@sema-agent/core
Version:
Stateless, task-oriented AI agent core
27 lines (26 loc) • 1.77 kB
TypeScript
import type { CheckpointGate, CheckpointToken } from "../checkpoint-store.js";
import type { TaskResult, TaskStatus, TerminalCause } from "../types.js";
import type { UnstartedRowOutcome } from "../terminal-cause.js";
/** The plane words a {@link TerminalCause} reads as — one derivation, called by the faces that speak
* them. The paused arm's `status` is its gate kind's registry row (`suspended` for an approval,
* a resource slice or a platform pause; `needs_review` for a plan or dry-run review, which also
* carries the `review.pending` code the review consumers key on). */
export declare function terminalProjection(terminal: TerminalCause): {
status: TaskStatus;
errorCode?: string;
errorMessage?: string;
blockedReason?: string;
checkpointToken?: CheckpointToken;
checkpointId?: string;
checkpointGate?: CheckpointGate;
workspaceRestoreMode?: "snapshot" | "park_only";
};
/**
* A compensation that changes WHY a settled result ended (a resume leg's approval reopened / could not
* be reopened) amends the CAUSE — the one record there is. The code fills only an empty seat (the leg's
* own terminal code, when it had one, still names the ending); the message is extended, not replaced;
* the row's outcome is stated on its own member (`unstartedRow`), whatever the code says, and — on a row that is pending again — whether
* the same decision resumed again can succeed (`resumeAgainMayCure`, the failure's cause read by the one table; absent when the table
* has no answer: the row is not this run's).
*/
export declare function amendTerminal(result: TaskResult, code: string, unstartedRow: UnstartedRowOutcome, message: (prior: string | undefined) => string, resumeAgainMayCure: boolean | undefined): void;