agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
53 lines • 2.63 kB
TypeScript
/**
* sliceToBacktrackTrace — serialize a footprintjs VARIABLE SLICE
* (`sliceToJSON(sliceForKey(...))` from `foottrace`) into the
* BacktrackTrace shape agentThinkingUI's <BacktrackView>/<BacktrackOverlay>
* renders.
*
* The sibling of {@link toBacktrackTrace}: that one maps a LOCALIZER REPORT
* (scored suspects, ablation verdicts); this one maps a STRUCTURAL SLICE —
* the exact dependency chain behind one variable, with no influence claims
* at all. Same board, honestly weaker chips:
*
* - `mode` is ALWAYS 'correlational' — a slice is exact STRUCTURE, but it
* never tested influence; the default modeLabel says exactly that.
* - every card is `upperBound: true` (the UI's hatched meter + star): the
* score is 1/(1+depth) — hop PROXIMITY, a deterministic layout aid, not
* evidence. The honesty lines state the formula so nobody reads it as
* influence.
* - slice honesty rides along verbatim: reads-coverage warning
* (readTracking off), truncation, per-node incomplete-sources counts,
* and honest ABSENCE — a missing slice renders an empty board whose
* honesty lines say why ('never written' → initial state / frozen args /
* closure), never a fabricated suspect.
*
* Pure mapping, no UI dependency, framework-agnostic JSON on both sides —
* the human and the LLM triage the SAME artifact (the parity loop: an agent
* emits this, a person confirms or overrides on the board).
*/
import type { SliceJSON } from 'foottrace';
import type { BacktrackTrace } from './toBacktrackTrace.js';
export interface SliceToBacktrackTraceOptions {
/** The visible outcome being questioned (the board's answer bubble). */
readonly answer: {
readonly text: string;
readonly label?: string;
readonly tone?: 'error' | 'question';
};
/** Headline question. Default: `Why is '<key>' what it is?`. */
readonly claim?: string;
/** How the anchor writer renders: rule diamond or LLM brain. Default 'rule'. */
readonly decidedAtKind?: 'llm' | 'rule';
/** Override the mode chip label. */
readonly modeLabel?: string;
readonly agent?: string;
readonly model?: string;
/** Max suspect cards. Default 6. The rest fold into one disclosed line. */
readonly maxSuspects?: number;
}
/**
* Serialize a variable slice for agentThinkingUI's BacktrackView. See the
* module doc — structural honesty is the whole design.
*/
export declare function sliceToBacktrackTrace(json: SliceJSON, opts: SliceToBacktrackTraceOptions): BacktrackTrace;
//# sourceMappingURL=sliceToBacktrackTrace.d.ts.map