/** * OpenKernel — Recovery Manager * * Classifies failures: 429, timeout, provider-down, hallucination, * tool-failure, verification-failure, planning-failure, browser-failure. * * Recovery actions: retry → rotate provider → spawn different worker → * replan → checkpoint → continue. */ import type { FailureType, Logger, Mission, Policy, RecoveryDecision, Task } from './types.js'; import type { EventBus } from './event-bus.js'; import type { ProviderManager } from './provider-manager.js'; import type { WorkerRuntime } from './worker-runtime.js'; import type { CapabilityRouter } from './router.js'; export interface RecoveryManagerDeps { eventBus: EventBus; providerManager: ProviderManager; workerRuntime: WorkerRuntime; router: CapabilityRouter; logger: Logger; } export interface RecoveryContext { mission: Mission; task: Task; error: string; attempts: number; policy: Policy; currentProviderId?: string; currentModelId?: string; /** How many times this task has failed verification — drives model escalation. */ verificationFailures?: number; } export declare class RecoveryManager { private deps; constructor(deps: RecoveryManagerDeps); classify(error: string): FailureType; decide(ctx: RecoveryContext): Promise; private findAlternateProvider; /** * Find a strictly MORE capable model than the one that just failed * verification — the escalation ladder. Ranks across all healthy providers by * benchmark and returns the best above the current model's tier, or null at * the ceiling. */ private findMoreCapableModel; private findAlternateWorker; }