agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
61 lines (60 loc) • 2.93 kB
TypeScript
/**
* window/options — validate a window strategy's options ONCE, at build time.
*
* Pattern: Guard functions returning a resolved config.
* Role: core/ layer. Every message here takes a `label`, because the same
* option bag arrives through two doors — `.compaction({...})` and
* `summarizeOldest({...})` — and an error should name the door the
* caller actually used. One implementation, so the two doors can
* never drift into validating differently.
* Emits: N/A.
*
* Everything fails at `.build()`, never mid-run. A window policy that turns
* out to be nonsense on iteration 40 of a paid run is a policy that cost you
* money to discover.
*/
import type { CompactionOptions, CompactionRetention, ResolvedCompaction, SlidingWindowOptions, TokenBudgetOptions } from './types.js';
/** Default depth of the "never touch this" recent window. */
export declare const DEFAULT_KEEP_RECENT_TURNS = 6;
/**
* How many tools' most recent results the window holds beyond
* `keepRecentTurns` when nobody said (9.57.0). ON by default, at 2.
*
* On by default for the same reason 9.55.0's anchor is: the counterfactual to
* a pinned 5,800-character tool result is not 5,800 bytes saved, it is a
* fabricated id, a refusal, a wasted action out of a small budget, and the
* same 5,800 bytes fetched again. That is a correctness failure the framework
* caused, and those are fixed on by default.
*
* TWO rather than one because the ceiling is spent newest-first among STALE
* candidates: a one-word acknowledgement from an actuator the model has
* stopped using can occupy a slot ahead of an older load-bearing observation.
* Two slots absorb that. `false` or `0` switches the pin off entirely.
*/
export declare const DEFAULT_KEEP_LAST_TOOL_RESULTS = 2;
/**
* Validate the `keepLastToolResults` dial. Refused at construction, never
* mid-run — the house rule for every window option.
*/
export declare function requireKeepLastToolResults(value: unknown, label: string): void;
/**
* What happens to folded messages when nobody said. The originals ride with
* the conversation: losing them has to be a choice somebody typed, not a
* default they inherited.
*/
export declare const DEFAULT_RETENTION: CompactionRetention;
/**
* Validate `.compaction()` / `summarizeOldest()` options.
*
* @param label the door being used, so the error names it
*/
export declare function resolveCompactionOptions(options: CompactionOptions, label: string): ResolvedCompaction;
/** Validate `slidingWindow()` options. */
export declare function resolveSlidingWindowOptions(options: SlidingWindowOptions, label: string): {
readonly keepRecentTurns: number;
};
/** Validate `tokenBudget()` options. */
export declare function resolveTokenBudgetOptions(options: TokenBudgetOptions, label: string): {
readonly thresholdTokens: number;
readonly keepRecentTurns: number;
};