import type { Session } from '../types/index.js'; import { type SessionStore } from './SessionStore.js'; /** * Restores a Session from its serialized form. * * Revives Date instances nested in: * - top-level `createdAt` / `updatedAt` * - `handoffHistory[].timestamp` * - `metadata.createdAt` / `metadata.lastActiveAt` * - `metadata.handoffHistory[].timestamp` * - `agentStates[*].lastActive` * * Adapter packages (postgres-store, redis-store, upstash-store, etc.) must * import this instead of re-implementing their own revival logic. * * The input may be a JSON string (e.g. from a Redis GET) or an already-parsed * object (e.g. a JSONB column from Postgres). Other shapes pass through * untouched in the key fields — callers are expected to have validated shape. */ export declare function reviveSession(raw: unknown): Session; /** Apply a session mutation to the latest snapshot and retry it after CAS conflicts. */ export declare function mutateSessionWithRetry(store: SessionStore, sessionId: string, mutator: (session: Session) => void | Promise): Promise;