UNPKG

agentfootprint

Version:

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

42 lines • 2.29 kB
/** * composedCoverage — the coverage row the LIBRARY composes for one call of a * tool that declares its search (`Tool.search`). * * Pattern: one row type, read by the claim checker. Pure data; TYPE-only * imports, and one type guard. * Role: the contract between the dispatch funnel that writes the row * (`../../core/agent/stages/toolCalls.ts` · `declareCoverage`, via * `search/compose.ts`) and every reader that judges a "not found", * "none" or "the full list" against it. * Emits: N/A. * * ## Why the library writes it, not the tool * * A tool author's prose about what a search covered is unreliable: a * registered study found that a note overstating what was checked made the * model's replies WORSE. So the tool declares, once and as typed data, what a * search is made of, and the library composes each call's row from the * arguments the call actually ran with. Composition can only under-claim, * relative to a TRUE declaration (one that misdescribes its query is the * trusted base, said out loud): a * facet enters `checked` from a value the call sent, a declared default composed * as if sent, a declared fixed qualifier, the declared (or sent) source or a * host-filled identity key — and every classified argument none of those * covers is a bearing gap. The subject is an item too (`facet: 'subject'`): * the statement a checker writes from the row alone names it. * * ## The fields, as revision 5 of the design names them (§ 3.2) * * The row is a {@link DeclaredCoverage} — the same row `coverageDeclared` * holds for every tool — with these fields more: `composed`, `resultId`, typed * `checked` items, `complete` and `gaps` (and `overclaim`, written by the * dispatch-time overclaim check of a later release). Its `notChecked` and `cannotCover` * lists stay the plain-prose view every older reader (the limits block, the * answer account) already prints: the gaps' `what` / `why`, with no facet. */ /** Whether a `coverageDeclared` row was composed by the library from a `search`. */ export function isComposedCoverage(row) { const r = row; return (r.composed === 'local' || r.composed === 'remote') && Array.isArray(r.gaps); } //# sourceMappingURL=composedCoverage.js.map