agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
44 lines • 2.1 kB
TypeScript
/**
* applyCachePolicy — internal helper for injection factories.
*
* The injection factories (`defineSkill`, `defineSteering`, `defineFact`,
* `defineInstruction`) call this to merge the
* consumer-supplied `cache` option with the flavor-specific default.
* The merged policy lands in `Injection.metadata.cache` for the
* CacheDecision subflow (Phase 4) to read back.
*
* Why it lives in src/cache/ (not co-located with each factory):
* - Single source of truth for per-flavor defaults
* - Tests for the defaults live in one place (test/cache/)
* - Adding a new factory means adding one entry to the map below;
* not duplicating the default-resolution logic five times
*/
import type { CachePolicy } from './types.js';
/**
* Per-flavor default `cache` values when consumer doesn't specify.
* These match the documentation in `CachePolicy`'s JSDoc — keep
* synchronized.
*/
declare const FLAVOR_DEFAULTS: Readonly<Record<string, CachePolicy>>;
/**
* Resolve the effective `cache` policy for an injection.
*
* @param flavor - The injection flavor (drives the default if `consumerValue` undefined)
* @param consumerValue - What the consumer wrote in `cache:` (or undefined)
* @returns The effective CachePolicy. Always defined.
*/
export declare function resolveCachePolicy(flavor: keyof typeof FLAVOR_DEFAULTS | string, consumerValue: CachePolicy | undefined): CachePolicy;
/** Preserve whether the caller supplied the policy before resolving its
* flavor default. Only configuration metadata; never projected into a request. */
export declare function cachePolicyMetadata(flavor: string, consumerValue: CachePolicy | undefined): {
readonly cache: CachePolicy;
readonly cachePolicySource: 'explicit' | 'default';
};
/**
* Read-only access to the per-flavor default table. Exported for
* tests asserting the documented defaults are wired correctly. Not
* intended for runtime use — callers should use `resolveCachePolicy`.
*/
export declare function getFlavorDefault(flavor: string): CachePolicy;
export {};
//# sourceMappingURL=applyCachePolicy.d.ts.map