@ontos-ai/knowhere-sdk 2.0.0 → 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/dist/index.d.mts 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,65 +315,575 @@ 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 */
489
323
  save(directory: string): Promise<string>;
490
324
  }
491
325
  /**
492
- * Page chunk
326
+ * Page chunk
327
+ */
328
+ interface PageChunk extends BaseChunk {
329
+ type: 'page';
330
+ }
331
+ /**
332
+ * Union type of all chunk types
333
+ */
334
+ type Chunk = TextChunk | ImageChunk | TableChunk | PageChunk;
335
+ /**
336
+ * Complete parse result
337
+ */
338
+ interface ParseResult {
339
+ /** Manifest metadata */
340
+ manifest: Manifest;
341
+ /** All chunks */
342
+ chunks: Chunk[];
343
+ /** Document navigation tree from doc_nav.json (current worker output) */
344
+ docNav?: DocNav;
345
+ /** Full document as Markdown (if available) */
346
+ fullMarkdown?: string;
347
+ /** Raw ZIP buffer */
348
+ rawZip: Buffer;
349
+ /** @deprecated Current worker no longer emits chunks_slim.json */
350
+ chunksSlim?: SlimChunk[];
351
+ /** @deprecated Current worker no longer emits hierarchy.json */
352
+ hierarchy?: unknown;
353
+ /** @deprecated Table-of-contents hierarchy hints (if available) */
354
+ tocHierarchies?: unknown;
355
+ /** @deprecated Knowledge-base CSV export (if available) */
356
+ kbCsv?: string;
357
+ /** @deprecated Pre-rendered hierarchy HTML view (if available) */
358
+ hierarchyViewHtml?: string;
359
+ /** Text chunks only */
360
+ readonly textChunks: TextChunk[];
361
+ /** Image chunks only */
362
+ readonly imageChunks: ImageChunk[];
363
+ /** Table chunks only */
364
+ readonly tableChunks: TableChunk[];
365
+ /** Page chunks only */
366
+ readonly pageChunks: PageChunk[];
367
+ /** Job ID */
368
+ readonly jobId: string;
369
+ /** Effective retrieval namespace when loaded from a job result */
370
+ namespace?: string;
371
+ /** Canonical document identifier when loaded from a job result */
372
+ documentId?: string;
373
+ /** Statistics */
374
+ readonly statistics: Statistics;
375
+ /** Find a specific chunk by ID */
376
+ getChunk(chunkId: string): Chunk | undefined;
377
+ /** Save all results to a directory */
378
+ save(directory: string): Promise<string>;
379
+ }
380
+
381
+ /**
382
+ * Canonical document state returned by document lifecycle endpoints.
383
+ */
384
+ interface Document {
385
+ /** Stable document identifier */
386
+ documentId: string;
387
+ /** Retrieval namespace */
388
+ namespace: string;
389
+ /** Current lifecycle status */
390
+ status: string;
391
+ /** Current published job result identifier */
392
+ currentJobResultId?: string;
393
+ /** Original source file name */
394
+ sourceFileName?: string;
395
+ /** Client-provided display metadata copied from the publishing job */
396
+ documentMetadata?: Record<string, unknown>;
397
+ /** Document creation timestamp */
398
+ createdAt?: Date;
399
+ /** Last update timestamp */
400
+ updatedAt?: Date;
401
+ /** Archive timestamp, when archived */
402
+ archivedAt?: Date;
403
+ }
404
+ /**
405
+ * Pagination metadata returned by document list endpoints.
406
+ */
407
+ interface DocumentListPagination {
408
+ /** Current page number */
409
+ page: number;
410
+ /** Number of items requested per page */
411
+ pageSize: number;
412
+ /** Total matching documents */
413
+ total: number;
414
+ /** Total number of pages */
415
+ totalPages: number;
416
+ }
417
+ /**
418
+ * Query parameters for GET /v2/documents.
419
+ */
420
+ interface DocumentListParams {
421
+ /** Retrieval namespace */
422
+ namespace?: string;
423
+ /** Page number (default: 1) */
424
+ page?: number;
425
+ /** Items per page (default: 50, maximum: 200) */
426
+ pageSize?: number;
427
+ }
428
+ /**
429
+ * Response from GET /v2/documents.
430
+ */
431
+ interface DocumentListResponse {
432
+ /** Namespace listed by the API */
433
+ namespace: string;
434
+ /** Documents visible in the namespace */
435
+ documents: Document[];
436
+ /** Pagination metadata */
437
+ pagination: DocumentListPagination;
438
+ }
439
+ /**
440
+ * Document chunk types supported by document chunk endpoints.
441
+ */
442
+ type DocumentChunkType = 'text' | 'image' | 'table' | 'page';
443
+ /**
444
+ * Pagination metadata returned by chunk list endpoints.
445
+ */
446
+ interface DocumentChunkPagination {
447
+ /** Current page number */
448
+ page: number;
449
+ /** Number of items requested per page */
450
+ pageSize: number;
451
+ /** Total matching chunks */
452
+ total: number;
453
+ /** Total number of pages */
454
+ totalPages: number;
455
+ }
456
+ /**
457
+ * Query parameters for GET /v2/documents/{document_id}/chunks.
458
+ */
459
+ interface DocumentChunkListParams {
460
+ /** Page number (default: 1) */
461
+ page?: number;
462
+ /** Items per page (default: 50, maximum: 200) */
463
+ pageSize?: number;
464
+ /** Optional chunk type filter */
465
+ chunkType?: DocumentChunkType;
466
+ /** Set true to include 7-day asset URLs for media and page citation assets */
467
+ includeAssetUrls?: boolean;
468
+ }
469
+ /**
470
+ * Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
471
+ */
472
+ interface DocumentChunkGetParams {
473
+ /** Set true to include 7-day asset URLs for media and page citation assets */
474
+ includeAssetUrls?: boolean;
475
+ }
476
+ /**
477
+ * One current-revision document chunk.
478
+ */
479
+ interface DocumentChunk {
480
+ /** Stable document chunk row identifier */
481
+ id: string;
482
+ /** Parser-provided chunk identifier */
483
+ chunkId: string;
484
+ /** Chunk content type */
485
+ chunkType: DocumentChunkType;
486
+ /** Content source marker. Page chunks normally expose summaries as content. */
487
+ contentSource?: string | null;
488
+ /** Chunk text or generated summary content */
489
+ content?: string | null;
490
+ /** Parent section identifier */
491
+ sectionId?: string | null;
492
+ /** Parent section path */
493
+ sectionPath?: string | null;
494
+ /** Source path from the parser output */
495
+ sourceChunkPath?: string | null;
496
+ /** Generated artifact file path for media chunks */
497
+ filePath?: string | null;
498
+ /** Sort order within the document revision */
499
+ sortOrder: number;
500
+ /** Chunk metadata returned by the API */
501
+ metadata: Record<string, unknown>;
502
+ /** 7-day asset URL for media or page citation assets when available */
503
+ assetUrl?: string | null;
504
+ /** Chunk creation timestamp */
505
+ createdAt?: Date;
506
+ }
507
+ /**
508
+ * Response from GET /v2/documents/{document_id}/files/page-citation-source.
509
+ */
510
+ interface DocumentPageCitationSource {
511
+ documentId: string;
512
+ namespace?: string;
513
+ jobId?: string;
514
+ jobResultId?: string;
515
+ variant?: string;
516
+ fileName: string;
517
+ contentType: string;
518
+ url: string;
519
+ expiresAt?: Date;
520
+ }
521
+ /**
522
+ * Response from GET /v2/documents/{document_id}/chunks.
523
+ */
524
+ interface DocumentChunkListResponse {
525
+ /** Stable document identifier */
526
+ documentId: string;
527
+ /** Retrieval namespace */
528
+ namespace: string;
529
+ /** Current published job result identifier */
530
+ jobResultId?: string | null;
531
+ /** Current published job identifier */
532
+ jobId?: string | null;
533
+ /** Current-revision chunks */
534
+ chunks: DocumentChunk[];
535
+ /** Pagination metadata */
536
+ pagination: DocumentChunkPagination;
537
+ }
538
+ /**
539
+ * Response from GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
540
+ */
541
+ interface DocumentChunkResponse {
542
+ /** Stable document identifier */
543
+ documentId: string;
544
+ /** Retrieval namespace */
545
+ namespace: string;
546
+ /** Current published job result identifier */
547
+ jobResultId?: string | null;
548
+ /** Current published job identifier */
549
+ jobId?: string | null;
550
+ /** Requested current-revision chunk */
551
+ chunk: DocumentChunk;
552
+ }
553
+
554
+ type KnowhereAssetStorageBody = Uint8Array;
555
+ interface KnowhereAssetStorageObject {
556
+ readonly key: string;
557
+ readonly body: KnowhereAssetStorageBody;
558
+ readonly contentType: string;
559
+ readonly metadata?: Readonly<Record<string, string>>;
560
+ }
561
+ interface KnowhereAssetStorageHead {
562
+ readonly key: string;
563
+ readonly contentType?: string;
564
+ readonly contentLength?: number;
565
+ readonly metadata?: Readonly<Record<string, string>>;
566
+ readonly url?: string;
567
+ }
568
+ interface KnowhereAssetStorageWriteResult {
569
+ readonly key: string;
570
+ readonly url?: string;
571
+ }
572
+ interface KnowhereAssetStorageAdapter {
573
+ writeObject(input: KnowhereAssetStorageObject): Promise<KnowhereAssetStorageWriteResult>;
574
+ headObject?(key: string): Promise<KnowhereAssetStorageHead | null>;
575
+ getObjectUrl?(key: string): Promise<string | null>;
576
+ }
577
+ interface KnowhereAssetStorageOptions {
578
+ readonly adapter: KnowhereAssetStorageAdapter;
579
+ readonly keyPrefix: string;
580
+ readonly skipExisting?: boolean;
581
+ readonly chunkPageSize?: number;
582
+ readonly revisionKey?: string;
583
+ }
584
+ interface KnowhereParsedSnapshotChunk {
585
+ readonly id: string;
586
+ readonly chunkId: string;
587
+ readonly chunkType: string;
588
+ readonly contentSource?: string;
589
+ readonly content: string;
590
+ readonly sectionPath?: string;
591
+ readonly sourceChunkPath: string;
592
+ readonly filePath?: string;
593
+ readonly sortOrder: number;
594
+ readonly metadata: Record<string, unknown>;
595
+ readonly assetUrl?: string;
596
+ }
597
+ interface KnowhereParsedSnapshotChunkPage {
598
+ readonly version: 1;
599
+ readonly jobId: string;
600
+ readonly revisionKey?: string;
601
+ readonly documentId?: string;
602
+ readonly namespace?: string;
603
+ readonly sourceFileName: string;
604
+ readonly page: number;
605
+ readonly pageSize: number;
606
+ readonly total: number;
607
+ readonly totalPages: number;
608
+ readonly chunks: readonly KnowhereParsedSnapshotChunk[];
609
+ }
610
+ interface KnowhereParsedSnapshotChunkPageReference {
611
+ readonly page: number;
612
+ readonly pageSize: number;
613
+ readonly chunkCount: number;
614
+ readonly key: string;
615
+ readonly url?: string;
616
+ }
617
+ interface KnowhereParsedSnapshotManifest {
618
+ readonly version: 1;
619
+ readonly kind: 'knowhere-parsed-result-snapshot';
620
+ readonly jobId: string;
621
+ readonly revisionKey?: string;
622
+ readonly documentId?: string;
623
+ readonly namespace?: string;
624
+ readonly sourceFileName: string;
625
+ readonly totalChunks: number;
626
+ readonly typeCounts?: Readonly<Partial<Record<DocumentChunkType, number>>>;
627
+ readonly chunkPageSize: number;
628
+ readonly chunkPages: readonly KnowhereParsedSnapshotChunkPageReference[];
629
+ readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
630
+ readonly createdAt: string;
631
+ }
632
+ interface KnowhereParsedSnapshot {
633
+ readonly manifest: KnowhereParsedSnapshotManifest;
634
+ readonly manifestKey: string;
635
+ readonly manifestUrl?: string;
636
+ readonly indexKey: string;
637
+ readonly indexUrl?: string;
638
+ readonly chunkPageUrlsByPage: Readonly<Record<number, string>>;
639
+ }
640
+ interface KnowhereAssetStorageResult {
641
+ readonly result: ParseResult;
642
+ readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
643
+ readonly snapshot?: KnowhereParsedSnapshot;
644
+ }
645
+ type ParsedDocumentAssetUrlPolicy = 'none' | 'durable';
646
+ interface ParsedDocumentStorageDocument {
647
+ readonly documentId: string;
648
+ readonly revisionKey: string;
649
+ }
650
+ type ParsedDocumentStorageManifestParams = ParsedDocumentStorageDocument;
651
+ interface ParsedDocumentStorageChunkPageParams extends ParsedDocumentStorageDocument {
652
+ readonly page: number;
653
+ readonly chunkType?: DocumentChunkType;
654
+ }
655
+ interface ParsedDocumentStorageAsset {
656
+ readonly sourcePath: string;
657
+ readonly body: KnowhereAssetStorageBody;
658
+ readonly contentType: string;
659
+ readonly metadata?: Readonly<Record<string, string>>;
660
+ }
661
+ interface ParsedDocumentStorageAssetParams extends ParsedDocumentStorageDocument {
662
+ readonly sourcePath: string;
663
+ }
664
+ interface ParsedDocumentSyncProgress {
665
+ readonly documentId: string;
666
+ readonly revisionKey: string;
667
+ readonly nextChunkPage: number;
668
+ readonly nextAssetIndex: number;
669
+ readonly status: 'running' | 'completed' | 'failed';
670
+ readonly updatedAt: string;
671
+ readonly error?: string;
672
+ }
673
+ interface ParsedDocumentStorage {
674
+ readManifest(params: ParsedDocumentStorageManifestParams): Promise<KnowhereParsedSnapshotManifest | null>;
675
+ writeManifest(params: {
676
+ readonly documentId: string;
677
+ readonly revisionKey: string;
678
+ readonly manifest: KnowhereParsedSnapshotManifest;
679
+ }): Promise<void>;
680
+ readChunkPage(params: ParsedDocumentStorageChunkPageParams): Promise<KnowhereParsedSnapshotChunkPage | null>;
681
+ writeChunkPage(params: {
682
+ readonly documentId: string;
683
+ readonly revisionKey: string;
684
+ readonly page: KnowhereParsedSnapshotChunkPage;
685
+ }): Promise<void>;
686
+ writeAsset(params: ParsedDocumentStorageDocument & ParsedDocumentStorageAsset): Promise<{
687
+ readonly sourcePath: string;
688
+ readonly url?: string;
689
+ }>;
690
+ getAssetUrl(params: ParsedDocumentStorageAssetParams): Promise<string | null>;
691
+ readSyncProgress(params: ParsedDocumentStorageDocument): Promise<ParsedDocumentSyncProgress | null>;
692
+ writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
693
+ }
694
+ interface ParsedDocumentSyncScheduler {
695
+ schedule(task: () => Promise<void>): void | Promise<void>;
696
+ }
697
+ interface ParsedDocumentStorageLimits {
698
+ readonly chunkPageSize?: number;
699
+ readonly remotePageSize?: number;
700
+ readonly maxPagesPerSync?: number;
701
+ readonly maxAssetsPerSync?: number;
702
+ readonly syncDeadlineMs?: number;
703
+ readonly grepMaxPages?: number;
704
+ readonly grepDeadlineMs?: number;
705
+ readonly outlineMaxPages?: number;
706
+ readonly outlineDeadlineMs?: number;
707
+ }
708
+ interface ParsedDocumentStorageConfig {
709
+ readonly storage: ParsedDocumentStorage;
710
+ readonly scheduler?: ParsedDocumentSyncScheduler;
711
+ readonly limits?: ParsedDocumentStorageLimits;
712
+ }
713
+
714
+ /**
715
+ * Parsing model options
716
+ */
717
+ type ParsingModel = 'base' | 'advanced';
718
+ /**
719
+ * Document type options
720
+ */
721
+ type DocType = 'auto' | 'pdf' | 'docx' | 'txt' | 'md';
722
+ /**
723
+ * Parsing configuration parameters
724
+ */
725
+ interface ParsingParams {
726
+ /** Parsing model to use (default: 'base') */
727
+ model?: ParsingModel;
728
+ /** Enable OCR for scanned documents (default: false) */
729
+ ocrEnabled?: boolean;
730
+ /** Knowledge base directory */
731
+ kbDir?: string;
732
+ /** Document type hint (default: 'auto') */
733
+ docType?: DocType;
734
+ /** Enable smart title parsing (default: false) */
735
+ smartTitleParse?: boolean;
736
+ /** Generate image summaries (default: false) */
737
+ summaryImage?: boolean;
738
+ /** Generate table summaries (default: false) */
739
+ summaryTable?: boolean;
740
+ /** Generate text summaries (default: false) */
741
+ summaryTxt?: boolean;
742
+ /** Additional fragment description */
743
+ addFragDesc?: string;
744
+ }
745
+ /**
746
+ * Webhook configuration
747
+ */
748
+ interface WebhookConfig {
749
+ /** Webhook URL to notify on job completion */
750
+ url: string;
751
+ }
752
+ /**
753
+ * Client-provided display metadata copied onto the published document.
754
+ */
755
+ type DocumentMetadata = Record<string, unknown>;
756
+ /**
757
+ * Job creation parameters
758
+ */
759
+ interface CreateJobParams {
760
+ /** Source type: 'file' for upload, 'url' for remote document */
761
+ sourceType: 'file' | 'url';
762
+ /** Source URL (required if sourceType is 'url') */
763
+ sourceUrl?: string;
764
+ /** File name (required if sourceType is 'file') */
765
+ fileName?: string;
766
+ /** Optional custom data identifier */
767
+ dataId?: string;
768
+ /** Retrieval namespace for the canonical document */
769
+ namespace?: string;
770
+ /** Existing document identifier when updating a published document */
771
+ documentId?: string;
772
+ /** Display metadata to copy onto the published document */
773
+ documentMetadata?: DocumentMetadata;
774
+ /** Parsing configuration */
775
+ parsingParams?: ParsingParams;
776
+ /** Webhook configuration */
777
+ webhook?: WebhookConfig;
778
+ }
779
+ /**
780
+ * File upload parameters
781
+ */
782
+ interface UploadParams {
783
+ /** File to upload (path, Buffer, Stream, or Uint8Array) */
784
+ file: string | Buffer | ReadStream | Uint8Array;
785
+ /** Upload progress callback */
786
+ onProgress?: (progress: UploadProgress) => void;
787
+ /** Abort signal for cancellation */
788
+ signal?: AbortSignal;
789
+ }
790
+ /**
791
+ * Wait options for polling
792
+ */
793
+ interface WaitOptions {
794
+ /** Polling interval in milliseconds (default: 10000) */
795
+ pollInterval?: number;
796
+ /** Maximum wait time in milliseconds (default: 1800000 = 30 minutes) */
797
+ pollTimeout?: number;
798
+ /** Progress callback */
799
+ onProgress?: (status: PollProgress) => void;
800
+ /** Abort signal for cancellation */
801
+ signal?: AbortSignal;
802
+ }
803
+ /**
804
+ * Load options for result parsing
805
+ */
806
+ interface LoadOptions {
807
+ /** Whether to verify ZIP checksum (default: true) */
808
+ verifyChecksum?: boolean;
809
+ }
810
+ /**
811
+ * High-level parse parameters
812
+ */
813
+ interface ParseParams {
814
+ /** Source URL (mutually exclusive with file) */
815
+ url?: string;
816
+ /** File to parse (path, Buffer, Stream, or Uint8Array) */
817
+ file?: string | Buffer | ReadStream | Uint8Array;
818
+ /** File name (auto-inferred for file paths and fs.ReadStream with a path) */
819
+ fileName?: string;
820
+ /** Parsing model (default: 'base') */
821
+ model?: ParsingModel;
822
+ /** Enable OCR (default: false) */
823
+ ocr?: boolean;
824
+ /** Document type hint */
825
+ docType?: DocType;
826
+ /** Enable smart title parsing */
827
+ smartTitleParse?: boolean;
828
+ /** Generate image summaries */
829
+ summaryImage?: boolean;
830
+ /** Generate table summaries */
831
+ summaryTable?: boolean;
832
+ /** Generate text summaries */
833
+ summaryTxt?: boolean;
834
+ /** Custom data identifier */
835
+ dataId?: string;
836
+ /** Retrieval namespace for the canonical document */
837
+ namespace?: string;
838
+ /** Existing document identifier when updating a published document */
839
+ documentId?: string;
840
+ /** Display metadata to copy onto the published document */
841
+ documentMetadata?: DocumentMetadata;
842
+ /** Additional fragment description */
843
+ addFragDesc?: string;
844
+ /** Knowledge base directory */
845
+ kbDir?: string;
846
+ /** Polling interval in milliseconds */
847
+ pollInterval?: number;
848
+ /** Maximum wait time in milliseconds */
849
+ pollTimeout?: number;
850
+ /** Whether to verify ZIP checksum (default: true) */
851
+ verifyChecksum?: boolean;
852
+ /**
853
+ * Optional asset storage adapter used to copy parsed media and page citation
854
+ * assets into application-owned storage before the result is returned.
855
+ */
856
+ storageAdapter?: KnowhereAssetStorageOptions;
857
+ /** Webhook configuration */
858
+ webhook?: WebhookConfig;
859
+ /** Upload progress callback */
860
+ onUploadProgress?: (progress: UploadProgress) => void;
861
+ /** Poll progress callback */
862
+ onPollProgress?: (status: PollProgress) => void;
863
+ /** Abort signal */
864
+ signal?: AbortSignal;
865
+ }
866
+ /**
867
+ * Upload progress information
493
868
  */
494
- interface PageChunk extends BaseChunk {
495
- type: 'page';
869
+ interface UploadProgress {
870
+ /** Bytes uploaded */
871
+ loaded: number;
872
+ /** Total bytes (may be undefined for streams) */
873
+ total?: number;
874
+ /** Upload percentage (0-100) */
875
+ percent: number;
496
876
  }
497
877
  /**
498
- * Union type of all chunk types
499
- */
500
- type Chunk = TextChunk | ImageChunk | TableChunk | PageChunk;
501
- /**
502
- * Complete parse result
878
+ * Polling progress information
503
879
  */
504
- interface ParseResult {
505
- /** Manifest metadata */
506
- manifest: Manifest;
507
- /** All chunks */
508
- chunks: Chunk[];
509
- /** Document navigation tree from doc_nav.json (current worker output) */
510
- docNav?: DocNav;
511
- /** Full document as Markdown (if available) */
512
- fullMarkdown?: string;
513
- /** Raw ZIP buffer */
514
- rawZip: Buffer;
515
- /** @deprecated Current worker no longer emits chunks_slim.json */
516
- chunksSlim?: SlimChunk[];
517
- /** @deprecated Current worker no longer emits hierarchy.json */
518
- hierarchy?: unknown;
519
- /** @deprecated Table-of-contents hierarchy hints (if available) */
520
- tocHierarchies?: unknown;
521
- /** @deprecated Knowledge-base CSV export (if available) */
522
- kbCsv?: string;
523
- /** @deprecated Pre-rendered hierarchy HTML view (if available) */
524
- hierarchyViewHtml?: string;
525
- /** Text chunks only */
526
- readonly textChunks: TextChunk[];
527
- /** Image chunks only */
528
- readonly imageChunks: ImageChunk[];
529
- /** Table chunks only */
530
- readonly tableChunks: TableChunk[];
531
- /** Page chunks only */
532
- readonly pageChunks: PageChunk[];
533
- /** Job ID */
534
- readonly jobId: string;
535
- /** Effective retrieval namespace when loaded from a job result */
536
- namespace?: string;
537
- /** Canonical document identifier when loaded from a job result */
538
- documentId?: string;
539
- /** Statistics */
540
- readonly statistics: Statistics;
541
- /** Find a specific chunk by ID */
542
- getChunk(chunkId: string): Chunk | undefined;
543
- /** Save all results to a directory */
544
- save(directory: string): Promise<string>;
880
+ interface PollProgress {
881
+ /** Current job status */
882
+ status: JobStatus;
883
+ /** Elapsed time in seconds */
884
+ elapsedSeconds: number;
885
+ /** Current job result */
886
+ jobResult: JobResult;
545
887
  }
546
888
 
547
889
  interface HttpClientOptions {
@@ -809,165 +1151,6 @@ declare class Retrieval extends BaseResource {
809
1151
  query(params: RetrievalQueryParams): Promise<RetrievalQueryResponse>;
810
1152
  }
811
1153
 
812
- /**
813
- * Canonical document state returned by document lifecycle endpoints.
814
- */
815
- interface Document {
816
- /** Stable document identifier */
817
- documentId: string;
818
- /** Retrieval namespace */
819
- namespace: string;
820
- /** Current lifecycle status */
821
- status: string;
822
- /** Current published job result identifier */
823
- currentJobResultId?: string;
824
- /** Original source file name */
825
- sourceFileName?: string;
826
- /** Client-provided display metadata copied from the publishing job */
827
- documentMetadata?: Record<string, unknown>;
828
- /** Document creation timestamp */
829
- createdAt?: Date;
830
- /** Last update timestamp */
831
- updatedAt?: Date;
832
- /** Archive timestamp, when archived */
833
- archivedAt?: Date;
834
- }
835
- /**
836
- * Pagination metadata returned by document list endpoints.
837
- */
838
- interface DocumentListPagination {
839
- /** Current page number */
840
- page: number;
841
- /** Number of items requested per page */
842
- pageSize: number;
843
- /** Total matching documents */
844
- total: number;
845
- /** Total number of pages */
846
- totalPages: number;
847
- }
848
- /**
849
- * Query parameters for GET /v2/documents.
850
- */
851
- interface DocumentListParams {
852
- /** Retrieval namespace */
853
- namespace?: string;
854
- /** Page number (default: 1) */
855
- page?: number;
856
- /** Items per page (default: 50, maximum: 200) */
857
- pageSize?: number;
858
- }
859
- /**
860
- * Response from GET /v2/documents.
861
- */
862
- interface DocumentListResponse {
863
- /** Namespace listed by the API */
864
- namespace: string;
865
- /** Documents visible in the namespace */
866
- documents: Document[];
867
- /** Pagination metadata */
868
- pagination: DocumentListPagination;
869
- }
870
- /**
871
- * Document chunk types supported by document chunk endpoints.
872
- */
873
- type DocumentChunkType = 'text' | 'image' | 'table' | 'page';
874
- /**
875
- * Pagination metadata returned by chunk list endpoints.
876
- */
877
- interface DocumentChunkPagination {
878
- /** Current page number */
879
- page: number;
880
- /** Number of items requested per page */
881
- pageSize: number;
882
- /** Total matching chunks */
883
- total: number;
884
- /** Total number of pages */
885
- totalPages: number;
886
- }
887
- /**
888
- * Query parameters for GET /v2/documents/{document_id}/chunks.
889
- */
890
- interface DocumentChunkListParams {
891
- /** Page number (default: 1) */
892
- page?: number;
893
- /** Items per page (default: 50, maximum: 200) */
894
- pageSize?: number;
895
- /** Optional chunk type filter */
896
- chunkType?: DocumentChunkType;
897
- /** Set true to include 7-day asset URLs for media chunks */
898
- includeAssetUrls?: boolean;
899
- }
900
- /**
901
- * Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
902
- */
903
- interface DocumentChunkGetParams {
904
- /** Set true to include 7-day asset URLs for media chunks */
905
- includeAssetUrls?: boolean;
906
- }
907
- /**
908
- * One current-revision document chunk.
909
- */
910
- interface DocumentChunk {
911
- /** Stable document chunk row identifier */
912
- id: string;
913
- /** Parser-provided chunk identifier */
914
- chunkId: string;
915
- /** Chunk content type */
916
- chunkType: DocumentChunkType;
917
- /** Content source marker. Page chunks normally expose summaries as content. */
918
- contentSource?: string | null;
919
- /** Chunk text or generated summary content */
920
- content?: string | null;
921
- /** Parent section identifier */
922
- sectionId?: string | null;
923
- /** Parent section path */
924
- sectionPath?: string | null;
925
- /** Source path from the parser output */
926
- sourceChunkPath?: string | null;
927
- /** Generated artifact file path for media chunks */
928
- filePath?: string | null;
929
- /** Sort order within the document revision */
930
- sortOrder: number;
931
- /** Chunk metadata returned by the API */
932
- metadata: Record<string, unknown>;
933
- /** 7-day asset URL for media chunks when available */
934
- assetUrl?: string | null;
935
- /** Chunk creation timestamp */
936
- createdAt?: Date;
937
- }
938
- /**
939
- * Response from GET /v2/documents/{document_id}/chunks.
940
- */
941
- interface DocumentChunkListResponse {
942
- /** Stable document identifier */
943
- documentId: string;
944
- /** Retrieval namespace */
945
- namespace: string;
946
- /** Current published job result identifier */
947
- jobResultId?: string | null;
948
- /** Current published job identifier */
949
- jobId?: string | null;
950
- /** Current-revision chunks */
951
- chunks: DocumentChunk[];
952
- /** Pagination metadata */
953
- pagination: DocumentChunkPagination;
954
- }
955
- /**
956
- * Response from GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
957
- */
958
- interface DocumentChunkResponse {
959
- /** Stable document identifier */
960
- documentId: string;
961
- /** Retrieval namespace */
962
- namespace: string;
963
- /** Current published job result identifier */
964
- jobResultId?: string | null;
965
- /** Current published job identifier */
966
- jobId?: string | null;
967
- /** Requested current-revision chunk */
968
- chunk: DocumentChunk;
969
- }
970
-
971
1154
  /**
972
1155
  * Resource for canonical document lifecycle operations.
973
1156
  */
@@ -988,6 +1171,10 @@ declare class Documents extends BaseResource {
988
1171
  * Get one current-revision chunk for one canonical document.
989
1172
  */
990
1173
  getChunk(documentId: string, documentChunkId: string, params?: DocumentChunkGetParams): Promise<DocumentChunkResponse>;
1174
+ /**
1175
+ * Get a signed normalized source-file URL for compatibility and debugging.
1176
+ */
1177
+ getPageCitationSource(documentId: string): Promise<DocumentPageCitationSource>;
991
1178
  /**
992
1179
  * Archive one canonical document by ID.
993
1180
  */
@@ -998,6 +1185,18 @@ declare class Documents extends BaseResource {
998
1185
  private createChunkGetRequestConfig;
999
1186
  }
1000
1187
 
1188
+ type PageCitationAssetContentType = 'image/png' | 'image/jpeg';
1189
+ type PageCitationAssetSource = 'knowhere-rendered-page-citation-source';
1190
+ interface PageCitationAsset {
1191
+ pageNum: number;
1192
+ artifactRef: string;
1193
+ assetUrl?: string;
1194
+ contentType: PageCitationAssetContentType;
1195
+ width?: number;
1196
+ height?: number;
1197
+ source: PageCitationAssetSource;
1198
+ }
1199
+
1001
1200
  type KnowledgeChunkType = DocumentChunkType;
1002
1201
  interface KnowledgeParseParams extends ParseParams {
1003
1202
  /** Optional stable local identifier for this parsed result copy. */
@@ -1028,6 +1227,8 @@ interface LocalKnowledgeDocument {
1028
1227
  interface LocalKnowledgeParseResponse {
1029
1228
  document: LocalKnowledgeDocument;
1030
1229
  result: ParseResult;
1230
+ assetUrlsByFilePath?: Readonly<Record<string, string>>;
1231
+ parsedSnapshot?: KnowhereParsedSnapshot;
1031
1232
  }
1032
1233
  interface KnowledgeAsyncParseParams extends ParseParams {
1033
1234
  /** Optional stable local identifier to use when this job result is cached later. */
@@ -1052,11 +1253,21 @@ interface KnowledgeStartupRecoveryResponse {
1052
1253
  checkedJobs: number;
1053
1254
  results: KnowledgeAsyncJobStatusResponse[];
1054
1255
  }
1055
- interface KnowledgeCacheJobResultParams {
1256
+ interface KnowledgeLoadJobResultParams {
1056
1257
  jobId: string;
1057
- localDocumentId?: string;
1058
1258
  verifyChecksum?: boolean;
1259
+ storageAdapter?: KnowhereAssetStorageOptions;
1260
+ }
1261
+ interface KnowledgeImportJobResultParams extends KnowledgeLoadJobResultParams {
1262
+ localDocumentId?: string;
1263
+ }
1264
+ interface KnowledgeJobResultResponse {
1265
+ result: ParseResult;
1266
+ assetUrlsByFilePath?: Readonly<Record<string, string>>;
1267
+ parsedSnapshot?: KnowhereParsedSnapshot;
1059
1268
  }
1269
+ /** @deprecated Use KnowledgeImportJobResultParams with importJobResult instead. */
1270
+ type KnowledgeCacheJobResultParams = KnowledgeImportJobResultParams;
1060
1271
  interface KnowledgeCacheDocumentParams {
1061
1272
  /** Canonical Knowhere document identifier from published retrieval results. */
1062
1273
  documentId: string;
@@ -1070,6 +1281,16 @@ interface KnowledgeDocumentReference {
1070
1281
  documentId?: string;
1071
1282
  /** Server parse job identifier whose completed result should be cached before reading. */
1072
1283
  jobId?: string;
1284
+ /** Current parsed revision key when the caller already has it. */
1285
+ revisionKey?: string;
1286
+ }
1287
+ type KnowledgeParsedStorageOptions = ParsedDocumentStorageConfig;
1288
+ type KnowledgeSyncParsedDocumentParams = KnowledgeDocumentReference;
1289
+ interface KnowledgeSyncParsedDocumentResponse {
1290
+ documentId: string;
1291
+ revisionKey: string;
1292
+ completed: boolean;
1293
+ manifest?: KnowhereParsedSnapshotManifest;
1073
1294
  }
1074
1295
  interface KnowledgeSection {
1075
1296
  sectionPath: string;
@@ -1088,14 +1309,19 @@ interface KnowledgeOutline {
1088
1309
  typeCounts: Record<KnowledgeChunkType, number>;
1089
1310
  sections: KnowledgeSection[];
1090
1311
  sectionTree: KnowledgeSection[];
1312
+ truncated?: boolean;
1313
+ continuationCursor?: string;
1091
1314
  }
1092
1315
  interface KnowledgeReadParams extends KnowledgeDocumentReference {
1316
+ page?: number;
1317
+ pageSize?: number;
1093
1318
  sectionPath?: string;
1094
1319
  startChunk?: number;
1095
1320
  endChunk?: number;
1096
1321
  chunkId?: string;
1097
1322
  chunkType?: KnowledgeChunkType;
1098
1323
  limit?: number;
1324
+ assetUrlPolicy?: ParsedDocumentAssetUrlPolicy;
1099
1325
  }
1100
1326
  interface KnowledgeReadChunk {
1101
1327
  position: number;
@@ -1109,6 +1335,7 @@ interface KnowledgeReadChunk {
1109
1335
  sectionPath: string;
1110
1336
  sourceChunkPath: string;
1111
1337
  filePath?: string;
1338
+ assetUrl?: string;
1112
1339
  pageNumbers?: number[];
1113
1340
  metadata: Record<string, unknown>;
1114
1341
  }
@@ -1116,9 +1343,14 @@ interface KnowledgeReadResponse {
1116
1343
  document: LocalKnowledgeDocument;
1117
1344
  chunks: KnowledgeReadChunk[];
1118
1345
  nextChunk?: number;
1346
+ page?: number;
1347
+ pageSize?: number;
1348
+ totalChunks?: number;
1349
+ totalPages?: number;
1119
1350
  }
1120
1351
  interface KnowledgeGrepParams extends KnowledgeDocumentReference {
1121
1352
  pattern: string;
1353
+ continuationCursor?: string;
1122
1354
  isRegex?: boolean;
1123
1355
  isCaseSensitive?: boolean;
1124
1356
  maxResults?: number;
@@ -1142,6 +1374,7 @@ interface KnowledgeGrepResponse {
1142
1374
  matches: KnowledgeGrepMatch[];
1143
1375
  scannedChunks: number;
1144
1376
  truncated: boolean;
1377
+ continuationCursor?: string;
1145
1378
  }
1146
1379
  interface KnowledgeSearchParams {
1147
1380
  query: string;
@@ -1180,15 +1413,27 @@ interface KnowledgeSearchResult {
1180
1413
  declare class Knowledge {
1181
1414
  private readonly client;
1182
1415
  private readonly store;
1416
+ private readonly cacheDirectory;
1417
+ private readonly parsedStorageConfig;
1183
1418
  constructor(client: Knowhere, options?: {
1184
1419
  cacheDirectory?: string;
1420
+ parsedStorage?: ParsedDocumentStorageConfig;
1185
1421
  });
1186
1422
  withCacheDirectory(cacheDirectory: string): Knowledge;
1423
+ withParsedStorage(parsedStorage: KnowledgeParsedStorageOptions): Knowledge;
1424
+ parseToLocalCache(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
1425
+ /** @deprecated Use parseToLocalCache for local cache imports or the top-level client.parse for server-safe parsing. */
1187
1426
  parse(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
1188
1427
  startParse(params: KnowledgeAsyncParseParams): Promise<KnowledgeAsyncParseResponse>;
1189
1428
  getJobStatus(jobId: string): Promise<KnowledgeAsyncJobStatusResponse>;
1190
1429
  recoverPendingAsyncParseJobs(): Promise<KnowledgeStartupRecoveryResponse>;
1430
+ loadJobResult(params: KnowledgeLoadJobResultParams): Promise<KnowledgeJobResultResponse>;
1431
+ importJobResult(params: KnowledgeImportJobResultParams): Promise<LocalKnowledgeParseResponse>;
1432
+ /** @deprecated Use importJobResult for local cache imports or loadJobResult for server-safe loads. */
1191
1433
  cacheJobResult(params: KnowledgeCacheJobResultParams): Promise<LocalKnowledgeParseResponse>;
1434
+ syncParsedDocument(params: KnowledgeSyncParsedDocumentParams): Promise<KnowledgeSyncParsedDocumentResponse>;
1435
+ private syncParseResultToConfiguredStorage;
1436
+ private parseWithoutClientStorageAdapter;
1192
1437
  cacheDocument(params: KnowledgeCacheDocumentParams): Promise<LocalKnowledgeParseResponse>;
1193
1438
  private resolveAsyncCache;
1194
1439
  listDocuments(): Promise<LocalKnowledgeDocument[]>;
@@ -1198,6 +1443,20 @@ declare class Knowledge {
1198
1443
  search(params: KnowledgeSearchParams): Promise<KnowledgeSearchResponse>;
1199
1444
  private resolveSearchDocuments;
1200
1445
  private loadReadableResult;
1446
+ private readRemoteDocumentChunks;
1447
+ private scanRemoteDocumentChunks;
1448
+ private grepRemoteDocumentChunks;
1449
+ private getRemoteDocumentOutline;
1450
+ private tryReadChunksFromParsedStorage;
1451
+ private tryGrepChunksFromParsedStorage;
1452
+ private tryReadOutlineFromParsedStorage;
1453
+ private readFreshParsedStorageManifest;
1454
+ private readStoredSnapshotChunks;
1455
+ private toRemoteReadChunks;
1456
+ private hardenReadChunkAssetUrls;
1457
+ private scheduleParsedStorageSync;
1458
+ private syncRemoteDocumentToParsedStorage;
1459
+ private requireParsedStorageConfig;
1201
1460
  private findLocalDocumentByRemoteId;
1202
1461
  private getPublishedDocumentJobId;
1203
1462
  }
@@ -1295,6 +1554,73 @@ declare class Knowhere {
1295
1554
 
1296
1555
  declare const VERSION = "0.1.0";
1297
1556
 
1557
+ declare function storeParseResultAssets(result: ParseResult, options?: KnowhereAssetStorageOptions): Promise<KnowhereAssetStorageResult>;
1558
+
1559
+ declare class DiskParsedDocumentStorage implements ParsedDocumentStorage {
1560
+ private readonly rootDirectory;
1561
+ constructor(rootDirectory: string);
1562
+ readManifest(params: {
1563
+ readonly documentId: string;
1564
+ readonly revisionKey: string;
1565
+ }): Promise<KnowhereParsedSnapshotManifest | null>;
1566
+ writeManifest(params: {
1567
+ readonly documentId: string;
1568
+ readonly revisionKey: string;
1569
+ readonly manifest: KnowhereParsedSnapshotManifest;
1570
+ }): Promise<void>;
1571
+ readChunkPage(params: {
1572
+ readonly documentId: string;
1573
+ readonly revisionKey: string;
1574
+ readonly page: number;
1575
+ }): Promise<KnowhereParsedSnapshotChunkPage | null>;
1576
+ writeChunkPage(params: {
1577
+ readonly documentId: string;
1578
+ readonly revisionKey: string;
1579
+ readonly page: KnowhereParsedSnapshotChunkPage;
1580
+ }): Promise<void>;
1581
+ writeAsset(params: {
1582
+ readonly documentId: string;
1583
+ readonly revisionKey: string;
1584
+ readonly sourcePath: string;
1585
+ readonly body: Uint8Array;
1586
+ readonly contentType: string;
1587
+ readonly metadata?: Readonly<Record<string, string>>;
1588
+ }): Promise<{
1589
+ readonly sourcePath: string;
1590
+ readonly url?: string;
1591
+ }>;
1592
+ getAssetUrl(params: {
1593
+ readonly documentId: string;
1594
+ readonly revisionKey: string;
1595
+ readonly sourcePath: string;
1596
+ }): Promise<string | null>;
1597
+ readSyncProgress(params: {
1598
+ readonly documentId: string;
1599
+ readonly revisionKey: string;
1600
+ }): Promise<ParsedDocumentSyncProgress | null>;
1601
+ writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
1602
+ private getManifestPath;
1603
+ private getChunkPagePath;
1604
+ private getProgressPath;
1605
+ private getAssetPath;
1606
+ private getRevisionDirectory;
1607
+ private readOptionalJson;
1608
+ private writeJson;
1609
+ }
1610
+
1611
+ declare function syncParseResultToParsedDocumentStorage(params: {
1612
+ readonly result: ParseResult;
1613
+ readonly storage: ParsedDocumentStorage;
1614
+ readonly documentId?: string;
1615
+ readonly revisionKey?: string;
1616
+ readonly chunkPageSize?: number;
1617
+ }): Promise<{
1618
+ readonly result: ParseResult;
1619
+ readonly snapshot?: KnowhereParsedSnapshot;
1620
+ readonly documentId: string;
1621
+ readonly revisionKey: string;
1622
+ }>;
1623
+
1298
1624
  /**
1299
1625
  * Base error class for all Knowhere SDK errors
1300
1626
  */
@@ -1424,4 +1750,4 @@ declare class JobFailedError extends KnowhereError {
1424
1750
  constructor(message: string, code: string, jobResult: JobResult);
1425
1751
  }
1426
1752
 
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 };
1753
+ 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, type KnowhereParsedSnapshot, type KnowhereParsedSnapshotChunk, type KnowhereParsedSnapshotChunkPage, type KnowhereParsedSnapshotChunkPageReference, type KnowhereParsedSnapshotManifest, 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 ParsedDocumentAssetUrlPolicy, type ParsedDocumentStorage, type ParsedDocumentStorageAsset, type ParsedDocumentStorageAssetParams, type ParsedDocumentStorageChunkPageParams, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentStorageManifestParams, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, 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 };