@ontos-ai/knowhere-sdk 2.0.0 → 2.1.2

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.ts CHANGED
@@ -118,176 +118,6 @@ interface JobResult {
118
118
  readonly isFailed: boolean;
119
119
  }
120
120
 
121
- /**
122
- * Parsing model options
123
- */
124
- type ParsingModel = 'base' | 'advanced';
125
- /**
126
- * Document type options
127
- */
128
- type DocType = 'auto' | 'pdf' | 'docx' | 'txt' | 'md';
129
- /**
130
- * Parsing configuration parameters
131
- */
132
- interface ParsingParams {
133
- /** Parsing model to use (default: 'base') */
134
- model?: ParsingModel;
135
- /** Enable OCR for scanned documents (default: false) */
136
- ocrEnabled?: boolean;
137
- /** Knowledge base directory */
138
- kbDir?: string;
139
- /** Document type hint (default: 'auto') */
140
- docType?: DocType;
141
- /** Enable smart title parsing (default: false) */
142
- smartTitleParse?: boolean;
143
- /** Generate image summaries (default: false) */
144
- summaryImage?: boolean;
145
- /** Generate table summaries (default: false) */
146
- summaryTable?: boolean;
147
- /** Generate text summaries (default: false) */
148
- summaryTxt?: boolean;
149
- /** Additional fragment description */
150
- addFragDesc?: string;
151
- }
152
- /**
153
- * Webhook configuration
154
- */
155
- interface WebhookConfig {
156
- /** Webhook URL to notify on job completion */
157
- url: string;
158
- }
159
- /**
160
- * Client-provided display metadata copied onto the published document.
161
- */
162
- type DocumentMetadata = Record<string, unknown>;
163
- /**
164
- * Job creation parameters
165
- */
166
- interface CreateJobParams {
167
- /** Source type: 'file' for upload, 'url' for remote document */
168
- sourceType: 'file' | 'url';
169
- /** Source URL (required if sourceType is 'url') */
170
- sourceUrl?: string;
171
- /** File name (required if sourceType is 'file') */
172
- fileName?: string;
173
- /** Optional custom data identifier */
174
- dataId?: string;
175
- /** Retrieval namespace for the canonical document */
176
- namespace?: string;
177
- /** Existing document identifier when updating a published document */
178
- documentId?: string;
179
- /** Display metadata to copy onto the published document */
180
- documentMetadata?: DocumentMetadata;
181
- /** Parsing configuration */
182
- parsingParams?: ParsingParams;
183
- /** Webhook configuration */
184
- webhook?: WebhookConfig;
185
- }
186
- /**
187
- * File upload parameters
188
- */
189
- interface UploadParams {
190
- /** File to upload (path, Buffer, Stream, or Uint8Array) */
191
- file: string | Buffer | ReadStream | Uint8Array;
192
- /** Upload progress callback */
193
- onProgress?: (progress: UploadProgress) => void;
194
- /** Abort signal for cancellation */
195
- signal?: AbortSignal;
196
- }
197
- /**
198
- * Wait options for polling
199
- */
200
- interface WaitOptions {
201
- /** Polling interval in milliseconds (default: 10000) */
202
- pollInterval?: number;
203
- /** Maximum wait time in milliseconds (default: 1800000 = 30 minutes) */
204
- pollTimeout?: number;
205
- /** Progress callback */
206
- onProgress?: (status: PollProgress) => void;
207
- /** Abort signal for cancellation */
208
- signal?: AbortSignal;
209
- }
210
- /**
211
- * Load options for result parsing
212
- */
213
- interface LoadOptions {
214
- /** Whether to verify ZIP checksum (default: true) */
215
- verifyChecksum?: boolean;
216
- }
217
- /**
218
- * High-level parse parameters
219
- */
220
- interface ParseParams {
221
- /** Source URL (mutually exclusive with file) */
222
- url?: string;
223
- /** File to parse (path, Buffer, Stream, or Uint8Array) */
224
- file?: string | Buffer | ReadStream | Uint8Array;
225
- /** File name (auto-inferred for file paths and fs.ReadStream with a path) */
226
- fileName?: string;
227
- /** Parsing model (default: 'base') */
228
- model?: ParsingModel;
229
- /** Enable OCR (default: false) */
230
- ocr?: boolean;
231
- /** Document type hint */
232
- docType?: DocType;
233
- /** Enable smart title parsing */
234
- smartTitleParse?: boolean;
235
- /** Generate image summaries */
236
- summaryImage?: boolean;
237
- /** Generate table summaries */
238
- summaryTable?: boolean;
239
- /** Generate text summaries */
240
- summaryTxt?: boolean;
241
- /** Custom data identifier */
242
- dataId?: string;
243
- /** Retrieval namespace for the canonical document */
244
- namespace?: string;
245
- /** Existing document identifier when updating a published document */
246
- documentId?: string;
247
- /** Display metadata to copy onto the published document */
248
- documentMetadata?: DocumentMetadata;
249
- /** Additional fragment description */
250
- addFragDesc?: string;
251
- /** Knowledge base directory */
252
- kbDir?: string;
253
- /** Polling interval in milliseconds */
254
- pollInterval?: number;
255
- /** Maximum wait time in milliseconds */
256
- pollTimeout?: number;
257
- /** Whether to verify ZIP checksum (default: true) */
258
- verifyChecksum?: boolean;
259
- /** Webhook configuration */
260
- webhook?: WebhookConfig;
261
- /** Upload progress callback */
262
- onUploadProgress?: (progress: UploadProgress) => void;
263
- /** Poll progress callback */
264
- onPollProgress?: (status: PollProgress) => void;
265
- /** Abort signal */
266
- signal?: AbortSignal;
267
- }
268
- /**
269
- * Upload progress information
270
- */
271
- interface UploadProgress {
272
- /** Bytes uploaded */
273
- loaded: number;
274
- /** Total bytes (may be undefined for streams) */
275
- total?: number;
276
- /** Upload percentage (0-100) */
277
- percent: number;
278
- }
279
- /**
280
- * Polling progress information
281
- */
282
- interface PollProgress {
283
- /** Current job status */
284
- status: JobStatus;
285
- /** Elapsed time in seconds */
286
- elapsedSeconds: number;
287
- /** Current job result */
288
- jobResult: JobResult;
289
- }
290
-
291
121
  /**
292
122
  * Statistics about the parsed document
293
123
  */
@@ -469,6 +299,8 @@ interface ImageChunk extends BaseChunk {
469
299
  type: 'image';
470
300
  /** Relative file path in ZIP */
471
301
  filePath: string;
302
+ /** Application-owned or server-provided display URL for the image asset. */
303
+ assetUrl?: string;
472
304
  /** Image data buffer */
473
305
  data: Buffer;
474
306
  /** Image format (derived from file extension) */
@@ -483,6 +315,8 @@ interface TableChunk extends BaseChunk {
483
315
  type: 'table';
484
316
  /** Relative file path in ZIP */
485
317
  filePath: string;
318
+ /** Application-owned or server-provided display URL for the table asset. */
319
+ assetUrl?: string;
486
320
  /** HTML representation */
487
321
  html: string;
488
322
  /** Save table HTML to disk */
@@ -544,6 +378,281 @@ interface ParseResult {
544
378
  save(directory: string): Promise<string>;
545
379
  }
546
380
 
381
+ type KnowhereAssetStorageBody = Uint8Array;
382
+ interface KnowhereAssetStorageObject {
383
+ readonly key: string;
384
+ readonly body: KnowhereAssetStorageBody;
385
+ readonly contentType: string;
386
+ readonly metadata?: Readonly<Record<string, string>>;
387
+ }
388
+ interface KnowhereAssetStorageHead {
389
+ readonly key: string;
390
+ readonly contentType?: string;
391
+ readonly contentLength?: number;
392
+ readonly metadata?: Readonly<Record<string, string>>;
393
+ readonly url?: string;
394
+ }
395
+ interface KnowhereAssetStorageWriteResult {
396
+ readonly key: string;
397
+ readonly url?: string;
398
+ }
399
+ interface KnowhereAssetStorageAdapter {
400
+ writeObject(input: KnowhereAssetStorageObject): Promise<KnowhereAssetStorageWriteResult>;
401
+ headObject?(key: string): Promise<KnowhereAssetStorageHead | null>;
402
+ getObjectUrl?(key: string): Promise<string | null>;
403
+ }
404
+ interface KnowhereAssetStorageOptions {
405
+ readonly adapter: KnowhereAssetStorageAdapter;
406
+ readonly keyPrefix: string;
407
+ readonly skipExisting?: boolean;
408
+ }
409
+ interface KnowhereAssetStorageResult {
410
+ readonly result: ParseResult;
411
+ readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
412
+ }
413
+ interface ParsedDocumentStorageDocument {
414
+ readonly documentId: string;
415
+ readonly revisionKey: string;
416
+ }
417
+ type ParsedDocumentRevisionParams = ParsedDocumentStorageDocument;
418
+ interface ParsedDocumentObjectParams extends ParsedDocumentRevisionParams {
419
+ readonly path: string;
420
+ }
421
+ interface ParsedDocumentObjectHead extends ParsedDocumentObjectParams {
422
+ readonly contentType?: string;
423
+ readonly contentLength?: number;
424
+ readonly metadata?: Readonly<Record<string, string>>;
425
+ readonly url?: string;
426
+ }
427
+ interface ParsedDocumentObject extends ParsedDocumentObjectHead {
428
+ readonly body: KnowhereAssetStorageBody;
429
+ }
430
+ interface ParsedDocumentWriteObjectParams extends ParsedDocumentObjectParams {
431
+ readonly body: KnowhereAssetStorageBody;
432
+ readonly contentType: string;
433
+ readonly metadata?: Readonly<Record<string, string>>;
434
+ }
435
+ interface ParsedDocumentWriteObjectResult extends ParsedDocumentObjectParams {
436
+ readonly url?: string;
437
+ }
438
+ type ParsedDocumentCommitSource = 'resultZip' | 'remoteReconstruction';
439
+ interface ParsedDocumentCommit {
440
+ readonly version: 1;
441
+ readonly documentId: string;
442
+ readonly revisionKey: string;
443
+ readonly source: ParsedDocumentCommitSource;
444
+ readonly committedAt: string;
445
+ }
446
+ interface ParsedDocumentSyncProgress {
447
+ readonly documentId: string;
448
+ readonly revisionKey: string;
449
+ readonly nextChunkPage?: number;
450
+ readonly status: 'running' | 'completed' | 'failed';
451
+ readonly updatedAt: string;
452
+ readonly error?: string;
453
+ }
454
+ interface ParsedDocumentStorage {
455
+ readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
456
+ writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
457
+ headObject?(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
458
+ getObjectUrl?(params: ParsedDocumentObjectParams): Promise<string | null>;
459
+ deletePrefix?(params: ParsedDocumentRevisionParams): Promise<void>;
460
+ readSyncProgress(params: ParsedDocumentRevisionParams): Promise<ParsedDocumentSyncProgress | null>;
461
+ writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
462
+ }
463
+ interface ParsedDocumentSyncScheduler {
464
+ schedule(task: () => Promise<void>): void | Promise<void>;
465
+ }
466
+ interface ParsedDocumentStorageLimits {
467
+ readonly remotePageSize?: number;
468
+ readonly maxPagesPerSync?: number;
469
+ readonly syncDeadlineMs?: number;
470
+ readonly grepMaxPages?: number;
471
+ readonly grepDeadlineMs?: number;
472
+ readonly outlineMaxPages?: number;
473
+ readonly outlineDeadlineMs?: number;
474
+ }
475
+ interface ParsedDocumentStorageConfig {
476
+ readonly storage: ParsedDocumentStorage;
477
+ readonly scheduler?: ParsedDocumentSyncScheduler;
478
+ readonly limits?: ParsedDocumentStorageLimits;
479
+ }
480
+
481
+ /**
482
+ * Parsing model options
483
+ */
484
+ type ParsingModel = 'base' | 'advanced';
485
+ /**
486
+ * Document type options
487
+ */
488
+ type DocType = 'auto' | 'pdf' | 'docx' | 'txt' | 'md';
489
+ /**
490
+ * Parsing configuration parameters
491
+ */
492
+ interface ParsingParams {
493
+ /** Parsing model to use (default: 'base') */
494
+ model?: ParsingModel;
495
+ /** Enable OCR for scanned documents (default: false) */
496
+ ocrEnabled?: boolean;
497
+ /** Knowledge base directory */
498
+ kbDir?: string;
499
+ /** Document type hint (default: 'auto') */
500
+ docType?: DocType;
501
+ /** Enable smart title parsing (default: false) */
502
+ smartTitleParse?: boolean;
503
+ /** Generate image summaries (default: false) */
504
+ summaryImage?: boolean;
505
+ /** Generate table summaries (default: false) */
506
+ summaryTable?: boolean;
507
+ /** Generate text summaries (default: false) */
508
+ summaryTxt?: boolean;
509
+ /** Additional fragment description */
510
+ addFragDesc?: string;
511
+ }
512
+ /**
513
+ * Webhook configuration
514
+ */
515
+ interface WebhookConfig {
516
+ /** Webhook URL to notify on job completion */
517
+ url: string;
518
+ }
519
+ /**
520
+ * Client-provided display metadata copied onto the published document.
521
+ */
522
+ type DocumentMetadata = Record<string, unknown>;
523
+ /**
524
+ * Job creation parameters
525
+ */
526
+ interface CreateJobParams {
527
+ /** Source type: 'file' for upload, 'url' for remote document */
528
+ sourceType: 'file' | 'url';
529
+ /** Source URL (required if sourceType is 'url') */
530
+ sourceUrl?: string;
531
+ /** File name (required if sourceType is 'file') */
532
+ fileName?: string;
533
+ /** Optional custom data identifier */
534
+ dataId?: string;
535
+ /** Retrieval namespace for the canonical document */
536
+ namespace?: string;
537
+ /** Existing document identifier when updating a published document */
538
+ documentId?: string;
539
+ /** Display metadata to copy onto the published document */
540
+ documentMetadata?: DocumentMetadata;
541
+ /** Parsing configuration */
542
+ parsingParams?: ParsingParams;
543
+ /** Webhook configuration */
544
+ webhook?: WebhookConfig;
545
+ }
546
+ /**
547
+ * File upload parameters
548
+ */
549
+ interface UploadParams {
550
+ /** File to upload (path, Buffer, Stream, or Uint8Array) */
551
+ file: string | Buffer | ReadStream | Uint8Array;
552
+ /** Upload progress callback */
553
+ onProgress?: (progress: UploadProgress) => void;
554
+ /** Abort signal for cancellation */
555
+ signal?: AbortSignal;
556
+ }
557
+ /**
558
+ * Wait options for polling
559
+ */
560
+ interface WaitOptions {
561
+ /** Polling interval in milliseconds (default: 10000) */
562
+ pollInterval?: number;
563
+ /** Maximum wait time in milliseconds (default: 1800000 = 30 minutes) */
564
+ pollTimeout?: number;
565
+ /** Progress callback */
566
+ onProgress?: (status: PollProgress) => void;
567
+ /** Abort signal for cancellation */
568
+ signal?: AbortSignal;
569
+ }
570
+ /**
571
+ * Load options for result parsing
572
+ */
573
+ interface LoadOptions {
574
+ /** Whether to verify ZIP checksum (default: true) */
575
+ verifyChecksum?: boolean;
576
+ }
577
+ /**
578
+ * High-level parse parameters
579
+ */
580
+ interface ParseParams {
581
+ /** Source URL (mutually exclusive with file) */
582
+ url?: string;
583
+ /** File to parse (path, Buffer, Stream, or Uint8Array) */
584
+ file?: string | Buffer | ReadStream | Uint8Array;
585
+ /** File name (auto-inferred for file paths and fs.ReadStream with a path) */
586
+ fileName?: string;
587
+ /** Parsing model (default: 'base') */
588
+ model?: ParsingModel;
589
+ /** Enable OCR (default: false) */
590
+ ocr?: boolean;
591
+ /** Document type hint */
592
+ docType?: DocType;
593
+ /** Enable smart title parsing */
594
+ smartTitleParse?: boolean;
595
+ /** Generate image summaries */
596
+ summaryImage?: boolean;
597
+ /** Generate table summaries */
598
+ summaryTable?: boolean;
599
+ /** Generate text summaries */
600
+ summaryTxt?: boolean;
601
+ /** Custom data identifier */
602
+ dataId?: string;
603
+ /** Retrieval namespace for the canonical document */
604
+ namespace?: string;
605
+ /** Existing document identifier when updating a published document */
606
+ documentId?: string;
607
+ /** Display metadata to copy onto the published document */
608
+ documentMetadata?: DocumentMetadata;
609
+ /** Additional fragment description */
610
+ addFragDesc?: string;
611
+ /** Knowledge base directory */
612
+ kbDir?: string;
613
+ /** Polling interval in milliseconds */
614
+ pollInterval?: number;
615
+ /** Maximum wait time in milliseconds */
616
+ pollTimeout?: number;
617
+ /** Whether to verify ZIP checksum (default: true) */
618
+ verifyChecksum?: boolean;
619
+ /**
620
+ * Optional asset storage adapter used to copy parsed media and page citation
621
+ * assets into application-owned storage before the result is returned.
622
+ */
623
+ storageAdapter?: KnowhereAssetStorageOptions;
624
+ /** Webhook configuration */
625
+ webhook?: WebhookConfig;
626
+ /** Upload progress callback */
627
+ onUploadProgress?: (progress: UploadProgress) => void;
628
+ /** Poll progress callback */
629
+ onPollProgress?: (status: PollProgress) => void;
630
+ /** Abort signal */
631
+ signal?: AbortSignal;
632
+ }
633
+ /**
634
+ * Upload progress information
635
+ */
636
+ interface UploadProgress {
637
+ /** Bytes uploaded */
638
+ loaded: number;
639
+ /** Total bytes (may be undefined for streams) */
640
+ total?: number;
641
+ /** Upload percentage (0-100) */
642
+ percent: number;
643
+ }
644
+ /**
645
+ * Polling progress information
646
+ */
647
+ interface PollProgress {
648
+ /** Current job status */
649
+ status: JobStatus;
650
+ /** Elapsed time in seconds */
651
+ elapsedSeconds: number;
652
+ /** Current job result */
653
+ jobResult: JobResult;
654
+ }
655
+
547
656
  interface HttpClientOptions {
548
657
  baseURL: string;
549
658
  apiKey?: string;
@@ -894,14 +1003,14 @@ interface DocumentChunkListParams {
894
1003
  pageSize?: number;
895
1004
  /** Optional chunk type filter */
896
1005
  chunkType?: DocumentChunkType;
897
- /** Set true to include 7-day asset URLs for media chunks */
1006
+ /** Set true to include 7-day asset URLs for media and page citation assets */
898
1007
  includeAssetUrls?: boolean;
899
1008
  }
900
1009
  /**
901
1010
  * Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
902
1011
  */
903
1012
  interface DocumentChunkGetParams {
904
- /** Set true to include 7-day asset URLs for media chunks */
1013
+ /** Set true to include 7-day asset URLs for media and page citation assets */
905
1014
  includeAssetUrls?: boolean;
906
1015
  }
907
1016
  /**
@@ -930,11 +1039,25 @@ interface DocumentChunk {
930
1039
  sortOrder: number;
931
1040
  /** Chunk metadata returned by the API */
932
1041
  metadata: Record<string, unknown>;
933
- /** 7-day asset URL for media chunks when available */
1042
+ /** 7-day asset URL for media or page citation assets when available */
934
1043
  assetUrl?: string | null;
935
1044
  /** Chunk creation timestamp */
936
1045
  createdAt?: Date;
937
1046
  }
1047
+ /**
1048
+ * Response from GET /v2/documents/{document_id}/files/page-citation-source.
1049
+ */
1050
+ interface DocumentPageCitationSource {
1051
+ documentId: string;
1052
+ namespace?: string;
1053
+ jobId?: string;
1054
+ jobResultId?: string;
1055
+ variant?: string;
1056
+ fileName: string;
1057
+ contentType: string;
1058
+ url: string;
1059
+ expiresAt?: Date;
1060
+ }
938
1061
  /**
939
1062
  * Response from GET /v2/documents/{document_id}/chunks.
940
1063
  */
@@ -988,6 +1111,10 @@ declare class Documents extends BaseResource {
988
1111
  * Get one current-revision chunk for one canonical document.
989
1112
  */
990
1113
  getChunk(documentId: string, documentChunkId: string, params?: DocumentChunkGetParams): Promise<DocumentChunkResponse>;
1114
+ /**
1115
+ * Get a signed normalized source-file URL for compatibility and debugging.
1116
+ */
1117
+ getPageCitationSource(documentId: string): Promise<DocumentPageCitationSource>;
991
1118
  /**
992
1119
  * Archive one canonical document by ID.
993
1120
  */
@@ -998,6 +1125,18 @@ declare class Documents extends BaseResource {
998
1125
  private createChunkGetRequestConfig;
999
1126
  }
1000
1127
 
1128
+ type PageCitationAssetContentType = 'image/png' | 'image/jpeg';
1129
+ type PageCitationAssetSource = 'knowhere-rendered-page-citation-source';
1130
+ interface PageCitationAsset {
1131
+ pageNum: number;
1132
+ artifactRef: string;
1133
+ assetUrl?: string;
1134
+ contentType: PageCitationAssetContentType;
1135
+ width?: number;
1136
+ height?: number;
1137
+ source: PageCitationAssetSource;
1138
+ }
1139
+
1001
1140
  type KnowledgeChunkType = DocumentChunkType;
1002
1141
  interface KnowledgeParseParams extends ParseParams {
1003
1142
  /** Optional stable local identifier for this parsed result copy. */
@@ -1028,6 +1167,7 @@ interface LocalKnowledgeDocument {
1028
1167
  interface LocalKnowledgeParseResponse {
1029
1168
  document: LocalKnowledgeDocument;
1030
1169
  result: ParseResult;
1170
+ assetUrlsByFilePath?: Readonly<Record<string, string>>;
1031
1171
  }
1032
1172
  interface KnowledgeAsyncParseParams extends ParseParams {
1033
1173
  /** Optional stable local identifier to use when this job result is cached later. */
@@ -1052,11 +1192,20 @@ interface KnowledgeStartupRecoveryResponse {
1052
1192
  checkedJobs: number;
1053
1193
  results: KnowledgeAsyncJobStatusResponse[];
1054
1194
  }
1055
- interface KnowledgeCacheJobResultParams {
1195
+ interface KnowledgeLoadJobResultParams {
1056
1196
  jobId: string;
1057
- localDocumentId?: string;
1058
1197
  verifyChecksum?: boolean;
1198
+ storageAdapter?: KnowhereAssetStorageOptions;
1059
1199
  }
1200
+ interface KnowledgeImportJobResultParams extends KnowledgeLoadJobResultParams {
1201
+ localDocumentId?: string;
1202
+ }
1203
+ interface KnowledgeJobResultResponse {
1204
+ result: ParseResult;
1205
+ assetUrlsByFilePath?: Readonly<Record<string, string>>;
1206
+ }
1207
+ /** @deprecated Use KnowledgeImportJobResultParams with importJobResult instead. */
1208
+ type KnowledgeCacheJobResultParams = KnowledgeImportJobResultParams;
1060
1209
  interface KnowledgeCacheDocumentParams {
1061
1210
  /** Canonical Knowhere document identifier from published retrieval results. */
1062
1211
  documentId: string;
@@ -1070,6 +1219,16 @@ interface KnowledgeDocumentReference {
1070
1219
  documentId?: string;
1071
1220
  /** Server parse job identifier whose completed result should be cached before reading. */
1072
1221
  jobId?: string;
1222
+ /** Current parsed revision key when the caller already has it. */
1223
+ revisionKey?: string;
1224
+ }
1225
+ type KnowledgeParsedStorageOptions = ParsedDocumentStorageConfig;
1226
+ type KnowledgeSyncParsedDocumentParams = KnowledgeDocumentReference;
1227
+ interface KnowledgeSyncParsedDocumentResponse {
1228
+ documentId: string;
1229
+ revisionKey: string;
1230
+ completed: boolean;
1231
+ commit?: ParsedDocumentCommit;
1073
1232
  }
1074
1233
  interface KnowledgeSection {
1075
1234
  sectionPath: string;
@@ -1088,8 +1247,12 @@ interface KnowledgeOutline {
1088
1247
  typeCounts: Record<KnowledgeChunkType, number>;
1089
1248
  sections: KnowledgeSection[];
1090
1249
  sectionTree: KnowledgeSection[];
1250
+ truncated?: boolean;
1251
+ continuationCursor?: string;
1091
1252
  }
1092
1253
  interface KnowledgeReadParams extends KnowledgeDocumentReference {
1254
+ page?: number;
1255
+ pageSize?: number;
1093
1256
  sectionPath?: string;
1094
1257
  startChunk?: number;
1095
1258
  endChunk?: number;
@@ -1109,6 +1272,7 @@ interface KnowledgeReadChunk {
1109
1272
  sectionPath: string;
1110
1273
  sourceChunkPath: string;
1111
1274
  filePath?: string;
1275
+ assetUrl?: string;
1112
1276
  pageNumbers?: number[];
1113
1277
  metadata: Record<string, unknown>;
1114
1278
  }
@@ -1116,9 +1280,14 @@ interface KnowledgeReadResponse {
1116
1280
  document: LocalKnowledgeDocument;
1117
1281
  chunks: KnowledgeReadChunk[];
1118
1282
  nextChunk?: number;
1283
+ page?: number;
1284
+ pageSize?: number;
1285
+ totalChunks?: number;
1286
+ totalPages?: number;
1119
1287
  }
1120
1288
  interface KnowledgeGrepParams extends KnowledgeDocumentReference {
1121
1289
  pattern: string;
1290
+ continuationCursor?: string;
1122
1291
  isRegex?: boolean;
1123
1292
  isCaseSensitive?: boolean;
1124
1293
  maxResults?: number;
@@ -1142,6 +1311,7 @@ interface KnowledgeGrepResponse {
1142
1311
  matches: KnowledgeGrepMatch[];
1143
1312
  scannedChunks: number;
1144
1313
  truncated: boolean;
1314
+ continuationCursor?: string;
1145
1315
  }
1146
1316
  interface KnowledgeSearchParams {
1147
1317
  query: string;
@@ -1180,15 +1350,27 @@ interface KnowledgeSearchResult {
1180
1350
  declare class Knowledge {
1181
1351
  private readonly client;
1182
1352
  private readonly store;
1353
+ private readonly cacheDirectory;
1354
+ private readonly parsedStorageConfig;
1183
1355
  constructor(client: Knowhere, options?: {
1184
1356
  cacheDirectory?: string;
1357
+ parsedStorage?: ParsedDocumentStorageConfig;
1185
1358
  });
1186
1359
  withCacheDirectory(cacheDirectory: string): Knowledge;
1360
+ withParsedStorage(parsedStorage: KnowledgeParsedStorageOptions): Knowledge;
1361
+ parseToLocalCache(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
1362
+ /** @deprecated Use parseToLocalCache for local cache imports or the top-level client.parse for server-safe parsing. */
1187
1363
  parse(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
1188
1364
  startParse(params: KnowledgeAsyncParseParams): Promise<KnowledgeAsyncParseResponse>;
1189
1365
  getJobStatus(jobId: string): Promise<KnowledgeAsyncJobStatusResponse>;
1190
1366
  recoverPendingAsyncParseJobs(): Promise<KnowledgeStartupRecoveryResponse>;
1367
+ loadJobResult(params: KnowledgeLoadJobResultParams): Promise<KnowledgeJobResultResponse>;
1368
+ importJobResult(params: KnowledgeImportJobResultParams): Promise<LocalKnowledgeParseResponse>;
1369
+ /** @deprecated Use importJobResult for local cache imports or loadJobResult for server-safe loads. */
1191
1370
  cacheJobResult(params: KnowledgeCacheJobResultParams): Promise<LocalKnowledgeParseResponse>;
1371
+ syncParsedDocument(params: KnowledgeSyncParsedDocumentParams): Promise<KnowledgeSyncParsedDocumentResponse>;
1372
+ private syncParseResultToConfiguredStorage;
1373
+ private parseWithoutClientStorageAdapter;
1192
1374
  cacheDocument(params: KnowledgeCacheDocumentParams): Promise<LocalKnowledgeParseResponse>;
1193
1375
  private resolveAsyncCache;
1194
1376
  listDocuments(): Promise<LocalKnowledgeDocument[]>;
@@ -1198,6 +1380,19 @@ declare class Knowledge {
1198
1380
  search(params: KnowledgeSearchParams): Promise<KnowledgeSearchResponse>;
1199
1381
  private resolveSearchDocuments;
1200
1382
  private loadReadableResult;
1383
+ private readRemoteDocumentChunks;
1384
+ private scanRemoteDocumentChunks;
1385
+ private grepRemoteDocumentChunks;
1386
+ private getRemoteDocumentOutline;
1387
+ private tryReadChunksFromParsedStorage;
1388
+ private tryGrepChunksFromParsedStorage;
1389
+ private tryReadOutlineFromParsedStorage;
1390
+ private readCommittedParsedStorageResult;
1391
+ private scheduleParsedStorageSync;
1392
+ private syncRemoteDocumentToParsedStorage;
1393
+ private syncRemoteDocumentChunksToParsedStorage;
1394
+ private readRemoteReconstructionChunks;
1395
+ private requireParsedStorageConfig;
1201
1396
  private findLocalDocumentByRemoteId;
1202
1397
  private getPublishedDocumentJobId;
1203
1398
  }
@@ -1295,6 +1490,38 @@ declare class Knowhere {
1295
1490
 
1296
1491
  declare const VERSION = "0.1.0";
1297
1492
 
1493
+ declare function storeParseResultAssets(result: ParseResult, options?: KnowhereAssetStorageOptions): Promise<KnowhereAssetStorageResult>;
1494
+
1495
+ declare class DiskParsedDocumentStorage implements ParsedDocumentStorage {
1496
+ private readonly rootDirectory;
1497
+ constructor(rootDirectory: string);
1498
+ readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
1499
+ writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
1500
+ headObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
1501
+ getObjectUrl(params: ParsedDocumentObjectParams): Promise<string | null>;
1502
+ deletePrefix(params: ParsedDocumentRevisionParams): Promise<void>;
1503
+ readSyncProgress(params: ParsedDocumentRevisionParams): Promise<ParsedDocumentSyncProgress | null>;
1504
+ writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
1505
+ private getObjectPath;
1506
+ private getRevisionDirectory;
1507
+ private readOptionalJson;
1508
+ private readObjectMetadata;
1509
+ private writeObjectMetadata;
1510
+ }
1511
+
1512
+ declare function syncParseResultToParsedDocumentStorage(params: {
1513
+ readonly result: ParseResult;
1514
+ readonly storage: ParsedDocumentStorage;
1515
+ readonly documentId?: string;
1516
+ readonly revisionKey?: string;
1517
+ readonly source?: ParsedDocumentCommitSource;
1518
+ }): Promise<{
1519
+ readonly result: ParseResult;
1520
+ readonly documentId: string;
1521
+ readonly revisionKey: string;
1522
+ readonly commit: ParsedDocumentCommit;
1523
+ }>;
1524
+
1298
1525
  /**
1299
1526
  * Base error class for all Knowhere SDK errors
1300
1527
  */
@@ -1424,4 +1651,4 @@ declare class JobFailedError extends KnowhereError {
1424
1651
  constructor(message: string, code: string, jobResult: JobResult);
1425
1652
  }
1426
1653
 
1427
- export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, KnowhereError, type KnowhereOptions, Knowledge, type KnowledgeAsyncJobStatusResponse, type KnowledgeAsyncParseParams, type KnowledgeAsyncParseResponse, type KnowledgeCacheDocumentParams, type KnowledgeCacheJobResultParams, type KnowledgeChunkType, type KnowledgeDocumentReference, type KnowledgeGrepMatch, type KnowledgeGrepParams, type KnowledgeGrepResponse, type KnowledgeOutline, type KnowledgeParseParams, type KnowledgeReadChunk, type KnowledgeReadParams, type KnowledgeReadResponse, type KnowledgeSearchParams, type KnowledgeSearchReference, type KnowledgeSearchResponse, type KnowledgeSearchResult, type KnowledgeSection, type KnowledgeStartupRecoveryResponse, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NetworkError, NotFoundError, type PageChunk, type ParseParams, type ParseResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalFilterMode, type RetrievalQueryParams, type RetrievalQueryResponse, type RetrievalReferencedChunk, type RetrievalResult, type RetrievalSectionExclusion, type RetrievalSource, ServiceUnavailableError, type Statistics, type TableChunk, type TextChunk, TimeoutError, type UploadParams, type UploadProgress, VERSION, ValidationError, type WaitOptions, type WebhookConfig, Knowhere as default };
1654
+ export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, DiskParsedDocumentStorage, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, type DocumentPageCitationSource, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, type KnowhereAssetStorageAdapter, type KnowhereAssetStorageBody, type KnowhereAssetStorageHead, type KnowhereAssetStorageObject, type KnowhereAssetStorageOptions, type KnowhereAssetStorageResult, type KnowhereAssetStorageWriteResult, KnowhereError, type KnowhereOptions, Knowledge, type KnowledgeAsyncJobStatusResponse, type KnowledgeAsyncParseParams, type KnowledgeAsyncParseResponse, type KnowledgeCacheDocumentParams, type KnowledgeCacheJobResultParams, type KnowledgeChunkType, type KnowledgeDocumentReference, type KnowledgeGrepMatch, type KnowledgeGrepParams, type KnowledgeGrepResponse, type KnowledgeImportJobResultParams, type KnowledgeJobResultResponse, type KnowledgeLoadJobResultParams, type KnowledgeOutline, type KnowledgeParseParams, type KnowledgeParsedStorageOptions, type KnowledgeReadChunk, type KnowledgeReadParams, type KnowledgeReadResponse, type KnowledgeSearchParams, type KnowledgeSearchReference, type KnowledgeSearchResponse, type KnowledgeSearchResult, type KnowledgeSection, type KnowledgeStartupRecoveryResponse, type KnowledgeSyncParsedDocumentParams, type KnowledgeSyncParsedDocumentResponse, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalFilterMode, type RetrievalQueryParams, type RetrievalQueryResponse, type RetrievalReferencedChunk, type RetrievalResult, type RetrievalSectionExclusion, type RetrievalSource, ServiceUnavailableError, type Statistics, type TableChunk, type TextChunk, TimeoutError, type UploadParams, type UploadProgress, VERSION, ValidationError, type WaitOptions, type WebhookConfig, Knowhere as default, storeParseResultAssets, syncParseResultToParsedDocumentStorage };