@oneharness/sdk 0.6.6 → 0.6.8

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.
@@ -4,7 +4,25 @@
4
4
  * `history_id` remains the resumable cursor.
5
5
  */
6
6
  export type HistoryStreamEnvelope = {
7
- record: HistoryRecord;
7
+ /**
8
+ * One harness run, normalized and frozen for the history log. Serialized as one
9
+ * JSONL line per harness run, appended as the run finalizes. Carries only the
10
+ * normalized cross-harness signals — no raw stdout/stderr.
11
+ */
12
+ record: ({
13
+ error?: null | undefined;
14
+ [k: string]: unknown;
15
+ } | ({
16
+ error: string;
17
+ schema_version?: "1.3" | undefined;
18
+ [k: string]: unknown;
19
+ } & ({
20
+ status?: "nonzero" | "timeout" | "spawn-error" | "skipped" | undefined;
21
+ [k: string]: unknown;
22
+ } | {
23
+ failure_kind: "tool_deferred";
24
+ [k: string]: unknown;
25
+ }))) & HistoryRecord;
8
26
  type: "record";
9
27
  [k: string]: unknown;
10
28
  } | {
@@ -12,13 +30,22 @@ export type HistoryStreamEnvelope = {
12
30
  type: "event";
13
31
  [k: string]: unknown;
14
32
  };
15
- /**
16
- * One harness run, normalized and frozen for the history log. Serialized as one
17
- * JSONL line per harness run, appended as the run finalizes. Carries only the
18
- * normalized cross-harness signals — no raw stdout/stderr.
19
- */
20
33
  export type HistoryRecord = {
21
34
  duration_ms: number;
35
+ /**
36
+ * Best-effort normalized failure text for a run that did not succeed: the
37
+ * harness's own diagnostic as oneharness captured it on stderr, or
38
+ * oneharness's own message when it generated one (a spawn failure, a
39
+ * timeout, a binary that is not installed). This is the *only* place a
40
+ * record quotes the process's own bytes, and it is deliberately narrow —
41
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
42
+ * that failed. `failure_kind` says what class of failure it was; this says
43
+ * what the harness actually reported, which is what an operator reads when
44
+ * the class is unclassified. Never derived from stdout, so it can never
45
+ * stand in for provider output the run did not produce. Omitted on the wire
46
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
47
+ */
48
+ error?: string | null | undefined;
22
49
  /**
23
50
  * Best-effort normalized tool-call events; `null` when the harness exposes
24
51
  * no machine-readable trace.
@@ -98,7 +125,7 @@ export type HistoryRecord = {
98
125
  * run's single prompt).
99
126
  */
100
127
  prompt: string;
101
- schema_version: "1.2";
128
+ schema_version: "1.2" | "1.3";
102
129
  /**
103
130
  * The oneharness session id this run belongs to (the history file's stem).
104
131
  */
@@ -128,6 +155,20 @@ export type HistoryRecord = {
128
155
  [k: string]: unknown;
129
156
  } | {
130
157
  duration_ms: number;
158
+ /**
159
+ * Best-effort normalized failure text for a run that did not succeed: the
160
+ * harness's own diagnostic as oneharness captured it on stderr, or
161
+ * oneharness's own message when it generated one (a spawn failure, a
162
+ * timeout, a binary that is not installed). This is the *only* place a
163
+ * record quotes the process's own bytes, and it is deliberately narrow —
164
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
165
+ * that failed. `failure_kind` says what class of failure it was; this says
166
+ * what the harness actually reported, which is what an operator reads when
167
+ * the class is unclassified. Never derived from stdout, so it can never
168
+ * stand in for provider output the run did not produce. Omitted on the wire
169
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
170
+ */
171
+ error?: string | null | undefined;
131
172
  /**
132
173
  * Best-effort normalized tool-call events; `null` when the harness exposes
133
174
  * no machine-readable trace.
@@ -210,7 +251,7 @@ export type HistoryRecord = {
210
251
  * run's single prompt).
211
252
  */
212
253
  prompt: string;
213
- schema_version: "1.1";
254
+ schema_version: "1.0" | "1.1";
214
255
  /**
215
256
  * The oneharness session id this run belongs to (the history file's stem).
216
257
  */
@@ -239,58 +280,50 @@ export type HistoryRecord = {
239
280
  variant?: string | null | undefined;
240
281
  [k: string]: unknown;
241
282
  } | {
242
- duration_ms: number;
283
+ duration_ms: number | null;
284
+ /**
285
+ * Best-effort normalized failure text for a run that did not succeed: the
286
+ * harness's own diagnostic as oneharness captured it on stderr, or
287
+ * oneharness's own message when it generated one (a spawn failure, a
288
+ * timeout, a binary that is not installed). This is the *only* place a
289
+ * record quotes the process's own bytes, and it is deliberately narrow —
290
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
291
+ * that failed. `failure_kind` says what class of failure it was; this says
292
+ * what the harness actually reported, which is what an operator reads when
293
+ * the class is unclassified. Never derived from stdout, so it can never
294
+ * stand in for provider output the run did not produce. Omitted on the wire
295
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
296
+ */
297
+ error?: string | null | undefined;
243
298
  /**
244
299
  * Best-effort normalized tool-call events; `null` when the harness exposes
245
300
  * no machine-readable trace.
246
301
  */
247
- events: (((ActionEvent & {
248
- duration_ms: number;
249
- finished_at: string;
250
- kind: "tool_call";
251
- started_at: string;
252
- status: "completed";
253
- tool_call_id: string;
254
- [k: string]: unknown;
255
- }) | (ActionEvent & {
256
- duration_ms: number;
257
- finished_at: string;
258
- kind: "tool_call";
259
- started_at: string;
260
- status: "failed";
261
- tool_call_id: string;
262
- [k: string]: unknown;
263
- }) | (ActionEvent & {
264
- kind: "tool_call";
265
- started_at: string;
266
- status: "timeout";
267
- tool_call_id: string;
268
- [k: string]: unknown;
269
- }) | (ActionEvent & {
270
- kind: "tool_call";
271
- started_at: string;
272
- status: "interrupted";
273
- tool_call_id: string;
274
- [k: string]: unknown;
275
- }) | (ActionEvent & {
276
- kind?: "tool_result" | undefined;
277
- [k: string]: unknown;
278
- })) & {
279
- timing_source?: never | undefined;
302
+ events: {
303
+ duration_ms?: null | undefined;
304
+ finished_at?: null | undefined;
305
+ index: number;
306
+ input: unknown;
307
+ kind: string;
308
+ name: string | null;
309
+ output: string | null;
310
+ started_at?: null | undefined;
311
+ status?: null | undefined;
312
+ tool_call_id?: string | null | undefined;
280
313
  [k: string]: unknown;
281
- })[] | null;
314
+ }[] | null;
282
315
  exit_code: number | null;
283
316
  /**
284
317
  * Best-effort classified failure reason (see [`FailureKind`]); `null` when
285
318
  * unclassified.
286
319
  */
287
320
  failure_kind: FailureKind | null;
288
- finished_at: string | null;
321
+ finished_at: null;
289
322
  /**
290
323
  * Canonical harness id (e.g. `claude-code`).
291
324
  */
292
325
  harness: string;
293
- harness_id?: string | undefined;
326
+ harness_id: string;
294
327
  /**
295
328
  * Globally unique, time-ordered record id. This is also the cursor accepted
296
329
  * by `history watch --after` and the exact id accepted by history lookup.
@@ -301,7 +334,7 @@ export type HistoryRecord = {
301
334
  * The effective top-level model for the run, if any.
302
335
  */
303
336
  model: string | null;
304
- model_ms: number;
337
+ model_ms?: never | undefined;
305
338
  /**
306
339
  * The human-meaningful session name (see [`session_name`]); repeated on
307
340
  * every record so a reader can resolve a session by name from any line.
@@ -322,7 +355,7 @@ export type HistoryRecord = {
322
355
  * run's single prompt).
323
356
  */
324
357
  prompt: string;
325
- schema_version: "1.0";
358
+ schema_version: "1.2" | "1.3";
326
359
  /**
327
360
  * The oneharness session id this run belongs to (the history file's stem).
328
361
  */
@@ -331,8 +364,8 @@ export type HistoryRecord = {
331
364
  * The harness's own continuation id, when it exposed one; `null` otherwise.
332
365
  */
333
366
  session_id: string | null;
334
- started_at: string;
335
- status: Status;
367
+ started_at?: never | undefined;
368
+ status: "ok" | "planned";
336
369
  /**
337
370
  * Best-effort final assistant text; `null` when extraction was impossible.
338
371
  */
@@ -341,34 +374,36 @@ export type HistoryRecord = {
341
374
  * How `text` was extracted; `null` when absent.
342
375
  */
343
376
  text_source: string | null;
344
- time_to_first_token_ms?: number | null | undefined;
377
+ time_to_first_token_ms?: never | undefined;
345
378
  /**
346
379
  * RFC3339 UTC instant the record was written (append time).
347
380
  */
348
381
  timestamp: string;
349
- tool_ms: number;
382
+ tool_ms?: never | undefined;
350
383
  usage: Usage2;
351
384
  variant?: string | null | undefined;
352
385
  [k: string]: unknown;
353
386
  } | {
354
- duration_ms: number | null;
387
+ duration_ms: number;
388
+ /**
389
+ * Best-effort normalized failure text for a run that did not succeed: the
390
+ * harness's own diagnostic as oneharness captured it on stderr, or
391
+ * oneharness's own message when it generated one (a spawn failure, a
392
+ * timeout, a binary that is not installed). This is the *only* place a
393
+ * record quotes the process's own bytes, and it is deliberately narrow —
394
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
395
+ * that failed. `failure_kind` says what class of failure it was; this says
396
+ * what the harness actually reported, which is what an operator reads when
397
+ * the class is unclassified. Never derived from stdout, so it can never
398
+ * stand in for provider output the run did not produce. Omitted on the wire
399
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
400
+ */
401
+ error?: string | null | undefined;
355
402
  /**
356
403
  * Best-effort normalized tool-call events; `null` when the harness exposes
357
404
  * no machine-readable trace.
358
405
  */
359
- events: {
360
- duration_ms?: null | undefined;
361
- finished_at?: null | undefined;
362
- index: number;
363
- input: unknown;
364
- kind: string;
365
- name: string | null;
366
- output: string | null;
367
- started_at?: null | undefined;
368
- status?: null | undefined;
369
- tool_call_id?: string | null | undefined;
370
- [k: string]: unknown;
371
- }[] | null;
406
+ events: ActionEvent[] | null;
372
407
  exit_code: number | null;
373
408
  /**
374
409
  * Best-effort classified failure reason (see [`FailureKind`]); `null` when
@@ -397,7 +432,7 @@ export type HistoryRecord = {
397
432
  * every record so a reader can resolve a session by name from any line.
398
433
  */
399
434
  name: string;
400
- observed_tool_ms?: never | undefined;
435
+ observed_tool_ms: number;
401
436
  /**
402
437
  * The normalized approval mode requested for the run.
403
438
  */
@@ -412,7 +447,7 @@ export type HistoryRecord = {
412
447
  * run's single prompt).
413
448
  */
414
449
  prompt: string;
415
- schema_version: "1.2";
450
+ schema_version: "1.2" | "1.3";
416
451
  /**
417
452
  * The oneharness session id this run belongs to (the history file's stem).
418
453
  */
@@ -441,7 +476,21 @@ export type HistoryRecord = {
441
476
  variant?: string | null | undefined;
442
477
  [k: string]: unknown;
443
478
  } | {
444
- duration_ms: number;
479
+ duration_ms: number | null;
480
+ /**
481
+ * Best-effort normalized failure text for a run that did not succeed: the
482
+ * harness's own diagnostic as oneharness captured it on stderr, or
483
+ * oneharness's own message when it generated one (a spawn failure, a
484
+ * timeout, a binary that is not installed). This is the *only* place a
485
+ * record quotes the process's own bytes, and it is deliberately narrow —
486
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
487
+ * that failed. `failure_kind` says what class of failure it was; this says
488
+ * what the harness actually reported, which is what an operator reads when
489
+ * the class is unclassified. Never derived from stdout, so it can never
490
+ * stand in for provider output the run did not produce. Omitted on the wire
491
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
492
+ */
493
+ error?: string | null | undefined;
445
494
  /**
446
495
  * Best-effort normalized tool-call events; `null` when the harness exposes
447
496
  * no machine-readable trace.
@@ -475,7 +524,7 @@ export type HistoryRecord = {
475
524
  * every record so a reader can resolve a session by name from any line.
476
525
  */
477
526
  name: string;
478
- observed_tool_ms: number;
527
+ observed_tool_ms?: never | undefined;
479
528
  /**
480
529
  * The normalized approval mode requested for the run.
481
530
  */
@@ -490,7 +539,7 @@ export type HistoryRecord = {
490
539
  * run's single prompt).
491
540
  */
492
541
  prompt: string;
493
- schema_version: "1.2";
542
+ schema_version: "1.2" | "1.3";
494
543
  /**
495
544
  * The oneharness session id this run belongs to (the history file's stem).
496
545
  */
@@ -500,7 +549,7 @@ export type HistoryRecord = {
500
549
  */
501
550
  session_id: string | null;
502
551
  started_at?: never | undefined;
503
- status: Status;
552
+ status: "nonzero" | "timeout" | "spawn-error" | "skipped";
504
553
  /**
505
554
  * Best-effort final assistant text; `null` when extraction was impossible.
506
555
  */
@@ -518,25 +567,119 @@ export type HistoryRecord = {
518
567
  usage: Usage4;
519
568
  variant?: string | null | undefined;
520
569
  [k: string]: unknown;
570
+ } | {
571
+ duration_ms: number;
572
+ /**
573
+ * Best-effort normalized failure text for a run that did not succeed: the
574
+ * harness's own diagnostic as oneharness captured it on stderr, or
575
+ * oneharness's own message when it generated one (a spawn failure, a
576
+ * timeout, a binary that is not installed). This is the *only* place a
577
+ * record quotes the process's own bytes, and it is deliberately narrow —
578
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
579
+ * that failed. `failure_kind` says what class of failure it was; this says
580
+ * what the harness actually reported, which is what an operator reads when
581
+ * the class is unclassified. Never derived from stdout, so it can never
582
+ * stand in for provider output the run did not produce. Omitted on the wire
583
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
584
+ */
585
+ error?: string | null | undefined;
586
+ /**
587
+ * Best-effort normalized tool-call events; `null` when the harness exposes
588
+ * no machine-readable trace.
589
+ */
590
+ events: ActionEvent[] | null;
591
+ exit_code: number | null;
592
+ /**
593
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
594
+ * unclassified.
595
+ */
596
+ failure_kind: FailureKind | null;
597
+ finished_at: null;
598
+ /**
599
+ * Canonical harness id (e.g. `claude-code`).
600
+ */
601
+ harness: string;
602
+ harness_id: string;
603
+ /**
604
+ * Globally unique, time-ordered record id. This is also the cursor accepted
605
+ * by `history watch --after` and the exact id accepted by history lookup.
606
+ */
607
+ history_id: string;
608
+ labels?: HistoryLabels5 | undefined;
609
+ /**
610
+ * The effective top-level model for the run, if any.
611
+ */
612
+ model: string | null;
613
+ model_ms?: never | undefined;
614
+ /**
615
+ * The human-meaningful session name (see [`session_name`]); repeated on
616
+ * every record so a reader can resolve a session by name from any line.
617
+ */
618
+ name: string;
619
+ observed_tool_ms?: never | undefined;
620
+ /**
621
+ * The normalized approval mode requested for the run.
622
+ */
623
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
624
+ /**
625
+ * The project directory the run operated in (the real path, not the
626
+ * on-disk slug), so the list view can show where a session ran.
627
+ */
628
+ project: string;
629
+ /**
630
+ * The prompt this harness run received (its own, on a batch run; else the
631
+ * run's single prompt).
632
+ */
633
+ prompt: string;
634
+ schema_version: "1.3";
635
+ /**
636
+ * The oneharness session id this run belongs to (the history file's stem).
637
+ */
638
+ session: string;
639
+ /**
640
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
641
+ */
642
+ session_id: string | null;
643
+ started_at: string;
644
+ status: "nonzero" | "timeout" | "spawn-error" | "skipped";
645
+ /**
646
+ * Best-effort final assistant text; `null` when extraction was impossible.
647
+ */
648
+ text: string | null;
649
+ /**
650
+ * How `text` was extracted; `null` when absent.
651
+ */
652
+ text_source: string | null;
653
+ time_to_first_token_ms?: number | null | undefined;
654
+ /**
655
+ * RFC3339 UTC instant the record was written (append time).
656
+ */
657
+ timestamp: string;
658
+ tool_ms?: never | undefined;
659
+ usage: Usage5;
660
+ variant?: string | null | undefined;
661
+ [k: string]: unknown;
521
662
  } | {
522
663
  duration_ms: number | null;
664
+ /**
665
+ * Best-effort normalized failure text for a run that did not succeed: the
666
+ * harness's own diagnostic as oneharness captured it on stderr, or
667
+ * oneharness's own message when it generated one (a spawn failure, a
668
+ * timeout, a binary that is not installed). This is the *only* place a
669
+ * record quotes the process's own bytes, and it is deliberately narrow —
670
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
671
+ * that failed. `failure_kind` says what class of failure it was; this says
672
+ * what the harness actually reported, which is what an operator reads when
673
+ * the class is unclassified. Never derived from stdout, so it can never
674
+ * stand in for provider output the run did not produce. Omitted on the wire
675
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
676
+ */
677
+ error?: string | null | undefined;
523
678
  /**
524
679
  * Best-effort normalized tool-call events; `null` when the harness exposes
525
680
  * no machine-readable trace.
526
681
  */
527
- events: ({
528
- duration_ms?: null | undefined;
529
- finished_at?: null | undefined;
530
- index: number;
531
- input: unknown;
532
- kind: string;
533
- name: string | null;
534
- output: string | null;
535
- started_at?: null | undefined;
536
- status?: null | undefined;
537
- tool_call_id?: string | null | undefined;
538
- [k: string]: unknown;
539
- } & {
682
+ events: (ActionEvent & {
540
683
  timing_source?: never | undefined;
541
684
  [k: string]: unknown;
542
685
  })[] | null;
@@ -557,7 +700,7 @@ export type HistoryRecord = {
557
700
  * by `history watch --after` and the exact id accepted by history lookup.
558
701
  */
559
702
  history_id: string;
560
- labels?: HistoryLabels5 | undefined;
703
+ labels?: HistoryLabels6 | undefined;
561
704
  /**
562
705
  * The effective top-level model for the run, if any.
563
706
  */
@@ -583,7 +726,7 @@ export type HistoryRecord = {
583
726
  * run's single prompt).
584
727
  */
585
728
  prompt: string;
586
- schema_version: "1.1";
729
+ schema_version: "1.0" | "1.1";
587
730
  /**
588
731
  * The oneharness session id this run belongs to (the history file's stem).
589
732
  */
@@ -593,7 +736,7 @@ export type HistoryRecord = {
593
736
  */
594
737
  session_id: string | null;
595
738
  started_at?: never | undefined;
596
- status: Status;
739
+ status: "nonzero" | "timeout" | "spawn-error" | "skipped";
597
740
  /**
598
741
  * Best-effort final assistant text; `null` when extraction was impossible.
599
742
  */
@@ -608,11 +751,25 @@ export type HistoryRecord = {
608
751
  */
609
752
  timestamp: string;
610
753
  tool_ms?: never | undefined;
611
- usage: Usage5;
754
+ usage: Usage6;
612
755
  variant?: string | null | undefined;
613
756
  [k: string]: unknown;
614
757
  } | {
615
758
  duration_ms: number | null;
759
+ /**
760
+ * Best-effort normalized failure text for a run that did not succeed: the
761
+ * harness's own diagnostic as oneharness captured it on stderr, or
762
+ * oneharness's own message when it generated one (a spawn failure, a
763
+ * timeout, a binary that is not installed). This is the *only* place a
764
+ * record quotes the process's own bytes, and it is deliberately narrow —
765
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
766
+ * that failed. `failure_kind` says what class of failure it was; this says
767
+ * what the harness actually reported, which is what an operator reads when
768
+ * the class is unclassified. Never derived from stdout, so it can never
769
+ * stand in for provider output the run did not produce. Omitted on the wire
770
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
771
+ */
772
+ error?: string | null | undefined;
616
773
  /**
617
774
  * Best-effort normalized tool-call events; `null` when the harness exposes
618
775
  * no machine-readable trace.
@@ -650,7 +807,7 @@ export type HistoryRecord = {
650
807
  * by `history watch --after` and the exact id accepted by history lookup.
651
808
  */
652
809
  history_id: string;
653
- labels?: HistoryLabels6 | undefined;
810
+ labels?: HistoryLabels7 | undefined;
654
811
  /**
655
812
  * The effective top-level model for the run, if any.
656
813
  */
@@ -676,7 +833,7 @@ export type HistoryRecord = {
676
833
  * run's single prompt).
677
834
  */
678
835
  prompt: string;
679
- schema_version: "1.0";
836
+ schema_version: "1.0" | "1.1";
680
837
  /**
681
838
  * The oneharness session id this run belongs to (the history file's stem).
682
839
  */
@@ -686,7 +843,7 @@ export type HistoryRecord = {
686
843
  */
687
844
  session_id: string | null;
688
845
  started_at?: never | undefined;
689
- status: Status;
846
+ status: "ok" | "planned";
690
847
  /**
691
848
  * Best-effort final assistant text; `null` when extraction was impossible.
692
849
  */
@@ -701,11 +858,25 @@ export type HistoryRecord = {
701
858
  */
702
859
  timestamp: string;
703
860
  tool_ms?: never | undefined;
704
- usage: Usage6;
861
+ usage: Usage7;
705
862
  variant?: string | null | undefined;
706
863
  [k: string]: unknown;
707
864
  } | {
708
865
  duration_ms: number | null;
866
+ /**
867
+ * Best-effort normalized failure text for a run that did not succeed: the
868
+ * harness's own diagnostic as oneharness captured it on stderr, or
869
+ * oneharness's own message when it generated one (a spawn failure, a
870
+ * timeout, a binary that is not installed). This is the *only* place a
871
+ * record quotes the process's own bytes, and it is deliberately narrow —
872
+ * trimmed, bounded to [`ERROR_MAX`] characters, and written only for a run
873
+ * that failed. `failure_kind` says what class of failure it was; this says
874
+ * what the harness actually reported, which is what an operator reads when
875
+ * the class is unclassified. Never derived from stdout, so it can never
876
+ * stand in for provider output the run did not produce. Omitted on the wire
877
+ * when absent, and gated to [`FIRST_ERROR_SCHEMA_VERSION`].
878
+ */
879
+ error?: string | null | undefined;
709
880
  events: {
710
881
  index: number;
711
882
  input: unknown;
@@ -731,7 +902,7 @@ export type HistoryRecord = {
731
902
  * by `history watch --after` and the exact id accepted by history lookup.
732
903
  */
733
904
  history_id: string;
734
- labels?: HistoryLabels7 | undefined;
905
+ labels?: HistoryLabels8 | undefined;
735
906
  /**
736
907
  * The effective top-level model for the run, if any.
737
908
  */
@@ -792,7 +963,7 @@ export type HistoryRecord = {
792
963
  */
793
964
  timestamp: string;
794
965
  tool_ms?: number | null | undefined;
795
- usage: Usage7;
966
+ usage: Usage8;
796
967
  variant?: string | null | undefined;
797
968
  [k: string]: unknown;
798
969
  };
@@ -821,7 +992,7 @@ export type HistoryEventLine = {
821
992
  harness: string;
822
993
  harness_id?: string | null | undefined;
823
994
  run_id: string;
824
- schema_version: "1.2";
995
+ schema_version: "1.2" | "1.3";
825
996
  variant?: string | null | undefined;
826
997
  [k: string]: unknown;
827
998
  } | {
@@ -1189,3 +1360,40 @@ export interface Usage7 {
1189
1360
  output_tokens: number | null;
1190
1361
  [k: string]: unknown;
1191
1362
  }
1363
+ /**
1364
+ * Caller-supplied metadata used to select related task-graph records.
1365
+ * Omitted on the wire when empty for additive compatibility.
1366
+ */
1367
+ export interface HistoryLabels8 {
1368
+ [k: string]: string;
1369
+ }
1370
+ /**
1371
+ * Best-effort token/cost accounting (every field `null` when unreported).
1372
+ */
1373
+ export interface Usage8 {
1374
+ /**
1375
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
1376
+ * previously-written prefix), when the harness reports them. `None` when the
1377
+ * harness does not surface cache counts — never `0` as a guess.
1378
+ */
1379
+ cache_read_tokens: number | null;
1380
+ /**
1381
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
1382
+ * creation), when the harness reports them. `None` when not surfaced.
1383
+ */
1384
+ cache_write_tokens: number | null;
1385
+ /**
1386
+ * Total cost in USD, when the harness reports it (often absent on
1387
+ * subscription auth, where there is no per-call dollar figure).
1388
+ */
1389
+ cost_usd: number | null;
1390
+ /**
1391
+ * Prompt/input tokens billed, when the harness reports them.
1392
+ */
1393
+ input_tokens: number | null;
1394
+ /**
1395
+ * Completion/output tokens billed, when the harness reports them.
1396
+ */
1397
+ output_tokens: number | null;
1398
+ [k: string]: unknown;
1399
+ }