/** * Shared HTTP client utilities for daemon health checks. * Provides typed error handling, retry logic, and debug logging. */ /** * Error codes for HTTP operations. */ export type HttpErrorCode = 'NETWORK_ERROR' | 'TIMEOUT' | 'NON_200_STATUS' | 'INVALID_RESPONSE'; /** * HTTP error details. */ export interface HttpError { code: HttpErrorCode; message: string; details?: unknown; statusCode?: number; } /** * Result type for HTTP operations (discriminated union). */ export type HttpResult = { ok: true; data: T; statusCode: number; } | { ok: false; error: HttpError; }; /** * Health check response schema. */ export interface HealthCheckResponse { status: string; sessions: number; uptime: number; pid: number; sessionTimeoutMs?: number; version?: string; name?: string; } /** * HTTP client configuration options. */ export interface HttpClientOptions { /** Request timeout in milliseconds (default: 3000) */ timeout?: number; /** Number of retry attempts (default: 0) */ retries?: number; /** Delay between retries in milliseconds (default: 500) */ retryDelay?: number; /** Error codes that trigger retries (default: ['NETWORK_ERROR', 'TIMEOUT']) */ retryOn?: HttpErrorCode[]; /** Optional logger function for debugging */ logger?: (msg: string) => void; } /** * Check daemon health with retry logic and typed error handling. * * @param host - Daemon host address * @param port - Daemon port number * @param options - HTTP client options * @returns Promise resolving to HttpResult with health data or error details */ export declare function checkDaemonHealth(host: string, port: number, options?: HttpClientOptions): Promise>; /** * Simple boolean wrapper for daemon health check (backwards compatible). * * @param host - Daemon host address * @param port - Daemon port number * @param options - HTTP client options * @returns Promise resolving to true if daemon is healthy, false otherwise */ export declare function isDaemonHealthy(host: string, port: number, options?: HttpClientOptions): Promise; //# sourceMappingURL=http-client.d.ts.map