@sema-agent/core
Version:
Stateless, task-oriented AI agent core
26 lines (25 loc) • 1.83 kB
TypeScript
/**
* Admission bookkeeping for HUMAN INPUTS accepted mid-run: the per-leg ordinal an accepted input is stamped
* with, and the acceptance frame's once-only seat. Two accepting arms share the ordinal — the stream's `steer`
* verb and the run body — which is why it is keyed on the leg's harness in a module-level WeakMap rather than
* held by either arm: one counter per leg, one ascending sequence across both. Also the stream verbs' typed
* refusal. (Whether a repeat under a used `inputId` is the same instruction is steer-replay.ts's one judgement,
* shared with the parked queue.)
*
* Run-loop machinery (layer 1), not a driven lane: nothing here takes an Input or hands back a Result, and
* nothing here reads host state. Named without the `run-` family prefix for that reason.
*/
import type { SteerReplayRefusalDetail } from "../steer-replay.js";
export declare function nextHumanInputSeq(key: object): number;
/** The identity keys a published `queued` frame carried beyond its own `eventId` (`parentToolCallId`, `sourceTaskId`): one fact, stated
* once by the frame's publisher and handed to whoever mints that input's other frames, so two frames of one input are never stamped
* by two computations. */
export type AcceptanceIdentity = {
parentToolCallId?: string;
sourceTaskId?: string;
};
export declare function armAcceptance(record: object, publish: () => AcceptanceIdentity): void;
export declare function announceAcceptance(record: object): AcceptanceIdentity | undefined;
/** The stream verbs' typed refusal: `cannot steer: <msg>`, `code` (`steering.not_running` by default), and the
* refusal's `detail` when the code carries one (`steering.duplicate_input_id` always does). */
export declare function steeringError(msg: string, code?: string, detail?: SteerReplayRefusalDetail): Error;