export interface SessionState { sessionId: string; model?: string; agent?: string; status?: "active" | "idle" | "completed"; createdAt: number; updatedAt: number; } const store = new Map(); export function setSessionState( sessionId: string, state: Partial>, ): void { const existing = store.get(sessionId); const now = Date.now(); store.set(sessionId, { ...existing, ...state, sessionId, createdAt: existing?.createdAt ?? now, updatedAt: now, }); } export function getSessionState(sessionId: string): SessionState | undefined { return store.get(sessionId); } export function deleteSessionState(sessionId: string): void { store.delete(sessionId); } export function clearSessionStore(): void { store.clear(); }