UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

32 lines (31 loc) • 2.14 kB
import type { PushQueue } from "../push-queue.js"; import { type TaskEvent, type TaskSpec, type TaskStream } from "../types.js"; import type { LiveHandle, RunInternals, RunnerDepsSeat, TaskStreamLiveSeat } from "./contracts.js"; import { type SteerReplayRecord, type SteerReplayRefusalDetail } from "../steer-replay.js"; export interface StreamSteerVerbInput { /** borrowed-readonly — the task spec (`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, SteerReplayRecord>; /** 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; `detail` rides the error). */ steeringError: (msg: string, code?: string, detail?: SteerReplayRefusalDetail) => 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;