cool-workflow 0.2.0 → 0.2.2

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