/** * Provider health and degradation. * * Bounded rolling evidence per provider/model/endpoint. Uses decay rather than * permanent blacklisting. Authentication failures never trigger futile retries; * rate limits respect retry hints; fallback is deterministic and preserves task * requirements. Health state is durable for resume but bounded in retention. */ export type HealthSignal = "success" | "rate_limit" | "timeout" | "authentication_failure" | "schema_incompatibility" | "tool_call_corruption" | "empty_response" | "context_overflow" | "provider_outage" | "cancellation"; export type HealthLevel = "healthy" | "degraded" | "unhealthy" | "unknown"; export interface HealthSample { signal: HealthSignal; recordedAt: string; sequence: number; } export interface ProviderHealthState { provider: string; model?: string; endpoint?: string; /** Bounded window of recent samples (oldest first). */ samples: readonly HealthSample[]; /** Deterministic snapshot used for routing. */ level: HealthLevel; lastSuccessfulAt?: string; } export declare const MAX_HEALTH_SAMPLES = 32; export declare function createHealthState(provider: string, model?: string, endpoint?: string): ProviderHealthState; /** * Record a health signal, keeping a bounded window of samples, and derive the * level from the window. Authentication failures mark the provider degraded * (never retried blindly). Successful newest sample restores health. */ export declare function recordHealthSignal(state: ProviderHealthState, signal: HealthSignal, recordedAt: string, sequence: number): ProviderHealthState; /** A retry is allowed only for retryable signals, and only with a cooldown. */ export declare function shouldRetry(state: ProviderHealthState, cooldownMs: number, nowMs: number): boolean; /** Count of a given signal within the window (used for bounded evidence). */ export declare function countSignal(state: ProviderHealthState, signal: HealthSignal): number; //# sourceMappingURL=provider-health.d.ts.map