/** * Browser-page watchdog primitives (issues #16 + #29). * * Two failure modes that bit users in v1.x: * 1. `page.waitForTimeout(N)` returns *immediately* when the underlying * browser process is in a zombie state, which turned poll loops into * busy-spinning consumers of 100 % CPU. * 2. `page.evaluate(...)` can hang forever when the renderer is wedged, * so loops never noticed they were operating on dead pages. * * `safeSleep` falls back to a Node `setTimeout` when the page sleep returns * suspiciously fast. `pageIsAlive` runs a tiny `evaluate` with a hard ceiling * so callers can detect a dead renderer without blocking. `isRecoverable` * recognises the common patchright/playwright disconnect strings so that * higher-level recovery code can rebuild the context instead of bailing. */ import type { Page } from "patchright"; /** * Sleep that is robust against a zombie page returning early. Always honours * at least 95 % of the requested duration via a Node-side timer fallback. */ export declare function safeSleep(page: Page, ms: number): Promise; /** * Returns `true` if the page responds to a trivial `evaluate` within the * health-check budget. Returns `false` for crashed, frozen or disconnected * pages — never throws. */ export declare function pageIsAlive(page: Page, budgetMs?: number): Promise; /** * Heuristic: errors that indicate the browser/page is gone but the higher * layer can recover by re-creating the context. Anything else should bubble * up unchanged. */ export declare function isRecoverable(error: unknown): boolean; //# sourceMappingURL=watchdog.d.ts.map