@heripo/model 0.1.44 → 0.1.46

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
@@ -35,6 +35,8 @@ ProcessedDocument (LLM 최적화 중간 모델)
35
35
 
36
36
  `@heripo/model`은 현재 PDF 파싱 및 문서 구조 추출 단계에서 사용되는 데이터 모델을 정의합니다. 향후 고고학 데이터 분석, 표준화, 시맨틱 모델링 등 다양한 분야별 모델이 추가될 예정입니다.
37
37
 
38
+ Node.js 24 이상을 대상으로 하며 ESM과 CommonJS를 모두 제공합니다. 문서 인터페이스는 `import type`으로 가져오고, 언어 유틸리티는 일반 import로 사용하세요. JSON 파싱 결과를 타입 단언하는 것만으로 런타임 검증이 되지는 않습니다.
39
+
38
40
  ## 설치
39
41
 
40
42
  ```bash
@@ -66,6 +68,8 @@ import type { DoclingDocument } from '@heripo/model';
66
68
  - `texts`, `pictures`, `tables`: 추출된 content node
67
69
  - `pages`: 페이지 metadata와 렌더링된 페이지 이미지 참조
68
70
 
71
+ `DoclingReference.$ref`와 각 노드의 `self_ref`로 원천 노드를 연결합니다. `DoclingProv.page_no`와 처리 모델의 `pdfPageNo`는 1부터 시작하지만 렌더링 파일은 `pages/page_0.png`부터 시작합니다. `Chapter.pageNo`와 `PageRange`는 인쇄된 문서의 논리 페이지 번호이므로 PDF 페이지 번호와 구분하세요. `DoclingBBox.coord_origin`을 확인한 뒤 좌표를 해석해야 합니다.
72
+
69
73
  ### ProcessedDocument
70
74
 
71
75
  LLM 분석에 최적화된 중간 데이터 모델입니다.
@@ -175,9 +179,9 @@ interface ProcessedTable {
175
179
 
176
180
  `grid`는 화면에 보이는 셀만 담은 compact list입니다. 병합 셀은
177
181
  `rowSpan`, `colSpan`으로 표현하고, span으로 덮인 shadow cell은 포함하지
178
- 않습니다. 테이블 셀에는 의도적으로 cell-level `sourceRef`가 없습니다. 셀을
179
- 원천 테이블로 추적할 때는 `table.sourceRef`와 `grid[row][col]` 위치를 함께
180
- 사용합니다.
182
+ 않습니다. 테이블 셀에는 의도적으로 cell-level `sourceRef`가 없습니다.
183
+ `table.sourceRef`로 원천 표를 찾은 뒤 셀의 span과 원본 좌표를 대조하세요.
184
+ 압축 배열의 인덱스는 원천 표의 논리적 열 번호와 다를 수 있습니다.
181
185
 
182
186
  ### ProcessedTableCell
183
187
 
@@ -202,7 +206,7 @@ interface ProcessedTableCell {
202
206
  import type { Caption } from '@heripo/model';
203
207
 
204
208
  interface Caption {
205
- num?: string; // 캡션 번호 (예: "그림 1"의 "1")
209
+ num?: string; // Caption prefix and number (e.g., "Figure 1")
206
210
  fullText: string; // 전체 캡션 텍스트
207
211
  }
208
212
  ```
@@ -250,7 +254,7 @@ interface DocumentProcessResult {
250
254
 
251
255
  ### OcrStrategy
252
256
 
253
- OCR 전략 선택 결과입니다.
257
+ OCR 전략 데이터를 표현하는 기존 타입입니다. 현재 PDF 파서는 고정 ocrmac과 후속 보정을 사용하며 이 전략을 선택하거나 반환하지 않습니다.
254
258
 
255
259
  ```typescript
256
260
  import type { OcrStrategy } from '@heripo/model';
@@ -274,6 +278,7 @@ import type {
274
278
  ComponentUsageReport,
275
279
  ModelUsageDetail,
276
280
  PhaseUsageReport,
281
+ TokenUsageMetadata,
277
282
  TokenUsageReport,
278
283
  TokenUsageSummary,
279
284
  } from '@heripo/model';
@@ -290,6 +295,7 @@ interface ComponentUsageReport {
290
295
  }
291
296
 
292
297
  interface PhaseUsageReport {
298
+ metadata?: TokenUsageMetadata[]; // Per-call context
293
299
  phase: string; // 단계 이름
294
300
  primary?: ModelUsageDetail; // 기본 모델 사용량
295
301
  fallback?: ModelUsageDetail; // 폴백 모델 사용량
@@ -301,94 +307,66 @@ interface ModelUsageDetail {
301
307
  inputTokens: number; // 입력 토큰 수
302
308
  outputTokens: number; // 출력 토큰 수
303
309
  totalTokens: number; // 전체 토큰 수
310
+ cachedInputTokens?: number | null; // 캐시 읽기 토큰
311
+ cacheWriteTokens?: number | null; // 기본 기간 캐시 쓰기 토큰
312
+ cacheWrite1hTokens?: number | null; // 1시간 캐시 쓰기 토큰
304
313
  }
305
314
 
306
315
  interface TokenUsageSummary {
307
316
  inputTokens: number; // 입력 토큰 수
308
317
  outputTokens: number; // 출력 토큰 수
309
318
  totalTokens: number; // 전체 토큰 수
319
+ cachedInputTokens?: number | null; // 합산된 캐시 읽기 토큰
320
+ cacheWriteTokens?: number | null; // 합산된 기본 기간 캐시 쓰기 토큰
321
+ cacheWrite1hTokens?: number | null; // 합산된 1시간 캐시 쓰기 토큰
310
322
  }
311
323
  ```
312
324
 
313
- ### Review Assistance 타입
325
+ 캐시 토큰은 `inputTokens`에 포함된 부분집합이며 추가 토큰이 아닙니다. 필드가 없거나 `null`이면 제공자가 완전한 값을 보고하지 않은 것이고, `0`은 사용량이 없다고 보고한 값입니다.
314
326
 
315
- `@heripo/pdf-parser`에서 `reviewAssistance`를 활성화했을 때 생성되는 선택적
316
- page-level review assistance 결과 타입입니다.
327
+ ### Review Assistance 타입
317
328
 
318
- ```typescript
319
- import type {
320
- ReviewAssistanceDecision,
321
- ReviewAssistanceIssue,
322
- ReviewAssistanceProgressEvent,
323
- ReviewAssistanceReport,
324
- } from '@heripo/model';
329
+ `correction.reviewAssistanceEnabled: true`일 때(파서 기본값) 생성하는 별도 감사 리포트입니다. `ProcessedDocument` 안에 포함되지 않습니다. [전체 타입 정의](./src/types/review-assistance.ts)는 명령, 근거, 이슈, 실행 추적 및 진행 이벤트를 제공합니다.
325
330
 
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
- }
331
+ 리포트의 필수 필드는 `schemaName`, `version`, `reportId`, `source`, `options`, `summary`, `pages`, `callTraces`입니다. 검증에서 거부된 결정은 `command`가 없고 `invalidOp`만 있을 수 있으므로 먼저 확인하세요.
351
332
 
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;
333
+ ```typescript
334
+ import type { ReviewAssistanceReport } from '@heripo/model';
335
+
336
+ function summarizeReview(report: ReviewAssistanceReport) {
337
+ for (const page of report.pages) {
338
+ for (const decision of page.decisions) {
339
+ console.log(
340
+ page.pageNo,
341
+ decision.command?.op ?? decision.invalidOp,
342
+ decision.disposition,
343
+ );
344
+ }
345
+ }
346
+ console.log(report.summary, report.callTraces);
362
347
  }
363
348
  ```
364
349
 
365
350
  ### BCP-47 언어 태그 유틸리티
366
351
 
367
- BCP-47 언어 태그를 다루기 위한 유틸리티입니다.
352
+ 언어 코드는 지원 목록에 대해 검증·정규화합니다. 일반 BCP-47 문법 전체를 검증하는 함수는 아닙니다. 표시 이름 유틸리티도 런타임 export입니다.
368
353
 
369
354
  ```typescript
370
355
  import {
371
- type Bcp47LanguageTag,
372
356
  BCP47_LANGUAGE_TAGS,
373
357
  BCP47_LANGUAGE_TAG_SET,
358
+ LANGUAGE_DISPLAY_NAMES,
359
+ buildLanguageDescription,
360
+ getLanguageDisplayName,
374
361
  isValidBcp47Tag,
375
362
  normalizeToBcp47,
376
363
  } from '@heripo/model';
377
364
 
378
- // Bcp47LanguageTag - 지원되는 전체 BCP-47 언어 태그의 유니온 타입
379
- type Bcp47LanguageTag = (typeof BCP47_LANGUAGE_TAGS)[number];
380
-
381
- // BCP47_LANGUAGE_TAGS - ocrmac에서 지원하는 언어 태그 상수 배열
382
- const BCP47_LANGUAGE_TAGS: readonly Bcp47LanguageTag[];
383
-
384
- // BCP47_LANGUAGE_TAG_SET - O(1) 조회를 위한 ReadonlySet
385
- const BCP47_LANGUAGE_TAG_SET: ReadonlySet<string>;
386
-
387
- // isValidBcp47Tag - 문자열이 유효한 BCP-47 태그인지 확인
388
- function isValidBcp47Tag(tag: string): tag is Bcp47LanguageTag;
389
-
390
- // normalizeToBcp47 - 언어 문자열을 BCP-47 형식으로 정규화
391
- function normalizeToBcp47(tag: string): Bcp47LanguageTag | null;
365
+ console.log(normalizeToBcp47('ko')); // 'ko-KR'
366
+ console.log(isValidBcp47Tag('ko-KR')); // true
367
+ console.log(BCP47_LANGUAGE_TAGS.length, BCP47_LANGUAGE_TAG_SET.has('ko-KR'));
368
+ console.log(LANGUAGE_DISPLAY_NAMES.ko, getLanguageDisplayName('ko-KR'));
369
+ console.log(buildLanguageDescription(['ko-KR', 'en-US']));
392
370
  ```
393
371
 
394
372
  ## 사용법
@@ -452,11 +430,11 @@ doc.chapters.forEach((chapter) => traverseChapters(chapter));
452
430
  ### 타입 가드
453
431
 
454
432
  ```typescript
455
- import type { ProcessedImage, ProcessedTable } from '@heripo/model';
433
+ import type { Caption, ProcessedImage, ProcessedTable } from '@heripo/model';
456
434
 
457
435
  function hasCaption(
458
436
  resource: ProcessedImage | ProcessedTable,
459
- ): resource is ProcessedImage | ProcessedTable {
437
+ ): resource is (ProcessedImage | ProcessedTable) & { caption: Caption } {
460
438
  return resource.caption !== undefined;
461
439
  }
462
440
 
@@ -466,8 +444,8 @@ const resourcesWithCaptions = [...doc.images, ...doc.tables].filter(hasCaption);
466
444
 
467
445
  ## 관련 패키지
468
446
 
469
- - [@heripo/pdf-parser](../pdf-parser) - PDF 파싱 및 OCR
470
- - [@heripo/document-processor](../document-processor) - 문서 구조 분석
447
+ - [@heripo/pdf-parser](../pdf-parser/README.ko.md) - PDF 파싱 및 OCR
448
+ - [@heripo/document-processor](../document-processor/README.ko.md) - 문서 구조 분석
471
449
 
472
450
  ## 후원
473
451
 
@@ -482,7 +460,7 @@ heripo lab의 오픈소스 연구를 후원하려면 다음 경로를 이용할
482
460
 
483
461
  ## 기여하기
484
462
 
485
- 기여는 언제나 환영합니다! [기여 가이드](../../CONTRIBUTING.ko.md)를 참고하세요.
463
+ 기여는 언제나 환영합니다! [기여 가이드](../../CONTRIBUTING.md)를 참고하세요.
486
464
 
487
465
  ## 프로젝트 전체 정보
488
466
 
package/README.md CHANGED
@@ -35,6 +35,8 @@ ProcessedDocument (LLM-optimized intermediate model)
35
35
 
36
36
  `@heripo/model` defines data models currently used in the PDF parsing and document structure extraction stages. Various domain-specific models for archaeological data analysis, standardization, semantic modeling, etc. will be added in the future.
37
37
 
38
+ Targets Node.js 24+ with ESM and CommonJS entry points. Use `import type` for document interfaces and ordinary imports for language utilities. A TypeScript assertion on parsed JSON does not perform runtime validation.
39
+
38
40
  ## Installation
39
41
 
40
42
  ```bash
@@ -66,6 +68,8 @@ import type { DoclingDocument } from '@heripo/model';
66
68
  - `texts`, `pictures`, `tables`: Extracted content nodes
67
69
  - `pages`: Page metadata and rendered page image references
68
70
 
71
+ `DoclingReference.$ref` and node `self_ref` values link source nodes. `DoclingProv.page_no` and processed `pdfPageNo` are one-based, while rendered files start at `pages/page_0.png`. `Chapter.pageNo` and `PageRange` refer to logical printed page numbers, which can differ from PDF page numbers. Interpret bounding boxes using their `DoclingBBox.coord_origin`.
72
+
69
73
  ### ProcessedDocument
70
74
 
71
75
  Intermediate data model optimized for LLM analysis.
@@ -175,9 +179,9 @@ interface ProcessedTable {
175
179
 
176
180
  `grid` is a compact list of visible cells. Merged cells are represented with
177
181
  `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.
182
+ Cells have no individual `sourceRef`. Locate the source table using
183
+ `table.sourceRef`, then compare cell spans and original coordinates. Compact
184
+ array indexes need not equal logical source column indexes.
181
185
 
182
186
  ### ProcessedTableCell
183
187
 
@@ -202,7 +206,7 @@ Image and table captions.
202
206
  import type { Caption } from '@heripo/model';
203
207
 
204
208
  interface Caption {
205
- num?: string; // Caption number (e.g., "1" in "Figure 1")
209
+ num?: string; // Caption prefix and number (e.g., "Figure 1")
206
210
  fullText: string; // Full caption text
207
211
  }
208
212
  ```
@@ -250,7 +254,8 @@ interface DocumentProcessResult {
250
254
 
251
255
  ### OcrStrategy
252
256
 
253
- OCR strategy selection result.
257
+ Retained type for OCR strategy data. The current PDF parser uses fixed ocrmac
258
+ plus post-Docling correction; it no longer returns or selects this strategy.
254
259
 
255
260
  ```typescript
256
261
  import type { OcrStrategy } from '@heripo/model';
@@ -274,6 +279,7 @@ import type {
274
279
  ComponentUsageReport,
275
280
  ModelUsageDetail,
276
281
  PhaseUsageReport,
282
+ TokenUsageMetadata,
277
283
  TokenUsageReport,
278
284
  TokenUsageSummary,
279
285
  } from '@heripo/model';
@@ -290,6 +296,7 @@ interface ComponentUsageReport {
290
296
  }
291
297
 
292
298
  interface PhaseUsageReport {
299
+ metadata?: TokenUsageMetadata[]; // Per-call context
293
300
  phase: string; // Phase name
294
301
  primary?: ModelUsageDetail; // Primary model usage
295
302
  fallback?: ModelUsageDetail; // Fallback model usage
@@ -301,94 +308,66 @@ interface ModelUsageDetail {
301
308
  inputTokens: number; // Input token count
302
309
  outputTokens: number; // Output token count
303
310
  totalTokens: number; // Total token count
311
+ cachedInputTokens?: number | null; // Cache reads
312
+ cacheWriteTokens?: number | null; // Default-duration cache writes
313
+ cacheWrite1hTokens?: number | null; // One-hour cache writes
304
314
  }
305
315
 
306
316
  interface TokenUsageSummary {
307
317
  inputTokens: number; // Input token count
308
318
  outputTokens: number; // Output token count
309
319
  totalTokens: number; // Total token count
320
+ cachedInputTokens?: number | null; // Cache reads across contributing calls
321
+ cacheWriteTokens?: number | null; // Default-duration cache writes
322
+ cacheWrite1hTokens?: number | null; // One-hour cache writes
310
323
  }
311
324
  ```
312
325
 
313
- ### Review Assistance Types
326
+ Cache counts are subsets of `inputTokens`, not additional tokens. Missing fields or `null` mean the provider did not report a complete count; `0` means it reported zero.
314
327
 
315
- Types for optional page-level review assistance generated by
316
- `@heripo/pdf-parser` when `reviewAssistance` is enabled.
328
+ ### Review Assistance Types
317
329
 
318
- ```typescript
319
- import type {
320
- ReviewAssistanceDecision,
321
- ReviewAssistanceIssue,
322
- ReviewAssistanceProgressEvent,
323
- ReviewAssistanceReport,
324
- } from '@heripo/model';
330
+ A separate audit report is produced when `correction.reviewAssistanceEnabled` is true (the parser default). It is not embedded in `ProcessedDocument`. The [complete type definitions](./src/types/review-assistance.ts) cover commands, evidence, issues, call traces and progress events.
325
331
 
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
- }
332
+ Required report fields are `schemaName`, `version`, `reportId`, `source`, `options`, `summary`, `pages` and `callTraces`. A rejected decision may have `invalidOp` and no `command`; check before accessing it.
351
333
 
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;
334
+ ```typescript
335
+ import type { ReviewAssistanceReport } from '@heripo/model';
336
+
337
+ function summarizeReview(report: ReviewAssistanceReport) {
338
+ for (const page of report.pages) {
339
+ for (const decision of page.decisions) {
340
+ console.log(
341
+ page.pageNo,
342
+ decision.command?.op ?? decision.invalidOp,
343
+ decision.disposition,
344
+ );
345
+ }
346
+ }
347
+ console.log(report.summary, report.callTraces);
362
348
  }
363
349
  ```
364
350
 
365
351
  ### BCP-47 Language Tag Utilities
366
352
 
367
- Utilities for working with BCP-47 language tags.
353
+ Language validation and normalization use the supported tag list; these are not general BCP-47 syntax validators. Display-name helpers are also runtime exports.
368
354
 
369
355
  ```typescript
370
356
  import {
371
- type Bcp47LanguageTag,
372
357
  BCP47_LANGUAGE_TAGS,
373
358
  BCP47_LANGUAGE_TAG_SET,
359
+ LANGUAGE_DISPLAY_NAMES,
360
+ buildLanguageDescription,
361
+ getLanguageDisplayName,
374
362
  isValidBcp47Tag,
375
363
  normalizeToBcp47,
376
364
  } from '@heripo/model';
377
365
 
378
- // Bcp47LanguageTag - Union type of supported full BCP-47 language tags
379
- type Bcp47LanguageTag = (typeof BCP47_LANGUAGE_TAGS)[number];
380
-
381
- // BCP47_LANGUAGE_TAGS - Const array of supported ocrmac language tags
382
- const BCP47_LANGUAGE_TAGS: readonly Bcp47LanguageTag[];
383
-
384
- // BCP47_LANGUAGE_TAG_SET - ReadonlySet for O(1) lookup
385
- const BCP47_LANGUAGE_TAG_SET: ReadonlySet<string>;
386
-
387
- // isValidBcp47Tag - Check if a string is a valid BCP-47 tag
388
- function isValidBcp47Tag(tag: string): tag is Bcp47LanguageTag;
389
-
390
- // normalizeToBcp47 - Normalize a language string to BCP-47 format
391
- function normalizeToBcp47(tag: string): Bcp47LanguageTag | null;
366
+ console.log(normalizeToBcp47('ko')); // 'ko-KR'
367
+ console.log(isValidBcp47Tag('ko-KR')); // true
368
+ console.log(BCP47_LANGUAGE_TAGS.length, BCP47_LANGUAGE_TAG_SET.has('ko-KR'));
369
+ console.log(LANGUAGE_DISPLAY_NAMES.ko, getLanguageDisplayName('ko-KR'));
370
+ console.log(buildLanguageDescription(['ko-KR', 'en-US']));
392
371
  ```
393
372
 
394
373
  ## Usage
@@ -452,11 +431,11 @@ doc.chapters.forEach((chapter) => traverseChapters(chapter));
452
431
  ### Type Guards
453
432
 
454
433
  ```typescript
455
- import type { ProcessedImage, ProcessedTable } from '@heripo/model';
434
+ import type { Caption, ProcessedImage, ProcessedTable } from '@heripo/model';
456
435
 
457
436
  function hasCaption(
458
437
  resource: ProcessedImage | ProcessedTable,
459
- ): resource is ProcessedImage | ProcessedTable {
438
+ ): resource is (ProcessedImage | ProcessedTable) & { caption: Caption } {
460
439
  return resource.caption !== undefined;
461
440
  }
462
441
 
@@ -466,8 +445,8 @@ const resourcesWithCaptions = [...doc.images, ...doc.tables].filter(hasCaption);
466
445
 
467
446
  ## Related Packages
468
447
 
469
- - [@heripo/pdf-parser](../pdf-parser) - PDF parsing and OCR
470
- - [@heripo/document-processor](../document-processor) - Document structure analysis
448
+ - [@heripo/pdf-parser](../pdf-parser/README.md) - PDF parsing and OCR
449
+ - [@heripo/document-processor](../document-processor/README.md) - Document structure analysis
471
450
 
472
451
  ## Sponsor
473
452
 
package/dist/index.d.cts CHANGED
@@ -774,6 +774,12 @@ interface ModelUsageDetail {
774
774
  * Always equals inputTokens + outputTokens.
775
775
  */
776
776
  totalTokens: number;
777
+ /** Cached input tokens reported by the provider; null means unreported. */
778
+ cachedInputTokens?: number | null;
779
+ /** Cache creation tokens at the default duration; null means unreported. */
780
+ cacheWriteTokens?: number | null;
781
+ /** Cache creation tokens at the one-hour duration; null means unreported. */
782
+ cacheWrite1hTokens?: number | null;
777
783
  }
778
784
  /**
779
785
  * Summary of token usage
@@ -793,6 +799,12 @@ interface TokenUsageSummary {
793
799
  * Total tokens (input + output)
794
800
  */
795
801
  totalTokens: number;
802
+ /** Cached input tokens, when reported for every contributing call. */
803
+ cachedInputTokens?: number | null;
804
+ /** Default-duration cache writes, when reported for every contributing call. */
805
+ cacheWriteTokens?: number | null;
806
+ /** One-hour cache writes, when reported for every contributing call. */
807
+ cacheWrite1hTokens?: number | null;
796
808
  }
797
809
  type TokenUsageMetadataValue = string | number | boolean | null;
798
810
  type TokenUsageMetadata = Record<string, TokenUsageMetadataValue>;
package/dist/index.d.ts CHANGED
@@ -774,6 +774,12 @@ interface ModelUsageDetail {
774
774
  * Always equals inputTokens + outputTokens.
775
775
  */
776
776
  totalTokens: number;
777
+ /** Cached input tokens reported by the provider; null means unreported. */
778
+ cachedInputTokens?: number | null;
779
+ /** Cache creation tokens at the default duration; null means unreported. */
780
+ cacheWriteTokens?: number | null;
781
+ /** Cache creation tokens at the one-hour duration; null means unreported. */
782
+ cacheWrite1hTokens?: number | null;
777
783
  }
778
784
  /**
779
785
  * Summary of token usage
@@ -793,6 +799,12 @@ interface TokenUsageSummary {
793
799
  * Total tokens (input + output)
794
800
  */
795
801
  totalTokens: number;
802
+ /** Cached input tokens, when reported for every contributing call. */
803
+ cachedInputTokens?: number | null;
804
+ /** Default-duration cache writes, when reported for every contributing call. */
805
+ cacheWriteTokens?: number | null;
806
+ /** One-hour cache writes, when reported for every contributing call. */
807
+ cacheWrite1hTokens?: number | null;
796
808
  }
797
809
  type TokenUsageMetadataValue = string | number | boolean | null;
798
810
  type TokenUsageMetadata = Record<string, TokenUsageMetadataValue>;
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.44",
5
+ "version": "0.1.46",
6
6
  "description": "Document models and type definitions for heripo engine",
7
7
  "main": "dist/index.cjs",
8
8
  "module": "dist/index.js",
@@ -55,9 +55,9 @@
55
55
  "@heripo/tsconfig": "0.0.0",
56
56
  "@heripo/tsup-config": "0.0.0",
57
57
  "@heripo/vitest-config": "0.0.0",
58
- "@vitest/coverage-v8": "^5.0.0",
58
+ "@vitest/coverage-v8": "^5.0.1",
59
59
  "tsup": "^8.5.1",
60
- "vitest": "^5.0.0"
60
+ "vitest": "^5.0.1"
61
61
  },
62
62
  "scripts": {
63
63
  "clean": "rimraf dist",