@ai-capabilities-suite/mcp-debugger-core
Version:
Core debugging engine for Node.js and TypeScript applications. Provides Inspector Protocol integration, breakpoint management, variable inspection, execution control, profiling, hang detection, and source map support.
126 lines (125 loc) • 3.09 kB
TypeScript
/**
* Health status enumeration
*/
export declare enum HealthStatus {
HEALTHY = "healthy",
UNHEALTHY = "unhealthy",
DEGRADED = "degraded"
}
/**
* Dependency health check result
*/
export interface DependencyHealth {
name: string;
status: HealthStatus;
message?: string;
latency?: number;
}
/**
* Overall health check result
*/
export interface HealthCheckResult {
status: HealthStatus;
timestamp: string;
uptime: number;
dependencies: DependencyHealth[];
details?: Record<string, any>;
}
/**
* Readiness check result
*/
export interface ReadinessCheckResult {
ready: boolean;
timestamp: string;
checks: {
name: string;
ready: boolean;
message?: string;
}[];
}
/**
* Liveness check result
*/
export interface LivenessCheckResult {
alive: boolean;
timestamp: string;
message?: string;
}
/**
* Dependency checker function type
*/
export type DependencyChecker = () => Promise<DependencyHealth>;
/**
* Health checker for production readiness
* Provides health, readiness, and liveness endpoints
*/
export declare class HealthChecker {
private startTime;
private dependencyCheckers;
private lastHealthCheck?;
private healthCheckInterval?;
constructor();
/**
* Register a dependency health checker
*/
registerDependencyChecker(name: string, checker: DependencyChecker): void;
/**
* Unregister a dependency health checker
*/
unregisterDependencyChecker(name: string): void;
/**
* Get uptime in milliseconds
*/
getUptime(): number;
/**
* Check health of a single dependency
*/
private checkDependency;
/**
* Perform health check
* Checks all registered dependencies and returns overall health status
*/
checkHealth(): Promise<HealthCheckResult>;
/**
* Get last health check result (cached)
*/
getLastHealthCheck(): HealthCheckResult | undefined;
/**
* Perform readiness check
* Checks if the service is ready to accept requests
*/
checkReadiness(): Promise<ReadinessCheckResult>;
/**
* Perform liveness check
* Checks if the service is alive and responsive
*/
checkLiveness(): Promise<LivenessCheckResult>;
/**
* Start periodic health checks
*/
startPeriodicHealthChecks(intervalMs?: number): void;
/**
* Stop periodic health checks
*/
stopPeriodicHealthChecks(): void;
/**
* Get health endpoint data (for HTTP endpoint)
*/
getHealthEndpointData(): Promise<string>;
/**
* Get readiness endpoint data (for HTTP endpoint)
*/
getReadinessEndpointData(): Promise<string>;
/**
* Get liveness endpoint data (for HTTP endpoint)
*/
getLivenessEndpointData(): Promise<string>;
/**
* Cleanup resources
*/
cleanup(): void;
}
/**
* Create a simple dependency checker for testing
*/
export declare function createSimpleDependencyChecker(name: string, checkFn: () => Promise<boolean>): DependencyChecker;