@chllming/wave-orchestration 0.7.1 → 0.7.3

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 (32) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +8 -8
  3. package/docs/plans/component-cutover-matrix.json +50 -3
  4. package/docs/plans/current-state.md +1 -1
  5. package/docs/plans/end-state-architecture.md +927 -0
  6. package/docs/plans/examples/wave-example-live-proof.md +1 -1
  7. package/docs/plans/migration.md +2 -2
  8. package/docs/plans/waves/wave-1.md +376 -0
  9. package/docs/plans/waves/wave-2.md +292 -0
  10. package/docs/plans/waves/wave-3.md +342 -0
  11. package/docs/plans/waves/wave-4.md +391 -0
  12. package/docs/plans/waves/wave-5.md +382 -0
  13. package/docs/plans/waves/wave-6.md +321 -0
  14. package/docs/reference/npmjs-trusted-publishing.md +2 -2
  15. package/docs/reference/sample-waves.md +4 -4
  16. package/package.json +1 -1
  17. package/releases/manifest.json +36 -0
  18. package/scripts/wave-orchestrator/agent-state.mjs +462 -35
  19. package/scripts/wave-orchestrator/artifact-schemas.mjs +81 -0
  20. package/scripts/wave-orchestrator/control-cli.mjs +7 -1
  21. package/scripts/wave-orchestrator/coordination.mjs +11 -10
  22. package/scripts/wave-orchestrator/human-input-workflow.mjs +289 -0
  23. package/scripts/wave-orchestrator/install.mjs +22 -0
  24. package/scripts/wave-orchestrator/launcher-derived-state.mjs +915 -0
  25. package/scripts/wave-orchestrator/launcher-gates.mjs +1061 -0
  26. package/scripts/wave-orchestrator/launcher-retry.mjs +873 -0
  27. package/scripts/wave-orchestrator/launcher-supervisor.mjs +704 -0
  28. package/scripts/wave-orchestrator/launcher.mjs +153 -2922
  29. package/scripts/wave-orchestrator/task-entity.mjs +557 -0
  30. package/scripts/wave-orchestrator/wave-files.mjs +11 -2
  31. package/scripts/wave-orchestrator/wave-state-reducer.mjs +566 -0
  32. package/wave.config.json +1 -1
@@ -0,0 +1,342 @@
1
+ # Wave 3 - Structured Result Envelopes and Retry Isolation
2
+
3
+ **Commit message**: `Arch: add role-aware result envelopes and isolate retry subsystem`
4
+
5
+ ## Component promotions
6
+
7
+ - executor-abstraction-and-prompt-transport: baseline-proved
8
+ - closure-sweep-and-role-gates: baseline-proved
9
+
10
+ ## Context7 defaults
11
+
12
+ - bundle: node-typescript
13
+ - query: "JSON schema validation, discriminated unions, and deterministic state machines in Node.js"
14
+
15
+ ## Agent A0: cont-QA
16
+
17
+ ### Role prompts
18
+
19
+ - docs/agents/wave-cont-qa-role.md
20
+
21
+ ### Executor
22
+
23
+ - id: codex
24
+ - model: gpt-5-codex
25
+ - codex.profile_name: review
26
+ - codex.search: true
27
+ - codex.json: true
28
+
29
+ ### Context7
30
+
31
+ - bundle: none
32
+
33
+ ### Prompt
34
+
35
+ ```text
36
+ Primary goal:
37
+ - Verify that result envelopes are role-aware and that the retry engine is fully deterministic from stored state.
38
+
39
+ Required context before coding:
40
+ - Read docs/plans/end-state-architecture.md (sections: Agent Result Envelope, Retry Engine).
41
+ - Read docs/reference/repository-guidance.md.
42
+
43
+ Specific expectations:
44
+ - confirm envelopes use common header + role-specific typed payloads, not one universal blob
45
+ - confirm gate engine prefers envelope when present, falls back to legacy adapter
46
+ - confirm retry engine is testable from stored state without launching anything
47
+ - confirm retry plan contract includes all six fields: why, what invalidated, what reusable, what stage, what executor changes, what human inputs block
48
+ - confirm executor adapters locate/read/validate agent-produced envelopes rather than building them from log tails
49
+ - do not PASS if any phase engine reads from log tails as primary input
50
+
51
+ File ownership (only touch these paths):
52
+ - docs/plans/waves/reviews/wave-3-cont-qa.md
53
+ ```
54
+
55
+ ## Agent A8: Integration Steward
56
+
57
+ ### Role prompts
58
+
59
+ - docs/agents/wave-integration-role.md
60
+
61
+ ### Executor
62
+
63
+ - id: claude
64
+ - model: claude-sonnet-4-6
65
+
66
+ ### Context7
67
+
68
+ - bundle: none
69
+
70
+ ### Capabilities
71
+
72
+ - integration
73
+ - docs-shared-plan
74
+
75
+ ### Prompt
76
+
77
+ ```text
78
+ Synthesize the result envelope and retry isolation changes.
79
+
80
+ Required context before coding:
81
+ - Read docs/plans/end-state-architecture.md.
82
+ - Read docs/reference/repository-guidance.md.
83
+ - Read docs/research/agent-context-sources.md.
84
+
85
+ Verify:
86
+ - envelope migration path is clean: legacy adapter synthesizes envelope from log markers during migration, gate engine always sees the same shape
87
+ - retry engine reads only from control-plane materialization and gate verdicts
88
+ - all role-specific envelope sections have clear validation rules
89
+ - no circular dependencies between retry engine and gate engine
90
+
91
+ File ownership (only touch these paths):
92
+ - .tmp/main-wave-launcher/integration/wave-3.md
93
+ - .tmp/main-wave-launcher/integration/wave-3.json
94
+ ```
95
+
96
+ ## Agent A9: Documentation Steward
97
+
98
+ ### Role prompts
99
+
100
+ - docs/agents/wave-documentation-role.md
101
+
102
+ ### Executor
103
+
104
+ - id: opencode
105
+ - opencode.files: docs/plans/end-state-architecture.md,docs/plans/current-state.md
106
+
107
+ ### Context7
108
+
109
+ - bundle: none
110
+
111
+ ### Prompt
112
+
113
+ ```text
114
+ Update shared plan docs to reflect result envelopes and retry isolation.
115
+
116
+ Required context before coding:
117
+ - Read docs/reference/repository-guidance.md.
118
+ - Read docs/research/agent-context-sources.md.
119
+
120
+ File ownership (only touch these paths):
121
+ - docs/plans/current-state.md
122
+ - docs/plans/master-plan.md
123
+ - docs/plans/migration.md
124
+ - docs/plans/wave-orchestrator.md
125
+ - docs/plans/component-cutover-matrix.md
126
+ - docs/plans/component-cutover-matrix.json
127
+ ```
128
+
129
+ ## Agent A1: Role-Aware Result Envelope
130
+
131
+ ### Executor
132
+
133
+ - profile: implement-fast
134
+ - model: gpt-5-codex
135
+ - codex.add_dirs: scripts,test
136
+ - fallbacks: claude, opencode
137
+
138
+ ### Context7
139
+
140
+ - bundle: node-typescript
141
+ - query: "TypeScript discriminated unions, JSON schema validation, zod or ajv schema patterns"
142
+
143
+ ### Components
144
+
145
+ - closure-sweep-and-role-gates
146
+ - executor-abstraction-and-prompt-transport
147
+
148
+ ### Exit contract
149
+
150
+ - completion: contract
151
+ - durability: none
152
+ - proof: unit
153
+ - doc-impact: owned
154
+
155
+ ### Deliverables
156
+
157
+ - scripts/wave-orchestrator/result-envelope.mjs
158
+ - test/wave-orchestrator/result-envelope.test.ts
159
+
160
+ ### Prompt
161
+
162
+ ```text
163
+ Implement role-aware structured result envelopes.
164
+
165
+ The envelope is NOT one universal blob. It uses a common header with role-specific typed optional payloads.
166
+
167
+ Common envelope header (all roles):
168
+ {
169
+ schemaVersion: 2,
170
+ agentId: string,
171
+ waveNumber: number,
172
+ attempt: number,
173
+ completedAt: ISO8601,
174
+ exitCode: number,
175
+ role: "implementation" | "integration" | "documentation" | "cont-qa" | "cont-eval" | "security" | "deploy",
176
+ proof: { state, completion, durability, proofLevel, detail },
177
+ deliverables: [{ path, exists, sha256 }],
178
+ proofArtifacts: [{ path, kind, exists, sha256, requiredFor }],
179
+ gaps: [{ kind, detail }],
180
+ unresolvedBlockers:[{ kind, detail, blocking }],
181
+ riskNotes: [string]
182
+ }
183
+
184
+ Role-specific payloads (typed optional sections):
185
+ implementation: { docDelta, components }
186
+ integration: { integrationState: { state, claims, conflicts, blockers, detail } }
187
+ documentation: { docClosure: { state, paths, detail } }
188
+ cont-qa: { verdict, gateClaims }
189
+ cont-eval: { evalState: { state, targets, benchmarks, regressions, targetIds, benchmarkIds, detail } }
190
+ security: { securityState: { state, findings, approvals, detail } }
191
+ deploy: { deployState: { state, environment, healthCheck, rolloutArtifact, detail } }
192
+
193
+ Implementation:
194
+ 1. Define the envelope schema with validation (result-envelope.mjs).
195
+ 2. Add buildEnvelopeFromLegacySignals() adapter in agent-state.mjs that synthesizes an envelope from parsed log markers — so the gate engine always sees the same shape during migration.
196
+ 3. Update the gate engine to prefer the envelope file when present, fall back to the legacy adapter.
197
+ 4. Canonical snapshot path must be attempt-scoped: .tmp/<lane>-wave-launcher/results/wave-<N>/attempt-<A>/<agentId>.json (immutability requirement).
198
+ 5. Update skills to instruct agents to emit the envelope file.
199
+
200
+ Required context before coding:
201
+ - Read docs/reference/repository-guidance.md.
202
+ - Read docs/research/agent-context-sources.md.
203
+ - Read docs/plans/end-state-architecture.md (section: Agent Result Envelope).
204
+ - Read scripts/wave-orchestrator/agent-state.mjs (current log parsing).
205
+ - Read scripts/wave-orchestrator/launcher-gates.mjs (current gate reads).
206
+
207
+ File ownership (only touch these paths):
208
+ - scripts/wave-orchestrator/result-envelope.mjs
209
+ - scripts/wave-orchestrator/agent-state.mjs
210
+ - scripts/wave-orchestrator/launcher-gates.mjs
211
+ - test/wave-orchestrator/result-envelope.test.ts
212
+ ```
213
+
214
+ ## Agent A2: Retry Engine Isolation
215
+
216
+ ### Executor
217
+
218
+ - profile: implement-fast
219
+ - model: gpt-5-codex
220
+ - codex.add_dirs: scripts,test
221
+ - fallbacks: claude, opencode
222
+
223
+ ### Context7
224
+
225
+ - bundle: node-typescript
226
+
227
+ ### Components
228
+
229
+ - closure-sweep-and-role-gates
230
+
231
+ ### Exit contract
232
+
233
+ - completion: contract
234
+ - durability: none
235
+ - proof: unit
236
+ - doc-impact: none
237
+
238
+ ### Deliverables
239
+
240
+ - scripts/wave-orchestrator/launcher-retry.mjs
241
+ - test/wave-orchestrator/retry-determinism.test.ts
242
+
243
+ ### Prompt
244
+
245
+ ```text
246
+ Harden the retry engine into a fully deterministic subsystem.
247
+
248
+ The retry engine must be testable from stored state without launching anything.
249
+
250
+ Retry plan contract (all six fields required):
251
+ 1. why_resuming: string — reason for retry
252
+ 2. invalidated: [taskId] — tasks whose proof is no longer valid
253
+ 3. reusable_proof: [{ proofBundleId, agentId }] — proof bundles still valid
254
+ 4. resume_from_stage: string — closure stage to resume from
255
+ 5. executor_changes: [{ agentId, from, to }] — executor fallback changes
256
+ 6. human_inputs_blocking: [requestId] — unresolved human inputs that block resume
257
+
258
+ Implementation:
259
+ 1. Refactor launcher-retry.mjs so all retry decisions read from control-plane materialization and task graph, not from override files.
260
+ 2. Override files become write-only compatibility caches for legacy CLI.
261
+ 3. Add retry-determinism.test.ts: feed stored control-plane events and task graphs through the retry planner, assert on the output plan without launching any processes.
262
+ 4. Ensure the retry engine uses the two-phase proof split: only unproven tasks on slice failure, only closure agents on gate failure.
263
+
264
+ Required context before coding:
265
+ - Read docs/reference/repository-guidance.md.
266
+ - Read docs/research/agent-context-sources.md.
267
+ - Read docs/plans/end-state-architecture.md (section: Phase Engines, retry-engine).
268
+ - Read scripts/wave-orchestrator/launcher-retry.mjs.
269
+ - Read scripts/wave-orchestrator/retry-control.mjs.
270
+
271
+ File ownership (only touch these paths):
272
+ - scripts/wave-orchestrator/launcher-retry.mjs
273
+ - scripts/wave-orchestrator/retry-control.mjs
274
+ - test/wave-orchestrator/retry-determinism.test.ts
275
+ ```
276
+
277
+ ## Agent A3: Executor Adapter Contract
278
+
279
+ ### Executor
280
+
281
+ - profile: implement-fast
282
+ - model: gpt-5-codex
283
+ - codex.add_dirs: scripts,test
284
+ - fallbacks: claude, opencode
285
+
286
+ ### Context7
287
+
288
+ - bundle: node-typescript
289
+
290
+ ### Components
291
+
292
+ - executor-abstraction-and-prompt-transport
293
+
294
+ ### Exit contract
295
+
296
+ - completion: contract
297
+ - durability: none
298
+ - proof: unit
299
+ - doc-impact: none
300
+
301
+ ### Deliverables
302
+
303
+ - scripts/wave-orchestrator/executors.mjs
304
+ - test/wave-orchestrator/executors.test.ts
305
+
306
+ ### Prompt
307
+
308
+ ```text
309
+ Refactor executor adapters to be capability-driven, not launcher-driven.
310
+
311
+ End-state executor adapter contract:
312
+ ExecutorAdapter {
313
+ executorId, displayName
314
+ capabilities: { sandboxModes, supportsSearch, supportsImages, supportsMcp, supportsHooks, maxTurns, rateLimitRetry, ... }
315
+ buildLaunchSpec(agent, wave, options) → LaunchSpec
316
+ locateResultEnvelope(statusPath, logPath) → path | null // locate agent-produced envelope
317
+ validateResultEnvelope(envelope) → { valid, errors } // validate envelope schema
318
+ synthesizeLegacyEnvelope(logPath, statusPath) → envelope // compatibility mode only
319
+ isAvailable() → boolean
320
+ fallbackEligibility: { canFallbackFrom, canFallbackTo, restrictions }
321
+ supervisionHooks: { onLaunch, onComplete, onTimeout, onRateLimit }
322
+ }
323
+
324
+ Key change: the end-state adapter reads/validates agent-produced envelopes, NOT builds them from log tails. buildResultEnvelope(logPath, statusPath) is migration-only and named synthesizeLegacyEnvelope to make that clear.
325
+
326
+ Implementation:
327
+ 1. Refactor executors.mjs to expose a capability-driven interface.
328
+ 2. Replace if (executor === 'codex') branching with capability checks.
329
+ 3. Add locateResultEnvelope and validateResultEnvelope to each adapter.
330
+ 4. Keep synthesizeLegacyEnvelope as explicit compatibility mode.
331
+ 5. Update tests to verify capability-driven behavior.
332
+
333
+ Required context before coding:
334
+ - Read docs/reference/repository-guidance.md.
335
+ - Read docs/research/agent-context-sources.md.
336
+ - Read docs/plans/end-state-architecture.md (section: Runtime Adapter Contract).
337
+ - Read scripts/wave-orchestrator/executors.mjs.
338
+
339
+ File ownership (only touch these paths):
340
+ - scripts/wave-orchestrator/executors.mjs
341
+ - test/wave-orchestrator/executors.test.ts
342
+ ```