/** * Persistent page-event buffer for the debug browser (2026-10). * * WHY THIS EXISTS. The auto-answer browser scrapes toasts/errors at capture * time, and the debug browser had NOTHING: a toast that appeared after a form * submit and vanished two seconds later was invisible to an agent that only * looked on its next tool call. In the live Soludesks QA run the agent spent * minutes re-reading the DOM for a dialog/error that had already been shown. * * This module injects a tiny, idempotent MutationObserver into the page that * records toast / alert / status / dialog events in a bounded ring buffer * (`window.__tsPageEvents`). It is installed: * - immediately when a session connects, * - on every new document via `Page.addScriptToEvaluateOnNewDocument`, * - again after a main-frame navigation (belt and braces). * * The script is dependency-free and returns a string so it can be injected * with `Runtime.evaluate` or registered as a new-document script. It never * reads field values and never logs anything. */ /** Maximum events retained in the page ring buffer (oldest dropped). */ export declare const PAGE_EVENT_LIMIT = 80; export interface PageEvent { /** toast | alert | status | error | dialog | dialog-closed */ type: string; text: string; /** epoch ms, page clock */ at: number; role?: string; count?: number; } /** * Build the injected page-event script. * * IMPORTANT: regex escapes must be DOUBLE-escaped inside this template literal * (`\\s`), otherwise the injected JS receives `s` (the exact bug the bridge lint * gate found in another injected script). */ export declare function buildPageEventScript(): string;