@sema-agent/core
Version:
Stateless, task-oriented AI agent core
26 lines (25 loc) • 1.61 kB
TypeScript
import { type TaskStream } from "../types.js";
import type { LiveHandle, RunnerDepsSeat, TaskStreamLiveSeat } from "./contracts.js";
export interface StreamHaltVerbsInput {
/** borrowed-readonly — the stream's live state: `resultValue` (the finished-task refusal, the liveness tests) and `handle`. */
live: TaskStreamLiveSeat;
/** borrowed-readonly — the readiness promise; halt and destroy resolve the handle through it while the run body has not published one. */
ready: Promise<LiveHandle | undefined>;
/** borrowed-readonly — the driver's timeout race, used for the readiness wait and for destroy's wait on the run's settle. */
orTimeout: <T>(p: Promise<T>) => Promise<T | undefined>;
/** borrowed-readonly — the readiness bound in ms; the halt's birth-window poll reads it. */
readyTimeoutMs: number;
/** borrowed-readonly — the run promise: `destroy` awaits its settle (bounded) before reaping. */
run: Promise<void>;
/** borrowed-readonly — the reap lane's step, run after the run settled (the suspended-run env + checkpoint reap). */
reapSuspended: () => Promise<void>;
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`onNotice`, after the readiness await). */
runner: RunnerDepsSeat;
}
export interface StreamHaltVerbsResult {
/** The stream's `halt` verb. */
halt: TaskStream["halt"];
/** The stream's `destroy` verb (idempotent at the promise level; never throws). */
destroy: TaskStream["destroy"];
}
export declare function streamHaltVerbs(input: StreamHaltVerbsInput): StreamHaltVerbsResult;