notebooklm-sdk 0.3.1 → 0.3.3

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AuthTokens, a as ConnectOptions } from './auth-Dxsm8894.cjs';
2
- export { C as CookieMap, d as connect } from './auth-Dxsm8894.cjs';
1
+ import { A as AuthTokens, a as ConnectOptions } from './auth-BlG6x47F.cjs';
2
+ export { C as CookieMap, d as connect } from './auth-BlG6x47F.cjs';
3
3
  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';
4
4
 
5
5
  /** RPC method IDs for NotebookLM batchexecute API. */
@@ -219,8 +219,9 @@ interface RPCCallOptions {
219
219
  declare class RPCCore {
220
220
  private readonly auth;
221
221
  private readonly timeoutMs;
222
- constructor(auth: AuthTokens, timeoutMs?: number);
223
- call(methodId: RPCMethodId, params: unknown[], opts?: RPCCallOptions): Promise<unknown>;
222
+ private readonly refreshAuth?;
223
+ constructor(auth: AuthTokens, timeoutMs?: number, refreshAuth?: () => Promise<void>);
224
+ call(methodId: RPCMethodId, params: unknown[], opts?: RPCCallOptions, retried?: boolean): Promise<unknown>;
224
225
  /** Extract source IDs from a notebook (used by chat/artifact APIs). */
225
226
  getSourceIds(notebookId: string): Promise<string[]>;
226
227
  }
@@ -345,10 +346,12 @@ declare class NotesAPI {
345
346
  private readonly rpc;
346
347
  constructor(rpc: RPCCore);
347
348
  list(notebookId: string): Promise<Note[]>;
349
+ get(notebookId: string, noteId: string): Promise<Note | null>;
348
350
  listMindMaps(notebookId: string): Promise<Note[]>;
349
351
  create(notebookId: string, content: string, title?: string): Promise<Note>;
350
352
  update(notebookId: string, noteId: string, content: string, title?: string): Promise<Note>;
351
353
  delete(notebookId: string, noteId: string): Promise<boolean>;
354
+ deleteMindMap(notebookId: string, mindMapId: string): Promise<boolean>;
352
355
  private _fetchAll;
353
356
  private _isMindMap;
354
357
  private _extractContent;
@@ -436,6 +439,8 @@ declare class ArtifactsAPI {
436
439
  createMindMap(notebookId: string, sourceIds?: string[]): Promise<Note>;
437
440
  /** Poll until artifact reaches completed/failed status. */
438
441
  waitUntilReady(notebookId: string, artifactId: string, timeout?: number, pollInterval?: number): Promise<Artifact>;
442
+ /** Get the current status of a generated artifact without waiting. */
443
+ pollStatus(notebookId: string, artifactId: string): Promise<GenerationStatus>;
439
444
  /** Download audio content as a Buffer. */
440
445
  downloadAudio(notebookId: string, artifactId: string): Promise<Buffer>;
441
446
  /** Download video content as a Buffer. */
@@ -454,6 +459,10 @@ declare class ArtifactsAPI {
454
459
  reviseSlide(notebookId: string, artifactId: string, slideIndex: number, prompt: string): Promise<GenerationStatus>;
455
460
  /** Get parsed headers and rows from a completed data table artifact. */
456
461
  getDataTableContent(notebookId: string, artifactId: string): Promise<DataTableContent | null>;
462
+ /** Export a completed report artifact to Google Docs. Returns the created document URL. */
463
+ exportReport(notebookId: string, artifactId: string, title: string): Promise<string | null>;
464
+ /** Export a completed data table artifact to Google Sheets. Returns the created spreadsheet URL. */
465
+ exportDataTable(notebookId: string, artifactId: string, title: string): Promise<string | null>;
457
466
  /**
458
467
  * Fetch a Google-hosted media URL, manually following redirects to ensure
459
468
  * cookies are included on every hop. Node/Bun fetch strips the Cookie header
@@ -471,25 +480,29 @@ interface AskOptions {
471
480
  declare class ChatAPI {
472
481
  private readonly rpc;
473
482
  private readonly auth;
483
+ private readonly refreshAuth?;
474
484
  private readonly conversationCache;
475
485
  private reqid;
476
- constructor(rpc: RPCCore, auth: AuthTokens);
486
+ constructor(rpc: RPCCore, auth: AuthTokens, refreshAuth?: (() => Promise<void>) | undefined);
477
487
  ask(notebookId: string, query: string, opts?: AskOptions): Promise<AskResult>;
478
488
  getConversationTurns(notebookId: string, conversationId: string): Promise<ConversationTurn[]>;
479
489
  getLastConversationId(notebookId: string): Promise<string | null>;
490
+ getHistory(notebookId: string, limit?: number, conversationId?: string): Promise<Array<[string, string]>>;
480
491
  /**
481
492
  * Low-level chat configuration. Set goal, response length, and optional
482
493
  * custom instructions directly. Persists on the server per notebook.
483
494
  * Use `setMode()` for preset combinations instead.
484
495
  */
485
- configure(notebookId: string, goal: ChatGoalValue, length: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
496
+ configure(notebookId: string, goal?: ChatGoalValue, length?: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
486
497
  /**
487
498
  * Set the chat mode for a notebook. Persists on the server — affects all
488
499
  * subsequent `ask()` calls until changed.
489
500
  */
490
501
  setMode(notebookId: string, mode: ChatModeValue): Promise<void>;
491
502
  clearCache(conversationId?: string): void;
503
+ getCachedTurns(conversationId: string): ConversationTurn[];
492
504
  private _buildHistory;
505
+ private _postChatRequest;
493
506
  }
494
507
 
495
508
  declare class NotebooksAPI {
@@ -502,7 +515,15 @@ declare class NotebooksAPI {
502
515
  rename(notebookId: string, newTitle: string): Promise<Notebook>;
503
516
  getSummary(notebookId: string): Promise<string>;
504
517
  removeFromRecent(notebookId: string): Promise<void>;
518
+ getRaw(notebookId: string): Promise<unknown>;
505
519
  getDescription(notebookId: string): Promise<NotebookDescription>;
520
+ share(notebookId: string, publicAccess?: boolean, artifactId?: string): Promise<{
521
+ public: boolean;
522
+ url: string | null;
523
+ artifactId: string | null;
524
+ }>;
525
+ getShareUrl(notebookId: string, artifactId?: string): string;
526
+ getMetadata(notebookId: string): Promise<NotebookMetadata>;
506
527
  }
507
528
 
508
529
  interface ResearchTask {
@@ -616,7 +637,9 @@ declare class SourcesAPI {
616
637
  checkFreshness(notebookId: string, sourceId: string): Promise<boolean>;
617
638
  delete(notebookId: string, sourceId: string): Promise<boolean>;
618
639
  refresh(notebookId: string, sourceId: string): Promise<boolean>;
640
+ rename(notebookId: string, sourceId: string, newTitle: string): Promise<Source>;
619
641
  waitUntilReady(notebookId: string, sourceId: string, timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source>;
642
+ waitForSources(notebookId: string, sourceIds: string[], timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source[]>;
620
643
  }
621
644
 
622
645
  interface ClientOptions {
@@ -646,6 +669,7 @@ declare class NotebookLMClient {
646
669
  readonly research: ResearchAPI;
647
670
  readonly settings: SettingsAPI;
648
671
  readonly sharing: SharingAPI;
672
+ private refreshPromise;
649
673
  private constructor();
650
674
  /**
651
675
  * Connect to NotebookLM using cookies.
@@ -658,4 +682,4 @@ declare class NotebookLMClient {
658
682
  refreshTokens(): Promise<void>;
659
683
  }
660
684
 
661
- export { type AddSourceOptions, type Artifact, type ArtifactStatus, type ArtifactType, ArtifactTypeCode, ArtifactsAPI, type AskOptions, type AskResult, AudioFormat, type AudioFormatValue, AudioLength, type AudioLengthValue, AuthTokens, ChatAPI, ChatGoal, type ChatGoalValue, ChatMode, type ChatModeValue, type ChatReference, ChatResponseLength, type ChatResponseLengthValue, type ClientOptions, ConnectOptions, type ConversationTurn, type CreateAudioOptions, type CreateDataTableOptions, type CreateInfographicOptions, type CreateQuizOptions, type CreateReportOptions, type CreateSlideDeckOptions, type CreateVideoOptions, type DataTableContent, DriveMimeType, type DriveMimeTypeValue, ExportType, type ExportTypeValue, type GenerationStatus, type ImportedSource, InfographicDetail, type InfographicDetailValue, InfographicOrientation, type InfographicOrientationValue, InfographicStyle, type InfographicStyleValue, type Note, type Notebook, type NotebookDescription, NotebookLMClient, type NotebookMetadata, NotebooksAPI, NotesAPI, QuizDifficulty, type QuizDifficultyValue, QuizQuantity, type QuizQuantityValue, RPCMethod, type RPCMethodId, type ReportSuggestion, 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 SourceFulltext, type SourceGuide, type SourceStatus, type SourceSummary, type SourceType, SourcesAPI, type SuggestedTopic, VideoFormat, type VideoFormatValue, VideoStyle, type VideoStyleValue };
685
+ export { type AddSourceOptions, type Artifact, type ArtifactStatus, type ArtifactType, ArtifactTypeCode, ArtifactsAPI, type AskOptions, type AskResult, AudioFormat, type AudioFormatValue, AudioLength, type AudioLengthValue, AuthTokens, ChatAPI, ChatGoal, type ChatGoalValue, ChatMode, type ChatModeValue, type ChatReference, ChatResponseLength, type ChatResponseLengthValue, type ClientOptions, ConnectOptions, type ConversationTurn, type CreateAudioOptions, type CreateDataTableOptions, type CreateInfographicOptions, type CreateQuizOptions, type CreateReportOptions, type CreateSlideDeckOptions, type CreateVideoOptions, type DataTableContent, DriveMimeType, type DriveMimeTypeValue, ExportType, type ExportTypeValue, type GenerationStatus, type ImportedSource, InfographicDetail, type InfographicDetailValue, InfographicOrientation, type InfographicOrientationValue, InfographicStyle, type InfographicStyleValue, type Note, type Notebook, type NotebookDescription, NotebookLMClient, type NotebookMetadata, NotebooksAPI, NotesAPI, QuizDifficulty, type QuizDifficultyValue, QuizQuantity, type QuizQuantityValue, RPCMethod, type RPCMethodId, type ReportFormat, type ReportSuggestion, 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 SourceFulltext, type SourceGuide, type SourceStatus, type SourceSummary, type SourceType, SourcesAPI, type SuggestedTopic, VideoFormat, type VideoFormatValue, VideoStyle, type VideoStyleValue };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AuthTokens, a as ConnectOptions } from './auth-Dxsm8894.js';
2
- export { C as CookieMap, d as connect } from './auth-Dxsm8894.js';
1
+ import { A as AuthTokens, a as ConnectOptions } from './auth-BlG6x47F.js';
2
+ export { C as CookieMap, d as connect } from './auth-BlG6x47F.js';
3
3
  export { ArtifactDownloadError, ArtifactError, ArtifactNotFoundError, ArtifactNotReadyError, ArtifactParseError, AuthError, ChatError, ClientError, NetworkError, NotebookError, NotebookLMError, NotebookNotFoundError, RPCError, RPCTimeoutError, RateLimitError, ServerError, SourceAddError, SourceError, SourceNotFoundError, SourceProcessingError, SourceTimeoutError } from './errors.js';
4
4
 
5
5
  /** RPC method IDs for NotebookLM batchexecute API. */
@@ -219,8 +219,9 @@ interface RPCCallOptions {
219
219
  declare class RPCCore {
220
220
  private readonly auth;
221
221
  private readonly timeoutMs;
222
- constructor(auth: AuthTokens, timeoutMs?: number);
223
- call(methodId: RPCMethodId, params: unknown[], opts?: RPCCallOptions): Promise<unknown>;
222
+ private readonly refreshAuth?;
223
+ constructor(auth: AuthTokens, timeoutMs?: number, refreshAuth?: () => Promise<void>);
224
+ call(methodId: RPCMethodId, params: unknown[], opts?: RPCCallOptions, retried?: boolean): Promise<unknown>;
224
225
  /** Extract source IDs from a notebook (used by chat/artifact APIs). */
225
226
  getSourceIds(notebookId: string): Promise<string[]>;
226
227
  }
@@ -345,10 +346,12 @@ declare class NotesAPI {
345
346
  private readonly rpc;
346
347
  constructor(rpc: RPCCore);
347
348
  list(notebookId: string): Promise<Note[]>;
349
+ get(notebookId: string, noteId: string): Promise<Note | null>;
348
350
  listMindMaps(notebookId: string): Promise<Note[]>;
349
351
  create(notebookId: string, content: string, title?: string): Promise<Note>;
350
352
  update(notebookId: string, noteId: string, content: string, title?: string): Promise<Note>;
351
353
  delete(notebookId: string, noteId: string): Promise<boolean>;
354
+ deleteMindMap(notebookId: string, mindMapId: string): Promise<boolean>;
352
355
  private _fetchAll;
353
356
  private _isMindMap;
354
357
  private _extractContent;
@@ -436,6 +439,8 @@ declare class ArtifactsAPI {
436
439
  createMindMap(notebookId: string, sourceIds?: string[]): Promise<Note>;
437
440
  /** Poll until artifact reaches completed/failed status. */
438
441
  waitUntilReady(notebookId: string, artifactId: string, timeout?: number, pollInterval?: number): Promise<Artifact>;
442
+ /** Get the current status of a generated artifact without waiting. */
443
+ pollStatus(notebookId: string, artifactId: string): Promise<GenerationStatus>;
439
444
  /** Download audio content as a Buffer. */
440
445
  downloadAudio(notebookId: string, artifactId: string): Promise<Buffer>;
441
446
  /** Download video content as a Buffer. */
@@ -454,6 +459,10 @@ declare class ArtifactsAPI {
454
459
  reviseSlide(notebookId: string, artifactId: string, slideIndex: number, prompt: string): Promise<GenerationStatus>;
455
460
  /** Get parsed headers and rows from a completed data table artifact. */
456
461
  getDataTableContent(notebookId: string, artifactId: string): Promise<DataTableContent | null>;
462
+ /** Export a completed report artifact to Google Docs. Returns the created document URL. */
463
+ exportReport(notebookId: string, artifactId: string, title: string): Promise<string | null>;
464
+ /** Export a completed data table artifact to Google Sheets. Returns the created spreadsheet URL. */
465
+ exportDataTable(notebookId: string, artifactId: string, title: string): Promise<string | null>;
457
466
  /**
458
467
  * Fetch a Google-hosted media URL, manually following redirects to ensure
459
468
  * cookies are included on every hop. Node/Bun fetch strips the Cookie header
@@ -471,25 +480,29 @@ interface AskOptions {
471
480
  declare class ChatAPI {
472
481
  private readonly rpc;
473
482
  private readonly auth;
483
+ private readonly refreshAuth?;
474
484
  private readonly conversationCache;
475
485
  private reqid;
476
- constructor(rpc: RPCCore, auth: AuthTokens);
486
+ constructor(rpc: RPCCore, auth: AuthTokens, refreshAuth?: (() => Promise<void>) | undefined);
477
487
  ask(notebookId: string, query: string, opts?: AskOptions): Promise<AskResult>;
478
488
  getConversationTurns(notebookId: string, conversationId: string): Promise<ConversationTurn[]>;
479
489
  getLastConversationId(notebookId: string): Promise<string | null>;
490
+ getHistory(notebookId: string, limit?: number, conversationId?: string): Promise<Array<[string, string]>>;
480
491
  /**
481
492
  * Low-level chat configuration. Set goal, response length, and optional
482
493
  * custom instructions directly. Persists on the server per notebook.
483
494
  * Use `setMode()` for preset combinations instead.
484
495
  */
485
- configure(notebookId: string, goal: ChatGoalValue, length: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
496
+ configure(notebookId: string, goal?: ChatGoalValue, length?: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
486
497
  /**
487
498
  * Set the chat mode for a notebook. Persists on the server — affects all
488
499
  * subsequent `ask()` calls until changed.
489
500
  */
490
501
  setMode(notebookId: string, mode: ChatModeValue): Promise<void>;
491
502
  clearCache(conversationId?: string): void;
503
+ getCachedTurns(conversationId: string): ConversationTurn[];
492
504
  private _buildHistory;
505
+ private _postChatRequest;
493
506
  }
494
507
 
495
508
  declare class NotebooksAPI {
@@ -502,7 +515,15 @@ declare class NotebooksAPI {
502
515
  rename(notebookId: string, newTitle: string): Promise<Notebook>;
503
516
  getSummary(notebookId: string): Promise<string>;
504
517
  removeFromRecent(notebookId: string): Promise<void>;
518
+ getRaw(notebookId: string): Promise<unknown>;
505
519
  getDescription(notebookId: string): Promise<NotebookDescription>;
520
+ share(notebookId: string, publicAccess?: boolean, artifactId?: string): Promise<{
521
+ public: boolean;
522
+ url: string | null;
523
+ artifactId: string | null;
524
+ }>;
525
+ getShareUrl(notebookId: string, artifactId?: string): string;
526
+ getMetadata(notebookId: string): Promise<NotebookMetadata>;
506
527
  }
507
528
 
508
529
  interface ResearchTask {
@@ -616,7 +637,9 @@ declare class SourcesAPI {
616
637
  checkFreshness(notebookId: string, sourceId: string): Promise<boolean>;
617
638
  delete(notebookId: string, sourceId: string): Promise<boolean>;
618
639
  refresh(notebookId: string, sourceId: string): Promise<boolean>;
640
+ rename(notebookId: string, sourceId: string, newTitle: string): Promise<Source>;
619
641
  waitUntilReady(notebookId: string, sourceId: string, timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source>;
642
+ waitForSources(notebookId: string, sourceIds: string[], timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source[]>;
620
643
  }
621
644
 
622
645
  interface ClientOptions {
@@ -646,6 +669,7 @@ declare class NotebookLMClient {
646
669
  readonly research: ResearchAPI;
647
670
  readonly settings: SettingsAPI;
648
671
  readonly sharing: SharingAPI;
672
+ private refreshPromise;
649
673
  private constructor();
650
674
  /**
651
675
  * Connect to NotebookLM using cookies.
@@ -658,4 +682,4 @@ declare class NotebookLMClient {
658
682
  refreshTokens(): Promise<void>;
659
683
  }
660
684
 
661
- export { type AddSourceOptions, type Artifact, type ArtifactStatus, type ArtifactType, ArtifactTypeCode, ArtifactsAPI, type AskOptions, type AskResult, AudioFormat, type AudioFormatValue, AudioLength, type AudioLengthValue, AuthTokens, ChatAPI, ChatGoal, type ChatGoalValue, ChatMode, type ChatModeValue, type ChatReference, ChatResponseLength, type ChatResponseLengthValue, type ClientOptions, ConnectOptions, type ConversationTurn, type CreateAudioOptions, type CreateDataTableOptions, type CreateInfographicOptions, type CreateQuizOptions, type CreateReportOptions, type CreateSlideDeckOptions, type CreateVideoOptions, type DataTableContent, DriveMimeType, type DriveMimeTypeValue, ExportType, type ExportTypeValue, type GenerationStatus, type ImportedSource, InfographicDetail, type InfographicDetailValue, InfographicOrientation, type InfographicOrientationValue, InfographicStyle, type InfographicStyleValue, type Note, type Notebook, type NotebookDescription, NotebookLMClient, type NotebookMetadata, NotebooksAPI, NotesAPI, QuizDifficulty, type QuizDifficultyValue, QuizQuantity, type QuizQuantityValue, RPCMethod, type RPCMethodId, type ReportSuggestion, 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 SourceFulltext, type SourceGuide, type SourceStatus, type SourceSummary, type SourceType, SourcesAPI, type SuggestedTopic, VideoFormat, type VideoFormatValue, VideoStyle, type VideoStyleValue };
685
+ export { type AddSourceOptions, type Artifact, type ArtifactStatus, type ArtifactType, ArtifactTypeCode, ArtifactsAPI, type AskOptions, type AskResult, AudioFormat, type AudioFormatValue, AudioLength, type AudioLengthValue, AuthTokens, ChatAPI, ChatGoal, type ChatGoalValue, ChatMode, type ChatModeValue, type ChatReference, ChatResponseLength, type ChatResponseLengthValue, type ClientOptions, ConnectOptions, type ConversationTurn, type CreateAudioOptions, type CreateDataTableOptions, type CreateInfographicOptions, type CreateQuizOptions, type CreateReportOptions, type CreateSlideDeckOptions, type CreateVideoOptions, type DataTableContent, DriveMimeType, type DriveMimeTypeValue, ExportType, type ExportTypeValue, type GenerationStatus, type ImportedSource, InfographicDetail, type InfographicDetailValue, InfographicOrientation, type InfographicOrientationValue, InfographicStyle, type InfographicStyleValue, type Note, type Notebook, type NotebookDescription, NotebookLMClient, type NotebookMetadata, NotebooksAPI, NotesAPI, QuizDifficulty, type QuizDifficultyValue, QuizQuantity, type QuizQuantityValue, RPCMethod, type RPCMethodId, type ReportFormat, type ReportSuggestion, 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 SourceFulltext, type SourceGuide, type SourceStatus, type SourceSummary, type SourceType, SourcesAPI, type SuggestedTopic, VideoFormat, type VideoFormatValue, VideoStyle, type VideoStyleValue };