UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

34 lines (33 loc) • 2.15 kB
/** * design/182 §11 — the permission-rule sync JOIN contract: the cross-repo acceptance suite the * server-side twin runs against its own merge implementation (design/182 §13 obligation ②: consume * core's `joinRuleStates`, or pass THIS suite against your reimplementation — semantic identity is the * contract, not code sharing). * * KIT form (design/159 S1): vitest-free (`node:assert`), runner seam via {@link ContractAssertionRunner}, * version lockstep via `CONTRACT_KIT_ENGINE_VERSION`. There is NO skip hook — every case is mandatory, * so a passing run never means "most of it passed". Fixtures are built inline: the join is a pure * function, so there is nothing to seed and no instance lifecycle. * * What is asserted: the semilattice laws (idempotent/commutative/associative — the convergence proof * itself, not prose), the design's convergence-matrix grids (M1-M13), the tombstone-union rule, the * metadata re-projection refusal, the state vector and the paired frontier collection. Content * assertions are set-based, never order-based: a twin with a different canonical output order passes, * a twin that loses or invents a dot does not. */ import type { RuleSyncFrontier, RuleSyncState } from "../permission-rule-store.js"; import { type ContractAssertionRunner } from "./contract-harness.js"; export interface PermissionRuleSyncContractHooks { /** The merge under test. Default: core's own `joinRuleStates` (self-verification). */ join?: (a: RuleSyncState, b: RuleSyncState) => RuleSyncState; /** The paired-collection arm under test. Default: core's `collectBelowFrontier`. */ collect?: (state: RuleSyncState, frontier: RuleSyncFrontier) => { state: RuleSyncState; collectedTombstones: number; }; /** The state vector under test. Default: core's `ruleSyncVector`. */ vector?: (state: RuleSyncState) => RuleSyncFrontier; runAssertion?: ContractAssertionRunner; } /** Run the full conformance suite. Throws (assert) on the first violated clause. */ export declare function permissionRuleSyncContract(hooks?: PermissionRuleSyncContractHooks): Promise<void>;