UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

40 lines (39 loc) • 2.96 kB
import { terminalProjection } from "../core/runner/terminal-projection.js"; import type { TerminalFailureDetail } from "../core/terminal-cause.js"; import type { TerminalCause } from "../core/types.js"; import { type Egress } from "../core/untrusted-egress.js"; /** A child run's failure words can carry a credential: every parent-facing reader takes them from here, each through the * `same-principal` tier, before any field bound can clip a token — a settled cause's projection, a rejected run's text, and * its thrown value (every string member, not the message alone). */ export declare const childTerminalFace: (terminal: TerminalCause) => ReturnType<typeof terminalProjection>; export declare const childThrownText: (err: unknown) => Egress<"same-principal">; /** A delegated child's failure code, read once per failure: the failure account's `code` and the `detail` of the same link (one * walk of the thrown value's `cause` chain, the walk a failed terminal reads), and the string `errorKind` the thrower declared. A * settled child has no thrown value: its account is `{ code: terminal.code }`. */ export interface ChildFailure { readonly code?: string; readonly errorKind?: string; readonly detail?: TerminalFailureDetail; } export declare function childFailureOf(err: unknown): ChildFailure; /** A rejected child run, read once: the sentence its faces carry and its failure account. */ export interface RejectedChild { readonly text: Egress<"same-principal">; readonly failure: ChildFailure; } export declare const rejectedChildOf: (err: unknown) => RejectedChild; /** The ROW face of a child's failure — a background row, its notice and poll, a parked resume's cause: the code as it stands * (a platform's word too: the host's own redaction, counting and alerts read the original), else the declared kind. */ export declare const childRowCode: (f: ChildFailure) => string | undefined; /** The ANSWER face of a child's failure — a tool result the parent's model and frame read: the account's code when it is an * engine word, else the declared kind. Only the account's item is screened: a declared `errorKind` is the thrower's * statement, lifted as declared, the way every tool's is. */ export declare const childAnswerCode: (f: ChildFailure) => string | undefined; /** * A rejected child run's thrown value, as the parent's tool layer receives it: the `same-principal` snapshot (every own member * kept), with its `details.code` set to the answer face's account item — the engine word of its failure account, or no `code` * member at all. The snapshot is what is read, so the thrown value is read once and the answer describes the copy the parent * receives (a member that serializes itself is read as the copy reads it). Its `errorKind` stands, so the frame's lift * (`details.code`, else `errorKind`) answers {@link childAnswerCode}. */ export declare const childRejection: (err: unknown) => unknown;