import type { Page } from 'playwright-core'; /** Represents a captured JS dialog event. */ export interface DialogEvent { id: string; type: 'alert' | 'confirm' | 'prompt' | 'beforeunload'; message: string; defaultValue: string; timestamp: number; handled: boolean; response?: 'accepted' | 'dismissed'; } /** Console message captured by the supervisor. */ export interface ConsoleEntry { type: string; text: string; timestamp: number; } export type DialogPolicy = 'must_respond' | 'auto_dismiss' | 'auto_accept'; export interface CdpSupervisorOptions { dialogPolicy: DialogPolicy; dialogTimeoutSeconds: number; maxConsoleEntries: number; } /** * CDP Supervisor — persistent event listener for browser pages. * * Monitors Dialog events, console output, and frame navigation. * Aligned with hermes-agent's `CDPSupervisor` pattern but using * Playwright's high-level event API instead of raw CDP WebSocket. */ export declare class CdpSupervisor { private readonly options; private dialogQueue; private consoleBuffer; private attachedPages; private dialogCounter; private pendingDialog; constructor(options?: Partial); /** Attach the supervisor to a page to begin monitoring. */ attach(page: Page): void; /** Get all pending (unhandled) dialogs. */ getPendingDialogs(): DialogEvent[]; /** Get all captured dialog events (including handled). */ getAllDialogs(): DialogEvent[]; /** Get recent console entries. */ getConsoleEntries(limit?: number): ConsoleEntry[]; /** Handle a pending dialog by id or the most recent one. */ handleDialog(action: 'accept' | 'dismiss', options?: { dialogId?: string; promptText?: string; }): Promise; /** Clear all dialog history. */ clearDialogs(): void; /** Clear console buffer. */ clearConsole(): void; private _onDialog; private _onConsole; }