@deksden-com/dd-flow-cli 0.7.0 → 0.8.0

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 (69) hide show
  1. package/CHANGELOG.md +666 -0
  2. package/README.md +7 -2
  3. package/dist/build-info.json +5 -5
  4. package/dist/cli/help.js +88 -10
  5. package/dist/cli/run-cli.js +523 -28
  6. package/dist/domain/stage-catalog.js +22 -0
  7. package/dist/domain/validation.js +1 -1
  8. package/dist/schemas/code-review-decision.schema.json +26 -0
  9. package/dist/schemas/code-review-result.schema.json +14 -0
  10. package/dist/schemas/code-verification.schema.json +14 -0
  11. package/dist/schemas/code-work-batch.schema.json +24 -0
  12. package/dist/schemas/code-work-result.schema.json +16 -0
  13. package/dist/schemas/compatibility.schema.json +32 -0
  14. package/dist/schemas/flow-contract.schema.json +9 -5
  15. package/dist/schemas/flow-run.schema.json +16 -123
  16. package/dist/schemas/plan-aspect-map.schema.json +22 -0
  17. package/dist/schemas/plan-review-decision.schema.json +14 -0
  18. package/dist/schemas/plan-review-result.schema.json +42 -0
  19. package/dist/schemas/protocol-plan.schema.json +15 -182
  20. package/dist/schemas/stage-finish-input.schema.json +16 -2
  21. package/dist/schemas/stage-report.schema.json +8 -7
  22. package/dist/schemas/stage-start-response.schema.json +4 -2
  23. package/dist/schemas/status-report.schema.json +76 -0
  24. package/dist/schemas/vnext-protocol-plan.schema.json +37 -0
  25. package/dist/schemas/vnext-protocolize-result.schema.json +29 -0
  26. package/dist/schemas/vnext-specify.schema.json +45 -0
  27. package/dist/services/branch-context.js +1 -1
  28. package/dist/services/cleanup.js +8 -8
  29. package/dist/services/cli-operation-classifier.js +10 -2
  30. package/dist/services/code-checks.js +244 -0
  31. package/dist/services/config.js +7 -1
  32. package/dist/services/dashboard.js +12 -12
  33. package/dist/services/engines.js +1 -1
  34. package/dist/services/eval-snapshots.js +404 -0
  35. package/dist/services/hooks.js +774 -18
  36. package/dist/services/ids.js +16 -6
  37. package/dist/services/lanes.js +1 -1
  38. package/dist/services/merge-queue.js +5 -5
  39. package/dist/services/merge-worker.js +2 -2
  40. package/dist/services/migrations.js +2 -2
  41. package/dist/services/plan-runtime.js +1 -1
  42. package/dist/services/projects.js +4 -4
  43. package/dist/services/prompts.js +17 -11
  44. package/dist/services/protocols.js +8 -8
  45. package/dist/services/run-projection.js +49 -13
  46. package/dist/services/runs.js +504 -51
  47. package/dist/services/schema-validation.js +21 -3
  48. package/dist/services/sessions.js +51 -12
  49. package/dist/services/stage-blocker.js +57 -0
  50. package/dist/services/stage-context.js +90 -0
  51. package/dist/services/stage-lifecycle.js +198 -75
  52. package/dist/services/stage-pause.js +175 -0
  53. package/dist/services/stage-report-renderer.js +65 -0
  54. package/dist/services/usage.js +526 -18
  55. package/dist/services/vnext-code-review.js +305 -0
  56. package/dist/services/vnext-code.js +686 -0
  57. package/dist/services/vnext-contracts.js +1 -0
  58. package/dist/services/vnext-execution-profile.js +27 -0
  59. package/dist/services/vnext-fanout.js +79 -0
  60. package/dist/services/vnext-plan-review.js +499 -0
  61. package/dist/services/vnext-plan.js +552 -0
  62. package/dist/services/vnext-protocolize.js +542 -0
  63. package/dist/services/vnext-specify.js +595 -0
  64. package/dist/services/vnext-workspace-policy.js +87 -0
  65. package/dist/services/work-registry.js +522 -0
  66. package/dist/services/worktrees.js +58 -37
  67. package/dist/storage/database.js +263 -34
  68. package/dist/storage/paths.js +47 -1
  69. package/package.json +12 -12
@@ -7,191 +7,24 @@
7
7
  "additionalProperties": false,
8
8
  "required": ["$schema", "schema_id", "plan_id", "protocol_id", "revision", "title", "summary", "specifications", "protocol_reference", "goal", "task_assessment", "route_decision", "policy_context", "sdlc_contours", "items", "verification", "code_handoff"],
9
9
  "properties": {
10
- "$schema": {"type": "string", "minLength": 1},
11
- "schema_id": {"const": "dd-flow/protocol-plan@1"},
12
- "plan_id": {"type": "string", "pattern": "^PLAN-[A-Za-z0-9][A-Za-z0-9._-]*$"},
13
- "protocol_id": {"type": "string", "pattern": "^PRT-[A-Za-z0-9][A-Za-z0-9._-]*$"},
14
- "revision": {"type": "integer", "minimum": 1},
15
- "title": {"type": "string", "minLength": 1},
16
- "summary": {"type": "string", "minLength": 1},
17
- "specifications": {
18
- "type": "array", "minItems": 1, "uniqueItems": true,
19
- "items": {
20
- "type": "object", "additionalProperties": false,
21
- "required": ["id", "version", "path", "sha256", "requirements"],
22
- "properties": {
23
- "id": {"type": "string", "pattern": "^SPC-[0-9]{3}$"},
24
- "version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
25
- "path": {"type": "string", "pattern": "^\\.memory-bank/"},
26
- "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
27
- "requirements": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^R-[0-9]+$"}}
28
- }
29
- }
30
- },
31
- "protocol_reference": {
32
- "type": "object", "additionalProperties": false, "required": ["path", "sha256"],
33
- "properties": {
34
- "path": {"type": "string", "pattern": "^\\.memory-bank/protocol/"},
35
- "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
36
- }
37
- },
38
- "goal": {
39
- "type": "object", "additionalProperties": false, "required": ["outcome", "constraints", "non_goals"],
40
- "properties": {
41
- "outcome": {"type": "string", "minLength": 1},
42
- "constraints": {"type": "array", "items": {"type": "string", "minLength": 1}},
43
- "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}}
44
- }
45
- },
10
+ "$schema": {"type": "string", "minLength": 1}, "schema_id": {"const": "dd-flow/protocol-plan@1"}, "plan_id": {"type": "string", "pattern": "^PLAN-[A-Za-z0-9][A-Za-z0-9._-]*$"}, "protocol_id": {"type": "string", "pattern": "^PRT-[A-Za-z0-9][A-Za-z0-9._-]*$"}, "revision": {"type": "integer", "minimum": 1}, "title": {"type": "string", "minLength": 1}, "summary": {"type": "string", "minLength": 1},
11
+ "specifications": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "object", "additionalProperties": false, "required": ["id", "version", "path", "sha256", "requirements"], "properties": {"id": {"type": "string", "pattern": "^SPC-[0-9]{3}$"}, "version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"}, "path": {"type": "string", "pattern": "^\\.memory-bank/"}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}, "requirements": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^R-[0-9]+$"}}}}},
12
+ "protocol_reference": {"type": "object", "additionalProperties": false, "required": ["path", "sha256"], "properties": {"path": {"type": "string", "pattern": "^\\.memory-bank/protocol/"}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}}},
13
+ "goal": {"type": "object", "additionalProperties": false, "required": ["outcome", "constraints", "non_goals"], "properties": {"outcome": {"type": "string", "minLength": 1}, "constraints": {"type": "array", "items": {"type": "string", "minLength": 1}}, "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}}}},
46
14
  "task_assessment": {"$ref": "#/definitions/taskAssessment"},
47
- "route_decision": {
48
- "type": "object", "additionalProperties": false,
49
- "required": ["initial_state", "selected_route", "selected_execution_mode", "reason", "capacity_probe", "packing"],
50
- "properties": {
51
- "initial_state": {"const": "orchestrator_local"},
52
- "selected_route": {"enum": ["local_compact", "single_wave_grouped", "multi_wave_grouped", "external_handoff"]},
53
- "selected_execution_mode": {"type": "string", "minLength": 1},
54
- "reason": {"type": "string", "minLength": 1},
55
- "capacity_probe": {"type": "string", "minLength": 1},
56
- "packing": {"type": "string", "minLength": 1}
57
- }
58
- },
59
- "policy_context": {
60
- "type": "object", "additionalProperties": false,
61
- "required": ["target_language", "source_authority", "current_truth_boundary", "validation", "lint"],
62
- "properties": {
63
- "target_language": {"type": "string", "minLength": 1},
64
- "source_authority": {"type": "string", "minLength": 1},
65
- "current_truth_boundary": {"type": "string", "minLength": 1},
66
- "validation": {"type": "string", "minLength": 1},
67
- "lint": {"type": "string", "minLength": 1}
68
- }
69
- },
70
- "sdlc_contours": {
71
- "type": "object", "additionalProperties": false, "required": ["summary", "contours"],
72
- "properties": {
73
- "summary": {"type": "string", "minLength": 1},
74
- "contours": {
75
- "type": "array", "minItems": 1,
76
- "items": {
77
- "type": "object", "additionalProperties": false,
78
- "required": ["name", "applicability_status", "gate_status", "target_stage", "summary"],
79
- "properties": {
80
- "name": {"type": "string", "minLength": 1},
81
- "applicability_status": {"enum": ["applicable", "external", "not_applicable"]},
82
- "gate_status": {"enum": ["required", "deferred", "not_applicable"]},
83
- "target_stage": {"enum": ["specify", "plan", "code", "readiness", "merge", "release"]},
84
- "summary": {"type": "string", "minLength": 1}
85
- }
86
- }
87
- }
88
- }
89
- },
15
+ "route_decision": {"type": "object", "additionalProperties": false, "required": ["initial_state", "selected_route", "selected_execution_mode", "reason", "capacity_probe", "packing"], "properties": {"initial_state": {"const": "orchestrator_local"}, "selected_route": {"enum": ["local_compact", "single_wave_grouped", "multi_wave_grouped", "external_handoff"]}, "selected_execution_mode": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}, "capacity_probe": {"type": "string", "minLength": 1}, "packing": {"type": "string", "minLength": 1}}},
16
+ "policy_context": {"type": "object", "additionalProperties": false, "required": ["target_language", "source_authority", "current_truth_boundary", "validation", "lint"], "properties": {"target_language": {"type": "string", "minLength": 1}, "source_authority": {"type": "string", "minLength": 1}, "current_truth_boundary": {"type": "string", "minLength": 1}, "validation": {"type": "string", "minLength": 1}, "lint": {"type": "string", "minLength": 1}}},
17
+ "sdlc_contours": {"type": "object", "additionalProperties": false, "required": ["summary", "contours"], "properties": {"summary": {"type": "string", "minLength": 1}, "contours": {"type": "array", "minItems": 1, "items": {"type": "object", "additionalProperties": false, "required": ["name", "applicability_status", "gate_status", "target_stage", "summary"], "properties": {"name": {"type": "string", "minLength": 1}, "applicability_status": {"enum": ["applicable", "external", "not_applicable"]}, "gate_status": {"enum": ["required", "deferred", "not_applicable"]}, "target_stage": {"enum": ["specify", "plan", "code", "readiness", "merge", "release"]}, "summary": {"type": "string", "minLength": 1}}}}}},
90
18
  "items": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/definitions/planItem"}},
91
- "verification": {
92
- "type": "object", "additionalProperties": false, "required": ["scenario_seeds", "commands", "acceptance"],
93
- "properties": {
94
- "scenario_seeds": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
95
- "commands": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
96
- "acceptance": {"type": "string", "minLength": 1}
97
- }
98
- },
99
- "code_handoff": {
100
- "type": "object", "additionalProperties": false,
101
- "required": ["must_read", "accepted_plan_ref", "companion_handoffs", "next_stage", "known_external_gate"],
102
- "properties": {
103
- "must_read": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
104
- "accepted_plan_ref": {
105
- "type": "object", "additionalProperties": false, "required": ["path", "revision", "sha256"],
106
- "properties": {
107
- "path": {"type": "string", "pattern": "^\\.memory-bank/protocol/[^/]+/plan\\.json$"},
108
- "revision": {"type": "integer", "minimum": 1},
109
- "sha256": {"enum": ["computed_by_stage_finish"]}
110
- }
111
- },
112
- "companion_handoffs": {
113
- "type": "array",
114
- "items": {
115
- "type": "object", "additionalProperties": false, "required": ["protocol_id", "repository", "scope"],
116
- "properties": {
117
- "protocol_id": {"type": "string", "pattern": "^PRT-[A-Za-z0-9][A-Za-z0-9._-]*$"},
118
- "repository": {"type": "string", "minLength": 1},
119
- "scope": {"type": "string", "minLength": 1}
120
- }
121
- }
122
- },
123
- "next_stage": {"enum": ["code", "readiness", "merge", "release"]},
124
- "known_external_gate": {"type": "string", "minLength": 1}
125
- }
126
- }
19
+ "verification": {"type": "object", "additionalProperties": false, "required": ["scenario_seeds", "commands", "acceptance"], "properties": {"scenario_seeds": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "commands": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "acceptance": {"type": "string", "minLength": 1}}},
20
+ "code_handoff": {"type": "object", "additionalProperties": false, "required": ["must_read", "accepted_plan_ref", "companion_handoffs", "next_stage", "known_external_gate"], "properties": {"must_read": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "accepted_plan_ref": {"type": "object", "additionalProperties": false, "required": ["path", "revision", "sha256"], "properties": {"path": {"type": "string", "pattern": "^\\.memory-bank/protocol/[^/]+/plan\\.json$"}, "revision": {"type": "integer", "minimum": 1}, "sha256": {"enum": ["computed_by_stage_finish"]}}}, "companion_handoffs": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["protocol_id", "repository", "scope"], "properties": {"protocol_id": {"type": "string", "pattern": "^PRT-[A-Za-z0-9][A-Za-z0-9._-]*$"}, "repository": {"type": "string", "minLength": 1}, "scope": {"type": "string", "minLength": 1}}}}, "next_stage": {"enum": ["code", "readiness", "merge", "release"]}, "known_external_gate": {"type": "string", "minLength": 1}}}
127
21
  },
128
22
  "definitions": {
129
- "semanticSpine": {
130
- "type": "object", "additionalProperties": false,
131
- "required": ["user_outcome", "component_responsibility", "must_preserve", "non_goals", "acceptance_contribution"],
132
- "properties": {
133
- "user_outcome": {"type": "string", "minLength": 1},
134
- "component_responsibility": {"type": "string", "minLength": 1},
135
- "must_preserve": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
136
- "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}},
137
- "acceptance_contribution": {"type": "string", "minLength": 1}
138
- }
139
- },
140
- "executionContext": {
141
- "type": "object", "additionalProperties": false,
142
- "required": ["prompt_profile", "required_read", "discovery_boundary", "write_scope", "checks"],
143
- "properties": {
144
- "prompt_profile": {"enum": ["documentation_contract", "code_implementation", "verification"]},
145
- "required_read": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
146
- "discovery_boundary": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
147
- "write_scope": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
148
- "checks": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}
149
- }
150
- },
151
- "verificationContract": {
152
- "type": "object", "additionalProperties": false, "required": ["checks", "evidence"],
153
- "properties": {
154
- "checks": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
155
- "evidence": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}
156
- }
157
- },
158
- "planItem": {
159
- "type": "object", "additionalProperties": false,
160
- "required": ["id", "kind", "title", "summary", "depends_on", "owner", "target_stage", "required", "requirements", "semantic_spine", "execution_context", "verification_contract"],
161
- "properties": {
162
- "id": {"type": "string", "pattern": "^P[0-9]+$"},
163
- "kind": {"type": "string", "minLength": 1},
164
- "title": {"type": "string", "minLength": 1},
165
- "summary": {"type": "string", "minLength": 1},
166
- "details": {"type": "string", "minLength": 1},
167
- "depends_on": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^P[0-9]+$"}},
168
- "owner": {"type": "string", "minLength": 1},
169
- "target_stage": {"enum": ["specify", "plan", "code", "readiness", "merge", "release"]},
170
- "required": {"type": "boolean"},
171
- "requirements": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^SPC-[0-9]{3}@[0-9]+\\.[0-9]+\\.[0-9]+/R-[0-9]+$"}},
172
- "semantic_spine": {"$ref": "#/definitions/semanticSpine"},
173
- "execution_context": {"$ref": "#/definitions/executionContext"},
174
- "verification_contract": {"$ref": "#/definitions/verificationContract"}
175
- }
176
- },
177
- "taskAssessment": {
178
- "type": "object", "additionalProperties": false,
179
- "required": ["scope_breadth", "solution_novelty", "solution_uncertainty", "failure_impact", "plan_floor"],
180
- "properties": {
181
- "scope_breadth": {"$ref": "#/definitions/assessmentAxis"},
182
- "solution_novelty": {"$ref": "#/definitions/assessmentAxis"},
183
- "solution_uncertainty": {"$ref": "#/definitions/assessmentAxis"},
184
- "failure_impact": {"$ref": "#/definitions/assessmentAxis"},
185
- "plan_floor": {"$ref": "#/definitions/assessmentAxis"}
186
- }
187
- },
188
- "assessmentAxis": {
189
- "type": "object", "additionalProperties": false, "required": ["level", "surfaces", "reason"],
190
- "properties": {
191
- "level": {"type": "string", "minLength": 1},
192
- "surfaces": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
193
- "reason": {"type": "string", "minLength": 1}
194
- }
195
- }
23
+ "semanticSpine": {"type": "object", "additionalProperties": false, "required": ["user_outcome", "component_responsibility", "must_preserve", "non_goals", "acceptance_contribution"], "properties": {"user_outcome": {"type": "string", "minLength": 1}, "component_responsibility": {"type": "string", "minLength": 1}, "must_preserve": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}}, "acceptance_contribution": {"type": "string", "minLength": 1}}},
24
+ "executionContext": {"type": "object", "additionalProperties": false, "required": ["prompt_profile", "required_read", "discovery_boundary", "planned_write_areas", "checks"], "properties": {"prompt_profile": {"enum": ["documentation_contract", "code_implementation", "verification"]}, "required_read": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "discovery_boundary": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "planned_write_areas": {"type": "array", "items": {"type": "string", "minLength": 1}, "description": "Soft concurrent-work coordination hints, never a write allowlist."}, "checks": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}}},
25
+ "verificationContract": {"type": "object", "additionalProperties": false, "required": ["checks", "evidence"], "properties": {"checks": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "evidence": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}}},
26
+ "planItem": {"type": "object", "additionalProperties": false, "required": ["id", "kind", "title", "summary", "depends_on", "owner", "target_stage", "required", "requirements", "semantic_spine", "execution_context", "verification_contract"], "properties": {"id": {"type": "string", "pattern": "^P[0-9]+$"}, "kind": {"type": "string", "minLength": 1}, "title": {"type": "string", "minLength": 1}, "summary": {"type": "string", "minLength": 1}, "details": {"type": "string", "minLength": 1}, "depends_on": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^P[0-9]+$"}}, "owner": {"type": "string", "minLength": 1}, "target_stage": {"enum": ["specify", "plan", "code", "readiness", "merge", "release"]}, "required": {"type": "boolean"}, "requirements": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^SPC-[0-9]{3}@[0-9]+\\.[0-9]+\\.[0-9]+/R-[0-9]+$"}}, "semantic_spine": {"$ref": "#/definitions/semanticSpine"}, "execution_context": {"$ref": "#/definitions/executionContext"}, "verification_contract": {"$ref": "#/definitions/verificationContract"}}},
27
+ "taskAssessment": {"type": "object", "additionalProperties": false, "required": ["scope_breadth", "solution_novelty", "solution_uncertainty", "failure_impact", "plan_floor"], "properties": {"scope_breadth": {"$ref": "#/definitions/assessmentAxis"}, "solution_novelty": {"$ref": "#/definitions/assessmentAxis"}, "solution_uncertainty": {"$ref": "#/definitions/assessmentAxis"}, "failure_impact": {"$ref": "#/definitions/assessmentAxis"}, "plan_floor": {"$ref": "#/definitions/assessmentAxis"}}},
28
+ "assessmentAxis": {"type": "object", "additionalProperties": false, "required": ["level", "surfaces", "reason"], "properties": {"level": {"type": "string", "minLength": 1}, "surfaces": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}, "reason": {"type": "string", "minLength": 1}}}
196
29
  }
197
30
  }
@@ -4,10 +4,10 @@
4
4
  "title": "Semantic stage finish input",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["schema_id", "status", "result", "acceptance", "changed_files", "checks", "evidence", "next_action"],
7
+ "required": ["schema_id", "status", "result", "acceptance", "checks", "evidence", "next_action"],
8
8
  "properties": {
9
9
  "schema_id": {"const": "dd-flow/stage-finish-input@1"},
10
- "status": {"enum": ["done", "blocked", "failed"]},
10
+ "status": {"enum": ["done", "waiting_for_user", "blocked", "failed"]},
11
11
  "result": {"type": "string", "minLength": 1},
12
12
  "acceptance": {"type": "array", "items": {"type": "string", "minLength": 1}},
13
13
  "changed_files": {"type": "array", "items": {"type": "string", "minLength": 1}},
@@ -15,6 +15,20 @@
15
15
  "evidence": {"type": "array", "items": {"type": "string", "minLength": 1}},
16
16
  "reviewer_findings": {"type": "array", "items": {"type": "string"}},
17
17
  "def_outcomes": {"type": "array", "items": {"type": "string"}},
18
+ "questions": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["id", "question", "impact"],
24
+ "properties": {
25
+ "id": {"type": "string", "minLength": 1},
26
+ "question": {"type": "string", "minLength": 1},
27
+ "impact": {"type": "string", "minLength": 1},
28
+ "recommendation": {"type": "string", "minLength": 1}
29
+ }
30
+ }
31
+ },
18
32
  "next_action": {"type": "string", "minLength": 1}
19
33
  }
20
34
  }
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "dd-flow/stage-report@1",
3
+ "$id": "dd-flow/stage-report@2",
4
4
  "title": "Generated stage report",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["schema_id", "run_id", "stage", "generated_at", "verdict", "semantic", "mechanical", "artifacts", "validation"],
7
+ "required": ["schema_id", "run_id", "stage", "generated_at", "verdict", "summary", "semantic", "mechanical", "artifacts", "validation"],
8
8
  "properties": {
9
- "schema_id": {"const": "dd-flow/stage-report@1"},
9
+ "schema_id": {"const": "dd-flow/stage-report@2"},
10
10
  "run_id": {"type": "string", "minLength": 1},
11
11
  "stage": {"type": "string", "minLength": 1},
12
12
  "generated_at": {"type": "string", "format": "date-time"},
13
- "verdict": {"enum": ["done", "blocked", "failed", "degraded"]},
13
+ "verdict": {"enum": ["done", "waiting_for_user", "blocked", "failed", "degraded"]},
14
+ "summary": {"type": "string", "minLength": 1},
14
15
  "semantic": {"type": "object", "required": ["result", "acceptance", "changed_files", "checks", "evidence", "next_action"], "additionalProperties": true, "properties": {"result": {"type": "string"}, "acceptance": {"type": "array"}, "changed_files": {"type": "array"}, "checks": {"type": "array"}, "evidence": {"type": "array"}, "next_action": {"type": "string"}}},
15
- "mechanical": {"type": "object", "required": ["started_at", "finished_at", "wall_clock_ms", "git", "session_coverage", "usage_coverage"], "additionalProperties": true, "properties": {"started_at": {"type": "string", "format": "date-time"}, "finished_at": {"type": "string", "format": "date-time"}, "wall_clock_ms": {"type": "integer", "minimum": 0}, "git": {"type": "object"}, "session_coverage": {"type": "object"}, "usage_coverage": {"type": "object"}}},
16
- "artifacts": {"type": "object", "required": ["json", "markdown", "html", "summary"], "additionalProperties": false, "properties": {"json": {"type": "string"}, "markdown": {"type": "string"}, "html": {"type": "string"}, "summary": {"type": "string"}}},
17
- "validation": {"type": "object", "required": ["permission_scope", "memory_bank_scope", "status"], "additionalProperties": true, "properties": {"permission_scope": {"const": "known_targets_only"}, "memory_bank_scope": {"const": "changed_files_and_links_only"}, "status": {"type": "string"}}},
16
+ "mechanical": {"type": "object", "required": ["started_at", "finished_at", "wall_clock_ms", "git"], "additionalProperties": true, "properties": {"started_at": {"type": "string", "format": "date-time"}, "finished_at": {"type": "string", "format": "date-time"}, "wall_clock_ms": {"type": ["integer", "null"], "minimum": 0}, "git": {"type": "object"}}},
17
+ "artifacts": {"type": "object", "required": ["json", "markdown", "html"], "additionalProperties": false, "properties": {"json": {"type": "string"}, "markdown": {"type": "string"}, "html": {"type": "string"}}},
18
+ "validation": {"type": "object", "required": ["status"], "additionalProperties": true, "properties": {"permission_scope": {"type": "string"}, "memory_bank_scope": {"type": "string"}, "status": {"type": "string"}}},
18
19
  "breadcrumbs": {"type": "array", "items": {"type": "object"}}
19
20
  }
20
21
  }
@@ -10,7 +10,7 @@
10
10
  "then": {"required": ["plan_ref", "aspect_map_ref"]}
11
11
  }
12
12
  ],
13
- "required": ["schema_id", "run_id", "stage", "attempt_number", "stage_root", "prompt_path", "aliases", "next_command", "worker_prompt_markdown"],
13
+ "required": ["schema_id", "run_id", "stage", "attempt_number", "stage_root", "prompt_path", "aliases", "resolved_context", "preflight", "worker_prompt_markdown", "next_command"],
14
14
  "properties": {
15
15
  "schema_id": {"const": "dd-flow/stage-start-response@2"},
16
16
  "run_id": {"type": "string", "minLength": 1},
@@ -24,7 +24,9 @@
24
24
  "plan_ref": {"type": "string", "pattern": "^\\.memory-bank/protocol/[^/]+/plan\\.json$"},
25
25
  "aspect_map_ref": {"type": "string", "minLength": 1},
26
26
  "next_command": {"type": "string", "pattern": "^dd-flow stage finish "},
27
+ "preflight": {"type": "object", "required": ["git", "compatibility", "permissions", "session_binding"], "additionalProperties": true},
28
+ "worker_prompt_markdown": {"type": "string", "minLength": 1},
27
29
  "permission_probe": {"type": "object", "additionalProperties": true},
28
- "worker_prompt_markdown": {"type": "string", "minLength": 1}
30
+ "bootstrap": {"type": "boolean"}
29
31
  }
30
32
  }
@@ -84,9 +84,85 @@
84
84
  }
85
85
  }
86
86
  }
87
+ },
88
+ "engine": {
89
+ "type": ["object", "null"],
90
+ "additionalProperties": true,
91
+ "properties": {
92
+ "contexts": { "$ref": "#/definitions/compatibilityContexts" }
93
+ }
87
94
  }
88
95
  },
89
96
  "definitions": {
97
+ "compatibilityContexts": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": ["project_current", "upgrade_target", "effective_execution"],
101
+ "properties": {
102
+ "project_current": { "$ref": "#/definitions/projectCurrentContext" },
103
+ "upgrade_target": {
104
+ "anyOf": [
105
+ { "type": "null" },
106
+ { "$ref": "#/definitions/upgradeTargetContext" }
107
+ ]
108
+ },
109
+ "effective_execution": { "$ref": "#/definitions/effectiveExecutionContext" }
110
+ }
111
+ },
112
+ "projectCurrentContext": {
113
+ "type": "object",
114
+ "additionalProperties": true,
115
+ "required": ["name", "canon", "memory_bank_version", "package_name", "required_engine_range", "resolution", "engine_version", "diagnostics"],
116
+ "properties": {
117
+ "name": { "const": "project_current" },
118
+ "canon": { "type": "object", "additionalProperties": true },
119
+ "memory_bank_version": { "type": ["string", "null"] },
120
+ "package_name": { "type": "string", "minLength": 1 },
121
+ "required_engine_range": { "type": ["string", "null"] },
122
+ "recommended_engine_version": { "type": ["string", "null"] },
123
+ "resolution": { "type": "string", "minLength": 1 },
124
+ "engine_version": { "type": ["string", "null"] },
125
+ "diagnostics": { "type": "array", "items": { "type": "string" } }
126
+ }
127
+ },
128
+ "upgradeTargetContext": {
129
+ "type": "object",
130
+ "additionalProperties": true,
131
+ "required": ["name", "canon", "memory_bank_version", "package_name", "required_engine_range", "resolution", "engine_version", "diagnostics"],
132
+ "properties": {
133
+ "name": { "const": "upgrade_target" },
134
+ "canon": {
135
+ "type": "object",
136
+ "additionalProperties": true,
137
+ "required": ["root", "version", "commit", "compatibility_sha256"],
138
+ "properties": {
139
+ "root": { "type": "string", "minLength": 1 },
140
+ "version": { "type": "string", "minLength": 1 },
141
+ "commit": { "type": "string", "minLength": 1 },
142
+ "compatibility_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
143
+ }
144
+ },
145
+ "memory_bank_version": { "type": ["string", "null"] },
146
+ "package_name": { "type": "string", "minLength": 1 },
147
+ "required_engine_range": { "type": ["string", "null"] },
148
+ "recommended_engine_version": { "type": ["string", "null"] },
149
+ "resolution": { "type": "string", "minLength": 1 },
150
+ "engine_version": { "type": ["string", "null"] },
151
+ "diagnostics": { "type": "array", "items": { "type": "string" } }
152
+ }
153
+ },
154
+ "effectiveExecutionContext": {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": ["operation", "mode", "package_name", "engine_version", "reason"],
158
+ "properties": {
159
+ "operation": { "type": "string", "minLength": 1 },
160
+ "mode": { "type": "string", "minLength": 1 },
161
+ "package_name": { "type": "string", "minLength": 1 },
162
+ "engine_version": { "type": ["string", "null"] },
163
+ "reason": { "type": "string", "minLength": 1 }
164
+ }
165
+ },
90
166
  "cliCompatibility": {
91
167
  "type": "object",
92
168
  "additionalProperties": true,
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "dd-flow/protocol-plan@6",
4
+ "title": "Semantic protocol implementation plan",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_id", "plan_id", "protocol_id", "revision", "title", "summary", "source_refs", "goal", "assessment", "decisions", "document_updates", "checks", "items", "acceptance"],
8
+ "properties": {
9
+ "schema_id": {"const": "dd-flow/protocol-plan@6"},
10
+ "plan_id": {"type": "string", "pattern": "^PLAN-[A-Za-z0-9][A-Za-z0-9._-]*$"},
11
+ "protocol_id": {"type": "string", "pattern": "^PRT-[A-Za-z0-9][A-Za-z0-9._-]*$"},
12
+ "revision": {"type": "integer", "minimum": 1},
13
+ "title": {"type": "string", "minLength": 1},
14
+ "summary": {"type": "string", "minLength": 1},
15
+ "source_refs": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/sourceRef"}},
16
+ "goal": {"type": "object", "additionalProperties": false, "required": ["outcome", "constraints", "non_goals"], "properties": {"outcome": {"type": "string", "minLength": 1}, "constraints": {"$ref": "#/$defs/strings"}, "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}}}},
17
+ "assessment": {"type": "object", "additionalProperties": false, "required": ["scope_breadth", "solution_novelty", "solution_uncertainty", "failure_impact", "selected_depth", "depth_trigger"], "properties": {"scope_breadth": {"$ref": "#/$defs/axis"}, "solution_novelty": {"$ref": "#/$defs/axis"}, "solution_uncertainty": {"$ref": "#/$defs/axis"}, "failure_impact": {"$ref": "#/$defs/axis"}, "selected_depth": {"enum": ["compact_plan", "full_plan"]}, "depth_trigger": {"type": "string", "minLength": 1}}},
18
+ "decisions": {"type": "array", "items": {"$ref": "#/$defs/decision"}},
19
+ "document_updates": {"type": "array", "items": {"$ref": "#/$defs/documentUpdate"}},
20
+ "checks": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/check"}},
21
+ "items": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/item"}},
22
+ "acceptance": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/acceptance"}}
23
+ },
24
+ "$defs": {
25
+ "strings": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
26
+ "sourceRef": {"type": "object", "additionalProperties": false, "required": ["kind", "id", "path", "requirement_ids"], "properties": {"kind": {"type": "string", "minLength": 1}, "id": {"type": "string", "minLength": 1}, "path": {"type": "string", "minLength": 1}, "requirement_ids": {"$ref": "#/$defs/strings"}, "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}}},
27
+ "axis": {"type": "object", "additionalProperties": false, "required": ["level", "surfaces", "reason"], "properties": {"level": {"type": "string", "minLength": 1}, "surfaces": {"$ref": "#/$defs/strings"}, "reason": {"type": "string", "minLength": 1}}},
28
+ "decision": {"type": "object", "additionalProperties": false, "required": ["id", "decision", "rationale", "affected_surfaces"], "properties": {"id": {"type": "string", "minLength": 1}, "decision": {"type": "string", "minLength": 1}, "rationale": {"type": "string", "minLength": 1}, "affected_surfaces": {"$ref": "#/$defs/strings"}, "durable_ref": {"type": "string", "minLength": 1}}},
29
+ "documentUpdate": {"type": "object", "additionalProperties": false, "required": ["path", "action", "owner", "reason"], "properties": {"path": {"type": "string", "minLength": 1}, "action": {"enum": ["create", "update"]}, "owner": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}}},
30
+ "spine": {"type": "object", "additionalProperties": false, "required": ["user_outcome", "component_responsibility", "must_preserve", "non_goals", "acceptance_contribution"], "properties": {"user_outcome": {"type": "string", "minLength": 1}, "component_responsibility": {"type": "string", "minLength": 1}, "must_preserve": {"$ref": "#/$defs/strings"}, "non_goals": {"type": "array", "items": {"type": "string", "minLength": 1}}, "acceptance_contribution": {"type": "string", "minLength": 1}}},
31
+ "execution": {"type": "object", "additionalProperties": false, "required": ["required_read", "discovery_boundary", "planned_write_areas", "stop_conditions"], "properties": {"required_read": {"$ref": "#/$defs/strings", "description": "Mandatory starting sources. This is not a read allowlist."}, "discovery_boundary": {"$ref": "#/$defs/strings", "description": "Likely discovery areas. A worker may inspect other project-local sources when necessary."}, "planned_write_areas": {"type": "array", "items": {"type": "string", "minLength": 1}, "description": "Optional file or directory hints used only to coordinate concurrent Works. They never grant or deny write permission."}, "stop_conditions": {"$ref": "#/$defs/strings", "description": "Semantic contradictions or external blockers that require the worker to stop."}}},
32
+ "check": {"type": "object", "additionalProperties": false, "required": ["id", "command", "purpose", "run_at", "availability"], "properties": {"id": {"type": "string", "pattern": "^CHK-[A-Za-z0-9-]+$"}, "command": {"type": "string", "minLength": 1}, "purpose": {"type": "string", "minLength": 1}, "run_at": {"enum": ["work", "code", "readiness", "merge", "release", "external"]}, "availability": {"enum": ["available", "planned"]}, "provided_by": {"type": "string", "pattern": "^P[0-9]+$"}, "definition": {"type": "string", "minLength": 1}, "required_artifacts": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}, "allOf": [{"if": {"properties": {"availability": {"const": "planned"}}, "required": ["availability"]}, "then": {"required": ["provided_by", "definition"], "properties": {"command": {"pattern": "^@check/"}}}}]},
33
+ "verification": {"type": "object", "additionalProperties": false, "required": ["check_refs"], "properties": {"check_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^CHK-[A-Za-z0-9-]+$"}}}},
34
+ "item": {"type": "object", "additionalProperties": false, "required": ["id", "title", "summary", "details", "depends_on", "requirement_refs", "semantic_spine", "execution_context", "verification"], "properties": {"id": {"type": "string", "pattern": "^P[0-9]+$"}, "title": {"type": "string", "minLength": 1}, "summary": {"type": "string", "minLength": 1}, "details": {"type": "string", "minLength": 1}, "depends_on": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^P[0-9]+$"}}, "requirement_refs": {"$ref": "#/$defs/strings"}, "semantic_spine": {"$ref": "#/$defs/spine"}, "execution_context": {"$ref": "#/$defs/execution"}, "verification": {"$ref": "#/$defs/verification"}}},
35
+ "acceptance": {"type": "object", "additionalProperties": false, "required": ["criterion_id", "plan_item_ids", "changed_surfaces", "path", "environment", "fixtures", "cleanup", "check_refs", "expected_evidence", "proof_limits", "gate"], "properties": {"criterion_id": {"type": "string", "pattern": "^AC-[0-9]+$"}, "plan_item_ids": {"type": "array", "minItems": 1, "items": {"type": "string", "pattern": "^P[0-9]+$"}}, "changed_surfaces": {"$ref": "#/$defs/strings"}, "path": {"type": "string", "minLength": 1}, "environment": {"type": "string", "minLength": 1}, "fixtures": {"type": "array", "items": {"type": "string", "minLength": 1}}, "cleanup": {"type": "string", "minLength": 1}, "check_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "pattern": "^CHK-[A-Za-z0-9-]+$"}}, "expected_evidence": {"$ref": "#/$defs/strings"}, "proof_limits": {"$ref": "#/$defs/strings"}, "gate": {"enum": ["work", "code", "readiness", "merge", "release", "external"]}}}
36
+ }
37
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "dd-flow/vnext-protocolize-result@3",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["schema_id", "outcome", "scope_sizing_verdict", "delivery", "obligation_ownership", "durable_links", "feature"],
7
+ "properties": {
8
+ "schema_id": {"const": "dd-flow/vnext-protocolize-result@3"},
9
+ "outcome": {"const": "protocolized"},
10
+ "scope_sizing_verdict": {"enum": ["single_executable_protocol", "single_compact_protocol", "specification_with_slices_required"]},
11
+ "delivery": {"$ref": "#/$defs/delivery"},
12
+ "obligation_ownership": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/ownership"}},
13
+ "obligation_amendments": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/amendment"}},
14
+ "durable_links": {"$ref": "#/$defs/durableLinks"},
15
+ "feature": {"$ref": "#/$defs/feature"}
16
+ },
17
+ "$defs": {
18
+ "strings": {"type": "array", "items": {"type": "string", "minLength": 1}},
19
+ "ownership": {"type": "object", "additionalProperties": false, "required": ["obligation_id", "member_keys"], "properties": {"obligation_id": {"type": "string", "pattern": "^(R|AC)-[0-9]{3,}$"}, "member_keys": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}},
20
+ "amendment": {"type": "object", "additionalProperties": false, "required": ["target_id", "replacement", "reason", "hitl_ref"], "properties": {"target_id": {"type": "string", "pattern": "^(R|AC)-[0-9]{3,}$"}, "replacement": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}, "hitl_ref": {"type": "string", "pattern": "^HITL-[A-Za-z0-9._-]+$"}}},
21
+ "primaryAcceptance": {"type": "object", "additionalProperties": false, "required": ["actor", "initial_state", "action", "expected_result", "verification", "proof_limits"], "properties": {"actor": {"type": "string", "minLength": 1}, "initial_state": {"type": "string"}, "action": {"type": "string", "minLength": 1}, "expected_result": {"type": "string", "minLength": 1}, "verification": {"type": "string", "minLength": 1}, "proof_limits": {"type": "string"}}},
22
+ "member": {"type": "object", "additionalProperties": false, "required": ["key", "title", "slug", "goal", "role", "in_scope", "out_of_scope", "primary_acceptance", "blocked_by"], "properties": {"key": {"type": "string", "minLength": 1}, "title": {"type": "string", "minLength": 1}, "slug": {"type": "string", "minLength": 1}, "goal": {"type": "string", "minLength": 1}, "role": {"type": "string", "minLength": 1}, "in_scope": {"$ref": "#/$defs/strings"}, "out_of_scope": {"type": "array", "items": {"type": "string", "minLength": 1}}, "primary_acceptance": {"$ref": "#/$defs/primaryAcceptance"}, "blocked_by": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}},
23
+ "mode": {"type": "object", "additionalProperties": false, "required": ["mode", "graph", "relative_duration", "reason"], "properties": {"mode": {"enum": ["shared_serial_bundle", "isolated_parallel", "isolated_dependency_waves"]}, "graph": {"type": "string", "minLength": 1}, "relative_duration": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}}},
24
+ "pset": {"type": "object", "additionalProperties": false, "required": ["selected", "workspace_owner", "confirmation_gate", "dependency_graph", "feasible_modes", "excluded_modes"], "properties": {"selected": {"enum": ["shared_serial_bundle", "isolated_parallel", "isolated_dependency_waves"]}, "workspace_owner": {"type": "string", "minLength": 1}, "confirmation_gate": {"const": "before_first_code"}, "dependency_graph": {"$ref": "#/$defs/strings"}, "feasible_modes": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/mode"}}, "excluded_modes": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["mode", "reason"], "properties": {"mode": {"enum": ["shared_serial_bundle", "isolated_parallel", "isolated_dependency_waves"]}, "reason": {"type": "string", "minLength": 1}}}}}},
25
+ "delivery": {"type": "object", "additionalProperties": false, "required": ["kind", "title", "slug", "members"], "properties": {"kind": {"enum": ["single_protocol", "protocol_set"]}, "title": {"type": "string", "minLength": 1}, "slug": {"type": "string", "minLength": 1}, "decomposition_rationale": {"type": "string", "minLength": 1}, "pset": {"$ref": "#/$defs/pset"}, "members": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/member"}}}},
26
+ "durableLinks": {"type": "object", "additionalProperties": false, "required": ["preserve_raw_intake", "related_epics", "related_features", "related_specs", "related_adrs", "related_scenarios"], "properties": {"preserve_raw_intake": {"type": "boolean"}, "related_epics": {"$ref": "#/$defs/strings"}, "related_features": {"$ref": "#/$defs/strings"}, "related_specs": {"$ref": "#/$defs/strings"}, "related_adrs": {"$ref": "#/$defs/strings"}, "related_scenarios": {"$ref": "#/$defs/strings"}}},
27
+ "feature": {"type": "object", "additionalProperties": false, "required": ["action"], "properties": {"action": {"enum": ["create", "link", "update", "not_applicable"]}, "epic_path": {"type": "string"}, "title": {"type": "string"}, "slug": {"type": "string"}, "summary": {"type": "string"}, "reason": {"type": "string"}}}
28
+ }
29
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "dd-flow/specify@1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["schema_id", "summary", "requirements", "acceptance_criteria", "sections"],
7
+ "properties": {
8
+ "schema_id": {"const": "dd-flow/specify@1"},
9
+ "summary": {"type": "string", "minLength": 1},
10
+ "requirements": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/requirement"}},
11
+ "acceptance_criteria": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/acceptance"}},
12
+ "sections": {"$ref": "#/$defs/sections"}
13
+ },
14
+ "$defs": {
15
+ "requirement": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["id", "statement"],
19
+ "properties": {
20
+ "id": {"type": "string", "pattern": "^R-[0-9]{3,}$"},
21
+ "statement": {"type": "string", "minLength": 1}
22
+ }
23
+ },
24
+ "acceptance": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["id", "statement"],
28
+ "properties": {
29
+ "id": {"type": "string", "pattern": "^AC-[0-9]{3,}$"},
30
+ "statement": {"type": "string", "minLength": 1}
31
+ }
32
+ },
33
+ "sections": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["problem_and_scope", "acceptance_and_verification", "gaps_defaults_and_project_facts", "assessment_and_protocolize_handoff"],
37
+ "properties": {
38
+ "problem_and_scope": {"type": "string", "minLength": 1},
39
+ "acceptance_and_verification": {"type": "string", "minLength": 1},
40
+ "gaps_defaults_and_project_facts": {"type": "string", "minLength": 1},
41
+ "assessment_and_protocolize_handoff": {"type": "string", "minLength": 1}
42
+ }
43
+ }
44
+ }
45
+ }
@@ -22,7 +22,7 @@ export function getProtocolBranchContext(context, input) {
22
22
  WHERE project_id = ?`, [resolved.project.id])
23
23
  .map((row) => [row.protocol_id, row]));
24
24
  const sessions = context.db.all(`SELECT protocol_id, worker_id, flow_kind, status, current_stage, next_action
25
- FROM flow_sessions
25
+ FROM sessions
26
26
  WHERE project_id = ? AND status IN ('pending', 'active', 'waiting_user', 'blocked', 'stopping')`, [resolved.project.id]);
27
27
  const sessionsByProtocol = new Map();
28
28
  for (const session of sessions) {