/** * BrowserScriptExecutor — parses and executes Playwright scripts line-by-line. * * Supports a subset of Playwright commands that can be deterministically parsed * from generated scripts. Unsupported lines cause a parse failure, signaling * the caller to fall back to AI-based execution. */ /** * Structural interface describing the browser session capabilities used by this executor. * Using a structural type instead of `any` lets callers pass any compatible object * (BrowserSession, BrowserProxySession, or a mock in tests) without a hard import. */ export interface BrowserSessionLike { getPage(): Promise<{ goto(url: string, opts?: Record): Promise; click(selector: string, opts?: Record): Promise; fill(selector: string, value: string, opts?: Record): Promise; locator(selector: string): { innerText(opts?: Record): Promise; }; keyboard: { type(text: string): Promise; press(key: string): Promise; }; mouse: { wheel(deltaX: number, deltaY: number): Promise; }; waitForTimeout(ms: number): Promise; }>; variables: Map; actionLog: { add(source: string, action: string, detail: string): void; }; } export interface ScriptStepResult { line: string; success: boolean; error?: string; } export interface ScriptExecutionResult { success: boolean; completedSteps: number; totalSteps: number; results: ScriptStepResult[]; failedLine?: string; /** True when a line could not be parsed — caller should fall back to chat AI */ fallbackToChat?: boolean; } /** * Execute a Playwright script against a browser session. */ export declare function executePlaywrightScript(session: BrowserSessionLike, script: string, onStepComplete?: (step: number, total: number, line: string) => void): Promise; //# sourceMappingURL=browser-script-executor.d.ts.map