@sema-agent/core
Version:
Stateless, task-oriented AI agent core
21 lines (20 loc) • 1.45 kB
TypeScript
/**
* The permission-rule WRITE-FACE contract: what every backend behind `PermissionRuleWriter.apply` owes
* its caller. The sibling kit (`permission-rule-sync-contract.ts`) pins the pure JOIN; this one pins the
* DOOR it arrives through. A delta is DATA — a foreign caller, a replayed record, a deserialized join —
* so "the type system says it cannot happen" is not an answer a door may give, and a kind outside the
* union must be refused rather than folded as whichever arm a dispatch chain happens to end with. The
* positive control rides the same run on purpose: a backend that throws at everything refuses the
* unnamed kind too, so a suite without the control proves nothing.
*
* KIT form: vitest-free (`node:assert`), runner seam via {@link ContractAssertionRunner}, no skip hook.
*/
import type { WritableDurableRulePartition } from "../permission-rule-store.js";
import { type ContractAssertionRunner } from "./contract-harness.js";
export interface PermissionRuleWriteContractHooks {
/** Open ONE fresh, EMPTY partition with a write face — once per case; teardown stays with the caller. */
make: () => WritableDurableRulePartition | Promise<WritableDurableRulePartition>;
runAssertion?: ContractAssertionRunner;
}
/** Run the full conformance suite. Throws (assert) on the first violated clause. */
export declare function permissionRuleWriteContract(hooks: PermissionRuleWriteContractHooks): Promise<void>;