/** * Session Timeout Manager for NotebookLM MCP Server * * Provides configurable session timeout enforcement: * - Hard timeout: Maximum session lifetime (default: 8 hours) * - Inactivity timeout: Auto-logout after idle period (default: 30 minutes) * - Warning callbacks before timeout * - Memory scrubbing on timeout * * Added by Pantheon Security for hardened fork. */ /** * Session timeout configuration */ export interface SessionTimeoutConfig { /** Maximum session lifetime in milliseconds (default: 8 hours) */ maxLifetimeMs: number; /** Inactivity timeout in milliseconds (default: 30 minutes) */ inactivityTimeoutMs: number; /** Warning before timeout in milliseconds (default: 5 minutes) */ warningBeforeMs: number; /** Enable hard timeout (default: true) */ enableHardTimeout: boolean; /** Enable inactivity timeout (default: true) */ enableInactivityTimeout: boolean; } /** * Timeout callback type */ export type TimeoutCallback = (sessionId: string, reason: "lifetime" | "inactivity") => Promise; /** * Warning callback type */ export type WarningCallback = (sessionId: string, reason: "lifetime" | "inactivity", remainingMs: number) => void; /** * Session Timeout Manager * * Manages session timeouts with configurable lifetime and inactivity limits. */ export declare class SessionTimeoutManager { private config; private sessions; private checkInterval; private onTimeout; private onWarning; constructor(config?: Partial); /** * Format duration for logging */ private formatDuration; /** * Register a new session */ startSession(sessionId: string): void; /** * Update session activity (reset inactivity timer) */ touchSession(sessionId: string): void; /** * Remove a session from tracking */ removeSession(sessionId: string): void; /** * Check if a session has expired */ isExpired(sessionId: string): { expired: boolean; reason?: "lifetime" | "inactivity"; }; /** * Get time remaining for a session */ getTimeRemaining(sessionId: string): { lifetime: number; inactivity: number; } | null; /** * Get session info for all tracked sessions */ getAllSessionsInfo(): Array<{ sessionId: string; createdAt: number; lastActivity: number; ageMs: number; inactiveMs: number; lifetimeRemainingMs: number; inactivityRemainingMs: number; }>; /** * Set callback for when a session times out */ setTimeoutCallback(callback: TimeoutCallback): void; /** * Set callback for timeout warnings */ setWarningCallback(callback: WarningCallback): void; /** * Start periodic timeout check */ private startPeriodicCheck; /** * Check all sessions for expiry and warnings */ private checkAllSessions; /** * Stop the timeout manager */ stop(): void; /** * Get configuration */ getConfig(): SessionTimeoutConfig; /** * Update configuration */ updateConfig(config: Partial): void; } /** * Get or create the global timeout manager */ export declare function getSessionTimeoutManager(): SessionTimeoutManager;