UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

31 lines (30 loc) • 1.74 kB
import type { ReasoningWireFacts } from "../../brain/reasoning.js"; import { type ExtraBodyDroppedSeatInput } from "./extra-body-dropped-seat.js"; import type { PushQueue } from "../push-queue.js"; import type { TaskEvent } from "../types.js"; import type { RunInternals, RunState } from "./contracts.js"; export interface RunBrainSinksInput { /** borrowed-mutable — the run's event queue: the `status` frames. */ queue: PushQueue<TaskEvent>; /** borrowed-readonly — the trusted run-scoped channel: `onStatusEvent` (the second sink). */ internals: RunInternals | undefined; /** borrowed-readonly — the run's mutable state, read for the telemetry frames' tracer and task id. */ rs: RunState; /** borrowed-readonly — the run's event-identity mint (stamped on every status frame). */ ident: () => { eventId: string; parentToolCallId?: string; sourceTaskId?: string; }; /** borrowed-readonly — the reasoning lane's wire-facts consumer, the third sink the composition installs. */ observeReasoningWireFacts: (facts: ReasoningWireFacts) => void; /** borrowed-readonly — the notice sink and the leg's ids; the fourth and fifth sinks' announcers are minted from them. */ notice: ExtraBodyDroppedSeatInput; } export interface RunBrainSinksResult { /** Compose the three brain ALS sinks around a brain-driving call. */ withBrainSinks: <T>(fn: () => Promise<T>) => Promise<T>; /** Compose the two leg-wide request sinks (the extraBody strip, the credential-origin refusal) around the whole leg. */ withLegRequestSinks: <T>(fn: () => Promise<T>) => Promise<T>; } export declare function runBrainSinks(input: RunBrainSinksInput): RunBrainSinksResult;