/** * A Driver decorator (wraps any Driver) that repairs a broken step at replay time — the * sanctioned exception to LLM-free replay (invariant #4). When a frozen target no longer * resolves, the LLM maps the original intent onto a current element, the action is retried, * and the substitution is recorded for re-freezing. No break → no LLM call. */ import type { Driver, LlmClient } from "../../core/ports.js"; import type { Evidence, PageElement, SettleOptions, Target } from "../../core/types.js"; /** A recorded substitution: `original` could not be found, `healed` (a re-located target carrying * role/index, not a brittle text-only one) was used instead. */ export interface Heal { original: Target; healed: Target; reason?: string; } export interface SelfHealOptions { maxHeals?: number; /** Fired when a step is healed — a host's signal that the scenario is aging (re-freeze worthwhile). */ onHeal?: (heal: Heal) => void; } /** Parse the heal reply → a chosen element name, or undefined for "none". */ export declare function parseHealChoice(text: string): string | undefined; export declare class SelfHealingDriver implements Driver { private readonly inner; private readonly llm; readonly heals: Heal[]; private readonly maxHeals; private readonly onHeal?; constructor(inner: Driver, llm: LlmClient, opts?: SelfHealOptions); goto(url: string): Promise; click(target: Target): Promise; doubleClick(target: Target): Promise; hover(target: Target): Promise; type(target: Target, text: string): Promise; select(target: Target, value: string): Promise; locate(target: Target): Promise; pressKey(key: string): Promise; scroll(direction?: "down" | "up"): Promise; screenshot(): Promise; snapshot(): Promise; settle(options?: SettleOptions): Promise; observe(): Promise; close(): Promise; private heal; }