codex-workflow-v2 2.0.0-beta.12.8 → 2.0.0-beta.13

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 (124) hide show
  1. package/README.md +60 -16
  2. package/dist/reviewer-runtime-build.json +1092 -0
  3. package/dist/src/alpha6/check-support-anchor.d.ts +24 -0
  4. package/dist/src/alpha6/check-support-anchor.js +102 -0
  5. package/dist/src/alpha6/check-support-anchor.js.map +1 -0
  6. package/dist/src/alpha6/component-owner.d.ts +28 -0
  7. package/dist/src/alpha6/component-owner.js +95 -0
  8. package/dist/src/alpha6/component-owner.js.map +1 -0
  9. package/dist/src/alpha6/downstream-proof.js +4 -2
  10. package/dist/src/alpha6/downstream-proof.js.map +1 -1
  11. package/dist/src/alpha6/mechanical-feasibility.js +42 -12
  12. package/dist/src/alpha6/mechanical-feasibility.js.map +1 -1
  13. package/dist/src/alpha6/milestone.d.ts +6 -2
  14. package/dist/src/alpha6/milestone.js +164 -10
  15. package/dist/src/alpha6/milestone.js.map +1 -1
  16. package/dist/src/alpha6/npm-check-contract.d.ts +11 -0
  17. package/dist/src/alpha6/npm-check-contract.js +36 -0
  18. package/dist/src/alpha6/npm-check-contract.js.map +1 -0
  19. package/dist/src/alpha6/plan-integrity.js +157 -27
  20. package/dist/src/alpha6/plan-integrity.js.map +1 -1
  21. package/dist/src/alpha6/plan-risk.js +3 -1
  22. package/dist/src/alpha6/plan-risk.js.map +1 -1
  23. package/dist/src/alpha6/remediation-cause.d.ts +13 -0
  24. package/dist/src/alpha6/remediation-cause.js +77 -0
  25. package/dist/src/alpha6/remediation-cause.js.map +1 -0
  26. package/dist/src/alpha6/remediation.d.ts +15 -4
  27. package/dist/src/alpha6/remediation.js +430 -67
  28. package/dist/src/alpha6/remediation.js.map +1 -1
  29. package/dist/src/alpha6/review.d.ts +6 -0
  30. package/dist/src/alpha6/review.js +46 -4
  31. package/dist/src/alpha6/review.js.map +1 -1
  32. package/dist/src/artifacts.js +6 -0
  33. package/dist/src/artifacts.js.map +1 -1
  34. package/dist/src/cli-actions.d.ts +25 -0
  35. package/dist/src/cli-actions.js +109 -0
  36. package/dist/src/cli-actions.js.map +1 -0
  37. package/dist/src/cli.js +244 -253
  38. package/dist/src/cli.js.map +1 -1
  39. package/dist/src/contracts.d.ts +202 -5
  40. package/dist/src/credential-transport.d.ts +38 -0
  41. package/dist/src/credential-transport.js +156 -0
  42. package/dist/src/credential-transport.js.map +1 -0
  43. package/dist/src/dependency-provenance.d.ts +23 -2
  44. package/dist/src/dependency-provenance.js +239 -36
  45. package/dist/src/dependency-provenance.js.map +1 -1
  46. package/dist/src/domain/completed-step-carryover.d.ts +13 -0
  47. package/dist/src/domain/completed-step-carryover.js +71 -0
  48. package/dist/src/domain/completed-step-carryover.js.map +1 -0
  49. package/dist/src/domain/validation.d.ts +9 -1
  50. package/dist/src/domain/validation.js +86 -0
  51. package/dist/src/domain/validation.js.map +1 -1
  52. package/dist/src/gateway-handshake.d.ts +11 -0
  53. package/dist/src/gateway-handshake.js +92 -0
  54. package/dist/src/gateway-handshake.js.map +1 -0
  55. package/dist/src/git.js +1 -0
  56. package/dist/src/git.js.map +1 -1
  57. package/dist/src/historical-step-provenance.d.ts +20 -0
  58. package/dist/src/historical-step-provenance.js +111 -0
  59. package/dist/src/historical-step-provenance.js.map +1 -0
  60. package/dist/src/index.d.ts +2 -0
  61. package/dist/src/index.js +2 -0
  62. package/dist/src/index.js.map +1 -1
  63. package/dist/src/lifecycle/corrective-replan-binding-manifest.d.ts +5 -0
  64. package/dist/src/lifecycle/corrective-replan-binding-manifest.js +9 -0
  65. package/dist/src/lifecycle/corrective-replan-binding-manifest.js.map +1 -1
  66. package/dist/src/lifecycle/corrective-replan.js +1 -1
  67. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  68. package/dist/src/lifecycle/semantic-registry.js +1 -1
  69. package/dist/src/observation.js +1 -2
  70. package/dist/src/observation.js.map +1 -1
  71. package/dist/src/observed-routes.d.ts +114 -0
  72. package/dist/src/observed-routes.js +545 -0
  73. package/dist/src/observed-routes.js.map +1 -0
  74. package/dist/src/operational-contract.d.ts +26 -0
  75. package/dist/src/operational-contract.js +94 -0
  76. package/dist/src/operational-contract.js.map +1 -0
  77. package/dist/src/reviewer.d.ts +218 -8
  78. package/dist/src/reviewer.js +927 -25
  79. package/dist/src/reviewer.js.map +1 -1
  80. package/dist/src/state/corrective-replan-executor.js +23 -15
  81. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  82. package/dist/src/state/corrective-replan-public.js +35 -10
  83. package/dist/src/state/corrective-replan-public.js.map +1 -1
  84. package/dist/src/state/corrective-replan-transaction.js +12 -4
  85. package/dist/src/state/corrective-replan-transaction.js.map +1 -1
  86. package/dist/src/state/corrective-yield-transaction.js +11 -2
  87. package/dist/src/state/corrective-yield-transaction.js.map +1 -1
  88. package/dist/src/state/lock.d.ts +1 -0
  89. package/dist/src/state/lock.js +24 -0
  90. package/dist/src/state/lock.js.map +1 -1
  91. package/dist/src/version.d.ts +1 -1
  92. package/dist/src/version.js +1 -1
  93. package/dist/src/version.js.map +1 -1
  94. package/dist/src/workflow.d.ts +70 -4
  95. package/dist/src/workflow.js +1888 -152
  96. package/dist/src/workflow.js.map +1 -1
  97. package/docs/autonomy-guardrails.md +41 -14
  98. package/docs/delegated-approval.md +6 -1
  99. package/docs/development-flow.md +42 -12
  100. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  101. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  102. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  103. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +191 -22
  104. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +163 -45
  105. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +346 -52
  106. package/docs/problem-briefs/01-pre-implementation-integrity.md +11 -7
  107. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +13 -6
  108. package/docs/problem-briefs/README.md +11 -11
  109. package/docs/release.md +89 -9
  110. package/docs/updating-existing-project.md +235 -0
  111. package/docs/validation-report.md +156 -98
  112. package/package.json +12 -3
  113. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
  114. package/plugins/codex-workflow-gateway/references/protocol.md +9 -0
  115. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +67 -1
  116. package/schemas/authorization-event.schema.json +10 -3
  117. package/schemas/corrective-decision-event.schema.json +164 -9
  118. package/schemas/corrective-replan-credentials.private.schema.json +4 -2
  119. package/schemas/milestone-scope-change-event.schema.json +25 -1
  120. package/schemas/remediation-event.schema.json +17 -1
  121. package/schemas/review-result.schema.json +1 -0
  122. package/schemas/step-review-event.schema.json +15 -0
  123. package/schemas/task.schema.json +104 -1
  124. package/schemas/transition-definition.schema.json +8 -0
@@ -49,10 +49,30 @@
49
49
  "if": { "properties": { "triggeringAttemptCount": { "const": 2 } }, "required": ["triggeringAttemptCount"] },
50
50
  "then": {
51
51
  "required": ["recoveryBasis", "planIntegrityEvidence"],
52
- "properties": { "decision": { "const": "replan-required" } }
52
+ "properties": { "decision": { "enum": ["continue-fix", "replan-required"] } }
53
+ }
54
+ },
55
+ {
56
+ "if": { "required": ["recoveryBasis"] },
57
+ "then": {
58
+ "required": ["planIntegrityEvidence"]
59
+ },
60
+ "else": { "not": { "required": ["planIntegrityEvidence"] } }
61
+ },
62
+ {
63
+ "if": {
64
+ "properties": {
65
+ "planIntegrityEvidence": {
66
+ "properties": { "kind": { "enum": ["check-support-anchor-outside-allowed-writes", "failed-check-component-owner-outside-allowed-writes"] } },
67
+ "required": ["kind"]
68
+ }
69
+ },
70
+ "required": ["planIntegrityEvidence"]
53
71
  },
72
+ "then": { "properties": { "decision": { "const": "continue-fix" } } },
54
73
  "else": {
55
- "not": { "anyOf": [{ "required": ["recoveryBasis"] }, { "required": ["planIntegrityEvidence"] }] }
74
+ "if": { "required": ["recoveryBasis"] },
75
+ "then": { "properties": { "decision": { "const": "replan-required" } } }
56
76
  }
57
77
  },
58
78
  {
@@ -74,13 +94,16 @@
74
94
  "items": { "type": "string", "minLength": 1 }
75
95
  },
76
96
  "planIntegrityEvidence": {
77
- "type": "object",
78
- "additionalProperties": false,
79
- "required": [
80
- "kind", "taskRevision", "remediationEventId", "remediationEventHash",
81
- "manifestPath", "manifestHash", "gitHead", "stepDefinitionHash",
82
- "missingScripts", "checkCommands", "changedFiles", "conflictHash"
83
- ],
97
+ "oneOf": [
98
+ { "$ref": "#/$defs/planIntegrityEvidenceV1" },
99
+ { "$ref": "#/$defs/planIntegrityEvidenceV2" },
100
+ { "$ref": "#/$defs/planIntegrityEvidenceV3" },
101
+ { "$ref": "#/$defs/planIntegrityEvidenceV4" }
102
+ ]
103
+ },
104
+ "planIntegrityEvidenceV1": {
105
+ "type": "object", "additionalProperties": false,
106
+ "required": ["kind", "taskRevision", "remediationEventId", "remediationEventHash", "manifestPath", "manifestHash", "gitHead", "stepDefinitionHash", "missingScripts", "checkCommands", "changedFiles", "conflictHash"],
84
107
  "properties": {
85
108
  "kind": { "const": "missing-npm-script-outside-allowed-writes" },
86
109
  "taskRevision": { "type": "integer", "minimum": 1 },
@@ -95,6 +118,138 @@
95
118
  "changedFiles": { "$ref": "#/$defs/stringList" },
96
119
  "conflictHash": { "$ref": "#/$defs/hash64" }
97
120
  }
121
+ },
122
+ "planIntegrityEvidenceV2": {
123
+ "type": "object", "additionalProperties": false,
124
+ "required": ["kind", "taskRevision", "remediationEvents", "manifestPath", "manifestHash", "gitHead", "stepDefinitionHash", "conflicts", "changedFiles", "conflictHash"],
125
+ "properties": {
126
+ "kind": { "const": "non-executable-npm-check-outside-allowed-writes" },
127
+ "taskRevision": { "type": "integer", "minimum": 1 },
128
+ "remediationEvents": {
129
+ "type": "array", "minItems": 1,
130
+ "items": {
131
+ "type": "object", "additionalProperties": false,
132
+ "required": ["eventId", "eventHash", "attemptOrdinal"],
133
+ "properties": {
134
+ "eventId": { "type": "string", "minLength": 1 },
135
+ "eventHash": { "$ref": "#/$defs/hash64" },
136
+ "attemptOrdinal": { "type": "integer", "minimum": 1 }
137
+ }
138
+ }
139
+ },
140
+ "manifestPath": { "const": "package.json" },
141
+ "manifestHash": { "$ref": "#/$defs/nullableHash64" },
142
+ "gitHead": { "$ref": "#/$defs/gitOid" },
143
+ "stepDefinitionHash": { "$ref": "#/$defs/hash64" },
144
+ "conflicts": {
145
+ "type": "array", "minItems": 1,
146
+ "items": {
147
+ "type": "object", "additionalProperties": false,
148
+ "required": ["reasonCode", "script", "command", "scriptCommand", "runnerPath", "runnerHash"],
149
+ "properties": {
150
+ "reasonCode": { "enum": ["MISSING_NPM_SCRIPT", "REQUIRED_SELECTOR_MISSING"] },
151
+ "script": { "type": "string", "minLength": 1 },
152
+ "command": { "type": "string", "minLength": 1 },
153
+ "scriptCommand": { "type": ["string", "null"] },
154
+ "runnerPath": { "type": ["string", "null"] },
155
+ "runnerHash": { "$ref": "#/$defs/nullableHash64" }
156
+ }
157
+ }
158
+ },
159
+ "changedFiles": { "$ref": "#/$defs/stringList" },
160
+ "conflictHash": { "$ref": "#/$defs/hash64" }
161
+ }
162
+ },
163
+ "planIntegrityEvidenceV3": {
164
+ "type": "object", "additionalProperties": false,
165
+ "required": ["kind", "taskRevision", "remediationEvents", "manifestPath", "manifestHash", "gitHead", "stepDefinitionHash", "conflicts", "scopeExtensions", "changedFiles", "conflictHash"],
166
+ "properties": {
167
+ "kind": { "const": "check-support-anchor-outside-allowed-writes" },
168
+ "taskRevision": { "type": "integer", "minimum": 1 },
169
+ "remediationEvents": {
170
+ "type": "array", "minItems": 1,
171
+ "items": {
172
+ "type": "object", "additionalProperties": false,
173
+ "required": ["eventId", "eventHash", "attemptOrdinal"],
174
+ "properties": {
175
+ "eventId": { "type": "string", "minLength": 1 },
176
+ "eventHash": { "$ref": "#/$defs/hash64" },
177
+ "attemptOrdinal": { "type": "integer", "minimum": 1 }
178
+ }
179
+ }
180
+ },
181
+ "manifestPath": { "const": "package.json" },
182
+ "manifestHash": { "$ref": "#/$defs/nullableHash64" },
183
+ "gitHead": { "$ref": "#/$defs/gitOid" },
184
+ "stepDefinitionHash": { "$ref": "#/$defs/hash64" },
185
+ "conflicts": {
186
+ "type": "array", "minItems": 1,
187
+ "items": {
188
+ "type": "object", "additionalProperties": false,
189
+ "required": ["reasonCode", "script", "command", "scriptCommand", "runnerPath", "runnerHash", "supportPath", "supportHash", "importSpecifier", "expectedOutputPaths", "anchoredMigrationNames"],
190
+ "properties": {
191
+ "reasonCode": { "const": "CHECK_SUPPORT_ANCHOR_OUTSIDE_ALLOWED_WRITES" },
192
+ "script": { "type": "string", "minLength": 1 },
193
+ "command": { "type": "string", "minLength": 1 },
194
+ "scriptCommand": { "type": "string", "minLength": 1 },
195
+ "runnerPath": { "type": "string", "minLength": 1 },
196
+ "runnerHash": { "$ref": "#/$defs/hash64" },
197
+ "supportPath": { "type": "string", "minLength": 1 },
198
+ "supportHash": { "$ref": "#/$defs/hash64" },
199
+ "importSpecifier": { "type": "string", "minLength": 1 },
200
+ "expectedOutputPaths": { "$ref": "#/$defs/stringList", "minItems": 1 },
201
+ "anchoredMigrationNames": { "$ref": "#/$defs/stringList", "minItems": 1 }
202
+ }
203
+ }
204
+ },
205
+ "scopeExtensions": { "$ref": "#/$defs/stringList", "minItems": 1 },
206
+ "changedFiles": { "$ref": "#/$defs/stringList" },
207
+ "conflictHash": { "$ref": "#/$defs/hash64" }
208
+ }
209
+ },
210
+ "planIntegrityEvidenceV4": {
211
+ "type": "object", "additionalProperties": false,
212
+ "required": ["kind", "taskRevision", "remediationEvents", "gitHead", "stepDefinitionHash", "semanticBoundaryHash", "failedCheckCauseFingerprint", "conflicts", "scopeExtensions", "changedFiles", "conflictHash"],
213
+ "properties": {
214
+ "kind": { "const": "failed-check-component-owner-outside-allowed-writes" },
215
+ "taskRevision": { "type": "integer", "minimum": 1 },
216
+ "remediationEvents": {
217
+ "type": "array", "minItems": 1,
218
+ "items": {
219
+ "type": "object", "additionalProperties": false,
220
+ "required": ["eventId", "eventHash", "attemptOrdinal"],
221
+ "properties": {
222
+ "eventId": { "type": "string", "minLength": 1 },
223
+ "eventHash": { "$ref": "#/$defs/hash64" },
224
+ "attemptOrdinal": { "type": "integer", "minimum": 1 }
225
+ }
226
+ }
227
+ },
228
+ "gitHead": { "$ref": "#/$defs/gitOid" },
229
+ "stepDefinitionHash": { "$ref": "#/$defs/hash64" },
230
+ "semanticBoundaryHash": { "$ref": "#/$defs/hash64" },
231
+ "failedCheckCauseFingerprint": { "$ref": "#/$defs/hash64" },
232
+ "conflicts": {
233
+ "type": "array", "minItems": 1,
234
+ "items": {
235
+ "type": "object", "additionalProperties": false,
236
+ "required": ["reasonCode", "command", "runnerPath", "ownerPath", "ownerHash", "importChain", "diagnosticPath", "componentRoot"],
237
+ "properties": {
238
+ "reasonCode": { "const": "FAILED_CHECK_COMPONENT_OWNER_OUTSIDE_ALLOWED_WRITES" },
239
+ "command": { "type": "string", "minLength": 1 },
240
+ "runnerPath": { "type": "string", "minLength": 1 },
241
+ "ownerPath": { "type": "string", "minLength": 1 },
242
+ "ownerHash": { "$ref": "#/$defs/hash64" },
243
+ "importChain": { "$ref": "#/$defs/stringList", "minItems": 2 },
244
+ "diagnosticPath": { "type": "string", "minLength": 1 },
245
+ "componentRoot": { "type": "string", "minLength": 1 }
246
+ }
247
+ }
248
+ },
249
+ "scopeExtensions": { "$ref": "#/$defs/stringList", "minItems": 1 },
250
+ "changedFiles": { "$ref": "#/$defs/stringList" },
251
+ "conflictHash": { "$ref": "#/$defs/hash64" }
252
+ }
98
253
  }
99
254
  }
100
255
  }
@@ -12,14 +12,16 @@
12
12
  },
13
13
  "bindingValues": {
14
14
  "type": "object", "additionalProperties": false,
15
- "required": ["transitionId", "runtimeFingerprint", "catalogHash", "lifecycleEpoch", "taskId", "revision", "currentPlanHash", "briefHash", "knowledgeRevision", "knowledgeHash", "gitHead", "guardedStepId", "correctiveDecisionEventId", "correctiveDecisionHash", "attemptCount", "remediationTailHash", "candidatePlanHash", "candidateStepSetHash", "planAuthorIdentityHash", "planValidationHash", "planValidatorIdentityHash", "riskAuditHash", "riskAuditorIdentityHash", "actorIdentityHash", "actorRole", "humanPrincipalIdentityHash", "capabilityId", "capabilityVersion"],
15
+ "required": ["transitionId", "runtimeFingerprint", "catalogHash", "lifecycleEpoch", "taskId", "revision", "currentPlanHash", "briefHash", "knowledgeRevision", "knowledgeHash", "targetKnowledgeRevision", "targetKnowledgeHash", "gitHead", "guardedStepId", "correctiveDecisionEventId", "correctiveDecisionHash", "attemptCount", "remediationTailHash", "candidatePlanHash", "candidateStepSetHash", "planAuthorIdentityHash", "planValidationHash", "planValidatorIdentityHash", "riskAuditHash", "riskAuditorIdentityHash", "actorIdentityHash", "actorRole", "humanPrincipalIdentityHash", "capabilityId", "capabilityVersion"],
16
16
  "properties": {
17
17
  "transitionId": { "const": "task.plan.corrective-replan" },
18
18
  "runtimeFingerprint": { "$ref": "#/$defs/hash" }, "catalogHash": { "$ref": "#/$defs/hash" },
19
19
  "lifecycleEpoch": { "const": 2 }, "taskId": { "$ref": "#/$defs/id" },
20
20
  "revision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "currentPlanHash": { "$ref": "#/$defs/hash" },
21
21
  "briefHash": { "$ref": "#/$defs/hash" }, "knowledgeRevision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
22
- "knowledgeHash": { "$ref": "#/$defs/hash" }, "gitHead": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
22
+ "knowledgeHash": { "$ref": "#/$defs/hash" },
23
+ "targetKnowledgeRevision": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
24
+ "targetKnowledgeHash": { "$ref": "#/$defs/hash" }, "gitHead": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
23
25
  "guardedStepId": { "$ref": "#/$defs/id" }, "correctiveDecisionEventId": { "$ref": "#/$defs/id" },
24
26
  "correctiveDecisionHash": { "$ref": "#/$defs/hash" }, "attemptCount": { "type": "integer", "minimum": 2, "maximum": 9007199254740991 },
25
27
  "remediationTailHash": { "$ref": "#/$defs/hash" }, "candidatePlanHash": { "$ref": "#/$defs/hash" },
@@ -32,8 +32,9 @@
32
32
  "after": { "$ref": "#/$defs/scopeSnapshot" },
33
33
  "actor": { "type": "string", "minLength": 1 },
34
34
  "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
35
- "authorizationMode": { "enum": ["human", "milestone-autonomy"] },
35
+ "authorizationMode": { "enum": ["human", "milestone-autonomy", "audited-remediation"] },
36
36
  "autonomyContractEventHash": { "$ref": "#/$defs/nullableHash64" },
37
+ "remediationEvidence": { "$ref": "#/$defs/remediationEvidence" },
37
38
  "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
38
39
  "recordedAt": { "type": "string", "format": "date-time" },
39
40
  "eventHash": { "$ref": "#/$defs/hash64" }
@@ -43,6 +44,29 @@
43
44
  "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
44
45
  "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
45
46
  "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
47
+ "remediationEvidence": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": [
51
+ "blockedTaskId", "blockedTaskRevision", "blockedBriefHash", "blockedPlanHash",
52
+ "planRiskAuditEventId", "planRiskAuditEventHash", "remediationTaskId", "predecessorTaskIds"
53
+ ],
54
+ "properties": {
55
+ "blockedTaskId": { "$ref": "#/$defs/taskId" },
56
+ "blockedTaskRevision": { "type": "integer", "minimum": 1 },
57
+ "blockedBriefHash": { "$ref": "#/$defs/hash64" },
58
+ "blockedPlanHash": { "$ref": "#/$defs/hash64" },
59
+ "planRiskAuditEventId": { "type": "string", "minLength": 1 },
60
+ "planRiskAuditEventHash": { "$ref": "#/$defs/hash64" },
61
+ "remediationTaskId": { "$ref": "#/$defs/taskId" },
62
+ "predecessorTaskIds": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "uniqueItems": true,
66
+ "items": { "$ref": "#/$defs/taskId" }
67
+ }
68
+ }
69
+ },
46
70
  "membership": {
47
71
  "type": "object",
48
72
  "additionalProperties": false,
@@ -31,11 +31,27 @@
31
31
  "completionCommit": { "$ref": "#/$defs/gitHash" },
32
32
  "checksHash": { "$ref": "#/$defs/hash64" },
33
33
  "reviewEventHash": { "$ref": "#/$defs/nullableHash64" },
34
- "reviewerAttestationHash": { "$ref": "#/$defs/nullableHash64" }
34
+ "reviewerAttestationHash": { "$ref": "#/$defs/nullableHash64" },
35
+ "executionTaskRevision": { "type": "integer", "minimum": 1 },
36
+ "dirtyWorktreeHash": { "$ref": "#/$defs/hash64" }
35
37
  }
36
38
  },
37
39
  "attemptOrdinal": { "type": "integer", "minimum": 1 },
38
40
  "mode": { "enum": ["ordinary", "corrective"] },
41
+ "causeBindings": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": ["authority", "causeId", "causeFingerprint", "planConflict"],
47
+ "properties": {
48
+ "authority": { "enum": ["mechanical", "external-reviewer"] },
49
+ "causeId": { "type": "string", "minLength": 1 },
50
+ "causeFingerprint": { "$ref": "#/$defs/hash64" },
51
+ "planConflict": { "type": "boolean" }
52
+ }
53
+ }
54
+ },
39
55
  "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
40
56
  "recordedAt": { "type": "string", "format": "date-time" },
41
57
  "eventHash": { "$ref": "#/$defs/hash64" }
@@ -23,6 +23,7 @@
23
23
  "summary": { "type": "string", "minLength": 1 },
24
24
  "evidence": { "type": "string", "minLength": 1 },
25
25
  "requiredAction": { "type": "string", "minLength": 1 },
26
+ "causeId": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{2,127}$" },
26
27
  "route": { "enum": ["fix", "replan"] },
27
28
  "planConflict": {
28
29
  "anyOf": [
@@ -49,6 +49,21 @@
49
49
  }
50
50
  }
51
51
  },
52
+ "remediationCauses": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["findingId", "causeId", "causeFingerprint", "route", "planConflict"],
58
+ "properties": {
59
+ "findingId": { "type": "string", "minLength": 1 },
60
+ "causeId": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{2,127}$" },
61
+ "causeFingerprint": { "$ref": "#/$defs/hash64" },
62
+ "route": { "enum": ["fix", "replan"] },
63
+ "planConflict": { "type": "boolean" }
64
+ }
65
+ }
66
+ },
52
67
  "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
53
68
  "recordedAt": { "type": "string", "format": "date-time" },
54
69
  "eventHash": { "$ref": "#/$defs/hash64" }
@@ -34,6 +34,21 @@
34
34
  "knowledgeMapRevision": { "type": ["integer", "null"], "minimum": 1 },
35
35
  "knowledgeMapHash": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
36
36
  "graphUse": { "enum": ["code-aware", "not-applicable", null] },
37
+ "productionEdges": {
38
+ "type": "array",
39
+ "uniqueItems": true,
40
+ "items": {
41
+ "type": "object",
42
+ "required": ["ownerStepId", "consumerStepId", "checkRef"],
43
+ "properties": {
44
+ "ownerStepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
45
+ "consumerStepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
46
+ "checkRef": { "type": "string", "minLength": 1 }
47
+ },
48
+ "additionalProperties": false
49
+ }
50
+ },
51
+ "requiresProductionEdges": { "type": "boolean" },
37
52
  "steps": { "type": "array" },
38
53
  "authorizations": { "type": "array" },
39
54
  "knowledgeRebinds": {
@@ -60,6 +75,33 @@
60
75
  "uniqueItems": true,
61
76
  "items": { "type": "string", "pattern": "^[a-f0-9]{40}$" }
62
77
  },
78
+ "historicalStepProvenanceRecoveries": {
79
+ "type": "array",
80
+ "items": {
81
+ "type": "object",
82
+ "required": [
83
+ "commitSha",
84
+ "actor",
85
+ "reason",
86
+ "recordedAt",
87
+ "sourceFinalAcceptanceRecordedAt",
88
+ "sourcePlanHash",
89
+ "sourceResultHash",
90
+ "sourceEvidenceHash"
91
+ ],
92
+ "properties": {
93
+ "commitSha": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
94
+ "actor": { "type": "string", "minLength": 1 },
95
+ "reason": { "type": "string", "minLength": 1 },
96
+ "recordedAt": { "type": "string", "format": "date-time" },
97
+ "sourceFinalAcceptanceRecordedAt": { "type": "string", "format": "date-time" },
98
+ "sourcePlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
99
+ "sourceResultHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
100
+ "sourceEvidenceHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
101
+ },
102
+ "additionalProperties": false
103
+ }
104
+ },
63
105
  "dependencyProvenanceRecoveries": {
64
106
  "type": "array",
65
107
  "items": {
@@ -134,10 +176,71 @@
134
176
  }
135
177
  },
136
178
  "additionalProperties": false
179
+ },
180
+ "historicalStepProvenance": {
181
+ "type": "object",
182
+ "required": ["activeStepId", "planHash", "dirtyFiles", "dirtyWorktreeHash", "retainedCommitSha"],
183
+ "properties": {
184
+ "activeStepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
185
+ "planHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
186
+ "dirtyFiles": {
187
+ "type": "array",
188
+ "uniqueItems": true,
189
+ "items": { "type": "string", "minLength": 1 }
190
+ },
191
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
192
+ "retainedCommitSha": { "type": "string", "pattern": "^[a-f0-9]{40}$" }
193
+ },
194
+ "additionalProperties": false
195
+ },
196
+ "planIntegrity": {
197
+ "type": "object",
198
+ "required": ["stepId", "planHash", "conflictHash", "dirtyFiles", "dirtyWorktreeHash", "remediationEventIds"],
199
+ "properties": {
200
+ "stepId": { "type": "string", "pattern": "^STEP-[A-Z0-9][A-Z0-9-]{2,63}$" },
201
+ "planHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
202
+ "conflictHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
203
+ "dirtyFiles": {
204
+ "type": "array",
205
+ "minItems": 1,
206
+ "uniqueItems": true,
207
+ "items": { "type": "string", "minLength": 1 }
208
+ },
209
+ "dirtyWorktreeHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
210
+ "remediationEventIds": {
211
+ "type": "array",
212
+ "minItems": 1,
213
+ "uniqueItems": true,
214
+ "items": { "type": "string", "minLength": 1 }
215
+ }
216
+ },
217
+ "additionalProperties": false
137
218
  }
138
219
  },
139
220
  "additionalProperties": false
140
221
  }
141
222
  }
142
- }
223
+ },
224
+ "allOf": [
225
+ {
226
+ "if": {
227
+ "properties": { "productionEdges": { "minItems": 1 } },
228
+ "required": ["productionEdges"]
229
+ },
230
+ "then": {
231
+ "required": ["requiresProductionEdges"],
232
+ "properties": { "requiresProductionEdges": { "const": true } }
233
+ }
234
+ },
235
+ {
236
+ "if": {
237
+ "properties": { "requiresProductionEdges": { "const": true } },
238
+ "required": ["requiresProductionEdges"]
239
+ },
240
+ "then": {
241
+ "required": ["productionEdges"],
242
+ "properties": { "productionEdges": { "minItems": 1 } }
243
+ }
244
+ }
245
+ ]
143
246
  }
@@ -436,6 +436,8 @@
436
436
  "projection.corrective-replan.candidate@1:field.plan-validator-identity-hash",
437
437
  "projection.corrective-replan.candidate@1:field.risk-audit-hash",
438
438
  "projection.corrective-replan.candidate@1:field.risk-auditor-identity-hash",
439
+ "projection.corrective-replan.candidate@1:field.target-knowledge-hash",
440
+ "projection.corrective-replan.candidate@1:field.target-knowledge-revision",
439
441
  "projection.corrective-replan.execution-receipt@1:field.actor-identity-hash",
440
442
  "projection.corrective-replan.execution-receipt@1:field.actor-role",
441
443
  "projection.corrective-replan.execution-receipt@1:field.attempt-count",
@@ -461,6 +463,8 @@
461
463
  "projection.corrective-replan.execution-receipt@1:field.risk-audit-hash",
462
464
  "projection.corrective-replan.execution-receipt@1:field.risk-auditor-identity-hash",
463
465
  "projection.corrective-replan.execution-receipt@1:field.runtime-fingerprint",
466
+ "projection.corrective-replan.execution-receipt@1:field.target-knowledge-hash",
467
+ "projection.corrective-replan.execution-receipt@1:field.target-knowledge-revision",
464
468
  "projection.corrective-replan.execution-receipt@1:field.task-id",
465
469
  "projection.corrective-replan.execution-receipt@1:field.task-revision",
466
470
  "projection.corrective-replan.execution-receipt@1:field.transition-id",
@@ -535,6 +539,8 @@
535
539
  "projection.input.execution-receipt@1:field.risk-audit-hash",
536
540
  "projection.input.execution-receipt@1:field.risk-auditor-identity-hash",
537
541
  "projection.input.execution-receipt@1:field.runtime-fingerprint",
542
+ "projection.input.execution-receipt@1:field.target-knowledge-hash",
543
+ "projection.input.execution-receipt@1:field.target-knowledge-revision",
538
544
  "projection.input.execution-receipt@1:field.task-id",
539
545
  "projection.input.execution-receipt@1:field.task-revision",
540
546
  "projection.input.execution-receipt@1:field.transition-id",
@@ -620,6 +626,8 @@
620
626
  "field.runtime-fingerprint",
621
627
  "field.step-id",
622
628
  "field.step-status",
629
+ "field.target-knowledge-hash",
630
+ "field.target-knowledge-revision",
623
631
  "field.task-id",
624
632
  "field.task-plan-hash",
625
633
  "field.task-revision",