@deksden-com/dd-flow-cli 0.9.0-beta.145 → 0.9.0-beta.149

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 (101) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/build-info.json +7 -7
  3. package/dist/cli/command-inputs.js +6 -2
  4. package/dist/cli/command-metadata.js +18 -2
  5. package/dist/cli/diagnostic-invocation.js +46 -0
  6. package/dist/cli/diagnostic.js +120 -0
  7. package/dist/cli/help.js +35 -0
  8. package/dist/cli/memory-flow-admission.js +4 -2
  9. package/dist/cli/memory-init.js +5 -2
  10. package/dist/cli/run-cli.js +16 -15
  11. package/dist/cli.js +6 -0
  12. package/dist/domain/diagnostic-aspects.js +103 -0
  13. package/dist/domain/diagnostic-flows.js +8 -0
  14. package/dist/harness-runtime/lib/agy-native-inspection.mjs +216 -0
  15. package/dist/harness-runtime/lib/agy-native_pb.js +117 -0
  16. package/dist/harness-runtime/lib/daemon-operations.d.mts +1 -0
  17. package/dist/harness-runtime/lib/daemon-operations.mjs +84 -10
  18. package/dist/harness-runtime/lib/dd-agy-daemon.mjs +306 -34
  19. package/dist/harness-runtime/lib/dd-codex-daemon.mjs +27 -13
  20. package/dist/harness-runtime/lib/dd-codex.mjs +4 -0
  21. package/dist/harness-runtime/lib/dd-droid-daemon.mjs +4 -3
  22. package/dist/harness-runtime/lib/dd-droid.mjs +70 -28
  23. package/dist/harness-runtime/lib/dd-grok-daemon.mjs +3 -3
  24. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +66 -20
  25. package/dist/harness-runtime/lib/dd-opencode.mjs +30 -3
  26. package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +7 -6
  27. package/dist/harness-runtime/lib/driver-recovery.mjs +9 -8
  28. package/dist/harness-runtime/lib/managed-daemon.d.mts +1 -1
  29. package/dist/harness-runtime/lib/managed-daemon.mjs +11 -3
  30. package/dist/harness-runtime/lib/native-children.d.mts +8 -1
  31. package/dist/harness-runtime/lib/native-children.mjs +114 -8
  32. package/dist/harness-runtime/lib/native-request-proof.mjs +1 -1
  33. package/dist/harness-runtime/lib/observation-clock.d.mts +2 -2
  34. package/dist/harness-runtime/lib/observation-clock.mjs +7 -4
  35. package/dist/harness-runtime/lib/provider-overload-policy.d.mts +1 -1
  36. package/dist/harness-runtime/lib/provider-overload-policy.mjs +1 -1
  37. package/dist/harness-runtime/lib/tool-observations.mjs +1 -1
  38. package/dist/schemas/diagnostic-stage-result.schema.json +354 -0
  39. package/dist/schemas/diagnostic-work-result.schema.json +296 -0
  40. package/dist/schemas/execution-bundle.schema.json +7 -1
  41. package/dist/schemas/project-flow-pack-manifest.schema.json +1 -1
  42. package/dist/services/check-environment.js +21 -0
  43. package/dist/services/check-runner-evidence.js +267 -15
  44. package/dist/services/code-checks.js +23 -15
  45. package/dist/services/controller-execution.js +10 -4
  46. package/dist/services/controller-fanout.js +13 -6
  47. package/dist/services/controller-memory-worker.js +3 -2
  48. package/dist/services/dashboard.js +2 -2
  49. package/dist/services/descriptor-run-settlement.js +5 -3
  50. package/dist/services/descriptor-run-start.js +22 -3
  51. package/dist/services/descriptor-stage-coordinator.js +37 -4
  52. package/dist/services/descriptor-stage-settlement.js +2 -1
  53. package/dist/services/diagnostic-evidence.js +73 -0
  54. package/dist/services/diagnostic-report-publication.js +72 -0
  55. package/dist/services/diagnostic-report.js +67 -0
  56. package/dist/services/diagnostic-run-bundle.js +74 -0
  57. package/dist/services/diagnostic-snapshot.js +159 -0
  58. package/dist/services/diagnostic-stage-handlers.js +108 -0
  59. package/dist/services/diagnostic-stage-results.js +132 -0
  60. package/dist/services/diagnostic-start.js +84 -0
  61. package/dist/services/diagnostic-work-batch.js +34 -0
  62. package/dist/services/diagnostic-work-collection.js +97 -0
  63. package/dist/services/diagnostic-work-registration.js +101 -0
  64. package/dist/services/diagnostic-work-results.js +93 -0
  65. package/dist/services/eval-snapshots.js +85 -29
  66. package/dist/services/execution-bundles.js +19 -7
  67. package/dist/services/flow-catalog.js +6 -1
  68. package/dist/services/frozen-engine.js +37 -2
  69. package/dist/services/hybrid-contracts.js +2 -0
  70. package/dist/services/installed-flow-source.js +25 -3
  71. package/dist/services/lifecycle-invocations.js +147 -34
  72. package/dist/services/memory-init-contexts.js +16 -0
  73. package/dist/services/memory-init-controller-start.js +12 -4
  74. package/dist/services/memory-init-lint-capability.js +5 -5
  75. package/dist/services/memory-init-native-capacity.js +4 -4
  76. package/dist/services/memory-init-preflight.js +10 -16
  77. package/dist/services/memory-init-worktrunk-capability.js +3 -7
  78. package/dist/services/memory-layer.js +4 -3
  79. package/dist/services/memory-tool-probe.js +25 -0
  80. package/dist/services/memory-verification-checks.js +15 -4
  81. package/dist/services/native-daemon-history.js +2 -1
  82. package/dist/services/provider-capacity.js +43 -38
  83. package/dist/services/release-cache.js +8 -0
  84. package/dist/services/run-control.js +2 -1
  85. package/dist/services/run-controller-adapter.js +2 -1
  86. package/dist/services/run-controller-process.js +2 -1
  87. package/dist/services/run-controller-recovery.js +2 -1
  88. package/dist/services/run-controller.js +85 -15
  89. package/dist/services/run-fork.js +1 -1
  90. package/dist/services/runs.js +6 -1
  91. package/dist/services/runtime-scope-resume.js +12 -6
  92. package/dist/services/runtime-scope-stop.js +3 -2
  93. package/dist/services/runtime-service.js +2 -1
  94. package/dist/services/stage-handlers.js +16 -3
  95. package/dist/services/stage-pause.js +4 -1
  96. package/dist/services/version-status.js +1 -1
  97. package/dist/services/vnext-code.js +2 -2
  98. package/dist/services/vnext-fanout.js +31 -1
  99. package/dist/services/work-registry.js +37 -6
  100. package/dist/services/workspace-bootstrap.js +2 -1
  101. package/package.json +6 -3
@@ -0,0 +1,354 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "dd-flow/diagnostic-stage-result@1",
4
+ "title": "Read-only audit and project-review stage result",
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
+ "allOf": [
19
+ {
20
+ "if": { "properties": { "stage": { "enum": ["preflight", "audit", "analyze"] } } },
21
+ "then": { "properties": { "details": { "type": "object", "properties": { "decisions": { "type": "array", "maxItems": 0 } } } } }
22
+ },
23
+ {
24
+ "if": { "properties": { "stage": { "const": "preflight" } } },
25
+ "then": { "properties": { "details": { "type": "object", "properties": { "findings": { "type": "array", "maxItems": 0 } } } } }
26
+ }
27
+ ],
28
+ "properties": {
29
+ "schema_id": {
30
+ "const": "dd-flow/diagnostic-stage-result@1"
31
+ },
32
+ "flow_id": {
33
+ "enum": [
34
+ "mb-audit",
35
+ "project-review"
36
+ ]
37
+ },
38
+ "run_id": {
39
+ "type": "string",
40
+ "pattern": "^RUN-[0-9]+-[a-z0-9-]+$"
41
+ },
42
+ "stage": {
43
+ "enum": [
44
+ "preflight",
45
+ "audit",
46
+ "analyze",
47
+ "review",
48
+ "report"
49
+ ]
50
+ },
51
+ "input_sha256": {
52
+ "$ref": "#/$defs/hash"
53
+ },
54
+ "snapshot_sha256": {
55
+ "$ref": "#/$defs/hash"
56
+ },
57
+ "summary": {
58
+ "$ref": "#/$defs/text"
59
+ },
60
+ "predecessors": {
61
+ "type": "array",
62
+ "maxItems": 1,
63
+ "items": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": [
67
+ "stage",
68
+ "path",
69
+ "sha256"
70
+ ],
71
+ "properties": {
72
+ "stage": {
73
+ "$ref": "#/$defs/text"
74
+ },
75
+ "path": {
76
+ "$ref": "#/$defs/text"
77
+ },
78
+ "sha256": {
79
+ "$ref": "#/$defs/hash"
80
+ }
81
+ }
82
+ }
83
+ },
84
+ "details": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": [
88
+ "focus",
89
+ "coverage",
90
+ "sources",
91
+ "missing_expected_sources",
92
+ "findings",
93
+ "decisions",
94
+ "limitations"
95
+ ],
96
+ "properties": {
97
+ "focus": {
98
+ "$ref": "#/$defs/focus"
99
+ },
100
+ "coverage": {
101
+ "type": "array",
102
+ "maxItems": 24,
103
+ "items": {
104
+ "$ref": "#/$defs/coverage"
105
+ }
106
+ },
107
+ "sources": {
108
+ "type": "array",
109
+ "maxItems": 4096,
110
+ "items": {
111
+ "$ref": "#/$defs/source"
112
+ }
113
+ },
114
+ "missing_expected_sources": {
115
+ "type": "array",
116
+ "maxItems": 256,
117
+ "items": {
118
+ "$ref": "#/$defs/text"
119
+ }
120
+ },
121
+ "findings": {
122
+ "type": "array",
123
+ "maxItems": 1000,
124
+ "items": {
125
+ "$ref": "#/$defs/finding"
126
+ }
127
+ },
128
+ "decisions": {
129
+ "type": "array",
130
+ "maxItems": 2000,
131
+ "items": {
132
+ "$ref": "#/$defs/decision"
133
+ }
134
+ },
135
+ "limitations": {
136
+ "type": "array",
137
+ "maxItems": 256,
138
+ "items": {
139
+ "$ref": "#/$defs/text"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ },
145
+ "$defs": {
146
+ "text": {
147
+ "type": "string",
148
+ "minLength": 1,
149
+ "maxLength": 16000
150
+ },
151
+ "hash": {
152
+ "type": "string",
153
+ "pattern": "^[a-f0-9]{64}$"
154
+ },
155
+ "source": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": [
159
+ "path",
160
+ "sha256"
161
+ ],
162
+ "properties": {
163
+ "path": {
164
+ "type": "string",
165
+ "description": "Path relative to the assigned diagnostic snapshot root, using forward slashes, for example src/index.ts or .memory-bank/index.md. Never an absolute path, dot segment, .git path, intake transport path or canonical support reference. Hash the exact snapshot file bytes.",
166
+ "minLength": 1,
167
+ "maxLength": 4096
168
+ },
169
+ "sha256": {
170
+ "$ref": "#/$defs/hash"
171
+ }
172
+ }
173
+ },
174
+ "coverage": {
175
+ "type": "object",
176
+ "additionalProperties": false,
177
+ "required": [
178
+ "id",
179
+ "applicability",
180
+ "reason",
181
+ "evidence"
182
+ ],
183
+ "properties": {
184
+ "id": {
185
+ "$ref": "#/$defs/text"
186
+ },
187
+ "applicability": {
188
+ "enum": [
189
+ "applicable",
190
+ "not_applicable",
191
+ "blocked",
192
+ "out_of_scope"
193
+ ]
194
+ },
195
+ "reason": {
196
+ "$ref": "#/$defs/text"
197
+ },
198
+ "evidence": {
199
+ "type": "array",
200
+ "maxItems": 64,
201
+ "items": {
202
+ "$ref": "#/$defs/source"
203
+ }
204
+ }
205
+ }
206
+ },
207
+ "finding": {
208
+ "type": "object",
209
+ "additionalProperties": false,
210
+ "required": [
211
+ "id",
212
+ "aspect_id",
213
+ "type",
214
+ "severity",
215
+ "confidence",
216
+ "summary",
217
+ "impact",
218
+ "evidence",
219
+ "recommendation"
220
+ ],
221
+ "properties": {
222
+ "id": {
223
+ "type": "string",
224
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,99}$"
225
+ },
226
+ "aspect_id": {
227
+ "$ref": "#/$defs/text"
228
+ },
229
+ "type": {
230
+ "enum": [
231
+ "project_defect",
232
+ "spec_drift",
233
+ "code_drift",
234
+ "memory_bank_gap",
235
+ "frontmatter_crosslink_gap",
236
+ "coding_standards_gap",
237
+ "policy_process_gap",
238
+ "evidence_gap",
239
+ "observation"
240
+ ]
241
+ },
242
+ "severity": {
243
+ "enum": [
244
+ "blocking",
245
+ "major",
246
+ "minor",
247
+ "informational"
248
+ ]
249
+ },
250
+ "confidence": {
251
+ "enum": [
252
+ "high",
253
+ "medium",
254
+ "low"
255
+ ]
256
+ },
257
+ "summary": {
258
+ "$ref": "#/$defs/text"
259
+ },
260
+ "impact": {
261
+ "$ref": "#/$defs/text"
262
+ },
263
+ "evidence": {
264
+ "type": "array",
265
+ "minItems": 1,
266
+ "maxItems": 64,
267
+ "items": {
268
+ "$ref": "#/$defs/source"
269
+ }
270
+ },
271
+ "recommendation": {
272
+ "$ref": "#/$defs/text"
273
+ }
274
+ }
275
+ },
276
+ "decision": {
277
+ "type": "object",
278
+ "additionalProperties": false,
279
+ "required": [
280
+ "finding_id",
281
+ "disposition",
282
+ "severity",
283
+ "reason",
284
+ "evidence"
285
+ ],
286
+ "properties": {
287
+ "finding_id": {
288
+ "$ref": "#/$defs/text"
289
+ },
290
+ "disposition": {
291
+ "enum": [
292
+ "accepted",
293
+ "downgraded",
294
+ "rejected",
295
+ "duplicate",
296
+ "def_candidate",
297
+ "review_fix_candidate"
298
+ ]
299
+ },
300
+ "severity": {
301
+ "enum": [
302
+ "blocking",
303
+ "major",
304
+ "minor",
305
+ "informational"
306
+ ]
307
+ },
308
+ "reason": {
309
+ "$ref": "#/$defs/text"
310
+ },
311
+ "evidence": {
312
+ "type": "array",
313
+ "maxItems": 64,
314
+ "items": {
315
+ "$ref": "#/$defs/source"
316
+ }
317
+ }
318
+ }
319
+ },
320
+ "focus": {
321
+ "type": "object",
322
+ "additionalProperties": false,
323
+ "required": [
324
+ "mode",
325
+ "target",
326
+ "title",
327
+ "summary"
328
+ ],
329
+ "properties": {
330
+ "mode": {
331
+ "enum": [
332
+ "memory_bank",
333
+ "whole_project",
334
+ "latest_protocol",
335
+ "specific_protocol",
336
+ "protocol_set",
337
+ "subsystem_or_spec_area",
338
+ "feature_or_epic",
339
+ "diff_or_commit_range"
340
+ ]
341
+ },
342
+ "target": {
343
+ "$ref": "#/$defs/text"
344
+ },
345
+ "title": {
346
+ "$ref": "#/$defs/text"
347
+ },
348
+ "summary": {
349
+ "$ref": "#/$defs/text"
350
+ }
351
+ }
352
+ }
353
+ }
354
+ }
@@ -0,0 +1,296 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "dd-flow/diagnostic-work-result@1",
4
+ "title": "Assigned read-only diagnostic aspect or independent critic result",
5
+ "allOf": [
6
+ {
7
+ "if": { "properties": { "stage": { "const": "review" } }, "required": ["stage"] },
8
+ "then": { "properties": { "findings": { "type": "array", "maxItems": 0 } } },
9
+ "else": { "properties": { "decisions": { "type": "array", "maxItems": 0 } } }
10
+ }
11
+ ],
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": [
15
+ "schema_id",
16
+ "flow_id",
17
+ "run_id",
18
+ "work_id",
19
+ "stage",
20
+ "aspect_id",
21
+ "summary",
22
+ "sources",
23
+ "findings",
24
+ "decisions",
25
+ "limitations"
26
+ ],
27
+ "properties": {
28
+ "schema_id": {
29
+ "const": "dd-flow/diagnostic-work-result@1"
30
+ },
31
+ "flow_id": {
32
+ "enum": [
33
+ "mb-audit",
34
+ "project-review"
35
+ ]
36
+ },
37
+ "run_id": {
38
+ "type": "string",
39
+ "pattern": "^RUN-[0-9]+-[a-z0-9-]+$"
40
+ },
41
+ "work_id": {
42
+ "type": "string",
43
+ "pattern": "^WRK-[0-9]+-[a-z0-9-]+$"
44
+ },
45
+ "stage": {
46
+ "enum": [
47
+ "audit",
48
+ "analyze",
49
+ "review"
50
+ ]
51
+ },
52
+ "aspect_id": {
53
+ "$ref": "#/$defs/text"
54
+ },
55
+ "summary": {
56
+ "$ref": "#/$defs/text"
57
+ },
58
+ "sources": {
59
+ "type": "array",
60
+ "maxItems": 4096,
61
+ "items": {
62
+ "$ref": "#/$defs/source"
63
+ }
64
+ },
65
+ "findings": {
66
+ "type": "array",
67
+ "maxItems": 1000,
68
+ "items": {
69
+ "$ref": "#/$defs/finding"
70
+ }
71
+ },
72
+ "decisions": {
73
+ "type": "array",
74
+ "maxItems": 2000,
75
+ "items": {
76
+ "$ref": "#/$defs/decision"
77
+ }
78
+ },
79
+ "limitations": {
80
+ "type": "array",
81
+ "maxItems": 256,
82
+ "items": {
83
+ "$ref": "#/$defs/text"
84
+ }
85
+ }
86
+ },
87
+ "$defs": {
88
+ "text": {
89
+ "type": "string",
90
+ "minLength": 1,
91
+ "maxLength": 16000
92
+ },
93
+ "hash": {
94
+ "type": "string",
95
+ "pattern": "^[a-f0-9]{64}$"
96
+ },
97
+ "source": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": [
101
+ "path",
102
+ "sha256"
103
+ ],
104
+ "properties": {
105
+ "path": {
106
+ "type": "string",
107
+ "description": "Path relative to the assigned diagnostic snapshot root, using forward slashes, for example src/index.ts or .memory-bank/index.md. Never an absolute path, dot segment, .git path, intake transport path or canonical support reference. Hash the exact snapshot file bytes.",
108
+ "minLength": 1,
109
+ "maxLength": 4096
110
+ },
111
+ "sha256": {
112
+ "$ref": "#/$defs/hash"
113
+ }
114
+ }
115
+ },
116
+ "coverage": {
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "required": [
120
+ "id",
121
+ "applicability",
122
+ "reason",
123
+ "evidence"
124
+ ],
125
+ "properties": {
126
+ "id": {
127
+ "$ref": "#/$defs/text"
128
+ },
129
+ "applicability": {
130
+ "enum": [
131
+ "applicable",
132
+ "not_applicable",
133
+ "blocked",
134
+ "out_of_scope"
135
+ ]
136
+ },
137
+ "reason": {
138
+ "$ref": "#/$defs/text"
139
+ },
140
+ "evidence": {
141
+ "type": "array",
142
+ "maxItems": 64,
143
+ "items": {
144
+ "$ref": "#/$defs/source"
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "finding": {
150
+ "type": "object",
151
+ "additionalProperties": false,
152
+ "required": [
153
+ "id",
154
+ "aspect_id",
155
+ "type",
156
+ "severity",
157
+ "confidence",
158
+ "summary",
159
+ "impact",
160
+ "evidence",
161
+ "recommendation"
162
+ ],
163
+ "properties": {
164
+ "id": {
165
+ "type": "string",
166
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,99}$"
167
+ },
168
+ "aspect_id": {
169
+ "$ref": "#/$defs/text"
170
+ },
171
+ "type": {
172
+ "enum": [
173
+ "project_defect",
174
+ "spec_drift",
175
+ "code_drift",
176
+ "memory_bank_gap",
177
+ "frontmatter_crosslink_gap",
178
+ "coding_standards_gap",
179
+ "policy_process_gap",
180
+ "evidence_gap",
181
+ "observation"
182
+ ]
183
+ },
184
+ "severity": {
185
+ "enum": [
186
+ "blocking",
187
+ "major",
188
+ "minor",
189
+ "informational"
190
+ ]
191
+ },
192
+ "confidence": {
193
+ "enum": [
194
+ "high",
195
+ "medium",
196
+ "low"
197
+ ]
198
+ },
199
+ "summary": {
200
+ "$ref": "#/$defs/text"
201
+ },
202
+ "impact": {
203
+ "$ref": "#/$defs/text"
204
+ },
205
+ "evidence": {
206
+ "type": "array",
207
+ "minItems": 1,
208
+ "maxItems": 64,
209
+ "items": {
210
+ "$ref": "#/$defs/source"
211
+ }
212
+ },
213
+ "recommendation": {
214
+ "$ref": "#/$defs/text"
215
+ }
216
+ }
217
+ },
218
+ "decision": {
219
+ "type": "object",
220
+ "additionalProperties": false,
221
+ "required": [
222
+ "finding_id",
223
+ "disposition",
224
+ "severity",
225
+ "reason",
226
+ "evidence"
227
+ ],
228
+ "properties": {
229
+ "finding_id": {
230
+ "$ref": "#/$defs/text"
231
+ },
232
+ "disposition": {
233
+ "enum": [
234
+ "accepted",
235
+ "downgraded",
236
+ "rejected",
237
+ "duplicate",
238
+ "def_candidate",
239
+ "review_fix_candidate"
240
+ ]
241
+ },
242
+ "severity": {
243
+ "enum": [
244
+ "blocking",
245
+ "major",
246
+ "minor",
247
+ "informational"
248
+ ]
249
+ },
250
+ "reason": {
251
+ "$ref": "#/$defs/text"
252
+ },
253
+ "evidence": {
254
+ "type": "array",
255
+ "maxItems": 64,
256
+ "items": {
257
+ "$ref": "#/$defs/source"
258
+ }
259
+ }
260
+ }
261
+ },
262
+ "focus": {
263
+ "type": "object",
264
+ "additionalProperties": false,
265
+ "required": [
266
+ "mode",
267
+ "target",
268
+ "title",
269
+ "summary"
270
+ ],
271
+ "properties": {
272
+ "mode": {
273
+ "enum": [
274
+ "memory_bank",
275
+ "whole_project",
276
+ "latest_protocol",
277
+ "specific_protocol",
278
+ "protocol_set",
279
+ "subsystem_or_spec_area",
280
+ "feature_or_epic",
281
+ "diff_or_commit_range"
282
+ ]
283
+ },
284
+ "target": {
285
+ "$ref": "#/$defs/text"
286
+ },
287
+ "title": {
288
+ "$ref": "#/$defs/text"
289
+ },
290
+ "summary": {
291
+ "$ref": "#/$defs/text"
292
+ }
293
+ }
294
+ }
295
+ }
296
+ }
@@ -3,6 +3,11 @@
3
3
  "$id": "dd-flow/execution-bundle@1",
4
4
  "type": "object",
5
5
  "additionalProperties": false,
6
+ "allOf": [{
7
+ "if": { "properties": { "flow_id": { "enum": ["mb-audit", "project-review"] } }, "required": ["flow_id"] },
8
+ "then": { "properties": { "project_pack": { "type": "null" } } },
9
+ "else": { "properties": { "project_pack": { "type": "object" } } }
10
+ }],
6
11
  "required": [
7
12
  "schema_id",
8
13
  "run_id",
@@ -129,7 +134,8 @@
129
134
  }
130
135
  },
131
136
  "project_pack": {
132
- "type": "object",
137
+ "description": "Null only for read-only diagnostics: project documents are snapshot evidence, not an executable project pack.",
138
+ "type": ["object", "null"],
133
139
  "additionalProperties": false,
134
140
  "required": [
135
141
  "sha256",
@@ -81,7 +81,7 @@
81
81
  "uniqueItems": true,
82
82
  "items": {
83
83
  "type": "string",
84
- "enum": ["mb-init.md", "mb-upgrade.md", "mb-distill.md"]
84
+ "enum": ["mb-init.md", "mb-upgrade.md", "mb-distill.md", "mb-audit.md", "review.md"]
85
85
  }
86
86
  },
87
87
  "generated_allow_patterns": {
@@ -0,0 +1,21 @@
1
+ import path from "node:path";
2
+ import { AppError } from "../shared/errors.js";
3
+ export function validateCheckEnvironment(value) {
4
+ if (value === undefined)
5
+ return undefined;
6
+ const entries = value && typeof value === "object" && !Array.isArray(value) ? Object.entries(value) : [];
7
+ if (!entries.length || entries.some(([key, selected]) => !["CODEX_HOME", "PLAYWRIGHT_BROWSERS_PATH"].includes(key)
8
+ || typeof selected !== "string" || !selected || selected.length > 4096 || selected.includes("\0") || !path.isAbsolute(selected)))
9
+ throw new AppError("invalid_check_environment", "Owned checks require absolute known resource paths", 2, { effect: "no_effect" });
10
+ return { ...value };
11
+ }
12
+ export function retainedBrowserEnvironment(environment) {
13
+ return environment.PLAYWRIGHT_BROWSERS_PATH === undefined ? undefined
14
+ : validateCheckEnvironment({ PLAYWRIGHT_BROWSERS_PATH: environment.PLAYWRIGHT_BROWSERS_PATH });
15
+ }
16
+ export function ownedCheckEnvironment(environment, requested) {
17
+ const selected = validateCheckEnvironment(requested), retained = retainedBrowserEnvironment(environment);
18
+ if (retained?.PLAYWRIGHT_BROWSERS_PATH && selected?.PLAYWRIGHT_BROWSERS_PATH && retained.PLAYWRIGHT_BROWSERS_PATH !== selected.PLAYWRIGHT_BROWSERS_PATH)
19
+ throw new AppError("invalid_check_environment", "Owned browser resource cannot be rebound", 2, { effect: "no_effect" });
20
+ return retained || selected ? { ...retained, ...selected } : undefined;
21
+ }