UNPKG

agentfootprint

Version:

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

43 lines (42 loc) • 2.45 kB
/** * search/resultFacts — the two facts a search tool's RESULT states out loud: * `resolved` (the entity a population value resolved to) and `paging` (whether * there is a next page). * * Pattern: one rule set, two doors (the `readItemExtras` law). The mint * (`absent()`, `describedResult()`) THROWS a refusal at the line the * author wrote; the reader (any envelope, minted anywhere) DROPS a * malformed value — read, never repaired. * Role: semantics/ layer, pure. The same spelling on the wire and in code * (every key is one word). * Emits: N/A. * * Both are the tool's own claims, said out loud — the trusted base. Each can * only NARROW what the library composes: `resolved` attaches to the value the * call was sent for and to no other entity; `paging.next` that is not null is * a gap, and a first page is complete only with `next: null`. */ /** One population value, resolved — `{ argument, id, name?, aliases? }`. */ export interface ResolvedDeclaration { /** The population argument the value was sent as. */ readonly argument: string; readonly id: string; readonly name?: string; readonly aliases?: readonly string[]; } /** `{ next }` — `null` says there is no next page; a cursor or page number says there is. */ export interface PagingDeclaration { readonly next: string | number | null; } /** What is wrong with a `resolved` list, or `undefined` when it is fine. */ export declare function resolvedProblem(value: unknown): string | undefined; /** What is wrong with a `paging`, or `undefined` when it is fine. */ export declare function pagingProblem(value: unknown): string | undefined; /** The minted `resolved` — a copy — or `undefined` for none; THROWS a refusal when malformed. */ export declare function mintResolved(value: unknown): readonly ResolvedDeclaration[] | undefined; /** The minted `paging` — a copy — or `undefined` for none; THROWS a refusal when malformed. */ export declare function mintPaging(value: unknown): PagingDeclaration | undefined; /** A `resolved` read off an envelope — a copy, or `undefined` when absent or malformed. */ export declare function readResolved(value: unknown): readonly ResolvedDeclaration[] | undefined; /** A `paging` read off an envelope — a copy, or `undefined` when absent or malformed. */ export declare function readPaging(value: unknown): PagingDeclaration | undefined;