devcontour-harness 0.1.0-alpha.28 → 0.1.0-alpha.30

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.
Files changed (75) hide show
  1. package/README.md +36 -2
  2. package/docs/architecture.md +80 -0
  3. package/docs/compatibility.md +15 -14
  4. package/docs/contracts.md +244 -26
  5. package/docs/release-notes/0.1.0-alpha.29.md +32 -0
  6. package/docs/release-notes/0.1.0-alpha.30.md +40 -0
  7. package/docs/review-probes.md +23 -20
  8. package/docs/toolchains.md +12 -1
  9. package/docs/upgrade.md +124 -0
  10. package/lib/agents/review-probe.d.ts +1 -0
  11. package/lib/agents/review-probe.js +38 -0
  12. package/lib/cli.js +57 -1
  13. package/lib/contracts/cli.d.ts +1150 -22
  14. package/lib/contracts/cli.js +129 -4
  15. package/lib/contracts/events.d.ts +642 -3
  16. package/lib/contracts/events.js +48 -0
  17. package/lib/contracts/index.d.ts +1 -0
  18. package/lib/contracts/index.js +1 -0
  19. package/lib/contracts/ports.d.ts +5 -1
  20. package/lib/contracts/published.d.ts +559 -2
  21. package/lib/contracts/published.js +2 -0
  22. package/lib/contracts/report.d.ts +1149 -0
  23. package/lib/contracts/report.js +401 -0
  24. package/lib/control/harness.d.ts +454 -1
  25. package/lib/control/harness.js +83 -1
  26. package/lib/control/report-file.d.ts +19 -0
  27. package/lib/control/report-file.js +85 -0
  28. package/lib/control/report.d.ts +9 -0
  29. package/lib/control/report.js +27 -0
  30. package/lib/engine/engine.d.ts +5 -1
  31. package/lib/engine/engine.js +49 -7
  32. package/lib/engine/runner.js +5 -2
  33. package/lib/environment/dependency-network.d.ts +42 -0
  34. package/lib/environment/dependency-network.js +413 -0
  35. package/lib/environment/isolation.d.ts +23 -1
  36. package/lib/environment/isolation.js +61 -2
  37. package/lib/environment/lifecycle.d.ts +3 -1
  38. package/lib/environment/lifecycle.js +22 -4
  39. package/lib/environment/os-tools.d.ts +3 -1
  40. package/lib/environment/os-tools.js +3 -1
  41. package/lib/environment/process.d.ts +11 -0
  42. package/lib/environment/process.js +42 -2
  43. package/lib/explain/state.d.ts +38 -0
  44. package/lib/explain/state.js +19 -11
  45. package/lib/index.d.ts +2 -0
  46. package/lib/index.js +2 -0
  47. package/lib/projections/attempt.d.ts +101 -0
  48. package/lib/projections/attempt.js +64 -0
  49. package/lib/projections/index.d.ts +2 -1
  50. package/lib/projections/index.js +2 -1
  51. package/lib/projections/stop.d.ts +19 -0
  52. package/lib/projections/stop.js +33 -27
  53. package/lib/report/compute.d.ts +72 -0
  54. package/lib/report/compute.js +1219 -0
  55. package/lib/report/document.d.ts +27 -0
  56. package/lib/report/document.js +206 -0
  57. package/lib/report/format.d.ts +23 -0
  58. package/lib/report/format.js +53 -0
  59. package/lib/report/html.d.ts +7 -0
  60. package/lib/report/html.js +109 -0
  61. package/lib/report/index.d.ts +4 -0
  62. package/lib/report/index.js +7 -0
  63. package/lib/report/markdown.d.ts +7 -0
  64. package/lib/report/markdown.js +112 -0
  65. package/lib/storage/sqlite.d.ts +19 -0
  66. package/lib/storage/sqlite.js +61 -6
  67. package/lib/verification/dependency-store.d.ts +13 -1
  68. package/lib/verification/dependency-store.js +99 -25
  69. package/lib/verification/file-digests.d.ts +33 -0
  70. package/lib/verification/file-digests.js +121 -0
  71. package/lib/verification/gates.d.ts +34 -4
  72. package/lib/verification/gates.js +113 -11
  73. package/package.json +5 -1
  74. package/schemas/run-event.schema.json +95 -0
  75. package/schemas/value-report.schema.json +2541 -0
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ /** Предел имени стадии в событии `attempt.stage`. */
3
+ export declare const STAGE_NAME_LIMIT = 300;
2
4
  /**
3
5
  * Нагрузка каждого типа события — закрытая схема: лишних полей нет, и
4
6
  * поэтому в событие нельзя положить fencing-токен, секрет или произвольный
@@ -103,6 +105,27 @@ export declare const eventPayloads: {
103
105
  sameVendor: z.ZodBoolean;
104
106
  blocking: z.ZodNumber;
105
107
  }, z.core.$strict>;
108
+ /**
109
+ * Граница стадии попытки (замер `AttemptState.timings`): одно `started` и
110
+ * не больше одного `finished` на стадию, в той же транзакции под fencing,
111
+ * что и замер. Стадия попытки, утратившей владение или упавшей, остаётся
112
+ * открытой: её конец — событие конца попытки. `at` и `durationMs` — по
113
+ * часам движка, те же, что в замере.
114
+ */
115
+ readonly 'attempt.stage': z.ZodObject<{
116
+ timingId: z.ZodString;
117
+ stage: z.ZodString;
118
+ phase: z.ZodEnum<{
119
+ started: "started";
120
+ finished: "finished";
121
+ }>;
122
+ at: z.ZodISODateTime;
123
+ durationMs: z.ZodOptional<z.ZodNumber>;
124
+ outcome: z.ZodOptional<z.ZodEnum<{
125
+ passed: "passed";
126
+ failed: "failed";
127
+ }>>;
128
+ }, z.core.$strict>;
106
129
  readonly 'attempt.failed': z.ZodObject<{
107
130
  failureKind: z.ZodEnum<{
108
131
  gate: "gate";
@@ -320,7 +343,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
320
343
  workId: z.ZodOptional<z.ZodString>;
321
344
  runId: z.ZodOptional<z.ZodString>;
322
345
  attempt: z.ZodOptional<z.ZodNumber>;
323
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
346
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
324
347
  payload: z.ZodObject<{
325
348
  digest: z.ZodString;
326
349
  orders: z.ZodNumber;
@@ -410,6 +433,19 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
410
433
  }>;
411
434
  sameVendor: z.ZodBoolean;
412
435
  blocking: z.ZodNumber;
436
+ }, z.core.$strict> | z.ZodObject<{
437
+ timingId: z.ZodString;
438
+ stage: z.ZodString;
439
+ phase: z.ZodEnum<{
440
+ started: "started";
441
+ finished: "finished";
442
+ }>;
443
+ at: z.ZodISODateTime;
444
+ durationMs: z.ZodOptional<z.ZodNumber>;
445
+ outcome: z.ZodOptional<z.ZodEnum<{
446
+ passed: "passed";
447
+ failed: "failed";
448
+ }>>;
413
449
  }, z.core.$strict> | z.ZodObject<{
414
450
  failureKind: z.ZodEnum<{
415
451
  gate: "gate";
@@ -582,7 +618,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
582
618
  workId: z.ZodOptional<z.ZodString>;
583
619
  runId: z.ZodOptional<z.ZodString>;
584
620
  attempt: z.ZodOptional<z.ZodNumber>;
585
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
621
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
586
622
  payload: z.ZodObject<{
587
623
  digest: z.ZodString;
588
624
  orders: z.ZodNumber;
@@ -672,6 +708,19 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
672
708
  }>;
673
709
  sameVendor: z.ZodBoolean;
674
710
  blocking: z.ZodNumber;
711
+ }, z.core.$strict> | z.ZodObject<{
712
+ timingId: z.ZodString;
713
+ stage: z.ZodString;
714
+ phase: z.ZodEnum<{
715
+ started: "started";
716
+ finished: "finished";
717
+ }>;
718
+ at: z.ZodISODateTime;
719
+ durationMs: z.ZodOptional<z.ZodNumber>;
720
+ outcome: z.ZodOptional<z.ZodEnum<{
721
+ passed: "passed";
722
+ failed: "failed";
723
+ }>>;
675
724
  }, z.core.$strict> | z.ZodObject<{
676
725
  failureKind: z.ZodEnum<{
677
726
  gate: "gate";
@@ -837,12 +886,602 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
837
886
  attempts: z.ZodNumber;
838
887
  }, z.core.$strict>;
839
888
  }, z.core.$strict>[]], "type">;
840
- export type RunEvent = {
889
+ /** Событие известного этой версии типа: так оно записывается. */
890
+ export type KnownRunEvent = {
841
891
  [T in EventType]: Envelope & {
842
892
  type: T;
843
893
  payload: z.infer<(typeof eventPayloads)[T]>;
844
894
  };
845
895
  }[EventType];
896
+ /**
897
+ * Событие типа, которого эта версия не знает (его записала более новая
898
+ * версия): при чтении журнала оно не обрывает список, а возвращается
899
+ * непрозрачным — конверт, `type: 'unknown'` и исходный тип в `original`;
900
+ * нагрузка не возвращается. Записать такое событие нельзя: писатель строгий
901
+ * (`runEventSchema`). Известный тип с нарушенной нагрузкой — по-прежнему отказ.
902
+ */
903
+ export declare const unknownRunEventSchema: z.ZodObject<{
904
+ apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
905
+ seq: z.ZodNumber;
906
+ at: z.ZodISODateTime;
907
+ graphId: z.ZodOptional<z.ZodString>;
908
+ workId: z.ZodOptional<z.ZodString>;
909
+ runId: z.ZodOptional<z.ZodString>;
910
+ attempt: z.ZodOptional<z.ZodNumber>;
911
+ type: z.ZodLiteral<"unknown">;
912
+ original: z.ZodString;
913
+ }, z.core.$strict>;
914
+ export type UnknownRunEvent = z.infer<typeof unknownRunEventSchema>;
915
+ /** Событие журнала при чтении: известного типа или непрозрачное неизвестное. */
916
+ export type RunEvent = KnownRunEvent | UnknownRunEvent;
917
+ /** Схема прочитанного события (`events`): `runEventSchema` и `unknownRunEventSchema`. */
918
+ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
919
+ apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
920
+ seq: z.ZodNumber;
921
+ at: z.ZodISODateTime;
922
+ graphId: z.ZodOptional<z.ZodString>;
923
+ workId: z.ZodOptional<z.ZodString>;
924
+ runId: z.ZodOptional<z.ZodString>;
925
+ attempt: z.ZodOptional<z.ZodNumber>;
926
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
927
+ payload: z.ZodObject<{
928
+ digest: z.ZodString;
929
+ orders: z.ZodNumber;
930
+ source: z.ZodObject<{
931
+ connector: z.ZodString;
932
+ ref: z.ZodString;
933
+ revision: z.ZodString;
934
+ }, z.core.$strict>;
935
+ }, z.core.$strict> | z.ZodObject<{
936
+ kind: z.ZodEnum<{
937
+ plan: "plan";
938
+ contract: "contract";
939
+ }>;
940
+ subject: z.ZodString;
941
+ digest: z.ZodString;
942
+ round: z.ZodNumber;
943
+ approved: z.ZodBoolean;
944
+ open: z.ZodNumber;
945
+ }, z.core.$strict> | z.ZodObject<{
946
+ digest: z.ZodString;
947
+ actor: z.ZodEnum<{
948
+ agent: "agent";
949
+ operator: "operator";
950
+ }>;
951
+ }, z.core.$strict> | z.ZodObject<{
952
+ orderDigest: z.ZodString;
953
+ }, z.core.$strict> | z.ZodObject<{
954
+ operation: z.ZodString;
955
+ reason: z.ZodString;
956
+ released: z.ZodBoolean;
957
+ }, z.core.$strict> | z.ZodObject<{
958
+ owner: z.ZodString;
959
+ runtime: z.ZodEnum<{
960
+ codex: "codex";
961
+ claude: "claude";
962
+ fixture: "fixture";
963
+ }>;
964
+ reviewer: z.ZodEnum<{
965
+ codex: "codex";
966
+ claude: "claude";
967
+ fixture: "fixture";
968
+ }>;
969
+ policyDigest: z.ZodString;
970
+ engineVersion: z.ZodString;
971
+ }, z.core.$strict> | z.ZodObject<{
972
+ phase: z.ZodEnum<{
973
+ ready: "ready";
974
+ failed: "failed";
975
+ cancelled: "cancelled";
976
+ draft: "draft";
977
+ running: "running";
978
+ verifying: "verifying";
979
+ reviewing: "reviewing";
980
+ integrating: "integrating";
981
+ done: "done";
982
+ }>;
983
+ sha: z.ZodOptional<z.ZodString>;
984
+ }, z.core.$strict> | z.ZodObject<{
985
+ phase: z.ZodEnum<{
986
+ candidate: "candidate";
987
+ integration: "integration";
988
+ }>;
989
+ gate: z.ZodString;
990
+ sha: z.ZodString;
991
+ passed: z.ZodBoolean;
992
+ evidenceId: z.ZodString;
993
+ consumer: z.ZodOptional<z.ZodString>;
994
+ recheck: z.ZodOptional<z.ZodObject<{
995
+ of: z.ZodString;
996
+ outcome: z.ZodEnum<{
997
+ flaky: "flaky";
998
+ confirmed: "confirmed";
999
+ }>;
1000
+ }, z.core.$strict>>;
1001
+ }, z.core.$strict> | z.ZodObject<{
1002
+ phase: z.ZodEnum<{
1003
+ candidate: "candidate";
1004
+ integration: "integration";
1005
+ }>;
1006
+ sha: z.ZodString;
1007
+ passed: z.ZodBoolean;
1008
+ evidenceId: z.ZodString;
1009
+ reviewer: z.ZodEnum<{
1010
+ codex: "codex";
1011
+ claude: "claude";
1012
+ fixture: "fixture";
1013
+ }>;
1014
+ sameVendor: z.ZodBoolean;
1015
+ blocking: z.ZodNumber;
1016
+ }, z.core.$strict> | z.ZodObject<{
1017
+ timingId: z.ZodString;
1018
+ stage: z.ZodString;
1019
+ phase: z.ZodEnum<{
1020
+ started: "started";
1021
+ finished: "finished";
1022
+ }>;
1023
+ at: z.ZodISODateTime;
1024
+ durationMs: z.ZodOptional<z.ZodNumber>;
1025
+ outcome: z.ZodOptional<z.ZodEnum<{
1026
+ passed: "passed";
1027
+ failed: "failed";
1028
+ }>>;
1029
+ }, z.core.$strict> | z.ZodObject<{
1030
+ failureKind: z.ZodEnum<{
1031
+ gate: "gate";
1032
+ unknown: "unknown";
1033
+ review: "review";
1034
+ cancelled: "cancelled";
1035
+ environment: "environment";
1036
+ timeout: "timeout";
1037
+ "provider-auth": "provider-auth";
1038
+ "stale-base": "stale-base";
1039
+ "empty-result": "empty-result";
1040
+ unfinished: "unfinished";
1041
+ "scope-violation": "scope-violation";
1042
+ "review-protocol": "review-protocol";
1043
+ merge: "merge";
1044
+ budget: "budget";
1045
+ "needs-lead": "needs-lead";
1046
+ }>;
1047
+ message: z.ZodString;
1048
+ blocked: z.ZodBoolean;
1049
+ }, z.core.$strict> | z.ZodObject<{
1050
+ leaseUntil: z.ZodNumber;
1051
+ }, z.core.$strict> | z.ZodObject<{
1052
+ reason: z.ZodString;
1053
+ }, z.core.$strict> | z.ZodObject<{
1054
+ integrationSha: z.ZodString;
1055
+ accepted: z.ZodBoolean;
1056
+ reason: z.ZodOptional<z.ZodString>;
1057
+ }, z.core.$strict> | z.ZodObject<{
1058
+ resultSha: z.ZodString;
1059
+ integrationSha: z.ZodString;
1060
+ }, z.core.$strict> | z.ZodObject<{
1061
+ code: z.ZodString;
1062
+ message: z.ZodString;
1063
+ }, z.core.$strict> | z.ZodObject<{
1064
+ reason: z.ZodEnum<{
1065
+ runtime: "runtime";
1066
+ operator: "operator";
1067
+ shutdown: "shutdown";
1068
+ "base-check": "base-check";
1069
+ reconfigure: "reconfigure";
1070
+ }>;
1071
+ failures: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1072
+ gate: "gate";
1073
+ unknown: "unknown";
1074
+ review: "review";
1075
+ cancelled: "cancelled";
1076
+ environment: "environment";
1077
+ timeout: "timeout";
1078
+ "provider-auth": "provider-auth";
1079
+ "stale-base": "stale-base";
1080
+ "empty-result": "empty-result";
1081
+ unfinished: "unfinished";
1082
+ "scope-violation": "scope-violation";
1083
+ "review-protocol": "review-protocol";
1084
+ merge: "merge";
1085
+ budget: "budget";
1086
+ "needs-lead": "needs-lead";
1087
+ }>>>;
1088
+ }, z.core.$strict> | z.ZodObject<{
1089
+ reason: z.ZodEnum<{
1090
+ runtime: "runtime";
1091
+ operator: "operator";
1092
+ shutdown: "shutdown";
1093
+ "base-check": "base-check";
1094
+ reconfigure: "reconfigure";
1095
+ }>;
1096
+ }, z.core.$strict> | z.ZodObject<{
1097
+ owner: z.ZodString;
1098
+ }, z.core.$strict> | z.ZodObject<{
1099
+ owner: z.ZodString;
1100
+ }, z.core.$strict> | z.ZodObject<{
1101
+ scope: z.ZodEnum<{
1102
+ work: "work";
1103
+ group: "group";
1104
+ total: "total";
1105
+ }>;
1106
+ scopeId: z.ZodOptional<z.ZodString>;
1107
+ state: z.ZodEnum<{
1108
+ exceeded: "exceeded";
1109
+ undetermined: "undetermined";
1110
+ }>;
1111
+ reason: z.ZodString;
1112
+ }, z.core.$strict> | z.ZodObject<{
1113
+ suite: z.ZodString;
1114
+ pending: z.ZodString;
1115
+ version: z.ZodNumber;
1116
+ digest: z.ZodString;
1117
+ status: z.ZodEnum<{
1118
+ completed: "completed";
1119
+ waiting: "waiting";
1120
+ }>;
1121
+ accepted: z.ZodArray<z.ZodString>;
1122
+ }, z.core.$strict> | z.ZodObject<{
1123
+ recoveryId: z.ZodString;
1124
+ property: z.ZodString;
1125
+ status: z.ZodEnum<{
1126
+ closed: "closed";
1127
+ stopped: "stopped";
1128
+ "awaiting-lead": "awaiting-lead";
1129
+ analyzing: "analyzing";
1130
+ applying: "applying";
1131
+ retry: "retry";
1132
+ retrying: "retrying";
1133
+ "awaiting-user": "awaiting-user";
1134
+ }>;
1135
+ reason: z.ZodOptional<z.ZodString>;
1136
+ }, z.core.$strict> | z.ZodObject<{
1137
+ verificationId: z.ZodString;
1138
+ workIds: z.ZodArray<z.ZodString>;
1139
+ policyDigest: z.ZodString;
1140
+ }, z.core.$strict> | z.ZodObject<{
1141
+ verificationId: z.ZodString;
1142
+ status: z.ZodEnum<{
1143
+ passed: "passed";
1144
+ failed: "failed";
1145
+ }>;
1146
+ manifestDigest: z.ZodOptional<z.ZodString>;
1147
+ error: z.ZodOptional<z.ZodString>;
1148
+ }, z.core.$strict> | z.ZodObject<{
1149
+ digest: z.ZodString;
1150
+ generation: z.ZodNumber;
1151
+ by: z.ZodString;
1152
+ operation: z.ZodOptional<z.ZodString>;
1153
+ }, z.core.$strict> | z.ZodObject<{
1154
+ operation: z.ZodString;
1155
+ digest: z.ZodString;
1156
+ status: z.ZodEnum<{
1157
+ failed: "failed";
1158
+ requested: "requested";
1159
+ cleared: "cleared";
1160
+ }>;
1161
+ error: z.ZodOptional<z.ZodString>;
1162
+ }, z.core.$strict> | z.ZodObject<{
1163
+ sink: z.ZodString;
1164
+ key: z.ZodString;
1165
+ revision: z.ZodString;
1166
+ attempts: z.ZodNumber;
1167
+ }, z.core.$strict> | z.ZodObject<{
1168
+ receipt: z.ZodOptional<z.ZodString>;
1169
+ sink: z.ZodString;
1170
+ key: z.ZodString;
1171
+ revision: z.ZodString;
1172
+ attempts: z.ZodNumber;
1173
+ }, z.core.$strict> | z.ZodObject<{
1174
+ error: z.ZodString;
1175
+ sink: z.ZodString;
1176
+ key: z.ZodString;
1177
+ revision: z.ZodString;
1178
+ attempts: z.ZodNumber;
1179
+ }, z.core.$strict> | z.ZodObject<{
1180
+ currentRevision: z.ZodString;
1181
+ sink: z.ZodString;
1182
+ key: z.ZodString;
1183
+ revision: z.ZodString;
1184
+ attempts: z.ZodNumber;
1185
+ }, z.core.$strict> | z.ZodObject<{
1186
+ operation: z.ZodString;
1187
+ reason: z.ZodString;
1188
+ sink: z.ZodString;
1189
+ key: z.ZodString;
1190
+ revision: z.ZodString;
1191
+ attempts: z.ZodNumber;
1192
+ }, z.core.$strict>;
1193
+ }, z.core.$strict>, ...z.ZodObject<{
1194
+ apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
1195
+ seq: z.ZodNumber;
1196
+ at: z.ZodISODateTime;
1197
+ graphId: z.ZodOptional<z.ZodString>;
1198
+ workId: z.ZodOptional<z.ZodString>;
1199
+ runId: z.ZodOptional<z.ZodString>;
1200
+ attempt: z.ZodOptional<z.ZodNumber>;
1201
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.failed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1202
+ payload: z.ZodObject<{
1203
+ digest: z.ZodString;
1204
+ orders: z.ZodNumber;
1205
+ source: z.ZodObject<{
1206
+ connector: z.ZodString;
1207
+ ref: z.ZodString;
1208
+ revision: z.ZodString;
1209
+ }, z.core.$strict>;
1210
+ }, z.core.$strict> | z.ZodObject<{
1211
+ kind: z.ZodEnum<{
1212
+ plan: "plan";
1213
+ contract: "contract";
1214
+ }>;
1215
+ subject: z.ZodString;
1216
+ digest: z.ZodString;
1217
+ round: z.ZodNumber;
1218
+ approved: z.ZodBoolean;
1219
+ open: z.ZodNumber;
1220
+ }, z.core.$strict> | z.ZodObject<{
1221
+ digest: z.ZodString;
1222
+ actor: z.ZodEnum<{
1223
+ agent: "agent";
1224
+ operator: "operator";
1225
+ }>;
1226
+ }, z.core.$strict> | z.ZodObject<{
1227
+ orderDigest: z.ZodString;
1228
+ }, z.core.$strict> | z.ZodObject<{
1229
+ operation: z.ZodString;
1230
+ reason: z.ZodString;
1231
+ released: z.ZodBoolean;
1232
+ }, z.core.$strict> | z.ZodObject<{
1233
+ owner: z.ZodString;
1234
+ runtime: z.ZodEnum<{
1235
+ codex: "codex";
1236
+ claude: "claude";
1237
+ fixture: "fixture";
1238
+ }>;
1239
+ reviewer: z.ZodEnum<{
1240
+ codex: "codex";
1241
+ claude: "claude";
1242
+ fixture: "fixture";
1243
+ }>;
1244
+ policyDigest: z.ZodString;
1245
+ engineVersion: z.ZodString;
1246
+ }, z.core.$strict> | z.ZodObject<{
1247
+ phase: z.ZodEnum<{
1248
+ ready: "ready";
1249
+ failed: "failed";
1250
+ cancelled: "cancelled";
1251
+ draft: "draft";
1252
+ running: "running";
1253
+ verifying: "verifying";
1254
+ reviewing: "reviewing";
1255
+ integrating: "integrating";
1256
+ done: "done";
1257
+ }>;
1258
+ sha: z.ZodOptional<z.ZodString>;
1259
+ }, z.core.$strict> | z.ZodObject<{
1260
+ phase: z.ZodEnum<{
1261
+ candidate: "candidate";
1262
+ integration: "integration";
1263
+ }>;
1264
+ gate: z.ZodString;
1265
+ sha: z.ZodString;
1266
+ passed: z.ZodBoolean;
1267
+ evidenceId: z.ZodString;
1268
+ consumer: z.ZodOptional<z.ZodString>;
1269
+ recheck: z.ZodOptional<z.ZodObject<{
1270
+ of: z.ZodString;
1271
+ outcome: z.ZodEnum<{
1272
+ flaky: "flaky";
1273
+ confirmed: "confirmed";
1274
+ }>;
1275
+ }, z.core.$strict>>;
1276
+ }, z.core.$strict> | z.ZodObject<{
1277
+ phase: z.ZodEnum<{
1278
+ candidate: "candidate";
1279
+ integration: "integration";
1280
+ }>;
1281
+ sha: z.ZodString;
1282
+ passed: z.ZodBoolean;
1283
+ evidenceId: z.ZodString;
1284
+ reviewer: z.ZodEnum<{
1285
+ codex: "codex";
1286
+ claude: "claude";
1287
+ fixture: "fixture";
1288
+ }>;
1289
+ sameVendor: z.ZodBoolean;
1290
+ blocking: z.ZodNumber;
1291
+ }, z.core.$strict> | z.ZodObject<{
1292
+ timingId: z.ZodString;
1293
+ stage: z.ZodString;
1294
+ phase: z.ZodEnum<{
1295
+ started: "started";
1296
+ finished: "finished";
1297
+ }>;
1298
+ at: z.ZodISODateTime;
1299
+ durationMs: z.ZodOptional<z.ZodNumber>;
1300
+ outcome: z.ZodOptional<z.ZodEnum<{
1301
+ passed: "passed";
1302
+ failed: "failed";
1303
+ }>>;
1304
+ }, z.core.$strict> | z.ZodObject<{
1305
+ failureKind: z.ZodEnum<{
1306
+ gate: "gate";
1307
+ unknown: "unknown";
1308
+ review: "review";
1309
+ cancelled: "cancelled";
1310
+ environment: "environment";
1311
+ timeout: "timeout";
1312
+ "provider-auth": "provider-auth";
1313
+ "stale-base": "stale-base";
1314
+ "empty-result": "empty-result";
1315
+ unfinished: "unfinished";
1316
+ "scope-violation": "scope-violation";
1317
+ "review-protocol": "review-protocol";
1318
+ merge: "merge";
1319
+ budget: "budget";
1320
+ "needs-lead": "needs-lead";
1321
+ }>;
1322
+ message: z.ZodString;
1323
+ blocked: z.ZodBoolean;
1324
+ }, z.core.$strict> | z.ZodObject<{
1325
+ leaseUntil: z.ZodNumber;
1326
+ }, z.core.$strict> | z.ZodObject<{
1327
+ reason: z.ZodString;
1328
+ }, z.core.$strict> | z.ZodObject<{
1329
+ integrationSha: z.ZodString;
1330
+ accepted: z.ZodBoolean;
1331
+ reason: z.ZodOptional<z.ZodString>;
1332
+ }, z.core.$strict> | z.ZodObject<{
1333
+ resultSha: z.ZodString;
1334
+ integrationSha: z.ZodString;
1335
+ }, z.core.$strict> | z.ZodObject<{
1336
+ code: z.ZodString;
1337
+ message: z.ZodString;
1338
+ }, z.core.$strict> | z.ZodObject<{
1339
+ reason: z.ZodEnum<{
1340
+ runtime: "runtime";
1341
+ operator: "operator";
1342
+ shutdown: "shutdown";
1343
+ "base-check": "base-check";
1344
+ reconfigure: "reconfigure";
1345
+ }>;
1346
+ failures: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1347
+ gate: "gate";
1348
+ unknown: "unknown";
1349
+ review: "review";
1350
+ cancelled: "cancelled";
1351
+ environment: "environment";
1352
+ timeout: "timeout";
1353
+ "provider-auth": "provider-auth";
1354
+ "stale-base": "stale-base";
1355
+ "empty-result": "empty-result";
1356
+ unfinished: "unfinished";
1357
+ "scope-violation": "scope-violation";
1358
+ "review-protocol": "review-protocol";
1359
+ merge: "merge";
1360
+ budget: "budget";
1361
+ "needs-lead": "needs-lead";
1362
+ }>>>;
1363
+ }, z.core.$strict> | z.ZodObject<{
1364
+ reason: z.ZodEnum<{
1365
+ runtime: "runtime";
1366
+ operator: "operator";
1367
+ shutdown: "shutdown";
1368
+ "base-check": "base-check";
1369
+ reconfigure: "reconfigure";
1370
+ }>;
1371
+ }, z.core.$strict> | z.ZodObject<{
1372
+ owner: z.ZodString;
1373
+ }, z.core.$strict> | z.ZodObject<{
1374
+ owner: z.ZodString;
1375
+ }, z.core.$strict> | z.ZodObject<{
1376
+ scope: z.ZodEnum<{
1377
+ work: "work";
1378
+ group: "group";
1379
+ total: "total";
1380
+ }>;
1381
+ scopeId: z.ZodOptional<z.ZodString>;
1382
+ state: z.ZodEnum<{
1383
+ exceeded: "exceeded";
1384
+ undetermined: "undetermined";
1385
+ }>;
1386
+ reason: z.ZodString;
1387
+ }, z.core.$strict> | z.ZodObject<{
1388
+ suite: z.ZodString;
1389
+ pending: z.ZodString;
1390
+ version: z.ZodNumber;
1391
+ digest: z.ZodString;
1392
+ status: z.ZodEnum<{
1393
+ completed: "completed";
1394
+ waiting: "waiting";
1395
+ }>;
1396
+ accepted: z.ZodArray<z.ZodString>;
1397
+ }, z.core.$strict> | z.ZodObject<{
1398
+ recoveryId: z.ZodString;
1399
+ property: z.ZodString;
1400
+ status: z.ZodEnum<{
1401
+ closed: "closed";
1402
+ stopped: "stopped";
1403
+ "awaiting-lead": "awaiting-lead";
1404
+ analyzing: "analyzing";
1405
+ applying: "applying";
1406
+ retry: "retry";
1407
+ retrying: "retrying";
1408
+ "awaiting-user": "awaiting-user";
1409
+ }>;
1410
+ reason: z.ZodOptional<z.ZodString>;
1411
+ }, z.core.$strict> | z.ZodObject<{
1412
+ verificationId: z.ZodString;
1413
+ workIds: z.ZodArray<z.ZodString>;
1414
+ policyDigest: z.ZodString;
1415
+ }, z.core.$strict> | z.ZodObject<{
1416
+ verificationId: z.ZodString;
1417
+ status: z.ZodEnum<{
1418
+ passed: "passed";
1419
+ failed: "failed";
1420
+ }>;
1421
+ manifestDigest: z.ZodOptional<z.ZodString>;
1422
+ error: z.ZodOptional<z.ZodString>;
1423
+ }, z.core.$strict> | z.ZodObject<{
1424
+ digest: z.ZodString;
1425
+ generation: z.ZodNumber;
1426
+ by: z.ZodString;
1427
+ operation: z.ZodOptional<z.ZodString>;
1428
+ }, z.core.$strict> | z.ZodObject<{
1429
+ operation: z.ZodString;
1430
+ digest: z.ZodString;
1431
+ status: z.ZodEnum<{
1432
+ failed: "failed";
1433
+ requested: "requested";
1434
+ cleared: "cleared";
1435
+ }>;
1436
+ error: z.ZodOptional<z.ZodString>;
1437
+ }, z.core.$strict> | z.ZodObject<{
1438
+ sink: z.ZodString;
1439
+ key: z.ZodString;
1440
+ revision: z.ZodString;
1441
+ attempts: z.ZodNumber;
1442
+ }, z.core.$strict> | z.ZodObject<{
1443
+ receipt: z.ZodOptional<z.ZodString>;
1444
+ sink: z.ZodString;
1445
+ key: z.ZodString;
1446
+ revision: z.ZodString;
1447
+ attempts: z.ZodNumber;
1448
+ }, z.core.$strict> | z.ZodObject<{
1449
+ error: z.ZodString;
1450
+ sink: z.ZodString;
1451
+ key: z.ZodString;
1452
+ revision: z.ZodString;
1453
+ attempts: z.ZodNumber;
1454
+ }, z.core.$strict> | z.ZodObject<{
1455
+ currentRevision: z.ZodString;
1456
+ sink: z.ZodString;
1457
+ key: z.ZodString;
1458
+ revision: z.ZodString;
1459
+ attempts: z.ZodNumber;
1460
+ }, z.core.$strict> | z.ZodObject<{
1461
+ operation: z.ZodString;
1462
+ reason: z.ZodString;
1463
+ sink: z.ZodString;
1464
+ key: z.ZodString;
1465
+ revision: z.ZodString;
1466
+ attempts: z.ZodNumber;
1467
+ }, z.core.$strict>;
1468
+ }, z.core.$strict>[], z.ZodObject<{
1469
+ apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
1470
+ seq: z.ZodNumber;
1471
+ at: z.ZodISODateTime;
1472
+ graphId: z.ZodOptional<z.ZodString>;
1473
+ workId: z.ZodOptional<z.ZodString>;
1474
+ runId: z.ZodOptional<z.ZodString>;
1475
+ attempt: z.ZodOptional<z.ZodNumber>;
1476
+ type: z.ZodLiteral<"unknown">;
1477
+ original: z.ZodString;
1478
+ }, z.core.$strict>], "type">;
1479
+ /**
1480
+ * Разобрать сохранённое событие терпимо к неизвестному типу: тип, которого
1481
+ * нет в `eventPayloads`, становится `UnknownRunEvent` (конверт проверяется
1482
+ * строго); известный тип разбирается строгой схемой, и её отказ — ошибка.
1483
+ */
1484
+ export declare function readRunEvent(raw: unknown): RunEvent;
846
1485
  export type RunEventDraft = {
847
1486
  [T in EventType]: Omit<Envelope, 'apiVersion' | 'seq' | 'at'> & {
848
1487
  type: T;