/** * NotebookLM source ingestion (issue #25). * * v2.0.0 supports the two source types that cover the bulk of real usage: * - `url` — paste a website URL (NotebookLM crawls and indexes it) * - `text` — paste raw text (treated as a copied document) * * File-upload, YouTube and Google-Drive ingestion are intentionally out of * scope for v2.0.0 — they require different overlay flows. * * Robustness strategy (2026-05, ported from the Fork's content-manager.ts): * * 1. Capture the *expected notebook UUID* from the URL up-front. NotebookLM * sometimes redirects pasted-text uploads to a freshly-created notebook; * we detect that and surface a clear error. * * 2. Resolve the dialog state defensively: if a dialog is already open we * use it; otherwise we click the sidebar "Add source" button. The * `[role="dialog"]` anchor is set synchronously on mount, so we do not * have to race the Material `.mdc-dialog--open` animation class. * * 3. Source-type buttons no longer ship with aria-labels — see * selectors.ts for the icon-/text-based anchors. * * 4. Insert verification is COUNT-BASED: snapshot * `.single-source-container` count before the submit click, then poll * after the dialog closes (up to 90 s — URL crawls are slow). */ import type { Page } from "patchright"; export type SourceType = "url" | "text"; export interface AddSourceInput { type: SourceType; /** URL when `type === "url"`, raw text when `type === "text"`. */ content: string; /** Optional title shown in the source list. NotebookLM uses a default if omitted. */ title?: string; } export interface AddSourceResult { success: boolean; type: SourceType; sourceCountBefore: number; sourceCountAfter: number; message?: string; } export declare function addSource(page: Page, input: AddSourceInput): Promise; /** * Count sources in the sidebar via two independent anchors: * * 1. `.single-source-container` — the per-row sidebar element. Most * direct, but only present once the sidebar has hydrated. * * 2. `.cover-subtitle-source-count` — a header label of the form * `"3 Quellen"` / `"3 sources"`. Robust to a collapsed or partially * hydrated sidebar because it lives in the chat header instead. * * We return whichever produces a higher count; mismatches between the two * usually mean the sidebar hasn't caught up yet, in which case the header * is the authoritative ground truth. */ export declare function countSources(page: Page): Promise; //# sourceMappingURL=sources.d.ts.map