import type CommitPort from '../../ports/CommitPort.ts';
import type LoggerPort from '../../ports/LoggerPort.ts';
/**
 * Health status constants.
 */
export declare const HealthStatus: {
    readonly HEALTHY: "healthy";
    readonly DEGRADED: "degraded";
    readonly UNHEALTHY: "unhealthy";
};
export type HealthStatusValue = typeof HealthStatus[keyof typeof HealthStatus];
export interface RepositoryHealth {
    status: 'healthy' | 'unhealthy';
    latencyMs: number;
}
export interface IndexHealth {
    status: 'healthy' | 'degraded' | 'unhealthy';
    loaded: boolean;
    shardCount?: number;
}
export interface HealthResult {
    status: 'healthy' | 'degraded' | 'unhealthy';
    components: {
        repository: RepositoryHealth;
        index: IndexHealth;
    };
    cachedAtTick?: number;
}
interface IndexReaderLike {
    shardOids?: {
        size: number;
    };
}
/**
 * Service for performing health checks on the graph system.
 *
 * Follows hexagonal architecture by depending on ports, not adapters.
 * Provides K8s-style probes (liveness vs readiness) and detailed component health.
 *
 * @example
 * const healthService = new HealthCheckService({
 *   persistence,
 *   cacheTtlTicks: 100,
 *   logger,
 * });
 *
 * // K8s liveness probe - am I running?
 * const alive = await healthService.isAlive(currentLamport);
 *
 * // K8s readiness probe - can I serve requests?
 * const ready = await healthService.isReady(currentLamport);
 *
 * // Detailed health breakdown
 * const health = await healthService.getHealth(currentLamport);
 * console.log(health.status); // 'healthy' | 'degraded' | 'unhealthy'
 */
export default class HealthCheckService {
    private readonly _persistence;
    private readonly _logger;
    private _indexReader;
    private readonly _healthCache;
    /**
     * Creates a HealthCheckService instance.
     */
    constructor({ persistence, cacheTtlTicks, logger, }: {
        persistence: CommitPort;
        cacheTtlTicks?: number;
        logger?: LoggerPort;
    });
    /**
     * Sets the index reader for index health checks.
     * Call this when an index is loaded.
     *
     * @param reader - The index reader, or null to clear
     */
    setIndexReader(reader: IndexReaderLike | null): void;
    /**
     * K8s-style liveness probe: Is the service running?
     *
     * Returns true if the repository is accessible.
     * A failed liveness check typically triggers a container restart.
     */
    isAlive(currentTick: number): Promise<boolean>;
    /**
     * K8s-style readiness probe: Can the service serve requests?
     *
     * Returns true if all critical components are healthy.
     * A failed readiness check removes the pod from load balancer.
     */
    isReady(currentTick: number): Promise<boolean>;
    /**
     * Gets detailed health information for all components.
     *
     * Results are cached for the configured tick TTL to prevent
     * excessive health check calls under load.
     */
    getHealth(currentTick: number): Promise<HealthResult>;
    /**
     * Computes health by checking all components.
     * This is called by CachedValue when the cache is stale.
     */
    private _computeHealth;
    /**
     * Checks repository health by pinging the persistence layer.
     */
    private _checkRepository;
    /**
     * Checks index health based on loaded state and shard count.
     */
    private _checkIndex;
    /**
     * Computes overall health status from component health.
     */
    private _computeOverallStatus;
}
export {};
