/** * Capture Agent — Recovery Chain * * Ordered recovery strategies when a deterministic opcode fails: * 1. Deterministic retry (same opcode, fresh observation) * 2. Selector memory lookup (known-good selectors from Supabase) * 3. Alternative interaction (keyboard, JS dispatch, coordinates) * 4. Targeted reload (reload page and retry) * 5. LLM Healer (last resort) */ import type { ExecutionOpcode, RuntimeAdapter } from './execution-types.js'; import type { RecoveryChain as IRecoveryChain, RecoveryAttemptResult, RecoveryAttemptOptions } from './opcode-runner.js'; import { type HealerLLMProvider } from './llm-healer.js'; export interface RecoveryChainOptions { /** Selector memory: stepSignature -> known-good selectors */ selectorMemory?: Record; /** LLM provider for the healer (optional, disables healer if not provided) */ llmProvider?: HealerLLMProvider; /** Max healer invocations per run. Default: 3 */ maxHealerInvocations?: number; /** Full program steps for healer context */ programSteps?: ExecutionOpcode[]; /** Credentials for {{email}}/{{password}}/{{loginUrl}} substitution during recovery */ credentials?: { email?: string; password?: string; loginUrl?: string; }; } export declare class RecoveryChainImpl implements IRecoveryChain { private healer; private selectorMemory; private programSteps; private credentials?; constructor(options?: RecoveryChainOptions); attempt(failedOpcode: ExecutionOpcode, opcodeIndex: number, adapter: RuntimeAdapter, options?: RecoveryAttemptOptions): Promise; }