@abelxiaoxing/cadence 1.4.0 → 1.5.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 (66) hide show
  1. package/README.md +130 -8
  2. package/agents/design-explorer.md +17 -11
  3. package/agents/diagnosis-worker.md +9 -1
  4. package/agents/implementation-worker.md +3 -1
  5. package/config/plan-draft.example.json +122 -0
  6. package/config/plan-draft.multiple-tasks.example.json +345 -0
  7. package/config/plan-draft.quick.example.json +78 -0
  8. package/package.json +10 -4
  9. package/prompts/abel-design.md +101 -44
  10. package/prompts/abel-implement.md +9 -0
  11. package/src/activity-contracts.ts +82 -0
  12. package/src/candidate-artifact.ts +143 -0
  13. package/src/candidate-patch.ts +31 -11
  14. package/src/candidate-workspace.ts +74 -0
  15. package/src/change-contract-schema.ts +191 -0
  16. package/src/change-contract.ts +5 -0
  17. package/src/change-verification.ts +920 -0
  18. package/src/child-budget.ts +58 -0
  19. package/src/child-model.ts +142 -0
  20. package/src/child-session.ts +289 -326
  21. package/src/contracts.ts +200 -76
  22. package/src/delivery-compiler.ts +105 -120
  23. package/src/delivery-revision.ts +42 -0
  24. package/src/design-control.ts +113 -4
  25. package/src/design-diagnostics.ts +150 -0
  26. package/src/durable-contracts.ts +213 -0
  27. package/src/durable-workflow.ts +148 -3570
  28. package/src/evidence-draft.ts +122 -0
  29. package/src/execution-profile.ts +38 -0
  30. package/src/implement-graph.ts +3 -0
  31. package/src/implement-plan.ts +70 -0
  32. package/src/index.ts +59 -522
  33. package/src/isolation-backend.ts +62 -40
  34. package/src/model-source.ts +22 -0
  35. package/src/operator-cli-entry.mjs +24 -0
  36. package/src/operator-cli.mjs +1421 -0
  37. package/src/operator-tools.ts +249 -0
  38. package/src/package-candidate.ts +227 -0
  39. package/src/package-verification.ts +86 -8
  40. package/src/package-workflow.ts +291 -0
  41. package/src/packet-runtime.ts +27 -48
  42. package/src/parent-provider.ts +86 -198
  43. package/src/phase-execution.ts +2248 -0
  44. package/src/pi-adapter.ts +19 -0
  45. package/src/plan-draft-summary.ts +149 -0
  46. package/src/plan-draft.ts +493 -0
  47. package/src/single-task-draft.ts +142 -0
  48. package/src/subagent-activity.ts +32 -66
  49. package/src/submit-tool.ts +20 -59
  50. package/src/transport-budget.ts +52 -0
  51. package/src/verification-capability.ts +5 -3
  52. package/src/verification-diagnostics.ts +76 -0
  53. package/src/verification-environment-io.ts +280 -0
  54. package/src/verification-environment.ts +56 -154
  55. package/src/verification-scan.ts +64 -0
  56. package/src/worker-broker.ts +39 -57
  57. package/src/workflow-policy.ts +14 -53
  58. package/src/workflow-recovery-policy.ts +95 -0
  59. package/src/workflow-scheduling.ts +105 -0
  60. package/src/workflow-state-machine.ts +105 -497
  61. package/src/workflow-status.ts +384 -0
  62. package/src/workspace-io-entry.mjs +19 -1
  63. package/src/workspace-io-worker.mjs +275 -50
  64. package/src/workspace-io.ts +6 -1
  65. package/src/empty-resource-loader.ts +0 -38
  66. package/src/parent-payload-bridge.ts +0 -523
@@ -0,0 +1,345 @@
1
+ {
2
+ "changeContract": {
3
+ "goal": "Fix integer addition and doubling through add",
4
+ "acceptance": [
5
+ {
6
+ "id": "integer-addition",
7
+ "statement": "add(2, 3) returns 5 and add(0, 0) remains 0",
8
+ "verification": {
9
+ "kind": "static-check",
10
+ "id": "add-acceptance",
11
+ "runner": {
12
+ "kind": "node",
13
+ "script": "test/add.test.mjs"
14
+ },
15
+ "args": [],
16
+ "classification": "expected-green"
17
+ }
18
+ },
19
+ {
20
+ "id": "integer-double",
21
+ "statement": "double(3) returns 6 via add(3, 3)",
22
+ "verification": {
23
+ "kind": "steps",
24
+ "id": "double-green",
25
+ "classification": "expected-green",
26
+ "steps": [
27
+ {
28
+ "kind": "static-check",
29
+ "id": "double-green-add",
30
+ "runner": {
31
+ "kind": "node",
32
+ "script": "test/add.test.mjs"
33
+ },
34
+ "args": [],
35
+ "classification": "expected-green"
36
+ },
37
+ {
38
+ "kind": "static-check",
39
+ "id": "double-green-own",
40
+ "runner": {
41
+ "kind": "node",
42
+ "script": "test/double.test.mjs"
43
+ },
44
+ "args": [],
45
+ "classification": "expected-green"
46
+ }
47
+ ]
48
+ }
49
+ }
50
+ ],
51
+ "constraints": [
52
+ {
53
+ "id": "no-dependencies",
54
+ "statement": "Keep the existing function signature and add no dependencies"
55
+ }
56
+ ],
57
+ "policy": {
58
+ "writeRoots": [
59
+ "src/add.mjs",
60
+ "test/add.test.mjs",
61
+ "src/double.mjs",
62
+ "test/double.test.mjs"
63
+ ],
64
+ "dependencies": [],
65
+ "verificationModes": ["behavior"]
66
+ }
67
+ },
68
+ "changeId": "fix-add-and-double",
69
+ "tasks": [
70
+ {
71
+ "taskId": "fix-add",
72
+ "dependsOn": [],
73
+ "objective": "Preserve the existing zero assertion; add a failing positive-integer assertion with [ADD:positive-integers], then fix addition",
74
+ "context": {
75
+ "agents": "No AGENTS.md in this example consumer; use the actual repository instructions when adapting",
76
+ "contract": "Gate A integer-addition acceptance; only src/add.mjs and test/add.test.mjs may change"
77
+ },
78
+ "roots": ["."],
79
+ "phases": {
80
+ "red": {
81
+ "write": ["test/add.test.mjs"],
82
+ "delete": [],
83
+ "verification": {
84
+ "use": "add-test",
85
+ "expectedFailure": "[ADD:positive-integers]"
86
+ }
87
+ },
88
+ "green": {
89
+ "write": ["src/add.mjs"],
90
+ "delete": [],
91
+ "verification": {
92
+ "use": "add-test"
93
+ }
94
+ }
95
+ },
96
+ "affectedVerification": {
97
+ "use": "add-test"
98
+ },
99
+ "repairVerification": {
100
+ "use": "add-test"
101
+ },
102
+ "scheduling": {
103
+ "conflicts": [],
104
+ "resources": []
105
+ },
106
+ "agents": {
107
+ "impact": "none"
108
+ },
109
+ "approvedDependencies": [],
110
+ "impactClosure": {
111
+ "changedSurfaces": ["none"],
112
+ "searchEvidence": [
113
+ "Example consumer: src/add.mjs exports add; test/add.test.mjs is its only caller and existing test"
114
+ ],
115
+ "relatedTests": [
116
+ {
117
+ "path": "test/add.test.mjs",
118
+ "evidence": "Existing add(0, 0) assertion passes; preserve it while adding the positive-integer regression"
119
+ }
120
+ ],
121
+ "affectedSuite": ["test/add.test.mjs"]
122
+ },
123
+ "read": ["package.json", "src/add.mjs", "test/add.test.mjs"]
124
+ },
125
+ {
126
+ "taskId": "fix-double",
127
+ "dependsOn": ["fix-add"],
128
+ "objective": "Keep double(0) passing; add the [DOUBLE:positive-integers] failure then use add(value, value)",
129
+ "context": {
130
+ "agents": "No AGENTS.md in this example consumer; use the actual repository instructions when adapting",
131
+ "contract": "Gate A integer-double acceptance; depends on corrected addition"
132
+ },
133
+ "roots": ["."],
134
+ "phases": {
135
+ "red": {
136
+ "write": ["test/double.test.mjs"],
137
+ "delete": [],
138
+ "verification": {
139
+ "kind": "steps",
140
+ "id": "double-red",
141
+ "classification": "expected-red",
142
+ "steps": [
143
+ {
144
+ "kind": "static-check",
145
+ "id": "double-red-add",
146
+ "runner": {
147
+ "kind": "node",
148
+ "script": "test/add.test.mjs"
149
+ },
150
+ "args": [],
151
+ "classification": "expected-green"
152
+ },
153
+ {
154
+ "kind": "static-check",
155
+ "id": "double-red-own",
156
+ "runner": {
157
+ "kind": "node",
158
+ "script": "test/double.test.mjs"
159
+ },
160
+ "args": [],
161
+ "classification": "expected-red",
162
+ "expectedFailure": "[DOUBLE:positive-integers]"
163
+ }
164
+ ]
165
+ }
166
+ },
167
+ "green": {
168
+ "write": ["src/double.mjs"],
169
+ "delete": [],
170
+ "verification": {
171
+ "kind": "steps",
172
+ "id": "double-green",
173
+ "classification": "expected-green",
174
+ "steps": [
175
+ {
176
+ "kind": "static-check",
177
+ "id": "double-green-add",
178
+ "runner": {
179
+ "kind": "node",
180
+ "script": "test/add.test.mjs"
181
+ },
182
+ "args": [],
183
+ "classification": "expected-green"
184
+ },
185
+ {
186
+ "kind": "static-check",
187
+ "id": "double-green-own",
188
+ "runner": {
189
+ "kind": "node",
190
+ "script": "test/double.test.mjs"
191
+ },
192
+ "args": [],
193
+ "classification": "expected-green"
194
+ }
195
+ ]
196
+ }
197
+ }
198
+ },
199
+ "affectedVerification": {
200
+ "kind": "steps",
201
+ "id": "double-affectedVerification",
202
+ "classification": "expected-green",
203
+ "steps": [
204
+ {
205
+ "kind": "static-check",
206
+ "id": "double-green-add-affectedVerification",
207
+ "runner": {
208
+ "kind": "node",
209
+ "script": "test/add.test.mjs"
210
+ },
211
+ "args": [],
212
+ "classification": "expected-green"
213
+ },
214
+ {
215
+ "kind": "static-check",
216
+ "id": "double-green-own-affectedVerification",
217
+ "runner": {
218
+ "kind": "node",
219
+ "script": "test/double.test.mjs"
220
+ },
221
+ "args": [],
222
+ "classification": "expected-green"
223
+ }
224
+ ]
225
+ },
226
+ "repairVerification": {
227
+ "kind": "steps",
228
+ "id": "double-repairVerification",
229
+ "classification": "expected-green",
230
+ "steps": [
231
+ {
232
+ "kind": "static-check",
233
+ "id": "double-green-add-repairVerification",
234
+ "runner": {
235
+ "kind": "node",
236
+ "script": "test/add.test.mjs"
237
+ },
238
+ "args": [],
239
+ "classification": "expected-green"
240
+ },
241
+ {
242
+ "kind": "static-check",
243
+ "id": "double-green-own-repairVerification",
244
+ "runner": {
245
+ "kind": "node",
246
+ "script": "test/double.test.mjs"
247
+ },
248
+ "args": [],
249
+ "classification": "expected-green"
250
+ }
251
+ ]
252
+ },
253
+ "scheduling": {
254
+ "conflicts": [],
255
+ "resources": []
256
+ },
257
+ "agents": {
258
+ "impact": "none"
259
+ },
260
+ "approvedDependencies": [],
261
+ "impactClosure": {
262
+ "changedSurfaces": ["none"],
263
+ "searchEvidence": [
264
+ "Example consumer: double imports add; each has an existing zero assertion; all.test.mjs imports both test files"
265
+ ],
266
+ "relatedTests": [
267
+ {
268
+ "path": "test/add.test.mjs",
269
+ "evidence": "Producer task owns the addition regression, checked before the double regression"
270
+ },
271
+ {
272
+ "path": "test/double.test.mjs",
273
+ "evidence": "Preserve the existing double(0) assertion while adding double(3)"
274
+ }
275
+ ],
276
+ "affectedSuite": ["test/add.test.mjs", "test/double.test.mjs"]
277
+ },
278
+ "read": [
279
+ "package.json",
280
+ "src/add.mjs",
281
+ "test/add.test.mjs",
282
+ "src/double.mjs",
283
+ "test/double.test.mjs"
284
+ ]
285
+ }
286
+ ],
287
+ "outputs": [
288
+ {
289
+ "id": "add-regression",
290
+ "path": "test/add.test.mjs",
291
+ "producer": {
292
+ "taskId": "fix-add",
293
+ "phase": "red"
294
+ },
295
+ "postcondition": "regular-file"
296
+ }
297
+ ],
298
+ "verification": {
299
+ "baseline": {
300
+ "fullSuite": {
301
+ "use": "full-suite"
302
+ }
303
+ },
304
+ "change": {
305
+ "fullSuite": {
306
+ "use": "full-suite"
307
+ },
308
+ "postApply": {
309
+ "use": "full-suite"
310
+ }
311
+ },
312
+ "artifactCorrection": {
313
+ "maxAttempts": 2
314
+ },
315
+ "repair": {
316
+ "maxAttempts": 1
317
+ }
318
+ },
319
+ "verificationDefinitions": {
320
+ "add-test": {
321
+ "kind": "static-check",
322
+ "runner": {
323
+ "kind": "node",
324
+ "script": "test/add.test.mjs"
325
+ },
326
+ "args": []
327
+ },
328
+ "full-suite": {
329
+ "kind": "static-check",
330
+ "runner": {
331
+ "kind": "node",
332
+ "script": "test/all.test.mjs"
333
+ },
334
+ "args": []
335
+ },
336
+ "double-test": {
337
+ "kind": "static-check",
338
+ "runner": {
339
+ "kind": "node",
340
+ "script": "test/double.test.mjs"
341
+ },
342
+ "args": []
343
+ }
344
+ }
345
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "changeId": "fix-integer-addition",
3
+ "changeContract": {
4
+ "goal": "Fix integer addition while preserving the existing zero case",
5
+ "acceptance": [
6
+ {
7
+ "id": "integer-addition",
8
+ "statement": "add(2, 3) returns 5 and add(0, 0) remains 0",
9
+ "verification": {
10
+ "kind": "static-check",
11
+ "id": "add-acceptance",
12
+ "runner": {
13
+ "kind": "node",
14
+ "script": "test/add.test.mjs"
15
+ },
16
+ "args": [],
17
+ "classification": "expected-green"
18
+ }
19
+ }
20
+ ],
21
+ "constraints": [
22
+ {
23
+ "id": "no-dependencies",
24
+ "statement": "Keep the existing function signature and add no dependencies"
25
+ }
26
+ ],
27
+ "policy": {
28
+ "writeRoots": ["src/add.mjs", "test/add.test.mjs"],
29
+ "dependencies": [],
30
+ "verificationModes": ["behavior"]
31
+ }
32
+ },
33
+ "singleTask": {
34
+ "taskId": "fix-add",
35
+ "objective": "Preserve the existing zero assertion; add a failing positive-integer assertion with [ADD:positive-integers], then fix addition",
36
+ "context": {
37
+ "agents": "No AGENTS.md in this example consumer; use the actual repository instructions when adapting",
38
+ "contract": "Gate A integer-addition acceptance; only src/add.mjs and test/add.test.mjs may change"
39
+ },
40
+ "roots": ["."],
41
+ "read": ["package.json", "src/add.mjs", "test/add.test.mjs"],
42
+ "impactClosure": {
43
+ "changedSurfaces": ["none"],
44
+ "searchEvidence": [
45
+ "Example consumer: src/add.mjs exports add; test/add.test.mjs is its only caller and existing test"
46
+ ],
47
+ "relatedTests": [
48
+ {
49
+ "path": "test/add.test.mjs",
50
+ "evidence": "Existing add(0, 0) assertion passes; preserve it while adding the positive-integer regression"
51
+ }
52
+ ],
53
+ "affectedSuite": ["test/add.test.mjs"]
54
+ },
55
+ "agents": {
56
+ "impact": "none"
57
+ },
58
+ "greenWrite": ["src/add.mjs"],
59
+ "redWrite": ["test/add.test.mjs"],
60
+ "expectedFailure": "[ADD:positive-integers]",
61
+ "verification": {
62
+ "kind": "static-check",
63
+ "runner": {
64
+ "kind": "node",
65
+ "script": "test/add.test.mjs"
66
+ },
67
+ "args": []
68
+ },
69
+ "fullSuite": {
70
+ "kind": "static-check",
71
+ "runner": {
72
+ "kind": "node",
73
+ "script": "test/add.test.mjs"
74
+ },
75
+ "args": []
76
+ }
77
+ }
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abelxiaoxing/cadence",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Four explicit Abel workflow prompts with stage-isolated design and diagnosis, durable resumable implementation, and three package-owned professional Agents.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,12 +46,17 @@
46
46
  "test:target": "vitest run",
47
47
  "check:agents": "node scripts/check-agents.mjs",
48
48
  "build:workspace-io": "bun scripts/build-workspace-io.mjs",
49
- "eval:workflow": "node --experimental-strip-types scripts/evaluate-workflow.mjs"
49
+ "eval:workflow": "node --experimental-strip-types scripts/evaluate-workflow.mjs",
50
+ "doctor": "node --experimental-strip-types src/operator-cli.mjs doctor",
51
+ "runs": "node --experimental-strip-types src/operator-cli.mjs runs",
52
+ "benchmark:verification": "node --experimental-strip-types scripts/benchmark-verification.mjs",
53
+ "eval:matrix": "node --experimental-strip-types scripts/evaluate-matrix.mjs"
50
54
  },
51
55
  "peerDependencies": {
52
56
  "@earendil-works/pi-coding-agent": "*",
53
57
  "@earendil-works/pi-tui": "*",
54
- "typebox": "*"
58
+ "typebox": "*",
59
+ "@earendil-works/pi-ai": "*"
55
60
  },
56
61
  "devDependencies": {
57
62
  "@biomejs/biome": "^2.4.16",
@@ -60,7 +65,8 @@
60
65
  "@types/node": "^22.15.3",
61
66
  "rumdl": "^0.2.10",
62
67
  "typescript": "^6.0.3",
63
- "vitest": "^4.1.8"
68
+ "vitest": "^4.1.8",
69
+ "@earendil-works/pi-ai": "0.84.3"
64
70
  },
65
71
  "repository": {
66
72
  "type": "git",