@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.
- package/LICENSE +21 -0
- package/README.md +435 -0
- package/dist/auth/account-switcher.d.ts +21 -0
- package/dist/auth/account-switcher.d.ts.map +1 -0
- package/dist/auth/account-switcher.js +54 -0
- package/dist/auth/account-switcher.js.map +1 -0
- package/dist/auth/auth-manager.d.ts +139 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.js +1006 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/browser/chromium-fallback.d.ts +24 -0
- package/dist/browser/chromium-fallback.d.ts.map +1 -0
- package/dist/browser/chromium-fallback.js +53 -0
- package/dist/browser/chromium-fallback.js.map +1 -0
- package/dist/browser/watchdog.d.ts +35 -0
- package/dist/browser/watchdog.d.ts.map +1 -0
- package/dist/browser/watchdog.js +74 -0
- package/dist/browser/watchdog.js.map +1 -0
- package/dist/config.d.ts +99 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +255 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +558 -0
- package/dist/index.js.map +1 -0
- package/dist/library/metadata.d.ts +14 -0
- package/dist/library/metadata.d.ts.map +1 -0
- package/dist/library/metadata.js +33 -0
- package/dist/library/metadata.js.map +1 -0
- package/dist/library/notebook-library.d.ts +70 -0
- package/dist/library/notebook-library.d.ts.map +1 -0
- package/dist/library/notebook-library.js +311 -0
- package/dist/library/notebook-library.js.map +1 -0
- package/dist/library/types.d.ts +67 -0
- package/dist/library/types.d.ts.map +1 -0
- package/dist/library/types.js +8 -0
- package/dist/library/types.js.map +1 -0
- package/dist/notebooklm/audio.d.ts +67 -0
- package/dist/notebooklm/audio.d.ts.map +1 -0
- package/dist/notebooklm/audio.js +275 -0
- package/dist/notebooklm/audio.js.map +1 -0
- package/dist/notebooklm/chat.d.ts +79 -0
- package/dist/notebooklm/chat.d.ts.map +1 -0
- package/dist/notebooklm/chat.js +631 -0
- package/dist/notebooklm/chat.js.map +1 -0
- package/dist/notebooklm/citations.d.ts +35 -0
- package/dist/notebooklm/citations.d.ts.map +1 -0
- package/dist/notebooklm/citations.js +173 -0
- package/dist/notebooklm/citations.js.map +1 -0
- package/dist/notebooklm/selectors.d.ts +168 -0
- package/dist/notebooklm/selectors.d.ts.map +1 -0
- package/dist/notebooklm/selectors.js +435 -0
- package/dist/notebooklm/selectors.js.map +1 -0
- package/dist/notebooklm/sources.d.ts +61 -0
- package/dist/notebooklm/sources.d.ts.map +1 -0
- package/dist/notebooklm/sources.js +324 -0
- package/dist/notebooklm/sources.js.map +1 -0
- package/dist/notebooklm/url.d.ts +7 -0
- package/dist/notebooklm/url.d.ts.map +1 -0
- package/dist/notebooklm/url.js +36 -0
- package/dist/notebooklm/url.js.map +1 -0
- package/dist/resources/resource-handlers.d.ts +22 -0
- package/dist/resources/resource-handlers.d.ts.map +1 -0
- package/dist/resources/resource-handlers.js +220 -0
- package/dist/resources/resource-handlers.js.map +1 -0
- package/dist/session/browser-session.d.ts +147 -0
- package/dist/session/browser-session.d.ts.map +1 -0
- package/dist/session/browser-session.js +838 -0
- package/dist/session/browser-session.js.map +1 -0
- package/dist/session/session-manager.d.ts +80 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +294 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/shared-context-manager.d.ts +107 -0
- package/dist/session/shared-context-manager.d.ts.map +1 -0
- package/dist/session/shared-context-manager.js +465 -0
- package/dist/session/shared-context-manager.js.map +1 -0
- package/dist/tools/definitions/ask-question.d.ts +8 -0
- package/dist/tools/definitions/ask-question.d.ts.map +1 -0
- package/dist/tools/definitions/ask-question.js +244 -0
- package/dist/tools/definitions/ask-question.js.map +1 -0
- package/dist/tools/definitions/notebook-management.d.ts +9 -0
- package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-management.js +263 -0
- package/dist/tools/definitions/notebook-management.js.map +1 -0
- package/dist/tools/definitions/session-management.d.ts +12 -0
- package/dist/tools/definitions/session-management.d.ts.map +1 -0
- package/dist/tools/definitions/session-management.js +82 -0
- package/dist/tools/definitions/session-management.js.map +1 -0
- package/dist/tools/definitions/sources.d.ts +14 -0
- package/dist/tools/definitions/sources.d.ts.map +1 -0
- package/dist/tools/definitions/sources.js +200 -0
- package/dist/tools/definitions/sources.js.map +1 -0
- package/dist/tools/definitions/system.d.ts +9 -0
- package/dist/tools/definitions/system.d.ts.map +1 -0
- package/dist/tools/definitions/system.js +152 -0
- package/dist/tools/definitions/system.js.map +1 -0
- package/dist/tools/definitions.d.ts +12 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +28 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers.d.ts +274 -0
- package/dist/tools/handlers.d.ts.map +1 -0
- package/dist/tools/handlers.js +840 -0
- package/dist/tools/handlers.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/transport/http.d.ts +38 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +231 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +133 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +671 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/cli-handler.d.ts +16 -0
- package/dist/utils/cli-handler.d.ts.map +1 -0
- package/dist/utils/cli-handler.js +105 -0
- package/dist/utils/cli-handler.js.map +1 -0
- package/dist/utils/disclaimer.d.ts +31 -0
- package/dist/utils/disclaimer.d.ts.map +1 -0
- package/dist/utils/disclaimer.js +43 -0
- package/dist/utils/disclaimer.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +92 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/page-utils.d.ts +25 -0
- package/dist/utils/page-utils.d.ts.map +1 -0
- package/dist/utils/page-utils.js +51 -0
- package/dist/utils/page-utils.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +37 -0
- package/dist/utils/settings-manager.d.ts.map +1 -0
- package/dist/utils/settings-manager.js +141 -0
- package/dist/utils/settings-manager.js.map +1 -0
- package/dist/utils/stealth-utils.d.ts +135 -0
- package/dist/utils/stealth-utils.d.ts.map +1 -0
- package/dist/utils/stealth-utils.js +399 -0
- package/dist/utils/stealth-utils.js.map +1 -0
- package/docs/configuration.md +181 -0
- package/docs/tools.md +417 -0
- package/docs/troubleshooting.md +171 -0
- package/docs/usage-guide.md +284 -0
- package/package.json +71 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NotebookLM source ingestion (issue #25).
|
|
3
|
+
*
|
|
4
|
+
* v2.0.0 supports the two source types that cover the bulk of real usage:
|
|
5
|
+
* - `url` — paste a website URL (NotebookLM crawls and indexes it)
|
|
6
|
+
* - `text` — paste raw text (treated as a copied document)
|
|
7
|
+
*
|
|
8
|
+
* File-upload, YouTube and Google-Drive ingestion are intentionally out of
|
|
9
|
+
* scope for v2.0.0 — they require different overlay flows.
|
|
10
|
+
*
|
|
11
|
+
* Robustness strategy (2026-05, ported from the Fork's content-manager.ts):
|
|
12
|
+
*
|
|
13
|
+
* 1. Capture the *expected notebook UUID* from the URL up-front. NotebookLM
|
|
14
|
+
* sometimes redirects pasted-text uploads to a freshly-created notebook;
|
|
15
|
+
* we detect that and surface a clear error.
|
|
16
|
+
*
|
|
17
|
+
* 2. Resolve the dialog state defensively: if a dialog is already open we
|
|
18
|
+
* use it; otherwise we click the sidebar "Add source" button. The
|
|
19
|
+
* `[role="dialog"]` anchor is set synchronously on mount, so we do not
|
|
20
|
+
* have to race the Material `.mdc-dialog--open` animation class.
|
|
21
|
+
*
|
|
22
|
+
* 3. Source-type buttons no longer ship with aria-labels — see
|
|
23
|
+
* selectors.ts for the icon-/text-based anchors.
|
|
24
|
+
*
|
|
25
|
+
* 4. Insert verification is COUNT-BASED: snapshot
|
|
26
|
+
* `.single-source-container` count before the submit click, then poll
|
|
27
|
+
* after the dialog closes (up to 90 s — URL crawls are slow).
|
|
28
|
+
*/
|
|
29
|
+
import { Selectors, joinAlt } from "./selectors.js";
|
|
30
|
+
import { safeSleep, isRecoverable } from "../browser/watchdog.js";
|
|
31
|
+
import { log } from "../utils/logger.js";
|
|
32
|
+
export async function addSource(page, input) {
|
|
33
|
+
const initialUrl = page.url();
|
|
34
|
+
const expectedUuid = initialUrl.match(/notebook\/([a-f0-9-]+)/)?.[1];
|
|
35
|
+
log.info(`📄 [add_source] type=${input.type} target_uuid=${expectedUuid ?? "?"}`);
|
|
36
|
+
try {
|
|
37
|
+
// 1. Open the Add-source dialog (or use one that's already open).
|
|
38
|
+
await openAddSourceOverlay(page);
|
|
39
|
+
// 2. Pick the source type if there is a picker. Some overlay variants
|
|
40
|
+
// drop straight into an input field; pickSourceType is a no-op then.
|
|
41
|
+
await pickSourceType(page, input.type);
|
|
42
|
+
// 3. Fill the content + optional title.
|
|
43
|
+
await fillSourceContent(page, input);
|
|
44
|
+
// 4. Snapshot the source count *before* submitting. The Fork captures it
|
|
45
|
+
// here (dialog still open, sidebar list not yet updated) so the
|
|
46
|
+
// post-close poll can detect a real increment.
|
|
47
|
+
const before = await countSources(page);
|
|
48
|
+
log.info(` 📊 source count before submit: ${before}`);
|
|
49
|
+
// 5. Click the primary "Insert" / "Hinzufügen" button.
|
|
50
|
+
await confirmInsert(page);
|
|
51
|
+
// 6. Wait for the dialog to animate away. NotebookLM doesn't append the
|
|
52
|
+
// new sidebar entry until the modal is fully gone.
|
|
53
|
+
await waitForOverlayToClose(page);
|
|
54
|
+
// 7. UUID redirect check: pasted-text uploads occasionally land in a new
|
|
55
|
+
// "Untitled notebook" instead of the target. Catch that here so the
|
|
56
|
+
// caller sees a useful error instead of a phantom success.
|
|
57
|
+
if (expectedUuid) {
|
|
58
|
+
const currentUrl = page.url();
|
|
59
|
+
const currentUuid = currentUrl.match(/notebook\/([a-f0-9-]+)/)?.[1];
|
|
60
|
+
if (currentUuid && currentUuid !== expectedUuid) {
|
|
61
|
+
log.error(` ❌ Notebook redirect: expected ${expectedUuid}, got ${currentUuid}`);
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
type: input.type,
|
|
65
|
+
sourceCountBefore: before,
|
|
66
|
+
sourceCountAfter: before,
|
|
67
|
+
message: `NotebookLM redirected to a different notebook (${currentUuid}) instead of ` +
|
|
68
|
+
`the target (${expectedUuid}). This is a known quirk for pasted-text uploads — ` +
|
|
69
|
+
`the source landed in a new "Untitled notebook".`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 8. Poll the source count for up to 90 s; URL crawls and large pastes
|
|
74
|
+
// can take a while to materialise as a sidebar entry.
|
|
75
|
+
const after = await waitForSourceCountIncrease(page, before, 90_000);
|
|
76
|
+
if (after > before) {
|
|
77
|
+
log.success(` ✅ source added (count ${before} → ${after})`);
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
type: input.type,
|
|
81
|
+
sourceCountBefore: before,
|
|
82
|
+
sourceCountAfter: after,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// 9. Last-ditch: maybe an error toast surfaced; surface it verbatim.
|
|
86
|
+
const errorText = await readDialogError(page);
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
type: input.type,
|
|
90
|
+
sourceCountBefore: before,
|
|
91
|
+
sourceCountAfter: after,
|
|
92
|
+
message: errorText ||
|
|
93
|
+
"Source dialog completed but the source list did not grow within 90 s. " +
|
|
94
|
+
"Either NotebookLM is still crawling/indexing or the upload silently failed.",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (isRecoverable(err))
|
|
99
|
+
throw err;
|
|
100
|
+
log.warning(` ⚠️ add_source failed: ${err}`);
|
|
101
|
+
return {
|
|
102
|
+
success: false,
|
|
103
|
+
type: input.type,
|
|
104
|
+
sourceCountBefore: 0,
|
|
105
|
+
sourceCountAfter: 0,
|
|
106
|
+
message: err instanceof Error ? err.message : String(err),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Count sources in the sidebar via two independent anchors:
|
|
112
|
+
*
|
|
113
|
+
* 1. `.single-source-container` — the per-row sidebar element. Most
|
|
114
|
+
* direct, but only present once the sidebar has hydrated.
|
|
115
|
+
*
|
|
116
|
+
* 2. `.cover-subtitle-source-count` — a header label of the form
|
|
117
|
+
* `"3 Quellen"` / `"3 sources"`. Robust to a collapsed or partially
|
|
118
|
+
* hydrated sidebar because it lives in the chat header instead.
|
|
119
|
+
*
|
|
120
|
+
* We return whichever produces a higher count; mismatches between the two
|
|
121
|
+
* usually mean the sidebar hasn't caught up yet, in which case the header
|
|
122
|
+
* is the authoritative ground truth.
|
|
123
|
+
*/
|
|
124
|
+
export async function countSources(page) {
|
|
125
|
+
let containerCount = 0;
|
|
126
|
+
try {
|
|
127
|
+
containerCount = await page.locator(Selectors.sources.sourceContainer).count();
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
/* fall through */
|
|
131
|
+
}
|
|
132
|
+
let headerCount = 0;
|
|
133
|
+
try {
|
|
134
|
+
const headerText = await page
|
|
135
|
+
.locator(".cover-subtitle-source-count")
|
|
136
|
+
.first()
|
|
137
|
+
.textContent({ timeout: 500 })
|
|
138
|
+
.catch(() => null);
|
|
139
|
+
const match = headerText?.match(/(\d+)/);
|
|
140
|
+
if (match)
|
|
141
|
+
headerCount = parseInt(match[1], 10);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
/* ignore */
|
|
145
|
+
}
|
|
146
|
+
return Math.max(containerCount, headerCount);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Open the Add-source modal. Order of attempts:
|
|
150
|
+
* 1. Dialog already open → use it (auto-modal on fresh notebooks).
|
|
151
|
+
* 2. Click the sidebar "Add source" button.
|
|
152
|
+
* 3. Last resort: navigate to `?addSource=true`, which auto-opens.
|
|
153
|
+
*/
|
|
154
|
+
async function openAddSourceOverlay(page) {
|
|
155
|
+
if (await isOverlayVisible(page)) {
|
|
156
|
+
log.info(" ✅ Add-source dialog already open, reusing");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// Try the sidebar button first — fastest path on a populated notebook.
|
|
160
|
+
try {
|
|
161
|
+
await page.locator(joinAlt(Selectors.sources.addButton)).first().click({ timeout: 5_000 });
|
|
162
|
+
await page
|
|
163
|
+
.locator(Selectors.sources.overlayPane)
|
|
164
|
+
.first()
|
|
165
|
+
.waitFor({ state: "visible", timeout: 8_000 });
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
log.warning(` ⚠️ Add-source button click failed (${err}), trying ?addSource=true URL fallback`);
|
|
170
|
+
}
|
|
171
|
+
// URL fallback — useful when the sidebar button is hidden or covered.
|
|
172
|
+
const url = page.url();
|
|
173
|
+
if (url && /\/notebook\//.test(url) && !url.includes("addSource=true")) {
|
|
174
|
+
const u = new URL(url);
|
|
175
|
+
u.searchParams.set("addSource", "true");
|
|
176
|
+
await page.goto(u.toString(), { waitUntil: "domcontentloaded", timeout: 15_000 });
|
|
177
|
+
await page
|
|
178
|
+
.locator(Selectors.sources.overlayPane)
|
|
179
|
+
.first()
|
|
180
|
+
.waitFor({ state: "visible", timeout: 10_000 });
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
throw new Error('Could not open the "Add source" dialog');
|
|
184
|
+
}
|
|
185
|
+
async function isOverlayVisible(page) {
|
|
186
|
+
return page
|
|
187
|
+
.locator(Selectors.sources.overlayPane)
|
|
188
|
+
.first()
|
|
189
|
+
.isVisible({ timeout: 500 })
|
|
190
|
+
.catch(() => false);
|
|
191
|
+
}
|
|
192
|
+
async function pickSourceType(page, type) {
|
|
193
|
+
const candidates = type === "url" ? Selectors.sources.sourceTypeUrl : Selectors.sources.sourceTypeText;
|
|
194
|
+
const overlay = page.locator(Selectors.sources.overlayPane).first();
|
|
195
|
+
for (const sel of candidates) {
|
|
196
|
+
const target = overlay.locator(sel).first();
|
|
197
|
+
if (await target.isVisible({ timeout: 1_000 }).catch(() => false)) {
|
|
198
|
+
await target.click();
|
|
199
|
+
// Sub-dialog needs a moment to hydrate before we type.
|
|
200
|
+
await safeSleep(page, 500);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Older overlays drop straight to the input (no type picker) — that's fine.
|
|
205
|
+
}
|
|
206
|
+
async function fillSourceContent(page, input) {
|
|
207
|
+
const overlay = page.locator(Selectors.sources.overlayPane).first();
|
|
208
|
+
// Wait for the overlay to actually contain a textarea (the picker swap is
|
|
209
|
+
// animated, so a tight 500 ms wait beats a busy poll).
|
|
210
|
+
await safeSleep(page, 500);
|
|
211
|
+
const inputCandidates = [
|
|
212
|
+
Selectors.sources.overlayTextarea,
|
|
213
|
+
Selectors.sources.overlayInput,
|
|
214
|
+
`${Selectors.sources.overlayPane} textarea:not(.query-box-input):not(.query-box-textarea)`,
|
|
215
|
+
];
|
|
216
|
+
let target = null;
|
|
217
|
+
for (const sel of inputCandidates) {
|
|
218
|
+
const candidate = page.locator(sel).first();
|
|
219
|
+
if (await candidate.isVisible({ timeout: 2_000 }).catch(() => false)) {
|
|
220
|
+
target = candidate;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!target) {
|
|
225
|
+
throw new Error("Could not find an input field inside the Add-source overlay. " +
|
|
226
|
+
"NotebookLM UI may have changed — please file an issue.");
|
|
227
|
+
}
|
|
228
|
+
// Title goes in a separate input when one is present; otherwise we prefix
|
|
229
|
+
// it onto the text content (Fork's fallback for older overlays).
|
|
230
|
+
let body = input.content;
|
|
231
|
+
if (input.title && input.type === "text") {
|
|
232
|
+
let titleInputFound = false;
|
|
233
|
+
const titleSelectors = [
|
|
234
|
+
'input[placeholder*="title" i]',
|
|
235
|
+
'input[placeholder*="name" i]',
|
|
236
|
+
'input[name="title"]',
|
|
237
|
+
`${Selectors.sources.overlayPane} input[type="text"]:not([readonly])`,
|
|
238
|
+
];
|
|
239
|
+
for (const sel of titleSelectors) {
|
|
240
|
+
const candidate = overlay.locator(sel).first();
|
|
241
|
+
if (await candidate.isVisible({ timeout: 500 }).catch(() => false)) {
|
|
242
|
+
await candidate.fill(input.title).catch(() => undefined);
|
|
243
|
+
titleInputFound = true;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (!titleInputFound) {
|
|
248
|
+
body = `${input.title}\n\n${input.content}`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
await target.fill(body);
|
|
252
|
+
// Small settle delay before clicking submit; Material's primary button
|
|
253
|
+
// briefly stays disabled after `fill()` while validators run.
|
|
254
|
+
await safeSleep(page, 300);
|
|
255
|
+
}
|
|
256
|
+
async function confirmInsert(page) {
|
|
257
|
+
const overlay = page.locator(Selectors.sources.overlayPane).first();
|
|
258
|
+
for (const sel of Selectors.sources.insertConfirm) {
|
|
259
|
+
const btn = overlay.locator(sel).first();
|
|
260
|
+
if (await btn.isVisible({ timeout: 1_000 }).catch(() => false)) {
|
|
261
|
+
const disabled = await btn.isDisabled().catch(() => false);
|
|
262
|
+
if (disabled)
|
|
263
|
+
continue;
|
|
264
|
+
await btn.click();
|
|
265
|
+
log.info(` ✅ submit clicked (selector: ${sel})`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// Fallback: pressing Enter in many flows submits the form.
|
|
270
|
+
log.warning(" ⚠️ No insert button matched, pressing Enter as fallback");
|
|
271
|
+
await page.keyboard.press("Enter");
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Wait until the Add-source modal animates away. NotebookLM only appends the
|
|
275
|
+
* new sidebar entry once the modal is fully gone, so we *must* wait here.
|
|
276
|
+
*/
|
|
277
|
+
async function waitForOverlayToClose(page, timeoutMs = 30_000) {
|
|
278
|
+
await page
|
|
279
|
+
.locator(Selectors.sources.overlayPane)
|
|
280
|
+
.first()
|
|
281
|
+
.waitFor({ state: "hidden", timeout: timeoutMs })
|
|
282
|
+
.catch(() => undefined);
|
|
283
|
+
}
|
|
284
|
+
async function waitForSourceCountIncrease(page, before, timeoutMs = 90_000) {
|
|
285
|
+
const deadline = Date.now() + timeoutMs;
|
|
286
|
+
while (Date.now() < deadline) {
|
|
287
|
+
const current = await countSources(page);
|
|
288
|
+
if (current > before)
|
|
289
|
+
return current;
|
|
290
|
+
await safeSleep(page, 500);
|
|
291
|
+
}
|
|
292
|
+
return await countSources(page);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Look for an error toast / `[role="alert"]` describing why the upload
|
|
296
|
+
* failed. We filter against Material-icon-name leakage (e.g. `more_vert`),
|
|
297
|
+
* which would otherwise produce nonsense error strings.
|
|
298
|
+
*/
|
|
299
|
+
async function readDialogError(page) {
|
|
300
|
+
const errorSelectors = [
|
|
301
|
+
'[role="alert"]:visible',
|
|
302
|
+
".error-message:visible",
|
|
303
|
+
".mdc-snackbar--open",
|
|
304
|
+
];
|
|
305
|
+
const ICON_LEAKS = ["more_vert", "more_horiz", "open_in_new", "content_copy"];
|
|
306
|
+
for (const sel of errorSelectors) {
|
|
307
|
+
try {
|
|
308
|
+
const el = page.locator(sel).first();
|
|
309
|
+
if (!(await el.isVisible({ timeout: 300 }).catch(() => false)))
|
|
310
|
+
continue;
|
|
311
|
+
const txt = (await el.textContent({ timeout: 1_000 }).catch(() => null))?.trim();
|
|
312
|
+
if (!txt || txt.length > 240)
|
|
313
|
+
continue;
|
|
314
|
+
if (ICON_LEAKS.some((leak) => txt.includes(leak)))
|
|
315
|
+
continue;
|
|
316
|
+
return txt;
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/notebooklm/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAoBzC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAU,EAAE,KAAqB;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrE,GAAG,CAAC,IAAI,CAAC,wBAAwB,KAAK,CAAC,IAAI,gBAAgB,YAAY,IAAI,GAAG,EAAE,CAAC,CAAC;IAElF,IAAI,CAAC;QACH,kEAAkE;QAClE,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAEjC,sEAAsE;QACtE,wEAAwE;QACxE,MAAM,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvC,wCAAwC;QACxC,MAAM,iBAAiB,CAAC,IAAI,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ookLmPageUrl(value: string): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Validate and normalize a NotebookLM notebook URL before it is persisted or
|
|
4
|
+
* opened in the authenticated browser context.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeNotebookUrl(value: string): string;
|
|
7
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/notebooklm/url.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const NOTEBOOKLM_HOSTS = new Set(["notebook.google.com", "notebooklm.google.com"]);
|
|
2
|
+
const NOTEBOOK_PATH = /^\/notebook\/[a-zA-Z0-9_-]+\/?$/;
|
|
3
|
+
export function isNotebookLmPageUrl(value) {
|
|
4
|
+
try {
|
|
5
|
+
const url = new URL(value);
|
|
6
|
+
return url.protocol === "https:" && NOTEBOOKLM_HOSTS.has(url.hostname.toLowerCase());
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate and normalize a NotebookLM notebook URL before it is persisted or
|
|
14
|
+
* opened in the authenticated browser context.
|
|
15
|
+
*/
|
|
16
|
+
export function normalizeNotebookUrl(value) {
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(value.trim());
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new Error("Notebook URL must be a valid absolute URL");
|
|
23
|
+
}
|
|
24
|
+
if (url.protocol !== "https:") {
|
|
25
|
+
throw new Error("Notebook URL must use HTTPS");
|
|
26
|
+
}
|
|
27
|
+
if (!NOTEBOOKLM_HOSTS.has(url.hostname.toLowerCase())) {
|
|
28
|
+
throw new Error("Notebook URL host must be notebook.google.com or notebooklm.google.com");
|
|
29
|
+
}
|
|
30
|
+
if (!NOTEBOOK_PATH.test(url.pathname)) {
|
|
31
|
+
throw new Error("Notebook URL must match https://notebook.google.com/notebook/<notebook-id>");
|
|
32
|
+
}
|
|
33
|
+
url.hash = "";
|
|
34
|
+
return url.toString();
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/notebooklm/url.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC,CAAC;AACnF,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;IACd,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import type { NotebookLibrary } from "../library/notebook-library.js";
|
|
3
|
+
/**
|
|
4
|
+
* Handlers for MCP Resource-related requests
|
|
5
|
+
*/
|
|
6
|
+
export declare class ResourceHandlers {
|
|
7
|
+
private library;
|
|
8
|
+
constructor(library: NotebookLibrary);
|
|
9
|
+
/**
|
|
10
|
+
* Register all resource handlers to the server
|
|
11
|
+
*/
|
|
12
|
+
registerHandlers(server: Server): void;
|
|
13
|
+
/**
|
|
14
|
+
* Return notebook IDs matching the provided input (case-insensitive contains)
|
|
15
|
+
*/
|
|
16
|
+
private completeNotebookIds;
|
|
17
|
+
/**
|
|
18
|
+
* Build a completion payload for MCP responses
|
|
19
|
+
*/
|
|
20
|
+
private buildCompletion;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resource-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-handlers.d.ts","sourceRoot":"","sources":["../../src/resources/resource-handlers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,EAAE,eAAe;IAIpC;;OAEG;IACI,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IA0N7C;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;OAEG;IACH,OAAO,CAAC,eAAe;CAQxB"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, CompleteRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { log } from "../utils/logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Handlers for MCP Resource-related requests
|
|
5
|
+
*/
|
|
6
|
+
export class ResourceHandlers {
|
|
7
|
+
library;
|
|
8
|
+
constructor(library) {
|
|
9
|
+
this.library = library;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Register all resource handlers to the server
|
|
13
|
+
*/
|
|
14
|
+
registerHandlers(server) {
|
|
15
|
+
// List available resources
|
|
16
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
17
|
+
log.info("📚 [MCP] list_resources request received");
|
|
18
|
+
const notebooks = this.library.listNotebooks();
|
|
19
|
+
const resources = [
|
|
20
|
+
{
|
|
21
|
+
uri: "notebooklm://library",
|
|
22
|
+
name: "Notebook Library",
|
|
23
|
+
description: "Complete notebook library with all available knowledge sources. " +
|
|
24
|
+
"Read this to discover what notebooks are available. " +
|
|
25
|
+
"⚠️ If you think a notebook might help with the user's task, " +
|
|
26
|
+
"ASK THE USER FOR PERMISSION before consulting it: " +
|
|
27
|
+
"'Should I consult the [notebook] for this task?'",
|
|
28
|
+
mimeType: "application/json",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
// Add individual notebook resources
|
|
32
|
+
for (const notebook of notebooks) {
|
|
33
|
+
resources.push({
|
|
34
|
+
uri: `notebooklm://library/${notebook.id}`,
|
|
35
|
+
name: notebook.name,
|
|
36
|
+
description: `${notebook.description} | Topics: ${notebook.topics.join(", ")} | ` +
|
|
37
|
+
`💡 Use ask_question to query this notebook (ask user permission first if task isn't explicitly about these topics)`,
|
|
38
|
+
mimeType: "application/json",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Add legacy metadata resource for backwards compatibility
|
|
42
|
+
const active = this.library.getActiveNotebook();
|
|
43
|
+
if (active) {
|
|
44
|
+
resources.push({
|
|
45
|
+
uri: "notebooklm://metadata",
|
|
46
|
+
name: "Active Notebook Metadata (Legacy)",
|
|
47
|
+
description: "Information about the currently active notebook. " +
|
|
48
|
+
"DEPRECATED: Use notebooklm://library instead for multi-notebook support. " +
|
|
49
|
+
"⚠️ Always ask user permission before using notebooks for tasks they didn't explicitly mention.",
|
|
50
|
+
mimeType: "application/json",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return { resources };
|
|
54
|
+
});
|
|
55
|
+
// List resource templates
|
|
56
|
+
server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
|
|
57
|
+
log.info("📑 [MCP] list_resource_templates request received");
|
|
58
|
+
return {
|
|
59
|
+
resourceTemplates: [
|
|
60
|
+
{
|
|
61
|
+
uriTemplate: "notebooklm://library/{id}",
|
|
62
|
+
name: "Notebook by ID",
|
|
63
|
+
description: "Access a specific notebook from your library by ID. " +
|
|
64
|
+
"Provides detailed metadata about the notebook including topics, use cases, and usage statistics. " +
|
|
65
|
+
"💡 Use the 'id' parameter from list_notebooks to access specific notebooks.",
|
|
66
|
+
mimeType: "application/json",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
// Read resource content
|
|
72
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
73
|
+
const { uri } = request.params;
|
|
74
|
+
log.info(`📖 [MCP] read_resource request: ${uri}`);
|
|
75
|
+
// Handle library resource
|
|
76
|
+
if (uri === "notebooklm://library") {
|
|
77
|
+
const notebooks = this.library.listNotebooks();
|
|
78
|
+
const stats = this.library.getStats();
|
|
79
|
+
const active = this.library.getActiveNotebook();
|
|
80
|
+
const libraryData = {
|
|
81
|
+
active_notebook: active
|
|
82
|
+
? {
|
|
83
|
+
id: active.id,
|
|
84
|
+
name: active.name,
|
|
85
|
+
description: active.description,
|
|
86
|
+
topics: active.topics,
|
|
87
|
+
}
|
|
88
|
+
: null,
|
|
89
|
+
notebooks: notebooks.map((nb) => ({
|
|
90
|
+
id: nb.id,
|
|
91
|
+
name: nb.name,
|
|
92
|
+
description: nb.description,
|
|
93
|
+
topics: nb.topics,
|
|
94
|
+
content_types: nb.content_types,
|
|
95
|
+
use_cases: nb.use_cases,
|
|
96
|
+
url: nb.url,
|
|
97
|
+
use_count: nb.use_count,
|
|
98
|
+
last_used: nb.last_used,
|
|
99
|
+
tags: nb.tags,
|
|
100
|
+
})),
|
|
101
|
+
stats,
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
contents: [
|
|
105
|
+
{
|
|
106
|
+
uri,
|
|
107
|
+
mimeType: "application/json",
|
|
108
|
+
text: JSON.stringify(libraryData, null, 2),
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// Handle individual notebook resource
|
|
114
|
+
if (uri.startsWith("notebooklm://library/")) {
|
|
115
|
+
const prefix = "notebooklm://library/";
|
|
116
|
+
const encodedId = uri.slice(prefix.length);
|
|
117
|
+
if (!encodedId) {
|
|
118
|
+
throw new Error("Notebook resource requires an ID (e.g. notebooklm://library/{id})");
|
|
119
|
+
}
|
|
120
|
+
let id;
|
|
121
|
+
try {
|
|
122
|
+
id = decodeURIComponent(encodedId);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
throw new Error(`Invalid notebook identifier encoding: ${encodedId}`);
|
|
126
|
+
}
|
|
127
|
+
if (!/^[a-z0-9][a-z0-9-]{0,62}$/i.test(id)) {
|
|
128
|
+
throw new Error(`Invalid notebook identifier: ${encodedId}. Notebook IDs may only contain letters, numbers, and hyphens.`);
|
|
129
|
+
}
|
|
130
|
+
const notebook = this.library.getNotebook(id);
|
|
131
|
+
if (!notebook) {
|
|
132
|
+
throw new Error(`Notebook not found: ${id}`);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
contents: [
|
|
136
|
+
{
|
|
137
|
+
uri,
|
|
138
|
+
mimeType: "application/json",
|
|
139
|
+
text: JSON.stringify(notebook, null, 2),
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// Legacy metadata resource (backwards compatibility)
|
|
145
|
+
if (uri === "notebooklm://metadata") {
|
|
146
|
+
const active = this.library.getActiveNotebook();
|
|
147
|
+
if (!active) {
|
|
148
|
+
throw new Error("No active notebook. Use notebooklm://library to see all notebooks.");
|
|
149
|
+
}
|
|
150
|
+
const metadata = {
|
|
151
|
+
description: active.description,
|
|
152
|
+
topics: active.topics,
|
|
153
|
+
content_types: active.content_types,
|
|
154
|
+
use_cases: active.use_cases,
|
|
155
|
+
notebook_url: active.url,
|
|
156
|
+
notebook_id: active.id,
|
|
157
|
+
last_used: active.last_used,
|
|
158
|
+
use_count: active.use_count,
|
|
159
|
+
note: "DEPRECATED: Use notebooklm://library or notebooklm://library/{id} instead",
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
contents: [
|
|
163
|
+
{
|
|
164
|
+
uri,
|
|
165
|
+
mimeType: "application/json",
|
|
166
|
+
text: JSON.stringify(metadata, null, 2),
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// Helpful error so misconfigured clients (issue #15 — reporter requested
|
|
172
|
+
// `mcp://notebooklm`, which never existed) learn the supported URI scheme.
|
|
173
|
+
throw new Error(`Unknown resource: ${uri}. Supported URIs: notebooklm://library, ` +
|
|
174
|
+
"notebooklm://library/{id}, notebooklm://metadata. " +
|
|
175
|
+
"Call resources/list to discover the active set.");
|
|
176
|
+
});
|
|
177
|
+
// Argument completions (for prompt arguments and resource templates)
|
|
178
|
+
server.setRequestHandler(CompleteRequestSchema, async (request) => {
|
|
179
|
+
const { ref, argument } = request.params;
|
|
180
|
+
try {
|
|
181
|
+
if (ref.type === "ref/resource") {
|
|
182
|
+
// The MCP SDK types `ref` as a discriminated union; the resource
|
|
183
|
+
// template branch carries `uri`. Narrow then resolve.
|
|
184
|
+
const uri = ref.uri;
|
|
185
|
+
if (uri === "notebooklm://library/{id}" && argument.name === "id") {
|
|
186
|
+
const values = this.completeNotebookIds(argument.value);
|
|
187
|
+
return this.buildCompletion(values);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
log.warning(`⚠️ [MCP] completion error: ${e}`);
|
|
193
|
+
}
|
|
194
|
+
return { completion: { values: [], total: 0 } };
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Return notebook IDs matching the provided input (case-insensitive contains)
|
|
199
|
+
*/
|
|
200
|
+
completeNotebookIds(input) {
|
|
201
|
+
const query = String(input ?? "").toLowerCase();
|
|
202
|
+
return this.library
|
|
203
|
+
.listNotebooks()
|
|
204
|
+
.map((nb) => nb.id)
|
|
205
|
+
.filter((id) => id.toLowerCase().includes(query))
|
|
206
|
+
.slice(0, 50);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Build a completion payload for MCP responses
|
|
210
|
+
*/
|
|
211
|
+
buildCompletion(values) {
|
|
212
|
+
return {
|
|
213
|
+
completion: {
|
|
214
|
+
values,
|
|
215
|
+
total: values.length,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=resource-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-handlers.js","sourceRoot":"","sources":["../../src/resources/resource-handlers.ts"],"names":[],"mappings":"AAAA,OAA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