notebooklm-sdk 0.1.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.
@@ -0,0 +1,578 @@
1
+ export { ArtifactDownloadError, ArtifactError, ArtifactNotFoundError, ArtifactNotReadyError, ArtifactParseError, AuthError, ChatError, ClientError, NetworkError, NotebookError, NotebookLMError, NotebookNotFoundError, RPCError, RPCTimeoutError, RateLimitError, ServerError, SourceAddError, SourceError, SourceNotFoundError, SourceProcessingError, SourceTimeoutError } from './errors.cjs';
2
+
3
+ interface CookieMap {
4
+ [key: string]: string;
5
+ }
6
+ interface AuthTokens {
7
+ cookies: CookieMap;
8
+ csrfToken: string;
9
+ sessionId: string;
10
+ cookieHeader: string;
11
+ /** Cookie header containing only .google.com domain cookies — for media downloads */
12
+ googleCookieHeader: string;
13
+ }
14
+ interface ConnectOptions {
15
+ /** "; "-separated cookie string (e.g. "SID=abc; HSID=xyz") */
16
+ cookies?: string;
17
+ /** Path to Playwright storage_state.json */
18
+ cookiesFile?: string;
19
+ /** Pre-parsed cookie map */
20
+ cookiesObject?: CookieMap | {
21
+ cookies?: Array<{
22
+ name: string;
23
+ value: string;
24
+ domain: string;
25
+ }>;
26
+ };
27
+ }
28
+ declare function connect(opts: ConnectOptions): Promise<AuthTokens>;
29
+
30
+ /** RPC method IDs for NotebookLM batchexecute API. */
31
+ declare const RPCMethod: {
32
+ readonly LIST_NOTEBOOKS: "wXbhsf";
33
+ readonly CREATE_NOTEBOOK: "CCqFvf";
34
+ readonly GET_NOTEBOOK: "rLM1Ne";
35
+ readonly RENAME_NOTEBOOK: "s0tc2d";
36
+ readonly DELETE_NOTEBOOK: "WWINqb";
37
+ readonly ADD_SOURCE: "izAoDd";
38
+ readonly ADD_SOURCE_FILE: "o4cbdc";
39
+ readonly DELETE_SOURCE: "tGMBJ";
40
+ readonly GET_SOURCE: "hizoJc";
41
+ readonly REFRESH_SOURCE: "FLmJqe";
42
+ readonly CHECK_SOURCE_FRESHNESS: "yR9Yof";
43
+ readonly UPDATE_SOURCE: "b7Wfje";
44
+ readonly SUMMARIZE: "VfAZjd";
45
+ readonly GET_SOURCE_GUIDE: "tr032e";
46
+ readonly GET_SUGGESTED_REPORTS: "ciyUvf";
47
+ readonly CREATE_ARTIFACT: "R7cb6c";
48
+ readonly LIST_ARTIFACTS: "gArtLc";
49
+ readonly DELETE_ARTIFACT: "V5N4be";
50
+ readonly RENAME_ARTIFACT: "rc3d8d";
51
+ readonly EXPORT_ARTIFACT: "Krh3pd";
52
+ readonly SHARE_ARTIFACT: "RGP97b";
53
+ readonly GET_INTERACTIVE_HTML: "v9rmvd";
54
+ readonly REVISE_SLIDE: "KmcKPe";
55
+ readonly START_FAST_RESEARCH: "Ljjv0c";
56
+ readonly START_DEEP_RESEARCH: "QA9ei";
57
+ readonly POLL_RESEARCH: "e3bVqc";
58
+ readonly IMPORT_RESEARCH: "LBwxtb";
59
+ readonly GENERATE_MIND_MAP: "yyryJe";
60
+ readonly CREATE_NOTE: "CYK0Xb";
61
+ readonly GET_NOTES_AND_MIND_MAPS: "cFji9";
62
+ readonly UPDATE_NOTE: "cYAfTb";
63
+ readonly DELETE_NOTE: "AH0mwd";
64
+ readonly GET_LAST_CONVERSATION_ID: "hPTbtc";
65
+ readonly GET_CONVERSATION_TURNS: "khqZz";
66
+ readonly SHARE_NOTEBOOK: "QDyure";
67
+ readonly GET_SHARE_STATUS: "JFMDGd";
68
+ readonly REMOVE_RECENTLY_VIEWED: "fejl7e";
69
+ readonly GET_USER_SETTINGS: "ZwVcOc";
70
+ readonly SET_USER_SETTINGS: "hT54vc";
71
+ };
72
+ type RPCMethodId = (typeof RPCMethod)[keyof typeof RPCMethod];
73
+ declare const ArtifactTypeCode: {
74
+ readonly AUDIO: 1;
75
+ readonly REPORT: 2;
76
+ readonly VIDEO: 3;
77
+ readonly QUIZ: 4;
78
+ readonly MIND_MAP: 5;
79
+ readonly INFOGRAPHIC: 7;
80
+ readonly SLIDE_DECK: 8;
81
+ readonly DATA_TABLE: 9;
82
+ };
83
+ /** User-facing source type strings. */
84
+ type SourceType = "google_docs" | "google_slides" | "google_spreadsheet" | "pdf" | "pasted_text" | "web_page" | "youtube" | "markdown" | "docx" | "csv" | "image" | "media" | "unknown";
85
+ /** User-facing artifact type strings. */
86
+ type ArtifactType = "audio" | "video" | "report" | "quiz" | "flashcards" | "mind_map" | "infographic" | "slide_deck" | "data_table" | "unknown";
87
+ /** User-facing artifact status strings. */
88
+ type ArtifactStatus = "in_progress" | "pending" | "completed" | "failed" | "unknown";
89
+ /** User-facing source status strings. */
90
+ type SourceStatus = "processing" | "ready" | "error" | "preparing" | "unknown";
91
+ declare const AudioFormat: {
92
+ readonly DEEP_DIVE: 1;
93
+ readonly BRIEF: 2;
94
+ readonly CRITIQUE: 3;
95
+ readonly DEBATE: 4;
96
+ };
97
+ type AudioFormatValue = (typeof AudioFormat)[keyof typeof AudioFormat];
98
+ declare const AudioLength: {
99
+ readonly SHORT: 1;
100
+ readonly DEFAULT: 2;
101
+ readonly LONG: 3;
102
+ };
103
+ type AudioLengthValue = (typeof AudioLength)[keyof typeof AudioLength];
104
+ declare const VideoFormat: {
105
+ readonly EXPLAINER: 1;
106
+ readonly BRIEF: 2;
107
+ readonly CINEMATIC: 3;
108
+ };
109
+ type VideoFormatValue = (typeof VideoFormat)[keyof typeof VideoFormat];
110
+ declare const VideoStyle: {
111
+ readonly AUTO_SELECT: 1;
112
+ readonly CUSTOM: 2;
113
+ readonly CLASSIC: 3;
114
+ readonly WHITEBOARD: 4;
115
+ readonly KAWAII: 5;
116
+ readonly ANIME: 6;
117
+ readonly WATERCOLOR: 7;
118
+ readonly RETRO_PRINT: 8;
119
+ readonly HERITAGE: 9;
120
+ readonly PAPER_CRAFT: 10;
121
+ };
122
+ type VideoStyleValue = (typeof VideoStyle)[keyof typeof VideoStyle];
123
+ declare const QuizQuantity: {
124
+ readonly FEWER: 1;
125
+ readonly STANDARD: 2;
126
+ readonly MORE: 2;
127
+ };
128
+ type QuizQuantityValue = (typeof QuizQuantity)[keyof typeof QuizQuantity];
129
+ declare const QuizDifficulty: {
130
+ readonly EASY: 1;
131
+ readonly MEDIUM: 2;
132
+ readonly HARD: 3;
133
+ };
134
+ type QuizDifficultyValue = (typeof QuizDifficulty)[keyof typeof QuizDifficulty];
135
+ declare const InfographicOrientation: {
136
+ readonly LANDSCAPE: 1;
137
+ readonly PORTRAIT: 2;
138
+ readonly SQUARE: 3;
139
+ };
140
+ type InfographicOrientationValue = (typeof InfographicOrientation)[keyof typeof InfographicOrientation];
141
+ declare const InfographicDetail: {
142
+ readonly CONCISE: 1;
143
+ readonly STANDARD: 2;
144
+ readonly DETAILED: 3;
145
+ };
146
+ type InfographicDetailValue = (typeof InfographicDetail)[keyof typeof InfographicDetail];
147
+ declare const InfographicStyle: {
148
+ readonly AUTO_SELECT: 1;
149
+ readonly SKETCH_NOTE: 2;
150
+ readonly PROFESSIONAL: 3;
151
+ readonly BENTO_GRID: 4;
152
+ readonly EDITORIAL: 5;
153
+ readonly INSTRUCTIONAL: 6;
154
+ readonly BRICKS: 7;
155
+ readonly CLAY: 8;
156
+ readonly ANIME: 9;
157
+ readonly KAWAII: 10;
158
+ readonly SCIENTIFIC: 11;
159
+ };
160
+ type InfographicStyleValue = (typeof InfographicStyle)[keyof typeof InfographicStyle];
161
+ declare const SlideDeckFormat: {
162
+ readonly DETAILED_DECK: 1;
163
+ readonly PRESENTER_SLIDES: 2;
164
+ };
165
+ type SlideDeckFormatValue = (typeof SlideDeckFormat)[keyof typeof SlideDeckFormat];
166
+ declare const SlideDeckLength: {
167
+ readonly DEFAULT: 1;
168
+ readonly SHORT: 2;
169
+ };
170
+ type SlideDeckLengthValue = (typeof SlideDeckLength)[keyof typeof SlideDeckLength];
171
+ declare const ExportType: {
172
+ readonly DOCS: 1;
173
+ readonly SHEETS: 2;
174
+ };
175
+ type ExportTypeValue = (typeof ExportType)[keyof typeof ExportType];
176
+ declare const ShareAccess: {
177
+ /** Only explicitly shared users can access */
178
+ readonly RESTRICTED: 0;
179
+ /** Anyone with the link can access */
180
+ readonly ANYONE_WITH_LINK: 1;
181
+ };
182
+ type ShareAccessValue = (typeof ShareAccess)[keyof typeof ShareAccess];
183
+ declare const ShareViewLevel: {
184
+ /** Chat + sources + notes */
185
+ readonly FULL_NOTEBOOK: 0;
186
+ /** Chat interface only */
187
+ readonly CHAT_ONLY: 1;
188
+ };
189
+ type ShareViewLevelValue = (typeof ShareViewLevel)[keyof typeof ShareViewLevel];
190
+ declare const SharePermission: {
191
+ readonly OWNER: 1;
192
+ readonly EDITOR: 2;
193
+ readonly VIEWER: 3;
194
+ /** Internal: remove user from share list */
195
+ readonly _REMOVE: 4;
196
+ };
197
+ type SharePermissionValue = (typeof SharePermission)[keyof typeof SharePermission];
198
+
199
+ interface Notebook {
200
+ id: string;
201
+ title: string;
202
+ createdAt: Date | null;
203
+ sourcesCount: number;
204
+ isOwner: boolean;
205
+ }
206
+ interface SuggestedTopic {
207
+ question: string;
208
+ prompt: string;
209
+ }
210
+ interface NotebookDescription {
211
+ summary: string;
212
+ suggestedTopics: SuggestedTopic[];
213
+ }
214
+ interface SourceSummary {
215
+ kind: SourceType;
216
+ title: string | null;
217
+ url: string | null;
218
+ }
219
+ interface NotebookMetadata {
220
+ id: string;
221
+ title: string;
222
+ createdAt: Date | null;
223
+ isOwner: boolean;
224
+ sources: SourceSummary[];
225
+ }
226
+ interface Source {
227
+ id: string;
228
+ title: string | null;
229
+ url: string | null;
230
+ kind: SourceType;
231
+ createdAt: Date | null;
232
+ status: SourceStatus;
233
+ /** Raw type code from API (for debugging) */
234
+ _typeCode: number | null;
235
+ }
236
+ interface Artifact {
237
+ id: string;
238
+ title: string | null;
239
+ kind: ArtifactType;
240
+ status: ArtifactStatus;
241
+ notebookId: string;
242
+ audioUrl: string | null;
243
+ videoUrl: string | null;
244
+ exportUrl: string | null;
245
+ shareUrl: string | null;
246
+ /** Markdown content for report artifacts (data[7][0]) */
247
+ content: string | null;
248
+ /** Raw data from API */
249
+ _raw: unknown[];
250
+ }
251
+ interface GenerationStatus {
252
+ status: ArtifactStatus;
253
+ artifactId: string | null;
254
+ }
255
+ interface SharedUser {
256
+ email: string;
257
+ permission: "owner" | "editor" | "viewer";
258
+ displayName: string | null;
259
+ avatarUrl: string | null;
260
+ }
261
+ interface ShareStatus {
262
+ notebookId: string;
263
+ isPublic: boolean;
264
+ /** 0 = restricted, 1 = anyone with link */
265
+ access: number;
266
+ /** 0 = full notebook, 1 = chat only */
267
+ viewLevel: number;
268
+ sharedUsers: SharedUser[];
269
+ shareUrl: string | null;
270
+ }
271
+ interface ChatReference {
272
+ sourceId: string;
273
+ title: string | null;
274
+ url: string | null;
275
+ }
276
+ interface AskResult {
277
+ answer: string;
278
+ conversationId: string;
279
+ turnNumber: number;
280
+ references: ChatReference[];
281
+ }
282
+ interface ConversationTurn {
283
+ query: string;
284
+ answer: string;
285
+ turnNumber: number;
286
+ }
287
+ interface Note {
288
+ id: string;
289
+ title: string | null;
290
+ content: string;
291
+ createdAt: Date | null;
292
+ updatedAt: Date | null;
293
+ }
294
+ interface MindMap {
295
+ id: string;
296
+ title: string | null;
297
+ content: string;
298
+ createdAt: Date | null;
299
+ }
300
+
301
+ interface RPCCallOptions {
302
+ sourcePath?: string;
303
+ allowNull?: boolean;
304
+ timeoutMs?: number;
305
+ }
306
+ declare class RPCCore {
307
+ private readonly auth;
308
+ private readonly timeoutMs;
309
+ constructor(auth: AuthTokens, timeoutMs?: number);
310
+ call(methodId: RPCMethodId, params: unknown[], opts?: RPCCallOptions): Promise<unknown>;
311
+ /** Extract source IDs from a notebook (used by chat/artifact APIs). */
312
+ getSourceIds(notebookId: string): Promise<string[]>;
313
+ }
314
+
315
+ declare class NotebooksAPI {
316
+ private readonly rpc;
317
+ constructor(rpc: RPCCore);
318
+ list(): Promise<Notebook[]>;
319
+ create(title: string): Promise<Notebook>;
320
+ get(notebookId: string): Promise<Notebook>;
321
+ delete(notebookId: string): Promise<boolean>;
322
+ rename(notebookId: string, newTitle: string): Promise<Notebook>;
323
+ getSummary(notebookId: string): Promise<string>;
324
+ getDescription(notebookId: string): Promise<NotebookDescription>;
325
+ }
326
+
327
+ interface AddSourceOptions {
328
+ waitUntilReady?: boolean;
329
+ waitTimeout?: number;
330
+ }
331
+ declare class SourcesAPI {
332
+ private readonly rpc;
333
+ private readonly auth;
334
+ constructor(rpc: RPCCore, auth: AuthTokens);
335
+ list(notebookId: string): Promise<Source[]>;
336
+ get(notebookId: string, sourceId: string): Promise<Source | null>;
337
+ addUrl(notebookId: string, url: string, opts?: AddSourceOptions): Promise<Source>;
338
+ addText(notebookId: string, text: string, title?: string, opts?: AddSourceOptions): Promise<Source>;
339
+ addFile(notebookId: string, filePath: string, mimeType: string, opts?: AddSourceOptions): Promise<Source>;
340
+ addFileBuffer(notebookId: string, data: Buffer | Uint8Array, fileName: string, mimeType: string, opts?: AddSourceOptions): Promise<Source>;
341
+ private uploadFile;
342
+ delete(notebookId: string, sourceId: string): Promise<boolean>;
343
+ refresh(notebookId: string, sourceId: string): Promise<boolean>;
344
+ waitUntilReady(notebookId: string, sourceId: string, timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source>;
345
+ }
346
+
347
+ interface CreateAudioOptions {
348
+ format?: AudioFormatValue;
349
+ length?: AudioLengthValue;
350
+ sourceIds?: string[];
351
+ instructions?: string;
352
+ language?: string;
353
+ }
354
+ interface CreateVideoOptions {
355
+ format?: VideoFormatValue;
356
+ style?: VideoStyleValue;
357
+ sourceIds?: string[];
358
+ instructions?: string;
359
+ language?: string;
360
+ }
361
+ interface CreateQuizOptions {
362
+ quantity?: QuizQuantityValue;
363
+ difficulty?: QuizDifficultyValue;
364
+ sourceIds?: string[];
365
+ instructions?: string;
366
+ }
367
+ interface CreateInfographicOptions {
368
+ orientation?: InfographicOrientationValue;
369
+ detail?: InfographicDetailValue;
370
+ style?: InfographicStyleValue;
371
+ sourceIds?: string[];
372
+ instructions?: string;
373
+ language?: string;
374
+ }
375
+ interface CreateSlideDeckOptions {
376
+ format?: SlideDeckFormatValue;
377
+ length?: SlideDeckLengthValue;
378
+ sourceIds?: string[];
379
+ instructions?: string;
380
+ language?: string;
381
+ }
382
+ type ReportFormat = "briefing_doc" | "study_guide" | "blog_post" | "custom";
383
+ interface CreateReportOptions {
384
+ format?: ReportFormat;
385
+ sourceIds?: string[];
386
+ language?: string;
387
+ customPrompt?: string;
388
+ extraInstructions?: string;
389
+ }
390
+ declare class ArtifactsAPI {
391
+ private readonly rpc;
392
+ private readonly auth;
393
+ constructor(rpc: RPCCore, auth: AuthTokens);
394
+ list(notebookId: string): Promise<Artifact[]>;
395
+ get(notebookId: string, artifactId: string): Promise<Artifact | null>;
396
+ delete(notebookId: string, artifactId: string): Promise<boolean>;
397
+ rename(notebookId: string, artifactId: string, newTitle: string): Promise<boolean>;
398
+ createAudio(notebookId: string, opts?: CreateAudioOptions): Promise<GenerationStatus>;
399
+ createVideo(notebookId: string, opts?: CreateVideoOptions): Promise<GenerationStatus>;
400
+ createQuiz(notebookId: string, opts?: CreateQuizOptions): Promise<GenerationStatus>;
401
+ createFlashcards(notebookId: string, opts?: CreateQuizOptions): Promise<GenerationStatus>;
402
+ createInfographic(notebookId: string, opts?: CreateInfographicOptions): Promise<GenerationStatus>;
403
+ createSlideDeck(notebookId: string, opts?: CreateSlideDeckOptions): Promise<GenerationStatus>;
404
+ createReport(notebookId: string, opts?: CreateReportOptions): Promise<GenerationStatus>;
405
+ createMindMap(notebookId: string, sourceIds?: string[]): Promise<GenerationStatus>;
406
+ /** Poll until artifact reaches completed/failed status. */
407
+ waitUntilReady(notebookId: string, artifactId: string, timeout?: number, pollInterval?: number): Promise<Artifact>;
408
+ /** Download audio content as a Buffer. */
409
+ downloadAudio(notebookId: string, artifactId: string): Promise<Buffer>;
410
+ /** Download video content as a Buffer. */
411
+ downloadVideo(notebookId: string, artifactId: string): Promise<Buffer>;
412
+ /** Get markdown content for a completed report artifact. */
413
+ getReportMarkdown(notebookId: string, artifactId: string): Promise<string | null>;
414
+ /** Get interactive HTML for quiz/flashcard artifacts. */
415
+ getInteractiveHtml(notebookId: string, artifactId: string): Promise<string | null>;
416
+ /**
417
+ * Fetch a Google-hosted media URL, manually following redirects to ensure
418
+ * cookies are included on every hop. Node/Bun fetch strips the Cookie header
419
+ * on cross-origin redirects (e.g. googleusercontent.com → lh3.google.com).
420
+ */
421
+ private _fetchMediaWithCookies;
422
+ private _callGenerate;
423
+ private _parseGenerationResult;
424
+ }
425
+
426
+ interface AskOptions {
427
+ conversationId?: string;
428
+ sourceIds?: string[];
429
+ }
430
+ declare class ChatAPI {
431
+ private readonly rpc;
432
+ private readonly auth;
433
+ private readonly conversationCache;
434
+ private reqid;
435
+ constructor(rpc: RPCCore, auth: AuthTokens);
436
+ ask(notebookId: string, query: string, opts?: AskOptions): Promise<AskResult>;
437
+ getConversationTurns(notebookId: string, conversationId: string): Promise<ConversationTurn[]>;
438
+ getLastConversationId(notebookId: string): Promise<string | null>;
439
+ clearCache(conversationId?: string): void;
440
+ private _buildHistory;
441
+ }
442
+
443
+ declare class NotesAPI {
444
+ private readonly rpc;
445
+ constructor(rpc: RPCCore);
446
+ list(notebookId: string): Promise<{
447
+ notes: Note[];
448
+ mindMaps: MindMap[];
449
+ }>;
450
+ create(notebookId: string, content: string, title?: string): Promise<Note>;
451
+ update(notebookId: string, noteId: string, content: string, title?: string): Promise<Note>;
452
+ delete(notebookId: string, noteId: string): Promise<boolean>;
453
+ }
454
+
455
+ interface ResearchTask {
456
+ taskId: string;
457
+ reportId: string | null;
458
+ notebookId: string;
459
+ query: string;
460
+ mode: "fast" | "deep";
461
+ }
462
+ interface ResearchSource {
463
+ url: string;
464
+ title: string;
465
+ /** 1=web, 2=drive, 5=deep research report */
466
+ resultType: number;
467
+ researchTaskId: string;
468
+ /** Markdown content for deep research report entries (resultType=5) */
469
+ reportMarkdown?: string;
470
+ }
471
+ interface ResearchResult {
472
+ taskId: string | null;
473
+ status: "in_progress" | "completed" | "no_research";
474
+ query: string;
475
+ sources: ResearchSource[];
476
+ summary: string;
477
+ report: string;
478
+ tasks: ResearchResult[];
479
+ }
480
+ interface ImportedSource {
481
+ id: string;
482
+ title: string;
483
+ }
484
+ declare class ResearchAPI {
485
+ private readonly rpc;
486
+ constructor(rpc: RPCCore);
487
+ /**
488
+ * Start a research session.
489
+ * @param source "web" or "drive"
490
+ * @param mode "fast" or "deep" (deep only available for web)
491
+ */
492
+ start(notebookId: string, query: string, source?: "web" | "drive", mode?: "fast" | "deep"): Promise<ResearchTask | null>;
493
+ /** Poll for current research results in a notebook. */
494
+ poll(notebookId: string): Promise<ResearchResult>;
495
+ /**
496
+ * Import selected research sources into the notebook.
497
+ * Pass sources from poll() — web sources need `url`, deep research report entries
498
+ * need `reportMarkdown` (resultType=5).
499
+ *
500
+ * Note: The API may return fewer items than imported. Use sources.list() to verify.
501
+ */
502
+ importSources(notebookId: string, taskId: string, sources: ResearchSource[]): Promise<ImportedSource[]>;
503
+ }
504
+
505
+ declare class SettingsAPI {
506
+ private readonly rpc;
507
+ constructor(rpc: RPCCore);
508
+ /** Get the current output language setting (e.g. "en", "ja", "zh_Hans"). */
509
+ getOutputLanguage(): Promise<string | null>;
510
+ /**
511
+ * Set the output language for artifact generation.
512
+ * Pass a BCP-47 language code, e.g. "en", "ja", "zh_Hans".
513
+ * Returns the language that was set, or null if the response couldn't be parsed.
514
+ */
515
+ setOutputLanguage(language: string): Promise<string | null>;
516
+ }
517
+
518
+ declare class SharingAPI {
519
+ private readonly rpc;
520
+ constructor(rpc: RPCCore);
521
+ /** Get current sharing configuration for a notebook. */
522
+ getStatus(notebookId: string): Promise<ShareStatus>;
523
+ /** Enable or disable public link sharing. Returns updated status. */
524
+ setPublic(notebookId: string, isPublic: boolean): Promise<ShareStatus>;
525
+ /**
526
+ * Set what viewers can access: full notebook or chat only.
527
+ * Note: GET_SHARE_STATUS doesn't return view_level, so it's inferred from what was set.
528
+ */
529
+ setViewLevel(notebookId: string, level: ShareViewLevelValue): Promise<ShareStatus>;
530
+ /** Share notebook with a user. Returns updated status. */
531
+ addUser(notebookId: string, email: string, permission?: SharePermissionValue, opts?: {
532
+ notify?: boolean;
533
+ welcomeMessage?: string;
534
+ }): Promise<ShareStatus>;
535
+ /** Update an existing user's permission level. Returns updated status. */
536
+ updateUser(notebookId: string, email: string, permission: SharePermissionValue): Promise<ShareStatus>;
537
+ /** Remove a user's access to the notebook. Returns updated status. */
538
+ removeUser(notebookId: string, email: string): Promise<ShareStatus>;
539
+ }
540
+
541
+ interface ClientOptions {
542
+ /** HTTP request timeout in milliseconds. Default: 30000 */
543
+ timeoutMs?: number;
544
+ }
545
+ /**
546
+ * NotebookLM SDK client.
547
+ *
548
+ * @example
549
+ * ```ts
550
+ * const client = await NotebookLMClient.connect({
551
+ * cookies: process.env.NOTEBOOKLM_COOKIES,
552
+ * });
553
+ * const notebooks = await client.notebooks.list();
554
+ * ```
555
+ */
556
+ declare class NotebookLMClient {
557
+ private readonly auth;
558
+ readonly notebooks: NotebooksAPI;
559
+ readonly sources: SourcesAPI;
560
+ readonly artifacts: ArtifactsAPI;
561
+ readonly chat: ChatAPI;
562
+ readonly notes: NotesAPI;
563
+ readonly research: ResearchAPI;
564
+ readonly settings: SettingsAPI;
565
+ readonly sharing: SharingAPI;
566
+ private constructor();
567
+ /**
568
+ * Connect to NotebookLM using cookies.
569
+ * Fetches CSRF and session tokens from the NotebookLM homepage.
570
+ */
571
+ static connect(opts: ConnectOptions, clientOpts?: ClientOptions): Promise<NotebookLMClient>;
572
+ /**
573
+ * Refresh CSRF and session tokens (e.g. if they expire mid-session).
574
+ */
575
+ refreshTokens(): Promise<void>;
576
+ }
577
+
578
+ export { type AddSourceOptions, type Artifact, type ArtifactStatus, type ArtifactType, ArtifactTypeCode, ArtifactsAPI, type AskOptions, type AskResult, AudioFormat, type AudioFormatValue, AudioLength, type AudioLengthValue, type AuthTokens, ChatAPI, type ChatReference, type ClientOptions, type ConnectOptions, type ConversationTurn, type CookieMap, type CreateAudioOptions, type CreateInfographicOptions, type CreateQuizOptions, type CreateReportOptions, type CreateSlideDeckOptions, type CreateVideoOptions, ExportType, type ExportTypeValue, type GenerationStatus, type ImportedSource, InfographicDetail, type InfographicDetailValue, InfographicOrientation, type InfographicOrientationValue, InfographicStyle, type InfographicStyleValue, type MindMap, type Note, type Notebook, type NotebookDescription, NotebookLMClient, type NotebookMetadata, NotebooksAPI, NotesAPI, QuizDifficulty, type QuizDifficultyValue, QuizQuantity, type QuizQuantityValue, RPCMethod, type RPCMethodId, ResearchAPI, type ResearchResult, type ResearchSource, type ResearchTask, SettingsAPI, ShareAccess, type ShareAccessValue, SharePermission, type SharePermissionValue, type ShareStatus, ShareViewLevel, type ShareViewLevelValue, type SharedUser, SharingAPI, SlideDeckFormat, type SlideDeckFormatValue, SlideDeckLength, type SlideDeckLengthValue, type Source, type SourceStatus, type SourceSummary, type SourceType, SourcesAPI, type SuggestedTopic, VideoFormat, type VideoFormatValue, VideoStyle, type VideoStyleValue, connect };