/** * In-memory LRU cache of provider decision outcomes. * * Keyed by `sha256(adapterVersion, model, questions, state)` over a canonical * (key-sorted) JSON serialization, so logically identical requests hit the * same entry regardless of object key order. Only provider answers are * stored; fallbacks are never cached. The cache is per-process and holds no * secrets (the key is not part of any request). * * @task T12490 * @epic T12486 */ import type { DecisionOutcome, DecisionRequest } from '@cleocode/contracts'; /** Default number of entries kept by {@link createDecisionCache}. */ export declare const DEFAULT_DECISION_CACHE_SIZE = 512; /** A bounded store of decision outcomes. */ export interface DecisionCache { /** Look up an outcome, marking it most-recently used. */ get(key: string): DecisionOutcome | undefined; /** Store an outcome, evicting the least-recently used entry when full. */ set(key: string, outcome: DecisionOutcome): void; /** Number of stored entries. */ readonly size: number; /** Drop every entry. */ clear(): void; } /** * sha256 hex of the canonical serialization of `value`. * * @param value - Any JSON-compatible value. * @returns 64-char lowercase hex digest. */ export declare function hashCanonical(value: unknown): string; /** * Cache key for a request under a given adapter version. * * @param adapterVersion - Wire-adapter identity; bump it to invalidate entries. * @param req - The request as sent to the provider (post-redaction). * @returns sha256 hex key. */ export declare function decisionCacheKey(adapterVersion: string, req: DecisionRequest): string; /** * Create an LRU {@link DecisionCache}. * * @param maxEntries - Capacity (minimum 1). Defaults to {@link DEFAULT_DECISION_CACHE_SIZE}. * @returns A new, empty cache. */ export declare function createDecisionCache(maxEntries?: number): DecisionCache; //# sourceMappingURL=cache.d.ts.map