UNPKG

agentfootprint

Version:

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

41 lines • 2.23 kB
/** * `accountForAnswer` — one answer's recording (+ what the app declared) in, a * typed account out. A pure read-time Fold over the Trace: no clock, network, * model or randomness; the same inputs give the same bytes. It never writes * back into the run. * * It throws ONLY on a caller error (a recording that is not an object, * declarations that break their rules). Content it cannot read is passed over * and counted (`unread`); a line whose fill fails becomes `unreadable.line@1`. */ import type { Recording } from '../recorders/observability/recordRun.js'; import type { AnswerAccount, AnswerAccountDeclarations } from './types.js'; import { type AccountInternals } from './facts/common.js'; export interface AccountOptions { /** The stored artifact's `meta.origin.runId`, when the caller has it — preferred over the recording's own. */ readonly runId?: string; } /** The answer text the account carries (the PDF folds at 1,200); the rest is in the record. */ export declare const MAX_ANSWER_CHARS = 4000; /** @internal — the account with test hooks (`failTemplate`). The public door is `accountForAnswer`. */ export declare function buildAccount(recording: unknown, declarations: AnswerAccountDeclarations | undefined, options: AccountOptions | undefined, internals?: AccountInternals): AnswerAccount; /** * Explain one answer from its recording. * * @param recording the answer's recording — `{ snapshot, events, structure }` (`recordRun`). * @param declarations what the APP declares when the report is made (skill labels, `rowsAt`); * everything filled from it is vouched `app`. * @param options `runId` — the stored artifact's `meta.origin.runId`, when known. * * @example * ```ts * import { accountForAnswer } from 'agentfootprint/observe'; * * const account = accountForAnswer(recording, { tools: { lookup_volumes: { rowsAt: 'volumes' } } }); * account.summary.sentence.text; // "Nothing this report looks for turned up in the record." * ``` */ export declare function accountForAnswer(recording: Recording, declarations?: AnswerAccountDeclarations, options?: { readonly runId?: string; }): AnswerAccount; //# sourceMappingURL=account.d.ts.map