UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

36 lines (35 loc) • 2.33 kB
/** * Halt attribution, the consumer half: the ONE predicate that turns the harness's * consumption statement ({@link HaltConsumption}) into the result's `haltedByUser` seat, and the disclosure * for the halt that was accepted but never consumed. Both readers of the statement live here so the law * has one spelling: signed ⇔ consumed; unconsumed ⇔ absent + `task.halt_unconsumed`. */ import type { HaltConsumption } from "../../internal/harness.js"; import { type RunnerDeps } from "../types.js"; /** * The attribution law: `haltedByUser` ⇔ the halt was CONSUMED by the machinery — its cut settled a turn (the * loop's report, stamped `"halt"` at the seat's abort) OR its stop request was among the sources a boundary * consult stopped the loop for. A halt merely ACCEPTED (latched, receipt answered) while the run ended for its * own reason is not consumed and never signs (fail-closed: rather absent than guessed). */ export declare function haltConsumed(c: HaltConsumption | undefined): boolean; export interface UnconsumedHaltDisclosureInput { /** The verb's acceptance fact (`loopLatch.userHalted`): a halt was latched on this run. */ accepted: boolean; /** The harness's statement, read after the prompt settled. */ consumption: HaltConsumption | undefined; onNotice: RunnerDeps["onNotice"]; sessionId: string; runId: string; taskId: string | undefined; } /** * The ACCEPTED-but-UNCONSUMED halt: the verb latched the stop (and may have cut a seat), but the run ended for * its own reason before the machinery consumed it — no settlement took the halt's cut as its cause and no * boundary consult stopped the loop for it (a brain minting its own `aborted` final, a natural completion past * the final commit point, an approval park whose commit won the race). The result reads the run's own terminal * without `haltedByUser`; this notice is the halt's trace — the same code the verb mints on its own arm (a halt * refused by an already-owned ending), one fact with one spelling, the two mint points disjoint: the verb arm mints * only while NO halt has been accepted on the run; once one was, this arm alone speaks. One per such run. Returns whether it was minted. */ export declare function discloseUnconsumedHalt(input: UnconsumedHaltDisclosureInput): boolean;