@chllming/wave-orchestration 0.8.3 → 0.8.5

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 (59) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/README.md +60 -11
  3. package/docs/README.md +8 -2
  4. package/docs/agents/wave-design-role.md +47 -0
  5. package/docs/concepts/what-is-a-wave.md +11 -7
  6. package/docs/guides/author-and-run-waves.md +24 -0
  7. package/docs/guides/planner.md +44 -0
  8. package/docs/plans/architecture-hardening-migration.md +8 -1
  9. package/docs/plans/current-state.md +19 -7
  10. package/docs/plans/end-state-architecture.md +88 -70
  11. package/docs/plans/examples/wave-example-design-handoff.md +262 -0
  12. package/docs/plans/examples/wave-example-live-proof.md +1 -1
  13. package/docs/plans/migration.md +370 -64
  14. package/docs/plans/wave-orchestrator.md +49 -13
  15. package/docs/reference/cli-reference.md +46 -14
  16. package/docs/reference/coordination-and-closure.md +19 -6
  17. package/docs/reference/npmjs-trusted-publishing.md +5 -4
  18. package/docs/reference/sample-waves.md +14 -7
  19. package/docs/reference/skills.md +10 -0
  20. package/package.json +1 -1
  21. package/releases/manifest.json +39 -0
  22. package/scripts/wave-orchestrator/agent-state.mjs +64 -491
  23. package/scripts/wave-orchestrator/autonomous.mjs +10 -6
  24. package/scripts/wave-orchestrator/{launcher-closure.mjs → closure-engine.mjs} +190 -74
  25. package/scripts/wave-orchestrator/config.mjs +5 -0
  26. package/scripts/wave-orchestrator/coordination.mjs +42 -1
  27. package/scripts/wave-orchestrator/{launcher-derived-state.mjs → derived-state-engine.mjs} +34 -146
  28. package/scripts/wave-orchestrator/{launcher-gates.mjs → gate-engine.mjs} +501 -141
  29. package/scripts/wave-orchestrator/human-input-resolution.mjs +14 -10
  30. package/scripts/wave-orchestrator/human-input-workflow.mjs +104 -0
  31. package/scripts/wave-orchestrator/implementation-engine.mjs +120 -0
  32. package/scripts/wave-orchestrator/install.mjs +3 -0
  33. package/scripts/wave-orchestrator/launcher-runtime.mjs +11 -6
  34. package/scripts/wave-orchestrator/launcher.mjs +324 -723
  35. package/scripts/wave-orchestrator/ledger.mjs +56 -27
  36. package/scripts/wave-orchestrator/local-executor.mjs +37 -0
  37. package/scripts/wave-orchestrator/planner.mjs +24 -4
  38. package/scripts/wave-orchestrator/projection-writer.mjs +256 -0
  39. package/scripts/wave-orchestrator/reconcile-format.mjs +32 -0
  40. package/scripts/wave-orchestrator/reducer-snapshot.mjs +297 -0
  41. package/scripts/wave-orchestrator/replay.mjs +3 -1
  42. package/scripts/wave-orchestrator/result-envelope.mjs +620 -0
  43. package/scripts/wave-orchestrator/retry-control.mjs +22 -2
  44. package/scripts/wave-orchestrator/{launcher-retry.mjs → retry-engine.mjs} +352 -18
  45. package/scripts/wave-orchestrator/role-helpers.mjs +124 -1
  46. package/scripts/wave-orchestrator/{launcher-supervisor.mjs → session-supervisor.mjs} +178 -103
  47. package/scripts/wave-orchestrator/shared.mjs +2 -0
  48. package/scripts/wave-orchestrator/skills.mjs +1 -0
  49. package/scripts/wave-orchestrator/task-entity.mjs +65 -45
  50. package/scripts/wave-orchestrator/traces.mjs +10 -1
  51. package/scripts/wave-orchestrator/wave-files.mjs +96 -10
  52. package/scripts/wave-orchestrator/wave-state-reducer.mjs +76 -12
  53. package/skills/README.md +7 -0
  54. package/skills/role-design/SKILL.md +50 -0
  55. package/skills/role-design/skill.json +36 -0
  56. package/skills/tui-design/SKILL.md +77 -0
  57. package/skills/tui-design/references/tui-design.md +259 -0
  58. package/skills/tui-design/skill.json +36 -0
  59. package/wave.config.json +15 -1
@@ -4,7 +4,7 @@ import {
4
4
  materializeAgentExecutionSummaryForRun,
5
5
  materializeAgentExecutionSummaries,
6
6
  readRunExecutionSummary,
7
- } from "./launcher-gates.mjs";
7
+ } from "./gate-engine.mjs";
8
8
  import {
9
9
  isOpenCoordinationStatus,
10
10
  appendCoordinationRecord,
@@ -13,9 +13,6 @@ import {
13
13
  readMaterializedCoordinationState,
14
14
  renderCoordinationBoardProjection,
15
15
  updateSeedRecords,
16
- writeCompiledInbox,
17
- writeCoordinationBoardProjection,
18
- writeJsonArtifact,
19
16
  buildCoordinationResponseMetrics,
20
17
  } from "./coordination-store.mjs";
21
18
  import { triageClarificationRequests } from "./clarification-triage.mjs";
@@ -24,29 +21,21 @@ import {
24
21
  buildRequestAssignments,
25
22
  renderDependencySnapshotMarkdown,
26
23
  syncAssignmentRecords,
27
- writeDependencySnapshotMarkdown,
28
24
  } from "./routing-state.mjs";
29
- import {
30
- writeAssignmentSnapshot,
31
- writeDependencySnapshot,
32
- } from "./artifact-schemas.mjs";
33
- import { deriveWaveLedger, readWaveLedger, writeWaveLedger } from "./ledger.mjs";
34
- import { buildDocsQueue, readDocsQueue, writeDocsQueue } from "./docs-queue.mjs";
35
- import {
36
- parseStructuredSignalsFromLog,
37
- } from "./dashboard-state.mjs";
25
+ import { deriveWaveLedger, readWaveLedger } from "./ledger.mjs";
26
+ import { buildDocsQueue, readDocsQueue } from "./docs-queue.mjs";
27
+ import { parseStructuredSignalsFromLog } from "./dashboard-state.mjs";
38
28
  import {
39
29
  isSecurityReviewAgent,
40
30
  resolveSecurityReviewReportPath,
41
31
  isContEvalImplementationOwningAgent,
32
+ resolveWaveRoleBindings,
42
33
  } from "./role-helpers.mjs";
43
34
  import {
44
35
  REPO_ROOT,
45
36
  compactSingleLine,
46
- ensureDirectory,
47
37
  readJsonOrNull,
48
38
  toIsoTimestamp,
49
- writeTextAtomic,
50
39
  } from "./shared.mjs";
51
40
  import {
52
41
  validateContEvalSummary,
@@ -307,27 +296,6 @@ export function buildWaveSecuritySummary({
307
296
  };
308
297
  }
309
298
 
310
- function renderWaveSecuritySummaryMarkdown(securitySummary) {
311
- return [
312
- `# Wave ${securitySummary.wave} Security Summary`,
313
- "",
314
- `- State: ${securitySummary.overallState || "unknown"}`,
315
- `- Detail: ${securitySummary.detail || "n/a"}`,
316
- `- Total findings: ${securitySummary.totalFindings || 0}`,
317
- `- Total approvals: ${securitySummary.totalApprovals || 0}`,
318
- `- Reviewers: ${(securitySummary.agents || []).length}`,
319
- "",
320
- "## Reviews",
321
- ...((securitySummary.agents || []).length > 0
322
- ? securitySummary.agents.map(
323
- (entry) =>
324
- `- ${entry.agentId}: state=${entry.state || "unknown"} findings=${entry.findings || 0} approvals=${entry.approvals || 0}${entry.reportPath ? ` report=${entry.reportPath}` : ""}${entry.detail ? ` detail=${entry.detail}` : ""}`,
325
- )
326
- : ["- None."]),
327
- "",
328
- ].join("\n");
329
- }
330
-
331
299
  function padReportedEntries(entries, minimumCount, label) {
332
300
  const padded = [...entries];
333
301
  for (let index = padded.length + 1; index <= minimumCount; index += 1) {
@@ -339,6 +307,7 @@ function padReportedEntries(entries, minimumCount, label) {
339
307
  function buildIntegrationEvidence({
340
308
  lanePaths,
341
309
  wave,
310
+ roleBindings = resolveWaveRoleBindings(wave, lanePaths),
342
311
  coordinationState,
343
312
  summariesByAgentId,
344
313
  docsQueue,
@@ -404,14 +373,14 @@ function buildIntegrationEvidence({
404
373
  for (const agent of wave.agents || []) {
405
374
  const summary = summariesByAgentId?.[agent.agentId] || null;
406
375
  const contEvalImplementationOwning =
407
- agent.agentId === lanePaths.contEvalAgentId &&
376
+ agent.agentId === roleBindings.contEvalAgentId &&
408
377
  isContEvalImplementationOwningAgent(agent, {
409
- contEvalAgentId: lanePaths.contEvalAgentId,
378
+ contEvalAgentId: roleBindings.contEvalAgentId,
410
379
  });
411
380
  if (isSecurityReviewAgent(agent)) {
412
381
  continue;
413
382
  }
414
- if (agent.agentId === lanePaths.contEvalAgentId) {
383
+ if (agent.agentId === roleBindings.contEvalAgentId) {
415
384
  const validation = validateContEvalSummary(agent, summary, {
416
385
  mode: "live",
417
386
  evalTargets: wave.evalTargets,
@@ -425,11 +394,11 @@ function buildIntegrationEvidence({
425
394
  }
426
395
  if (
427
396
  ![
428
- lanePaths.contQaAgentId,
429
- lanePaths.integrationAgentId,
430
- lanePaths.documentationAgentId,
397
+ roleBindings.contQaAgentId,
398
+ roleBindings.integrationAgentId,
399
+ roleBindings.documentationAgentId,
431
400
  ].includes(agent.agentId) &&
432
- (agent.agentId !== lanePaths.contEvalAgentId || contEvalImplementationOwning)
401
+ (agent.agentId !== roleBindings.contEvalAgentId || contEvalImplementationOwning)
433
402
  ) {
434
403
  const validation = validateImplementationSummary(agent, summary);
435
404
  if (!validation.ok) {
@@ -553,10 +522,12 @@ export function buildWaveIntegrationSummary({
553
522
  dependencySnapshot = null,
554
523
  securitySummary = null,
555
524
  }) {
556
- const explicitIntegration = summariesByAgentId[lanePaths.integrationAgentId]?.integration || null;
525
+ const roleBindings = resolveWaveRoleBindings(wave, lanePaths);
526
+ const explicitIntegration = summariesByAgentId[roleBindings.integrationAgentId]?.integration || null;
557
527
  const evidence = buildIntegrationEvidence({
558
528
  lanePaths,
559
529
  wave,
530
+ roleBindings,
560
531
  coordinationState,
561
532
  summariesByAgentId,
562
533
  docsQueue,
@@ -569,7 +540,7 @@ export function buildWaveIntegrationSummary({
569
540
  return {
570
541
  wave: wave.wave,
571
542
  lane: lanePaths.lane,
572
- agentId: lanePaths.integrationAgentId,
543
+ agentId: roleBindings.integrationAgentId,
573
544
  attempt,
574
545
  openClaims: padReportedEntries(
575
546
  evidence.openClaims,
@@ -619,63 +590,7 @@ export function buildWaveIntegrationSummary({
619
590
  };
620
591
  }
621
592
 
622
- function renderIntegrationSection(title, items) {
623
- return [
624
- title,
625
- ...((items || []).length > 0 ? items.map((item) => `- ${item}`) : ["- None."]),
626
- "",
627
- ];
628
- }
629
-
630
- function renderIntegrationSummaryMarkdown(integrationSummary) {
631
- return [
632
- `# Wave ${integrationSummary.wave} Integration Summary`,
633
- "",
634
- `- Recommendation: ${integrationSummary.recommendation || "unknown"}`,
635
- `- Detail: ${integrationSummary.detail || "n/a"}`,
636
- `- Open claims: ${(integrationSummary.openClaims || []).length}`,
637
- `- Conflicting claims: ${(integrationSummary.conflictingClaims || []).length}`,
638
- `- Unresolved blockers: ${(integrationSummary.unresolvedBlockers || []).length}`,
639
- `- Changed interfaces: ${(integrationSummary.changedInterfaces || []).length}`,
640
- `- Cross-component impacts: ${(integrationSummary.crossComponentImpacts || []).length}`,
641
- `- Proof gaps: ${(integrationSummary.proofGaps || []).length}`,
642
- `- Deploy risks: ${(integrationSummary.deployRisks || []).length}`,
643
- `- Documentation gaps: ${(integrationSummary.docGaps || []).length}`,
644
- `- Security review: ${integrationSummary.securityState || "not-applicable"}`,
645
- `- Security findings: ${(integrationSummary.securityFindings || []).length}`,
646
- `- Security approvals: ${(integrationSummary.securityApprovals || []).length}`,
647
- `- Inbound dependencies: ${(integrationSummary.inboundDependencies || []).length}`,
648
- `- Outbound dependencies: ${(integrationSummary.outboundDependencies || []).length}`,
649
- `- Helper assignments: ${(integrationSummary.helperAssignments || []).length}`,
650
- "",
651
- ...renderIntegrationSection("## Open Claims", integrationSummary.openClaims),
652
- ...renderIntegrationSection("## Conflicting Claims", integrationSummary.conflictingClaims),
653
- ...renderIntegrationSection("## Unresolved Blockers", integrationSummary.unresolvedBlockers),
654
- ...renderIntegrationSection("## Changed Interfaces", integrationSummary.changedInterfaces),
655
- ...renderIntegrationSection(
656
- "## Cross-Component Impacts",
657
- integrationSummary.crossComponentImpacts,
658
- ),
659
- ...renderIntegrationSection("## Proof Gaps", integrationSummary.proofGaps),
660
- ...renderIntegrationSection("## Deploy Risks", integrationSummary.deployRisks),
661
- ...renderIntegrationSection("## Security Findings", integrationSummary.securityFindings),
662
- ...renderIntegrationSection("## Security Approvals", integrationSummary.securityApprovals),
663
- ...renderIntegrationSection("## Inbound Dependencies", integrationSummary.inboundDependencies),
664
- ...renderIntegrationSection("## Outbound Dependencies", integrationSummary.outboundDependencies),
665
- ...renderIntegrationSection("## Helper Assignments", integrationSummary.helperAssignments),
666
- "## Runtime Assignments",
667
- ...((integrationSummary.runtimeAssignments || []).length > 0
668
- ? integrationSummary.runtimeAssignments.map(
669
- (assignment) =>
670
- `- ${assignment.agentId}: executor=${assignment.executorId || "n/a"} role=${assignment.role || "n/a"} profile=${assignment.profile || "none"} fallback_used=${assignment.fallbackUsed ? "yes" : "no"}`,
671
- )
672
- : ["- None."]),
673
- "",
674
- ...renderIntegrationSection("## Documentation Gaps", integrationSummary.docGaps),
675
- ].join("\n");
676
- }
677
-
678
- export function writeWaveDerivedState({
593
+ export function buildWaveDerivedState({
679
594
  lanePaths,
680
595
  wave,
681
596
  agentRuns = [],
@@ -684,6 +599,7 @@ export function writeWaveDerivedState({
684
599
  attempt = 0,
685
600
  orchestratorId = null,
686
601
  }) {
602
+ const roleBindings = resolveWaveRoleBindings(wave, lanePaths);
687
603
  const coordinationLogPath = waveCoordinationLogPath(lanePaths, wave.wave);
688
604
  const existingDocsQueue = readDocsQueue(waveDocsQueuePath(lanePaths, wave.wave));
689
605
  const existingIntegrationSummary = readJsonOrNull(waveIntegrationPath(lanePaths, wave.wave));
@@ -694,10 +610,10 @@ export function writeWaveDerivedState({
694
610
  agents: wave.agents,
695
611
  componentPromotions: wave.componentPromotions,
696
612
  sharedPlanDocs: lanePaths.sharedPlanDocs,
697
- contQaAgentId: lanePaths.contQaAgentId,
698
- contEvalAgentId: lanePaths.contEvalAgentId,
699
- integrationAgentId: lanePaths.integrationAgentId,
700
- documentationAgentId: lanePaths.documentationAgentId,
613
+ contQaAgentId: roleBindings.contQaAgentId,
614
+ contEvalAgentId: roleBindings.contEvalAgentId,
615
+ integrationAgentId: roleBindings.integrationAgentId,
616
+ documentationAgentId: roleBindings.documentationAgentId,
701
617
  feedbackRequests,
702
618
  });
703
619
  let coordinationState = readMaterializedCoordinationState(coordinationLogPath);
@@ -738,18 +654,6 @@ export function writeWaveDerivedState({
738
654
  ledger: existingLedger,
739
655
  capabilityRouting: lanePaths.capabilityRouting,
740
656
  });
741
- writeAssignmentSnapshot(waveAssignmentsPath(lanePaths, wave.wave), capabilityAssignments, {
742
- lane: lanePaths.lane,
743
- wave: wave.wave,
744
- });
745
- writeDependencySnapshot(waveDependencySnapshotPath(lanePaths, wave.wave), dependencySnapshot, {
746
- lane: lanePaths.lane,
747
- wave: wave.wave,
748
- });
749
- writeDependencySnapshotMarkdown(
750
- waveDependencySnapshotMarkdownPath(lanePaths, wave.wave),
751
- dependencySnapshot,
752
- );
753
657
  const runtimeAssignments = wave.agents.map((agent) => ({
754
658
  agentId: agent.agentId,
755
659
  role: agent.executorResolved?.role || null,
@@ -772,18 +676,12 @@ export function writeWaveDerivedState({
772
676
  componentPromotions: wave.componentPromotions,
773
677
  runtimeAssignments,
774
678
  });
775
- writeDocsQueue(waveDocsQueuePath(lanePaths, wave.wave), docsQueue);
776
679
  const securitySummary = buildWaveSecuritySummary({
777
680
  lanePaths,
778
681
  wave,
779
682
  attempt,
780
683
  summariesByAgentId,
781
684
  });
782
- writeJsonArtifact(waveSecurityPath(lanePaths, wave.wave), securitySummary);
783
- writeTextAtomic(
784
- waveSecurityMarkdownPath(lanePaths, wave.wave),
785
- `${renderWaveSecuritySummaryMarkdown(securitySummary)}\n`,
786
- );
787
685
  const integrationSummary = buildWaveIntegrationSummary({
788
686
  lanePaths,
789
687
  wave,
@@ -797,11 +695,6 @@ export function writeWaveDerivedState({
797
695
  dependencySnapshot,
798
696
  securitySummary,
799
697
  });
800
- writeJsonArtifact(waveIntegrationPath(lanePaths, wave.wave), integrationSummary);
801
- writeTextAtomic(
802
- waveIntegrationMarkdownPath(lanePaths, wave.wave),
803
- `${renderIntegrationSummaryMarkdown(integrationSummary)}\n`,
804
- );
805
698
  const ledger = deriveWaveLedger({
806
699
  lane: lanePaths.lane,
807
700
  wave,
@@ -810,17 +703,15 @@ export function writeWaveDerivedState({
810
703
  integrationSummary,
811
704
  docsQueue,
812
705
  attempt,
813
- contQaAgentId: lanePaths.contQaAgentId,
814
- contEvalAgentId: lanePaths.contEvalAgentId,
815
- integrationAgentId: lanePaths.integrationAgentId,
816
- documentationAgentId: lanePaths.documentationAgentId,
706
+ contQaAgentId: roleBindings.contQaAgentId,
707
+ contEvalAgentId: roleBindings.contEvalAgentId,
708
+ integrationAgentId: roleBindings.integrationAgentId,
709
+ documentationAgentId: roleBindings.documentationAgentId,
817
710
  benchmarkCatalogPath: lanePaths.laneProfile?.paths?.benchmarkCatalogPath,
818
711
  capabilityAssignments,
819
712
  dependencySnapshot,
820
713
  });
821
- writeWaveLedger(waveLedgerPath(lanePaths, wave.wave), ledger);
822
714
  const inboxDir = waveInboxDir(lanePaths, wave.wave);
823
- ensureDirectory(inboxDir);
824
715
  const sharedSummary = compileSharedSummary({
825
716
  wave,
826
717
  state: coordinationState,
@@ -830,7 +721,6 @@ export function writeWaveDerivedState({
830
721
  dependencySnapshot,
831
722
  });
832
723
  const sharedSummaryPath = path.join(inboxDir, "shared-summary.md");
833
- writeCompiledInbox(sharedSummaryPath, sharedSummary.text);
834
724
  const inboxesByAgentId = {};
835
725
  for (const agent of wave.agents) {
836
726
  const inbox = compileAgentInbox({
@@ -844,7 +734,6 @@ export function writeWaveDerivedState({
844
734
  dependencySnapshot,
845
735
  });
846
736
  const inboxPath = path.join(inboxDir, `${agent.agentId}.md`);
847
- writeCompiledInbox(inboxPath, inbox.text);
848
737
  inboxesByAgentId[agent.agentId] = { path: inboxPath, text: inbox.text, truncated: inbox.truncated };
849
738
  }
850
739
  const boardText = renderCoordinationBoardProjection({
@@ -857,26 +746,25 @@ export function writeWaveDerivedState({
857
746
  });
858
747
  const responseMetrics = buildCoordinationResponseMetrics(coordinationState);
859
748
  const messageBoardPath = path.join(lanePaths.messageboardsDir, `wave-${wave.wave}.md`);
860
- writeCoordinationBoardProjection(messageBoardPath, {
861
- wave: wave.wave,
862
- waveFile: wave.file,
863
- agents: wave.agents,
864
- state: coordinationState,
865
- capabilityAssignments,
866
- dependencySnapshot,
867
- });
868
749
  return {
869
750
  coordinationLogPath,
870
751
  coordinationState,
871
752
  clarificationTriage,
872
753
  docsQueue,
754
+ docsQueuePath: waveDocsQueuePath(lanePaths, wave.wave),
873
755
  capabilityAssignments,
756
+ assignmentSnapshotPath: waveAssignmentsPath(lanePaths, wave.wave),
874
757
  dependencySnapshot,
758
+ dependencySnapshotPath: waveDependencySnapshotPath(lanePaths, wave.wave),
759
+ dependencySnapshotMarkdownPath: waveDependencySnapshotMarkdownPath(lanePaths, wave.wave),
875
760
  securitySummary,
761
+ securitySummaryPath: waveSecurityPath(lanePaths, wave.wave),
876
762
  integrationSummary,
763
+ integrationSummaryPath: waveIntegrationPath(lanePaths, wave.wave),
877
764
  integrationMarkdownPath: waveIntegrationMarkdownPath(lanePaths, wave.wave),
878
765
  securityMarkdownPath: waveSecurityMarkdownPath(lanePaths, wave.wave),
879
766
  ledger,
767
+ ledgerPath: waveLedgerPath(lanePaths, wave.wave),
880
768
  responseMetrics,
881
769
  sharedSummaryPath,
882
770
  sharedSummaryText: sharedSummary.text,