UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

43 lines • 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cacheRequestedWithoutSupport = void 0; /** Build-time cache diagnostic. Never evaluates a policy predicate, reads * prompt text, or serializes a provider/options bag. The Agent calls once * at construction; the returned policy source becomes fixed run metadata. */ const footprintjs_1 = require("footprintjs"); function cacheRequestedWithoutSupport(args) { if (args.disabled || args.strategy.name !== 'none') return undefined; let requested = args.systemPrompt.length > 0 && args.systemPolicy !== 'never' ? args.systemExplicit ? 'explicit' : 'default' : undefined; for (const injection of args.injections) { if (!(injection.inject.systemPrompt?.length || injection.inject.messages?.length || injection.inject.tools?.length)) continue; if (injection.metadata?.cache === undefined || injection.metadata.cache === 'never') continue; // Named factories record the source before applying their defaults. A // custom Injection that authors metadata.cache itself is explicit. const source = injection.metadata.cachePolicySource === 'default' ? 'default' : 'explicit'; if (source === 'explicit' || requested === undefined) requested = source; } if (requested === undefined) return undefined; if ((0, footprintjs_1.isDevMode)() && (requested === 'explicit' || args.modelAwareUnavailable)) { // eslint-disable-next-line no-console console.warn((requested === 'explicit' ? `agentfootprint Agent: caching was requested, but provider '${args.providerName}' ` : `agentfootprint Agent: the default cache policy applies, but provider '${args.providerName}' `) + "is configured with cache strategy 'none'. No cache markers will be sent. " + 'Choose a supported provider/model, or disable caching.'); } return requested; } exports.cacheRequestedWithoutSupport = cacheRequestedWithoutSupport; //# sourceMappingURL=cacheSupport.js.map