mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Fix cross-issue regressions found during post-0.4.4 merge review:\n\n- preserve permission mode across clear and empty-session replacement flows\n- keep provider effort passthrough and context-window estimates aligned with runtime metadata\n- invalidate recent project caches and trace message signatures when sessions change\n- recognize Windows ARM64 unpacked package-smoke output\n\nTested: bun test scripts/quality-gate/package-smoke/index.test.ts scripts/quality-gate/runner.test.ts\nTested: bun run check:desktop\nTested: bun run check:server\nConfidence: high\nScope-risk: moderate
21 lines
566 B
TypeScript
21 lines
566 B
TypeScript
import type { RecentProject } from '../api/sessions'
|
|
|
|
let cachedProjects: RecentProject[] | null = null
|
|
let cacheTimestamp = 0
|
|
const CACHE_TTL = 30_000
|
|
|
|
export function getCachedRecentProjects(): RecentProject[] | null {
|
|
if (!cachedProjects || Date.now() - cacheTimestamp >= CACHE_TTL) return null
|
|
return cachedProjects
|
|
}
|
|
|
|
export function setCachedRecentProjects(projects: RecentProject[]): void {
|
|
cachedProjects = projects
|
|
cacheTimestamp = Date.now()
|
|
}
|
|
|
|
export function invalidateRecentProjectsCache(): void {
|
|
cachedProjects = null
|
|
cacheTimestamp = 0
|
|
}
|