(sid: string)
| 36 | * to persist to and can pre-load the last known state. |
| 37 | */ |
| 38 | export async function initCacheStatsState(sid: string): Promise<void> { |
| 39 | sessionId = sid |
| 40 | const filePath = getStateFilePath(sid) |
| 41 | const persisted = await readState(filePath) |
| 42 | // Pre-load persisted values so the UI can show fallback immediately |
| 43 | memState = { |
| 44 | signature: persisted.signature, |
| 45 | lastResetAt: persisted.lastResetAt, |
| 46 | lastHitRate: persisted.lastHitRate, |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Called whenever a new assistant response is received with usage data. |
no test coverage detected