/** * In-memory Gemini cached-content handle store. * * Ported from PSYCHE src/llm/caching.py. Uses LRU eviction up to * MAX_ENTRIES. `build_cache_key` uses deterministic JSON + sha256. * * @task T1393 (T1386-W7) * @epic T1386 */ import type { ModelConfig, PromptCachePolicy } from './types-config.js'; export type { PromptCachePolicy } from './types-config.js'; /** In-memory handle for a Gemini cached-content resource. */ export interface GeminiCacheHandle { key: string; cachedContentName: string; expiresAt: Date; } /** * Build a deterministic cache key for a Gemini cached-content request. * * Includes transport, model, cache policy, cacheable messages, tools, * system instruction, and tool_config — all of which affect the cached * content and must be part of the key. */ export declare function buildCacheKey(params: { config: ModelConfig; cachePolicy: PromptCachePolicy; cacheableMessages: Array>; tools: Array> | null | undefined; systemInstruction?: string | null; toolConfig?: Record | null; }): string; /** * Best-effort local LRU cache for Gemini cached-content handles. * * Uses insertion-order Map with LRU eviction at MAX_ENTRIES limit. * Thread-safety: not needed in single-threaded Node.js (no threading). */ export declare class InMemoryGeminiCacheStore { static readonly MAX_ENTRIES = 1024; private readonly _handles; /** * Get a cached handle by key. * Returns null if not found or if expired. */ get(key: string): GeminiCacheHandle | null; /** * Store a handle. Evicts expired entries, then oldest if over limit. * Returns the stored handle. */ set(handle: GeminiCacheHandle): GeminiCacheHandle; } /** Module-level singleton cache store (test-patchable). */ export declare const geminiCacheStore: InMemoryGeminiCacheStore; //# sourceMappingURL=caching.d.ts.map