@oneharness/sdk 0.10.2 → 0.11.0

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.
@@ -119,6 +119,26 @@ export type ExecutionTelemetry = {
119
119
  tool_ms: number;
120
120
  [k: string]: unknown;
121
121
  };
122
+ /**
123
+ * Whether a candidate's normalized result carries **evidence it did the task's
124
+ * work** — the first thing [`startup_failure_reason`] consults.
125
+ *
126
+ * Two independent witnesses, either of which is decisive:
127
+ *
128
+ * - **Tool events.** A recorded tool call is the harness acting on the task.
129
+ * - **Usage accounting.** [`Usage::reports_billed_work`][billed] — the same definition
130
+ * `signals::record_reports_work` classifies a raw harness record with, so the
131
+ * two readings of "billed" are one contract with one implementation.
132
+ *
133
+ * It is also a **published reading**, not only an internal one: a run that
134
+ * failed with nothing to classify carries it as [`RunResult::work`] and in its
135
+ * history record, because there the question "did this candidate do anything?"
136
+ * is the only one left. One type for both, so the value a reader sees is the
137
+ * same value the fall-through verdict consulted.
138
+ *
139
+ * [billed]: crate::domain::signals::Usage::reports_billed_work
140
+ */
141
+ export type RunWork = "done" | "none";
122
142
  /**
123
143
  * The top-level `run` report written to stdout.
124
144
  */
@@ -297,6 +317,24 @@ export interface FallbackReport {
297
317
  * when no candidate could run at all — every one was a startup failure.
298
318
  */
299
319
  ran: string | null;
320
+ /**
321
+ * Whether the candidate named by `ran` stopped the chain **having shown no
322
+ * evidence it did the task's work, and with nothing to say why** — its
323
+ * [`RunResult::work`] read [`RunWork::None`] on a failure no classifier
324
+ * recognized.
325
+ *
326
+ * The chain still stops there, deliberately: re-running a task that may
327
+ * genuinely have failed for free would burn the next identity's quota on
328
+ * the same failure, which is worse than stopping (see
329
+ * [`crate::domain::fallback::startup_failure_reason`]). What this flag adds
330
+ * is the *attribution* — without it a candidate that never got started reads
331
+ * in the report exactly like one that tried the task and failed it, and the
332
+ * remaining candidates look untried for a reason nobody can name.
333
+ *
334
+ * `false` whenever `ran` is `null` (no candidate ran at all — every one is
335
+ * in `fell_through`, each with its reason).
336
+ */
337
+ stopped_without_work: boolean;
300
338
  [k: string]: unknown;
301
339
  }
302
340
  /**
@@ -481,6 +519,22 @@ export interface RunResult {
481
519
  * Named preset, when this result came from a composed harness id.
482
520
  */
483
521
  variant: string | null;
522
+ /**
523
+ * What this run has to show for itself when `failure_kind` has nothing to
524
+ * say: [`RunWork::Done`] if the harness recorded a tool call or billed
525
+ * usage, [`RunWork::None`] if nothing says it got that far. `null` on every
526
+ * other run — a success needs no such reading, and a *classified* failure
527
+ * already names its cause.
528
+ *
529
+ * This is the reading the fallback verdict itself consults
530
+ * ([`crate::domain::fallback::startup_failure_reason`]), published rather
531
+ * than left to be re-derived: an unclassified failure that did nothing is
532
+ * otherwise indistinguishable from one that ran the task and failed it, and
533
+ * the two mean opposite things to whoever reads the run. Publishing it
534
+ * changes no verdict — a candidate reading `none` still stops a chain, and
535
+ * one reading `done` still never falls through it.
536
+ */
537
+ work: RunWork | null;
484
538
  [k: string]: unknown;
485
539
  }
486
540
  /**
@@ -6,7 +6,7 @@ export type HistoryLine = ({
6
6
  harness: string;
7
7
  harness_id?: string | null | undefined;
8
8
  run_id: string;
9
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
9
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
10
10
  type: "event";
11
11
  variant?: string | null | undefined;
12
12
  [k: string]: unknown;
@@ -27,7 +27,7 @@ export type HistoryLine = ({
27
27
  [k: string]: unknown;
28
28
  } | ({
29
29
  error: string;
30
- schema_version?: "1.3" | "1.4" | "1.5" | "1.6" | undefined;
30
+ schema_version?: "1.3" | "1.4" | "1.5" | "1.6" | "1.7" | undefined;
31
31
  [k: string]: unknown;
32
32
  } & ({
33
33
  status?: "nonzero" | "timeout" | "cancelled" | "spawn-error" | "skipped" | undefined;
@@ -36,22 +36,30 @@ export type HistoryLine = ({
36
36
  failure_kind: "tool_deferred";
37
37
  [k: string]: unknown;
38
38
  }))) & ({
39
+ work?: null | undefined;
40
+ [k: string]: unknown;
41
+ } | {
42
+ schema_version?: "1.7" | undefined;
43
+ status?: "nonzero" | "timeout" | "cancelled" | undefined;
44
+ work: "done" | "none";
45
+ [k: string]: unknown;
46
+ }) & ({
39
47
  status?: "ok" | "nonzero" | "timeout" | "spawn-error" | "skipped" | "planned" | undefined;
40
48
  [k: string]: unknown;
41
49
  } | {
42
- schema_version?: "1.4" | "1.5" | "1.6" | undefined;
50
+ schema_version?: "1.4" | "1.5" | "1.6" | "1.7" | undefined;
43
51
  [k: string]: unknown;
44
52
  }) & (({
45
53
  failure_kind?: "auth" | "rate_limit" | "model_not_found" | "quota" | "tool_deferred" | "untrusted_directory" | "input_too_large" | null;
46
54
  [k: string]: unknown;
47
55
  } | {
48
- schema_version?: "1.5" | "1.6" | undefined;
56
+ schema_version?: "1.5" | "1.6" | "1.7" | undefined;
49
57
  [k: string]: unknown;
50
58
  }) & ({
51
59
  failure_kind?: "auth" | "rate_limit" | "model_not_found" | "quota" | "session_not_found" | "tool_deferred" | null;
52
60
  [k: string]: unknown;
53
61
  } | {
54
- schema_version?: "1.6" | undefined;
62
+ schema_version?: "1.6" | "1.7" | undefined;
55
63
  [k: string]: unknown;
56
64
  })) & ({
57
65
  duration_ms: number;
@@ -74,7 +82,7 @@ export type HistoryLine = ({
74
82
  permission_mode: PermissionMode;
75
83
  project: string;
76
84
  prompt: string;
77
- schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
85
+ schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
78
86
  session: string;
79
87
  session_id: string | null;
80
88
  started_at: string;
@@ -87,6 +95,11 @@ export type HistoryLine = ({
87
95
  type: "run";
88
96
  usage: Usage;
89
97
  variant?: string | null | undefined;
98
+ /**
99
+ * Work evidence for a failure nothing classified (see
100
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
101
+ */
102
+ work?: RunWork | null | undefined;
90
103
  [k: string]: unknown;
91
104
  } | {
92
105
  duration_ms: number;
@@ -109,7 +122,7 @@ export type HistoryLine = ({
109
122
  permission_mode: PermissionMode;
110
123
  project: string;
111
124
  prompt: string;
112
- schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
125
+ schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
113
126
  session: string;
114
127
  session_id: string | null;
115
128
  started_at: string;
@@ -122,6 +135,11 @@ export type HistoryLine = ({
122
135
  type: "run";
123
136
  usage: Usage;
124
137
  variant?: string | null | undefined;
138
+ /**
139
+ * Work evidence for a failure nothing classified (see
140
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
141
+ */
142
+ work?: RunWork | null | undefined;
125
143
  [k: string]: unknown;
126
144
  } | {
127
145
  duration_ms: number;
@@ -144,7 +162,7 @@ export type HistoryLine = ({
144
162
  permission_mode: PermissionMode;
145
163
  project: string;
146
164
  prompt: string;
147
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
165
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
148
166
  session: string;
149
167
  session_id: string | null;
150
168
  started_at?: never | undefined;
@@ -157,6 +175,11 @@ export type HistoryLine = ({
157
175
  type: "run";
158
176
  usage: Usage;
159
177
  variant?: string | null | undefined;
178
+ /**
179
+ * Work evidence for a failure nothing classified (see
180
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
181
+ */
182
+ work?: RunWork | null | undefined;
160
183
  [k: string]: unknown;
161
184
  } | {
162
185
  duration_ms: number | null;
@@ -179,7 +202,7 @@ export type HistoryLine = ({
179
202
  permission_mode: PermissionMode;
180
203
  project: string;
181
204
  prompt: string;
182
- schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
205
+ schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
183
206
  session: string;
184
207
  session_id: string | null;
185
208
  started_at?: never | undefined;
@@ -192,6 +215,11 @@ export type HistoryLine = ({
192
215
  type: "run";
193
216
  usage: Usage;
194
217
  variant?: string | null | undefined;
218
+ /**
219
+ * Work evidence for a failure nothing classified (see
220
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
221
+ */
222
+ work?: RunWork | null | undefined;
195
223
  [k: string]: unknown;
196
224
  } | {
197
225
  duration_ms: number;
@@ -214,7 +242,7 @@ export type HistoryLine = ({
214
242
  permission_mode: PermissionMode;
215
243
  project: string;
216
244
  prompt: string;
217
- schema_version: "1.3" | "1.4" | "1.5" | "1.6";
245
+ schema_version: "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
218
246
  session: string;
219
247
  session_id: string | null;
220
248
  started_at: string;
@@ -227,6 +255,11 @@ export type HistoryLine = ({
227
255
  type: "run";
228
256
  usage: Usage;
229
257
  variant?: string | null | undefined;
258
+ /**
259
+ * Work evidence for a failure nothing classified (see
260
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
261
+ */
262
+ work?: RunWork | null | undefined;
230
263
  [k: string]: unknown;
231
264
  } | {
232
265
  duration_ms: number | null;
@@ -249,7 +282,7 @@ export type HistoryLine = ({
249
282
  permission_mode: PermissionMode;
250
283
  project: string;
251
284
  prompt: string;
252
- schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
285
+ schema_version: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
253
286
  session: string;
254
287
  session_id: string | null;
255
288
  started_at?: never | undefined;
@@ -262,6 +295,11 @@ export type HistoryLine = ({
262
295
  type: "run";
263
296
  usage: Usage;
264
297
  variant?: string | null | undefined;
298
+ /**
299
+ * Work evidence for a failure nothing classified (see
300
+ * [`HistoryRecord::work`]). Omitted on the wire when absent.
301
+ */
302
+ work?: RunWork | null | undefined;
265
303
  [k: string]: unknown;
266
304
  }));
267
305
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -288,6 +326,26 @@ export type FailureKind = "auth" | "rate_limit" | "model_not_found" | "quota" |
288
326
  * downgrading it.
289
327
  */
290
328
  export type PermissionMode = "read-only" | "plan" | "default" | "edit" | "auto" | "bypass";
329
+ /**
330
+ * Whether a candidate's normalized result carries **evidence it did the task's
331
+ * work** — the first thing [`startup_failure_reason`] consults.
332
+ *
333
+ * Two independent witnesses, either of which is decisive:
334
+ *
335
+ * - **Tool events.** A recorded tool call is the harness acting on the task.
336
+ * - **Usage accounting.** [`Usage::reports_billed_work`][billed] — the same definition
337
+ * `signals::record_reports_work` classifies a raw harness record with, so the
338
+ * two readings of "billed" are one contract with one implementation.
339
+ *
340
+ * It is also a **published reading**, not only an internal one: a run that
341
+ * failed with nothing to classify carries it as [`RunResult::work`] and in its
342
+ * history record, because there the question "did this candidate do anything?"
343
+ * is the only one left. One type for both, so the value a reader sees is the
344
+ * same value the fall-through verdict consulted.
345
+ *
346
+ * [billed]: crate::domain::signals::Usage::reports_billed_work
347
+ */
348
+ export type RunWork = "done" | "none";
291
349
  /**
292
350
  * The outcome of attempting to run one harness.
293
351
  */
@@ -93,7 +93,7 @@ export type HistoryRecord = {
93
93
  * run's single prompt).
94
94
  */
95
95
  prompt: string;
96
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
96
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
97
97
  /**
98
98
  * The oneharness session id this run belongs to (the history file's stem).
99
99
  */
@@ -120,6 +120,22 @@ export type HistoryRecord = {
120
120
  tool_ms: number;
121
121
  usage: Usage;
122
122
  variant?: string | null | undefined;
123
+ /**
124
+ * What a run that failed with **nothing to classify** has to show for
125
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
126
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
127
+ * [`RunResult::work`] — one value with one source, like every signal here —
128
+ * and omitted on the wire on every other run, since a success raises the
129
+ * question and a classified failure has already answered it.
130
+ *
131
+ * This is the field that tells apart, for a reader of the record, the two
132
+ * things an unexplained failure can be: a candidate that never got started,
133
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
134
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
135
+ * first reads exactly like a chain that stopped at the second. Gated to
136
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
137
+ */
138
+ work?: RunWork | null | undefined;
123
139
  [k: string]: unknown;
124
140
  } | {
125
141
  duration_ms: number;
@@ -246,6 +262,22 @@ export type HistoryRecord = {
246
262
  tool_ms: number;
247
263
  usage: Usage1;
248
264
  variant?: string | null | undefined;
265
+ /**
266
+ * What a run that failed with **nothing to classify** has to show for
267
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
268
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
269
+ * [`RunResult::work`] — one value with one source, like every signal here —
270
+ * and omitted on the wire on every other run, since a success raises the
271
+ * question and a classified failure has already answered it.
272
+ *
273
+ * This is the field that tells apart, for a reader of the record, the two
274
+ * things an unexplained failure can be: a candidate that never got started,
275
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
276
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
277
+ * first reads exactly like a chain that stopped at the second. Gated to
278
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
279
+ */
280
+ work?: RunWork | null | undefined;
249
281
  [k: string]: unknown;
250
282
  } | {
251
283
  duration_ms: number | null;
@@ -323,7 +355,7 @@ export type HistoryRecord = {
323
355
  * run's single prompt).
324
356
  */
325
357
  prompt: string;
326
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
358
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
327
359
  /**
328
360
  * The oneharness session id this run belongs to (the history file's stem).
329
361
  */
@@ -350,6 +382,22 @@ export type HistoryRecord = {
350
382
  tool_ms?: never | undefined;
351
383
  usage: Usage2;
352
384
  variant?: string | null | undefined;
385
+ /**
386
+ * What a run that failed with **nothing to classify** has to show for
387
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
388
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
389
+ * [`RunResult::work`] — one value with one source, like every signal here —
390
+ * and omitted on the wire on every other run, since a success raises the
391
+ * question and a classified failure has already answered it.
392
+ *
393
+ * This is the field that tells apart, for a reader of the record, the two
394
+ * things an unexplained failure can be: a candidate that never got started,
395
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
396
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
397
+ * first reads exactly like a chain that stopped at the second. Gated to
398
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
399
+ */
400
+ work?: RunWork | null | undefined;
353
401
  [k: string]: unknown;
354
402
  } | {
355
403
  duration_ms: number;
@@ -415,7 +463,7 @@ export type HistoryRecord = {
415
463
  * run's single prompt).
416
464
  */
417
465
  prompt: string;
418
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
466
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
419
467
  /**
420
468
  * The oneharness session id this run belongs to (the history file's stem).
421
469
  */
@@ -442,6 +490,22 @@ export type HistoryRecord = {
442
490
  tool_ms?: never | undefined;
443
491
  usage: Usage3;
444
492
  variant?: string | null | undefined;
493
+ /**
494
+ * What a run that failed with **nothing to classify** has to show for
495
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
496
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
497
+ * [`RunResult::work`] — one value with one source, like every signal here —
498
+ * and omitted on the wire on every other run, since a success raises the
499
+ * question and a classified failure has already answered it.
500
+ *
501
+ * This is the field that tells apart, for a reader of the record, the two
502
+ * things an unexplained failure can be: a candidate that never got started,
503
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
504
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
505
+ * first reads exactly like a chain that stopped at the second. Gated to
506
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
507
+ */
508
+ work?: RunWork | null | undefined;
445
509
  [k: string]: unknown;
446
510
  } | {
447
511
  duration_ms: number | null;
@@ -507,7 +571,7 @@ export type HistoryRecord = {
507
571
  * run's single prompt).
508
572
  */
509
573
  prompt: string;
510
- schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6";
574
+ schema_version: "1.2" | "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
511
575
  /**
512
576
  * The oneharness session id this run belongs to (the history file's stem).
513
577
  */
@@ -534,6 +598,22 @@ export type HistoryRecord = {
534
598
  tool_ms?: never | undefined;
535
599
  usage: Usage4;
536
600
  variant?: string | null | undefined;
601
+ /**
602
+ * What a run that failed with **nothing to classify** has to show for
603
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
604
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
605
+ * [`RunResult::work`] — one value with one source, like every signal here —
606
+ * and omitted on the wire on every other run, since a success raises the
607
+ * question and a classified failure has already answered it.
608
+ *
609
+ * This is the field that tells apart, for a reader of the record, the two
610
+ * things an unexplained failure can be: a candidate that never got started,
611
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
612
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
613
+ * first reads exactly like a chain that stopped at the second. Gated to
614
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
615
+ */
616
+ work?: RunWork | null | undefined;
537
617
  [k: string]: unknown;
538
618
  } | {
539
619
  duration_ms: number;
@@ -599,7 +679,7 @@ export type HistoryRecord = {
599
679
  * run's single prompt).
600
680
  */
601
681
  prompt: string;
602
- schema_version: "1.3" | "1.4" | "1.5" | "1.6";
682
+ schema_version: "1.3" | "1.4" | "1.5" | "1.6" | "1.7";
603
683
  /**
604
684
  * The oneharness session id this run belongs to (the history file's stem).
605
685
  */
@@ -626,6 +706,22 @@ export type HistoryRecord = {
626
706
  tool_ms?: never | undefined;
627
707
  usage: Usage5;
628
708
  variant?: string | null | undefined;
709
+ /**
710
+ * What a run that failed with **nothing to classify** has to show for
711
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
712
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
713
+ * [`RunResult::work`] — one value with one source, like every signal here —
714
+ * and omitted on the wire on every other run, since a success raises the
715
+ * question and a classified failure has already answered it.
716
+ *
717
+ * This is the field that tells apart, for a reader of the record, the two
718
+ * things an unexplained failure can be: a candidate that never got started,
719
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
720
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
721
+ * first reads exactly like a chain that stopped at the second. Gated to
722
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
723
+ */
724
+ work?: RunWork | null | undefined;
629
725
  [k: string]: unknown;
630
726
  } | {
631
727
  duration_ms: number | null;
@@ -721,6 +817,22 @@ export type HistoryRecord = {
721
817
  tool_ms?: never | undefined;
722
818
  usage: Usage6;
723
819
  variant?: string | null | undefined;
820
+ /**
821
+ * What a run that failed with **nothing to classify** has to show for
822
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
823
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
824
+ * [`RunResult::work`] — one value with one source, like every signal here —
825
+ * and omitted on the wire on every other run, since a success raises the
826
+ * question and a classified failure has already answered it.
827
+ *
828
+ * This is the field that tells apart, for a reader of the record, the two
829
+ * things an unexplained failure can be: a candidate that never got started,
830
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
831
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
832
+ * first reads exactly like a chain that stopped at the second. Gated to
833
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
834
+ */
835
+ work?: RunWork | null | undefined;
724
836
  [k: string]: unknown;
725
837
  } | {
726
838
  duration_ms: number | null;
@@ -828,6 +940,22 @@ export type HistoryRecord = {
828
940
  tool_ms?: never | undefined;
829
941
  usage: Usage7;
830
942
  variant?: string | null | undefined;
943
+ /**
944
+ * What a run that failed with **nothing to classify** has to show for
945
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
946
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
947
+ * [`RunResult::work`] — one value with one source, like every signal here —
948
+ * and omitted on the wire on every other run, since a success raises the
949
+ * question and a classified failure has already answered it.
950
+ *
951
+ * This is the field that tells apart, for a reader of the record, the two
952
+ * things an unexplained failure can be: a candidate that never got started,
953
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
954
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
955
+ * first reads exactly like a chain that stopped at the second. Gated to
956
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
957
+ */
958
+ work?: RunWork | null | undefined;
831
959
  [k: string]: unknown;
832
960
  } | {
833
961
  duration_ms: number | null;
@@ -933,6 +1061,22 @@ export type HistoryRecord = {
933
1061
  tool_ms?: number | null | undefined;
934
1062
  usage: Usage8;
935
1063
  variant?: string | null | undefined;
1064
+ /**
1065
+ * What a run that failed with **nothing to classify** has to show for
1066
+ * itself: [`RunWork::Done`] where the harness recorded a tool call or billed
1067
+ * usage, [`RunWork::None`] where nothing says it got that far. Copied from
1068
+ * [`RunResult::work`] — one value with one source, like every signal here —
1069
+ * and omitted on the wire on every other run, since a success raises the
1070
+ * question and a classified failure has already answered it.
1071
+ *
1072
+ * This is the field that tells apart, for a reader of the record, the two
1073
+ * things an unexplained failure can be: a candidate that never got started,
1074
+ * and one that ran the task and lost. Without it both are a `nonzero` line with a
1075
+ * null `failure_kind` and empty accounting, and a chain that stopped at the
1076
+ * first reads exactly like a chain that stopped at the second. Gated to
1077
+ * [`FIRST_WORK_EVIDENCE_SCHEMA_VERSION`].
1078
+ */
1079
+ work?: RunWork | null | undefined;
936
1080
  [k: string]: unknown;
937
1081
  };
938
1082
  export type ToolCallStatus = "completed" | "failed" | "timeout" | "interrupted";
@@ -956,12 +1100,32 @@ export type FailureKind = "auth" | "rate_limit" | "model_not_found" | "quota" |
956
1100
  * The outcome of attempting to run one harness.
957
1101
  */
958
1102
  export type Status = "ok" | "nonzero" | "timeout" | "cancelled" | "spawn-error" | "skipped" | "planned";
1103
+ /**
1104
+ * Whether a candidate's normalized result carries **evidence it did the task's
1105
+ * work** — the first thing [`startup_failure_reason`] consults.
1106
+ *
1107
+ * Two independent witnesses, either of which is decisive:
1108
+ *
1109
+ * - **Tool events.** A recorded tool call is the harness acting on the task.
1110
+ * - **Usage accounting.** [`Usage::reports_billed_work`][billed] — the same definition
1111
+ * `signals::record_reports_work` classifies a raw harness record with, so the
1112
+ * two readings of "billed" are one contract with one implementation.
1113
+ *
1114
+ * It is also a **published reading**, not only an internal one: a run that
1115
+ * failed with nothing to classify carries it as [`RunResult::work`] and in its
1116
+ * history record, because there the question "did this candidate do anything?"
1117
+ * is the only one left. One type for both, so the value a reader sees is the
1118
+ * same value the fall-through verdict consulted.
1119
+ *
1120
+ * [billed]: crate::domain::signals::Usage::reports_billed_work
1121
+ */
1122
+ export type RunWork = "done" | "none";
959
1123
  export type HistoryRecords = (({
960
1124
  error?: null | undefined;
961
1125
  [k: string]: unknown;
962
1126
  } | ({
963
1127
  error: string;
964
- schema_version?: "1.3" | "1.4" | "1.5" | "1.6" | undefined;
1128
+ schema_version?: "1.3" | "1.4" | "1.5" | "1.6" | "1.7" | undefined;
965
1129
  [k: string]: unknown;
966
1130
  } & ({
967
1131
  status?: "nonzero" | "timeout" | "cancelled" | "spawn-error" | "skipped" | undefined;
@@ -970,22 +1134,30 @@ export type HistoryRecords = (({
970
1134
  failure_kind: "tool_deferred";
971
1135
  [k: string]: unknown;
972
1136
  }))) & ({
1137
+ work?: null | undefined;
1138
+ [k: string]: unknown;
1139
+ } | {
1140
+ schema_version?: "1.7" | undefined;
1141
+ status?: "nonzero" | "timeout" | "cancelled" | undefined;
1142
+ work: "done" | "none";
1143
+ [k: string]: unknown;
1144
+ }) & ({
973
1145
  status?: "ok" | "nonzero" | "timeout" | "spawn-error" | "skipped" | "planned" | undefined;
974
1146
  [k: string]: unknown;
975
1147
  } | {
976
- schema_version?: "1.4" | "1.5" | "1.6" | undefined;
1148
+ schema_version?: "1.4" | "1.5" | "1.6" | "1.7" | undefined;
977
1149
  [k: string]: unknown;
978
1150
  }) & (({
979
1151
  failure_kind?: "auth" | "rate_limit" | "model_not_found" | "quota" | "tool_deferred" | "untrusted_directory" | "input_too_large" | null;
980
1152
  [k: string]: unknown;
981
1153
  } | {
982
- schema_version?: "1.5" | "1.6" | undefined;
1154
+ schema_version?: "1.5" | "1.6" | "1.7" | undefined;
983
1155
  [k: string]: unknown;
984
1156
  }) & ({
985
1157
  failure_kind?: "auth" | "rate_limit" | "model_not_found" | "quota" | "session_not_found" | "tool_deferred" | null;
986
1158
  [k: string]: unknown;
987
1159
  } | {
988
- schema_version?: "1.6" | undefined;
1160
+ schema_version?: "1.6" | "1.7" | undefined;
989
1161
  [k: string]: unknown;
990
1162
  })) & HistoryRecord)[];
991
1163
  /**