/** * Browser Session Management * Manages unique session IDs for each browser monitoring session * Mirrors the pattern from src/session.ts but for browser connections */ /** * Generate a short, readable browser session ID * Format: browser-- * Example: browser-20250122143022-a3f2 */ export declare function generateBrowserSessionId(): string; /** * Get the browser session log file path for a given session ID * @param sessionId The browser session ID * @param active If true, return path in active directory, otherwise inactive (default: true) */ export declare function getBrowserSessionLogPath(sessionId: string, active?: boolean): string; /** * Get the browser master index file path * This file tracks all browser session IDs in chronological order */ export declare function getBrowserMasterIndexPath(): string; /** * Register a new browser session in the master index * @param sessionId The browser session ID to register * @param projectDir The working directory where the browser monitoring was started * @param url The URL being monitored (optional) */ export declare function registerBrowserSession(sessionId: string, projectDir: string, url?: string): Promise; /** * Get all browser session IDs from the master index * @returns Array of session IDs in chronological order */ export declare function getAllBrowserSessionIds(): string[]; /** * Get the active browser sessions file path * This file tracks currently running browser sessions */ export declare function getActiveBrowserSessionsPath(): string; /** * Mark a browser session as active (running) * @param sessionId The browser session ID * @param projectDir The project directory * @param url The URL being monitored (optional) * @param pid The PID of the native host process owning this session (defaults to current process) */ export declare function markBrowserSessionActive(sessionId: string, projectDir: string, url?: string, pid?: number): Promise; /** * Synchronously reap browser sessions whose native-host PID is dead. * Legacy entries without a PID are reaped too. * Skips the async lock — reaping races with native-host writes are rare and * the blast radius is one session entry being rewritten. * @returns Number of sessions reaped */ export declare function reapDeadBrowserSessions(): number; /** * Mark a browser session as completed and move its log to inactive directory * @param sessionId The browser session ID * @param archiveLog Whether to archive the log file to inactive directory (default: true) */ export declare function markBrowserSessionCompleted(sessionId: string, archiveLog?: boolean): Promise; /** * Get all active browser session IDs for a specific project * @param projectDir The project directory (optional - returns all if not specified) * @returns Array of active browser session IDs */ export declare function getActiveBrowserSessions(projectDir?: string): string[]; /** * Clean up stale browser sessions. PID liveness is authoritative — an idle * browser tab whose native host is still running is NOT stale. * @returns Number of stale sessions cleaned up */ export declare function cleanupStaleBrowserSessions(_maxAgeMinutes?: number): number; /** * End ALL currently-active browser sessions unconditionally and archive * their logs. Called at native-host startup so each new SW connection * starts clean — no stale session entries can linger. * @returns Number of sessions ended */ export declare function endAllActiveBrowserSessions(): number; //# sourceMappingURL=browser-session.d.ts.map