notebooklm-kit 0.0.1 → 2.1.1
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 +22 -0
- package/README.md +4102 -0
- package/dist/src/auth/auth.d.ts +46 -0
- package/dist/src/auth/auth.d.ts.map +1 -0
- package/dist/src/auth/auth.js +323 -0
- package/dist/src/auth/auth.js.map +1 -0
- package/dist/src/auth/refresh.d.ts +150 -0
- package/dist/src/auth/refresh.d.ts.map +1 -0
- package/dist/src/auth/refresh.js +433 -0
- package/dist/src/auth/refresh.js.map +1 -0
- package/dist/src/client/notebooklm-client.d.ts +372 -0
- package/dist/src/client/notebooklm-client.d.ts.map +1 -0
- package/dist/src/client/notebooklm-client.js +550 -0
- package/dist/src/client/notebooklm-client.js.map +1 -0
- package/dist/src/index.d.ts +50 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +45 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/rpc/rpc-client.d.ts +48 -0
- package/dist/src/rpc/rpc-client.d.ts.map +1 -0
- package/dist/src/rpc/rpc-client.js +94 -0
- package/dist/src/rpc/rpc-client.js.map +1 -0
- package/dist/src/rpc/rpc-methods.d.ts +127 -0
- package/dist/src/rpc/rpc-methods.d.ts.map +1 -0
- package/dist/src/rpc/rpc-methods.js +169 -0
- package/dist/src/rpc/rpc-methods.js.map +1 -0
- package/dist/src/services/artifacts.d.ts +1017 -0
- package/dist/src/services/artifacts.d.ts.map +1 -0
- package/dist/src/services/artifacts.js +5413 -0
- package/dist/src/services/artifacts.js.map +1 -0
- package/dist/src/services/generation.d.ts +147 -0
- package/dist/src/services/generation.d.ts.map +1 -0
- package/dist/src/services/generation.js +479 -0
- package/dist/src/services/generation.js.map +1 -0
- package/dist/src/services/notebook-language.d.ts +109 -0
- package/dist/src/services/notebook-language.d.ts.map +1 -0
- package/dist/src/services/notebook-language.js +204 -0
- package/dist/src/services/notebook-language.js.map +1 -0
- package/dist/src/services/notebooks.d.ts +26 -0
- package/dist/src/services/notebooks.d.ts.map +1 -0
- package/dist/src/services/notebooks.js +539 -0
- package/dist/src/services/notebooks.js.map +1 -0
- package/dist/src/services/notes.d.ts +72 -0
- package/dist/src/services/notes.d.ts.map +1 -0
- package/dist/src/services/notes.js +340 -0
- package/dist/src/services/notes.js.map +1 -0
- package/dist/src/services/sources.d.ts +1085 -0
- package/dist/src/services/sources.d.ts.map +1 -0
- package/dist/src/services/sources.js +2675 -0
- package/dist/src/services/sources.js.map +1 -0
- package/dist/src/types/artifact.d.ts +258 -0
- package/dist/src/types/artifact.d.ts.map +1 -0
- package/dist/src/types/artifact.js +42 -0
- package/dist/src/types/artifact.js.map +1 -0
- package/dist/src/types/common.d.ts +226 -0
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/src/types/common.js +80 -0
- package/dist/src/types/common.js.map +1 -0
- package/dist/src/types/languages.d.ts +179 -0
- package/dist/src/types/languages.d.ts.map +1 -0
- package/dist/src/types/languages.js +254 -0
- package/dist/src/types/languages.js.map +1 -0
- package/dist/src/types/note.d.ts +41 -0
- package/dist/src/types/note.d.ts.map +1 -0
- package/dist/src/types/note.js +12 -0
- package/dist/src/types/note.js.map +1 -0
- package/dist/src/types/notebook.d.ts +81 -0
- package/dist/src/types/notebook.d.ts.map +1 -0
- package/dist/src/types/notebook.js +5 -0
- package/dist/src/types/notebook.js.map +1 -0
- package/dist/src/types/source.d.ts +241 -0
- package/dist/src/types/source.d.ts.map +1 -0
- package/dist/src/types/source.js +60 -0
- package/dist/src/types/source.js.map +1 -0
- package/dist/src/utils/batch-execute.d.ts +58 -0
- package/dist/src/utils/batch-execute.d.ts.map +1 -0
- package/dist/src/utils/batch-execute.js +398 -0
- package/dist/src/utils/batch-execute.js.map +1 -0
- package/dist/src/utils/chunked-decoder.d.ts +11 -0
- package/dist/src/utils/chunked-decoder.d.ts.map +1 -0
- package/dist/src/utils/chunked-decoder.js +326 -0
- package/dist/src/utils/chunked-decoder.js.map +1 -0
- package/dist/src/utils/chunked-parser.d.ts +61 -0
- package/dist/src/utils/chunked-parser.d.ts.map +1 -0
- package/dist/src/utils/chunked-parser.js +609 -0
- package/dist/src/utils/chunked-parser.js.map +1 -0
- package/dist/src/utils/errors.d.ts +58 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +357 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/quota.d.ts +213 -0
- package/dist/src/utils/quota.d.ts.map +1 -0
- package/dist/src/utils/quota.js +518 -0
- package/dist/src/utils/quota.js.map +1 -0
- package/dist/src/utils/streaming-client.d.ts +129 -0
- package/dist/src/utils/streaming-client.d.ts.map +1 -0
- package/dist/src/utils/streaming-client.js +559 -0
- package/dist/src/utils/streaming-client.js.map +1 -0
- package/package.json +85 -7
- package/index.js +0 -2
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chunked response parser for NotebookLM's special response format
|
|
3
|
+
* Handles the complex chunked format used by NotebookLM API responses
|
|
4
|
+
*/
|
|
5
|
+
import { NotebookLMParseError } from '../types/common.js';
|
|
6
|
+
/**
|
|
7
|
+
* Chunked response parser
|
|
8
|
+
* Specialized parser for NotebookLM's chunked response format
|
|
9
|
+
*/
|
|
10
|
+
export class ChunkedResponseParser {
|
|
11
|
+
raw;
|
|
12
|
+
debug;
|
|
13
|
+
rawChunks = [];
|
|
14
|
+
cleanedData = '';
|
|
15
|
+
constructor(raw, debug = false) {
|
|
16
|
+
this.raw = raw;
|
|
17
|
+
this.debug = debug;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parse list of projects from response
|
|
21
|
+
*/
|
|
22
|
+
parseListProjectsResponse() {
|
|
23
|
+
// Initialize chunks
|
|
24
|
+
this.rawChunks = this.extractChunks();
|
|
25
|
+
// Try different parsing methods
|
|
26
|
+
// Step 1: Standard JSON (preferred method for wXbhsf)
|
|
27
|
+
try {
|
|
28
|
+
const projects = this.parseStandardJSON();
|
|
29
|
+
if (projects.length >= 0) { // Allow empty arrays
|
|
30
|
+
return projects;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
this.logDebug(`Standard JSON parsing failed: ${error.message}, trying regex method`);
|
|
35
|
+
}
|
|
36
|
+
// Step 2: Regex-based extraction
|
|
37
|
+
try {
|
|
38
|
+
const projects = this.parseWithRegex();
|
|
39
|
+
if (projects.length > 0) {
|
|
40
|
+
this.logDebug(`Successfully parsed ${projects.length} projects using regex method`);
|
|
41
|
+
return projects;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.logDebug(`Regex parsing failed: ${error.message}, trying direct scan method`);
|
|
46
|
+
}
|
|
47
|
+
// Step 3: Direct scanning (last resort - may extract sources, so we filter)
|
|
48
|
+
try {
|
|
49
|
+
const allProjects = this.parseDirectScan();
|
|
50
|
+
if (allProjects.length > 0) {
|
|
51
|
+
// Filter out sources: only keep items where projectId matches a notebook ID pattern
|
|
52
|
+
// Notebooks have titles, sources don't (or have different structure)
|
|
53
|
+
const projects = allProjects.filter((p) => {
|
|
54
|
+
// If title is empty or looks like a source title, skip it
|
|
55
|
+
if (!p.title || p.title.trim() === '')
|
|
56
|
+
return false;
|
|
57
|
+
// If title looks like a file name (has extension), might be a source
|
|
58
|
+
if (/\.(pdf|png|jpg|jpeg|mp3|mp4|txt)$/i.test(p.title))
|
|
59
|
+
return false;
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
this.logDebug(`Successfully parsed ${projects.length} projects using direct scan method (filtered from ${allProjects.length} total)`);
|
|
63
|
+
return projects;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
this.logDebug(`Direct scan failed: ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
// Step 4: Check if response indicates empty list (metadata-only response)
|
|
70
|
+
try {
|
|
71
|
+
if (this.checkEmptyResponse()) {
|
|
72
|
+
this.logDebug('Response appears to be empty list (metadata only)');
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
this.logDebug(`Empty response check failed: ${error.message}`);
|
|
78
|
+
}
|
|
79
|
+
throw new NotebookLMParseError('Failed to parse projects response with all methods');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if response is an empty list (metadata-only)
|
|
83
|
+
*/
|
|
84
|
+
checkEmptyResponse() {
|
|
85
|
+
// Look for metadata-only response patterns
|
|
86
|
+
// Pattern: [null, [pagination], [metadata], ...] without actual project data
|
|
87
|
+
for (const chunk of this.rawChunks) {
|
|
88
|
+
if (chunk.includes('"wrb.fr"') && (chunk.includes('"hT54vc"') || chunk.includes('"ozz5Z"'))) {
|
|
89
|
+
try {
|
|
90
|
+
const parsed = JSON.parse(chunk);
|
|
91
|
+
if (Array.isArray(parsed) && parsed.length >= 3 && typeof parsed[2] === 'string') {
|
|
92
|
+
const innerData = JSON.parse(JSON.parse(`"${parsed[2]}"`));
|
|
93
|
+
// Check if it's a metadata-only structure (no project arrays)
|
|
94
|
+
if (Array.isArray(innerData) && innerData.length > 0) {
|
|
95
|
+
// If first element is null and structure looks like metadata, likely empty
|
|
96
|
+
if (innerData[0] === null && !this.containsProjectData(innerData)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Continue to other checks
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Check if data structure contains project-like data
|
|
111
|
+
*/
|
|
112
|
+
containsProjectData(data) {
|
|
113
|
+
if (!Array.isArray(data))
|
|
114
|
+
return false;
|
|
115
|
+
// Look for arrays that look like projects: [title, ..., projectId, emoji, ...]
|
|
116
|
+
for (const item of data) {
|
|
117
|
+
if (Array.isArray(item) && item.length >= 3) {
|
|
118
|
+
// Check if it has a UUID-like projectId at position 2
|
|
119
|
+
const possibleId = item[2];
|
|
120
|
+
if (typeof possibleId === 'string' && /^[a-f0-9-]{36}$/i.test(possibleId)) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Recursively check nested arrays
|
|
125
|
+
if (Array.isArray(item) && this.containsProjectData(item)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Extract and clean chunks from raw response
|
|
133
|
+
*/
|
|
134
|
+
extractChunks() {
|
|
135
|
+
// Remove typical chunked response header
|
|
136
|
+
let cleanedResponse = this.raw.trim().replace(/^\)\]\}'/, '');
|
|
137
|
+
// Handle trailing digits (chunk size indicators)
|
|
138
|
+
if (cleanedResponse.length > 0) {
|
|
139
|
+
cleanedResponse = cleanedResponse.replace(/\n\d+$/, '');
|
|
140
|
+
}
|
|
141
|
+
this.cleanedData = cleanedResponse;
|
|
142
|
+
// Split by newline
|
|
143
|
+
const chunks = cleanedResponse.split('\n');
|
|
144
|
+
// Filter out numeric-only chunks (chunk size indicators)
|
|
145
|
+
return chunks.filter(chunk => !this.isNumeric(chunk.trim()));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Parse using standard JSON techniques
|
|
149
|
+
*/
|
|
150
|
+
parseStandardJSON() {
|
|
151
|
+
let jsonSection = '';
|
|
152
|
+
// First, check if the raw response is already a valid JSON array (direct JSON, not chunked)
|
|
153
|
+
try {
|
|
154
|
+
const directParse = JSON.parse(this.raw.trim());
|
|
155
|
+
if (Array.isArray(directParse)) {
|
|
156
|
+
// This is a direct JSON array - parse it directly
|
|
157
|
+
// Handle different nesting structures:
|
|
158
|
+
// - [[[notebook]]] - single notebook triple-nested
|
|
159
|
+
// - [[[notebook1], [notebook2], ...]] - multiple notebooks triple-nested
|
|
160
|
+
// - [[notebook1], [notebook2], ...] - multiple notebooks double-nested
|
|
161
|
+
let projectsData = directParse;
|
|
162
|
+
// Check if triple-nested: [[[notebook(s)]]]
|
|
163
|
+
if (Array.isArray(directParse) && directParse.length === 1 && Array.isArray(directParse[0])) {
|
|
164
|
+
const innerArray = directParse[0];
|
|
165
|
+
// Check if inner array contains a single notebook or multiple notebooks
|
|
166
|
+
// Single notebook: [["title", [sources], "id", "emoji", null]]
|
|
167
|
+
// Multiple notebooks: [[["title1", ...], ["title2", ...], ...]]
|
|
168
|
+
if (innerArray.length === 1 && Array.isArray(innerArray[0])) {
|
|
169
|
+
// Check if this is a notebook array (has structure [title, sources, id, emoji])
|
|
170
|
+
const firstItem = innerArray[0];
|
|
171
|
+
if (Array.isArray(firstItem) && firstItem.length >= 3) {
|
|
172
|
+
const hasTitle = typeof firstItem[0] === 'string';
|
|
173
|
+
const hasSourcesOrId = Array.isArray(firstItem[1]) || firstItem[1] === null;
|
|
174
|
+
const hasId = typeof firstItem[2] === 'string' && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(firstItem[2]);
|
|
175
|
+
if (hasTitle && (hasSourcesOrId || hasId)) {
|
|
176
|
+
// This is a single notebook: wrap it in an array for consistent processing
|
|
177
|
+
projectsData = [firstItem];
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
// This might be an array of notebooks
|
|
181
|
+
projectsData = innerArray;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
projectsData = innerArray;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// Multiple items in inner array - could be notebooks or sources
|
|
190
|
+
projectsData = innerArray;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return this.parseProjectsArray(projectsData);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
// Not a direct JSON array, continue with chunked parsing
|
|
198
|
+
this.logDebug(`Direct JSON parse failed: ${error.message}`);
|
|
199
|
+
}
|
|
200
|
+
// Look for chunk containing "wrb.fr" with project list RPCs
|
|
201
|
+
for (const chunk of this.rawChunks) {
|
|
202
|
+
if (chunk.includes('"wrb.fr"') && (chunk.includes('"hT54vc"') || chunk.includes('"wXbhsf"') || chunk.includes('"ozz5Z"'))) {
|
|
203
|
+
jsonSection = chunk;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (!jsonSection) {
|
|
208
|
+
throw new Error('Failed to find JSON section containing wrb.fr');
|
|
209
|
+
}
|
|
210
|
+
// Try to parse as JSON
|
|
211
|
+
let wrbResponse;
|
|
212
|
+
try {
|
|
213
|
+
wrbResponse = JSON.parse(jsonSection);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// Try extracting just the array part
|
|
217
|
+
const arrayStart = jsonSection.indexOf('[[');
|
|
218
|
+
const arrayEnd = jsonSection.lastIndexOf(']]');
|
|
219
|
+
if (arrayStart >= 0 && arrayEnd > arrayStart) {
|
|
220
|
+
const arrayString = jsonSection.substring(arrayStart, arrayEnd + 2);
|
|
221
|
+
wrbResponse = JSON.parse(arrayString);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
throw new Error('Failed to parse JSON');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (wrbResponse.length < 3) {
|
|
228
|
+
throw new Error(`Unexpected response format: array too short (len=${wrbResponse.length})`);
|
|
229
|
+
}
|
|
230
|
+
// Extract projects data from position 2
|
|
231
|
+
let projectsRaw;
|
|
232
|
+
if (typeof wrbResponse[2] === 'string') {
|
|
233
|
+
projectsRaw = wrbResponse[2];
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
throw new Error(`Unexpected type for project data: ${typeof wrbResponse[2]}`);
|
|
237
|
+
}
|
|
238
|
+
// Unescape the JSON string
|
|
239
|
+
let unescaped;
|
|
240
|
+
try {
|
|
241
|
+
unescaped = JSON.parse(`"${projectsRaw}"`);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
throw new Error('Failed to unescape project data');
|
|
245
|
+
}
|
|
246
|
+
// Parse as array
|
|
247
|
+
let projectsData;
|
|
248
|
+
try {
|
|
249
|
+
projectsData = JSON.parse(unescaped);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
// Try parsing as object
|
|
253
|
+
if (error.message.includes('cannot unmarshal object')) {
|
|
254
|
+
return this.parseAsObject(unescaped);
|
|
255
|
+
}
|
|
256
|
+
throw new Error('Failed to parse project data as array');
|
|
257
|
+
}
|
|
258
|
+
// Check if this is a metadata-only response (empty list)
|
|
259
|
+
if (Array.isArray(projectsData) && projectsData.length >= 2) {
|
|
260
|
+
// Empty list response pattern: [null, [pagination], [metadata], ...]
|
|
261
|
+
// First element is null, second is pagination [1,100,50,500000], third is metadata
|
|
262
|
+
if (projectsData[0] === null &&
|
|
263
|
+
Array.isArray(projectsData[1]) &&
|
|
264
|
+
projectsData[1].length === 4 &&
|
|
265
|
+
typeof projectsData[1][0] === 'number') {
|
|
266
|
+
// This is a valid empty list response - return empty array
|
|
267
|
+
this.logDebug('Recognized empty list response (metadata-only structure)');
|
|
268
|
+
return [];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// Parse the projects data array
|
|
272
|
+
return this.parseProjectsArray(projectsData);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Parse projects array into notebook objects
|
|
276
|
+
*/
|
|
277
|
+
parseProjectsArray(projectsData) {
|
|
278
|
+
// Handle different response structures
|
|
279
|
+
const projects = [];
|
|
280
|
+
// Helper to check if a string looks like a UUID (notebook ID)
|
|
281
|
+
const isUUIDLike = (str) => {
|
|
282
|
+
if (typeof str !== 'string')
|
|
283
|
+
return false;
|
|
284
|
+
// UUID format: 8-4-4-4-12 hex digits with dashes
|
|
285
|
+
return /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(str);
|
|
286
|
+
};
|
|
287
|
+
// Handle different structures:
|
|
288
|
+
// - [[notebook]] - single notebook double-nested (from parseStandardJSON)
|
|
289
|
+
// - [[notebook1], [notebook2], ...] - multiple notebooks double-nested
|
|
290
|
+
// - [notebook] - single notebook array directly (edge case)
|
|
291
|
+
let notebooksArray = projectsData;
|
|
292
|
+
// Check if projectsData is a direct notebook array (not wrapped in another array)
|
|
293
|
+
// This should only happen in edge cases, not from parseStandardJSON
|
|
294
|
+
if (Array.isArray(projectsData) && projectsData.length >= 3) {
|
|
295
|
+
const firstIsString = typeof projectsData[0] === 'string';
|
|
296
|
+
const secondIsArrayOrNull = Array.isArray(projectsData[1]) || projectsData[1] === null;
|
|
297
|
+
const thirdIsUUID = typeof projectsData[2] === 'string' && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(projectsData[2]);
|
|
298
|
+
// Only wrap if:
|
|
299
|
+
// 1. It looks like a notebook array (title, sources/id, id)
|
|
300
|
+
// 2. AND the first element is NOT an array (if first element is array, it's already wrapped)
|
|
301
|
+
// 3. AND projectsData.length is small (if it's large, it's likely already an array of notebooks)
|
|
302
|
+
if (firstIsString && (secondIsArrayOrNull || thirdIsUUID) &&
|
|
303
|
+
!Array.isArray(projectsData[0]) && projectsData.length < 10) {
|
|
304
|
+
this.logDebug('Detected direct notebook array (not wrapped), wrapping it');
|
|
305
|
+
notebooksArray = [projectsData];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Case 1: notebooksArray is an array of notebook arrays
|
|
309
|
+
if (Array.isArray(notebooksArray)) {
|
|
310
|
+
for (let i = 0; i < notebooksArray.length; i++) {
|
|
311
|
+
const item = notebooksArray[i];
|
|
312
|
+
if (!Array.isArray(item) || item.length < 3) {
|
|
313
|
+
this.logDebug(`Skipping item ${i}: not array or too short (len=${Array.isArray(item) ? item.length : typeof item})`);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
// wXbhsf structure: [title, [sources...] or null, notebook_id, emoji, ...]
|
|
317
|
+
// CRITICAL: Skip if this looks like a source array (nested inside notebook)
|
|
318
|
+
// Sources have structure: [[source_id], source_title, ...] where source_id is at index 0
|
|
319
|
+
// OR: [source_title, ..., source_id, ...] where source_id is at a later index
|
|
320
|
+
// Notebooks have structure: [title, [sources...] or null, notebook_id, emoji] where title is at index 0
|
|
321
|
+
const firstElement = item[0];
|
|
322
|
+
// If first element is an array containing a UUID (source ID), this is a source, skip it
|
|
323
|
+
if (Array.isArray(firstElement) && firstElement.length > 0 && isUUIDLike(firstElement[0])) {
|
|
324
|
+
this.logDebug(`Skipping source: first element is array with UUID ${firstElement[0]}`);
|
|
325
|
+
continue; // This is a source, not a notebook
|
|
326
|
+
}
|
|
327
|
+
const title = item[0];
|
|
328
|
+
const sourcesOrId = item[1];
|
|
329
|
+
const possibleId = item[2];
|
|
330
|
+
const emoji = item[3];
|
|
331
|
+
// Pattern 1: [title, [sources...] or null, notebook_id, emoji] - wXbhsf format
|
|
332
|
+
// This is the PRIMARY pattern for notebooks - they MUST have sources array or null at index 1
|
|
333
|
+
// Validate:
|
|
334
|
+
// - index 0 (title) must be a string (can be empty)
|
|
335
|
+
// - index 1 (sourcesOrId) must be an array (sources) OR null
|
|
336
|
+
// - index 2 (possibleId) must be a valid UUID (notebook ID)
|
|
337
|
+
// - index 3 (emoji) is optional
|
|
338
|
+
if (typeof title === 'string' && (Array.isArray(sourcesOrId) || sourcesOrId === null) && isUUIDLike(possibleId)) {
|
|
339
|
+
// Additional validation: if sourcesOrId is an array, verify it contains source structures
|
|
340
|
+
// Sources have structure: [[source_id], source_title, ...]
|
|
341
|
+
if (Array.isArray(sourcesOrId) && sourcesOrId.length > 0) {
|
|
342
|
+
const firstSource = sourcesOrId[0];
|
|
343
|
+
// If first source doesn't look like a source array ([[source_id], ...]), skip
|
|
344
|
+
if (!Array.isArray(firstSource) || firstSource.length === 0 || !Array.isArray(firstSource[0])) {
|
|
345
|
+
this.logDebug(`Skipping item: sources array doesn't contain valid source structures`);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Count sources: sourcesOrId is either null or an array of sources
|
|
350
|
+
const sourceCount = Array.isArray(sourcesOrId) ? sourcesOrId.length : 0;
|
|
351
|
+
const project = {
|
|
352
|
+
title: title.trim() || 'Untitled notebook',
|
|
353
|
+
projectId: possibleId,
|
|
354
|
+
emoji: typeof emoji === 'string' && emoji.trim() ? emoji : '📄',
|
|
355
|
+
sourceCount,
|
|
356
|
+
};
|
|
357
|
+
projects.push(project);
|
|
358
|
+
continue; // Skip to next item
|
|
359
|
+
}
|
|
360
|
+
// Pattern 2: [title, ..., projectId, emoji] - simpler format (no nested sources, sourcesOrId is not an array)
|
|
361
|
+
// CRITICAL: This pattern is DEPRECATED and should rarely match
|
|
362
|
+
// The API should primarily return Pattern 1 (with sources array or null)
|
|
363
|
+
// Only accept Pattern 2 if:
|
|
364
|
+
// 1. Index 1 is NOT an array and NOT null (different from notebook pattern)
|
|
365
|
+
// 2. AND the title doesn't look like a source (URLs, file extensions, malformed JSON)
|
|
366
|
+
// 3. AND we have strong indicators it's a notebook (emoji at index 3, proper title length)
|
|
367
|
+
// 4. AND the title is not empty and looks like a real notebook title
|
|
368
|
+
if (typeof title === 'string' && !Array.isArray(sourcesOrId) && sourcesOrId !== null && isUUIDLike(possibleId)) {
|
|
369
|
+
const titleStr = String(title).trim();
|
|
370
|
+
// STRICT filtering to exclude sources:
|
|
371
|
+
// - Sources often have URLs as titles (start with http:// or https://)
|
|
372
|
+
// - Sources often have file extensions in titles
|
|
373
|
+
// - Sources might have malformed titles (like the ones in the terminal output)
|
|
374
|
+
// - Sources might have very short or very long titles
|
|
375
|
+
const looksLikeSource = !titleStr || // Empty title
|
|
376
|
+
titleStr.startsWith('http://') ||
|
|
377
|
+
titleStr.startsWith('https://') ||
|
|
378
|
+
/\.(pdf|png|jpg|jpeg|mp3|mp4|txt|doc|docx)$/i.test(titleStr) ||
|
|
379
|
+
titleStr.length > 200 || // Very long titles are likely sources
|
|
380
|
+
titleStr.length < 3 || // Very short titles are suspicious
|
|
381
|
+
/^[,\[\]]/.test(titleStr) || // Starts with JSON-like characters (malformed)
|
|
382
|
+
/\]\]/.test(titleStr) || // Contains closing brackets (malformed JSON)
|
|
383
|
+
/^\[null/.test(titleStr) || // Starts with [null (malformed JSON)
|
|
384
|
+
/null,/.test(titleStr); // Contains null, (malformed JSON)
|
|
385
|
+
if (looksLikeSource) {
|
|
386
|
+
this.logDebug(`Skipping source: title looks like a source (${titleStr.substring(0, 50)}...)`);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
// Additional checks for notebook indicators:
|
|
390
|
+
// - Must have at least 4 elements (title, something, id, emoji)
|
|
391
|
+
// - Should have an emoji at index 3 (notebooks typically have emojis)
|
|
392
|
+
if (item.length < 4) {
|
|
393
|
+
this.logDebug(`Skipping item: too short to be a notebook (len=${item.length})`);
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
// If no emoji and title is suspicious, skip it
|
|
397
|
+
if (!emoji || (typeof emoji !== 'string')) {
|
|
398
|
+
this.logDebug(`Skipping item: no emoji indicator, likely a source`);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
// No sources in this format
|
|
402
|
+
const project = {
|
|
403
|
+
title: titleStr || 'Untitled notebook',
|
|
404
|
+
projectId: possibleId,
|
|
405
|
+
emoji: typeof emoji === 'string' && emoji.trim() ? emoji : '📄',
|
|
406
|
+
sourceCount: 0,
|
|
407
|
+
};
|
|
408
|
+
this.logDebug(`Extracted notebook (pattern 2 - rare case): ${project.title} (${possibleId}) with 0 sources`);
|
|
409
|
+
projects.push(project);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
this.logDebug(`Skipping item: doesn't match notebook pattern (title=${typeof title}, sourcesOrId=${typeof sourcesOrId}, possibleId=${typeof possibleId})`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// If no projects found, return empty array (valid empty list)
|
|
417
|
+
return projects;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Parse as object format
|
|
421
|
+
*/
|
|
422
|
+
parseAsObject(data) {
|
|
423
|
+
const projectMap = JSON.parse(data);
|
|
424
|
+
const projects = [];
|
|
425
|
+
for (const [key, value] of Object.entries(projectMap)) {
|
|
426
|
+
if (this.isUUIDLike(key)) {
|
|
427
|
+
const proj = {
|
|
428
|
+
projectId: key,
|
|
429
|
+
title: '',
|
|
430
|
+
emoji: '📄',
|
|
431
|
+
};
|
|
432
|
+
if (typeof value === 'object' && value !== null) {
|
|
433
|
+
const objValue = value;
|
|
434
|
+
proj.title = objValue.title || objValue.name || `Project ${key.substring(0, 8)}`;
|
|
435
|
+
if (objValue.emoji) {
|
|
436
|
+
proj.emoji = objValue.emoji;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
projects.push(proj);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (projects.length === 0) {
|
|
443
|
+
throw new Error('No projects found in object format');
|
|
444
|
+
}
|
|
445
|
+
return projects;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Parse using regex patterns
|
|
449
|
+
*/
|
|
450
|
+
parseWithRegex() {
|
|
451
|
+
// Find wrb.fr section (supports hT54vc, wXbhsf, and ozz5Z RPC IDs)
|
|
452
|
+
const wrbfrPattern = /\[\["wrb\.fr","(?:hT54vc|wXbhsf|ozz5Z)","(.*?)",/;
|
|
453
|
+
const matches = this.cleanedData.match(wrbfrPattern);
|
|
454
|
+
if (!matches || matches.length < 2) {
|
|
455
|
+
throw new Error('Could not find project data section in response');
|
|
456
|
+
}
|
|
457
|
+
// Unescape
|
|
458
|
+
let projectDataStr = matches[1];
|
|
459
|
+
projectDataStr = projectDataStr.replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
460
|
+
this.logDebug(`Project data string (first 100 chars): ${projectDataStr.substring(0, 100)}`);
|
|
461
|
+
// Find projects
|
|
462
|
+
const projects = [];
|
|
463
|
+
const titlePattern = /\[\[\["([^"]+?)"/g;
|
|
464
|
+
let match;
|
|
465
|
+
while ((match = titlePattern.exec(projectDataStr)) !== null) {
|
|
466
|
+
const title = match[1];
|
|
467
|
+
if (!title)
|
|
468
|
+
continue;
|
|
469
|
+
// Look for project ID near title
|
|
470
|
+
const idPattern = new RegExp(`\\["${this.escapeRegex(title)}"[^\\]]*?,[^\\]]*?,"([a-zA-Z0-9-]+)"`);
|
|
471
|
+
const idMatch = projectDataStr.match(idPattern);
|
|
472
|
+
let projectId = '';
|
|
473
|
+
if (idMatch && idMatch[1]) {
|
|
474
|
+
projectId = idMatch[1];
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
// Try to find UUID-like pattern nearby
|
|
478
|
+
const uuidPattern = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/;
|
|
479
|
+
const titleIndex = projectDataStr.indexOf(title);
|
|
480
|
+
if (titleIndex > 0) {
|
|
481
|
+
const searchEnd = Math.min(titleIndex + 500, projectDataStr.length);
|
|
482
|
+
const uuidMatch = projectDataStr.substring(titleIndex, searchEnd).match(uuidPattern);
|
|
483
|
+
if (uuidMatch) {
|
|
484
|
+
projectId = uuidMatch[0];
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (!projectId)
|
|
489
|
+
continue;
|
|
490
|
+
// Look for emoji
|
|
491
|
+
let emoji = '📄';
|
|
492
|
+
const projectIdIndex = projectDataStr.indexOf(projectId);
|
|
493
|
+
if (projectIdIndex > 0) {
|
|
494
|
+
const searchEnd = Math.min(projectIdIndex + 100, projectDataStr.length);
|
|
495
|
+
const emojiPattern = /"([^"]{1,5})"/g;
|
|
496
|
+
const emojiSection = projectDataStr.substring(projectIdIndex, searchEnd);
|
|
497
|
+
let emojiMatch;
|
|
498
|
+
while ((emojiMatch = emojiPattern.exec(emojiSection)) !== null) {
|
|
499
|
+
if (emojiMatch[1] && emojiMatch[1].length <= 2) {
|
|
500
|
+
emoji = emojiMatch[1];
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
projects.push({ title, projectId, emoji });
|
|
506
|
+
}
|
|
507
|
+
if (projects.length === 0) {
|
|
508
|
+
throw new Error('No projects found using regex patterns');
|
|
509
|
+
}
|
|
510
|
+
return projects;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Parse using direct scanning
|
|
514
|
+
* NOTE: This is a fallback method and should use strict filtering to avoid including sources
|
|
515
|
+
*/
|
|
516
|
+
parseDirectScan() {
|
|
517
|
+
// Find all UUID patterns
|
|
518
|
+
const uuidPattern = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/g;
|
|
519
|
+
const uuidMatches = this.cleanedData.match(uuidPattern) || [];
|
|
520
|
+
if (uuidMatches.length === 0) {
|
|
521
|
+
throw new Error('No UUID-like project IDs found in the response');
|
|
522
|
+
}
|
|
523
|
+
// Deduplicate
|
|
524
|
+
const uniqueIds = Array.from(new Set(uuidMatches));
|
|
525
|
+
const projects = [];
|
|
526
|
+
this.logDebug(`Direct scan: Found ${uniqueIds.length} unique UUIDs, applying strict filtering...`);
|
|
527
|
+
for (const id of uniqueIds) {
|
|
528
|
+
const project = {
|
|
529
|
+
projectId: id,
|
|
530
|
+
title: '',
|
|
531
|
+
emoji: '📄',
|
|
532
|
+
};
|
|
533
|
+
// Find title near ID
|
|
534
|
+
const idIndex = this.cleanedData.indexOf(id);
|
|
535
|
+
if (idIndex > 0) {
|
|
536
|
+
const beforeStart = Math.max(0, idIndex - 500);
|
|
537
|
+
const beforeText = this.cleanedData.substring(beforeStart, idIndex);
|
|
538
|
+
// Look for title in quotes
|
|
539
|
+
const titlePattern = /"([^"]{3,200})"/g;
|
|
540
|
+
const titleMatches = [];
|
|
541
|
+
let titleMatch;
|
|
542
|
+
while ((titleMatch = titlePattern.exec(beforeText)) !== null) {
|
|
543
|
+
if (titleMatch[1]) {
|
|
544
|
+
titleMatches.push(titleMatch[1]);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (titleMatches.length > 0) {
|
|
548
|
+
project.title = titleMatches[titleMatches.length - 1]; // Closest to ID
|
|
549
|
+
}
|
|
550
|
+
// Look for emoji after ID
|
|
551
|
+
const afterEnd = Math.min(this.cleanedData.length, idIndex + 100);
|
|
552
|
+
const afterText = this.cleanedData.substring(idIndex, afterEnd);
|
|
553
|
+
const emojiPattern = /"([^"]{1,2})"/;
|
|
554
|
+
const emojiMatch = afterText.match(emojiPattern);
|
|
555
|
+
if (emojiMatch && emojiMatch[1]) {
|
|
556
|
+
project.emoji = emojiMatch[1];
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (!project.title) {
|
|
560
|
+
project.title = `Notebook ${id.substring(0, 8)}`;
|
|
561
|
+
}
|
|
562
|
+
// Apply the same strict filtering as parseProjectsArray Pattern 2
|
|
563
|
+
const titleStr = String(project.title).trim();
|
|
564
|
+
const looksLikeSource = !titleStr || // Empty title
|
|
565
|
+
titleStr.startsWith('http://') ||
|
|
566
|
+
titleStr.startsWith('https://') ||
|
|
567
|
+
/\.(pdf|png|jpg|jpeg|mp3|mp4|txt|doc|docx)$/i.test(titleStr) ||
|
|
568
|
+
titleStr.length > 200 || // Very long titles are likely sources
|
|
569
|
+
titleStr.length < 3 || // Very short titles are suspicious
|
|
570
|
+
/^[,\[\]]/.test(titleStr) || // Starts with JSON-like characters (malformed)
|
|
571
|
+
/\]\]/.test(titleStr) || // Contains closing brackets (malformed JSON)
|
|
572
|
+
/^\[null/.test(titleStr) || // Starts with [null (malformed JSON)
|
|
573
|
+
/null,/.test(titleStr) || // Contains null, (malformed JSON)
|
|
574
|
+
titleStr === `Notebook ${id.substring(0, 8)}`; // Generated title (no real title found)
|
|
575
|
+
if (looksLikeSource) {
|
|
576
|
+
this.logDebug(`Direct scan: Skipping source ${id}: title looks like a source (${titleStr.substring(0, 50)}...)`);
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
this.logDebug(`Direct scan: Accepting notebook ${id}: "${titleStr.substring(0, 50)}${titleStr.length > 50 ? '...' : ''}"`);
|
|
580
|
+
projects.push(project);
|
|
581
|
+
}
|
|
582
|
+
this.logDebug(`Direct scan: Filtered ${uniqueIds.length} UUIDs down to ${projects.length} notebooks`);
|
|
583
|
+
return projects;
|
|
584
|
+
}
|
|
585
|
+
// ========================================================================
|
|
586
|
+
// Helper methods
|
|
587
|
+
// ========================================================================
|
|
588
|
+
isNumeric(s) {
|
|
589
|
+
return /^\d+$/.test(s.trim());
|
|
590
|
+
}
|
|
591
|
+
isUUIDLike(s) {
|
|
592
|
+
return /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(s);
|
|
593
|
+
}
|
|
594
|
+
escapeRegex(str) {
|
|
595
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
596
|
+
}
|
|
597
|
+
logDebug(message) {
|
|
598
|
+
if (this.debug && typeof console !== 'undefined') {
|
|
599
|
+
console.log(`[ChunkedParser] ${message}`);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Create a chunked response parser
|
|
605
|
+
*/
|
|
606
|
+
export function createChunkedParser(raw, debug = false) {
|
|
607
|
+
return new ChunkedResponseParser(raw, debug);
|
|
608
|
+
}
|
|
609
|
+
//# sourceMappingURL=chunked-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunked-parser.js","sourceRoot":"","sources":["../../../src/utils/chunked-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,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