/** * RuntimeHealthAggregator, tracks health status for all runtime domains and * derives composite system health. Consumers subscribe to health changes or * query current health state. */ import type { HealthDomain, HealthStatus, DomainHealth, CompositeHealth } from './types.js'; /** * Tracks per-domain health and derives composite system health. * All domains are initialized as 'unknown' at construction time. * Subscribers are notified synchronously on any health change. */ export declare class RuntimeHealthAggregator { private readonly domainHealth; private readonly subscribers; private readonly clock; /** * @param clock - Optional injectable clock function (default: Date.now). * Useful in tests to control time without real clock dependencies. */ constructor(clock?: () => number); /** * Update a domain's health status and optionally override specific fields. * Notifies all subscribers if the status actually changed. */ updateDomainHealth(domain: HealthDomain, status: HealthStatus, details?: Partial>): void; /** * Get the current health record for a specific domain. * Always returns a record (domains are pre-initialized as 'unknown'). */ getDomainHealth(domain: HealthDomain): DomainHealth; /** * Get composite system health derived from all domain states. * Overall: 'failed' if any domain failed, 'degraded' if any degraded, 'healthy' otherwise. * Domains still 'unknown' do not contribute to 'degraded' or 'failed'. */ getCompositeHealth(): CompositeHealth; /** * Check whether a domain is allowed to execute an operation. * A domain is blocked if it is 'failed' or 'degraded' and the optional operation * matches one of the degradedCapabilities for that domain. */ canExecute(domain: HealthDomain, operation?: string): { allowed: boolean; reason?: string; }; /** * Subscribe to composite health changes. * The callback is invoked synchronously after every domain health update. * Returns an unsubscribe function. */ subscribe(callback: (health: CompositeHealth) => void): () => void; /** Derive overall health status from all domain states */ private deriveOverallHealth; /** Notify all subscribers with current composite health */ private notifySubscribers; } //# sourceMappingURL=aggregator.d.ts.map