agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
68 lines • 3.2 kB
TypeScript
/**
* apply — the pure half of applying a recipe.
*
* Pattern: policy resolution + the sentences the applier raises. Pure, so
* every refusal can be read and tested without building an agent.
* Role: recipes/ layer. `AgentBuilder.recipe()` is the only caller; it owns
* the mutation, this file owns the words.
* Emits: N/A.
*/
import { type RecipeSource } from './provenance.js';
import type { AppliedRecipe, RecipeConflictPolicy } from './types.js';
/**
* Resolve the conflict policy, or refuse the requested one BY NAME.
*
* The three a reader reaches for are named in the refusal because each is a
* real design and none is implemented: every one of them has to answer where
* the dropped registration is RECORDED, and until it does, running it as
* `'error'`'s quiet cousin would be the accepted-and-silently-wrong shape this
* library refuses. So the unimplemented policy is refused rather than
* approximated by the one that ships.
*/
export declare function resolveRecipeConflictPolicy(value: unknown, callSite: string): RecipeConflictPolicy;
/**
* The refusal for a name two sources both registered.
*
* Raised only when at least one side came from a recipe. A collision between
* two direct builder calls keeps the sentence it has always had — the message
* an app already reads in its tests should not change because a feature it does
* not use shipped.
*
* `what` is the word the reader uses (`'tool name'` / `'injection id'`);
* `existing` is who registered it first and `incoming` who is registering it
* now, either of which may be `undefined` for the unattributed case;
* `callSite` is the API being called, e.g. `Agent.tool()`.
*/
export declare function duplicateRegistrationRefusal(params: {
readonly what: 'tool name' | 'injection id';
readonly name: string;
readonly existing: RecipeSource | undefined;
readonly incoming: RecipeSource | undefined;
readonly callSite: string;
}): string;
/** The refusal for one composition applied twice to one agent. */
export declare function duplicateRecipeRefusal(params: {
readonly existing: AppliedRecipe;
readonly incoming: AppliedRecipe;
readonly callSite: string;
}): string;
/**
* The refusal for a recipe that applies ITSELF, directly or through another.
*
* A SEPARATE sentence from {@link duplicateRecipeRefusal}, because these are two
* different facts and the fix is different for each: "already applied" means the
* chain names one composition twice, and "currently applying" means the
* composition is its own ancestor and would never terminate. Telling the author
* their recursion is a duplicate would send them to look at the wrong line.
*
* `stack` is the application chain, outermost first, so the message can show the
* cycle rather than assert one.
*/
export declare function recursiveRecipeRefusal(params: {
readonly stack: readonly AppliedRecipe[];
readonly incoming: AppliedRecipe;
readonly callSite: string;
}): string;
/** The refusal for `configure` returning a promise. */
export declare function asyncConfigureRefusal(recipe: AppliedRecipe, callSite: string): string;
//# sourceMappingURL=apply.d.ts.map