UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

34 lines (33 loc) • 2.83 kB
/** * `Runner.voidVerifierPause` — the verb that voids a verification gate's VERIFIER card: the card a verifier leg parks records * `CheckpointState.compositionLeg` with entry `verify`, and that recorded leg is what this verb reads, the same member a host * reads to tell a verifier's card from one its own run's resume reaches. One reading, one seat: a card that records no leg, or * another entry's, is refused before anything is settled (`resume.composition_mismatch`), so the verb never voids a card the * gate did not mint. * * Voiding = the settle every in-Runner terminal settle makes (`expireRowWithDuty`: the single-shot `expire` CAS — the row ends * `expired` exactly as an expiry leaves it — with the duty its win carries: the parked-constraint entry evicted, the paused env * this process holds destroyed) plus the one thing an expiry alone leaves behind: the verifier session's PIN, taken at the park * mint, is released here — the same end state the resumed run's terminal leaves (unpinned, not released: the transcript stays * the session store's to evict). Only the CAS winner unpins; a card another settler already took (a resume won, the reaper or * an earlier void expired it) answers `false` and its winner owns the unpin. An unpin that throws or does not settle is said on * `onError` and thrown (`checkpoint.void_unpin_failed`): the card IS voided, its session still pinned — never a silent `true`. */ import { type CheckpointToken } from "../checkpoint-store.js"; import type { SessionStore } from "../session.js"; import type { InheritedGate, RunnerDepsSeat, SuspendReap } from "./contracts.js"; import type { LocalClaims } from "./local-claims.js"; export interface VoidVerifierPauseInput { /** borrowed-readonly — the verifier card's token (`VerificationOutcome.verifierPause.checkpointToken`). */ token: CheckpointToken; /** borrowed-readonly — the Runner's deployment deps, read LIVE (the checkpoint store; `onError` for the bounded legs). */ runner: RunnerDepsSeat; /** borrowed-readonly — the Runner's session store: the card's session is unpinned on a win. */ sessions: SessionStore; /** borrowed-mutable — the Runner's same-Runner claims (this void's attempt opens and closes its own), parked-constraint registry and suspended-env reap handles. */ locallyClaimedTokens: LocalClaims; parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>; suspendedEnvReaps: Map<CheckpointToken, SuspendReap>; } /** Void the verifier card `token` names: `true` = this call voided it and unpinned its session, `false` = already settled (throws `checkpoint.void_unpin_failed` when voided but not unpinned). */ export declare function voidVerifierPause(input: VoidVerifierPauseInput): Promise<boolean>;