@sema-agent/core
Version:
Stateless, task-oriented AI agent core
28 lines (27 loc) • 1.94 kB
TypeScript
/**
* The TaskStream façade's PERMISSION-MODE verb: `setPermissionMode` — the one entrance a running leg's mode changes
* through (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).
*/
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 seat rides 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"];
}
export declare function streamModeVerb(input: StreamModeVerbInput): StreamModeVerbResult;