@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.
@@ -254,6 +254,10 @@ export interface RunResult {
254
254
  * Canonical harness id (e.g. `claude-code`).
255
255
  */
256
256
  harness: string;
257
+ /**
258
+ * Base id or `<base>:<variant>`, suitable for selecting the same candidate.
259
+ */
260
+ harness_id: string;
257
261
  /**
258
262
  * The model this result ran with (the value oneharness put on the harness's
259
263
  * model flag), or `null` when no model was requested and the harness used its
@@ -325,6 +329,10 @@ export interface RunResult {
325
329
  * How `usage` was read (e.g. `json`); `null` when nothing was found.
326
330
  */
327
331
  usage_source: string | null;
332
+ /**
333
+ * Named preset, when this result came from a composed harness id.
334
+ */
335
+ variant: string | null;
328
336
  [k: string]: unknown;
329
337
  }
330
338
  /**
@@ -4,9 +4,11 @@
4
4
  export type HistoryLine = {
5
5
  event: ActionEvent;
6
6
  harness: string;
7
+ harness_id?: string | null | undefined;
7
8
  run_id: string;
8
- schema_version: "1.0";
9
+ schema_version: "1.0" | "1.1";
9
10
  type: "event";
11
+ variant?: string | null | undefined;
10
12
  [k: string]: unknown;
11
13
  } | ({
12
14
  duration_ms: number;
@@ -14,6 +16,7 @@ export type HistoryLine = {
14
16
  failure_kind: FailureKind | null;
15
17
  finished_at: string;
16
18
  harness: string;
19
+ harness_id?: string | null | undefined;
17
20
  history_id: string;
18
21
  labels?: HistoryLabels | undefined;
19
22
  model: string | null;
@@ -22,7 +25,7 @@ export type HistoryLine = {
22
25
  permission_mode: PermissionMode;
23
26
  project: string;
24
27
  prompt: string;
25
- schema_version: "1.0";
28
+ schema_version: "1.0" | "1.1";
26
29
  session: string;
27
30
  session_id: string | null;
28
31
  started_at: string;
@@ -34,6 +37,7 @@ export type HistoryLine = {
34
37
  tool_ms: number;
35
38
  type: "run";
36
39
  usage: Usage;
40
+ variant?: string | null | undefined;
37
41
  [k: string]: unknown;
38
42
  } | {
39
43
  duration_ms: number;
@@ -41,6 +45,7 @@ export type HistoryLine = {
41
45
  failure_kind: FailureKind | null;
42
46
  finished_at: string | null;
43
47
  harness: string;
48
+ harness_id?: string | null | undefined;
44
49
  history_id: string;
45
50
  labels?: HistoryLabels | undefined;
46
51
  model: string | null;
@@ -49,7 +54,7 @@ export type HistoryLine = {
49
54
  permission_mode: PermissionMode;
50
55
  project: string;
51
56
  prompt: string;
52
- schema_version: "1.0";
57
+ schema_version: "1.0" | "1.1";
53
58
  session: string;
54
59
  session_id: string | null;
55
60
  started_at: string;
@@ -61,6 +66,7 @@ export type HistoryLine = {
61
66
  tool_ms: number;
62
67
  type: "run";
63
68
  usage: Usage;
69
+ variant?: string | null | undefined;
64
70
  [k: string]: unknown;
65
71
  } | {
66
72
  duration_ms: number | null;
@@ -68,6 +74,7 @@ export type HistoryLine = {
68
74
  failure_kind: FailureKind | null;
69
75
  finished_at: null;
70
76
  harness: string;
77
+ harness_id?: string | null | undefined;
71
78
  history_id: string;
72
79
  labels?: HistoryLabels | undefined;
73
80
  model: string | null;
@@ -76,7 +83,7 @@ export type HistoryLine = {
76
83
  permission_mode: PermissionMode;
77
84
  project: string;
78
85
  prompt: string;
79
- schema_version: "1.0";
86
+ schema_version: "1.0" | "1.1";
80
87
  session: string;
81
88
  session_id: string | null;
82
89
  started_at?: never | undefined;
@@ -88,6 +95,7 @@ export type HistoryLine = {
88
95
  tool_ms?: never | undefined;
89
96
  type: "run";
90
97
  usage: Usage;
98
+ variant?: string | null | undefined;
91
99
  [k: string]: unknown;
92
100
  });
93
101
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -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";
@@ -462,3 +665,77 @@ export interface Usage2 {
462
665
  output_tokens: number | null;
463
666
  [k: string]: unknown;
464
667
  }
668
+ /**
669
+ * Caller-supplied metadata used to select related task-graph records.
670
+ * Omitted on the wire when empty for additive compatibility.
671
+ */
672
+ export interface HistoryLabels3 {
673
+ [k: string]: string;
674
+ }
675
+ /**
676
+ * Best-effort token/cost accounting (every field `null` when unreported).
677
+ */
678
+ export interface Usage3 {
679
+ /**
680
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
681
+ * previously-written prefix), when the harness reports them. `None` when the
682
+ * harness does not surface cache counts — never `0` as a guess.
683
+ */
684
+ cache_read_tokens: number | null;
685
+ /**
686
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
687
+ * creation), when the harness reports them. `None` when not surfaced.
688
+ */
689
+ cache_write_tokens: number | null;
690
+ /**
691
+ * Total cost in USD, when the harness reports it (often absent on
692
+ * subscription auth, where there is no per-call dollar figure).
693
+ */
694
+ cost_usd: number | null;
695
+ /**
696
+ * Prompt/input tokens billed, when the harness reports them.
697
+ */
698
+ input_tokens: number | null;
699
+ /**
700
+ * Completion/output tokens billed, when the harness reports them.
701
+ */
702
+ output_tokens: number | null;
703
+ [k: string]: unknown;
704
+ }
705
+ /**
706
+ * Caller-supplied metadata used to select related task-graph records.
707
+ * Omitted on the wire when empty for additive compatibility.
708
+ */
709
+ export interface HistoryLabels4 {
710
+ [k: string]: string;
711
+ }
712
+ /**
713
+ * Best-effort token/cost accounting (every field `null` when unreported).
714
+ */
715
+ export interface Usage4 {
716
+ /**
717
+ * Prompt tokens served from the provider's prompt cache (a cheap read of a
718
+ * previously-written prefix), when the harness reports them. `None` when the
719
+ * harness does not surface cache counts — never `0` as a guess.
720
+ */
721
+ cache_read_tokens: number | null;
722
+ /**
723
+ * Prompt tokens written to the provider's prompt cache (a.k.a. cache
724
+ * creation), when the harness reports them. `None` when not surfaced.
725
+ */
726
+ cache_write_tokens: number | null;
727
+ /**
728
+ * Total cost in USD, when the harness reports it (often absent on
729
+ * subscription auth, where there is no per-call dollar figure).
730
+ */
731
+ cost_usd: number | null;
732
+ /**
733
+ * Prompt/input tokens billed, when the harness reports them.
734
+ */
735
+ input_tokens: number | null;
736
+ /**
737
+ * Completion/output tokens billed, when the harness reports them.
738
+ */
739
+ output_tokens: number | null;
740
+ [k: string]: unknown;
741
+ }