import { sha256 } from '../fsx.js';
const cache = new Map();
export function codexRouteCacheKey(input) {
    return sha256(JSON.stringify({
        route: input.route,
        tier: input.tier || null,
        prompt: String(input.prompt || '').slice(0, 4000),
        files: input.inputFiles || [],
        images: (input.inputImages || []).length,
        sandbox: input.sandboxPolicy,
        allow_local_llm: input.allowLocalLlm === true,
        backend_preference: input.backendPreference || [],
        local_llm_policy: input.localLlmPolicy || null,
        write_paths: input.requestedScopeContract?.write_paths || [],
        allowed_paths: input.requestedScopeContract?.allowed_paths || []
    }));
}
export function readRouteCache(key) {
    return cache.has(key) ? cache.get(key) : null;
}
export function writeRouteCache(key, value) {
    cache.set(key, value);
    return value;
}
export function clearRouteCache() {
    cache.clear();
}
//# sourceMappingURL=route-cache.js.map