agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
38 lines (37 loc) • 2.21 kB
TypeScript
/**
* resolve — which reads a PROSE claim names (design § 5.2): by the entity each call was SENT
* for (its `resolved` id, name and aliases — store data never binds another entity's name), or,
* for a search with no population, by its `source.said` words.
*
* Pattern: mentions are token runs of the unit that hold a name by the library's one name rule
* (`lib/normalize.ts` · `sameName`: `Payments` is `payments`, `ARRAY-X9` is not
* `array-x9`); a mention joined to another word by "or",
* "and", "nor" or a comma is a second entity, and an entity no read resolves makes the
* whole claim `entity-unresolved` — "payments or checkout" with one searched cannot pass
* as checked. The reads a claim RESTS ON are this turn's reads (any leg) of a resolved
* entity whose tool's `subject.said` word the unit names; a call on the same entity and
* another subject is never pulled in. A claim naming no entity is unresolved; the
* person's message and the single call of the turn only name a CANDIDATE.
* Role: integrity/ layer (L3), read by `prose.ts`.
*/
import type { DetectedClaim } from './detect.js';
import type { StaleSince, TurnCall, TurnRecord } from './types.js';
import type { ProseWorkBudget } from './work.js';
/** The reads of one entity a claim names. */
export interface EntityGroup {
readonly status: 'resolved' | 'stale' | 'subject-unmatched';
/** For `resolved`: the reads the claim rests on. Otherwise the reads that named the entity. */
readonly calls: readonly TurnCall[];
readonly staleSince?: StaleSince;
}
export type ProseResolution = {
readonly status: 'groups';
readonly groups: readonly EntityGroup[];
} | {
readonly status: 'entity-unresolved';
readonly candidates: readonly string[];
};
/** The calls of the answer's turn, in this recording. */
export declare function isCurrent(call: TurnCall, record: TurnRecord): boolean;
/** The reads a prose claim resolves to, grouped by entity. */
export declare function resolveProseClaim(claim: DetectedClaim, text: string, record: TurnRecord, personMessage?: string, work?: ProseWorkBudget): ProseResolution;