agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
54 lines (53 loc) • 2.89 kB
TypeScript
/**
* The two envelope RECOGNIZERS — a leaf: no imports but types.
*
* `absent.ts` mints an absence and `ledger.ts` a coverage ledger, and each owns
* its sentences; this file owns only the one question every reader asks of a
* finished value, "is this an absence?" / "is this a covered result?". It is
* split out so a post-hoc reader (the answer account, the one emptiness reader
* in `emptiness.ts`, the standing fold) can ask it without loading the mints'
* tool-name checks and refusal sentences. `absent.ts` and `ledger.ts` re-export
* these names, so every existing import keeps working.
*/
import type { CoveredResult, DeclaredCoveredResult, DeclaredToolAbsence, ToolAbsence } from './types.js';
/**
* The reserved key that makes an absence recognizable. Exported because tests,
* docs and any consumer inspecting a raw tool result match on it — and
* because a reserved word on the wire has to be nameable.
*/
export declare const ABSENCE_MARKER = "af_absent";
/**
* Recognize (or decline to recognize) a value as an absence — STRICT, and the
* strictness is the zero-cost guarantee. Only a plain object whose
* `af_absent` is exactly `true` and whose `checked` is a non-empty array
* qualifies; every other value any tool has ever returned takes the path it
* always took, byte for byte.
*
* `undefined` means "not an absence", never "a malformed one" — this library
* does not guess at a shape it did not mint.
*/
export declare function readAbsence(value: unknown): ToolAbsence | undefined;
/** The literal `absent({ checked: 'declared' })` mints in place of a list. */
export declare const DECLARED_CHECKED = "declared";
/**
* Recognize the envelope `absent({ checked: 'declared' })` mints — an absence
* whose coverage the tool's `search` declares, before the dispatch funnel
* composes it. STRICT like {@link readAbsence}: a plain object whose
* `af_absent` is exactly `true` and whose `checked` is exactly the literal.
* `readAbsence` never reads this shape, so a reader that predates it sees data.
*/
export declare function readDeclaredAbsence(value: unknown): DeclaredToolAbsence | undefined;
/** The reserved key that makes a ledger recognizable. */
export declare const COVERAGE_MARKER = "af_coverage";
/**
* Recognize (or decline to recognize) a value as a covered result. STRICT for
* the same reason `readAbsence` is: only a plain object carrying a plain
* `af_coverage` object AND a `result` key qualifies.
*/
export declare function readCoverageLedger(value: unknown): CoveredResult | undefined;
/**
* Recognize the envelope `coverage(rows, { checked: 'declared' })` mints — a
* ledger whose coverage the tool's `search` declares, before the dispatch
* funnel composes it. STRICT like {@link readCoverageLedger}.
*/
export declare function readDeclaredLedger(value: unknown): DeclaredCoveredResult | undefined;