@sema-agent/core
Version:
Stateless, task-oriented AI agent core
31 lines (30 loc) • 2.02 kB
TypeScript
import type { PushQueue } from "../push-queue.js";
import { type TaskEvent, type TaskSpec, type TaskStream } from "../types.js";
import type { AcceptedSteerInput, LiveHandle, RunInternals, RunnerDepsSeat, TaskStreamLiveSeat } from "./contracts.js";
export interface StreamSteerVerbInput {
/** borrowed-readonly — the task spec (the hooks seat, `principal`, `taskId`). */
spec: TaskSpec;
/** borrowed-readonly — the trusted run-internals channel (the spawning tool id the ledger frame carries). */
internals: RunInternals | undefined;
/** borrowed-mutable — the stream's event queue: the `human_input` receipt is pushed here on acceptance. */
queue: PushQueue<TaskEvent>;
/** borrowed-mutable — this stream's accepted-input dedup domain (the SAME Map the driver clears when the run settles). */
acceptedSteerInputs: Map<string, AcceptedSteerInput>;
/** borrowed-readonly — the stream's live state: `resultValue` and `handle`, read at each liveness test. */
live: TaskStreamLiveSeat;
/** borrowed-readonly — the readiness promise (settles to the live handle, or `undefined` when the run ended first). */
ready: Promise<LiveHandle | undefined>;
/** borrowed-readonly — the driver's bounded race over a promise (the wedged-prepare guard). */
orTimeout: <T>(p: Promise<T>) => Promise<T | undefined>;
/** borrowed-readonly — the readiness bound in ms; the birth-window poll's deadline reads it too. */
readyTimeoutMs: number;
/** borrowed-readonly — the driver's typed steering refusal (`steering.not_running` by default). */
steeringError: (msg: string, code?: string) => Error;
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`hooks`, `onError`, `onNotice`, after awaits too). */
runner: RunnerDepsSeat;
}
export interface StreamSteerVerbResult {
/** The stream's `steer` verb. */
steer: TaskStream["steer"];
}
export declare function streamSteerVerb(input: StreamSteerVerbInput): StreamSteerVerbResult;