@heripo/model 0.1.27 → 0.1.29

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/README.ko.md CHANGED
@@ -18,6 +18,7 @@
18
18
  - [설치](#설치)
19
19
  - [데이터 모델](#데이터-모델)
20
20
  - [사용법](#사용법)
21
+ - [후원](#후원)
21
22
  - [라이선스](#라이선스)
22
23
 
23
24
  ## 개요
@@ -59,9 +60,11 @@ import type { DoclingDocument } from '@heripo/model';
59
60
 
60
61
  **주요 필드:**
61
62
 
62
- - `type`: 문서 타입 (예: "pdf")
63
- - `item_index`: 아이템 인덱스
64
- - `json_content`: 문서 내용 (JSON 객체)
63
+ - `schema_name`, `version`, `name`: Docling 문서 식별 필드
64
+ - `origin`: 원천 파일 metadata
65
+ - `body`, `furniture`, `groups`: 문서 트리 및 그룹 구조
66
+ - `texts`, `pictures`, `tables`: 추출된 content node
67
+ - `pages`: 페이지 metadata와 렌더링된 페이지 이미지 참조
65
68
 
66
69
  ### ProcessedDocument
67
70
 
@@ -72,6 +75,8 @@ import type { ProcessedDocument } from '@heripo/model';
72
75
 
73
76
  interface ProcessedDocument {
74
77
  reportId: string; // 리포트 ID
78
+ schemaVersion?: string; // 처리된 문서 schema version
79
+ source?: ProcessedDocumentSource; // 원천 Docling artifact metadata
75
80
  pageRangeMap: Record<number, PageRange>; // PDF 페이지 → 문서 페이지 매핑
76
81
  chapters: Chapter[]; // 계층적 챕터 구조
77
82
  images: ProcessedImage[]; // 추출된 이미지 메타데이터
@@ -80,6 +85,21 @@ interface ProcessedDocument {
80
85
  }
81
86
  ```
82
87
 
88
+ ### ProcessedDocumentSource
89
+
90
+ 처리된 문서를 만들 때 사용한 Docling JSON의 원천 artifact metadata입니다.
91
+
92
+ ```typescript
93
+ import type { ProcessedDocumentSource } from '@heripo/model';
94
+
95
+ interface ProcessedDocumentSource {
96
+ pipelineRunId?: string; // 처리 pipeline run ID
97
+ doclingObjectKey?: string; // result.json 또는 병합된 Docling JSON object key
98
+ doclingSha256?: string; // Docling JSON artifact의 SHA-256 hash
99
+ handoffManifestObjectKey?: string; // handoff manifest object key
100
+ }
101
+ ```
102
+
83
103
  ### Chapter
84
104
 
85
105
  문서의 계층적 섹션 구조입니다.
@@ -93,6 +113,7 @@ interface Chapter {
93
113
  originTitle: string; // 원본 제목
94
114
  level: number; // 계층 레벨 (1, 2, 3, ...)
95
115
  pageNo: number; // 시작 페이지 번호
116
+ sourceRefs?: string[]; // 제목 추출에 사용된 원천 Docling ref
96
117
  textBlocks: TextBlock[]; // 텍스트 블록
97
118
  imageIds: string[]; // 이미지 ID 참조
98
119
  tableIds: string[]; // 테이블 ID 참조
@@ -109,6 +130,8 @@ interface Chapter {
109
130
  import type { TextBlock } from '@heripo/model';
110
131
 
111
132
  interface TextBlock {
133
+ id?: string; // 안정적인 텍스트 블록 ID
134
+ sourceRef?: string; // 원천 Docling text ref
112
135
  text: string; // 텍스트 내용
113
136
  pdfPageNo: number; // PDF 페이지 번호
114
137
  }
@@ -123,6 +146,8 @@ import type { ProcessedImage } from '@heripo/model';
123
146
 
124
147
  interface ProcessedImage {
125
148
  id: string; // 이미지 ID
149
+ sourceRef?: string; // 원천 Docling picture ref
150
+ captionSourceRefs?: string[]; // 캡션 텍스트 item의 원천 Docling ref
126
151
  caption?: Caption; // 캡션 (선택)
127
152
  pdfPageNo: number; // PDF 페이지 번호
128
153
  path: string; // 이미지 파일 경로
@@ -138,6 +163,8 @@ import type { ProcessedTable } from '@heripo/model';
138
163
 
139
164
  interface ProcessedTable {
140
165
  id: string; // 테이블 ID
166
+ sourceRef?: string; // 원천 Docling table ref
167
+ captionSourceRefs?: string[]; // 캡션 텍스트 item의 원천 Docling ref
141
168
  caption?: Caption; // 캡션 (선택)
142
169
  pdfPageNo: number; // PDF 페이지 번호
143
170
  grid: ProcessedTableCell[][]; // 2D 그리드 데이터
@@ -146,6 +173,12 @@ interface ProcessedTable {
146
173
  }
147
174
  ```
148
175
 
176
+ `grid`는 화면에 보이는 셀만 담은 compact list입니다. 병합 셀은
177
+ `rowSpan`, `colSpan`으로 표현하고, span으로 덮인 shadow cell은 포함하지
178
+ 않습니다. 테이블 셀에는 의도적으로 cell-level `sourceRef`가 없습니다. 셀을
179
+ 원천 테이블로 추적할 때는 `table.sourceRef`와 `grid[row][col]` 위치를 함께
180
+ 사용합니다.
181
+
149
182
  ### ProcessedTableCell
150
183
 
151
184
  테이블 셀 메타데이터입니다.
@@ -196,6 +229,7 @@ import type { ProcessedFootnote } from '@heripo/model';
196
229
 
197
230
  interface ProcessedFootnote {
198
231
  id: string; // 각주 ID
232
+ sourceRef?: string; // 원천 Docling text ref
199
233
  text: string; // 각주 텍스트
200
234
  pdfPageNo: number; // PDF 페이지 번호
201
235
  }
@@ -228,7 +262,6 @@ interface OcrStrategy {
228
262
  reason: string; // 전략 선택 이유
229
263
  sampledPages: number; // 샘플링된 페이지 수
230
264
  totalPages: number; // 문서 전체 페이지 수
231
- koreanHanjaMixPages?: number[]; // 한국어-한자 혼용 페이지
232
265
  }
233
266
  ```
234
267
 
@@ -277,6 +310,58 @@ interface TokenUsageSummary {
277
310
  }
278
311
  ```
279
312
 
313
+ ### Review Assistance 타입
314
+
315
+ `@heripo/pdf-parser`에서 `reviewAssistance`를 활성화했을 때 생성되는 선택적
316
+ page-level review assistance 결과 타입입니다.
317
+
318
+ ```typescript
319
+ import type {
320
+ ReviewAssistanceDecision,
321
+ ReviewAssistanceIssue,
322
+ ReviewAssistanceProgressEvent,
323
+ ReviewAssistanceReport,
324
+ } from '@heripo/model';
325
+
326
+ interface ReviewAssistanceReport {
327
+ schemaName: 'HeripoReviewAssistanceReport';
328
+ version: '1.0';
329
+ reportId: string;
330
+ source: {
331
+ doclingResult: 'result.json';
332
+ ocrOriginSnapshot?: 'result_ocr_origin.json';
333
+ originSnapshot?: 'result_review_origin.json';
334
+ };
335
+ summary: {
336
+ pageCount: number;
337
+ pagesSucceeded: number;
338
+ pagesFailed: number;
339
+ autoAppliedCount: number;
340
+ proposalCount: number;
341
+ skippedCount: number;
342
+ issueCount: number;
343
+ };
344
+ pages: Array<{
345
+ pageNo: number;
346
+ status: 'succeeded' | 'failed';
347
+ decisions: ReviewAssistanceDecision[];
348
+ issues: ReviewAssistanceIssue[];
349
+ }>;
350
+ }
351
+
352
+ interface ReviewAssistanceProgressEvent {
353
+ substage:
354
+ | 'review-assistance:prepare'
355
+ | 'review-assistance:page'
356
+ | 'review-assistance:patch'
357
+ | 'review-assistance:write-report';
358
+ status: 'started' | 'progress' | 'completed' | 'failed';
359
+ reportId: string;
360
+ pageNo?: number;
361
+ pageCount?: number;
362
+ }
363
+ ```
364
+
280
365
  ### BCP-47 언어 태그 유틸리티
281
366
 
282
367
  BCP-47 언어 태그를 다루기 위한 유틸리티입니다.
@@ -290,10 +375,10 @@ import {
290
375
  normalizeToBcp47,
291
376
  } from '@heripo/model';
292
377
 
293
- // Bcp47LanguageTag - 지원되는 BCP-47 언어 태그의 유니온 타입
294
- type Bcp47LanguageTag = 'ko' | 'en' | 'ja' | 'zh' | /* ... */ string;
378
+ // Bcp47LanguageTag - 지원되는 전체 BCP-47 언어 태그의 유니온 타입
379
+ type Bcp47LanguageTag = (typeof BCP47_LANGUAGE_TAGS)[number];
295
380
 
296
- // BCP47_LANGUAGE_TAGS - 30개 지원 태그의 상수 배열
381
+ // BCP47_LANGUAGE_TAGS - ocrmac에서 지원하는 언어 태그 상수 배열
297
382
  const BCP47_LANGUAGE_TAGS: readonly Bcp47LanguageTag[];
298
383
 
299
384
  // BCP47_LANGUAGE_TAG_SET - O(1) 조회를 위한 ReadonlySet
@@ -303,7 +388,7 @@ const BCP47_LANGUAGE_TAG_SET: ReadonlySet<string>;
303
388
  function isValidBcp47Tag(tag: string): tag is Bcp47LanguageTag;
304
389
 
305
390
  // normalizeToBcp47 - 언어 문자열을 BCP-47 형식으로 정규화
306
- function normalizeToBcp47(tag: string): Bcp47LanguageTag | undefined;
391
+ function normalizeToBcp47(tag: string): Bcp47LanguageTag | null;
307
392
  ```
308
393
 
309
394
  ## 사용법
@@ -384,6 +469,13 @@ const resourcesWithCaptions = [...doc.images, ...doc.tables].filter(hasCaption);
384
469
  - [@heripo/pdf-parser](../pdf-parser) - PDF 파싱 및 OCR
385
470
  - [@heripo/document-processor](../document-processor) - 문서 구조 분석
386
471
 
472
+ ## 후원
473
+
474
+ heripo lab의 오픈소스 연구를 후원하려면 다음 경로를 이용할 수 있습니다:
475
+
476
+ - [Open Collective](https://opencollective.com/heripo-project): 전반적인 프로젝트 후원
477
+ - [fairy.hada.io/@heripo](https://fairy.hada.io/@heripo): 한국인 개인 후원자를 위한 원화 결제
478
+
387
479
  ## 라이선스
388
480
 
389
481
  이 패키지는 [Apache License 2.0](../../LICENSE) 라이선스 하에 배포됩니다.
package/README.md CHANGED
@@ -18,6 +18,7 @@
18
18
  - [Installation](#installation)
19
19
  - [Data Models](#data-models)
20
20
  - [Usage](#usage)
21
+ - [Sponsor](#sponsor)
21
22
  - [License](#license)
22
23
 
23
24
  ## Overview
@@ -59,9 +60,11 @@ import type { DoclingDocument } from '@heripo/model';
59
60
 
60
61
  **Key Fields:**
61
62
 
62
- - `type`: Document type (e.g., "pdf")
63
- - `item_index`: Item index
64
- - `json_content`: Document content (JSON object)
63
+ - `schema_name`, `version`, `name`: Docling document identity fields
64
+ - `origin`: Source file metadata
65
+ - `body`, `furniture`, `groups`: Document tree and grouping structures
66
+ - `texts`, `pictures`, `tables`: Extracted content nodes
67
+ - `pages`: Page metadata and rendered page image references
65
68
 
66
69
  ### ProcessedDocument
67
70
 
@@ -72,6 +75,8 @@ import type { ProcessedDocument } from '@heripo/model';
72
75
 
73
76
  interface ProcessedDocument {
74
77
  reportId: string; // Report ID
78
+ schemaVersion?: string; // Processed document schema version
79
+ source?: ProcessedDocumentSource; // Source Docling artifact metadata
75
80
  pageRangeMap: Record<number, PageRange>; // PDF page → document page mapping
76
81
  chapters: Chapter[]; // Hierarchical chapter structure
77
82
  images: ProcessedImage[]; // Extracted image metadata
@@ -80,6 +85,21 @@ interface ProcessedDocument {
80
85
  }
81
86
  ```
82
87
 
88
+ ### ProcessedDocumentSource
89
+
90
+ Source artifact metadata for the Docling JSON used to create a processed document.
91
+
92
+ ```typescript
93
+ import type { ProcessedDocumentSource } from '@heripo/model';
94
+
95
+ interface ProcessedDocumentSource {
96
+ pipelineRunId?: string; // Processing pipeline run ID
97
+ doclingObjectKey?: string; // Object key for result.json or merged Docling JSON
98
+ doclingSha256?: string; // SHA-256 hash of the Docling JSON artifact
99
+ handoffManifestObjectKey?: string; // Object key for a handoff manifest
100
+ }
101
+ ```
102
+
83
103
  ### Chapter
84
104
 
85
105
  Hierarchical section structure of the document.
@@ -93,6 +113,7 @@ interface Chapter {
93
113
  originTitle: string; // Original title from source
94
114
  level: number; // Hierarchy level (1, 2, 3, ...)
95
115
  pageNo: number; // Start page number
116
+ sourceRefs?: string[]; // Source Docling refs used for the title
96
117
  textBlocks: TextBlock[]; // Text blocks
97
118
  imageIds: string[]; // Image ID references
98
119
  tableIds: string[]; // Table ID references
@@ -109,6 +130,8 @@ Atomic text unit.
109
130
  import type { TextBlock } from '@heripo/model';
110
131
 
111
132
  interface TextBlock {
133
+ id?: string; // Stable text block ID
134
+ sourceRef?: string; // Source Docling text ref
112
135
  text: string; // Text content
113
136
  pdfPageNo: number; // PDF page number
114
137
  }
@@ -123,6 +146,8 @@ import type { ProcessedImage } from '@heripo/model';
123
146
 
124
147
  interface ProcessedImage {
125
148
  id: string; // Image ID
149
+ sourceRef?: string; // Source Docling picture ref
150
+ captionSourceRefs?: string[]; // Source Docling refs for caption text items
126
151
  caption?: Caption; // Caption (optional)
127
152
  pdfPageNo: number; // PDF page number
128
153
  path: string; // Image file path
@@ -138,6 +163,8 @@ import type { ProcessedTable } from '@heripo/model';
138
163
 
139
164
  interface ProcessedTable {
140
165
  id: string; // Table ID
166
+ sourceRef?: string; // Source Docling table ref
167
+ captionSourceRefs?: string[]; // Source Docling refs for caption text items
141
168
  caption?: Caption; // Caption (optional)
142
169
  pdfPageNo: number; // PDF page number
143
170
  grid: ProcessedTableCell[][]; // 2D grid data
@@ -146,6 +173,12 @@ interface ProcessedTable {
146
173
  }
147
174
  ```
148
175
 
176
+ `grid` is a compact list of visible cells. Merged cells are represented with
177
+ `rowSpan` and `colSpan`; shadow cells covered by a span are not included.
178
+ Table cells intentionally do not have cell-level `sourceRef` values. Use
179
+ `table.sourceRef` together with `grid[row][col]` when tracing a cell back to
180
+ the source table.
181
+
149
182
  ### ProcessedTableCell
150
183
 
151
184
  Table cell metadata.
@@ -196,6 +229,7 @@ import type { ProcessedFootnote } from '@heripo/model';
196
229
 
197
230
  interface ProcessedFootnote {
198
231
  id: string; // Footnote ID
232
+ sourceRef?: string; // Source Docling text ref
199
233
  text: string; // Footnote text
200
234
  pdfPageNo: number; // PDF page number
201
235
  }
@@ -228,7 +262,6 @@ interface OcrStrategy {
228
262
  reason: string; // Reason for strategy selection
229
263
  sampledPages: number; // Number of sampled pages
230
264
  totalPages: number; // Total pages in document
231
- koreanHanjaMixPages?: number[]; // Pages with Korean-Hanja mixed script
232
265
  }
233
266
  ```
234
267
 
@@ -277,6 +310,58 @@ interface TokenUsageSummary {
277
310
  }
278
311
  ```
279
312
 
313
+ ### Review Assistance Types
314
+
315
+ Types for optional page-level review assistance generated by
316
+ `@heripo/pdf-parser` when `reviewAssistance` is enabled.
317
+
318
+ ```typescript
319
+ import type {
320
+ ReviewAssistanceDecision,
321
+ ReviewAssistanceIssue,
322
+ ReviewAssistanceProgressEvent,
323
+ ReviewAssistanceReport,
324
+ } from '@heripo/model';
325
+
326
+ interface ReviewAssistanceReport {
327
+ schemaName: 'HeripoReviewAssistanceReport';
328
+ version: '1.0';
329
+ reportId: string;
330
+ source: {
331
+ doclingResult: 'result.json';
332
+ ocrOriginSnapshot?: 'result_ocr_origin.json';
333
+ originSnapshot?: 'result_review_origin.json';
334
+ };
335
+ summary: {
336
+ pageCount: number;
337
+ pagesSucceeded: number;
338
+ pagesFailed: number;
339
+ autoAppliedCount: number;
340
+ proposalCount: number;
341
+ skippedCount: number;
342
+ issueCount: number;
343
+ };
344
+ pages: Array<{
345
+ pageNo: number;
346
+ status: 'succeeded' | 'failed';
347
+ decisions: ReviewAssistanceDecision[];
348
+ issues: ReviewAssistanceIssue[];
349
+ }>;
350
+ }
351
+
352
+ interface ReviewAssistanceProgressEvent {
353
+ substage:
354
+ | 'review-assistance:prepare'
355
+ | 'review-assistance:page'
356
+ | 'review-assistance:patch'
357
+ | 'review-assistance:write-report';
358
+ status: 'started' | 'progress' | 'completed' | 'failed';
359
+ reportId: string;
360
+ pageNo?: number;
361
+ pageCount?: number;
362
+ }
363
+ ```
364
+
280
365
  ### BCP-47 Language Tag Utilities
281
366
 
282
367
  Utilities for working with BCP-47 language tags.
@@ -290,10 +375,10 @@ import {
290
375
  normalizeToBcp47,
291
376
  } from '@heripo/model';
292
377
 
293
- // Bcp47LanguageTag - Union type of supported BCP-47 language tags
294
- type Bcp47LanguageTag = 'ko' | 'en' | 'ja' | 'zh' | /* ... */ string;
378
+ // Bcp47LanguageTag - Union type of supported full BCP-47 language tags
379
+ type Bcp47LanguageTag = (typeof BCP47_LANGUAGE_TAGS)[number];
295
380
 
296
- // BCP47_LANGUAGE_TAGS - Const array of 30 supported tags
381
+ // BCP47_LANGUAGE_TAGS - Const array of supported ocrmac language tags
297
382
  const BCP47_LANGUAGE_TAGS: readonly Bcp47LanguageTag[];
298
383
 
299
384
  // BCP47_LANGUAGE_TAG_SET - ReadonlySet for O(1) lookup
@@ -303,7 +388,7 @@ const BCP47_LANGUAGE_TAG_SET: ReadonlySet<string>;
303
388
  function isValidBcp47Tag(tag: string): tag is Bcp47LanguageTag;
304
389
 
305
390
  // normalizeToBcp47 - Normalize a language string to BCP-47 format
306
- function normalizeToBcp47(tag: string): Bcp47LanguageTag | undefined;
391
+ function normalizeToBcp47(tag: string): Bcp47LanguageTag | null;
307
392
  ```
308
393
 
309
394
  ## Usage
@@ -384,6 +469,13 @@ const resourcesWithCaptions = [...doc.images, ...doc.tables].filter(hasCaption);
384
469
  - [@heripo/pdf-parser](../pdf-parser) - PDF parsing and OCR
385
470
  - [@heripo/document-processor](../document-processor) - Document structure analysis
386
471
 
472
+ ## Sponsor
473
+
474
+ If you'd like to support heripo lab's open-source research, you can sponsor us through:
475
+
476
+ - [Open Collective](https://opencollective.com/heripo-project) for general project sponsorship.
477
+ - [fairy.hada.io/@heripo](https://fairy.hada.io/@heripo) for Korean individual supporters who prefer KRW payments.
478
+
387
479
  ## License
388
480
 
389
481
  This package is distributed under the [Apache License 2.0](../../LICENSE).
package/dist/index.d.cts CHANGED
@@ -191,6 +191,37 @@ interface PageRange {
191
191
  */
192
192
  endPageNo: number;
193
193
  }
194
+ /**
195
+ * Source artifact metadata for a processed document
196
+ *
197
+ * Stores caller-supplied identifiers for the raw or merged Docling artifact used
198
+ * to create this processed document. Storage providers and URL formats are kept
199
+ * outside this model.
200
+ *
201
+ * @interface ProcessedDocumentSource
202
+ */
203
+ interface ProcessedDocumentSource {
204
+ /**
205
+ * Identifier of the processing pipeline run that produced the source artifact
206
+ * @type {string}
207
+ */
208
+ pipelineRunId?: string;
209
+ /**
210
+ * Object key for the canonical or merged Docling JSON artifact
211
+ * @type {string}
212
+ */
213
+ doclingObjectKey?: string;
214
+ /**
215
+ * SHA-256 hash of the Docling JSON artifact
216
+ * @type {string}
217
+ */
218
+ doclingSha256?: string;
219
+ /**
220
+ * Object key for a handoff manifest that describes related processing outputs
221
+ * @type {string}
222
+ */
223
+ handoffManifestObjectKey?: string;
224
+ }
194
225
  /**
195
226
  * Text block (paragraph, sentence, etc.)
196
227
  *
@@ -199,6 +230,16 @@ interface PageRange {
199
230
  * @interface TextBlock
200
231
  */
201
232
  interface TextBlock {
233
+ /**
234
+ * Stable identifier of the text block
235
+ * @type {string}
236
+ */
237
+ id?: string;
238
+ /**
239
+ * Docling self reference for the source text item
240
+ * @type {string}
241
+ */
242
+ sourceRef?: string;
202
243
  /**
203
244
  * Content of the text block
204
245
  * @type {string}
@@ -248,6 +289,11 @@ interface Chapter {
248
289
  * @type {number}
249
290
  */
250
291
  level: number;
292
+ /**
293
+ * Docling references for the source nodes used to derive the chapter title
294
+ * @type {string[]}
295
+ */
296
+ sourceRefs?: string[];
251
297
  /**
252
298
  * Text blocks inside the chapter
253
299
  *
@@ -303,6 +349,16 @@ interface ProcessedImage {
303
349
  * @type {string}
304
350
  */
305
351
  id: string;
352
+ /**
353
+ * Docling self reference for the source picture item
354
+ * @type {string}
355
+ */
356
+ sourceRef?: string;
357
+ /**
358
+ * Docling references for caption text items associated with this image
359
+ * @type {string[]}
360
+ */
361
+ captionSourceRefs?: string[];
306
362
  /**
307
363
  * Caption information for the image (if available)
308
364
  * @type {Caption}
@@ -325,6 +381,10 @@ interface ProcessedImage {
325
381
  /**
326
382
  * Cell information of a table
327
383
  *
384
+ * Table cells intentionally do not carry cell-level Docling source references.
385
+ * Use the parent table's `sourceRef` with the row/column index in `grid` as
386
+ * the locator for cell provenance.
387
+ *
328
388
  * @interface ProcessedTableCell
329
389
  */
330
390
  interface ProcessedTableCell {
@@ -366,6 +426,16 @@ interface ProcessedTable {
366
426
  * @type {string}
367
427
  */
368
428
  id: string;
429
+ /**
430
+ * Docling self reference for the source table item
431
+ * @type {string}
432
+ */
433
+ sourceRef?: string;
434
+ /**
435
+ * Docling references for caption text items associated with this table
436
+ * @type {string[]}
437
+ */
438
+ captionSourceRefs?: string[];
369
439
  /**
370
440
  * Caption information for the table (if available)
371
441
  * @type {Caption}
@@ -389,7 +459,9 @@ interface ProcessedTable {
389
459
  /**
390
460
  * Table data (2D array)
391
461
  *
392
- * Access using grid[row][col].
462
+ * Access using grid[row][col]. For source lookup, combine `sourceRef` with
463
+ * the row and column indexes because processed cells do not store cell-level
464
+ * source references.
393
465
  *
394
466
  * @type {ProcessedTableCell[][]}
395
467
  */
@@ -412,6 +484,11 @@ interface ProcessedFootnote {
412
484
  * @type {string}
413
485
  */
414
486
  id: string;
487
+ /**
488
+ * Docling self reference for the source footnote text item
489
+ * @type {string}
490
+ */
491
+ sourceRef?: string;
415
492
  /**
416
493
  * Text content of the footnote
417
494
  *
@@ -438,6 +515,16 @@ interface ProcessedDocument {
438
515
  * @type {string}
439
516
  */
440
517
  reportId: string;
518
+ /**
519
+ * Processed document schema version
520
+ * @type {string}
521
+ */
522
+ schemaVersion?: string;
523
+ /**
524
+ * Source artifact metadata for the Docling artifact used to produce this document
525
+ * @type {ProcessedDocumentSource}
526
+ */
527
+ source?: ProcessedDocumentSource;
441
528
  /**
442
529
  * Mapping of page ranges for actual document pages per PDF page
443
530
  *
@@ -741,7 +828,7 @@ interface DocumentProcessResult {
741
828
  /**
742
829
  * Result of the OCR strategy sampling phase.
743
830
  * Determines whether to use ocrmac (standard Docling pipeline)
744
- * or VLM (direct vision language model processing) for a given document.
831
+ * or VLM text correction for a given document.
745
832
  */
746
833
  interface OcrStrategy {
747
834
  /** Selected OCR method */
@@ -756,8 +843,6 @@ interface OcrStrategy {
756
843
  sampledPages: number;
757
844
  /** Total number of pages in the document */
758
845
  totalPages: number;
759
- /** 1-based page numbers where Korean-Hanja mixed script was detected in text layer */
760
- koreanHanjaMixPages?: number[];
761
846
  }
762
847
 
763
848
  type ReviewAssistanceReportSchemaName = 'HeripoReviewAssistanceReport';
@@ -950,4 +1035,4 @@ interface ReviewAssistanceProgressEvent {
950
1035
  message?: string;
951
1036
  }
952
1037
 
953
- export { BCP47_LANGUAGE_TAGS, BCP47_LANGUAGE_TAG_SET, type Bcp47LanguageTag, type Caption, type Chapter, type ComponentUsageReport, type DoclingBBox, type DoclingBaseNode, type DoclingBody, type DoclingDocument, type DoclingGroupItem, type DoclingOrigin, type DoclingPage, type DoclingPageImage, type DoclingPictureItem, type DoclingProv, type DoclingReference, type DoclingTableCell, type DoclingTableData, type DoclingTableItem, type DoclingTextItem, type DocumentProcessResult, LANGUAGE_DISPLAY_NAMES, type ModelUsageDetail, type OcrStrategy, type PageRange, type PhaseUsageReport, type ProcessedDocument, type ProcessedFootnote, type ProcessedImage, type ProcessedTable, type ProcessedTableCell, type ReviewAssistanceCommand, type ReviewAssistanceDecision, type ReviewAssistanceDecisionEvidence, type ReviewAssistanceDisposition, type ReviewAssistanceFailurePolicy, type ReviewAssistanceImageRegion, type ReviewAssistanceIssue, type ReviewAssistanceIssueCategory, type ReviewAssistanceIssueSeverity, type ReviewAssistancePageResult, type ReviewAssistancePageStatus, type ReviewAssistanceProgressEvent, type ReviewAssistanceProgressStatus, type ReviewAssistanceProgressSubstage, type ReviewAssistanceReport, type ReviewAssistanceReportSchemaName, type ReviewAssistanceReportVersion, type ReviewAssistanceTableCell, type TextBlock, type TokenUsageMetadata, type TokenUsageMetadataValue, type TokenUsageReport, type TokenUsageSummary, buildLanguageDescription, getLanguageDisplayName, isValidBcp47Tag, normalizeToBcp47 };
1038
+ export { BCP47_LANGUAGE_TAGS, BCP47_LANGUAGE_TAG_SET, type Bcp47LanguageTag, type Caption, type Chapter, type ComponentUsageReport, type DoclingBBox, type DoclingBaseNode, type DoclingBody, type DoclingDocument, type DoclingGroupItem, type DoclingOrigin, type DoclingPage, type DoclingPageImage, type DoclingPictureItem, type DoclingProv, type DoclingReference, type DoclingTableCell, type DoclingTableData, type DoclingTableItem, type DoclingTextItem, type DocumentProcessResult, LANGUAGE_DISPLAY_NAMES, type ModelUsageDetail, type OcrStrategy, type PageRange, type PhaseUsageReport, type ProcessedDocument, type ProcessedDocumentSource, type ProcessedFootnote, type ProcessedImage, type ProcessedTable, type ProcessedTableCell, type ReviewAssistanceCommand, type ReviewAssistanceDecision, type ReviewAssistanceDecisionEvidence, type ReviewAssistanceDisposition, type ReviewAssistanceFailurePolicy, type ReviewAssistanceImageRegion, type ReviewAssistanceIssue, type ReviewAssistanceIssueCategory, type ReviewAssistanceIssueSeverity, type ReviewAssistancePageResult, type ReviewAssistancePageStatus, type ReviewAssistanceProgressEvent, type ReviewAssistanceProgressStatus, type ReviewAssistanceProgressSubstage, type ReviewAssistanceReport, type ReviewAssistanceReportSchemaName, type ReviewAssistanceReportVersion, type ReviewAssistanceTableCell, type TextBlock, type TokenUsageMetadata, type TokenUsageMetadataValue, type TokenUsageReport, type TokenUsageSummary, buildLanguageDescription, getLanguageDisplayName, isValidBcp47Tag, normalizeToBcp47 };
package/dist/index.d.ts CHANGED
@@ -191,6 +191,37 @@ interface PageRange {
191
191
  */
192
192
  endPageNo: number;
193
193
  }
194
+ /**
195
+ * Source artifact metadata for a processed document
196
+ *
197
+ * Stores caller-supplied identifiers for the raw or merged Docling artifact used
198
+ * to create this processed document. Storage providers and URL formats are kept
199
+ * outside this model.
200
+ *
201
+ * @interface ProcessedDocumentSource
202
+ */
203
+ interface ProcessedDocumentSource {
204
+ /**
205
+ * Identifier of the processing pipeline run that produced the source artifact
206
+ * @type {string}
207
+ */
208
+ pipelineRunId?: string;
209
+ /**
210
+ * Object key for the canonical or merged Docling JSON artifact
211
+ * @type {string}
212
+ */
213
+ doclingObjectKey?: string;
214
+ /**
215
+ * SHA-256 hash of the Docling JSON artifact
216
+ * @type {string}
217
+ */
218
+ doclingSha256?: string;
219
+ /**
220
+ * Object key for a handoff manifest that describes related processing outputs
221
+ * @type {string}
222
+ */
223
+ handoffManifestObjectKey?: string;
224
+ }
194
225
  /**
195
226
  * Text block (paragraph, sentence, etc.)
196
227
  *
@@ -199,6 +230,16 @@ interface PageRange {
199
230
  * @interface TextBlock
200
231
  */
201
232
  interface TextBlock {
233
+ /**
234
+ * Stable identifier of the text block
235
+ * @type {string}
236
+ */
237
+ id?: string;
238
+ /**
239
+ * Docling self reference for the source text item
240
+ * @type {string}
241
+ */
242
+ sourceRef?: string;
202
243
  /**
203
244
  * Content of the text block
204
245
  * @type {string}
@@ -248,6 +289,11 @@ interface Chapter {
248
289
  * @type {number}
249
290
  */
250
291
  level: number;
292
+ /**
293
+ * Docling references for the source nodes used to derive the chapter title
294
+ * @type {string[]}
295
+ */
296
+ sourceRefs?: string[];
251
297
  /**
252
298
  * Text blocks inside the chapter
253
299
  *
@@ -303,6 +349,16 @@ interface ProcessedImage {
303
349
  * @type {string}
304
350
  */
305
351
  id: string;
352
+ /**
353
+ * Docling self reference for the source picture item
354
+ * @type {string}
355
+ */
356
+ sourceRef?: string;
357
+ /**
358
+ * Docling references for caption text items associated with this image
359
+ * @type {string[]}
360
+ */
361
+ captionSourceRefs?: string[];
306
362
  /**
307
363
  * Caption information for the image (if available)
308
364
  * @type {Caption}
@@ -325,6 +381,10 @@ interface ProcessedImage {
325
381
  /**
326
382
  * Cell information of a table
327
383
  *
384
+ * Table cells intentionally do not carry cell-level Docling source references.
385
+ * Use the parent table's `sourceRef` with the row/column index in `grid` as
386
+ * the locator for cell provenance.
387
+ *
328
388
  * @interface ProcessedTableCell
329
389
  */
330
390
  interface ProcessedTableCell {
@@ -366,6 +426,16 @@ interface ProcessedTable {
366
426
  * @type {string}
367
427
  */
368
428
  id: string;
429
+ /**
430
+ * Docling self reference for the source table item
431
+ * @type {string}
432
+ */
433
+ sourceRef?: string;
434
+ /**
435
+ * Docling references for caption text items associated with this table
436
+ * @type {string[]}
437
+ */
438
+ captionSourceRefs?: string[];
369
439
  /**
370
440
  * Caption information for the table (if available)
371
441
  * @type {Caption}
@@ -389,7 +459,9 @@ interface ProcessedTable {
389
459
  /**
390
460
  * Table data (2D array)
391
461
  *
392
- * Access using grid[row][col].
462
+ * Access using grid[row][col]. For source lookup, combine `sourceRef` with
463
+ * the row and column indexes because processed cells do not store cell-level
464
+ * source references.
393
465
  *
394
466
  * @type {ProcessedTableCell[][]}
395
467
  */
@@ -412,6 +484,11 @@ interface ProcessedFootnote {
412
484
  * @type {string}
413
485
  */
414
486
  id: string;
487
+ /**
488
+ * Docling self reference for the source footnote text item
489
+ * @type {string}
490
+ */
491
+ sourceRef?: string;
415
492
  /**
416
493
  * Text content of the footnote
417
494
  *
@@ -438,6 +515,16 @@ interface ProcessedDocument {
438
515
  * @type {string}
439
516
  */
440
517
  reportId: string;
518
+ /**
519
+ * Processed document schema version
520
+ * @type {string}
521
+ */
522
+ schemaVersion?: string;
523
+ /**
524
+ * Source artifact metadata for the Docling artifact used to produce this document
525
+ * @type {ProcessedDocumentSource}
526
+ */
527
+ source?: ProcessedDocumentSource;
441
528
  /**
442
529
  * Mapping of page ranges for actual document pages per PDF page
443
530
  *
@@ -741,7 +828,7 @@ interface DocumentProcessResult {
741
828
  /**
742
829
  * Result of the OCR strategy sampling phase.
743
830
  * Determines whether to use ocrmac (standard Docling pipeline)
744
- * or VLM (direct vision language model processing) for a given document.
831
+ * or VLM text correction for a given document.
745
832
  */
746
833
  interface OcrStrategy {
747
834
  /** Selected OCR method */
@@ -756,8 +843,6 @@ interface OcrStrategy {
756
843
  sampledPages: number;
757
844
  /** Total number of pages in the document */
758
845
  totalPages: number;
759
- /** 1-based page numbers where Korean-Hanja mixed script was detected in text layer */
760
- koreanHanjaMixPages?: number[];
761
846
  }
762
847
 
763
848
  type ReviewAssistanceReportSchemaName = 'HeripoReviewAssistanceReport';
@@ -950,4 +1035,4 @@ interface ReviewAssistanceProgressEvent {
950
1035
  message?: string;
951
1036
  }
952
1037
 
953
- export { BCP47_LANGUAGE_TAGS, BCP47_LANGUAGE_TAG_SET, type Bcp47LanguageTag, type Caption, type Chapter, type ComponentUsageReport, type DoclingBBox, type DoclingBaseNode, type DoclingBody, type DoclingDocument, type DoclingGroupItem, type DoclingOrigin, type DoclingPage, type DoclingPageImage, type DoclingPictureItem, type DoclingProv, type DoclingReference, type DoclingTableCell, type DoclingTableData, type DoclingTableItem, type DoclingTextItem, type DocumentProcessResult, LANGUAGE_DISPLAY_NAMES, type ModelUsageDetail, type OcrStrategy, type PageRange, type PhaseUsageReport, type ProcessedDocument, type ProcessedFootnote, type ProcessedImage, type ProcessedTable, type ProcessedTableCell, type ReviewAssistanceCommand, type ReviewAssistanceDecision, type ReviewAssistanceDecisionEvidence, type ReviewAssistanceDisposition, type ReviewAssistanceFailurePolicy, type ReviewAssistanceImageRegion, type ReviewAssistanceIssue, type ReviewAssistanceIssueCategory, type ReviewAssistanceIssueSeverity, type ReviewAssistancePageResult, type ReviewAssistancePageStatus, type ReviewAssistanceProgressEvent, type ReviewAssistanceProgressStatus, type ReviewAssistanceProgressSubstage, type ReviewAssistanceReport, type ReviewAssistanceReportSchemaName, type ReviewAssistanceReportVersion, type ReviewAssistanceTableCell, type TextBlock, type TokenUsageMetadata, type TokenUsageMetadataValue, type TokenUsageReport, type TokenUsageSummary, buildLanguageDescription, getLanguageDisplayName, isValidBcp47Tag, normalizeToBcp47 };
1038
+ export { BCP47_LANGUAGE_TAGS, BCP47_LANGUAGE_TAG_SET, type Bcp47LanguageTag, type Caption, type Chapter, type ComponentUsageReport, type DoclingBBox, type DoclingBaseNode, type DoclingBody, type DoclingDocument, type DoclingGroupItem, type DoclingOrigin, type DoclingPage, type DoclingPageImage, type DoclingPictureItem, type DoclingProv, type DoclingReference, type DoclingTableCell, type DoclingTableData, type DoclingTableItem, type DoclingTextItem, type DocumentProcessResult, LANGUAGE_DISPLAY_NAMES, type ModelUsageDetail, type OcrStrategy, type PageRange, type PhaseUsageReport, type ProcessedDocument, type ProcessedDocumentSource, type ProcessedFootnote, type ProcessedImage, type ProcessedTable, type ProcessedTableCell, type ReviewAssistanceCommand, type ReviewAssistanceDecision, type ReviewAssistanceDecisionEvidence, type ReviewAssistanceDisposition, type ReviewAssistanceFailurePolicy, type ReviewAssistanceImageRegion, type ReviewAssistanceIssue, type ReviewAssistanceIssueCategory, type ReviewAssistanceIssueSeverity, type ReviewAssistancePageResult, type ReviewAssistancePageStatus, type ReviewAssistanceProgressEvent, type ReviewAssistanceProgressStatus, type ReviewAssistanceProgressSubstage, type ReviewAssistanceReport, type ReviewAssistanceReportSchemaName, type ReviewAssistanceReportVersion, type ReviewAssistanceTableCell, type TextBlock, type TokenUsageMetadata, type TokenUsageMetadataValue, type TokenUsageReport, type TokenUsageSummary, buildLanguageDescription, getLanguageDisplayName, isValidBcp47Tag, normalizeToBcp47 };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@heripo/model",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.1.27",
5
+ "version": "0.1.29",
6
6
  "description": "Document models and type definitions for heripo engine",
7
7
  "main": "dist/index.cjs",
8
8
  "module": "dist/index.js",
@@ -56,8 +56,8 @@
56
56
  "tsup": "^8.5.1",
57
57
  "vitest": "^4.1.5",
58
58
  "@heripo/tsconfig": "0.0.0",
59
- "@heripo/vitest-config": "0.0.0",
60
- "@heripo/tsup-config": "0.0.0"
59
+ "@heripo/tsup-config": "0.0.0",
60
+ "@heripo/vitest-config": "0.0.0"
61
61
  },
62
62
  "scripts": {
63
63
  "clean": "rimraf dist",