@sema-agent/core
Version:
Stateless, task-oriented AI agent core
44 lines (43 loc) • 2.91 kB
TypeScript
import type { PushQueue } from "../push-queue.js";
import { type DeliveryObligations } from "../task-notification.js";
import type { TaskEvent, TaskSpec } from "../types.js";
import type { Stats } from "./assemble-result.js";
import type { InstallingPhaseResult, Prepared, RunnerDepsSeat, RunState } from "./contracts.js";
import type { CallerStopGate } from "./caller-stop-gate.js";
/** A final-verification frame: the mark, then the message in the run's reading, inside the engine's marked shell (no
* newline after the open tag — the counter's probe reads the open tag and the mark as one run). */
export declare function finalVerificationFrame(which: "nudge" | "reentry", prepared: Pick<Prepared, "reminderMark" | "engineText">): string;
export interface RunStopAndFinalVerifyInput {
/** borrowed-readonly — the task spec: the hooks slot and the `finalVerification` opt-in. */
spec: TaskSpec;
/** borrowed-mutable — the leg's prepared seat: the stop gate is installed on its harness; the abort signal, the
* pause and halt holders, the output seat, the session, the hook bound and identity are read inside the gate. */
prepared: Prepared;
/** borrowed-mutable — the run's event queue: the injection echo frames. */
queue: PushQueue<TaskEvent>;
/** borrowed-mutable — the run's mutable state: the injection counter (`counters.finalVerifyInjections`) is bumped;
* the grounding latches, the write latch and the turn cap are read. */
rs: RunState;
/** borrowed-readonly — the run's usage counters, read by the headroom guards. */
stats: Stats;
/** borrowed-readonly — the run's event-identity mint (the echo frames). */
ident: () => {
eventId: string;
parentToolCallId?: string;
sourceTaskId?: string;
};
/** borrowed-readonly — the monotonic walltime deadline (the clock lane's), read by the budget fill. */
walltimeMonotonicDeadline: number | undefined;
/** borrowed-readonly — the terminal frames this leg's lane is still owed (the notification lane's book): a one-shot
* submission's ending waits on it. */
deliveryObligations: DeliveryObligations;
/** borrowed-readonly — the run's caller-stop gate the three stop verbs trip: a halt that arrives while the one-shot ending waits
* (no turn is in flight for it to cut) ends the wait, as an interrupt's abort does. */
callerStop: CallerStopGate;
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`hooks` at resolution, `onError` in the gate). */
runner: RunnerDepsSeat;
}
/** Nothing comes back: the gate is INSTALLED on the borrowed harness, and the seat's closures are read by it alone. */
export interface RunStopAndFinalVerifyResult extends InstallingPhaseResult {
}
export declare function runStopAndFinalVerify(input: RunStopAndFinalVerifyInput): RunStopAndFinalVerifyResult;