@oneharness/sdk 0.5.4 → 0.5.6

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.
@@ -66,6 +66,7 @@ export type HistoryRecord = {
66
66
  * Canonical harness id (e.g. `claude-code`).
67
67
  */
68
68
  harness: string;
69
+ harness_id: string;
69
70
  /**
70
71
  * Globally unique, time-ordered record id. This is also the cursor accepted
71
72
  * by `history watch --after` and the exact id accepted by history lookup.
@@ -96,7 +97,7 @@ export type HistoryRecord = {
96
97
  * run's single prompt).
97
98
  */
98
99
  prompt: string;
99
- schema_version: "1.0";
100
+ schema_version: "1.1";
100
101
  /**
101
102
  * The oneharness session id this run belongs to (the history file's stem).
102
103
  */
@@ -122,6 +123,115 @@ export type HistoryRecord = {
122
123
  timestamp: string;
123
124
  tool_ms: number;
124
125
  usage: Usage;
126
+ variant?: string | null | undefined;
127
+ [k: string]: unknown;
128
+ } | {
129
+ duration_ms: number;
130
+ /**
131
+ * Best-effort normalized tool-call events; `null` when the harness exposes
132
+ * no machine-readable trace.
133
+ */
134
+ events: ((ActionEvent & {
135
+ duration_ms: number;
136
+ finished_at: string;
137
+ kind: "tool_call";
138
+ started_at: string;
139
+ status: "completed";
140
+ tool_call_id: string;
141
+ [k: string]: unknown;
142
+ }) | (ActionEvent & {
143
+ duration_ms: number;
144
+ finished_at: string;
145
+ kind: "tool_call";
146
+ started_at: string;
147
+ status: "failed";
148
+ tool_call_id: string;
149
+ [k: string]: unknown;
150
+ }) | (ActionEvent & {
151
+ kind: "tool_call";
152
+ started_at: string;
153
+ status: "timeout";
154
+ tool_call_id: string;
155
+ [k: string]: unknown;
156
+ }) | (ActionEvent & {
157
+ kind: "tool_call";
158
+ started_at: string;
159
+ status: "interrupted";
160
+ tool_call_id: string;
161
+ [k: string]: unknown;
162
+ }) | (ActionEvent & {
163
+ kind?: "tool_result" | undefined;
164
+ [k: string]: unknown;
165
+ }))[] | null;
166
+ exit_code: number | null;
167
+ /**
168
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
169
+ * unclassified.
170
+ */
171
+ failure_kind: FailureKind | null;
172
+ finished_at: string | null;
173
+ /**
174
+ * Canonical harness id (e.g. `claude-code`).
175
+ */
176
+ harness: string;
177
+ harness_id?: string | undefined;
178
+ /**
179
+ * Globally unique, time-ordered record id. This is also the cursor accepted
180
+ * by `history watch --after` and the exact id accepted by history lookup.
181
+ */
182
+ history_id: string;
183
+ labels?: HistoryLabels1 | undefined;
184
+ /**
185
+ * The effective top-level model for the run, if any.
186
+ */
187
+ model: string | null;
188
+ model_ms: number;
189
+ /**
190
+ * The human-meaningful session name (see [`session_name`]); repeated on
191
+ * every record so a reader can resolve a session by name from any line.
192
+ */
193
+ name: string;
194
+ /**
195
+ * The normalized approval mode requested for the run.
196
+ */
197
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
198
+ /**
199
+ * The project directory the run operated in (the real path, not the
200
+ * on-disk slug), so the list view can show where a session ran.
201
+ */
202
+ project: string;
203
+ /**
204
+ * The prompt this harness run received (its own, on a batch run; else the
205
+ * run's single prompt).
206
+ */
207
+ prompt: string;
208
+ schema_version: "1.0";
209
+ /**
210
+ * The oneharness session id this run belongs to (the history file's stem).
211
+ */
212
+ session: string;
213
+ /**
214
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
215
+ */
216
+ session_id: string | null;
217
+ started_at: string;
218
+ status: Status;
219
+ /**
220
+ * Best-effort final assistant text; `null` when extraction was impossible.
221
+ */
222
+ text: string | null;
223
+ /**
224
+ * How `text` was extracted; `null` when absent.
225
+ */
226
+ text_source: string | null;
227
+ time_to_first_token_ms?: number | null | undefined;
228
+ /**
229
+ * RFC3339 UTC instant the record was written (append time).
230
+ */
231
+ timestamp: string;
232
+ tool_ms: number;
233
+ usage: Usage1;
234
+ variant?: string | null | undefined;
125
235
  [k: string]: unknown;
126
236
  } | {
127
237
  duration_ms: number | null;
@@ -153,12 +263,102 @@ export type HistoryRecord = {
153
263
  * Canonical harness id (e.g. `claude-code`).
154
264
  */
155
265
  harness: string;
266
+ harness_id: string;
156
267
  /**
157
268
  * Globally unique, time-ordered record id. This is also the cursor accepted
158
269
  * by `history watch --after` and the exact id accepted by history lookup.
159
270
  */
160
271
  history_id: string;
161
- labels?: HistoryLabels1 | undefined;
272
+ labels?: HistoryLabels2 | undefined;
273
+ /**
274
+ * The effective top-level model for the run, if any.
275
+ */
276
+ model: string | null;
277
+ model_ms?: never | undefined;
278
+ /**
279
+ * The human-meaningful session name (see [`session_name`]); repeated on
280
+ * every record so a reader can resolve a session by name from any line.
281
+ */
282
+ name: string;
283
+ /**
284
+ * The normalized approval mode requested for the run.
285
+ */
286
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
287
+ /**
288
+ * The project directory the run operated in (the real path, not the
289
+ * on-disk slug), so the list view can show where a session ran.
290
+ */
291
+ project: string;
292
+ /**
293
+ * The prompt this harness run received (its own, on a batch run; else the
294
+ * run's single prompt).
295
+ */
296
+ prompt: string;
297
+ schema_version: "1.1";
298
+ /**
299
+ * The oneharness session id this run belongs to (the history file's stem).
300
+ */
301
+ session: string;
302
+ /**
303
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
304
+ */
305
+ session_id: string | null;
306
+ started_at?: never | undefined;
307
+ status: Status;
308
+ /**
309
+ * Best-effort final assistant text; `null` when extraction was impossible.
310
+ */
311
+ text: string | null;
312
+ /**
313
+ * How `text` was extracted; `null` when absent.
314
+ */
315
+ text_source: string | null;
316
+ time_to_first_token_ms?: never | undefined;
317
+ /**
318
+ * RFC3339 UTC instant the record was written (append time).
319
+ */
320
+ timestamp: string;
321
+ tool_ms?: never | undefined;
322
+ usage: Usage2;
323
+ variant?: string | null | undefined;
324
+ [k: string]: unknown;
325
+ } | {
326
+ duration_ms: number | null;
327
+ /**
328
+ * Best-effort normalized tool-call events; `null` when the harness exposes
329
+ * no machine-readable trace.
330
+ */
331
+ events: {
332
+ duration_ms?: null | undefined;
333
+ finished_at?: null | undefined;
334
+ index: number;
335
+ input: unknown;
336
+ kind: string;
337
+ name: string | null;
338
+ output: string | null;
339
+ started_at?: null | undefined;
340
+ status?: null | undefined;
341
+ tool_call_id?: string | null | undefined;
342
+ [k: string]: unknown;
343
+ }[] | null;
344
+ exit_code: number | null;
345
+ /**
346
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
347
+ * unclassified.
348
+ */
349
+ failure_kind: FailureKind | null;
350
+ finished_at: null;
351
+ /**
352
+ * Canonical harness id (e.g. `claude-code`).
353
+ */
354
+ harness: string;
355
+ harness_id?: string | undefined;
356
+ /**
357
+ * Globally unique, time-ordered record id. This is also the cursor accepted
358
+ * by `history watch --after` and the exact id accepted by history lookup.
359
+ */
360
+ history_id: string;
361
+ labels?: HistoryLabels3 | undefined;
162
362
  /**
163
363
  * The effective top-level model for the run, if any.
164
364
  */
@@ -208,7 +408,8 @@ export type HistoryRecord = {
208
408
  */
209
409
  timestamp: string;
210
410
  tool_ms?: never | undefined;
211
- usage: Usage1;
411
+ usage: Usage3;
412
+ variant?: string | null | undefined;
212
413
  [k: string]: unknown;
213
414
  } | {
214
415
  duration_ms: number | null;
@@ -231,12 +432,13 @@ export type HistoryRecord = {
231
432
  * Canonical harness id (e.g. `claude-code`).
232
433
  */
233
434
  harness: string;
435
+ harness_id: string;
234
436
  /**
235
437
  * Globally unique, time-ordered record id. This is also the cursor accepted
236
438
  * by `history watch --after` and the exact id accepted by history lookup.
237
439
  */
238
440
  history_id: string;
239
- labels?: HistoryLabels2 | undefined;
441
+ labels?: HistoryLabels4 | undefined;
240
442
  /**
241
443
  * The effective top-level model for the run, if any.
242
444
  */
@@ -292,7 +494,8 @@ export type HistoryRecord = {
292
494
  */
293
495
  timestamp: string;
294
496
  tool_ms?: number | null | undefined;
295
- usage: Usage2;
497
+ usage: Usage4;
498
+ variant?: string | null | undefined;
296
499
  [k: string]: unknown;
297
500
  };
298
501
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -475,13 +678,89 @@ export interface Usage2 {
475
678
  output_tokens: number | null;
476
679
  [k: string]: unknown;
477
680
  }
681
+ /**
682
+ * Caller-supplied metadata used to select related task-graph records.
683
+ * Omitted on the wire when empty for additive compatibility.
684
+ */
685
+ export interface HistoryLabels3 {
686
+ [k: string]: string;
687
+ }
688
+ /**
689
+ * Best-effort token/cost accounting (every field `null` when unreported).
690
+ */
691
+ export interface Usage3 {
692
+ /**
693
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
694
+ * previously-written prefix), when the harness reports them. `None` when the
695
+ * harness does not surface cache counts — never `0` as a guess.
696
+ */
697
+ cache_read_tokens: number | null;
698
+ /**
699
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
700
+ * creation), when the harness reports them. `None` when not surfaced.
701
+ */
702
+ cache_write_tokens: number | null;
703
+ /**
704
+ * Total cost in USD, when the harness reports it (often absent on
705
+ * subscription auth, where there is no per-call dollar figure).
706
+ */
707
+ cost_usd: number | null;
708
+ /**
709
+ * Prompt/input tokens billed, when the harness reports them.
710
+ */
711
+ input_tokens: number | null;
712
+ /**
713
+ * Completion/output tokens billed, when the harness reports them.
714
+ */
715
+ output_tokens: number | null;
716
+ [k: string]: unknown;
717
+ }
718
+ /**
719
+ * Caller-supplied metadata used to select related task-graph records.
720
+ * Omitted on the wire when empty for additive compatibility.
721
+ */
722
+ export interface HistoryLabels4 {
723
+ [k: string]: string;
724
+ }
725
+ /**
726
+ * Best-effort token/cost accounting (every field `null` when unreported).
727
+ */
728
+ export interface Usage4 {
729
+ /**
730
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
731
+ * previously-written prefix), when the harness reports them. `None` when the
732
+ * harness does not surface cache counts — never `0` as a guess.
733
+ */
734
+ cache_read_tokens: number | null;
735
+ /**
736
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
737
+ * creation), when the harness reports them. `None` when not surfaced.
738
+ */
739
+ cache_write_tokens: number | null;
740
+ /**
741
+ * Total cost in USD, when the harness reports it (often absent on
742
+ * subscription auth, where there is no per-call dollar figure).
743
+ */
744
+ cost_usd: number | null;
745
+ /**
746
+ * Prompt/input tokens billed, when the harness reports them.
747
+ */
748
+ input_tokens: number | null;
749
+ /**
750
+ * Completion/output tokens billed, when the harness reports them.
751
+ */
752
+ output_tokens: number | null;
753
+ [k: string]: unknown;
754
+ }
478
755
  /**
479
756
  * One normalized action observed during a run.
480
757
  */
481
758
  export interface HistoryEventLine {
482
759
  event: ActionEvent;
483
760
  harness: string;
761
+ harness_id?: string | null | undefined;
484
762
  run_id: string;
485
- schema_version: string;
763
+ schema_version: "1.0" | "1.1";
764
+ variant?: string | null | undefined;
486
765
  [k: string]: unknown;
487
766
  }
@@ -52,6 +52,7 @@ export type HistoryRecord = {
52
52
  * Canonical harness id (e.g. `claude-code`).
53
53
  */
54
54
  harness: string;
55
+ harness_id: string;
55
56
  /**
56
57
  * Globally unique, time-ordered record id. This is also the cursor accepted
57
58
  * by `history watch --after` and the exact id accepted by history lookup.
@@ -82,7 +83,7 @@ export type HistoryRecord = {
82
83
  * run's single prompt).
83
84
  */
84
85
  prompt: string;
85
- schema_version: "1.0";
86
+ schema_version: "1.1";
86
87
  /**
87
88
  * The oneharness session id this run belongs to (the history file's stem).
88
89
  */
@@ -108,6 +109,115 @@ export type HistoryRecord = {
108
109
  timestamp: string;
109
110
  tool_ms: number;
110
111
  usage: Usage;
112
+ variant?: string | null | undefined;
113
+ [k: string]: unknown;
114
+ } | {
115
+ duration_ms: number;
116
+ /**
117
+ * Best-effort normalized tool-call events; `null` when the harness exposes
118
+ * no machine-readable trace.
119
+ */
120
+ events: ((ActionEvent & {
121
+ duration_ms: number;
122
+ finished_at: string;
123
+ kind: "tool_call";
124
+ started_at: string;
125
+ status: "completed";
126
+ tool_call_id: string;
127
+ [k: string]: unknown;
128
+ }) | (ActionEvent & {
129
+ duration_ms: number;
130
+ finished_at: string;
131
+ kind: "tool_call";
132
+ started_at: string;
133
+ status: "failed";
134
+ tool_call_id: string;
135
+ [k: string]: unknown;
136
+ }) | (ActionEvent & {
137
+ kind: "tool_call";
138
+ started_at: string;
139
+ status: "timeout";
140
+ tool_call_id: string;
141
+ [k: string]: unknown;
142
+ }) | (ActionEvent & {
143
+ kind: "tool_call";
144
+ started_at: string;
145
+ status: "interrupted";
146
+ tool_call_id: string;
147
+ [k: string]: unknown;
148
+ }) | (ActionEvent & {
149
+ kind?: "tool_result" | undefined;
150
+ [k: string]: unknown;
151
+ }))[] | null;
152
+ exit_code: number | null;
153
+ /**
154
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
155
+ * unclassified.
156
+ */
157
+ failure_kind: FailureKind | null;
158
+ finished_at: string | null;
159
+ /**
160
+ * Canonical harness id (e.g. `claude-code`).
161
+ */
162
+ harness: string;
163
+ harness_id?: string | undefined;
164
+ /**
165
+ * Globally unique, time-ordered record id. This is also the cursor accepted
166
+ * by `history watch --after` and the exact id accepted by history lookup.
167
+ */
168
+ history_id: string;
169
+ labels?: HistoryLabels1 | undefined;
170
+ /**
171
+ * The effective top-level model for the run, if any.
172
+ */
173
+ model: string | null;
174
+ model_ms: number;
175
+ /**
176
+ * The human-meaningful session name (see [`session_name`]); repeated on
177
+ * every record so a reader can resolve a session by name from any line.
178
+ */
179
+ name: string;
180
+ /**
181
+ * The normalized approval mode requested for the run.
182
+ */
183
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
184
+ /**
185
+ * The project directory the run operated in (the real path, not the
186
+ * on-disk slug), so the list view can show where a session ran.
187
+ */
188
+ project: string;
189
+ /**
190
+ * The prompt this harness run received (its own, on a batch run; else the
191
+ * run's single prompt).
192
+ */
193
+ prompt: string;
194
+ schema_version: "1.0";
195
+ /**
196
+ * The oneharness session id this run belongs to (the history file's stem).
197
+ */
198
+ session: string;
199
+ /**
200
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
201
+ */
202
+ session_id: string | null;
203
+ started_at: string;
204
+ status: Status;
205
+ /**
206
+ * Best-effort final assistant text; `null` when extraction was impossible.
207
+ */
208
+ text: string | null;
209
+ /**
210
+ * How `text` was extracted; `null` when absent.
211
+ */
212
+ text_source: string | null;
213
+ time_to_first_token_ms?: number | null | undefined;
214
+ /**
215
+ * RFC3339 UTC instant the record was written (append time).
216
+ */
217
+ timestamp: string;
218
+ tool_ms: number;
219
+ usage: Usage1;
220
+ variant?: string | null | undefined;
111
221
  [k: string]: unknown;
112
222
  } | {
113
223
  duration_ms: number | null;
@@ -139,12 +249,102 @@ export type HistoryRecord = {
139
249
  * Canonical harness id (e.g. `claude-code`).
140
250
  */
141
251
  harness: string;
252
+ harness_id: string;
142
253
  /**
143
254
  * Globally unique, time-ordered record id. This is also the cursor accepted
144
255
  * by `history watch --after` and the exact id accepted by history lookup.
145
256
  */
146
257
  history_id: string;
147
- labels?: HistoryLabels1 | undefined;
258
+ labels?: HistoryLabels2 | undefined;
259
+ /**
260
+ * The effective top-level model for the run, if any.
261
+ */
262
+ model: string | null;
263
+ model_ms?: never | undefined;
264
+ /**
265
+ * The human-meaningful session name (see [`session_name`]); repeated on
266
+ * every record so a reader can resolve a session by name from any line.
267
+ */
268
+ name: string;
269
+ /**
270
+ * The normalized approval mode requested for the run.
271
+ */
272
+ permission_mode: "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
273
+ /**
274
+ * The project directory the run operated in (the real path, not the
275
+ * on-disk slug), so the list view can show where a session ran.
276
+ */
277
+ project: string;
278
+ /**
279
+ * The prompt this harness run received (its own, on a batch run; else the
280
+ * run's single prompt).
281
+ */
282
+ prompt: string;
283
+ schema_version: "1.1";
284
+ /**
285
+ * The oneharness session id this run belongs to (the history file's stem).
286
+ */
287
+ session: string;
288
+ /**
289
+ * The harness's own continuation id, when it exposed one; `null` otherwise.
290
+ */
291
+ session_id: string | null;
292
+ started_at?: never | undefined;
293
+ status: Status;
294
+ /**
295
+ * Best-effort final assistant text; `null` when extraction was impossible.
296
+ */
297
+ text: string | null;
298
+ /**
299
+ * How `text` was extracted; `null` when absent.
300
+ */
301
+ text_source: string | null;
302
+ time_to_first_token_ms?: never | undefined;
303
+ /**
304
+ * RFC3339 UTC instant the record was written (append time).
305
+ */
306
+ timestamp: string;
307
+ tool_ms?: never | undefined;
308
+ usage: Usage2;
309
+ variant?: string | null | undefined;
310
+ [k: string]: unknown;
311
+ } | {
312
+ duration_ms: number | null;
313
+ /**
314
+ * Best-effort normalized tool-call events; `null` when the harness exposes
315
+ * no machine-readable trace.
316
+ */
317
+ events: {
318
+ duration_ms?: null | undefined;
319
+ finished_at?: null | undefined;
320
+ index: number;
321
+ input: unknown;
322
+ kind: string;
323
+ name: string | null;
324
+ output: string | null;
325
+ started_at?: null | undefined;
326
+ status?: null | undefined;
327
+ tool_call_id?: string | null | undefined;
328
+ [k: string]: unknown;
329
+ }[] | null;
330
+ exit_code: number | null;
331
+ /**
332
+ * Best-effort classified failure reason (see [`FailureKind`]); `null` when
333
+ * unclassified.
334
+ */
335
+ failure_kind: FailureKind | null;
336
+ finished_at: null;
337
+ /**
338
+ * Canonical harness id (e.g. `claude-code`).
339
+ */
340
+ harness: string;
341
+ harness_id?: string | undefined;
342
+ /**
343
+ * Globally unique, time-ordered record id. This is also the cursor accepted
344
+ * by `history watch --after` and the exact id accepted by history lookup.
345
+ */
346
+ history_id: string;
347
+ labels?: HistoryLabels3 | undefined;
148
348
  /**
149
349
  * The effective top-level model for the run, if any.
150
350
  */
@@ -194,7 +394,8 @@ export type HistoryRecord = {
194
394
  */
195
395
  timestamp: string;
196
396
  tool_ms?: never | undefined;
197
- usage: Usage1;
397
+ usage: Usage3;
398
+ variant?: string | null | undefined;
198
399
  [k: string]: unknown;
199
400
  } | {
200
401
  duration_ms: number | null;
@@ -217,12 +418,13 @@ export type HistoryRecord = {
217
418
  * Canonical harness id (e.g. `claude-code`).
218
419
  */
219
420
  harness: string;
421
+ harness_id: string;
220
422
  /**
221
423
  * Globally unique, time-ordered record id. This is also the cursor accepted
222
424
  * by `history watch --after` and the exact id accepted by history lookup.
223
425
  */
224
426
  history_id: string;
225
- labels?: HistoryLabels2 | undefined;
427
+ labels?: HistoryLabels4 | undefined;
226
428
  /**
227
429
  * The effective top-level model for the run, if any.
228
430
  */
@@ -278,7 +480,8 @@ export type HistoryRecord = {
278
480
  */
279
481
  timestamp: string;
280
482
  tool_ms?: number | null | undefined;
281
- usage: Usage2;
483
+ usage: Usage4;
484
+ variant?: string | null | undefined;
282
485
  [k: string]: unknown;
283
486
  };
284
487
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -461,3 +664,77 @@ export interface Usage2 {
461
664
  output_tokens: number | null;
462
665
  [k: string]: unknown;
463
666
  }
667
+ /**
668
+ * Caller-supplied metadata used to select related task-graph records.
669
+ * Omitted on the wire when empty for additive compatibility.
670
+ */
671
+ export interface HistoryLabels3 {
672
+ [k: string]: string;
673
+ }
674
+ /**
675
+ * Best-effort token/cost accounting (every field `null` when unreported).
676
+ */
677
+ export interface Usage3 {
678
+ /**
679
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
680
+ * previously-written prefix), when the harness reports them. `None` when the
681
+ * harness does not surface cache counts — never `0` as a guess.
682
+ */
683
+ cache_read_tokens: number | null;
684
+ /**
685
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
686
+ * creation), when the harness reports them. `None` when not surfaced.
687
+ */
688
+ cache_write_tokens: number | null;
689
+ /**
690
+ * Total cost in USD, when the harness reports it (often absent on
691
+ * subscription auth, where there is no per-call dollar figure).
692
+ */
693
+ cost_usd: number | null;
694
+ /**
695
+ * Prompt/input tokens billed, when the harness reports them.
696
+ */
697
+ input_tokens: number | null;
698
+ /**
699
+ * Completion/output tokens billed, when the harness reports them.
700
+ */
701
+ output_tokens: number | null;
702
+ [k: string]: unknown;
703
+ }
704
+ /**
705
+ * Caller-supplied metadata used to select related task-graph records.
706
+ * Omitted on the wire when empty for additive compatibility.
707
+ */
708
+ export interface HistoryLabels4 {
709
+ [k: string]: string;
710
+ }
711
+ /**
712
+ * Best-effort token/cost accounting (every field `null` when unreported).
713
+ */
714
+ export interface Usage4 {
715
+ /**
716
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
717
+ * previously-written prefix), when the harness reports them. `None` when the
718
+ * harness does not surface cache counts — never `0` as a guess.
719
+ */
720
+ cache_read_tokens: number | null;
721
+ /**
722
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
723
+ * creation), when the harness reports them. `None` when not surfaced.
724
+ */
725
+ cache_write_tokens: number | null;
726
+ /**
727
+ * Total cost in USD, when the harness reports it (often absent on
728
+ * subscription auth, where there is no per-call dollar figure).
729
+ */
730
+ cost_usd: number | null;
731
+ /**
732
+ * Prompt/input tokens billed, when the harness reports them.
733
+ */
734
+ input_tokens: number | null;
735
+ /**
736
+ * Completion/output tokens billed, when the harness reports them.
737
+ */
738
+ output_tokens: number | null;
739
+ [k: string]: unknown;
740
+ }