UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

32 lines (31 loc) • 2.02 kB
/** * The resume ladder's APPROVAL-LANE capture and binding rung (E4), verbatim from * `Runner.resumeStream`: on a human / irreversible_ask row every deployment-supplied field of the * `policy_ask` decide is read exactly once into a plain twin (answer canonicalized, updatedInput cloned to the * JSON domain, the decision word, the refused keys, the host's decision facts and attribution, the deny note), * then the decision-action binding (boundCallId, boundInputHash by version), the env_failed replay guard and * the content-ask answer binding. Synchronous; every refusal throws pre-CAS. */ import { type QuestionAnswer } from "../ask-question.js"; import { type Checkpoint, type ResumeOutcome } from "../checkpoint-store.js"; import type { ResumeTaskConfig, RunnerDepsSeat } from "./contracts.js"; export interface ResumePolicyOutcomeInput { /** borrowed-readonly — the pending row (the lane is keyed on the STORED gate kind; the binding reads its pending call). */ cp: Checkpoint; /** borrowed-readonly — the caller's outcome; each policy field is read exactly once, into the twin. */ outcome: ResumeOutcome; /** borrowed-readonly — the config snapshot; the answer binding reads its `onQuestion` face. */ config: ResumeTaskConfig; /** borrowed-readonly — the Runner's deployment deps, read LIVE through the Runner (the answer binding falls back to `onQuestion`); the one home of why it is a * seat and not a captured object is {@link RunnerDepsSeat}. */ runner: RunnerDepsSeat; } export interface ResumePolicyOutcomeResult { /** The approval lane's plain twin (a human / irreversible_ask row), else undefined. */ plainPolicyOutcome: Extract<ResumeOutcome, { gate: "policy_ask"; }> | undefined; /** The decide's content-ask answer in canonical form (present only when one was carried). */ redeemedAnswer: QuestionAnswer | undefined; } export declare function resumePolicyOutcome(input: ResumePolicyOutcomeInput): ResumePolicyOutcomeResult;