notebooklm-sdk 0.3.2 → 0.3.4

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;
@@ -399,6 +402,12 @@ interface DataTableContent {
399
402
  headers: string[];
400
403
  rows: string[][];
401
404
  }
405
+ interface PollUntilReadyOptions {
406
+ timeoutSecs?: number;
407
+ intervalSecs?: number;
408
+ onTick?: (status: GenerationStatus) => void | Promise<void>;
409
+ signal?: AbortSignal;
410
+ }
402
411
  type ReportFormat = "briefing_doc" | "study_guide" | "blog_post" | "custom";
403
412
  interface CreateReportOptions {
404
413
  format?: ReportFormat;
@@ -436,6 +445,11 @@ declare class ArtifactsAPI {
436
445
  createMindMap(notebookId: string, sourceIds?: string[]): Promise<Note>;
437
446
  /** Poll until artifact reaches completed/failed status. */
438
447
  waitUntilReady(notebookId: string, artifactId: string, timeout?: number, pollInterval?: number): Promise<Artifact>;
448
+ /** Poll until artifact is fully ready, with optional progress hooks and cancellation. */
449
+ pollUntilReady(notebookId: string, artifactId: string, opts?: PollUntilReadyOptions): Promise<Artifact>;
450
+ private throwIfAborted;
451
+ /** Get the current status of a generated artifact without waiting. */
452
+ pollStatus(notebookId: string, artifactId: string): Promise<GenerationStatus>;
439
453
  /** Download audio content as a Buffer. */
440
454
  downloadAudio(notebookId: string, artifactId: string): Promise<Buffer>;
441
455
  /** Download video content as a Buffer. */
@@ -475,25 +489,29 @@ interface AskOptions {
475
489
  declare class ChatAPI {
476
490
  private readonly rpc;
477
491
  private readonly auth;
492
+ private readonly refreshAuth?;
478
493
  private readonly conversationCache;
479
494
  private reqid;
480
- constructor(rpc: RPCCore, auth: AuthTokens);
495
+ constructor(rpc: RPCCore, auth: AuthTokens, refreshAuth?: (() => Promise<void>) | undefined);
481
496
  ask(notebookId: string, query: string, opts?: AskOptions): Promise<AskResult>;
482
497
  getConversationTurns(notebookId: string, conversationId: string): Promise<ConversationTurn[]>;
483
498
  getLastConversationId(notebookId: string): Promise<string | null>;
499
+ getHistory(notebookId: string, limit?: number, conversationId?: string): Promise<Array<[string, string]>>;
484
500
  /**
485
501
  * Low-level chat configuration. Set goal, response length, and optional
486
502
  * custom instructions directly. Persists on the server per notebook.
487
503
  * Use `setMode()` for preset combinations instead.
488
504
  */
489
- configure(notebookId: string, goal: ChatGoalValue, length: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
505
+ configure(notebookId: string, goal?: ChatGoalValue, length?: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
490
506
  /**
491
507
  * Set the chat mode for a notebook. Persists on the server — affects all
492
508
  * subsequent `ask()` calls until changed.
493
509
  */
494
510
  setMode(notebookId: string, mode: ChatModeValue): Promise<void>;
495
511
  clearCache(conversationId?: string): void;
512
+ getCachedTurns(conversationId: string): ConversationTurn[];
496
513
  private _buildHistory;
514
+ private _postChatRequest;
497
515
  }
498
516
 
499
517
  declare class NotebooksAPI {
@@ -506,7 +524,15 @@ declare class NotebooksAPI {
506
524
  rename(notebookId: string, newTitle: string): Promise<Notebook>;
507
525
  getSummary(notebookId: string): Promise<string>;
508
526
  removeFromRecent(notebookId: string): Promise<void>;
527
+ getRaw(notebookId: string): Promise<unknown>;
509
528
  getDescription(notebookId: string): Promise<NotebookDescription>;
529
+ share(notebookId: string, publicAccess?: boolean, artifactId?: string): Promise<{
530
+ public: boolean;
531
+ url: string | null;
532
+ artifactId: string | null;
533
+ }>;
534
+ getShareUrl(notebookId: string, artifactId?: string): string;
535
+ getMetadata(notebookId: string): Promise<NotebookMetadata>;
510
536
  }
511
537
 
512
538
  interface ResearchTask {
@@ -620,7 +646,9 @@ declare class SourcesAPI {
620
646
  checkFreshness(notebookId: string, sourceId: string): Promise<boolean>;
621
647
  delete(notebookId: string, sourceId: string): Promise<boolean>;
622
648
  refresh(notebookId: string, sourceId: string): Promise<boolean>;
649
+ rename(notebookId: string, sourceId: string, newTitle: string): Promise<Source>;
623
650
  waitUntilReady(notebookId: string, sourceId: string, timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source>;
651
+ waitForSources(notebookId: string, sourceIds: string[], timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source[]>;
624
652
  }
625
653
 
626
654
  interface ClientOptions {
@@ -650,6 +678,7 @@ declare class NotebookLMClient {
650
678
  readonly research: ResearchAPI;
651
679
  readonly settings: SettingsAPI;
652
680
  readonly sharing: SharingAPI;
681
+ private refreshPromise;
653
682
  private constructor();
654
683
  /**
655
684
  * Connect to NotebookLM using cookies.
@@ -662,4 +691,4 @@ declare class NotebookLMClient {
662
691
  refreshTokens(): Promise<void>;
663
692
  }
664
693
 
665
- 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 };
694
+ 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, type PollUntilReadyOptions, 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;
@@ -399,6 +402,12 @@ interface DataTableContent {
399
402
  headers: string[];
400
403
  rows: string[][];
401
404
  }
405
+ interface PollUntilReadyOptions {
406
+ timeoutSecs?: number;
407
+ intervalSecs?: number;
408
+ onTick?: (status: GenerationStatus) => void | Promise<void>;
409
+ signal?: AbortSignal;
410
+ }
402
411
  type ReportFormat = "briefing_doc" | "study_guide" | "blog_post" | "custom";
403
412
  interface CreateReportOptions {
404
413
  format?: ReportFormat;
@@ -436,6 +445,11 @@ declare class ArtifactsAPI {
436
445
  createMindMap(notebookId: string, sourceIds?: string[]): Promise<Note>;
437
446
  /** Poll until artifact reaches completed/failed status. */
438
447
  waitUntilReady(notebookId: string, artifactId: string, timeout?: number, pollInterval?: number): Promise<Artifact>;
448
+ /** Poll until artifact is fully ready, with optional progress hooks and cancellation. */
449
+ pollUntilReady(notebookId: string, artifactId: string, opts?: PollUntilReadyOptions): Promise<Artifact>;
450
+ private throwIfAborted;
451
+ /** Get the current status of a generated artifact without waiting. */
452
+ pollStatus(notebookId: string, artifactId: string): Promise<GenerationStatus>;
439
453
  /** Download audio content as a Buffer. */
440
454
  downloadAudio(notebookId: string, artifactId: string): Promise<Buffer>;
441
455
  /** Download video content as a Buffer. */
@@ -475,25 +489,29 @@ interface AskOptions {
475
489
  declare class ChatAPI {
476
490
  private readonly rpc;
477
491
  private readonly auth;
492
+ private readonly refreshAuth?;
478
493
  private readonly conversationCache;
479
494
  private reqid;
480
- constructor(rpc: RPCCore, auth: AuthTokens);
495
+ constructor(rpc: RPCCore, auth: AuthTokens, refreshAuth?: (() => Promise<void>) | undefined);
481
496
  ask(notebookId: string, query: string, opts?: AskOptions): Promise<AskResult>;
482
497
  getConversationTurns(notebookId: string, conversationId: string): Promise<ConversationTurn[]>;
483
498
  getLastConversationId(notebookId: string): Promise<string | null>;
499
+ getHistory(notebookId: string, limit?: number, conversationId?: string): Promise<Array<[string, string]>>;
484
500
  /**
485
501
  * Low-level chat configuration. Set goal, response length, and optional
486
502
  * custom instructions directly. Persists on the server per notebook.
487
503
  * Use `setMode()` for preset combinations instead.
488
504
  */
489
- configure(notebookId: string, goal: ChatGoalValue, length: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
505
+ configure(notebookId: string, goal?: ChatGoalValue, length?: ChatResponseLengthValue, customPrompt?: string): Promise<void>;
490
506
  /**
491
507
  * Set the chat mode for a notebook. Persists on the server — affects all
492
508
  * subsequent `ask()` calls until changed.
493
509
  */
494
510
  setMode(notebookId: string, mode: ChatModeValue): Promise<void>;
495
511
  clearCache(conversationId?: string): void;
512
+ getCachedTurns(conversationId: string): ConversationTurn[];
496
513
  private _buildHistory;
514
+ private _postChatRequest;
497
515
  }
498
516
 
499
517
  declare class NotebooksAPI {
@@ -506,7 +524,15 @@ declare class NotebooksAPI {
506
524
  rename(notebookId: string, newTitle: string): Promise<Notebook>;
507
525
  getSummary(notebookId: string): Promise<string>;
508
526
  removeFromRecent(notebookId: string): Promise<void>;
527
+ getRaw(notebookId: string): Promise<unknown>;
509
528
  getDescription(notebookId: string): Promise<NotebookDescription>;
529
+ share(notebookId: string, publicAccess?: boolean, artifactId?: string): Promise<{
530
+ public: boolean;
531
+ url: string | null;
532
+ artifactId: string | null;
533
+ }>;
534
+ getShareUrl(notebookId: string, artifactId?: string): string;
535
+ getMetadata(notebookId: string): Promise<NotebookMetadata>;
510
536
  }
511
537
 
512
538
  interface ResearchTask {
@@ -620,7 +646,9 @@ declare class SourcesAPI {
620
646
  checkFreshness(notebookId: string, sourceId: string): Promise<boolean>;
621
647
  delete(notebookId: string, sourceId: string): Promise<boolean>;
622
648
  refresh(notebookId: string, sourceId: string): Promise<boolean>;
649
+ rename(notebookId: string, sourceId: string, newTitle: string): Promise<Source>;
623
650
  waitUntilReady(notebookId: string, sourceId: string, timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source>;
651
+ waitForSources(notebookId: string, sourceIds: string[], timeout?: number, initialInterval?: number, maxInterval?: number, backoffFactor?: number): Promise<Source[]>;
624
652
  }
625
653
 
626
654
  interface ClientOptions {
@@ -650,6 +678,7 @@ declare class NotebookLMClient {
650
678
  readonly research: ResearchAPI;
651
679
  readonly settings: SettingsAPI;
652
680
  readonly sharing: SharingAPI;
681
+ private refreshPromise;
653
682
  private constructor();
654
683
  /**
655
684
  * Connect to NotebookLM using cookies.
@@ -662,4 +691,4 @@ declare class NotebookLMClient {
662
691
  refreshTokens(): Promise<void>;
663
692
  }
664
693
 
665
- 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 };
694
+ 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, type PollUntilReadyOptions, 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 };