/** * Session rotation: reuse the persisted session across restarts while fresh, * rotate after an idle gap or max age. On rotation the pending queue is flushed * under the OLD session_id first (flush snapshots the envelope synchronously), * then a new id is minted. Fail-open throughout. */ import type { StorageAdapter } from './sink.js'; export declare const SESSION_IDLE_MS = 1800000; export declare const SESSION_MAX_MS = 86400000; export declare class SessionManager { private readonly storage; private readonly beforeRotate; private readonly onSessionId; private record; private persistScheduled; constructor(storage: StorageAdapter, beforeRotate: () => void, onSessionId: (id: string) => void); currentId(): string; /** Adopt the persisted session if still fresh (works for sync and async storage). */ restore(): Promise; /** Called on every captured event: rotate if stale, then bump activity. */ touch(): void; /** Background transition: record activity so the idle gap starts now. */ background(): void; /** Foreground/resume: rotate if the idle gap or max age was crossed. */ foreground(): void; private stale; private rotate; private schedulePersist; }