@charlie.act7/gemini-notebook-mcp 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +435 -0
  3. package/dist/auth/account-switcher.d.ts +21 -0
  4. package/dist/auth/account-switcher.d.ts.map +1 -0
  5. package/dist/auth/account-switcher.js +54 -0
  6. package/dist/auth/account-switcher.js.map +1 -0
  7. package/dist/auth/auth-manager.d.ts +139 -0
  8. package/dist/auth/auth-manager.d.ts.map +1 -0
  9. package/dist/auth/auth-manager.js +1006 -0
  10. package/dist/auth/auth-manager.js.map +1 -0
  11. package/dist/browser/chromium-fallback.d.ts +24 -0
  12. package/dist/browser/chromium-fallback.d.ts.map +1 -0
  13. package/dist/browser/chromium-fallback.js +53 -0
  14. package/dist/browser/chromium-fallback.js.map +1 -0
  15. package/dist/browser/watchdog.d.ts +35 -0
  16. package/dist/browser/watchdog.d.ts.map +1 -0
  17. package/dist/browser/watchdog.js +74 -0
  18. package/dist/browser/watchdog.js.map +1 -0
  19. package/dist/config.d.ts +99 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +255 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/errors.d.ts +26 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +41 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/index.d.ts +32 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +558 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/library/metadata.d.ts +14 -0
  32. package/dist/library/metadata.d.ts.map +1 -0
  33. package/dist/library/metadata.js +33 -0
  34. package/dist/library/metadata.js.map +1 -0
  35. package/dist/library/notebook-library.d.ts +70 -0
  36. package/dist/library/notebook-library.d.ts.map +1 -0
  37. package/dist/library/notebook-library.js +311 -0
  38. package/dist/library/notebook-library.js.map +1 -0
  39. package/dist/library/types.d.ts +67 -0
  40. package/dist/library/types.d.ts.map +1 -0
  41. package/dist/library/types.js +8 -0
  42. package/dist/library/types.js.map +1 -0
  43. package/dist/notebooklm/audio.d.ts +67 -0
  44. package/dist/notebooklm/audio.d.ts.map +1 -0
  45. package/dist/notebooklm/audio.js +275 -0
  46. package/dist/notebooklm/audio.js.map +1 -0
  47. package/dist/notebooklm/chat.d.ts +79 -0
  48. package/dist/notebooklm/chat.d.ts.map +1 -0
  49. package/dist/notebooklm/chat.js +631 -0
  50. package/dist/notebooklm/chat.js.map +1 -0
  51. package/dist/notebooklm/citations.d.ts +35 -0
  52. package/dist/notebooklm/citations.d.ts.map +1 -0
  53. package/dist/notebooklm/citations.js +173 -0
  54. package/dist/notebooklm/citations.js.map +1 -0
  55. package/dist/notebooklm/selectors.d.ts +168 -0
  56. package/dist/notebooklm/selectors.d.ts.map +1 -0
  57. package/dist/notebooklm/selectors.js +435 -0
  58. package/dist/notebooklm/selectors.js.map +1 -0
  59. package/dist/notebooklm/sources.d.ts +61 -0
  60. package/dist/notebooklm/sources.d.ts.map +1 -0
  61. package/dist/notebooklm/sources.js +324 -0
  62. package/dist/notebooklm/sources.js.map +1 -0
  63. package/dist/notebooklm/url.d.ts +7 -0
  64. package/dist/notebooklm/url.d.ts.map +1 -0
  65. package/dist/notebooklm/url.js +36 -0
  66. package/dist/notebooklm/url.js.map +1 -0
  67. package/dist/resources/resource-handlers.d.ts +22 -0
  68. package/dist/resources/resource-handlers.d.ts.map +1 -0
  69. package/dist/resources/resource-handlers.js +220 -0
  70. package/dist/resources/resource-handlers.js.map +1 -0
  71. package/dist/session/browser-session.d.ts +147 -0
  72. package/dist/session/browser-session.d.ts.map +1 -0
  73. package/dist/session/browser-session.js +838 -0
  74. package/dist/session/browser-session.js.map +1 -0
  75. package/dist/session/session-manager.d.ts +80 -0
  76. package/dist/session/session-manager.d.ts.map +1 -0
  77. package/dist/session/session-manager.js +294 -0
  78. package/dist/session/session-manager.js.map +1 -0
  79. package/dist/session/shared-context-manager.d.ts +107 -0
  80. package/dist/session/shared-context-manager.d.ts.map +1 -0
  81. package/dist/session/shared-context-manager.js +465 -0
  82. package/dist/session/shared-context-manager.js.map +1 -0
  83. package/dist/tools/definitions/ask-question.d.ts +8 -0
  84. package/dist/tools/definitions/ask-question.d.ts.map +1 -0
  85. package/dist/tools/definitions/ask-question.js +244 -0
  86. package/dist/tools/definitions/ask-question.js.map +1 -0
  87. package/dist/tools/definitions/notebook-management.d.ts +9 -0
  88. package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
  89. package/dist/tools/definitions/notebook-management.js +263 -0
  90. package/dist/tools/definitions/notebook-management.js.map +1 -0
  91. package/dist/tools/definitions/session-management.d.ts +12 -0
  92. package/dist/tools/definitions/session-management.d.ts.map +1 -0
  93. package/dist/tools/definitions/session-management.js +82 -0
  94. package/dist/tools/definitions/session-management.js.map +1 -0
  95. package/dist/tools/definitions/sources.d.ts +14 -0
  96. package/dist/tools/definitions/sources.d.ts.map +1 -0
  97. package/dist/tools/definitions/sources.js +200 -0
  98. package/dist/tools/definitions/sources.js.map +1 -0
  99. package/dist/tools/definitions/system.d.ts +9 -0
  100. package/dist/tools/definitions/system.d.ts.map +1 -0
  101. package/dist/tools/definitions/system.js +152 -0
  102. package/dist/tools/definitions/system.js.map +1 -0
  103. package/dist/tools/definitions.d.ts +12 -0
  104. package/dist/tools/definitions.d.ts.map +1 -0
  105. package/dist/tools/definitions.js +28 -0
  106. package/dist/tools/definitions.js.map +1 -0
  107. package/dist/tools/handlers.d.ts +274 -0
  108. package/dist/tools/handlers.d.ts.map +1 -0
  109. package/dist/tools/handlers.js +840 -0
  110. package/dist/tools/handlers.js.map +1 -0
  111. package/dist/tools/index.d.ts +8 -0
  112. package/dist/tools/index.d.ts.map +1 -0
  113. package/dist/tools/index.js +8 -0
  114. package/dist/tools/index.js.map +1 -0
  115. package/dist/transport/http.d.ts +38 -0
  116. package/dist/transport/http.d.ts.map +1 -0
  117. package/dist/transport/http.js +231 -0
  118. package/dist/transport/http.js.map +1 -0
  119. package/dist/types.d.ts +101 -0
  120. package/dist/types.d.ts.map +1 -0
  121. package/dist/types.js +5 -0
  122. package/dist/types.js.map +1 -0
  123. package/dist/utils/cleanup-manager.d.ts +133 -0
  124. package/dist/utils/cleanup-manager.d.ts.map +1 -0
  125. package/dist/utils/cleanup-manager.js +671 -0
  126. package/dist/utils/cleanup-manager.js.map +1 -0
  127. package/dist/utils/cli-handler.d.ts +16 -0
  128. package/dist/utils/cli-handler.d.ts.map +1 -0
  129. package/dist/utils/cli-handler.js +105 -0
  130. package/dist/utils/cli-handler.js.map +1 -0
  131. package/dist/utils/disclaimer.d.ts +31 -0
  132. package/dist/utils/disclaimer.d.ts.map +1 -0
  133. package/dist/utils/disclaimer.js +43 -0
  134. package/dist/utils/disclaimer.js.map +1 -0
  135. package/dist/utils/logger.d.ts +61 -0
  136. package/dist/utils/logger.d.ts.map +1 -0
  137. package/dist/utils/logger.js +92 -0
  138. package/dist/utils/logger.js.map +1 -0
  139. package/dist/utils/page-utils.d.ts +25 -0
  140. package/dist/utils/page-utils.d.ts.map +1 -0
  141. package/dist/utils/page-utils.js +51 -0
  142. package/dist/utils/page-utils.js.map +1 -0
  143. package/dist/utils/settings-manager.d.ts +37 -0
  144. package/dist/utils/settings-manager.d.ts.map +1 -0
  145. package/dist/utils/settings-manager.js +141 -0
  146. package/dist/utils/settings-manager.js.map +1 -0
  147. package/dist/utils/stealth-utils.d.ts +135 -0
  148. package/dist/utils/stealth-utils.d.ts.map +1 -0
  149. package/dist/utils/stealth-utils.js +399 -0
  150. package/dist/utils/stealth-utils.js.map +1 -0
  151. package/docs/configuration.md +181 -0
  152. package/docs/tools.md +417 -0
  153. package/docs/troubleshooting.md +171 -0
  154. package/docs/usage-guide.md +284 -0
  155. package/package.json +71 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Citation extraction for NotebookLM answers (issue #20).
3
+ *
4
+ * NotebookLM renders citation markers like `[1]`, `[2]` inside the answer and
5
+ * — in a separate panel — the cited passage from the source document. v1
6
+ * required the LLM to spell those out manually, which wasted tokens and was
7
+ * unreliable. v2 reads the citations directly from the DOM after the answer
8
+ * settles.
9
+ *
10
+ * Approach:
11
+ * 1. Read all `button.citation-marker` inside the *latest* answer container
12
+ * (so previous answers in the same session don't bleed in).
13
+ * 2. For each marker, click it to open the source panel, read the
14
+ * highlighted passage out of `.paragraph .highlighted`, then press
15
+ * Escape so the chat input remains usable for follow-up questions.
16
+ * 3. Return structured `Citation[]` and a formatted variant of the answer
17
+ * according to the requested `SourceFormat`.
18
+ *
19
+ * All NotebookLM-facing CSS lives in the central selector registry, so a
20
+ * single UI change cannot break both this module and chat extraction.
21
+ */
22
+ import type { Page } from "patchright";
23
+ export type SourceFormat = "none" | "inline" | "footnotes" | "json";
24
+ export interface Citation {
25
+ marker: string;
26
+ number: number;
27
+ sourceName: string;
28
+ sourceText: string;
29
+ }
30
+ export interface ExtractCitationsResult {
31
+ citations: Citation[];
32
+ formattedAnswer: string;
33
+ }
34
+ export declare function extractCitations(page: Page, answerText: string, format?: SourceFormat): Promise<ExtractCitationsResult>;
35
+ //# sourceMappingURL=citations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../../src/notebooklm/citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,YAAqB,GAC5B,OAAO,CAAC,sBAAsB,CAAC,CAkCjC"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Citation extraction for NotebookLM answers (issue #20).
3
+ *
4
+ * NotebookLM renders citation markers like `[1]`, `[2]` inside the answer and
5
+ * — in a separate panel — the cited passage from the source document. v1
6
+ * required the LLM to spell those out manually, which wasted tokens and was
7
+ * unreliable. v2 reads the citations directly from the DOM after the answer
8
+ * settles.
9
+ *
10
+ * Approach:
11
+ * 1. Read all `button.citation-marker` inside the *latest* answer container
12
+ * (so previous answers in the same session don't bleed in).
13
+ * 2. For each marker, click it to open the source panel, read the
14
+ * highlighted passage out of `.paragraph .highlighted`, then press
15
+ * Escape so the chat input remains usable for follow-up questions.
16
+ * 3. Return structured `Citation[]` and a formatted variant of the answer
17
+ * according to the requested `SourceFormat`.
18
+ *
19
+ * All NotebookLM-facing CSS lives in the central selector registry, so a
20
+ * single UI change cannot break both this module and chat extraction.
21
+ */
22
+ import { safeSleep } from "../browser/watchdog.js";
23
+ export async function extractCitations(page, answerText, format = "none") {
24
+ if (format === "none") {
25
+ return { citations: [], formattedAnswer: answerText };
26
+ }
27
+ const rawCitations = await readCitationStubs(page);
28
+ if (rawCitations.length === 0) {
29
+ return { citations: [], formattedAnswer: answerText };
30
+ }
31
+ // Excerpt extraction must run sequentially: each click opens the source
32
+ // panel for the *currently active* citation; doing them in parallel races
33
+ // the same DOM region. We cap each excerpt at 1.5 s so a slow panel can't
34
+ // block the whole batch (issue: ask_question hang after answer rendered).
35
+ const citations = [];
36
+ for (const stub of rawCitations) {
37
+ const sourceText = await extractExcerpt(page, stub.number);
38
+ citations.push({
39
+ marker: `[${stub.number}]`,
40
+ number: stub.number,
41
+ sourceName: stub.sourceName,
42
+ sourceText: sourceText || stub.sourceName,
43
+ });
44
+ }
45
+ // Best-effort: dismiss any source panel still open and refocus the chat
46
+ // input so the next question can be typed without an extra click.
47
+ await page.keyboard.press("Escape").catch(() => undefined);
48
+ await safeSleep(page, 100);
49
+ return {
50
+ citations,
51
+ formattedAnswer: formatAnswer(answerText, citations, format),
52
+ };
53
+ }
54
+ async function readCitationStubs(page) {
55
+ try {
56
+ return (await page.evaluate(`
57
+ (() => {
58
+ const containers = document.querySelectorAll('.to-user-container .message-text-content');
59
+ const scope = containers.length > 0 ? containers[containers.length - 1] : document;
60
+ const buttons = scope.querySelectorAll('button.citation-marker');
61
+ const seen = new Set();
62
+ const out = [];
63
+ buttons.forEach((btn) => {
64
+ const text = btn.textContent || '';
65
+ const match = text.match(/(\\d+)/);
66
+ if (!match) return;
67
+ const num = parseInt(match[1], 10);
68
+ if (seen.has(num)) return;
69
+ seen.add(num);
70
+ const span = btn.querySelector('span[aria-label]');
71
+ let sourceName = '';
72
+ if (span) {
73
+ const label = span.getAttribute('aria-label') || '';
74
+ const colon = label.indexOf(': ');
75
+ sourceName = colon > 0 ? label.slice(colon + 2).trim() : label.trim();
76
+ }
77
+ out.push({ number: num, sourceName });
78
+ });
79
+ return out.sort((a, b) => a.number - b.number);
80
+ })()
81
+ `));
82
+ }
83
+ catch {
84
+ return [];
85
+ }
86
+ }
87
+ async function extractExcerpt(page, number) {
88
+ try {
89
+ const clicked = await page.evaluate(`
90
+ (() => {
91
+ const containers = document.querySelectorAll('.to-user-container .message-text-content');
92
+ const scope = containers.length > 0 ? containers[containers.length - 1] : document;
93
+ const buttons = scope.querySelectorAll('button.citation-marker');
94
+ for (const btn of buttons) {
95
+ const text = btn.textContent || '';
96
+ const match = text.match(/(\\d+)/);
97
+ if (match && parseInt(match[1], 10) === ${number}) {
98
+ btn.scrollIntoView({ block: 'center' });
99
+ btn.click();
100
+ return true;
101
+ }
102
+ }
103
+ return false;
104
+ })()
105
+ `);
106
+ if (!clicked)
107
+ return "";
108
+ // Tight cap: a slow source panel must not stall the answer pipeline.
109
+ // 1500 ms is enough for the highlighted-paragraph render in 95% of cases;
110
+ // the remaining 5% just lose the excerpt (sourceName still goes through).
111
+ const deadline = Date.now() + 1_500;
112
+ while (Date.now() < deadline) {
113
+ const text = (await page.evaluate(`
114
+ (() => {
115
+ const highlights = document.querySelectorAll('.highlighted');
116
+ if (highlights.length === 0) return '';
117
+ const hTexts = Array.from(highlights)
118
+ .map((el) => (el.innerText || '').trim())
119
+ .filter(Boolean);
120
+ if (hTexts.length === 0) return '';
121
+ const parent = highlights[0].closest('.paragraph') || highlights[0].parentElement;
122
+ const pText = (parent && parent.innerText ? parent.innerText : '').trim();
123
+ const hText = hTexts.join(' ');
124
+ return pText.length > hText.length ? pText : hText;
125
+ })()
126
+ `));
127
+ if (text) {
128
+ await page.keyboard.press("Escape").catch(() => undefined);
129
+ return text;
130
+ }
131
+ await safeSleep(page, 150);
132
+ }
133
+ await page.keyboard.press("Escape").catch(() => undefined);
134
+ return "";
135
+ }
136
+ catch {
137
+ return "";
138
+ }
139
+ }
140
+ function formatAnswer(answer, citations, format) {
141
+ if (format === "none" || citations.length === 0)
142
+ return answer;
143
+ switch (format) {
144
+ case "json": {
145
+ // Caller usually returns the structured `citations` field; the answer
146
+ // string itself is left untouched here.
147
+ return answer;
148
+ }
149
+ case "inline": {
150
+ let out = answer;
151
+ for (const c of citations) {
152
+ const replacement = c.sourceText
153
+ ? `${c.marker} (${c.sourceName}: "${truncate(c.sourceText, 200)}")`
154
+ : `${c.marker} (${c.sourceName})`;
155
+ out = out.split(c.marker).join(replacement);
156
+ }
157
+ return out;
158
+ }
159
+ case "footnotes":
160
+ default: {
161
+ const footnotes = citations
162
+ .map((c) => `${c.marker} ${c.sourceName}${c.sourceText && c.sourceText !== c.sourceName ? ` — "${truncate(c.sourceText, 240)}"` : ""}`)
163
+ .join("\n");
164
+ return `${answer}\n\nSources:\n${footnotes}`;
165
+ }
166
+ }
167
+ }
168
+ function truncate(text, max) {
169
+ if (text.length <= max)
170
+ return text;
171
+ return `${text.slice(0, max - 1).trimEnd()}…`;
172
+ }
173
+ //# sourceMappingURL=citations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citations.js","sourceRoot":"","sources":["../../src/notebooklm/citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAgBnD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAU,EACV,UAAkB,EAClB,SAAuB,MAAM;IAE7B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;IACxD,CAAC;IAED,wEAAwE;IACxE,0EAA0E;IAC1E,0EAA0E;IAC1E,0EAA0E;IAC1E,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,SAAS,CAAC,IAAI,CAAC;YACb,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,UAAU,IAAI,IAAI,CAAC,UAAU;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,wEAAwE;IACxE,kEAAkE;IAClE,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC3D,MA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AE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7H;iBACA,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,OAAO,GAAG,MAAM,iBAAiB,SAAS,EAAE,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC;AAChD,CAAC"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Central selector registry for the NotebookLM web UI.
3
+ *
4
+ * # Multilingual strategy
5
+ *
6
+ * Google ships NotebookLM in dozens of locales. Anchor priority:
7
+ *
8
+ * 1. **Class names** (`.add-source-button`, `.single-source-container`,
9
+ * `.submit-button`, `.create-artifact-button-container`, …) — these
10
+ * are Angular component selectors and identical in every locale.
11
+ *
12
+ * 2. **Material-Symbols icon names** (`audio_magic_eraser`, `content_paste`,
13
+ * `link`, `upload`, `download`, …) — Google ships them as the literal
14
+ * text node of `<mat-icon>` in every locale, so they are 100% language-
15
+ * agnostic. Most stable anchor for icon-driven controls.
16
+ *
17
+ * 3. **`role="dialog"`, `role="button"`** — set synchronously by Angular,
18
+ * no animation race.
19
+ *
20
+ * 4. **Locale-bound aria-labels and visible text** — last resort. Each
21
+ * list below covers the eight major NotebookLM locales:
22
+ * EN, DE, FR, ES, PT, IT, NL, JA. Adding more is mechanical; nothing
23
+ * breaks if a locale is missing because the class/icon anchors fire
24
+ * first.
25
+ *
26
+ * Last verified: 2026-05 against the live notebooklm.google.com layout
27
+ * (DE, EN locales).
28
+ */
29
+ export declare const Selectors: {
30
+ readonly chat: {
31
+ readonly message: "chat-message";
32
+ readonly userMessage: ".from-user-container";
33
+ readonly answerContainer: ".to-user-container";
34
+ readonly answerText: ".to-user-container .message-text-content";
35
+ readonly answerActions: ".to-user-container .message-actions";
36
+ readonly jumpToBottomButton: "button.jump-to-bottom-button";
37
+ readonly stopButton: "button.stop-button";
38
+ /**
39
+ * Chat textarea. The class is shared across locales; aria-labels are a
40
+ * fallback for older builds where the class was different.
41
+ */
42
+ readonly queryInput: readonly ["textarea.query-box-input", "textarea[aria-label*=\"query\" i]", "textarea[aria-label*=\"anfrag\" i]", "textarea[aria-label*=\"requete\" i]", "textarea[aria-label*=\"zone de requete\" i]", "textarea[aria-label*=\"consulta\" i]", "textarea[aria-label*=\"domanda\" i]", "textarea[aria-label*=\"vraag\" i]", "textarea[aria-label*=\"質問\" i]", "textarea[aria-label*=\"pergunta\" i]"];
43
+ /**
44
+ * The chat submit button has the *language-bound* aria-label
45
+ * (Send / Senden / Envoyer / Enviar / Invia / Verzenden / 送信). It also
46
+ * has the stable class `.submit-button`. The sources web-search overlay
47
+ * uses `.actions-enter-button` with the SAME aria-label, so we MUST
48
+ * anchor on `.submit-button` to avoid distractor matches.
49
+ */
50
+ readonly submitButton: readonly ["button.submit-button", "button.submit-button[aria-label*=\"send\" i]", "button.submit-button[aria-label*=\"senden\" i]", "button.submit-button[aria-label*=\"envoyer\" i]", "button.submit-button[aria-label*=\"enviar\" i]", "button.submit-button[aria-label*=\"invia\" i]", "button.submit-button[aria-label*=\"verzend\" i]", "button.submit-button[aria-label*=\"送信\" i]"];
51
+ readonly optionsButton: readonly ["button[aria-label=\"Chat options\"]", "button[aria-label=\"Opciones de chat\"]", "button[aria-label=\"Optionen für den Chat\"]", "button[aria-label=\"Options du chat\"]", "button[aria-label=\"Opzioni chat\"]", "button[aria-label=\"Opções do chat\"]", "button[aria-label=\"Chatopties\"]", "button[aria-label=\"チャットのオプション\"]"];
52
+ readonly clearHistoryMenuItem: readonly ["[role=\"menuitem\"]:has-text(\"Clear chat history\")", "[role=\"menuitem\"]:has-text(\"Borrar el historial de chat\")", "[role=\"menuitem\"]:has-text(\"Chatverlauf löschen\")", "[role=\"menuitem\"]:has-text(\"Effacer l’historique du chat\")", "[role=\"menuitem\"]:has-text(\"Cancella cronologia chat\")", "[role=\"menuitem\"]:has-text(\"Limpar histórico do chat\")", "[role=\"menuitem\"]:has-text(\"Chatgeschiedenis wissen\")", "[role=\"menuitem\"]:has-text(\"チャット履歴を削除\")"];
53
+ readonly clearHistoryConfirmButton: readonly ["button:has-text(\"Clear\")", "button:has-text(\"Borrar\")", "button:has-text(\"Löschen\")", "button:has-text(\"Effacer\")", "button:has-text(\"Cancella\")", "button:has-text(\"Limpar\")", "button:has-text(\"Wissen\")", "button:has-text(\"削除\")"];
54
+ };
55
+ /**
56
+ * NotebookLM removed tabs in favour of a three-pane sidebar (2026 layout).
57
+ * These selectors are kept only for the rare legacy layouts.
58
+ */
59
+ readonly tabs: {
60
+ readonly discussion: readonly ["[role=\"tab\"]:has-text(\"Discussion\")", "[role=\"tab\"]:has-text(\"Diskussion\")", "[role=\"tab\"]:has-text(\"Diskussionen\")", "[role=\"tab\"]:has-text(\"Discusión\")", "[role=\"tab\"]:has-text(\"Discussione\")", "[role=\"tab\"]:has-text(\"Discussão\")", "[role=\"tab\"]:has-text(\"ディスカッション\")"];
61
+ readonly sources: readonly ["[role=\"tab\"]:has-text(\"Sources\")", "[role=\"tab\"]:has-text(\"Quellen\")", "[role=\"tab\"]:has-text(\"Fuentes\")", "[role=\"tab\"]:has-text(\"Fonti\")", "[role=\"tab\"]:has-text(\"Fontes\")", "[role=\"tab\"]:has-text(\"Bronnen\")", "[role=\"tab\"]:has-text(\"ソース\")"];
62
+ readonly activeTabClass: "mdc-tab--active";
63
+ readonly tabList: ".mat-mdc-tab-list .mdc-tab";
64
+ };
65
+ readonly citations: {
66
+ readonly button: readonly ["button.citation-marker", "button.xap-inline-dialog.citation-marker", "button[data-citation]"];
67
+ readonly label: "span[aria-label]";
68
+ readonly highlight: ".highlighted";
69
+ readonly paragraph: ".paragraph";
70
+ readonly paragraphHighlight: ".paragraph .highlighted";
71
+ };
72
+ readonly sources: {
73
+ /**
74
+ * Per-source row in the sidebar (language-agnostic). Stable Angular
75
+ * class — verified across all observed locales.
76
+ */
77
+ readonly sourceContainer: ".single-source-container";
78
+ /**
79
+ * "X Quellen" / "X sources" header text. Numeric so we read the count
80
+ * via regex on the visible text. Independent of sidebar collapse state.
81
+ */
82
+ readonly sourceCountIndicator: ".cover-subtitle-source-count";
83
+ /**
84
+ * Sidebar "Add source" button. Class `.add-source-button` is language-
85
+ * agnostic; aria-labels listed for older builds without the class.
86
+ */
87
+ readonly addButton: readonly ["button.add-source-button", "button[aria-label=\"Add source\"]", "button[aria-label*=\"add source\" i]", "button[aria-label*=\"quelle hinzu\" i]", "button[aria-label*=\"ajouter une source\" i]", "button[aria-label*=\"añadir fuente\" i]", "button[aria-label*=\"agregar fuente\" i]", "button[aria-label*=\"aggiungi fonte\" i]", "button[aria-label*=\"adicionar fonte\" i]", "button[aria-label*=\"bron toevoegen\" i]", "button[aria-label*=\"ソースを追加\" i]"];
88
+ /**
89
+ * Real Material modal. `[role="dialog"]` is set by Angular synchronously
90
+ * the moment the modal mounts — race-free against the `.mdc-dialog--open`
91
+ * animation class and resistant to Material-UI version bumps. Avoid
92
+ * `.cdk-overlay-pane` (matches every dropdown / emoji picker / menu).
93
+ */
94
+ readonly overlayPane: "[role=\"dialog\"]";
95
+ readonly overlayInput: "[role=\"dialog\"] input[type=\"text\"]:not([readonly])";
96
+ readonly overlayTextarea: "[role=\"dialog\"] textarea";
97
+ /**
98
+ * Source-type buttons in the Add-source overlay. Google ships them
99
+ * *without* aria-labels — the only stable, language-agnostic anchor is
100
+ * the Material-Symbols icon name baked into a `<mat-icon>` text node.
101
+ */
102
+ readonly sourceTypeUrl: readonly ["button.drop-zone-icon-button:has(mat-icon.youtube-icon)", "button.drop-zone-icon-button:has(mat-icon:text-is(\"link\"))", "button.drop-zone-icon-button:has-text(\"Websites\")", "button.drop-zone-icon-button:has-text(\"Website\")", "button.drop-zone-icon-button:has-text(\"Sites Web\")", "button.drop-zone-icon-button:has-text(\"Sitio web\")", "button.drop-zone-icon-button:has-text(\"Sito web\")", "button.drop-zone-icon-button:has-text(\"Sites\")", "button.drop-zone-icon-button:has-text(\"ウェブサイト\")", "span:has-text(\"Website\")", "span:has-text(\"URL\")"];
103
+ readonly sourceTypeText: readonly ["button.drop-zone-icon-button:has(mat-icon:text-is(\"content_paste\"))", "button.drop-zone-icon-button:has-text(\"Kopierter Text\")", "button.drop-zone-icon-button:has-text(\"Copied text\")", "button.drop-zone-icon-button:has-text(\"Pasted text\")", "button.drop-zone-icon-button:has-text(\"Texte copié\")", "button.drop-zone-icon-button:has-text(\"Texto copiado\")", "button.drop-zone-icon-button:has-text(\"Testo copiato\")", "button.drop-zone-icon-button:has-text(\"Gekopieerde tekst\")", "button.drop-zone-icon-button:has-text(\"コピーしたテキスト\")", "span:has-text(\"Copied text\")", "span:has-text(\"Pasted text\")", "[data-type=\"text\"]"];
104
+ readonly sourceTypeYoutube: readonly ["button.drop-zone-icon-button mat-icon.youtube-icon", "button.drop-zone-icon-button:has(mat-icon:text-is(\"video_youtube\"))"];
105
+ readonly sourceTypeFile: readonly ["input[type=\"file\"]", "button.drop-zone-icon-button:has(mat-icon:text-is(\"upload\"))", "button.drop-zone-icon-button:has-text(\"Dateien hochladen\")", "button.drop-zone-icon-button:has-text(\"Upload sources\")", "button.drop-zone-icon-button:has-text(\"Importer\")", "button.drop-zone-icon-button:has-text(\"Subir\")", "button.drop-zone-icon-button:has-text(\"Carica\")", "button.drop-zone-icon-button:has-text(\"Uploaden\")", "button.drop-zone-icon-button:has-text(\"アップロード\")"];
106
+ /**
107
+ * Primary submit button in the add-source dialog. Material's
108
+ * `.mdc-button--raised` class is the most stable anchor; per-locale
109
+ * visible-text variants are fallbacks for older builds.
110
+ */
111
+ readonly insertConfirm: readonly ["button.mdc-button--raised:has-text(\"Insert\")", "button.mat-flat-button:has-text(\"Insert\")", "button[color=\"primary\"]:has-text(\"Insert\")", "button.mdc-button--raised:has-text(\"Einfügen\")", "button.mdc-button--raised:has-text(\"Hinzufügen\")", "button.mdc-button--raised:has-text(\"Ajouter\")", "button.mdc-button--raised:has-text(\"Insertar\")", "button.mdc-button--raised:has-text(\"Inserisci\")", "button.mdc-button--raised:has-text(\"Invoegen\")", "button.mdc-button--raised:has-text(\"挿入\")", "button:has-text(\"Insert\")", "button:has-text(\"Einfügen\")", "button:has-text(\"Hinzufügen\")", "button:has-text(\"Ajouter\")", "button:has-text(\"Insérer\")", "button:has-text(\"Insertar\")", "button:has-text(\"Añadir\")", "button:has-text(\"Agregar\")", "button:has-text(\"Inserisci\")", "button:has-text(\"Aggiungi\")", "button:has-text(\"Inserir\")", "button:has-text(\"Adicionar\")", "button:has-text(\"Invoegen\")", "button:has-text(\"Toevoegen\")", "button:has-text(\"挿入\")", "button:has-text(\"追加\")", "button:has-text(\"Add\")", "button:has-text(\"Submit\")", "button[type=\"submit\"]", "[role=\"dialog\"] .mdc-dialog__actions button:not(:has-text(\"Cancel\")):not(:has-text(\"Close\")):not(:has-text(\"Schließen\")):not(:has-text(\"Annuler\")):not(:has-text(\"Cancelar\")):not(:has-text(\"Annulla\")):not(:has-text(\"Annuleren\")):not(:has-text(\"キャンセル\"))"];
112
+ };
113
+ readonly studio: {
114
+ /**
115
+ * "Audio Overview" entry control. As of the 2026-05 Studio layout this
116
+ * is a `<div role="button">` with a Material-Symbols `audio_magic_eraser`
117
+ * icon, NOT a real `<button>`. Icon-anchored selectors fire first.
118
+ */
119
+ readonly audioOverviewButton: readonly [".create-artifact-button-container:has(mat-icon:text-is(\"audio_magic_eraser\"))", "[role=\"button\"]:has(mat-icon:text-is(\"audio_magic_eraser\"))", "[role=\"button\"][aria-label*=\"audio-zusammenfassung\" i]", "[role=\"button\"][aria-label*=\"audio overview\" i]", "[role=\"button\"][aria-label*=\"aperçu audio\" i]", "[role=\"button\"][aria-label*=\"resumen de audio\" i]", "[role=\"button\"][aria-label*=\"panoramica audio\" i]", "[role=\"button\"][aria-label*=\"visão geral de áudio\" i]", "[role=\"button\"][aria-label*=\"audio-overzicht\" i]", "[role=\"button\"][aria-label*=\"音声の概要\" i]", "[role=\"button\"][aria-label*=\"audio\" i]", "button:has(mat-icon:text-is(\"audio_magic_eraser\"))", "button[aria-label*=\"audio overview\" i]", "button[aria-label*=\"audio-zusammenfassung\" i]", "button[aria-label*=\"podcast\" i]"];
120
+ /**
121
+ * Generate / Generieren / Générer trigger inside the customise dialog.
122
+ * Visible-text varies by locale.
123
+ */
124
+ readonly generateButton: readonly ["button:has-text(\"Generate\")", "button:has-text(\"Generieren\")", "button:has-text(\"Générer\")", "button:has-text(\"Generer\")", "button:has-text(\"Generar\")", "button:has-text(\"Genera\")", "button:has-text(\"Gerar\")", "button:has-text(\"Genereren\")", "button:has-text(\"生成\")"];
125
+ /**
126
+ * Download trigger. The Studio panel uses an icon-only button with a
127
+ * `download` Material-Symbols glyph; aria-label is locale-bound.
128
+ */
129
+ readonly downloadButton: readonly ["button:has(mat-icon:text-is(\"download\"))", "button[aria-label*=\"download\" i]", "button[aria-label*=\"herunterladen\" i]", "button[aria-label*=\"télécharger\" i]", "button[aria-label*=\"descargar\" i]", "button[aria-label*=\"scarica\" i]", "button[aria-label*=\"baixar\" i]", "button[aria-label*=\"downloaden\" i]", "button[aria-label*=\"ダウンロード\" i]"];
130
+ /**
131
+ * Completed Audio-Overview tile. Modern NotebookLM does NOT mount a real
132
+ * `<audio>` element in the DOM; the player is a custom Angular tile
133
+ * inside `.artifact-library-container > artifact-library-item`. The
134
+ * play-button (`button.artifact-action-button` with locale-bound
135
+ * aria-label "Wiedergeben"/"Play"/…) is the most reliable "audio is
136
+ * ready" signal because it only mounts after generation completes.
137
+ */
138
+ readonly audioPlayer: readonly ["artifact-library-item:has(button.artifact-action-button)", ".artifact-library-container artifact-library-item", "audio", "[role=\"audio\"]"];
139
+ /**
140
+ * Per-tile "Mehr"/"More"/"Plus"/… three-dot button. Opens the menu that
141
+ * contains the Download item.
142
+ */
143
+ readonly audioMoreMenuButton: readonly ["artifact-library-item button:has(mat-icon:text-is(\"more_vert\"))", "artifact-library-item button[aria-label*=\"mehr\" i]", "artifact-library-item button[aria-label*=\"more\" i]", "artifact-library-item button[aria-label*=\"plus\" i]", "artifact-library-item button[aria-label*=\"más\" i]", "artifact-library-item button[aria-label*=\"altro\" i]", "artifact-library-item button[aria-label*=\"mais\" i]", "artifact-library-item button[aria-label*=\"meer\" i]", "artifact-library-item button[aria-label*=\"その他\" i]"];
144
+ /**
145
+ * Download menu-item that surfaces after clicking the three-dot menu.
146
+ */
147
+ readonly audioDownloadMenuItem: readonly ["[role=\"menuitem\"]:has(mat-icon:text-is(\"download\"))", "[role=\"menuitem\"]:has-text(\"Download\")", "[role=\"menuitem\"]:has-text(\"Herunterladen\")", "[role=\"menuitem\"]:has-text(\"Télécharger\")", "[role=\"menuitem\"]:has-text(\"Descargar\")", "[role=\"menuitem\"]:has-text(\"Scarica\")", "[role=\"menuitem\"]:has-text(\"Baixar\")", "[role=\"menuitem\"]:has-text(\"Downloaden\")", "[role=\"menuitem\"]:has-text(\"ダウンロード\")"];
148
+ };
149
+ readonly notebooks: {
150
+ readonly projectCard: "button[aria-labelledby*=\"project-\"]";
151
+ readonly cardMenuButton: readonly ["button[aria-label*=\"menu\" i]", "button[aria-label*=\"options\" i]", "button[aria-label*=\"more\" i]", "button[aria-label*=\"optionen\" i]", "button[aria-label*=\"opzioni\" i]", "button[aria-label*=\"opciones\" i]", "button[aria-label*=\"opções\" i]", "button[aria-label*=\"メニュー\" i]"];
152
+ readonly deleteButton: readonly ["[role=\"menuitem\"]:has-text(\"Delete\")", "[role=\"menuitem\"]:has-text(\"Löschen\")", "[role=\"menuitem\"]:has-text(\"Supprimer\")", "[role=\"menuitem\"]:has-text(\"Eliminar\")", "[role=\"menuitem\"]:has-text(\"Borrar\")", "[role=\"menuitem\"]:has-text(\"Elimina\")", "[role=\"menuitem\"]:has-text(\"Excluir\")", "[role=\"menuitem\"]:has-text(\"Verwijderen\")", "[role=\"menuitem\"]:has-text(\"削除\")"];
153
+ readonly confirmDelete: readonly ["button:has-text(\"Delete\")", "button:has-text(\"Löschen\")", "button:has-text(\"Supprimer\")", "button:has-text(\"Eliminar\")", "button:has-text(\"Borrar\")", "button:has-text(\"Elimina\")", "button:has-text(\"Excluir\")", "button:has-text(\"Verwijderen\")", "button:has-text(\"削除\")"];
154
+ };
155
+ /**
156
+ * Material Icon labels that leak into extracted answer text as isolated
157
+ * lines. Stripped from the response before delivery to the client.
158
+ */
159
+ readonly uiControlLabels: Set<string>;
160
+ };
161
+ /**
162
+ * Joins a list of selector candidates into a comma-separated string.
163
+ * Patchright/Playwright accepts this as a CSS locator (comma = OR).
164
+ *
165
+ * Example: `joinAlt(Selectors.chat.queryInput)` → `"textarea.query-box-input, textarea[aria-label*=\"query\" i], ..."`
166
+ */
167
+ export declare function joinAlt(selectors: readonly string[]): string;
168
+ //# sourceMappingURL=selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/notebooklm/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;QASlB;;;WAGG;;QAaH;;;;;;WAMG;;;;;;IA2CL;;;OAGG;;;;;;;;;;;;;;;QAqCD;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QAcH;;;;;WAKG;;;;QAIH;;;;WAIG;;;;;QA+CH;;;;WAIG;;;;QAsCH;;;;WAIG;;QAqBH;;;WAGG;;QAYH;;;WAGG;;QAcH;;;;;;;WAOG;;QAQH;;;WAGG;;QAYH;;WAEG;;;;;;;;;IAkDL;;;OAGG;;CAiBK,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE5D"}