@oneharness/sdk 0.10.2 → 0.10.3

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.
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { ConfigOptions } from "./config-options.js";
3
3
  import type { ConfigReport, Field, Field10, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, HarnessReport, HookEntry, VariantReport } from "./config-report.js";
4
- import type { ActionEvent, BatchReport, ControlEvent, ControlReason, ControlReport, ControlVerb, ExecutionTelemetry, FailureKind, FallThrough, FallThroughReason, FallbackReport, RunReport, RunResult, SessionReport, Status, TimingSource, ToolCallStatus, Usage, UtcInstant } from "./contracts.js";
4
+ import type { ActionEvent, BatchReport, ControlEvent, ControlReason, ControlReport, ControlVerb, ExecutionTelemetry, FailureKind, FallThrough, FallThroughReason, FallbackReport, RunReport, RunResult, RunWork, SessionReport, Status, TimingSource, ToolCallStatus, Usage, UtcInstant } from "./contracts.js";
5
5
  import type { DetectOptions } from "./detect-options.js";
6
6
  import type { DetectInfo, DetectReport } from "./detection.js";
7
7
  import type { GateOptions } from "./gate-options.js";
@@ -109,6 +109,7 @@ export declare const RunOptionsSchema: z.ZodType<RunOptions>;
109
109
  export declare const RunReportSchema: z.ZodType<RunReport>;
110
110
  export declare const RunResultSchema: z.ZodType<RunResult>;
111
111
  export declare const RunStreamEnvelopeSchema: z.ZodType<RunStreamEnvelope>;
112
+ export declare const RunWorkSchema: z.ZodType<RunWork>;
112
113
  export declare const SessionPhaseSchema: z.ZodType<SessionPhase>;
113
114
  export declare const SessionReportSchema: z.ZodType<SessionReport>;
114
115
  export declare const StatusSchema: z.ZodType<Status>;
@@ -193,6 +193,7 @@ export const FallbackReportSchema = z.looseObject({
193
193
  .array(z.lazy(() => FallThroughSchema))
194
194
  .refine((value) => value !== undefined, { message: "Required" }),
195
195
  ran: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
196
+ stopped_without_work: z.boolean().refine((value) => value !== undefined, { message: "Required" }),
196
197
  });
197
198
  export const FieldSchema = z.looseObject({
198
199
  source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -340,7 +341,14 @@ export const HistoryEventLineSchema = z.union([
340
341
  .refine((value) => [...value].length <= 36, { message: "Too long: expected at most 36 characters" })
341
342
  .refine((value) => value !== undefined, { message: "Required" }),
342
343
  schema_version: z
343
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
344
+ .union([
345
+ z.literal("1.2"),
346
+ z.literal("1.3"),
347
+ z.literal("1.4"),
348
+ z.literal("1.5"),
349
+ z.literal("1.6"),
350
+ z.literal("1.7"),
351
+ ])
344
352
  .refine((value) => value !== undefined, { message: "Required" }),
345
353
  variant: z.union([z.string(), z.null()]).optional(),
346
354
  }),
@@ -390,7 +398,14 @@ export const HistoryLineSchema = z.union([
390
398
  .refine((value) => [...value].length <= 36, { message: "Too long: expected at most 36 characters" })
391
399
  .refine((value) => value !== undefined, { message: "Required" }),
392
400
  schema_version: z
393
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
401
+ .union([
402
+ z.literal("1.2"),
403
+ z.literal("1.3"),
404
+ z.literal("1.4"),
405
+ z.literal("1.5"),
406
+ z.literal("1.6"),
407
+ z.literal("1.7"),
408
+ ])
394
409
  .refine((value) => value !== undefined, { message: "Required" }),
395
410
  type: z.literal("event").refine((value) => value !== undefined, { message: "Required" }),
396
411
  variant: z.union([z.string(), z.null()]).optional(),
@@ -416,7 +431,7 @@ export const HistoryLineSchema = z.union([
416
431
  variant: z.union([z.string(), z.null()]).optional(),
417
432
  }),
418
433
  ]),
419
- z.intersection(z.intersection(z.intersection(z.union([
434
+ z.intersection(z.intersection(z.intersection(z.intersection(z.union([
420
435
  z.looseObject({
421
436
  duration_ms: z
422
437
  .int()
@@ -468,10 +483,13 @@ export const HistoryLineSchema = z.union([
468
483
  z.literal("1.4"),
469
484
  z.literal("1.5"),
470
485
  z.literal("1.6"),
486
+ z.literal("1.7"),
471
487
  ])
472
488
  .refine((value) => value !== undefined, { message: "Required" }),
473
489
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
474
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
490
+ session_id: z
491
+ .union([z.string(), z.null()])
492
+ .refine((value) => value !== undefined, { message: "Required" }),
475
493
  started_at: z
476
494
  .string()
477
495
  .min(1)
@@ -492,6 +510,7 @@ export const HistoryLineSchema = z.union([
492
510
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
493
511
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
494
512
  variant: z.union([z.string(), z.null()]).optional(),
513
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
495
514
  }),
496
515
  z.looseObject({
497
516
  duration_ms: z
@@ -546,10 +565,13 @@ export const HistoryLineSchema = z.union([
546
565
  z.literal("1.4"),
547
566
  z.literal("1.5"),
548
567
  z.literal("1.6"),
568
+ z.literal("1.7"),
549
569
  ])
550
570
  .refine((value) => value !== undefined, { message: "Required" }),
551
571
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
552
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
572
+ session_id: z
573
+ .union([z.string(), z.null()])
574
+ .refine((value) => value !== undefined, { message: "Required" }),
553
575
  started_at: z
554
576
  .string()
555
577
  .min(1)
@@ -576,6 +598,7 @@ export const HistoryLineSchema = z.union([
576
598
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
577
599
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
578
600
  variant: z.union([z.string(), z.null()]).optional(),
601
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
579
602
  }),
580
603
  z.looseObject({
581
604
  duration_ms: z
@@ -620,10 +643,19 @@ export const HistoryLineSchema = z.union([
620
643
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
621
644
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
622
645
  schema_version: z
623
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
646
+ .union([
647
+ z.literal("1.2"),
648
+ z.literal("1.3"),
649
+ z.literal("1.4"),
650
+ z.literal("1.5"),
651
+ z.literal("1.6"),
652
+ z.literal("1.7"),
653
+ ])
624
654
  .refine((value) => value !== undefined, { message: "Required" }),
625
655
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
626
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
656
+ session_id: z
657
+ .union([z.string(), z.null()])
658
+ .refine((value) => value !== undefined, { message: "Required" }),
627
659
  started_at: z.never().optional(),
628
660
  status: z.lazy(() => StatusSchema).refine((value) => value !== undefined, { message: "Required" }),
629
661
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -636,6 +668,7 @@ export const HistoryLineSchema = z.union([
636
668
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
637
669
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
638
670
  variant: z.union([z.string(), z.null()]).optional(),
671
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
639
672
  }),
640
673
  z.looseObject({
641
674
  duration_ms: z
@@ -684,10 +717,13 @@ export const HistoryLineSchema = z.union([
684
717
  z.literal("1.4"),
685
718
  z.literal("1.5"),
686
719
  z.literal("1.6"),
720
+ z.literal("1.7"),
687
721
  ])
688
722
  .refine((value) => value !== undefined, { message: "Required" }),
689
723
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
690
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
724
+ session_id: z
725
+ .union([z.string(), z.null()])
726
+ .refine((value) => value !== undefined, { message: "Required" }),
691
727
  started_at: z.never().optional(),
692
728
  status: z
693
729
  .union([
@@ -708,6 +744,7 @@ export const HistoryLineSchema = z.union([
708
744
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
709
745
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
710
746
  variant: z.union([z.string(), z.null()]).optional(),
747
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
711
748
  }),
712
749
  z.looseObject({
713
750
  duration_ms: z
@@ -749,10 +786,12 @@ export const HistoryLineSchema = z.union([
749
786
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
750
787
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
751
788
  schema_version: z
752
- .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
789
+ .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")])
753
790
  .refine((value) => value !== undefined, { message: "Required" }),
754
791
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
755
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
792
+ session_id: z
793
+ .union([z.string(), z.null()])
794
+ .refine((value) => value !== undefined, { message: "Required" }),
756
795
  started_at: z
757
796
  .string()
758
797
  .min(1)
@@ -776,6 +815,7 @@ export const HistoryLineSchema = z.union([
776
815
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
777
816
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
778
817
  variant: z.union([z.string(), z.null()]).optional(),
818
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
779
819
  }),
780
820
  z.looseObject({
781
821
  duration_ms: z
@@ -824,10 +864,13 @@ export const HistoryLineSchema = z.union([
824
864
  z.literal("1.4"),
825
865
  z.literal("1.5"),
826
866
  z.literal("1.6"),
867
+ z.literal("1.7"),
827
868
  ])
828
869
  .refine((value) => value !== undefined, { message: "Required" }),
829
870
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
830
- session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
871
+ session_id: z
872
+ .union([z.string(), z.null()])
873
+ .refine((value) => value !== undefined, { message: "Required" }),
831
874
  started_at: z.never().optional(),
832
875
  status: z
833
876
  .union([z.literal("ok"), z.literal("planned")])
@@ -842,6 +885,7 @@ export const HistoryLineSchema = z.union([
842
885
  type: z.literal("run").refine((value) => value !== undefined, { message: "Required" }),
843
886
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
844
887
  variant: z.union([z.string(), z.null()]).optional(),
888
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
845
889
  }),
846
890
  ]), z.union([
847
891
  z.looseObject({
@@ -850,7 +894,7 @@ export const HistoryLineSchema = z.union([
850
894
  z.intersection(z.looseObject({
851
895
  error: z.string().refine((value) => value !== undefined, { message: "Required" }),
852
896
  schema_version: z
853
- .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
897
+ .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")])
854
898
  .optional(),
855
899
  }), z.union([
856
900
  z.looseObject({
@@ -870,6 +914,17 @@ export const HistoryLineSchema = z.union([
870
914
  .refine((value) => value !== undefined, { message: "Required" }),
871
915
  }),
872
916
  ])),
917
+ ])), z.union([
918
+ z.looseObject({
919
+ work: z.null().optional(),
920
+ }),
921
+ z.looseObject({
922
+ schema_version: z.literal("1.7").optional(),
923
+ status: z.union([z.literal("nonzero"), z.literal("timeout"), z.literal("cancelled")]).optional(),
924
+ work: z
925
+ .union([z.literal("done"), z.literal("none")])
926
+ .refine((value) => value !== undefined, { message: "Required" }),
927
+ }),
873
928
  ])), z.union([
874
929
  z.looseObject({
875
930
  status: z
@@ -884,7 +939,7 @@ export const HistoryLineSchema = z.union([
884
939
  .optional(),
885
940
  }),
886
941
  z.looseObject({
887
- schema_version: z.union([z.literal("1.4"), z.literal("1.5"), z.literal("1.6")]).optional(),
942
+ schema_version: z.union([z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")]).optional(),
888
943
  }),
889
944
  ])), z.intersection(z.union([
890
945
  z.looseObject({
@@ -902,7 +957,7 @@ export const HistoryLineSchema = z.union([
902
957
  .optional(),
903
958
  }),
904
959
  z.looseObject({
905
- schema_version: z.union([z.literal("1.5"), z.literal("1.6")]).optional(),
960
+ schema_version: z.union([z.literal("1.5"), z.literal("1.6"), z.literal("1.7")]).optional(),
906
961
  }),
907
962
  ]), z.union([
908
963
  z.looseObject({
@@ -919,7 +974,7 @@ export const HistoryLineSchema = z.union([
919
974
  .optional(),
920
975
  }),
921
976
  z.looseObject({
922
- schema_version: z.literal("1.6").optional(),
977
+ schema_version: z.union([z.literal("1.6"), z.literal("1.7")]).optional(),
923
978
  }),
924
979
  ]))),
925
980
  ]);
@@ -971,7 +1026,7 @@ export const HistoryMigrateReportSchema = z.looseObject({
971
1026
  .gte(0)
972
1027
  .refine((value) => value !== undefined, { message: "Required" }),
973
1028
  });
974
- export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(z.union([
1029
+ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(z.intersection(z.union([
975
1030
  z.looseObject({
976
1031
  duration_ms: z
977
1032
  .int()
@@ -1031,7 +1086,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1031
1086
  z.intersection(z.lazy(() => ActionEventSchema), z.looseObject({
1032
1087
  kind: z.literal("tool_call").refine((value) => value !== undefined, { message: "Required" }),
1033
1088
  started_at: z.string().refine((value) => value !== undefined, { message: "Required" }),
1034
- status: z.literal("interrupted").refine((value) => value !== undefined, { message: "Required" }),
1089
+ status: z
1090
+ .literal("interrupted")
1091
+ .refine((value) => value !== undefined, { message: "Required" }),
1035
1092
  tool_call_id: z
1036
1093
  .string()
1037
1094
  .min(1)
@@ -1048,7 +1105,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1048
1105
  failure_kind: z
1049
1106
  .union([z.lazy(() => FailureKindSchema), z.null()])
1050
1107
  .refine((value) => value !== undefined, { message: "Required" }),
1051
- finished_at: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1108
+ finished_at: z
1109
+ .union([z.string(), z.null()])
1110
+ .refine((value) => value !== undefined, { message: "Required" }),
1052
1111
  harness: z.string().refine((value) => value !== undefined, { message: "Required" }),
1053
1112
  harness_id: z.string().refine((value) => value !== undefined, { message: "Required" }),
1054
1113
  history_id: z
@@ -1071,7 +1130,14 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1071
1130
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
1072
1131
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
1073
1132
  schema_version: z
1074
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1133
+ .union([
1134
+ z.literal("1.2"),
1135
+ z.literal("1.3"),
1136
+ z.literal("1.4"),
1137
+ z.literal("1.5"),
1138
+ z.literal("1.6"),
1139
+ z.literal("1.7"),
1140
+ ])
1075
1141
  .refine((value) => value !== undefined, { message: "Required" }),
1076
1142
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
1077
1143
  session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -1081,7 +1147,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1081
1147
  .refine((value) => value !== undefined, { message: "Required" }),
1082
1148
  status: z.lazy(() => StatusSchema).refine((value) => value !== undefined, { message: "Required" }),
1083
1149
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1084
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1150
+ text_source: z
1151
+ .union([z.string(), z.null()])
1152
+ .refine((value) => value !== undefined, { message: "Required" }),
1085
1153
  time_to_first_token_ms: z.union([z.int().gte(0), z.null()]).optional(),
1086
1154
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1087
1155
  tool_ms: z
@@ -1090,6 +1158,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1090
1158
  .refine((value) => value !== undefined, { message: "Required" }),
1091
1159
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1092
1160
  variant: z.union([z.string(), z.null()]).optional(),
1161
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1093
1162
  }),
1094
1163
  z.looseObject({
1095
1164
  duration_ms: z
@@ -1118,7 +1187,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1118
1187
  finished_at: z.string().refine((value) => value !== undefined, { message: "Required" }),
1119
1188
  kind: z.literal("tool_call").refine((value) => value !== undefined, { message: "Required" }),
1120
1189
  started_at: z.string().refine((value) => value !== undefined, { message: "Required" }),
1121
- status: z.literal("completed").refine((value) => value !== undefined, { message: "Required" }),
1190
+ status: z
1191
+ .literal("completed")
1192
+ .refine((value) => value !== undefined, { message: "Required" }),
1122
1193
  tool_call_id: z
1123
1194
  .string()
1124
1195
  .min(1)
@@ -1171,7 +1242,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1171
1242
  failure_kind: z
1172
1243
  .union([z.lazy(() => FailureKindSchema), z.null()])
1173
1244
  .refine((value) => value !== undefined, { message: "Required" }),
1174
- finished_at: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1245
+ finished_at: z
1246
+ .union([z.string(), z.null()])
1247
+ .refine((value) => value !== undefined, { message: "Required" }),
1175
1248
  harness: z.string().refine((value) => value !== undefined, { message: "Required" }),
1176
1249
  harness_id: z.string().optional(),
1177
1250
  history_id: z
@@ -1204,7 +1277,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1204
1277
  .refine((value) => value !== undefined, { message: "Required" }),
1205
1278
  status: z.lazy(() => StatusSchema).refine((value) => value !== undefined, { message: "Required" }),
1206
1279
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1207
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1280
+ text_source: z
1281
+ .union([z.string(), z.null()])
1282
+ .refine((value) => value !== undefined, { message: "Required" }),
1208
1283
  time_to_first_token_ms: z.union([z.int().gte(0), z.null()]).optional(),
1209
1284
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1210
1285
  tool_ms: z
@@ -1213,6 +1288,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1213
1288
  .refine((value) => value !== undefined, { message: "Required" }),
1214
1289
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1215
1290
  variant: z.union([z.string(), z.null()]).optional(),
1291
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1216
1292
  }),
1217
1293
  z.looseObject({
1218
1294
  duration_ms: z
@@ -1240,7 +1316,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1240
1316
  .refine((value) => value !== undefined, { message: "Required" }),
1241
1317
  input: z.unknown().refine((value) => value !== undefined, { message: "Required" }),
1242
1318
  kind: z.string().refine((value) => value !== undefined, { message: "Required" }),
1243
- name: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1319
+ name: z
1320
+ .union([z.string(), z.null()])
1321
+ .refine((value) => value !== undefined, { message: "Required" }),
1244
1322
  output: z
1245
1323
  .union([z.string(), z.null()])
1246
1324
  .refine((value) => value !== undefined, { message: "Required" }),
@@ -1275,7 +1353,14 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1275
1353
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
1276
1354
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
1277
1355
  schema_version: z
1278
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1356
+ .union([
1357
+ z.literal("1.2"),
1358
+ z.literal("1.3"),
1359
+ z.literal("1.4"),
1360
+ z.literal("1.5"),
1361
+ z.literal("1.6"),
1362
+ z.literal("1.7"),
1363
+ ])
1279
1364
  .refine((value) => value !== undefined, { message: "Required" }),
1280
1365
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
1281
1366
  session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -1284,12 +1369,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1284
1369
  .union([z.literal("ok"), z.literal("planned")])
1285
1370
  .refine((value) => value !== undefined, { message: "Required" }),
1286
1371
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1287
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1372
+ text_source: z
1373
+ .union([z.string(), z.null()])
1374
+ .refine((value) => value !== undefined, { message: "Required" }),
1288
1375
  time_to_first_token_ms: z.never().optional(),
1289
1376
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1290
1377
  tool_ms: z.never().optional(),
1291
1378
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1292
1379
  variant: z.union([z.string(), z.null()]).optional(),
1380
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1293
1381
  }),
1294
1382
  z.looseObject({
1295
1383
  duration_ms: z
@@ -1337,19 +1425,29 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1337
1425
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
1338
1426
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
1339
1427
  schema_version: z
1340
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1428
+ .union([
1429
+ z.literal("1.2"),
1430
+ z.literal("1.3"),
1431
+ z.literal("1.4"),
1432
+ z.literal("1.5"),
1433
+ z.literal("1.6"),
1434
+ z.literal("1.7"),
1435
+ ])
1341
1436
  .refine((value) => value !== undefined, { message: "Required" }),
1342
1437
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
1343
1438
  session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1344
1439
  started_at: z.never().optional(),
1345
1440
  status: z.lazy(() => StatusSchema).refine((value) => value !== undefined, { message: "Required" }),
1346
1441
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1347
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1442
+ text_source: z
1443
+ .union([z.string(), z.null()])
1444
+ .refine((value) => value !== undefined, { message: "Required" }),
1348
1445
  time_to_first_token_ms: z.never().optional(),
1349
1446
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1350
1447
  tool_ms: z.never().optional(),
1351
1448
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1352
1449
  variant: z.union([z.string(), z.null()]).optional(),
1450
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1353
1451
  }),
1354
1452
  z.looseObject({
1355
1453
  duration_ms: z
@@ -1393,7 +1491,14 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1393
1491
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
1394
1492
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
1395
1493
  schema_version: z
1396
- .union([z.literal("1.2"), z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1494
+ .union([
1495
+ z.literal("1.2"),
1496
+ z.literal("1.3"),
1497
+ z.literal("1.4"),
1498
+ z.literal("1.5"),
1499
+ z.literal("1.6"),
1500
+ z.literal("1.7"),
1501
+ ])
1397
1502
  .refine((value) => value !== undefined, { message: "Required" }),
1398
1503
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
1399
1504
  session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -1408,12 +1513,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1408
1513
  ])
1409
1514
  .refine((value) => value !== undefined, { message: "Required" }),
1410
1515
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1411
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1516
+ text_source: z
1517
+ .union([z.string(), z.null()])
1518
+ .refine((value) => value !== undefined, { message: "Required" }),
1412
1519
  time_to_first_token_ms: z.never().optional(),
1413
1520
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1414
1521
  tool_ms: z.never().optional(),
1415
1522
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1416
1523
  variant: z.union([z.string(), z.null()]).optional(),
1524
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1417
1525
  }),
1418
1526
  z.looseObject({
1419
1527
  duration_ms: z
@@ -1458,7 +1566,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1458
1566
  project: z.string().refine((value) => value !== undefined, { message: "Required" }),
1459
1567
  prompt: z.string().refine((value) => value !== undefined, { message: "Required" }),
1460
1568
  schema_version: z
1461
- .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1569
+ .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")])
1462
1570
  .refine((value) => value !== undefined, { message: "Required" }),
1463
1571
  session: z.string().refine((value) => value !== undefined, { message: "Required" }),
1464
1572
  session_id: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
@@ -1476,12 +1584,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1476
1584
  ])
1477
1585
  .refine((value) => value !== undefined, { message: "Required" }),
1478
1586
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1479
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1587
+ text_source: z
1588
+ .union([z.string(), z.null()])
1589
+ .refine((value) => value !== undefined, { message: "Required" }),
1480
1590
  time_to_first_token_ms: z.union([z.int().gte(0), z.null()]).optional(),
1481
1591
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1482
1592
  tool_ms: z.never().optional(),
1483
1593
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1484
1594
  variant: z.union([z.string(), z.null()]).optional(),
1595
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1485
1596
  }),
1486
1597
  z.looseObject({
1487
1598
  duration_ms: z
@@ -1545,12 +1656,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1545
1656
  ])
1546
1657
  .refine((value) => value !== undefined, { message: "Required" }),
1547
1658
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1548
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1659
+ text_source: z
1660
+ .union([z.string(), z.null()])
1661
+ .refine((value) => value !== undefined, { message: "Required" }),
1549
1662
  time_to_first_token_ms: z.never().optional(),
1550
1663
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1551
1664
  tool_ms: z.never().optional(),
1552
1665
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1553
1666
  variant: z.union([z.string(), z.null()]).optional(),
1667
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1554
1668
  }),
1555
1669
  z.looseObject({
1556
1670
  duration_ms: z
@@ -1626,12 +1740,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1626
1740
  .union([z.literal("ok"), z.literal("planned")])
1627
1741
  .refine((value) => value !== undefined, { message: "Required" }),
1628
1742
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1629
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1743
+ text_source: z
1744
+ .union([z.string(), z.null()])
1745
+ .refine((value) => value !== undefined, { message: "Required" }),
1630
1746
  time_to_first_token_ms: z.never().optional(),
1631
1747
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1632
1748
  tool_ms: z.never().optional(),
1633
1749
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1634
1750
  variant: z.union([z.string(), z.null()]).optional(),
1751
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1635
1752
  }),
1636
1753
  z.looseObject({
1637
1754
  duration_ms: z
@@ -1657,7 +1774,9 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1657
1774
  .refine((value) => value !== undefined, { message: "Required" }),
1658
1775
  input: z.unknown().refine((value) => value !== undefined, { message: "Required" }),
1659
1776
  kind: z.string().refine((value) => value !== undefined, { message: "Required" }),
1660
- name: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1777
+ name: z
1778
+ .union([z.string(), z.null()])
1779
+ .refine((value) => value !== undefined, { message: "Required" }),
1661
1780
  output: z
1662
1781
  .union([z.string(), z.null()])
1663
1782
  .refine((value) => value !== undefined, { message: "Required" }),
@@ -1696,12 +1815,15 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1696
1815
  started_at: z.union([z.string(), z.null()]).optional(),
1697
1816
  status: z.lazy(() => StatusSchema).refine((value) => value !== undefined, { message: "Required" }),
1698
1817
  text: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1699
- text_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
1818
+ text_source: z
1819
+ .union([z.string(), z.null()])
1820
+ .refine((value) => value !== undefined, { message: "Required" }),
1700
1821
  time_to_first_token_ms: z.union([z.int().gte(0), z.null()]).optional(),
1701
1822
  timestamp: z.string().refine((value) => value !== undefined, { message: "Required" }),
1702
1823
  tool_ms: z.union([z.int().gte(0), z.null()]).optional(),
1703
1824
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
1704
1825
  variant: z.union([z.string(), z.null()]).optional(),
1826
+ work: z.union([z.lazy(() => RunWorkSchema), z.null()]).optional(),
1705
1827
  }),
1706
1828
  ]), z.union([
1707
1829
  z.looseObject({
@@ -1710,7 +1832,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1710
1832
  z.intersection(z.looseObject({
1711
1833
  error: z.string().refine((value) => value !== undefined, { message: "Required" }),
1712
1834
  schema_version: z
1713
- .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6")])
1835
+ .union([z.literal("1.3"), z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")])
1714
1836
  .optional(),
1715
1837
  }), z.union([
1716
1838
  z.looseObject({
@@ -1725,9 +1847,22 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1725
1847
  .optional(),
1726
1848
  }),
1727
1849
  z.looseObject({
1728
- failure_kind: z.literal("tool_deferred").refine((value) => value !== undefined, { message: "Required" }),
1850
+ failure_kind: z
1851
+ .literal("tool_deferred")
1852
+ .refine((value) => value !== undefined, { message: "Required" }),
1729
1853
  }),
1730
1854
  ])),
1855
+ ])), z.union([
1856
+ z.looseObject({
1857
+ work: z.null().optional(),
1858
+ }),
1859
+ z.looseObject({
1860
+ schema_version: z.literal("1.7").optional(),
1861
+ status: z.union([z.literal("nonzero"), z.literal("timeout"), z.literal("cancelled")]).optional(),
1862
+ work: z
1863
+ .union([z.literal("done"), z.literal("none")])
1864
+ .refine((value) => value !== undefined, { message: "Required" }),
1865
+ }),
1731
1866
  ])), z.union([
1732
1867
  z.looseObject({
1733
1868
  status: z
@@ -1742,7 +1877,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1742
1877
  .optional(),
1743
1878
  }),
1744
1879
  z.looseObject({
1745
- schema_version: z.union([z.literal("1.4"), z.literal("1.5"), z.literal("1.6")]).optional(),
1880
+ schema_version: z.union([z.literal("1.4"), z.literal("1.5"), z.literal("1.6"), z.literal("1.7")]).optional(),
1746
1881
  }),
1747
1882
  ])), z.intersection(z.union([
1748
1883
  z.looseObject({
@@ -1760,7 +1895,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1760
1895
  .optional(),
1761
1896
  }),
1762
1897
  z.looseObject({
1763
- schema_version: z.union([z.literal("1.5"), z.literal("1.6")]).optional(),
1898
+ schema_version: z.union([z.literal("1.5"), z.literal("1.6"), z.literal("1.7")]).optional(),
1764
1899
  }),
1765
1900
  ]), z.union([
1766
1901
  z.looseObject({
@@ -1777,7 +1912,7 @@ export const HistoryRecordSchema = z.intersection(z.intersection(z.intersection(
1777
1912
  .optional(),
1778
1913
  }),
1779
1914
  z.looseObject({
1780
- schema_version: z.literal("1.6").optional(),
1915
+ schema_version: z.union([z.literal("1.6"), z.literal("1.7")]).optional(),
1781
1916
  }),
1782
1917
  ])));
1783
1918
  export const HistoryRecordsSchema = z.array(z.lazy(() => HistoryRecordSchema));
@@ -2049,6 +2184,9 @@ export const RunResultSchema = z.looseObject({
2049
2184
  usage: z.lazy(() => UsageSchema).refine((value) => value !== undefined, { message: "Required" }),
2050
2185
  usage_source: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
2051
2186
  variant: z.union([z.string(), z.null()]).refine((value) => value !== undefined, { message: "Required" }),
2187
+ work: z
2188
+ .union([z.lazy(() => RunWorkSchema), z.null()])
2189
+ .refine((value) => value !== undefined, { message: "Required" }),
2052
2190
  });
2053
2191
  export const RunStreamEnvelopeSchema = z.union([
2054
2192
  z.looseObject({
@@ -2060,6 +2198,7 @@ export const RunStreamEnvelopeSchema = z.union([
2060
2198
  type: z.literal("result").refine((value) => value !== undefined, { message: "Required" }),
2061
2199
  }),
2062
2200
  ]);
2201
+ export const RunWorkSchema = z.union([z.literal("done"), z.literal("none")]);
2063
2202
  export const SessionPhaseSchema = z.union([z.literal("create"), z.literal("continue")]);
2064
2203
  export const SessionReportSchema = z.looseObject({
2065
2204
  name: z.string().refine((value) => value !== undefined, { message: "Required" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneharness/sdk",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Typed Node.js SDK for oneharness",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "node": ">=20"
20
20
  },
21
21
  "dependencies": {
22
- "oneharness-cli": "0.10.2",
22
+ "oneharness-cli": "0.10.3",
23
23
  "zod": "^4.4.3"
24
24
  }
25
25
  }