agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
53 lines • 3.06 kB
TypeScript
/**
* Skill-body ↔ tool-contract consistency check (Proposal 009, Tier 1).
*
* A skill's `body` (prose injected into the system prompt) can quietly contradict
* the tools it actually unlocks, and the model then **refuses a tool that is right
* there** — or is told about one it can't call. The library already knows each
* skill's real tool set (`inject.tools`), so it can flag the mismatch at authoring
* time instead of at run time.
*
* Tier 1 is DETERMINISTIC (no LLM): pure string + schema checks. The semantic
* contradictions it can't see — e.g. "the body calls an OPTIONAL arg required" —
* are Tier 2 (LLM-advisory, opt-in). Both checks here are WARNINGS, never errors:
* a body naming a foreign tool is often an intentional `read_skill` handoff hint.
*/
import type { Injection } from './types.js';
import type { GraphProblem } from './skillGraphCheckup.js';
/** The tool names a skill unlocks (`inject.tools[].schema.name`). */
export declare function skillToolNames(skill: Injection): readonly string[];
/**
* Tools that are callable from EVERY skill — the agent's baseline (`.tool()` /
* `.tools()` registrations, an always-on `ToolProvider`). Both checks below need
* them, and need them differently, which is why they are a third set rather than
* more entries in `knownToolNames` (8.7.0):
*
* • `body-unknown-tool` must treat them as KNOWN — `lookup_order(id)` in a body is
* not a typo when the agent really registers `lookup_order`;
* • `body-foreign-tool` must EXCLUDE them — that check means "a tool that belongs
* to another skill and is therefore not callable here", and a baseline tool is
* callable here. Folding them into `knownToolNames` alone would have swapped one
* false warning for another.
*/
export interface SkillContractOptions {
/**
* Tool names the agent exposes to every skill (`.tool()`, `.tools()`, a baseline
* provider). Pass `agent`-level names when checking a graph whose skills rely on
* them: `graph.checkup({ knownTools: ['lookup_order'] })`.
*/
readonly knownTools?: readonly string[];
}
/**
* Check ONE skill's body against its tool contract. Pure + side-effect-free.
*
* @param skill the skill to check
* @param knownToolNames every tool name reachable in the wider graph/agent (lets
* the check tell a cross-skill HANDOFF from a typo). Omit to
* check a skill in isolation (only its own tools are "known").
* @param options `knownTools` — baseline tools callable from every skill.
* See {@link SkillContractOptions}.
*/
export declare function checkSkillContract(skill: Injection, knownToolNames?: ReadonlySet<string>, options?: SkillContractOptions): GraphProblem[];
/** Run the contract check across many skills with a shared known-tool set. Pure. */
export declare function checkSkillContracts(skills: readonly Injection[], options?: SkillContractOptions): GraphProblem[];
//# sourceMappingURL=skillContract.d.ts.map