Skip to content

Commit d8f3250

Browse files
Miriadresearch
andcommitted
feat: add notebooklm/types.ts
Co-authored-by: research <research@miriad.systems>
1 parent 5bfa0e0 commit d8f3250

1 file changed

Lines changed: 135 additions & 0 deletions

File tree

lib/services/notebooklm/types.ts

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/**
2+
* NotebookLM TypeScript Client — Type Definitions
3+
*
4+
* RPC method IDs, artifact codes, and interfaces for the pure-TS
5+
* NotebookLM client. Method IDs are reverse-engineered from the
6+
* notebooklm-py Python package.
7+
*
8+
* @module lib/services/notebooklm/types
9+
*/
10+
11+
// ---------------------------------------------------------------------------
12+
// RPC Method IDs (reverse-engineered from notebooklm-py)
13+
// ---------------------------------------------------------------------------
14+
15+
export const RPCMethod = {
16+
// Notebook operations
17+
LIST_NOTEBOOKS: 'wXbhsf',
18+
CREATE_NOTEBOOK: 'CCqFvf',
19+
GET_NOTEBOOK: 'rLM1Ne',
20+
DELETE_NOTEBOOK: 'WWINqb',
21+
22+
// Source operations
23+
ADD_SOURCE: 'izAoDd',
24+
25+
// Research
26+
START_FAST_RESEARCH: 'Ljjv0c',
27+
START_DEEP_RESEARCH: 'QA9ei',
28+
POLL_RESEARCH: 'e3bVqc',
29+
IMPORT_RESEARCH: 'LBwxtb',
30+
31+
// Artifacts
32+
CREATE_ARTIFACT: 'R7cb6c',
33+
LIST_ARTIFACTS: 'gArtLc',
34+
35+
// Summary
36+
SUMMARIZE: 'VfAZjd',
37+
38+
// Mind map
39+
GENERATE_MIND_MAP: 'yyryJe',
40+
} as const;
41+
42+
export type RPCMethodId = (typeof RPCMethod)[keyof typeof RPCMethod];
43+
44+
// ---------------------------------------------------------------------------
45+
// Artifact type codes
46+
// ---------------------------------------------------------------------------
47+
48+
export const ArtifactTypeCode = {
49+
AUDIO: 1,
50+
REPORT: 2,
51+
VIDEO: 3,
52+
QUIZ: 4,
53+
MIND_MAP: 5,
54+
INFOGRAPHIC: 7,
55+
SLIDE_DECK: 8,
56+
DATA_TABLE: 9,
57+
} as const;
58+
59+
// ---------------------------------------------------------------------------
60+
// Artifact status codes
61+
// ---------------------------------------------------------------------------
62+
63+
export const ArtifactStatus = {
64+
PROCESSING: 1,
65+
PENDING: 2,
66+
COMPLETED: 3,
67+
FAILED: 4,
68+
} as const;
69+
70+
// ---------------------------------------------------------------------------
71+
// Infographic options
72+
// ---------------------------------------------------------------------------
73+
74+
export const InfographicOrientation = {
75+
LANDSCAPE: 1,
76+
PORTRAIT: 2,
77+
SQUARE: 3,
78+
} as const;
79+
80+
export const InfographicDetail = {
81+
CONCISE: 1,
82+
STANDARD: 2,
83+
DETAILED: 3,
84+
} as const;
85+
86+
// ---------------------------------------------------------------------------
87+
// API endpoints
88+
// ---------------------------------------------------------------------------
89+
90+
export const BATCHEXECUTE_URL =
91+
'https://notebooklm.google.com/_/LabsTailwindUi/data/batchexecute';
92+
93+
// ---------------------------------------------------------------------------
94+
// Interfaces
95+
// ---------------------------------------------------------------------------
96+
97+
export interface NotebookLMCookie {
98+
name: string;
99+
value: string;
100+
domain: string;
101+
}
102+
103+
export interface AuthTokens {
104+
cookies: Record<string, string>;
105+
cookieHeader: string;
106+
csrfToken: string;
107+
sessionId: string;
108+
}
109+
110+
export interface Notebook {
111+
id: string;
112+
title: string;
113+
}
114+
115+
export interface ResearchResult {
116+
taskId: string;
117+
status: 'in_progress' | 'completed' | 'no_research';
118+
query: string;
119+
sources: Array<{ url: string; title: string }>;
120+
summary: string;
121+
}
122+
123+
export interface GenerationStatus {
124+
taskId: string;
125+
status: 'pending' | 'in_progress' | 'completed' | 'failed';
126+
error?: string;
127+
}
128+
129+
export interface Artifact {
130+
id: string;
131+
typeCode: number;
132+
statusCode: number;
133+
title?: string;
134+
raw: unknown[];
135+
}

0 commit comments

Comments
 (0)