@deksden-com/dd-flow-cli 0.7.0 → 0.8.0-beta.135
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.
- package/CHANGELOG.md +630 -0
- package/README.md +6 -1
- package/dist/build-info.json +10 -10
- package/dist/cli/help.js +88 -10
- package/dist/cli/run-cli.js +525 -28
- package/dist/domain/stage-catalog.js +22 -0
- package/dist/schemas/code-review-decision.schema.json +26 -0
- package/dist/schemas/code-review-result.schema.json +14 -0
- package/dist/schemas/code-verification.schema.json +14 -0
- package/dist/schemas/code-work-batch.schema.json +24 -0
- package/dist/schemas/code-work-result.schema.json +16 -0
- package/dist/schemas/flow-contract.schema.json +6 -3
- package/dist/schemas/flow-run.schema.json +16 -123
- package/dist/schemas/plan-aspect-map.schema.json +22 -0
- package/dist/schemas/plan-review-decision.schema.json +14 -0
- package/dist/schemas/plan-review-result.schema.json +42 -0
- package/dist/schemas/protocol-plan.schema.json +15 -182
- package/dist/schemas/stage-finish-input.schema.json +16 -2
- package/dist/schemas/stage-report.schema.json +8 -7
- package/dist/schemas/vnext-protocol-plan.schema.json +37 -0
- package/dist/schemas/vnext-protocolize-result.schema.json +29 -0
- package/dist/schemas/vnext-specify.schema.json +45 -0
- package/dist/services/branch-context.js +1 -1
- package/dist/services/cleanup.js +8 -8
- package/dist/services/cli-operation-classifier.js +10 -2
- package/dist/services/code-checks.js +244 -0
- package/dist/services/config.js +7 -1
- package/dist/services/dashboard.js +12 -12
- package/dist/services/engines.js +1 -1
- package/dist/services/eval-snapshots.js +404 -0
- package/dist/services/hooks.js +774 -18
- package/dist/services/ids.js +16 -6
- package/dist/services/lanes.js +1 -1
- package/dist/services/merge-queue.js +5 -5
- package/dist/services/merge-worker.js +2 -2
- package/dist/services/migrations.js +2 -2
- package/dist/services/plan-runtime.js +1 -1
- package/dist/services/projects.js +4 -4
- package/dist/services/prompts.js +1 -1
- package/dist/services/protocols.js +8 -8
- package/dist/services/run-projection.js +49 -13
- package/dist/services/runs.js +504 -51
- package/dist/services/schema-validation.js +21 -3
- package/dist/services/sessions.js +51 -12
- package/dist/services/stage-blocker.js +57 -0
- package/dist/services/stage-context.js +90 -0
- package/dist/services/stage-lifecycle.js +198 -75
- package/dist/services/stage-pause.js +175 -0
- package/dist/services/stage-report-renderer.js +65 -0
- package/dist/services/usage.js +526 -18
- package/dist/services/vnext-code-review.js +308 -0
- package/dist/services/vnext-code.js +616 -0
- package/dist/services/vnext-contracts.js +1 -0
- package/dist/services/vnext-execution-profile.js +27 -0
- package/dist/services/vnext-fanout.js +79 -0
- package/dist/services/vnext-plan-review.js +499 -0
- package/dist/services/vnext-plan.js +576 -0
- package/dist/services/vnext-protocolize.js +542 -0
- package/dist/services/vnext-specify.js +595 -0
- package/dist/services/vnext-workspace-policy.js +87 -0
- package/dist/services/work-registry.js +499 -0
- package/dist/services/worktrees.js +58 -37
- package/dist/storage/database.js +263 -34
- package/dist/storage/paths.js +47 -1
- 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
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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", "write_scope", "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}}, "write_scope": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}, "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", "
|
|
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@
|
|
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@
|
|
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"
|
|
16
|
-
"artifacts": {"type": "object", "required": ["json", "markdown", "html"
|
|
17
|
-
"validation": {"type": "object", "required": ["
|
|
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
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "dd-flow/protocol-plan@5",
|
|
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@5"},
|
|
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", "write_scope", "stop_conditions"], "properties": {"required_read": {"$ref": "#/$defs/strings"}, "discovery_boundary": {"$ref": "#/$defs/strings"}, "write_scope": {"$ref": "#/$defs/strings"}, "stop_conditions": {"$ref": "#/$defs/strings"}}},
|
|
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
|
|
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) {
|
package/dist/services/cleanup.js
CHANGED
|
@@ -68,7 +68,7 @@ export function cleanupScan(context, input) {
|
|
|
68
68
|
action: { kind: "cancel_queue_job", project_id: project.id, protocol_id: job.protocol_id }
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
const staleSessions = context.db.all(`SELECT session_id, protocol_id, workspace_path FROM
|
|
71
|
+
const staleSessions = context.db.all(`SELECT session_id, protocol_id, workspace_path FROM sessions
|
|
72
72
|
WHERE project_id = ? AND status IN ('pending', 'active', 'waiting_user', 'blocked', 'stopping')
|
|
73
73
|
ORDER BY updated_at ASC, session_id ASC`, [project.id]);
|
|
74
74
|
for (const session of staleSessions) {
|
|
@@ -87,7 +87,7 @@ export function cleanupScan(context, input) {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
const staleRuns = context.db.all(`SELECT id, runtime_path, run_dir, workspace_root FROM
|
|
90
|
+
const staleRuns = context.db.all(`SELECT id, runtime_path, run_dir, workspace_root FROM runs
|
|
91
91
|
WHERE project_id = ? AND status = 'running'
|
|
92
92
|
ORDER BY updated_at ASC, id ASC`, [project.id]);
|
|
93
93
|
for (const run of staleRuns) {
|
|
@@ -306,7 +306,7 @@ function applyAction(context, action, reason, force, now) {
|
|
|
306
306
|
return { kind: action.kind, changed: true, protocol_id: action.protocol_id };
|
|
307
307
|
}
|
|
308
308
|
if (action.kind === "close_flow_session" && action.session_id) {
|
|
309
|
-
const result = context.db.run(`UPDATE
|
|
309
|
+
const result = context.db.run(`UPDATE sessions SET status = 'stopped', stop_reason = ?, updated_at = ?, stopped_at = ?
|
|
310
310
|
WHERE project_id = ? AND session_id = ? AND status IN ('pending', 'active', 'waiting_user', 'blocked', 'stopping')`, [reason, now, now, action.project_id, action.session_id]);
|
|
311
311
|
if (result.changes !== 1) {
|
|
312
312
|
return { kind: action.kind, changed: false, skipped: true, reason: "already_stopped", session_id: action.session_id };
|
|
@@ -321,13 +321,13 @@ function applyAction(context, action, reason, force, now) {
|
|
|
321
321
|
return { kind: action.kind, changed: true, session_id: action.session_id };
|
|
322
322
|
}
|
|
323
323
|
if (action.kind === "discard_stale_run" && action.run_id) {
|
|
324
|
-
const run = context.db.get("SELECT status, runtime_path, run_dir, workspace_root, index_json FROM
|
|
324
|
+
const run = context.db.get("SELECT status, runtime_path, run_dir, workspace_root, index_json FROM runs WHERE project_id = ? AND id = ?", [action.project_id, action.run_id]);
|
|
325
325
|
if (!run) {
|
|
326
326
|
return { kind: action.kind, changed: false, skipped: true, reason: "run_not_found", run_id: action.run_id };
|
|
327
327
|
}
|
|
328
328
|
if (run.status === "discarded") {
|
|
329
329
|
const index = discardedRunIndex(run.index_json, reason, now);
|
|
330
|
-
context.db.run("UPDATE
|
|
330
|
+
context.db.run("UPDATE runs SET verdict = 'discarded', next_action = ?, index_json = ?, updated_at = ?, completed_at = COALESCE(completed_at, ?) WHERE project_id = ? AND id = ?", [reason, JSON.stringify(index), now, now, action.project_id, action.run_id]);
|
|
331
331
|
if (fs.existsSync(run.runtime_path))
|
|
332
332
|
fs.writeFileSync(run.runtime_path, `${JSON.stringify(index, null, 2)}\n`);
|
|
333
333
|
return { kind: action.kind, changed: true, run_id: action.run_id };
|
|
@@ -339,11 +339,11 @@ function applyAction(context, action, reason, force, now) {
|
|
|
339
339
|
return { kind: action.kind, changed: false, skipped: true, reason: "runtime_or_workspace_reappeared", run_id: action.run_id };
|
|
340
340
|
}
|
|
341
341
|
const index = discardedRunIndex(run.index_json, reason, now);
|
|
342
|
-
context.db.run(`UPDATE
|
|
342
|
+
context.db.run(`UPDATE runs SET status = 'discarded', verdict = 'discarded', next_action = ?, index_json = ?, updated_at = ?, completed_at = ?
|
|
343
343
|
WHERE project_id = ? AND id = ? AND status = 'running'`, [reason, JSON.stringify(index), now, now, action.project_id, action.run_id]);
|
|
344
344
|
fs.mkdirSync(run.run_dir, { recursive: true });
|
|
345
345
|
fs.writeFileSync(run.runtime_path, `${JSON.stringify(index, null, 2)}\n`);
|
|
346
|
-
context.db.run(`UPDATE
|
|
346
|
+
context.db.run(`UPDATE sessions SET status = 'stopped', stop_reason = ?, updated_at = ?, stopped_at = ?
|
|
347
347
|
WHERE project_id = ? AND run_id = ? AND status IN ('pending', 'active', 'waiting_user', 'blocked', 'stopping')`, [reason, now, now, action.project_id, action.run_id]);
|
|
348
348
|
context.db.run("UPDATE flow_session_segments SET ended_at = ? WHERE project_id = ? AND run_id = ? AND ended_at IS NULL", [now, action.project_id, action.run_id]);
|
|
349
349
|
appendAudit(context, {
|
|
@@ -398,7 +398,7 @@ function applyAction(context, action, reason, force, now) {
|
|
|
398
398
|
}
|
|
399
399
|
function discardedRunIndex(indexJson, reason, now) {
|
|
400
400
|
const index = JSON.parse(indexJson);
|
|
401
|
-
index.schema_id = "dd-flow/flow-run@
|
|
401
|
+
index.schema_id = "dd-flow/flow-run@3";
|
|
402
402
|
index.status = "discarded";
|
|
403
403
|
index.verdict = "discarded";
|
|
404
404
|
index.next_action = reason;
|
|
@@ -70,7 +70,7 @@ function isUpgradeAllowlisted(args) {
|
|
|
70
70
|
return true;
|
|
71
71
|
if (family === "run" && command === "start")
|
|
72
72
|
return optionValue(args, "flow-kind") === "mb-upgrade";
|
|
73
|
-
if (family === "stage" && ["start", "finish"].includes(command ?? ""))
|
|
73
|
+
if (family === "stage" && ["start", "pause", "resume", "finish"].includes(command ?? ""))
|
|
74
74
|
return hasRunBinding(args);
|
|
75
75
|
if (family === "session" && ["status", "register", "stop", "usage"].includes(command ?? ""))
|
|
76
76
|
return hasRunBinding(args);
|
|
@@ -101,7 +101,15 @@ function isRouterNative(args) {
|
|
|
101
101
|
return true;
|
|
102
102
|
if (["engine", "version", "schema"].includes(first))
|
|
103
103
|
return true;
|
|
104
|
-
return first === "codex" && args[1] === "hook" && args[2] === "handle"
|
|
104
|
+
return (first === "codex" && args[1] === "hook" && args[2] === "handle")
|
|
105
|
+
|| (first === "zcode" && args[1] === "event" && args[2] === "handle")
|
|
106
|
+
|| (first === "zcode" && args[1] === "usage" && args[2] === "ingest")
|
|
107
|
+
|| (first === "grok" && args[1] === "event" && args[2] === "handle")
|
|
108
|
+
|| (first === "grok" && args[1] === "usage" && args[2] === "ingest")
|
|
109
|
+
|| (first === "opencode" && args[1] === "event" && args[2] === "handle")
|
|
110
|
+
|| (first === "opencode" && args[1] === "usage" && args[2] === "ingest")
|
|
111
|
+
|| (first === "agy" && args[1] === "event" && args[2] === "handle")
|
|
112
|
+
|| (first === "agy" && args[1] === "usage" && args[2] === "ingest");
|
|
105
113
|
}
|
|
106
114
|
function isReadOnlyDiagnostic(family, command, action) {
|
|
107
115
|
if (!family)
|