/** * @file health-check.ts * @description Health check mechanism for proactive monitoring of remote MCP connections */ export type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown'; export interface HealthCheckResult { status: HealthStatus; latencyMs?: number; lastChecked: Date; consecutiveFailures: number; consecutiveSuccesses: number; error?: string; } export interface HealthCheckOptions { /** Interval between health checks in ms (default: 30000) */ intervalMs?: number; /** Timeout for health check in ms (default: 5000) */ timeoutMs?: number; /** Number of failures before marking unhealthy (default: 3) */ unhealthyThreshold?: number; /** Number of successes before marking healthy (default: 2) */ healthyThreshold?: number; /** Latency threshold for degraded status in ms (default: 2000) */ degradedLatencyMs?: number; /** Callback on health status change */ onStatusChange?: (appId: string, status: HealthStatus, previousStatus: HealthStatus) => void; } /** * Health checker for a single remote MCP connection */ export declare class HealthChecker { private readonly appId; private readonly options; private readonly checkFn; private status; private lastResult?; private consecutiveFailures; private consecutiveSuccesses; private intervalTimer?; private isChecking; constructor(appId: string, checkFn: () => Promise, options?: HealthCheckOptions); /** * Start periodic health checks */ start(): void; /** * Stop periodic health checks */ stop(): void; /** * Perform a single health check */ check(): Promise; /** * Get current health status */ getStatus(): HealthStatus; /** * Get last check result */ getLastResult(): HealthCheckResult | undefined; /** * Reset health checker state */ reset(): void; /** * Mark as healthy (e.g., after successful operation) */ markHealthy(): void; /** * Mark as unhealthy (e.g., after failed operation) */ markUnhealthy(error?: Error): void; } /** * Manager for multiple health checkers (one per remote app) */ export declare class HealthCheckManager { private readonly checkers; private readonly defaultOptions; constructor(defaultOptions?: HealthCheckOptions); /** * Create and start a health checker for an app */ addChecker(appId: string, checkFn: () => Promise, options?: HealthCheckOptions): HealthChecker; /** * Remove and stop a health checker */ removeChecker(appId: string): void; /** * Get health checker for an app */ getChecker(appId: string): HealthChecker | undefined; /** * Get health status for all apps */ getAllStatuses(): Map; /** * Stop all health checkers */ stopAll(): void; /** * Dispose and clean up */ dispose(): void; } //# sourceMappingURL=health-check.d.ts.map