UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

29 lines (28 loc) • 1.71 kB
/** * The fail-fast RECORD and the one error it becomes. * * The reliability loop (`core/agent/stages/reliabilityExecution.ts · failFast`) * ends a run by writing this record and breaking. Whoever owns the run's * outcome turns it into `ReliabilityFailFastError`: the agent's own run * boundary (`Agent · finalizeResult`), or a composition the agent runs inside * (`core-flow/childFailFast.ts`). Every chart boundary between the two carries * the record across — a record left behind a boundary is a run that ends * "successfully" with no answer. */ import type { AgentState } from '../core/agent/types.js'; import { ReliabilityFailFastError } from './types.js'; /** The keys of the record, listed once and checked against `AgentState`. */ export declare const RELIABILITY_FAIL_KEYS: readonly ["reliabilityFailKind", "reliabilityFailPayload", "reliabilityFailReason", "reliabilityFailCauseMessage", "reliabilityFailCauseName"]; /** The fail-fast record as a state holds it. */ export type ReliabilityFailRecord = Pick<AgentState, (typeof RELIABILITY_FAIL_KEYS)[number]>; /** * The fail-fast record a state holds: its present keys, or nothing when no * fail-fast fired — so a boundary that spreads it crosses no new key otherwise. */ export declare function failFastRecordOf(state: Readonly<Record<string, unknown>>): ReliabilityFailRecord | undefined; /** * The error a fail-fast record becomes. The cause is rebuilt from the message * and name the record keeps — an `Error` does not survive the state's * `structuredClone`, so the record never held the original. */ export declare function failFastErrorOf(record: ReliabilityFailRecord, snapshot?: unknown): ReliabilityFailFastError;