/** * NotebookLM chat extraction with streaming-stability detection. * * Replaces the legacy `waitForLatestAnswer()` (issue #43). Old logic gated on * `div.thinking-message`, which Google removed; calls timed out even though * the answer was visible. New logic only relies on the answer container itself * and treats text as final once it has been *stable* across N consecutive * polls (default 3). That makes the wait robust to UI churn and Material-icon * leaks (`more_vert`, `more_horiz`, …) which would otherwise destabilise the * extracted text. * * Companion fixes: * - issue #14 / #27 — timeout is fully configurable per call * - issue #16 — bounded polls + sleep fallback to defuse zombie pages * - issue #28 — sanitisation strips UI-control labels before delivery */ import type { Page } from "patchright"; export interface AskOptions { /** The question text — used to skip echo lines that NotebookLM mirrors back. */ question?: string; /** Hard ceiling on the wait. Default 600 000 ms (10 min) — overridable per call. */ timeoutMs?: number; /** Poll cadence. Default 750 ms. Lower values increase load without much benefit. */ pollIntervalMs?: number; /** Texts known *before* the question was submitted. Used to skip prior answers. */ ignoreTexts?: string[]; /** How many consecutive identical polls count as "answer settled". Default 3. */ stablePolls?: number; } /** * Snapshot every visible assistant answer text *before* a new question is * submitted. Pass the result into `waitForStableAnswer({ ignoreTexts })` so * the new turn isn't confused with prior turns in the same session. */ export declare function snapshotPriorAnswers(page: Page): Promise; /** * Wait for the *latest* answer text to appear and stabilise. * * Returns the sanitised final text, or `null` on timeout. The function never * throws on UI hiccups — failure surfaces as `null` so the caller can decide * how to recover (retry vs. report error to the user). */ export declare function waitForStableAnswer(page: Page, options?: AskOptions): Promise; /** * Strip Material-icon labels (`more_vert`, `more_horiz`, …) and orphaned * citation markers that NotebookLM occasionally leaks into `innerText`. * Only isolated lines are removed — never inline content — so legitimate * answer prose with the same words ("more horizontal") is not touched. */ export declare function sanitizeAnswer(text: string): string; //# sourceMappingURL=chat.d.ts.map