/** * read — the ONE recognizer the tool-dispatch loop calls. * * Pattern: one reader, every dispatch door (the `applyResultCeiling` * precedent). The batch loop and the credential/resume execute * boundary both call this at the moment a handler's return lands, so * a resumed call declares its coverage exactly as an inline one. * Role: core/ layer, pure. Recognition and normalization only — the caller * owns the events, the scope write and the delivered status. * Emits: N/A. * * Zero-cost when unused: two `typeof` checks and a key lookup for every * result that is neither shape, and `undefined` back. Nothing is emitted, * nothing is written, and the value the model reads is the value the tool * returned — byte for byte. */ import type { ToolResultStatus } from '../../../lib/injection-engine/toolOutcome.js'; import type { Coverage } from './types.js'; /** One coverage statement found in a result, before the caller stamps it with * the call it came from. */ export interface CoverageFacts { readonly kind: 'absence' | 'ledger'; readonly coverage: Coverage; /** Present for `'absence'` — what the search was for. */ readonly lookedFor?: string; } /** What one recognized result declares. `undefined` from * {@link readCoverageResult} means "neither shape": untouched path. */ export interface CoverageReading { /** * The status the framework DELIVERS for this call. `'absent'` when an * absence is in play — never `'failure'`, and that is the point: a status * of `'failure'` would route an honest empty answer down the same edge as * a broken collector, which is the exact confusion the primitive removes. * Undefined for a bare ledger — a ledger says nothing about the outcome, * only about its boundary. */ readonly status?: ToolResultStatus; /** In declaration order: the outer ledger first, then the absence it * wraps. Usually one entry; two only when an author bounded an absence. */ readonly declared: readonly CoverageFacts[]; } /** * Read one finalized tool result for coverage declarations. * * The two shapes compose: `coverage(absent({…}), {…})` is a search that found * nothing AND a boundary around the search, so both are declared and the * delivered status is still `'absent'` — the ledger bounds the answer, it * does not change what the answer was. */ export declare function readCoverageResult(value: unknown): CoverageReading | undefined;