@chllming/wave-orchestration 0.5.1

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 (68) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +549 -0
  3. package/docs/agents/wave-deploy-verifier-role.md +34 -0
  4. package/docs/agents/wave-documentation-role.md +30 -0
  5. package/docs/agents/wave-evaluator-role.md +43 -0
  6. package/docs/agents/wave-infra-role.md +34 -0
  7. package/docs/agents/wave-integration-role.md +32 -0
  8. package/docs/agents/wave-launcher-role.md +37 -0
  9. package/docs/context7/bundles.json +91 -0
  10. package/docs/plans/component-cutover-matrix.json +112 -0
  11. package/docs/plans/component-cutover-matrix.md +49 -0
  12. package/docs/plans/context7-wave-orchestrator.md +130 -0
  13. package/docs/plans/current-state.md +44 -0
  14. package/docs/plans/master-plan.md +16 -0
  15. package/docs/plans/migration.md +23 -0
  16. package/docs/plans/wave-orchestrator.md +254 -0
  17. package/docs/plans/waves/wave-0.md +165 -0
  18. package/docs/reference/github-packages-setup.md +52 -0
  19. package/docs/reference/migration-0.2-to-0.5.md +622 -0
  20. package/docs/reference/npmjs-trusted-publishing.md +55 -0
  21. package/docs/reference/repository-guidance.md +18 -0
  22. package/docs/reference/runtime-config/README.md +85 -0
  23. package/docs/reference/runtime-config/claude.md +105 -0
  24. package/docs/reference/runtime-config/codex.md +81 -0
  25. package/docs/reference/runtime-config/opencode.md +93 -0
  26. package/docs/research/agent-context-sources.md +57 -0
  27. package/docs/roadmap.md +626 -0
  28. package/package.json +53 -0
  29. package/releases/manifest.json +101 -0
  30. package/scripts/context7-api-check.sh +21 -0
  31. package/scripts/context7-export-env.sh +52 -0
  32. package/scripts/research/agent-context-archive.mjs +472 -0
  33. package/scripts/research/generate-agent-context-indexes.mjs +85 -0
  34. package/scripts/research/import-agent-context-archive.mjs +793 -0
  35. package/scripts/research/manifests/harness-and-blackboard-2026-03-21.mjs +201 -0
  36. package/scripts/wave-autonomous.mjs +13 -0
  37. package/scripts/wave-cli-bootstrap.mjs +27 -0
  38. package/scripts/wave-dashboard.mjs +11 -0
  39. package/scripts/wave-human-feedback.mjs +11 -0
  40. package/scripts/wave-launcher.mjs +11 -0
  41. package/scripts/wave-local-executor.mjs +13 -0
  42. package/scripts/wave-orchestrator/agent-state.mjs +416 -0
  43. package/scripts/wave-orchestrator/autonomous.mjs +367 -0
  44. package/scripts/wave-orchestrator/clarification-triage.mjs +605 -0
  45. package/scripts/wave-orchestrator/config.mjs +848 -0
  46. package/scripts/wave-orchestrator/context7.mjs +464 -0
  47. package/scripts/wave-orchestrator/coord-cli.mjs +286 -0
  48. package/scripts/wave-orchestrator/coordination-store.mjs +987 -0
  49. package/scripts/wave-orchestrator/coordination.mjs +768 -0
  50. package/scripts/wave-orchestrator/dashboard-renderer.mjs +254 -0
  51. package/scripts/wave-orchestrator/dashboard-state.mjs +473 -0
  52. package/scripts/wave-orchestrator/dep-cli.mjs +219 -0
  53. package/scripts/wave-orchestrator/docs-queue.mjs +75 -0
  54. package/scripts/wave-orchestrator/executors.mjs +385 -0
  55. package/scripts/wave-orchestrator/feedback.mjs +372 -0
  56. package/scripts/wave-orchestrator/install.mjs +540 -0
  57. package/scripts/wave-orchestrator/launcher.mjs +3879 -0
  58. package/scripts/wave-orchestrator/ledger.mjs +332 -0
  59. package/scripts/wave-orchestrator/local-executor.mjs +263 -0
  60. package/scripts/wave-orchestrator/replay.mjs +246 -0
  61. package/scripts/wave-orchestrator/roots.mjs +10 -0
  62. package/scripts/wave-orchestrator/routing-state.mjs +542 -0
  63. package/scripts/wave-orchestrator/shared.mjs +405 -0
  64. package/scripts/wave-orchestrator/terminals.mjs +209 -0
  65. package/scripts/wave-orchestrator/traces.mjs +1094 -0
  66. package/scripts/wave-orchestrator/wave-files.mjs +1923 -0
  67. package/scripts/wave.mjs +103 -0
  68. package/wave.config.json +115 -0
@@ -0,0 +1,286 @@
1
+ import path from "node:path";
2
+ import { buildDocsQueue, readDocsQueue, writeDocsQueue } from "./docs-queue.mjs";
3
+ import { readWaveLedger, writeWaveLedger } from "./ledger.mjs";
4
+ import {
5
+ buildDependencySnapshot,
6
+ buildRequestAssignments,
7
+ writeDependencySnapshotMarkdown,
8
+ } from "./routing-state.mjs";
9
+ import {
10
+ appendCoordinationRecord,
11
+ compileAgentInbox,
12
+ compileSharedSummary,
13
+ readJsonArtifact,
14
+ readMaterializedCoordinationState,
15
+ serializeCoordinationState,
16
+ updateSeedRecords,
17
+ writeCompiledInbox,
18
+ writeCoordinationBoardProjection,
19
+ writeJsonArtifact,
20
+ } from "./coordination-store.mjs";
21
+ import { buildLanePaths, ensureDirectory, parseNonNegativeInt } from "./shared.mjs";
22
+ import { parseWaveFiles } from "./wave-files.mjs";
23
+
24
+ function printUsage() {
25
+ console.log(`Usage:
26
+ wave coord post --lane <lane> --wave <n> --agent <id> --kind <kind> --summary <text> [--dry-run] [options]
27
+ wave coord show --lane <lane> --wave <n> [--dry-run] [--json]
28
+ wave coord render --lane <lane> --wave <n> [--dry-run]
29
+ wave coord inbox --lane <lane> --wave <n> --agent <id> [--dry-run]
30
+ `);
31
+ }
32
+
33
+ function parseArgs(argv) {
34
+ const args = argv[0] === "--" ? argv.slice(1) : argv;
35
+ const subcommand = String(args[0] || "").trim().toLowerCase();
36
+ const options = {
37
+ lane: "main",
38
+ wave: null,
39
+ dryRun: false,
40
+ agent: "",
41
+ kind: "",
42
+ summary: "",
43
+ detail: "",
44
+ targets: [],
45
+ priority: "normal",
46
+ dependsOn: [],
47
+ artifactRefs: [],
48
+ status: "open",
49
+ json: false,
50
+ };
51
+ for (let i = 1; i < args.length; i += 1) {
52
+ const arg = args[i];
53
+ if (arg === "--lane") {
54
+ options.lane = String(args[++i] || "").trim();
55
+ } else if (arg === "--wave") {
56
+ options.wave = parseNonNegativeInt(args[++i], "--wave");
57
+ } else if (arg === "--agent") {
58
+ options.agent = String(args[++i] || "").trim();
59
+ } else if (arg === "--kind") {
60
+ options.kind = String(args[++i] || "").trim();
61
+ } else if (arg === "--summary") {
62
+ options.summary = String(args[++i] || "").trim();
63
+ } else if (arg === "--detail") {
64
+ options.detail = String(args[++i] || "").trim();
65
+ } else if (arg === "--target") {
66
+ options.targets.push(String(args[++i] || "").trim());
67
+ } else if (arg === "--priority") {
68
+ options.priority = String(args[++i] || "").trim();
69
+ } else if (arg === "--depends-on") {
70
+ options.dependsOn.push(String(args[++i] || "").trim());
71
+ } else if (arg === "--artifact") {
72
+ options.artifactRefs.push(String(args[++i] || "").trim());
73
+ } else if (arg === "--status") {
74
+ options.status = String(args[++i] || "").trim();
75
+ } else if (arg === "--json") {
76
+ options.json = true;
77
+ } else if (arg === "--dry-run") {
78
+ options.dryRun = true;
79
+ } else if (arg && arg !== "--") {
80
+ throw new Error(`Unknown argument: ${arg}`);
81
+ }
82
+ }
83
+ if (!subcommand) {
84
+ throw new Error("Expected subcommand");
85
+ }
86
+ return { subcommand, options };
87
+ }
88
+
89
+ function loadWave(lanePaths, waveNumber) {
90
+ const waves = parseWaveFiles(lanePaths.wavesDir, { laneProfile: lanePaths.laneProfile });
91
+ const wave = waves.find((item) => item.wave === waveNumber);
92
+ if (!wave) {
93
+ throw new Error(`Wave ${waveNumber} not found in ${lanePaths.wavesDir}`);
94
+ }
95
+ return wave;
96
+ }
97
+
98
+ function coordinationLogPath(lanePaths, waveNumber) {
99
+ return path.join(lanePaths.coordinationDir, `wave-${waveNumber}.jsonl`);
100
+ }
101
+
102
+ function messageBoardPath(lanePaths, waveNumber) {
103
+ return path.join(lanePaths.messageboardsDir, `wave-${waveNumber}.md`);
104
+ }
105
+
106
+ function docsQueuePath(lanePaths, waveNumber) {
107
+ return path.join(lanePaths.docsQueueDir, `wave-${waveNumber}.json`);
108
+ }
109
+
110
+ function ledgerPath(lanePaths, waveNumber) {
111
+ return path.join(lanePaths.ledgerDir, `wave-${waveNumber}.json`);
112
+ }
113
+
114
+ function assignmentsPath(lanePaths, waveNumber) {
115
+ return path.join(lanePaths.assignmentsDir, `wave-${waveNumber}.json`);
116
+ }
117
+
118
+ function dependencySnapshotPath(lanePaths, waveNumber) {
119
+ return path.join(lanePaths.dependencySnapshotsDir, `wave-${waveNumber}.json`);
120
+ }
121
+
122
+ function dependencySnapshotMarkdownPath(lanePaths, waveNumber) {
123
+ return path.join(lanePaths.dependencySnapshotsDir, `wave-${waveNumber}.md`);
124
+ }
125
+
126
+ function integrationPath(lanePaths, waveNumber) {
127
+ return path.join(lanePaths.integrationDir, `wave-${waveNumber}.json`);
128
+ }
129
+
130
+ export async function runCoordinationCli(argv) {
131
+ if (argv.includes("--help") || argv.includes("-h")) {
132
+ printUsage();
133
+ return;
134
+ }
135
+ const { subcommand, options } = parseArgs(argv);
136
+ const lanePaths = buildLanePaths(options.lane, {
137
+ runVariant: options.dryRun ? "dry-run" : undefined,
138
+ });
139
+ ensureDirectory(lanePaths.coordinationDir);
140
+ ensureDirectory(lanePaths.assignmentsDir);
141
+ ensureDirectory(lanePaths.inboxesDir);
142
+ ensureDirectory(lanePaths.messageboardsDir);
143
+ ensureDirectory(lanePaths.docsQueueDir);
144
+ ensureDirectory(lanePaths.ledgerDir);
145
+ ensureDirectory(lanePaths.integrationDir);
146
+ ensureDirectory(lanePaths.dependencySnapshotsDir);
147
+ if (options.wave === null) {
148
+ throw new Error("--wave is required");
149
+ }
150
+ const wave = loadWave(lanePaths, options.wave);
151
+ const logPath = coordinationLogPath(lanePaths, wave.wave);
152
+ updateSeedRecords(logPath, {
153
+ lane: lanePaths.lane,
154
+ wave: wave.wave,
155
+ agents: wave.agents,
156
+ componentPromotions: wave.componentPromotions,
157
+ sharedPlanDocs: lanePaths.sharedPlanDocs,
158
+ evaluatorAgentId: lanePaths.evaluatorAgentId,
159
+ integrationAgentId: lanePaths.integrationAgentId,
160
+ documentationAgentId: lanePaths.documentationAgentId,
161
+ feedbackRequests: [],
162
+ });
163
+ if (subcommand === "post") {
164
+ if (!options.agent || !options.kind || !options.summary) {
165
+ throw new Error("--agent, --kind, and --summary are required for post");
166
+ }
167
+ const record = appendCoordinationRecord(logPath, {
168
+ lane: lanePaths.lane,
169
+ wave: wave.wave,
170
+ agentId: options.agent,
171
+ kind: options.kind,
172
+ summary: options.summary,
173
+ detail: options.detail,
174
+ targets: options.targets,
175
+ priority: options.priority,
176
+ dependsOn: options.dependsOn,
177
+ artifactRefs: options.artifactRefs,
178
+ status: options.status,
179
+ source: "agent",
180
+ });
181
+ console.log(JSON.stringify(record, null, 2));
182
+ return;
183
+ }
184
+ const state = readMaterializedCoordinationState(logPath);
185
+ const queue =
186
+ readDocsQueue(docsQueuePath(lanePaths, wave.wave)) ||
187
+ buildDocsQueue({
188
+ lane: lanePaths.lane,
189
+ wave,
190
+ summariesByAgentId: {},
191
+ sharedPlanDocs: lanePaths.sharedPlanDocs,
192
+ componentPromotions: wave.componentPromotions,
193
+ });
194
+ writeDocsQueue(docsQueuePath(lanePaths, wave.wave), queue);
195
+ const ledger = readWaveLedger(ledgerPath(lanePaths, wave.wave)) || {
196
+ wave: wave.wave,
197
+ lane: lanePaths.lane,
198
+ phase: "planned",
199
+ tasks: [],
200
+ };
201
+ writeWaveLedger(ledgerPath(lanePaths, wave.wave), ledger);
202
+ const integrationSummary = readJsonArtifact(integrationPath(lanePaths, wave.wave));
203
+ const capabilityAssignments = buildRequestAssignments({
204
+ coordinationState: state,
205
+ agents: wave.agents,
206
+ ledger,
207
+ capabilityRouting: lanePaths.capabilityRouting,
208
+ });
209
+ const dependencySnapshot = buildDependencySnapshot({
210
+ dirPath: lanePaths.crossLaneDependenciesDir,
211
+ lane: lanePaths.lane,
212
+ waveNumber: wave.wave,
213
+ agents: wave.agents,
214
+ ledger,
215
+ capabilityRouting: lanePaths.capabilityRouting,
216
+ });
217
+ writeJsonArtifact(assignmentsPath(lanePaths, wave.wave), capabilityAssignments);
218
+ writeJsonArtifact(dependencySnapshotPath(lanePaths, wave.wave), dependencySnapshot);
219
+ writeDependencySnapshotMarkdown(
220
+ dependencySnapshotMarkdownPath(lanePaths, wave.wave),
221
+ dependencySnapshot,
222
+ );
223
+ if (subcommand === "show") {
224
+ if (options.json) {
225
+ console.log(JSON.stringify(serializeCoordinationState(state), null, 2));
226
+ } else {
227
+ for (const record of state.latestRecords) {
228
+ console.log(`${record.updatedAt} ${record.agentId} ${record.kind}/${record.status} ${record.summary}`);
229
+ }
230
+ }
231
+ return;
232
+ }
233
+ if (subcommand === "render") {
234
+ const boardPath = messageBoardPath(lanePaths, wave.wave);
235
+ writeCoordinationBoardProjection(boardPath, {
236
+ wave: wave.wave,
237
+ waveFile: wave.file,
238
+ agents: wave.agents,
239
+ state,
240
+ capabilityAssignments,
241
+ dependencySnapshot,
242
+ });
243
+ console.log(path.relative(process.cwd(), boardPath));
244
+ return;
245
+ }
246
+ if (subcommand === "inbox") {
247
+ if (!options.agent) {
248
+ throw new Error("--agent is required for inbox");
249
+ }
250
+ const agent = wave.agents.find((item) => item.agentId === options.agent);
251
+ if (!agent) {
252
+ throw new Error(`Agent ${options.agent} not found in wave ${wave.wave}`);
253
+ }
254
+ const shared = compileSharedSummary({
255
+ wave,
256
+ state,
257
+ ledger,
258
+ integrationSummary,
259
+ capabilityAssignments,
260
+ dependencySnapshot,
261
+ });
262
+ const inbox = compileAgentInbox({
263
+ wave,
264
+ agent,
265
+ state,
266
+ ledger,
267
+ docsQueue: queue,
268
+ integrationSummary,
269
+ capabilityAssignments,
270
+ dependencySnapshot,
271
+ });
272
+ const baseDir = path.join(lanePaths.inboxesDir, `wave-${wave.wave}`);
273
+ ensureDirectory(baseDir);
274
+ const sharedPath = path.join(baseDir, "shared-summary.md");
275
+ const inboxPath = path.join(baseDir, `${agent.agentId}.md`);
276
+ writeCompiledInbox(sharedPath, shared.text);
277
+ writeCompiledInbox(inboxPath, inbox.text);
278
+ writeJsonArtifact(path.join(baseDir, `${agent.agentId}.json`), {
279
+ sharedPath,
280
+ inboxPath,
281
+ });
282
+ console.log(JSON.stringify({ sharedPath, inboxPath }, null, 2));
283
+ return;
284
+ }
285
+ throw new Error(`Unknown coord subcommand: ${subcommand}`);
286
+ }