/**
 * In-process CAE trace + bundle session store (ephemeral until T867).
 */
const MAX = 512;
const sessions = new Map();
let lastEvalAtIso = null;
export function touchCaeEvalTimestamp() {
    lastEvalAtIso = new Date().toISOString();
}
export function getLastCaeEvalIso() {
    return lastEvalAtIso;
}
export function storeCaeSession(traceId, rec) {
    touchCaeEvalTimestamp();
    sessions.set(traceId, rec);
    while (sessions.size > MAX) {
        const first = sessions.keys().next().value;
        if (first !== undefined)
            sessions.delete(first);
    }
}
export function getCaeSession(traceId) {
    return sessions.get(traceId);
}
export function clearCaeSessionsForTests() {
    sessions.clear();
    lastEvalAtIso = null;
}
