UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

39 lines (38 loc) • 2.41 kB
import type { ToolDetachHub } from "../tool-detach.js"; import type { TaskStream } from "../types.js"; import type { CaptureOptOutRef, LiveHandle, ManualCompactRef, McpRedialRef, NotifyRef, TaskStreamLiveSeat } from "./contracts.js"; export interface StreamLifecycleVerbsInput { /** borrowed-readonly — the stream's live state: `resultValue` (the finished-task refusals) and `handle`, read at each call. */ live: TaskStreamLiveSeat; /** borrowed-readonly — the readiness promise the four async verbs await before they touch the handle. */ ready: Promise<LiveHandle | undefined>; /** borrowed-readonly — the driver's timeout race: a wedged prepare cannot hang a verb on `ready`. */ orTimeout: <T>(p: Promise<T>) => Promise<T | undefined>; /** borrowed-readonly — the driver's typed steering refusal (`steering.not_running` by default); the opt-out and compact verbs share it. */ steeringError: (msg: string, code?: string) => Error; /** borrowed-readonly — the notify bridge; `inject` is bound by the run body once the notification lane exists. */ notifyRef: NotifyRef; /** borrowed-readonly — the capture opt-out bridge; `flip` is bound by the run body when a memory session mounted. */ captureOptOutRef: CaptureOptOutRef; /** borrowed-readonly — the MCP re-dial bridge; `redial` is bound by the run body when the leg declared MCP servers. */ mcpRedialRef: McpRedialRef; /** borrowed-mutable — the manual-compaction request seat: the compact verb arms it and parks its waiter here. */ manualCompactRef: ManualCompactRef; /** borrowed-readonly — the run-local detach hub the detach verb requests through. */ detachHub: ToolDetachHub; } export interface StreamLifecycleVerbsResult { /** The stream's `notify` verb. */ notify: TaskStream["notify"]; /** The stream's `optOutMemoryCapture` verb. */ optOutMemoryCapture: TaskStream["optOutMemoryCapture"]; /** The stream's `reconnectMcpServer` verb. */ reconnectMcpServer: TaskStream["reconnectMcpServer"]; /** The stream's `compact` verb. */ compact: TaskStream["compact"]; /** The stream's `detach` verb. */ detach: TaskStream["detach"]; /** The stream's `interrupt` verb. */ interrupt: TaskStream["interrupt"]; } export declare function streamLifecycleVerbs(input: StreamLifecycleVerbsInput): StreamLifecycleVerbsResult;