/**
 * Worker Health Monitor
 * Comprehensive health monitoring and recovery for worker threads
 */
import { EventEmitter } from 'events';
import { Worker } from 'worker_threads';
interface WorkerHealthStatus {
    workerId: string;
    isHealthy: boolean;
    lastHeartbeat: number;
    taskCount: number;
    memoryUsage: number;
    errorCount: number;
    responseTime: number;
    status: 'active' | 'idle' | 'busy' | 'unresponsive' | 'failed' | 'terminating';
}
interface HealthCheckOptions {
    heartbeatInterval?: number;
    heartbeatTimeout?: number;
    maxErrorCount?: number;
    maxResponseTime?: number;
    memoryThreshold?: number;
    enableAutoRecovery?: boolean;
    healthCheckRetries?: number;
}
export declare class WorkerHealthMonitor extends EventEmitter {
    private workers;
    private healthStatus;
    private healthCheckTimer?;
    private options;
    private pendingHealthChecks;
    constructor(options?: HealthCheckOptions);
    /**
     * Register a worker for health monitoring
     */
    registerWorker(workerId: string, worker: Worker): void;
    /**
     * Unregister a worker from health monitoring
     */
    unregisterWorker(workerId: string): void;
    /**
     * Get health status for a specific worker
     */
    getWorkerHealth(workerId: string): WorkerHealthStatus | null;
    /**
     * Get health status for all workers
     */
    getAllWorkerHealth(): WorkerHealthStatus[];
    /**
     * Check if a worker is healthy
     */
    isWorkerHealthy(workerId: string): boolean;
    /**
     * Get count of healthy workers
     */
    getHealthyWorkerCount(): number;
    /**
     * Force health check for a specific worker
     */
    checkWorkerHealth(workerId: string): Promise<boolean>;
    /**
     * Attempt to recover an unhealthy worker
     */
    private recoverWorker;
    /**
     * Set up event listeners for a worker
     */
    private setupWorkerListeners;
    /**
     * Start periodic health monitoring
     */
    private startHealthMonitoring;
    /**
     * Stop health monitoring
     */
    private stopHealthMonitoring;
    /**
     * Clean up worker resources
     */
    private cleanupWorker;
    /**
     * Get overall system health metrics
     */
    getSystemHealthMetrics(): {
        totalWorkers: number;
        healthyWorkers: number;
        failedWorkers: number;
        averageResponseTime: number;
        totalErrorCount: number;
        memoryUsage: number;
    };
    /**
     * Shutdown health monitor
     */
    shutdown(): void;
}
export {};
//# sourceMappingURL=worker-health-monitor.d.ts.map