agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
44 lines (43 loc) • 2.2 kB
TypeScript
/**
* invariant-violation at the WIRE seam — the composed frame and the
* serialized body disagree about what the model was shown.
*
* Pattern: pure function over two name lists; same algebra, new seam.
* Role: the check the compose seam CANNOT do. The recorded defect: the
* internal frame said a subsystem's tools were removed, and the
* adapter still serialized four schemas. Every check over the
* pre-serialization IR read a clean frame — the bug lived in the
* gap between the frame and the body. So the comparison here is
* IR against `LLMResponse.wireManifest`, the manifest an adapter
* reads back from the FINAL request body after every transform
* (adapters/llm/wireManifest.ts).
*
* BOTH DIRECTIONS are defects, distinguished in the message: a name on the
* wire the frame never composed (the recorded bug — the adapter retained or
* invented it) and a composed name that never crossed (the model was
* promised a capability it cannot call). One finding per direction, all
* offending names aboard, so ten leaked schemas are one defect, not ten.
*
* HONEST ABSENCE: an adapter that states no manifest leaves the request
* INCOMPARABLE — no finding, never a guess; the disposition for that call
* is `unreachable`, not `checked-pass`. An EMPTY manifest is a stated zero
* and compares normally.
*/
import type { ContextError } from '../finding/types.js';
/** The tool names the frame composed for THIS call, and where that was read. */
export interface ComposedTools {
readonly names: readonly string[];
readonly provenance: string;
}
/** The tool names the adapter says actually crossed, and which adapter said so. */
export interface ServedWire {
readonly names: readonly string[];
readonly provenance: string;
}
/**
* Compare one call's composed frame against its wire manifest.
*
* Returns findings (usually none). Equal sets — whatever the order or
* duplication — return nothing, which the caller files as `checked-pass`.
*/
export declare function wireViolationsOf(composed: ComposedTools, wire: ServedWire | undefined, epoch: number): readonly ContextError[];