import { type BackgroundAgentStore } from "../background-agent-store.js";
import { type ContractAssertionRunner } from "./contract-harness.js";
/**
 * design/159 — the cross-backend {@link BackgroundAgentStore} contract kit (vitest-free; see
 * `contract-harness.ts` for the runner seam and `contract-kit-version.ts` for version lockstep).
 * `make()` must return a FRESH, empty store each call; a store a case creates is closed (`close?.()`)
 * when the case ends, so a backend holding a file descriptor does not leak one per case.
 *
 * 为什么这个家族需要一份共跑资产:这个 store 的两个捆绑后端是逐方法手写的孪生实现,而本仓在它上面
 * 已经连续吃过四次「一份修了、另一份没修」——RB-60 / RB-74 / RB-87 / RB-111,其中 RB-87 与 RB-111
 * 是同一个 reap 重复计数缺陷在两个后端里分别被发现、相隔一个版本。REF-A3/REF-D18 之后共享形状收敛
 * 到了单一构造点,但**语义**仍然只由每个后端各自的测试看住;第三方后端更是完全在射程之外。这份
 * 试剂盒把语义变成全后端共跑的验收底线:任何后端在这里变红 = 该后端违约,**不许通过放宽契约让它
 * 变绿**。
 *
 * 断言只描述已落地的行为(权威文本 = `src/core/background-agent-store.ts` 的接口契约段),不引入
 * 任何新义务。
 *
 * 分层:
 * - 核心层 {@link backgroundAgentStoreContract}:每个后端都必须过。
 * - 可选能力层 {@link backgroundAgentStoreScopesContract}:只挂实现了可选方法 `listScopes` 的后端
 *   (接口把它标为可选——把它折进核心层就会变成「没实现的后端静默跳过」,而静默跳过正是假绿的
 *   来源)。两个捆绑后端都实现了它,都挂。
 */
/** 契约统一用的租户 scope(核心层的多租户用例会另外显式构造第二个)。 */
export declare const BACKGROUND_AGENT_CONTRACT_SCOPE = "tenant-A";
/**
 * The damaged-row clause's hooks (additive): `plantRow` leaves a row as a foreign writer (or an earlier engine) would — `raw`
 * stored under (handle, scope), past every write gate — and answers the store to read it from (a file backend reopens its
 * directory, since its replay is where a stored row is read). A backend with no bytes a foreign writer could damage declares
 * `unplantable` with the reason instead. Passing neither in a hooks object is refused.
 */
export interface BackgroundAgentStoreContractHooks {
    readonly plantRow?: (store: BackgroundAgentStore, key: {
        readonly handle: string;
        readonly scope: string;
    }, raw: unknown) => Promise<BackgroundAgentStore>;
    readonly unplantable?: string;
}
/**
 * 核心不变量层 —— 每个 {@link BackgroundAgentStore} 后端都必须过。With `hooks.plantRow`, also the damaged-row clause: a row whose
 * members do not read is listed as its handle and verdict, `get` / `update` refuse it in {@link BACKGROUND_AGENT_ROW_MALFORMED_CODE}
 * without handing back anything planted, a sweep leaves it, and deletion by its handle goes on.
 */
export declare function backgroundAgentStoreContract(mk: () => BackgroundAgentStore, runAssertion?: ContractAssertionRunner, hooks?: BackgroundAgentStoreContractHooks): Promise<void>;
/**
 * 可选能力层 —— 只挂实现了 {@link BackgroundAgentStore.listScopes} 的后端。接口把该方法标为可选
 * (一个把租户清单记在别处的部署可以省略它),所以它不能进核心层:核心层里的「没实现就跳过」等于
 * 给不合规后端发一张假绿通行证。两个捆绑后端都实现了它。
 */
export declare function backgroundAgentStoreScopesContract(mk: () => BackgroundAgentStore, runAssertion?: ContractAssertionRunner): Promise<void>;
