cool-workflow 0.2.1 → 0.2.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 (156) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/apps/architecture-review/app.json +1 -1
  4. package/apps/architecture-review-fast/app.json +1 -1
  5. package/apps/end-to-end-golden-path/app.json +1 -1
  6. package/apps/pr-review-fix-ci/app.json +1 -1
  7. package/apps/release-cut/app.json +1 -1
  8. package/apps/research-synthesis/app.json +1 -1
  9. package/dist/cli/dispatch.js +29 -91
  10. package/dist/cli/entry.js +41 -1
  11. package/dist/cli/io.js +6 -2
  12. package/dist/cli/parseargv.js +6 -2
  13. package/dist/core/capability-data.js +271 -0
  14. package/dist/core/capability-table.js +16 -3504
  15. package/dist/core/format/completion.js +68 -0
  16. package/dist/core/format/help.js +50 -8
  17. package/dist/core/format/safe-json.js +73 -0
  18. package/dist/core/format/state-explosion-text.js +1 -1
  19. package/dist/core/multi-agent/candidate-scoring.js +5 -1
  20. package/dist/core/multi-agent/collaboration.js +6 -5
  21. package/dist/core/multi-agent/coordinator.js +9 -8
  22. package/dist/core/multi-agent/runtime.js +4 -4
  23. package/dist/core/multi-agent/topology.js +3 -3
  24. package/dist/core/pipeline/commit-gate.js +2 -1
  25. package/dist/core/pipeline/dispatch.js +18 -4
  26. package/dist/core/pipeline/drive-decide.js +2 -1
  27. package/dist/core/state/migrations.js +16 -1
  28. package/dist/core/state/state-explosion/digest.js +16 -15
  29. package/dist/core/state/state-explosion/graph.js +26 -19
  30. package/dist/core/state/state-explosion/helpers.js +2 -1
  31. package/dist/core/state/state-explosion/report.js +6 -6
  32. package/dist/core/trust/ledger.js +2 -1
  33. package/dist/core/types/execution-backend.js +18 -0
  34. package/dist/core/types/observability.js +7 -0
  35. package/dist/core/util/collate.js +23 -0
  36. package/dist/core/util/numeric-flag.js +40 -0
  37. package/dist/core/version.js +1 -1
  38. package/dist/mcp/server.js +99 -11
  39. package/dist/shell/audit-cli.js +99 -23
  40. package/dist/shell/commit-summary.js +2 -1
  41. package/dist/shell/coordinator-io.js +73 -13
  42. package/dist/shell/dispatch.js +1 -1
  43. package/dist/shell/doctor.js +80 -1
  44. package/dist/shell/drive.js +269 -59
  45. package/dist/shell/eval-text.js +2 -2
  46. package/dist/shell/evidence-reasoning.js +8 -7
  47. package/dist/shell/execution-backend/agent.js +20 -1
  48. package/dist/shell/execution-backend/container.js +4 -1
  49. package/dist/shell/execution-backend/local.js +4 -1
  50. package/dist/shell/execution-backend/registry.js +2 -1
  51. package/dist/shell/execution-backend/types.js +0 -9
  52. package/dist/shell/feedback-cli.js +6 -6
  53. package/dist/shell/fs-atomic.js +232 -30
  54. package/dist/shell/man-cli.js +6 -0
  55. package/dist/shell/metrics-cli.js +2 -1
  56. package/dist/shell/multi-agent-cli.js +367 -323
  57. package/dist/shell/multi-agent-host.js +9 -9
  58. package/dist/shell/multi-agent-operator-ux.js +82 -39
  59. package/dist/shell/node-store.js +10 -4
  60. package/dist/shell/observability.js +13 -12
  61. package/dist/shell/onramp.js +17 -1
  62. package/dist/shell/operator-ux-text.js +24 -23
  63. package/dist/shell/operator-ux.js +22 -20
  64. package/dist/shell/orchestrator.js +49 -38
  65. package/dist/shell/pipeline-cli.js +168 -111
  66. package/dist/shell/reclamation-io.js +16 -5
  67. package/dist/shell/registry-cli.js +19 -17
  68. package/dist/shell/remote-source.js +13 -8
  69. package/dist/shell/report-cli.js +45 -0
  70. package/dist/shell/report.js +4 -2
  71. package/dist/shell/run-registry-io.js +77 -19
  72. package/dist/shell/run-store.js +91 -2
  73. package/dist/shell/scheduling-io.js +12 -13
  74. package/dist/shell/state-cli.js +2 -7
  75. package/dist/shell/state-explosion-cli.js +19 -10
  76. package/dist/shell/topology-io.js +38 -6
  77. package/dist/shell/trust-audit.js +264 -23
  78. package/dist/shell/trust-policy-io.js +1 -1
  79. package/dist/shell/worker-cli.js +41 -29
  80. package/dist/shell/worker-isolation.js +34 -9
  81. package/dist/shell/workflow-app-loader.js +3 -2
  82. package/dist/wiring/capability-table/basics.js +91 -0
  83. package/dist/wiring/capability-table/exec-backend.js +171 -0
  84. package/dist/wiring/capability-table/index.js +42 -0
  85. package/dist/wiring/capability-table/multi-agent.js +630 -0
  86. package/dist/wiring/capability-table/parity.js +467 -0
  87. package/dist/wiring/capability-table/pipeline.js +292 -0
  88. package/dist/wiring/capability-table/registry-core.js +208 -0
  89. package/dist/wiring/capability-table/reporting.js +435 -0
  90. package/dist/wiring/capability-table/scheduling-registry.js +592 -0
  91. package/dist/wiring/capability-table/state.js +181 -0
  92. package/dist/wiring/capability-table/trust-ledger.js +158 -0
  93. package/dist/wiring/capability-table/workflow-apps.js +381 -0
  94. package/docs/agent-delegation-drive.7.md +4 -0
  95. package/docs/candidate-scoring.7.md +1 -1
  96. package/docs/canonical-workflow-apps.7.md +7 -7
  97. package/docs/cli-mcp-parity.7.md +13 -3
  98. package/docs/contract-migration-tooling.7.md +4 -0
  99. package/docs/control-plane-scheduling.7.md +4 -0
  100. package/docs/coordinator-blackboard.7.md +17 -17
  101. package/docs/dogfood-one-real-repo.7.md +11 -11
  102. package/docs/durable-state-and-locking.7.md +24 -0
  103. package/docs/end-to-end-golden-path.7.md +14 -14
  104. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  105. package/docs/execution-backends.7.md +4 -0
  106. package/docs/getting-started.md +37 -37
  107. package/docs/index.md +1 -0
  108. package/docs/multi-agent-cli-mcp-surface.7.md +21 -17
  109. package/docs/multi-agent-eval-replay-harness.7.md +17 -13
  110. package/docs/multi-agent-operator-ux.7.md +23 -19
  111. package/docs/multi-agent-runtime-core.7.md +22 -22
  112. package/docs/multi-agent-topologies.7.md +6 -6
  113. package/docs/multi-agent-trust-policy-audit.7.md +11 -11
  114. package/docs/node-snapshot-diff-replay.7.md +4 -0
  115. package/docs/observability-cost-accounting.7.md +4 -0
  116. package/docs/operator-ux.7.md +34 -34
  117. package/docs/pipeline-runner.7.md +4 -4
  118. package/docs/project-index.md +48 -5
  119. package/docs/real-execution-backends.7.md +4 -0
  120. package/docs/release-and-migration.7.md +5 -1
  121. package/docs/release-tooling.7.md +4 -0
  122. package/docs/routines.md +4 -4
  123. package/docs/run-registry-control-plane.7.md +23 -19
  124. package/docs/run-retention-reclamation.7.md +4 -0
  125. package/docs/scheduled-tasks.md +14 -14
  126. package/docs/security-trust-hardening.7.md +43 -13
  127. package/docs/state-explosion-management.7.md +14 -10
  128. package/docs/team-collaboration.7.md +4 -0
  129. package/docs/trust-audit-anchor.7.md +71 -0
  130. package/docs/unix-principles.md +3 -1
  131. package/docs/verifier-gated-commit.7.md +1 -1
  132. package/docs/web-desktop-workbench.7.md +4 -0
  133. package/docs/workflow-app-framework.7.md +13 -13
  134. package/manifest/plugin.manifest.json +1 -1
  135. package/package.json +4 -2
  136. package/scripts/agents/claude-p-agent.js +2 -2
  137. package/scripts/block-unapproved-tag.sh +23 -2
  138. package/scripts/bump-version.js +24 -2
  139. package/scripts/canonical-apps.js +4 -4
  140. package/scripts/children/batch-delegate-child.js +52 -2
  141. package/scripts/dogfood-release.js +1 -1
  142. package/scripts/fake-date-for-reproduction.js +44 -0
  143. package/scripts/golden-path.js +4 -4
  144. package/scripts/purity-baseline.json +71 -0
  145. package/scripts/purity-gate.js +239 -0
  146. package/scripts/release-check.js +8 -1
  147. package/scripts/release-flow.js +57 -1
  148. package/scripts/verdict-keygen.js +83 -0
  149. package/scripts/verify-bump-reproduction.sh +148 -0
  150. package/scripts/verify-verdict-signature.js +61 -0
  151. package/scripts/version-sync-check.js +33 -12
  152. package/skills/cool-workflow/SKILL.md +9 -9
  153. package/skills/cool-workflow/references/commands.md +89 -88
  154. package/ui/workbench/app.css +37 -1
  155. package/ui/workbench/app.js +124 -6
  156. package/workflows/README.md +19 -0
@@ -0,0 +1,630 @@
1
+ "use strict";
2
+ // wiring/capability-table/multi-agent.ts — MILESTONE 9 (multi-agent,
3
+ // topology, coordinator/blackboard, candidate scoring, collaboration,
4
+ // eval-replay) CLI bindings. Split out of core/capability-table.ts,
5
+ // byte-for-byte (extracted with sed, not retyped).
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const registry_core_1 = require("./registry-core");
8
+ const io_1 = require("../../cli/io");
9
+ const state_explosion_text_1 = require("../../core/format/state-explosion-text");
10
+ // This whole module is required unconditionally at startup for EVERY
11
+ // command (see wiring/capability-table/index.ts) — a top-level import of
12
+ // each shell module below would cost every invocation its full load, even
13
+ // though only that one capability's own handler ever calls into it.
14
+ function loadOperatorUxText() {
15
+ return require("../../shell/operator-ux-text");
16
+ }
17
+ function loadEvalText() {
18
+ return require("../../shell/eval-text");
19
+ }
20
+ function loadMultiAgentCli() {
21
+ return require("../../shell/multi-agent-cli");
22
+ }
23
+ function loadCollaborationIo() {
24
+ return require("../../shell/collaboration-io");
25
+ }
26
+ function loadTopologyIo() {
27
+ return require("../../shell/topology-io");
28
+ }
29
+ (0, registry_core_1.attachCliBinding)("topology.list", { path: ["topology", "list"], jsonMode: "default", handler: () => ({ json: loadMultiAgentCli().topologyList() }) });
30
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.list").mcp.handler = () => loadMultiAgentCli().topologyList();
31
+ (0, registry_core_1.attachCliBinding)("topology.show", {
32
+ path: ["topology", "show"],
33
+ jsonMode: "default",
34
+ handler: (args) => ({ json: loadMultiAgentCli().topologyShowCli((0, io_1.required)(args.positionals[0], "topology id")) }),
35
+ });
36
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.show").mcp.handler = (args) => loadMultiAgentCli().topologyShowCli((0, io_1.required)((0, io_1.optionalArg)(args.topologyId ?? args.id), "topology id"));
37
+ (0, registry_core_1.attachCliBinding)("topology.validate", {
38
+ path: ["topology", "validate"],
39
+ jsonMode: "default",
40
+ handler: (args) => {
41
+ const result = loadMultiAgentCli().topologyValidateCli((0, io_1.required)(args.positionals[0], "topology id"));
42
+ return { json: result, exitCode: result.valid ? undefined : 1 };
43
+ },
44
+ });
45
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.validate").mcp.handler = (args) => loadMultiAgentCli().topologyValidateCli((0, io_1.required)((0, io_1.optionalArg)(args.topologyId ?? args.id), "topology id"));
46
+ (0, registry_core_1.attachCliBinding)("topology.apply", {
47
+ path: ["topology", "apply"],
48
+ jsonMode: "default",
49
+ handler: (args) => ({
50
+ json: loadMultiAgentCli().topologyApplyCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), topologyId: (0, io_1.required)(args.positionals[1], "topology id") }),
51
+ }),
52
+ });
53
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.apply").mcp.handler = (args) => loadMultiAgentCli().topologyApplyCli({ ...args, topologyId: args.topologyId ?? args.id });
54
+ // jsonMode "flag": human `Topologies` panel by default, canonical JSON
55
+ // under --json (old build's topology.summary was flag).
56
+ (0, registry_core_1.attachCliBinding)("topology.summary", {
57
+ path: ["topology", "summary"],
58
+ jsonMode: "flag",
59
+ handler: (args) => {
60
+ const summary = loadMultiAgentCli().topologySummaryCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
61
+ return { json: summary, text: `${loadTopologyIo().formatTopologySummaryText(summary)}\n` };
62
+ },
63
+ });
64
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.summary").mcp.handler = (args) => loadMultiAgentCli().topologySummaryCli(args);
65
+ // jsonMode "flag": human `Run Graph:` render by default, canonical JSON
66
+ // under --json (old build's topology.graph was flag).
67
+ (0, registry_core_1.attachCliBinding)("topology.graph", {
68
+ path: ["topology", "graph"],
69
+ jsonMode: "flag",
70
+ handler: (args) => {
71
+ const runId = (0, io_1.required)(args.positionals[0], "run id");
72
+ const graph = loadMultiAgentCli().topologyGraphCli({ runId, ...args.options });
73
+ return { json: graph, text: `${loadTopologyIo().formatTopologyGraphText(runId, graph)}\n` };
74
+ },
75
+ });
76
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("topology.graph").mcp.handler = (args) => loadMultiAgentCli().topologyGraphCli(args);
77
+ // ---- multi-agent kernel + host -----------------------------------------
78
+ (0, registry_core_1.attachCliBinding)("multi-agent.run", {
79
+ path: ["multi-agent", "run"],
80
+ jsonMode: "default",
81
+ // positionals[1] is the MultiAgentRun entity id for the transition/show
82
+ // arms (`cw multi-agent run <run> <id> --status …`); it must NOT collide
83
+ // with the create arm's `--id`, so it is forwarded as `multiAgentRunId`
84
+ // only when no `--id` create flag was passed (old handler took `id` from
85
+ // the 3rd positional token).
86
+ handler: (args) => ({
87
+ json: loadMultiAgentCli().multiAgentRunCli({
88
+ ...args.options,
89
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
90
+ multiAgentRunId: args.options.id === undefined ? (args.positionals[1] ?? args.options.multiAgentRunId) : args.options.multiAgentRunId,
91
+ }),
92
+ }),
93
+ });
94
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.run").mcp.handler = (args) => loadMultiAgentCli().multiAgentRunCli(args);
95
+ (0, registry_core_1.attachCliBinding)("multi-agent.status", {
96
+ path: ["multi-agent", "status"],
97
+ jsonMode: "flag",
98
+ handler: (args) => ({
99
+ json: loadMultiAgentCli().multiAgentStatusCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
100
+ text: loadMultiAgentCli().multiAgentStatusText({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
101
+ }),
102
+ });
103
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.status").mcp.handler = (args) => loadMultiAgentCli().multiAgentStatusCli(args);
104
+ (0, registry_core_1.attachCliBinding)("multi-agent.step", {
105
+ path: ["multi-agent", "step"],
106
+ jsonMode: "default",
107
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentStepCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
108
+ });
109
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.step").mcp.handler = (args) => loadMultiAgentCli().multiAgentStepCli(args);
110
+ (0, registry_core_1.attachCliBinding)("multi-agent.blackboard", {
111
+ path: ["multi-agent", "blackboard"],
112
+ jsonMode: "default",
113
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentBlackboardCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }, args.positionals[1]) }),
114
+ });
115
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.blackboard").mcp.handler = (args) => loadMultiAgentCli().multiAgentBlackboardCli(args, args.action);
116
+ (0, registry_core_1.attachCliBinding)("multi-agent.score", {
117
+ path: ["multi-agent", "score"],
118
+ jsonMode: "default",
119
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentScoreCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), candidate: args.options.candidate ?? args.positionals[1] }) }),
120
+ });
121
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.score").mcp.handler = (args) => loadMultiAgentCli().multiAgentScoreCli(args);
122
+ (0, registry_core_1.attachCliBinding)("multi-agent.select", {
123
+ path: ["multi-agent", "select"],
124
+ jsonMode: "default",
125
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentSelectCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), candidate: args.options.candidate ?? args.positionals[1] }) }),
126
+ });
127
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.select").mcp.handler = (args) => loadMultiAgentCli().multiAgentSelectCli(args);
128
+ // jsonMode "flag": human `Multi-Agent` panel by default, canonical JSON
129
+ // under --json (old build's multi-agent.summary was flag).
130
+ (0, registry_core_1.attachCliBinding)("multi-agent.summary", {
131
+ path: ["multi-agent", "summary"],
132
+ jsonMode: "flag",
133
+ handler: (args) => {
134
+ const summary = loadMultiAgentCli().multiAgentSummaryCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
135
+ return { json: summary, text: `${loadOperatorUxText().formatMultiAgentSummaryText(summary)}\n` };
136
+ },
137
+ });
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.summary").mcp.handler = (args) => loadMultiAgentCli().multiAgentSummaryCli(args);
139
+ // `cw multi-agent graph <run>` is one dispatch path served by two capability
140
+ // rows (multi-agent.graph — the operator graph — and multi-agent.graph.compact
141
+ // — the state-explosion view under --view/--focus/--depth), exactly like
142
+ // blackboard.message.post/list. One shared handler answers both; the
143
+ // second row exists so both capabilities carry a cli binding (the
144
+ // both-surface pairing) and `cw help multi-agent` can list both forms.
145
+ function multiAgentGraphHandler(args) {
146
+ const call = { runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options };
147
+ if (args.options.view !== undefined || args.options.focus !== undefined || args.options.depth !== undefined) {
148
+ const compact = loadMultiAgentCli().multiAgentGraphCompactCli(call);
149
+ return { json: compact, text: (0, state_explosion_text_1.formatCompactGraph)(compact) };
150
+ }
151
+ return { json: loadMultiAgentCli().multiAgentGraphCli(call), text: loadMultiAgentCli().multiAgentGraphText(call) };
152
+ }
153
+ (0, registry_core_1.attachCliBinding)("multi-agent.graph", { path: ["multi-agent", "graph"], helpPath: ["multi-agent", "graph"], jsonMode: "flag", handler: multiAgentGraphHandler });
154
+ (0, registry_core_1.attachCliBinding)("multi-agent.graph.compact", { path: ["multi-agent", "graph"], helpPath: ["multi-agent", "graph"], jsonMode: "flag", handler: multiAgentGraphHandler });
155
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.graph").mcp.handler = (args) => loadMultiAgentCli().multiAgentGraphCli(args);
156
+ // GAP: `cw multi-agent dependencies|failures|evidence` — the MCP tool rows
157
+ // (cw_multi_agent_dependencies/failures/evidence) were declared but had no
158
+ // CLI path binding and their mcp.handler was still notYetImplemented. Wire
159
+ // both surfaces to the same operator-ux derivation the CLI text render uses
160
+ // (port of the old handler's dependencies/failures/evidence arms).
161
+ (0, registry_core_1.attachCliBinding)("multi-agent.dependencies", {
162
+ path: ["multi-agent", "dependencies"],
163
+ jsonMode: "flag",
164
+ handler: (args) => ({
165
+ json: loadMultiAgentCli().multiAgentDependenciesCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
166
+ text: loadMultiAgentCli().multiAgentDependenciesText({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
167
+ }),
168
+ });
169
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.dependencies").mcp.handler = (args) => loadMultiAgentCli().multiAgentDependenciesCli(args);
170
+ (0, registry_core_1.attachCliBinding)("multi-agent.failures", {
171
+ path: ["multi-agent", "failures"],
172
+ jsonMode: "flag",
173
+ handler: (args) => ({
174
+ json: loadMultiAgentCli().multiAgentFailuresCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
175
+ text: loadMultiAgentCli().multiAgentFailuresText({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
176
+ }),
177
+ });
178
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.failures").mcp.handler = (args) => loadMultiAgentCli().multiAgentFailuresCli(args);
179
+ (0, registry_core_1.attachCliBinding)("multi-agent.evidence", {
180
+ path: ["multi-agent", "evidence"],
181
+ jsonMode: "flag",
182
+ handler: (args) => ({
183
+ json: loadMultiAgentCli().multiAgentEvidenceCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
184
+ text: loadMultiAgentCli().multiAgentEvidenceText({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }),
185
+ }),
186
+ });
187
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.evidence").mcp.handler = (args) => loadMultiAgentCli().multiAgentEvidenceCli(args);
188
+ // GAP: `cw multi-agent reasoning <run> [--refresh|--evidence <id>]` — the
189
+ // evidence-adoption reasoning chain (cw_evidence_reasoning /
190
+ // cw_evidence_reasoning_refresh MCP tools were declared but notYetImplemented,
191
+ // and no CLI verb was bound). `--refresh` prints the durable index (JSON only,
192
+ // matching the old handler's printJson refresh arm); otherwise it prints the
193
+ // report (text, or JSON under --json).
194
+ function multiAgentReasoningHandler(args) {
195
+ const call = { runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options };
196
+ if (args.options.refresh && args.options.evidence === undefined && args.options.evidenceId === undefined) {
197
+ return { json: loadMultiAgentCli().multiAgentReasoningRefreshCli(call) };
198
+ }
199
+ return { json: loadMultiAgentCli().multiAgentReasoningCli(call), text: loadMultiAgentCli().multiAgentReasoningText(call) };
200
+ }
201
+ (0, registry_core_1.attachCliBinding)("multi-agent.reasoning", { path: ["multi-agent", "reasoning"], helpPath: ["multi-agent", "reasoning"], jsonMode: "flag", handler: multiAgentReasoningHandler });
202
+ // `multi-agent.reasoning.refresh` (the durable evidence-adoption index) shares
203
+ // the ["multi-agent","reasoning"] dispatch path — `cw multi-agent reasoning
204
+ // <run> --refresh` is served by the reasoning binding above (first row wins).
205
+ // This row exists so the refresh capability also carries a cli binding (the
206
+ // both-surface pairing) and `cw help multi-agent` lists it. Same handler.
207
+ (0, registry_core_1.attachCliBinding)("multi-agent.reasoning.refresh", { path: ["multi-agent", "reasoning"], helpPath: ["multi-agent", "reasoning"], jsonMode: "default", handler: multiAgentReasoningHandler });
208
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.reasoning").mcp.handler = (args) => loadMultiAgentCli().multiAgentReasoningCli(args);
209
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.reasoning.refresh").mcp.handler = (args) => loadMultiAgentCli().multiAgentReasoningRefreshCli(args);
210
+ // GAP: the state-explosion / contract read views (cw_multi_agent_summarize /
211
+ // cw_blackboard_summarize / cw_multi_agent_graph_compact / cw_contract_show)
212
+ // were declared MCP tools left on notYetImplemented, and their CLI verbs were
213
+ // unbound. Wire both surfaces to the ported read fns.
214
+ (0, registry_core_1.attachCliBinding)("multi-agent.summarize", {
215
+ path: ["multi-agent", "summarize"],
216
+ jsonMode: "flag",
217
+ handler: (args) => {
218
+ const result = loadMultiAgentCli().multiAgentSummarizeCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
219
+ return { json: result, text: (0, state_explosion_text_1.formatStateExplosionReport)(result) };
220
+ },
221
+ });
222
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.summarize").mcp.handler = (args) => loadMultiAgentCli().multiAgentSummarizeCli(args);
223
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.graph.compact").mcp.handler = (args) => loadMultiAgentCli().multiAgentGraphCompactCli(args);
224
+ (0, registry_core_1.attachCliBinding)("blackboard.summarize", {
225
+ path: ["blackboard", "summarize"],
226
+ jsonMode: "flag",
227
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardSummarizeCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
228
+ });
229
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.summarize").mcp.handler = (args) => loadMultiAgentCli().blackboardSummarizeCli(args);
230
+ (0, registry_core_1.attachCliBinding)("contract.show", {
231
+ path: ["contract", "show"],
232
+ jsonMode: "default",
233
+ handler: (args) => ({ json: loadMultiAgentCli().contractShowCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }, args.positionals[1]) }),
234
+ });
235
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("contract.show").mcp.handler = (args) => loadMultiAgentCli().contractShowCli(args);
236
+ (0, registry_core_1.attachCliBinding)("multi-agent.run.create", {
237
+ path: ["multi-agent", "role"],
238
+ helpPath: ["multi-agent", "role"],
239
+ jsonMode: "default",
240
+ handler: (args) => ({
241
+ json: loadMultiAgentCli().multiAgentRoleCli({
242
+ ...args.options,
243
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
244
+ roleId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.roleId,
245
+ }),
246
+ }),
247
+ });
248
+ (0, registry_core_1.attachCliBinding)("multi-agent.group.create", {
249
+ path: ["multi-agent", "group"],
250
+ helpPath: ["multi-agent", "group"],
251
+ jsonMode: "default",
252
+ handler: (args) => ({
253
+ json: loadMultiAgentCli().multiAgentGroupCli({
254
+ ...args.options,
255
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
256
+ groupId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.groupId,
257
+ }),
258
+ }),
259
+ });
260
+ (0, registry_core_1.attachCliBinding)("multi-agent.membership.create", {
261
+ path: ["multi-agent", "membership"],
262
+ helpPath: ["multi-agent", "membership"],
263
+ jsonMode: "default",
264
+ handler: (args) => ({
265
+ json: loadMultiAgentCli().multiAgentMembershipCli({
266
+ ...args.options,
267
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
268
+ membershipId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.membershipId,
269
+ }),
270
+ }),
271
+ });
272
+ (0, registry_core_1.attachCliBinding)("multi-agent.fanout.create", {
273
+ path: ["multi-agent", "fanout"],
274
+ helpPath: ["multi-agent", "fanout"],
275
+ jsonMode: "default",
276
+ handler: (args) => ({
277
+ json: loadMultiAgentCli().multiAgentFanoutCli({
278
+ ...args.options,
279
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
280
+ fanoutId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.fanoutId,
281
+ }),
282
+ }),
283
+ });
284
+ (0, registry_core_1.attachCliBinding)("multi-agent.fanin.collect", {
285
+ path: ["multi-agent", "fanin"],
286
+ helpPath: ["multi-agent", "fanin"],
287
+ jsonMode: "default",
288
+ handler: (args) => ({
289
+ json: loadMultiAgentCli().multiAgentFaninCli({
290
+ ...args.options,
291
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
292
+ faninId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.faninId,
293
+ }),
294
+ }),
295
+ });
296
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.run.create").mcp.handler = (args) => loadMultiAgentCli().multiAgentRoleCli(args);
297
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.role.create").mcp.handler = (args) => loadMultiAgentCli().multiAgentRoleCli(args);
298
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.group.create").mcp.handler = (args) => loadMultiAgentCli().multiAgentGroupCli(args);
299
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.membership.create").mcp.handler = (args) => loadMultiAgentCli().multiAgentMembershipCli(args);
300
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.fanout.create").mcp.handler = (args) => loadMultiAgentCli().multiAgentFanoutCli(args);
301
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.fanin.collect").mcp.handler = (args) => loadMultiAgentCli().multiAgentFaninCli(args);
302
+ // GAP: the *.show MCP tools were declared but left notYetImplemented. Route
303
+ // each to its create CLI fn's read arm (id-only args return the record).
304
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.role.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentRoleCli({ ...args, roleId: args.roleId ?? args.id });
305
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.group.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentGroupCli({ ...args, groupId: args.groupId ?? args.id });
306
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.membership.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentMembershipCli({ ...args, membershipId: args.membershipId ?? args.id });
307
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.fanout.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentFanoutCli({ ...args, fanoutId: args.fanoutId ?? args.id });
308
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.fanin.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentFaninCli({ ...args, faninId: args.faninId ?? args.id });
309
+ // The create/show pairs for role/group/membership/fanout/fanin each SHARE
310
+ // one dispatch path (["multi-agent","role"] etc.); `cw multi-agent role
311
+ // <run> [id]` is served by the create binding declared above (first row
312
+ // wins findCapabilityByCliPath), and an id-only invocation returns the
313
+ // existing record (the read arm). These extra rows exist so each show
314
+ // capability — and multi-agent.role.create, distinct from the
315
+ // multi-agent.run.create binding that already owns the ["multi-agent",
316
+ // "role"] path — also carries a cli binding (the both-surface pairing),
317
+ // exactly like blackboard.message.post/list. Same handler, same shell fn.
318
+ function multiAgentRoleHandler(args) {
319
+ return {
320
+ json: loadMultiAgentCli().multiAgentRoleCli({
321
+ ...args.options,
322
+ runId: (0, io_1.required)(args.positionals[0], "run id"),
323
+ roleId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.roleId,
324
+ }),
325
+ };
326
+ }
327
+ (0, registry_core_1.attachCliBinding)("multi-agent.role.create", { path: ["multi-agent", "role"], helpPath: ["multi-agent", "role"], jsonMode: "default", handler: multiAgentRoleHandler });
328
+ (0, registry_core_1.attachCliBinding)("multi-agent.role.show", { path: ["multi-agent", "role"], helpPath: ["multi-agent", "role"], jsonMode: "default", handler: multiAgentRoleHandler });
329
+ (0, registry_core_1.attachCliBinding)("multi-agent.group.show", {
330
+ path: ["multi-agent", "group"],
331
+ helpPath: ["multi-agent", "group"],
332
+ jsonMode: "default",
333
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentGroupCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), groupId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.groupId }) }),
334
+ });
335
+ (0, registry_core_1.attachCliBinding)("multi-agent.membership.show", {
336
+ path: ["multi-agent", "membership"],
337
+ helpPath: ["multi-agent", "membership"],
338
+ jsonMode: "default",
339
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentMembershipCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), membershipId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.membershipId }) }),
340
+ });
341
+ (0, registry_core_1.attachCliBinding)("multi-agent.fanout.show", {
342
+ path: ["multi-agent", "fanout"],
343
+ helpPath: ["multi-agent", "fanout"],
344
+ jsonMode: "default",
345
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentFanoutCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), fanoutId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.fanoutId }) }),
346
+ });
347
+ (0, registry_core_1.attachCliBinding)("multi-agent.fanin.show", {
348
+ path: ["multi-agent", "fanin"],
349
+ helpPath: ["multi-agent", "fanin"],
350
+ jsonMode: "default",
351
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentFaninCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id"), faninId: args.options.id === undefined && args.positionals.length >= 2 ? args.positionals[1] : args.options.faninId }) }),
352
+ });
353
+ (0, registry_core_1.attachCliBinding)("multi-agent.run.transition", {
354
+ path: ["multi-agent", "transition"],
355
+ jsonMode: "default",
356
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentRunCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
357
+ });
358
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.run.transition").mcp.handler = (args) => loadMultiAgentCli().multiAgentRunCli(args);
359
+ (0, registry_core_1.attachCliBinding)("multi-agent.run.show", {
360
+ path: ["multi-agent", "show"],
361
+ jsonMode: "default",
362
+ handler: (args) => ({ json: loadMultiAgentCli().multiAgentShowCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }, (0, io_1.required)(args.positionals[1], "id")) }),
363
+ });
364
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("multi-agent.run.show").mcp.handler = (args) => loadMultiAgentCli().multiAgentShowCli(args, (0, io_1.required)((0, io_1.optionalArg)(args.multiAgentRunId ?? args.id), "id"));
365
+ // ---- blackboard / coordinator -------------------------------------------
366
+ (0, registry_core_1.attachCliBinding)("blackboard.summary", {
367
+ path: ["blackboard", "summary"],
368
+ jsonMode: "default",
369
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardSummaryCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
370
+ });
371
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.summary").mcp.handler = (args) => loadMultiAgentCli().blackboardSummaryCli(args);
372
+ (0, registry_core_1.attachCliBinding)("blackboard.graph", {
373
+ path: ["blackboard", "graph"],
374
+ jsonMode: "default",
375
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardGraphCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
376
+ });
377
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.graph").mcp.handler = (args) => loadMultiAgentCli().blackboardGraphCli(args);
378
+ (0, registry_core_1.attachCliBinding)("blackboard.resolve", {
379
+ path: ["blackboard", "resolve"],
380
+ jsonMode: "default",
381
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardResolveCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
382
+ });
383
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.resolve").mcp.handler = (args) => loadMultiAgentCli().blackboardResolveCli(args);
384
+ // GAP: the blackboard write/read verbs accept the sub-verb's ACTION word
385
+ // ("create"/"post"/"put"/"add"/"list") in EITHER of two slots around the run
386
+ // id, per the smokes' varied spellings:
387
+ // blackboard topic <run> (create, run first)
388
+ // blackboard topic create <run> (create action FIRST)
389
+ // blackboard message <run> (post, run first)
390
+ // blackboard message <run> list (list action AFTER run)
391
+ // blackboard message list <run> (list action FIRST)
392
+ // blackboard message post <run> (post action FIRST)
393
+ // dispatchTable already consumed the sub-verb ("topic"/"message"/…), so the
394
+ // handler's positionals begin at the token AFTER it. `blackboardRunAndAction`
395
+ // strips a leading action word (if present) so the run id is found wherever it
396
+ // sits, and reports the effective action word for the post/list split.
397
+ const BLACKBOARD_ACTION_WORDS = new Set(["create", "post", "put", "add", "list", "show"]);
398
+ function blackboardRunAndAction(args) {
399
+ const [first, second] = args.positionals;
400
+ if (first !== undefined && BLACKBOARD_ACTION_WORDS.has(first)) {
401
+ return { runId: (0, io_1.required)(second, "run id"), action: first };
402
+ }
403
+ return { runId: (0, io_1.required)(first, "run id"), action: second };
404
+ }
405
+ (0, registry_core_1.attachCliBinding)("blackboard.topic.create", {
406
+ path: ["blackboard", "topic"],
407
+ helpPath: ["blackboard", "topic", "create"],
408
+ jsonMode: "default",
409
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardTopicCreateCli({ ...args.options, runId: blackboardRunAndAction(args).runId }) }),
410
+ });
411
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.topic.create").mcp.handler = (args) => loadMultiAgentCli().blackboardTopicCreateCli(args);
412
+ function blackboardMessageHandler(args) {
413
+ const { runId, action } = blackboardRunAndAction(args);
414
+ if (action === "list")
415
+ return { json: loadMultiAgentCli().blackboardMessageListCli({ ...args.options, runId }) };
416
+ return { json: loadMultiAgentCli().blackboardMessagePostCli({ ...args.options, runId }) };
417
+ }
418
+ (0, registry_core_1.attachCliBinding)("blackboard.message.post", { path: ["blackboard", "message"], helpPath: ["blackboard", "message", "post"], jsonMode: "default", handler: blackboardMessageHandler });
419
+ (0, registry_core_1.attachCliBinding)("blackboard.message.list", { path: ["blackboard", "message"], helpPath: ["blackboard", "message", "list"], jsonMode: "default", handler: blackboardMessageHandler });
420
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.message.post").mcp.handler = (args) => loadMultiAgentCli().blackboardMessagePostCli(args);
421
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.message.list").mcp.handler = (args) => loadMultiAgentCli().blackboardMessageListCli(args);
422
+ (0, registry_core_1.attachCliBinding)("blackboard.context.put", {
423
+ path: ["blackboard", "context"],
424
+ helpPath: ["blackboard", "context", "put"],
425
+ jsonMode: "default",
426
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardContextPutCli({ ...args.options, runId: blackboardRunAndAction(args).runId }) }),
427
+ });
428
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.context.put").mcp.handler = (args) => loadMultiAgentCli().blackboardContextPutCli(args);
429
+ function blackboardArtifactHandler(args) {
430
+ const { runId, action } = blackboardRunAndAction(args);
431
+ if (action === "list")
432
+ return { json: loadMultiAgentCli().blackboardArtifactListCli({ ...args.options, runId }) };
433
+ return { json: loadMultiAgentCli().blackboardArtifactAddCli({ ...args.options, runId }) };
434
+ }
435
+ (0, registry_core_1.attachCliBinding)("blackboard.artifact.add", { path: ["blackboard", "artifact"], helpPath: ["blackboard", "artifact", "add"], jsonMode: "default", handler: blackboardArtifactHandler });
436
+ (0, registry_core_1.attachCliBinding)("blackboard.artifact.list", { path: ["blackboard", "artifact"], helpPath: ["blackboard", "artifact", "list"], jsonMode: "default", handler: blackboardArtifactHandler });
437
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.artifact.add").mcp.handler = (args) => loadMultiAgentCli().blackboardArtifactAddCli(args);
438
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.artifact.list").mcp.handler = (args) => loadMultiAgentCli().blackboardArtifactListCli(args);
439
+ (0, registry_core_1.attachCliBinding)("blackboard.snapshot", {
440
+ path: ["blackboard", "snapshot"],
441
+ jsonMode: "default",
442
+ handler: (args) => ({ json: loadMultiAgentCli().blackboardSnapshotCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
443
+ });
444
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("blackboard.snapshot").mcp.handler = (args) => loadMultiAgentCli().blackboardSnapshotCli(args);
445
+ (0, registry_core_1.attachCliBinding)("coordinator.summary", {
446
+ path: ["coordinator", "summary"],
447
+ jsonMode: "default",
448
+ handler: (args) => ({ json: loadMultiAgentCli().coordinatorSummaryCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
449
+ });
450
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("coordinator.summary").mcp.handler = (args) => loadMultiAgentCli().coordinatorSummaryCli(args);
451
+ (0, registry_core_1.attachCliBinding)("coordinator.decision", {
452
+ path: ["coordinator", "decision"],
453
+ jsonMode: "default",
454
+ handler: (args) => ({ json: loadMultiAgentCli().coordinatorDecisionCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
455
+ });
456
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("coordinator.decision").mcp.handler = (args) => loadMultiAgentCli().coordinatorDecisionCli(args);
457
+ // ---- candidate scoring ----------------------------------------------------
458
+ (0, registry_core_1.attachCliBinding)("candidate.list", {
459
+ path: ["candidate", "list"],
460
+ jsonMode: "default",
461
+ handler: (args) => ({ json: loadMultiAgentCli().candidateListCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
462
+ });
463
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.list").mcp.handler = (args) => loadMultiAgentCli().candidateListCli(args);
464
+ (0, registry_core_1.attachCliBinding)("candidate.show", {
465
+ path: ["candidate", "show"],
466
+ jsonMode: "default",
467
+ handler: (args) => ({ json: loadMultiAgentCli().candidateShowCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }, (0, io_1.required)(args.positionals[1], "candidate id")) }),
468
+ });
469
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.show").mcp.handler = (args) => loadMultiAgentCli().candidateShowCli(args, (0, io_1.required)((0, io_1.optionalArg)(args.candidateId), "candidate id"));
470
+ (0, registry_core_1.attachCliBinding)("candidate.register", {
471
+ path: ["candidate", "register"],
472
+ jsonMode: "default",
473
+ handler: (args) => ({ json: loadMultiAgentCli().candidateRegisterCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
474
+ });
475
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.register").mcp.handler = (args) => loadMultiAgentCli().candidateRegisterCli(args);
476
+ (0, registry_core_1.attachCliBinding)("candidate.score", {
477
+ path: ["candidate", "score"],
478
+ jsonMode: "default",
479
+ handler: (args) => ({ json: loadMultiAgentCli().candidateScoreCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }, (0, io_1.required)(args.positionals[1], "candidate id")) }),
480
+ });
481
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.score").mcp.handler = (args) => loadMultiAgentCli().candidateScoreCli(args, (0, io_1.required)((0, io_1.optionalArg)(args.candidateId), "candidate id"));
482
+ (0, registry_core_1.attachCliBinding)("candidate.rank", {
483
+ path: ["candidate", "rank"],
484
+ jsonMode: "default",
485
+ handler: (args) => ({ json: loadMultiAgentCli().candidateRankCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options }) }),
486
+ });
487
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.rank").mcp.handler = (args) => loadMultiAgentCli().candidateRankCli(args);
488
+ (0, registry_core_1.attachCliBinding)("candidate.select", {
489
+ path: ["candidate", "select"],
490
+ jsonMode: "default",
491
+ handler: (args) => ({ json: loadMultiAgentCli().candidateSelectCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }, (0, io_1.required)(args.positionals[1], "candidate id")) }),
492
+ });
493
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.select").mcp.handler = (args) => loadMultiAgentCli().candidateSelectCli(args, (0, io_1.required)((0, io_1.optionalArg)(args.candidateId), "candidate id"));
494
+ (0, registry_core_1.attachCliBinding)("candidate.reject", {
495
+ path: ["candidate", "reject"],
496
+ jsonMode: "default",
497
+ handler: (args) => ({ json: loadMultiAgentCli().candidateRejectCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }, (0, io_1.required)(args.positionals[1], "candidate id")) }),
498
+ });
499
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.reject").mcp.handler = (args) => loadMultiAgentCli().candidateRejectCli(args, (0, io_1.required)((0, io_1.optionalArg)(args.candidateId), "candidate id"));
500
+ // jsonMode "flag": human `Candidates` panel by default, canonical JSON under
501
+ // --json (old build's candidate.summary was flag).
502
+ (0, registry_core_1.attachCliBinding)("candidate.summary", {
503
+ path: ["candidate", "summary"],
504
+ jsonMode: "flag",
505
+ handler: (args) => {
506
+ const summary = loadMultiAgentCli().candidateSummaryCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
507
+ return { json: summary, text: `${loadOperatorUxText().formatCandidateSummaryText(summary)}\n` };
508
+ },
509
+ });
510
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("candidate.summary").mcp.handler = (args) => loadMultiAgentCli().candidateSummaryCli(args);
511
+ // ---- collaboration ---------------------------------------------------------
512
+ (0, registry_core_1.attachCliBinding)("approve", {
513
+ path: ["approve"],
514
+ jsonMode: "default",
515
+ handler: (args) => ({ json: loadMultiAgentCli().approveCli({ ...args.options, runId: (0, io_1.required)(args.positionals[1], "run id"), body: args.positionals[3] }, args.positionals[0], args.positionals[2]) }),
516
+ });
517
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("approve").mcp.handler = (args) => loadMultiAgentCli().approveCli(args);
518
+ (0, registry_core_1.attachCliBinding)("reject", {
519
+ path: ["reject"],
520
+ jsonMode: "default",
521
+ handler: (args) => ({ json: loadMultiAgentCli().rejectCollabCli({ ...args.options, runId: (0, io_1.required)(args.positionals[1], "run id") }, args.positionals[0], args.positionals[2]) }),
522
+ });
523
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("reject").mcp.handler = (args) => loadMultiAgentCli().rejectCollabCli(args);
524
+ (0, registry_core_1.attachCliBinding)("comment.add", {
525
+ path: ["comment", "add"],
526
+ jsonMode: "default",
527
+ handler: (args) => ({ json: loadMultiAgentCli().commentAddCli({ ...args.options, runId: (0, io_1.required)(args.positionals[1], "run id"), body: args.options.body ?? args.positionals[3] }, args.positionals[0], args.positionals[2]) }),
528
+ });
529
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("comment.add").mcp.handler = (args) => loadMultiAgentCli().commentAddCli(args);
530
+ // jsonMode "flag": human comment list by default, canonical JSON under
531
+ // --json (old build's comment.list was flag).
532
+ (0, registry_core_1.attachCliBinding)("comment.list", {
533
+ path: ["comment", "list"],
534
+ jsonMode: "flag",
535
+ handler: (args) => {
536
+ const report = loadMultiAgentCli().commentListCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
537
+ return { json: report, text: `${loadCollaborationIo().formatCommentList(report)}\n` };
538
+ },
539
+ });
540
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("comment.list").mcp.handler = (args) => loadMultiAgentCli().commentListCli(args);
541
+ (0, registry_core_1.attachCliBinding)("handoff", {
542
+ path: ["handoff"],
543
+ jsonMode: "default",
544
+ // `cw handoff <kind> <run-id> [target-id]` (byte-behavior port of the old
545
+ // build's handleHandoff): the FIRST required() is on the target-kind
546
+ // positional, so a bare `cw handoff` fails with "Missing target kind" — not
547
+ // "Missing run id". The kind check must fire before the run-id read.
548
+ handler: (args) => {
549
+ const kind = (0, io_1.required)(args.positionals[0], "target kind");
550
+ const runId = (0, io_1.required)(args.positionals[1], "run id");
551
+ return { json: loadMultiAgentCli().handoffCli({ ...args.options, runId }, kind, args.positionals[2]) };
552
+ },
553
+ });
554
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("handoff").mcp.handler = (args) => loadMultiAgentCli().handoffCli(args);
555
+ // jsonMode "flag": human review-status report by default, canonical JSON
556
+ // under --json (old build's review.status was flag).
557
+ (0, registry_core_1.attachCliBinding)("review.status", {
558
+ path: ["review", "status"],
559
+ jsonMode: "flag",
560
+ handler: (args) => {
561
+ const report = loadMultiAgentCli().reviewStatusCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
562
+ return { json: report, text: `${loadCollaborationIo().formatReviewStatus(report)}\n` };
563
+ },
564
+ });
565
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("review.status").mcp.handler = (args) => loadMultiAgentCli().reviewStatusCli(args);
566
+ (0, registry_core_1.attachCliBinding)("review.policy", {
567
+ path: ["review", "policy"],
568
+ jsonMode: "default",
569
+ handler: (args) => ({ json: loadMultiAgentCli().reviewPolicyCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") }) }),
570
+ });
571
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("review.policy").mcp.handler = (args) => loadMultiAgentCli().reviewPolicyCli(args);
572
+ // ---- eval replay harness ---------------------------------------------------
573
+ // eval snapshot|replay|compare|score|gate|report — `jsonMode: flag` so a bare
574
+ // call renders the human eval report (formatMultiAgentEval) and `--json`
575
+ // prints the result object, matching the old build's eval handler.
576
+ (0, registry_core_1.attachCliBinding)("eval.snapshot", {
577
+ path: ["eval", "snapshot"],
578
+ jsonMode: "flag",
579
+ handler: (args) => {
580
+ const result = loadMultiAgentCli().evalSnapshotCli({ runId: (0, io_1.required)(args.positionals[0], "run id"), ...args.options });
581
+ return { json: result, text: loadEvalText().formatMultiAgentEval(result) };
582
+ },
583
+ });
584
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.snapshot").mcp.handler = (args) => loadMultiAgentCli().evalSnapshotCli(args);
585
+ (0, registry_core_1.attachCliBinding)("eval.replay", {
586
+ path: ["eval", "replay"],
587
+ jsonMode: "flag",
588
+ handler: (args) => {
589
+ const result = loadMultiAgentCli().evalReplayCli({ snapshot: args.positionals[0], ...args.options });
590
+ return { json: result, text: loadEvalText().formatMultiAgentEval(result) };
591
+ },
592
+ });
593
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.replay").mcp.handler = (args) => loadMultiAgentCli().evalReplayCli(args);
594
+ (0, registry_core_1.attachCliBinding)("eval.compare", {
595
+ path: ["eval", "compare"],
596
+ jsonMode: "flag",
597
+ handler: (args) => {
598
+ const result = loadMultiAgentCli().evalCompareCli({ baseline: args.positionals[0], replay: args.positionals[1], ...args.options });
599
+ return { json: result, text: loadEvalText().formatMultiAgentEval(result) };
600
+ },
601
+ });
602
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.compare").mcp.handler = (args) => loadMultiAgentCli().evalCompareCli(args);
603
+ (0, registry_core_1.attachCliBinding)("eval.score", {
604
+ path: ["eval", "score"],
605
+ jsonMode: "flag",
606
+ handler: (args) => {
607
+ const result = loadMultiAgentCli().evalScoreCli({ replay: args.positionals[0], ...args.options });
608
+ return { json: result, text: loadEvalText().formatMultiAgentEval(result) };
609
+ },
610
+ });
611
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.score").mcp.handler = (args) => loadMultiAgentCli().evalScoreCli(args);
612
+ (0, registry_core_1.attachCliBinding)("eval.gate", {
613
+ path: ["eval", "gate"],
614
+ jsonMode: "flag",
615
+ handler: (args) => {
616
+ const gate = loadMultiAgentCli().evalGateCli({ suite: args.positionals[0], ...args.options });
617
+ return { json: gate, text: loadEvalText().formatMultiAgentEval(gate), exitCode: gate.verdict === "ship" ? undefined : 1 };
618
+ },
619
+ });
620
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.gate").mcp.handler = (args) => loadMultiAgentCli().evalGateCli(args);
621
+ (0, registry_core_1.attachCliBinding)("eval.report", {
622
+ path: ["eval", "report"],
623
+ jsonMode: "flag",
624
+ handler: (args) => {
625
+ const result = loadMultiAgentCli().evalReportCli({ replay: args.positionals[0], ...args.options });
626
+ return { json: result, text: loadEvalText().formatMultiAgentEval(result) };
627
+ },
628
+ });
629
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("eval.report").mcp.handler = (args) => loadMultiAgentCli().evalReportCli(args);
630
+ // ---------------------------------------------------------------------