@sema-agent/core
Version:
Stateless, task-oriented AI agent core
35 lines (34 loc) • 2.4 kB
TypeScript
/**
* The TaskStream façade's MODE verbs, each the one entrance a running leg's setting changes through:
*
* `setPermissionMode` (a shell's mode toggle, a serving layer's `permission_mode` control frame). ONE read of the argument at
* the wire boundary, the steer lane's liveness gate, then the leg's live mode seat: the requested word is rewritten, the
* fold against the deployment's deny bits and the classifier face is re-judged (a fold is announced by the seat), a
* leg that became `auto` arms its classifier, and the same three-member receipt the wiring manifest carries comes
* back — EVERY call answers one, whether or not the effective mode moved, so a caller never has to render
* optimistically. The next tool call reads the new mode at the gate's arbitration point; a child leg derives its own
* effective mode from this seat on its next read (no forwarding frame).
*
* `setFastMode` (a shell's fast-mode toggle): the same argument read and liveness gate, then the leg's fast mode — what it
* asks for is rewritten, a change is a toggle (it ends the session's cooldown; turning on forgets the models an endpoint
* refused), and the reading the wiring manifest carries comes back on every call. The next model request reads it.
*/
import type { TaskStream } from "../types.js";
import type { LiveHandle, TaskStreamLiveSeat } from "./contracts.js";
export interface StreamModeVerbInput {
/** borrowed-readonly — the stream's live state: `resultValue` (the finished-task refusal) and `handle` (the mode seats ride it). */
live: TaskStreamLiveSeat;
/** borrowed-readonly — the readiness promise the verb awaits before it touches the handle. */
ready: Promise<LiveHandle | undefined>;
/** borrowed-readonly — the driver's timeout race: a wedged prepare cannot hang the verb on `ready`. */
orTimeout: <T>(p: Promise<T>) => Promise<T | undefined>;
/** borrowed-readonly — the driver's refusal factory, the steer verb's own `steeringError` seat. */
steeringError: (msg: string, code?: string) => Error;
}
export interface StreamModeVerbResult {
/** The stream's `setPermissionMode` verb. */
setPermissionMode: TaskStream["setPermissionMode"];
/** The stream's `setFastMode` verb. */
setFastMode: TaskStream["setFastMode"];
}
export declare function streamModeVerb(input: StreamModeVerbInput): StreamModeVerbResult;