agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
55 lines • 2.93 kB
TypeScript
/**
* lazyTraceToolpack — the toolpack with LATE-BOUND artifacts.
*
* `traceToolpack(artifacts)` is a factory over FROZEN artifacts: it
* precomputes an index and even bakes step-id enums into tool schemas.
* That is right for the dedicated debugger (the run is already complete
* when you build it) — and wrong for `.selfExplain()`, where the tools
* are defined at Agent BUILD time but must read the agent's own *previous
* completed run*, which changes every turn.
*
* This wrapper splits the two lifetimes:
*
* - SCHEMAS are built once from an empty template (artifact-independent —
* no id enums, generic descriptions; the same shape `traceToolpack`
* itself produces past the enum cap), so the tools can be mounted on
* a skill before any run exists.
* - EXECUTION resolves `resolve()` per call, builds the REAL toolpack
* over the resolved artifacts (memoized by snapshot identity — one
* index per completed run, not per call), and delegates through
* `callTraceTool` so arg validation matches the eager path.
*
* When `resolve()` returns undefined (no completed run yet), every tool
* answers with an honest, model-visible message instead of throwing —
* the same #9 philosophy as the toolpack's unknown-id corrections.
*/
import type { Tool } from '../tools/tools.js';
import { NO_COMPLETED_RUN_MESSAGE } from '../lib/traceToolNames.js';
import type { TraceToolpackArtifacts, TraceToolpackOptions } from './types.js';
export { NO_COMPLETED_RUN_MESSAGE };
/**
* Model-visible answer when a tool MOUNTED on the catalog has no evidence
* to serve for this particular run.
*
* The lazy pack's shape is fixed at Agent BUILD time — the tool catalog and
* the builder's name reservation both need to know the list before any run
* exists — while an artifact bag's OPTIONAL parts (the narrative, the event
* tail) are decided per run. So a tool can be on the catalog with nothing
* behind it, and the honest move is to say which switch turns it back on
* rather than to answer emptily.
*/
export declare function missingArtifactMessage(toolName: string): string;
/**
* Build the toolpack with late-bound artifacts.
*
* The template is built over an artifact bag that declares EVERY optional
* part (an empty narrative, an empty event tail), so the lazy pack mounts
* the same tool list every time. That fixed list is what the Agent
* builder's name reservation and the tool catalog are both keyed on — a
* pack whose shape depended on a run that has not happened yet could not
* be reserved at build time. When a resolved run turns out not to carry
* one of those parts, the tool answers with
* {@link missingArtifactMessage} instead of quietly disappearing.
*/
export declare function lazyTraceToolpack(resolve: () => TraceToolpackArtifacts | undefined, options?: TraceToolpackOptions): Tool[];
//# sourceMappingURL=lazyToolpack.d.ts.map