/** * SMI-761: Session Health Monitoring * SMI-1189: Refactored to use TypedEventEmitter * * Provides health monitoring for swarm sessions: * - Heartbeat mechanism every 30 seconds * - Automatic detection of stuck sessions * - Session state recovery capabilities * - Metrics for session health */ import type { SessionData } from './SessionContext.js'; import { TypedEventEmitter } from './typed-event-emitter.js'; import { type SessionHealth, type SessionHealthStatus, type HealthMonitorConfig, type SessionHealthEvents } from './health-types.js'; export type { SessionHealth, SessionHealthStatus, HealthMonitorConfig, SessionHealthEvents }; /** * Session Health Monitor * * Tracks session health through heartbeats and detects stuck sessions. */ export declare class SessionHealthMonitor extends TypedEventEmitter { private config; private sessions; private checkInterval; private started; constructor(config?: HealthMonitorConfig); /** * Start monitoring a session */ registerSession(session: SessionData): void; /** * Record a heartbeat for a session */ heartbeat(sessionId: string): void; /** * Stop monitoring a session */ unregisterSession(sessionId: string): void; /** * Get health status for a session */ getSessionHealth(sessionId: string): SessionHealth | null; /** * Get health status for all sessions */ getAllSessionHealth(): SessionHealth[]; /** * Start the health monitor */ start(): void; /** * Stop the health monitor */ stop(): void; /** * Check if the monitor is running */ isRunning(): boolean; /** * Get the number of monitored sessions */ getSessionCount(): number; /** * Attempt to recover a dead session from stored sessionData * * @param state - The session health state to recover * @returns true if recovery was successful, false otherwise */ private attemptRecovery; /** * Check all sessions for health issues */ private checkAllSessions; } /** * Get the default health monitor instance */ export declare function getHealthMonitor(): SessionHealthMonitor; /** * Initialize the health monitor with custom config */ export declare function initializeHealthMonitor(config?: HealthMonitorConfig): SessionHealthMonitor; /** * Shutdown the health monitor */ export declare function shutdownHealthMonitor(): void; //# sourceMappingURL=SessionHealthMonitor.d.ts.map