@deksden-com/dd-flow-cli 0.9.0-beta.152 → 0.9.0-beta.156

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 (227) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/build-info.json +8 -8
  3. package/dist/cli/command-inputs.js +33 -3
  4. package/dist/cli/command-metadata.js +73 -2
  5. package/dist/cli/delivery.js +108 -0
  6. package/dist/cli/diagnostic-invocation.js +23 -7
  7. package/dist/cli/diagnostic.js +14 -3
  8. package/dist/cli/help.js +117 -1
  9. package/dist/cli/hook-ingress.js +36 -49
  10. package/dist/cli/interactive-invocation.js +33 -0
  11. package/dist/cli/interactive.js +114 -0
  12. package/dist/cli/memory-fix-invocation.js +52 -0
  13. package/dist/cli/memory-fix.js +100 -0
  14. package/dist/cli/memory-flow-admission.js +7 -3
  15. package/dist/cli/memory-init.js +5 -4
  16. package/dist/cli/native-hook-ingress.js +5 -1
  17. package/dist/cli/native-hook-preparation.js +31 -4
  18. package/dist/cli/run-cli.js +274 -19
  19. package/dist/cli.js +17 -3
  20. package/dist/domain/delivery-flows.js +8 -0
  21. package/dist/domain/distill-flow.js +20 -0
  22. package/dist/domain/interactive-flow.js +1 -0
  23. package/dist/domain/memory-fix-flow.js +2 -0
  24. package/dist/domain/review-fix-flow.js +2 -0
  25. package/dist/domain/source-snapshot-flows.js +4 -0
  26. package/dist/harness-runtime/bin/dd-agy.mjs +18 -3
  27. package/dist/harness-runtime/bin/dd-grok.mjs +15 -5
  28. package/dist/harness-runtime/bin/dd-zcode.mjs +15 -7
  29. package/dist/harness-runtime/lib/agy-error-boundary.mjs +18 -10
  30. package/dist/harness-runtime/lib/agy-native-inspection.mjs +12 -3
  31. package/dist/harness-runtime/lib/agy-native-inventory.mjs +19 -0
  32. package/dist/harness-runtime/lib/agy-terminal-envelope.mjs +13 -6
  33. package/dist/harness-runtime/lib/agy-transcript-stream.mjs +54 -0
  34. package/dist/harness-runtime/lib/daemon-observation.d.mts +1 -0
  35. package/dist/harness-runtime/lib/daemon-observation.mjs +12 -4
  36. package/dist/harness-runtime/lib/daemon-operations.mjs +20 -5
  37. package/dist/harness-runtime/lib/dd-agy-daemon.d.mts +1 -0
  38. package/dist/harness-runtime/lib/dd-agy-daemon.mjs +371 -114
  39. package/dist/harness-runtime/lib/dd-codex-daemon.mjs +43 -3
  40. package/dist/harness-runtime/lib/dd-codex.mjs +36 -4
  41. package/dist/harness-runtime/lib/dd-droid-daemon.mjs +25 -11
  42. package/dist/harness-runtime/lib/dd-droid.mjs +124 -11
  43. package/dist/harness-runtime/lib/dd-grok-daemon.d.mts +1 -0
  44. package/dist/harness-runtime/lib/dd-grok-daemon.mjs +137 -25
  45. package/dist/harness-runtime/lib/dd-grok.mjs +4 -2
  46. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +115 -17
  47. package/dist/harness-runtime/lib/dd-opencode.mjs +10 -7
  48. package/dist/harness-runtime/lib/dd-zcode-daemon.d.mts +1 -0
  49. package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +115 -22
  50. package/dist/harness-runtime/lib/dd-zcode.mjs +75 -36
  51. package/dist/harness-runtime/lib/delegation-instructions.d.mts +2 -1
  52. package/dist/harness-runtime/lib/delegation-instructions.mjs +15 -5
  53. package/dist/harness-runtime/lib/delivery-command.mjs +84 -0
  54. package/dist/harness-runtime/lib/driver-recovery.mjs +0 -19
  55. package/dist/harness-runtime/lib/droid-observation.mjs +9 -5
  56. package/dist/harness-runtime/lib/lifecycle-contract.d.mts +1 -0
  57. package/dist/harness-runtime/lib/lifecycle-contract.mjs +2 -1
  58. package/dist/harness-runtime/lib/native-hook-command.d.mts +3 -2
  59. package/dist/harness-runtime/lib/native-hook-command.mjs +63 -8
  60. package/dist/harness-runtime/lib/native-streams.mjs +3 -10
  61. package/dist/harness-runtime/lib/opencode-plugin.mjs +36 -9
  62. package/dist/harness-runtime/lib/operation-errors.mjs +13 -0
  63. package/dist/harness-runtime/lib/operation-progress.mjs +6 -2
  64. package/dist/harness-runtime/lib/process-json.mjs +4 -5
  65. package/dist/harness-runtime/lib/tool-observations.mjs +20 -10
  66. package/dist/harness-runtime/lib/zcode-native-hook-ownership.mjs +109 -0
  67. package/dist/schemas/code-work-result.schema.json +2 -1
  68. package/dist/schemas/delivery-stage-result.schema.json +286 -0
  69. package/dist/schemas/distill-stage-result.schema.json +667 -0
  70. package/dist/schemas/distill-work-result.schema.json +428 -0
  71. package/dist/schemas/execution-bundle.schema.json +6 -2
  72. package/dist/schemas/interactive-stage-result.schema.json +47 -0
  73. package/dist/schemas/interactive-work-result.schema.json +63 -0
  74. package/dist/schemas/mb-fix-stage-result.schema.json +93 -0
  75. package/dist/schemas/project-flow-pack-manifest.schema.json +2 -2
  76. package/dist/schemas/review-fix-stage-result.schema.json +210 -0
  77. package/dist/schemas/run-control-receipt.schema.json +1 -0
  78. package/dist/services/assigned-lifecycle.js +382 -0
  79. package/dist/services/check-runner-evidence.js +45 -8
  80. package/dist/services/cli-operation-classifier.js +6 -1
  81. package/dist/services/code-checks.js +46 -29
  82. package/dist/services/codex-hook-delivery.js +11 -2
  83. package/dist/services/controller-child-repair.js +95 -0
  84. package/dist/services/controller-execution.js +4 -1
  85. package/dist/services/controller-fanout.js +19 -9
  86. package/dist/services/controller-memory-worker.js +6 -4
  87. package/dist/services/controller-result-authority.js +122 -0
  88. package/dist/services/dashboard.js +4 -2
  89. package/dist/services/delivery-access.js +123 -0
  90. package/dist/services/delivery-approval.js +68 -0
  91. package/dist/services/delivery-artifact.js +86 -0
  92. package/dist/services/delivery-checks.js +178 -0
  93. package/dist/services/delivery-execution.js +181 -0
  94. package/dist/services/delivery-intents.js +212 -0
  95. package/dist/services/delivery-operation.js +81 -0
  96. package/dist/services/delivery-policy.js +91 -0
  97. package/dist/services/delivery-procedures.js +43 -0
  98. package/dist/services/delivery-request.js +99 -0
  99. package/dist/services/delivery-result.js +144 -0
  100. package/dist/services/delivery-stage-commands.js +26 -0
  101. package/dist/services/delivery-stage-entry.js +56 -0
  102. package/dist/services/delivery-stage-handlers.js +135 -0
  103. package/dist/services/delivery-stage-results.js +94 -0
  104. package/dist/services/descriptor-coordinator-session.js +3 -1
  105. package/dist/services/descriptor-run-start.js +24 -4
  106. package/dist/services/descriptor-stage-coordinator.js +78 -10
  107. package/dist/services/descriptor-stage-settlement.js +59 -14
  108. package/dist/services/diagnostic-repair-intake.js +123 -0
  109. package/dist/services/diagnostic-repair-source-intake.js +102 -0
  110. package/dist/services/diagnostic-report.js +30 -0
  111. package/dist/services/diagnostic-run-bundle.js +48 -9
  112. package/dist/services/diagnostic-snapshot.js +2 -2
  113. package/dist/services/diagnostic-stage-handlers.js +3 -2
  114. package/dist/services/diagnostic-stage-results.js +26 -0
  115. package/dist/services/diagnostic-start.js +56 -6
  116. package/dist/services/diagnostic-work-collection.js +3 -3
  117. package/dist/services/distill-document-publication.js +280 -0
  118. package/dist/services/distill-promotion.js +197 -0
  119. package/dist/services/distill-publication-custody.js +162 -0
  120. package/dist/services/distill-stage-handlers.js +249 -0
  121. package/dist/services/distill-stage-results.js +105 -0
  122. package/dist/services/distill-user-inputs.js +4 -0
  123. package/dist/services/distill-work-batch.js +42 -0
  124. package/dist/services/distill-work-collection.js +74 -0
  125. package/dist/services/distill-work-registration.js +93 -0
  126. package/dist/services/distill-work-results.js +98 -0
  127. package/dist/services/eval-snapshots.js +17 -7
  128. package/dist/services/external-work-launch.js +8 -2
  129. package/dist/services/flow-catalog.js +24 -0
  130. package/dist/services/frozen-engine.js +19 -2
  131. package/dist/services/generic-execution.js +4 -3
  132. package/dist/services/harness-adapter.js +2 -14
  133. package/dist/services/hook-memory-routing.js +1 -1
  134. package/dist/services/hooks.js +31 -6
  135. package/dist/services/hybrid-contracts.js +6 -1
  136. package/dist/services/installed-flow-source.js +37 -2
  137. package/dist/services/interactive-attached-session.js +215 -0
  138. package/dist/services/interactive-baseline-custody.js +54 -0
  139. package/dist/services/interactive-before-versions.js +148 -0
  140. package/dist/services/interactive-bundle-data.js +85 -0
  141. package/dist/services/interactive-checks.js +179 -0
  142. package/dist/services/interactive-execution.js +33 -0
  143. package/dist/services/interactive-finish-integration.js +236 -0
  144. package/dist/services/interactive-git-baseline.js +230 -0
  145. package/dist/services/interactive-git-dispatch.js +278 -0
  146. package/dist/services/interactive-input-delivery.js +82 -0
  147. package/dist/services/interactive-mutation-scope.js +231 -0
  148. package/dist/services/interactive-request.js +287 -0
  149. package/dist/services/interactive-run-bundle.js +109 -0
  150. package/dist/services/interactive-stage-entry.js +41 -0
  151. package/dist/services/interactive-stage-handlers.js +289 -0
  152. package/dist/services/interactive-stage-observation.js +136 -0
  153. package/dist/services/interactive-stage-results.js +111 -0
  154. package/dist/services/interactive-user-inputs.js +142 -0
  155. package/dist/services/interactive-work-batch.js +43 -0
  156. package/dist/services/interactive-work-collection.js +119 -0
  157. package/dist/services/interactive-work-completion.js +180 -0
  158. package/dist/services/interactive-work-context.js +249 -0
  159. package/dist/services/interactive-work-history.js +112 -0
  160. package/dist/services/interactive-work-registration.js +124 -0
  161. package/dist/services/interactive-work-results.js +115 -0
  162. package/dist/services/interactive-work-start.js +155 -0
  163. package/dist/services/lifecycle-invocations.js +250 -33
  164. package/dist/services/managed-daemon-binding.js +52 -1
  165. package/dist/services/memory-compose-handler.js +2 -22
  166. package/dist/services/memory-finish-integration.js +58 -17
  167. package/dist/services/memory-fix-finish-integration.js +129 -0
  168. package/dist/services/memory-fix-git-dispatch.js +139 -0
  169. package/dist/services/memory-fix-intake-custody.js +11 -0
  170. package/dist/services/memory-fix-intake-settlement.js +127 -0
  171. package/dist/services/memory-fix-publication.js +196 -0
  172. package/dist/services/memory-fix-repair-admission.js +116 -0
  173. package/dist/services/memory-fix-request.js +141 -0
  174. package/dist/services/memory-fix-run-bundle.js +83 -0
  175. package/dist/services/memory-fix-scope.js +78 -0
  176. package/dist/services/memory-fix-sources.js +85 -0
  177. package/dist/services/memory-fix-stage-entry.js +24 -0
  178. package/dist/services/memory-fix-stage-handlers.js +282 -0
  179. package/dist/services/memory-fix-stage-results.js +106 -0
  180. package/dist/services/memory-fix-workspace.js +127 -0
  181. package/dist/services/memory-flow-user-inputs.js +88 -0
  182. package/dist/services/memory-init-contexts.js +55 -5
  183. package/dist/services/memory-init-controller-start.js +20 -4
  184. package/dist/services/memory-layer.js +7 -3
  185. package/dist/services/memory-native-review-copy.js +27 -3
  186. package/dist/services/memory-repair-document-delta.js +1 -0
  187. package/dist/services/project-flow-source.js +195 -0
  188. package/dist/services/project-git-integration.js +92 -0
  189. package/dist/services/repair-intents.js +2 -7
  190. package/dist/services/retained-native-hook.js +274 -0
  191. package/dist/services/review-fix-handoff.js +82 -0
  192. package/dist/services/review-fix-intake-custody.js +17 -0
  193. package/dist/services/review-fix-stage-entry.js +43 -0
  194. package/dist/services/review-fix-stage-handlers.js +176 -0
  195. package/dist/services/review-fix-stage-results.js +86 -0
  196. package/dist/services/run-control-worker.js +42 -1
  197. package/dist/services/run-control.js +40 -5
  198. package/dist/services/run-controller-adapter.js +37 -3
  199. package/dist/services/run-controller-process.js +25 -4
  200. package/dist/services/run-controller-recovery.js +46 -6
  201. package/dist/services/run-controller-state.js +3 -2
  202. package/dist/services/run-controller.js +257 -44
  203. package/dist/services/run-recovery.js +31 -2
  204. package/dist/services/run-timeline.js +59 -0
  205. package/dist/services/runs.js +18 -31
  206. package/dist/services/sessions.js +2 -1
  207. package/dist/services/stage-handlers.js +55 -3
  208. package/dist/services/stage-lifecycle.js +4 -3
  209. package/dist/services/stage-pause.js +26 -9
  210. package/dist/services/stage-report-renderer.js +2 -6
  211. package/dist/services/technical-notes.js +31 -0
  212. package/dist/services/verification-matrix.js +1 -1
  213. package/dist/services/version-status.js +1 -1
  214. package/dist/services/vnext-code-review.js +74 -5
  215. package/dist/services/vnext-code.js +8 -32
  216. package/dist/services/vnext-fanout.js +53 -8
  217. package/dist/services/vnext-merge.js +10 -5
  218. package/dist/services/vnext-plan-review.js +1 -1
  219. package/dist/services/vnext-plan.js +1 -1
  220. package/dist/services/vnext-protocolize.js +1 -1
  221. package/dist/services/vnext-specify.js +10 -5
  222. package/dist/services/work-registry.js +255 -69
  223. package/dist/services/worktrees.js +7 -4
  224. package/dist/storage/database.js +2 -1
  225. package/dist/verification-components.json +82 -0
  226. package/package.json +3 -2
  227. package/tools/verification-jobs.mjs +35 -10
@@ -0,0 +1,667 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "dd-flow/distill-stage-result@1",
4
+ "title": "Distillation stage result; promotion/check references require CLI-owned custody",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "flow_id",
10
+ "run_id",
11
+ "stage",
12
+ "input_sha256",
13
+ "snapshot_sha256",
14
+ "summary",
15
+ "predecessors",
16
+ "details"
17
+ ],
18
+ "properties": {
19
+ "schema_id": {
20
+ "const": "dd-flow/distill-stage-result@1"
21
+ },
22
+ "flow_id": {
23
+ "const": "mb-distill"
24
+ },
25
+ "run_id": {
26
+ "type": "string",
27
+ "pattern": "^RUN-[0-9]+-[a-z0-9-]+$"
28
+ },
29
+ "stage": {
30
+ "enum": [
31
+ "preflight",
32
+ "extract",
33
+ "review",
34
+ "promote",
35
+ "verify",
36
+ "finish"
37
+ ]
38
+ },
39
+ "input_sha256": {
40
+ "type": "string",
41
+ "pattern": "^[a-f0-9]{64}$"
42
+ },
43
+ "snapshot_sha256": {
44
+ "type": "string",
45
+ "pattern": "^[a-f0-9]{64}$"
46
+ },
47
+ "summary": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 16000
51
+ },
52
+ "predecessors": {
53
+ "type": "array",
54
+ "minItems": 0,
55
+ "maxItems": 1,
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": [
60
+ "stage",
61
+ "path",
62
+ "sha256"
63
+ ],
64
+ "properties": {
65
+ "stage": {
66
+ "type": "string",
67
+ "minLength": 1,
68
+ "maxLength": 16000
69
+ },
70
+ "path": {
71
+ "type": "string",
72
+ "minLength": 1,
73
+ "maxLength": 4096
74
+ },
75
+ "sha256": {
76
+ "type": "string",
77
+ "pattern": "^[a-f0-9]{64}$"
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "details": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": [
86
+ "coverage",
87
+ "candidates",
88
+ "decisions",
89
+ "limitations",
90
+ "write_scope",
91
+ "promotion_receipt",
92
+ "verification"
93
+ ],
94
+ "properties": {
95
+ "coverage": {
96
+ "type": "array",
97
+ "minItems": 22,
98
+ "maxItems": 22,
99
+ "items": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": [
103
+ "id",
104
+ "applicability",
105
+ "reason",
106
+ "evidence"
107
+ ],
108
+ "properties": {
109
+ "id": {
110
+ "type": "string",
111
+ "minLength": 1,
112
+ "maxLength": 16000
113
+ },
114
+ "applicability": {
115
+ "enum": [
116
+ "applicable",
117
+ "not_applicable",
118
+ "blocked",
119
+ "out_of_scope"
120
+ ]
121
+ },
122
+ "reason": {
123
+ "type": "string",
124
+ "minLength": 1,
125
+ "maxLength": 16000
126
+ },
127
+ "evidence": {
128
+ "type": "array",
129
+ "minItems": 0,
130
+ "maxItems": 64,
131
+ "items": {
132
+ "$ref": "#/$defs/source"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ },
138
+ "candidates": {
139
+ "type": "array",
140
+ "minItems": 0,
141
+ "maxItems": 1000,
142
+ "items": {
143
+ "$ref": "#/$defs/candidate"
144
+ }
145
+ },
146
+ "decisions": {
147
+ "type": "array",
148
+ "minItems": 0,
149
+ "maxItems": 1000,
150
+ "items": {
151
+ "$ref": "#/$defs/decision"
152
+ }
153
+ },
154
+ "limitations": {
155
+ "type": "array",
156
+ "minItems": 0,
157
+ "maxItems": 256,
158
+ "items": {
159
+ "type": "string",
160
+ "minLength": 1,
161
+ "maxLength": 16000
162
+ }
163
+ },
164
+ "write_scope": {
165
+ "anyOf": [
166
+ {
167
+ "type": "null"
168
+ },
169
+ {
170
+ "type": "object",
171
+ "additionalProperties": false,
172
+ "required": [
173
+ "destination_root",
174
+ "candidate_ids",
175
+ "paths",
176
+ "approval_source"
177
+ ],
178
+ "properties": {
179
+ "destination_root": {
180
+ "type": "string",
181
+ "minLength": 1,
182
+ "maxLength": 4096
183
+ },
184
+ "candidate_ids": {
185
+ "type": "array",
186
+ "minItems": 1,
187
+ "maxItems": 1000,
188
+ "items": {
189
+ "type": "string",
190
+ "minLength": 1,
191
+ "maxLength": 16000
192
+ },
193
+ "uniqueItems": true
194
+ },
195
+ "paths": {
196
+ "type": "array",
197
+ "minItems": 1,
198
+ "maxItems": 4096,
199
+ "items": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "maxLength": 4096
203
+ },
204
+ "uniqueItems": true
205
+ },
206
+ "approval_source": {
207
+ "type": "object",
208
+ "additionalProperties": false,
209
+ "required": [
210
+ "root",
211
+ "path",
212
+ "sha256"
213
+ ],
214
+ "properties": {
215
+ "root": {
216
+ "const": "run"
217
+ },
218
+ "path": {
219
+ "type": "string",
220
+ "minLength": 1,
221
+ "maxLength": 4096
222
+ },
223
+ "sha256": {
224
+ "type": "string",
225
+ "pattern": "^[a-f0-9]{64}$"
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ ]
232
+ },
233
+ "promotion_receipt": {
234
+ "anyOf": [
235
+ {
236
+ "type": "null"
237
+ },
238
+ {
239
+ "type": "object",
240
+ "additionalProperties": false,
241
+ "required": [
242
+ "root",
243
+ "path",
244
+ "sha256"
245
+ ],
246
+ "properties": {
247
+ "root": {
248
+ "const": "run"
249
+ },
250
+ "path": {
251
+ "type": "string",
252
+ "minLength": 1,
253
+ "maxLength": 4096
254
+ },
255
+ "sha256": {
256
+ "type": "string",
257
+ "pattern": "^[a-f0-9]{64}$"
258
+ }
259
+ }
260
+ }
261
+ ]
262
+ },
263
+ "verification": {
264
+ "type": "array",
265
+ "minItems": 0,
266
+ "maxItems": 1000,
267
+ "items": {
268
+ "type": "object",
269
+ "additionalProperties": false,
270
+ "required": [
271
+ "candidate_id",
272
+ "verdict",
273
+ "evidence",
274
+ "summary"
275
+ ],
276
+ "properties": {
277
+ "candidate_id": {
278
+ "type": "string",
279
+ "minLength": 1,
280
+ "maxLength": 16000
281
+ },
282
+ "verdict": {
283
+ "enum": [
284
+ "verified",
285
+ "unresolved"
286
+ ]
287
+ },
288
+ "evidence": {
289
+ "type": "array",
290
+ "minItems": 1,
291
+ "maxItems": 64,
292
+ "items": {
293
+ "type": "object",
294
+ "additionalProperties": false,
295
+ "required": [
296
+ "root",
297
+ "path",
298
+ "sha256"
299
+ ],
300
+ "properties": {
301
+ "root": {
302
+ "enum": [
303
+ "run",
304
+ "destination"
305
+ ]
306
+ },
307
+ "path": {
308
+ "type": "string",
309
+ "minLength": 1,
310
+ "maxLength": 4096
311
+ },
312
+ "sha256": {
313
+ "type": "string",
314
+ "pattern": "^[a-f0-9]{64}$"
315
+ }
316
+ }
317
+ }
318
+ },
319
+ "summary": {
320
+ "type": "string",
321
+ "minLength": 1,
322
+ "maxLength": 16000
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
329
+ },
330
+ "allOf": [
331
+ {
332
+ "if": {
333
+ "properties": {
334
+ "stage": {
335
+ "const": "preflight"
336
+ }
337
+ },
338
+ "required": [
339
+ "stage"
340
+ ],
341
+ "type": "object"
342
+ },
343
+ "then": {
344
+ "properties": {
345
+ "details": {
346
+ "properties": {
347
+ "candidates": {
348
+ "maxItems": 0,
349
+ "type": "array"
350
+ },
351
+ "decisions": {
352
+ "maxItems": 0,
353
+ "type": "array"
354
+ },
355
+ "promotion_receipt": {
356
+ "type": "null"
357
+ },
358
+ "verification": {
359
+ "maxItems": 0,
360
+ "type": "array"
361
+ }
362
+ },
363
+ "type": "object"
364
+ }
365
+ },
366
+ "type": "object"
367
+ }
368
+ },
369
+ {
370
+ "if": {
371
+ "properties": {
372
+ "stage": {
373
+ "const": "extract"
374
+ }
375
+ },
376
+ "required": [
377
+ "stage"
378
+ ],
379
+ "type": "object"
380
+ },
381
+ "then": {
382
+ "properties": {
383
+ "details": {
384
+ "properties": {
385
+ "decisions": {
386
+ "maxItems": 0,
387
+ "type": "array"
388
+ },
389
+ "promotion_receipt": {
390
+ "type": "null"
391
+ },
392
+ "verification": {
393
+ "maxItems": 0,
394
+ "type": "array"
395
+ }
396
+ },
397
+ "type": "object"
398
+ }
399
+ },
400
+ "type": "object"
401
+ }
402
+ },
403
+ {
404
+ "if": {
405
+ "properties": {
406
+ "stage": {
407
+ "const": "review"
408
+ }
409
+ },
410
+ "required": [
411
+ "stage"
412
+ ],
413
+ "type": "object"
414
+ },
415
+ "then": {
416
+ "properties": {
417
+ "details": {
418
+ "properties": {
419
+ "promotion_receipt": {
420
+ "type": "null"
421
+ },
422
+ "verification": {
423
+ "maxItems": 0,
424
+ "type": "array"
425
+ }
426
+ },
427
+ "type": "object"
428
+ }
429
+ },
430
+ "type": "object"
431
+ }
432
+ }
433
+ ],
434
+ "$defs": {
435
+ "source": {
436
+ "type": "object",
437
+ "additionalProperties": false,
438
+ "required": [
439
+ "path",
440
+ "sha256"
441
+ ],
442
+ "properties": {
443
+ "path": {
444
+ "type": "string",
445
+ "minLength": 1,
446
+ "maxLength": 4096
447
+ },
448
+ "sha256": {
449
+ "type": "string",
450
+ "pattern": "^[a-f0-9]{64}$"
451
+ }
452
+ }
453
+ },
454
+ "candidate": {
455
+ "type": "object",
456
+ "additionalProperties": false,
457
+ "required": [
458
+ "id",
459
+ "aspect_id",
460
+ "practice",
461
+ "source_refs",
462
+ "usage_refs",
463
+ "baseline_refs",
464
+ "delta",
465
+ "problem_solved",
466
+ "applicability",
467
+ "canon_fit",
468
+ "agent_leverage",
469
+ "evidence_strength",
470
+ "adoption_effort",
471
+ "complexity_risk",
472
+ "disposition",
473
+ "value",
474
+ "suggested_location",
475
+ "suggested_form",
476
+ "suggested_wording",
477
+ "risks",
478
+ "open_questions"
479
+ ],
480
+ "properties": {
481
+ "id": {
482
+ "type": "string",
483
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,99}$"
484
+ },
485
+ "aspect_id": {
486
+ "type": "string",
487
+ "minLength": 1,
488
+ "maxLength": 16000
489
+ },
490
+ "practice": {
491
+ "type": "string",
492
+ "minLength": 1,
493
+ "maxLength": 16000
494
+ },
495
+ "source_refs": {
496
+ "type": "array",
497
+ "minItems": 1,
498
+ "maxItems": 64,
499
+ "items": {
500
+ "$ref": "#/$defs/source"
501
+ }
502
+ },
503
+ "usage_refs": {
504
+ "type": "array",
505
+ "minItems": 0,
506
+ "maxItems": 64,
507
+ "items": {
508
+ "$ref": "#/$defs/source"
509
+ }
510
+ },
511
+ "baseline_refs": {
512
+ "type": "array",
513
+ "minItems": 1,
514
+ "maxItems": 64,
515
+ "items": {
516
+ "$ref": "#/$defs/source"
517
+ }
518
+ },
519
+ "delta": {
520
+ "type": "string",
521
+ "minLength": 1,
522
+ "maxLength": 16000
523
+ },
524
+ "problem_solved": {
525
+ "type": "string",
526
+ "minLength": 1,
527
+ "maxLength": 16000
528
+ },
529
+ "applicability": {
530
+ "type": "string",
531
+ "minLength": 1,
532
+ "maxLength": 16000
533
+ },
534
+ "canon_fit": {
535
+ "type": "string",
536
+ "minLength": 1,
537
+ "maxLength": 16000
538
+ },
539
+ "agent_leverage": {
540
+ "type": "string",
541
+ "minLength": 1,
542
+ "maxLength": 16000
543
+ },
544
+ "evidence_strength": {
545
+ "enum": [
546
+ "strong",
547
+ "medium",
548
+ "weak"
549
+ ]
550
+ },
551
+ "adoption_effort": {
552
+ "type": "string",
553
+ "minLength": 1,
554
+ "maxLength": 16000
555
+ },
556
+ "complexity_risk": {
557
+ "type": "string",
558
+ "minLength": 1,
559
+ "maxLength": 16000
560
+ },
561
+ "disposition": {
562
+ "enum": [
563
+ "adopt",
564
+ "adapt",
565
+ "observe",
566
+ "duplicate",
567
+ "reject"
568
+ ]
569
+ },
570
+ "value": {
571
+ "enum": [
572
+ "high",
573
+ "medium",
574
+ "low"
575
+ ]
576
+ },
577
+ "suggested_location": {
578
+ "type": "string",
579
+ "minLength": 1,
580
+ "maxLength": 16000
581
+ },
582
+ "suggested_form": {
583
+ "enum": [
584
+ "rule",
585
+ "guide",
586
+ "template",
587
+ "prompt",
588
+ "example"
589
+ ]
590
+ },
591
+ "suggested_wording": {
592
+ "type": "string",
593
+ "minLength": 1,
594
+ "maxLength": 16000
595
+ },
596
+ "risks": {
597
+ "type": "array",
598
+ "minItems": 0,
599
+ "maxItems": 256,
600
+ "items": {
601
+ "type": "string",
602
+ "minLength": 1,
603
+ "maxLength": 16000
604
+ }
605
+ },
606
+ "open_questions": {
607
+ "type": "array",
608
+ "minItems": 0,
609
+ "maxItems": 256,
610
+ "items": {
611
+ "type": "string",
612
+ "minLength": 1,
613
+ "maxLength": 16000
614
+ }
615
+ }
616
+ }
617
+ },
618
+ "decision": {
619
+ "type": "object",
620
+ "additionalProperties": false,
621
+ "required": [
622
+ "candidate_id",
623
+ "disposition",
624
+ "reason",
625
+ "source_refs",
626
+ "baseline_refs"
627
+ ],
628
+ "properties": {
629
+ "candidate_id": {
630
+ "type": "string",
631
+ "minLength": 1,
632
+ "maxLength": 16000
633
+ },
634
+ "disposition": {
635
+ "enum": [
636
+ "adopt",
637
+ "adapt",
638
+ "observe",
639
+ "duplicate",
640
+ "reject"
641
+ ]
642
+ },
643
+ "reason": {
644
+ "type": "string",
645
+ "minLength": 1,
646
+ "maxLength": 16000
647
+ },
648
+ "source_refs": {
649
+ "type": "array",
650
+ "minItems": 0,
651
+ "maxItems": 64,
652
+ "items": {
653
+ "$ref": "#/$defs/source"
654
+ }
655
+ },
656
+ "baseline_refs": {
657
+ "type": "array",
658
+ "minItems": 0,
659
+ "maxItems": 64,
660
+ "items": {
661
+ "$ref": "#/$defs/source"
662
+ }
663
+ }
664
+ }
665
+ }
666
+ }
667
+ }