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,435 @@
1
+ "use strict";
2
+ // wiring/capability-table/reporting.ts — MILESTONE 11 (reporting,
3
+ // observability, doctor/fix, workbench, run summary/status/operator,
4
+ // worker.*, feedback.*, audit.*) CLI bindings. Split out of
5
+ // core/capability-table.ts, byte-for-byte (extracted with sed, not
6
+ // retyped).
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ const registry_core_1 = require("./registry-core");
42
+ const io_1 = require("../../cli/io");
43
+ const state_explosion_text_1 = require("../../core/format/state-explosion-text");
44
+ // This file is required at startup for every command. Loading these shell
45
+ // modules only when their handler runs, not at import time, keeps that
46
+ // load cost out of commands that never touch reporting/status/graph.
47
+ function loadStateExplosionCli() {
48
+ return require("../../shell/state-explosion-cli");
49
+ }
50
+ function loadRunStore() {
51
+ return require("../../shell/run-store");
52
+ }
53
+ // MILESTONE 11 (reporting, observability, doctor/fix, workbench, run
54
+ // export/bundle) CLI bindings: report, status (real run id), graph,
55
+ // operator.status|report|graph. Handler bodies live in shell/report-
56
+ // view-cli.ts (impure — they load run state and, for `report`/`operator
57
+ // report`, re-write report.md); this table only wires argv shape ->
58
+ // handler call, per cli/dispatch.ts's generic executor contract.
59
+ // ---------------------------------------------------------------------
60
+ function loadReportViewCli() {
61
+ return require("../../shell/report-view-cli");
62
+ }
63
+ function loadOperatorUxText() {
64
+ return require("../../shell/operator-ux-text");
65
+ }
66
+ (0, registry_core_1.attachCliBinding)("report", {
67
+ path: ["report"],
68
+ jsonMode: "flag",
69
+ handler: (args) => {
70
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
71
+ const reportViewCli = loadReportViewCli();
72
+ const result = reportViewCli.reportWriteCli(runId, args.options);
73
+ if (args.options.show || args.options.summary) {
74
+ const stateExplosion = (0, state_explosion_text_1.formatStateExplosionReport)(loadStateExplosionCli().summaryShowCli(runId, args.options));
75
+ return { json: result, text: `${reportViewCli.operatorReportText(runId, args.options)}\n\n${stateExplosion}\n` };
76
+ }
77
+ return { json: result, text: `${result.path}\n` };
78
+ },
79
+ });
80
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("report").mcp.handler = (args) => loadReportViewCli().reportWriteCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
81
+ // `status` already carries a milestone-2 CLI binding (`attachCliBinding("status", ...)`
82
+ // above); replace its handler here with the real run-id-aware body while
83
+ // keeping the same row/path (no reshape needed — see byte-compat item 5).
84
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").cli = {
85
+ path: ["status"],
86
+ jsonMode: "flag",
87
+ handler: (args) => {
88
+ // `cw status <id>` (positional) and `cw status --run <id>` must both
89
+ // resolve the same run — the flag form used to be silently ignored
90
+ // (positionals[0] only), so a bogus id given via --run and a real one
91
+ // looked identical ("No run selected" for both).
92
+ const runId = (0, io_1.optionalArg)(args.positionals[0]) || (0, io_1.optionalArg)(args.options.run) || (0, io_1.optionalArg)(args.options.runId);
93
+ const reportViewCli = loadReportViewCli();
94
+ if (!runId)
95
+ return { json: reportViewCli.statusCli(undefined, args.options), text: `No run selected\n\nNext Action\n${adviseNoRunLines()}` };
96
+ if (args.options.summary || args.options.brief) {
97
+ return { json: reportViewCli.statusCli(runId, args.options), text: `${reportViewCli.statusSummaryText(runId, args.options)}\n` };
98
+ }
99
+ return { json: reportViewCli.statusCli(runId, args.options), text: `${reportViewCli.statusFullText(runId, args.options)}\n` };
100
+ },
101
+ };
102
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").mcp.handler = (args) => loadReportViewCli().statusCli((0, io_1.optionalArg)(args.runId), args);
103
+ function adviseNoRunLines() {
104
+ return " cw plan <workflow-id> --repo <path>\n reason: No run id is available yet; create a workflow run before dispatching or recording evidence.\n";
105
+ }
106
+ (0, registry_core_1.attachCliBinding)("graph", {
107
+ path: ["graph"],
108
+ jsonMode: "flag",
109
+ handler: (args) => {
110
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
111
+ const reportViewCli = loadReportViewCli();
112
+ return { json: reportViewCli.graphCli(runId, args.options), text: `${reportViewCli.graphText(runId, args.options)}\n` };
113
+ },
114
+ });
115
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("graph").mcp.handler = (args) => loadReportViewCli().graphCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
116
+ (0, registry_core_1.attachCliBinding)("operator.status", {
117
+ path: ["operator", "status"],
118
+ jsonMode: "flag",
119
+ handler: (args) => {
120
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
121
+ const reportViewCli = loadReportViewCli();
122
+ if (args.options.summary || args.options.brief) {
123
+ return { json: reportViewCli.operatorStatusCli(runId, args.options), text: `${reportViewCli.statusSummaryText(runId, args.options)}\n` };
124
+ }
125
+ return { json: reportViewCli.operatorStatusCli(runId, args.options), text: `${reportViewCli.statusFullText(runId, args.options)}\n` };
126
+ },
127
+ });
128
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.status").mcp.handler = (args) => loadReportViewCli().operatorStatusCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
129
+ (0, registry_core_1.attachCliBinding)("operator.report", {
130
+ path: ["operator", "report"],
131
+ jsonMode: "flag",
132
+ handler: (args) => {
133
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
134
+ const reportViewCli = loadReportViewCli();
135
+ return { json: reportViewCli.operatorReportCli(runId, args.options), text: `${reportViewCli.operatorReportText(runId, args.options)}\n` };
136
+ },
137
+ });
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.report").mcp.handler = (args) => loadReportViewCli().operatorReportCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
139
+ // ---- metrics.show / metrics.summary -----------------------------------
140
+ function loadMetricsCli() {
141
+ return require("../../shell/metrics-cli");
142
+ }
143
+ function loadObservability() {
144
+ return require("../../shell/observability");
145
+ }
146
+ (0, registry_core_1.attachCliBinding)("metrics.show", {
147
+ path: ["metrics", "show"],
148
+ jsonMode: "flag",
149
+ handler: (args) => {
150
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
151
+ const report = loadMetricsCli().metricsShowCli(runId, args.options);
152
+ return { json: report, text: `${loadObservability().formatMetricsReport(report)}\n` };
153
+ },
154
+ });
155
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("metrics.show").mcp.handler = (args) => loadMetricsCli().metricsShowCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
156
+ (0, registry_core_1.attachCliBinding)("metrics.summary", {
157
+ path: ["metrics", "summary"],
158
+ jsonMode: "flag",
159
+ handler: (args) => {
160
+ const report = loadMetricsCli().metricsSummaryCli(args.options);
161
+ return { json: report, text: `${loadObservability().formatMetricsSummary(report)}\n` };
162
+ },
163
+ });
164
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("metrics.summary").mcp.handler = (args) => loadMetricsCli().metricsSummaryCli(args);
165
+ // ---- worker.summary (the workbench worker panel + `cw worker summary`) ----
166
+ function loadWorkerIsolation() {
167
+ return require("../../shell/worker-isolation");
168
+ }
169
+ const workerPath = __importStar(require("node:path"));
170
+ function workerSummaryCli(args) {
171
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
172
+ const run = loadRunStore().loadRunFromCwd(runId, invocationCwdFor(args));
173
+ return loadWorkerIsolation().summarizeWorkers(run);
174
+ }
175
+ function workerSummaryText(args) {
176
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
177
+ const run = loadRunStore().loadRunFromCwd(runId, invocationCwdFor(args));
178
+ return loadWorkerIsolation().formatWorkerSummaryText(run);
179
+ }
180
+ function invocationCwdFor(args) {
181
+ return typeof args.cwd === "string" && args.cwd.trim() ? workerPath.resolve(args.cwd) : process.cwd();
182
+ }
183
+ // jsonMode "flag": human `Workers` panel by default, canonical JSON under
184
+ // --json (old build's worker.summary was flag, cli/handlers/worker.ts).
185
+ (0, registry_core_1.attachCliBinding)("worker.summary", {
186
+ path: ["worker", "summary"],
187
+ jsonMode: "flag",
188
+ handler: (args) => ({
189
+ json: workerSummaryCli({ ...args.options, runId: args.positionals[0] }),
190
+ text: `${workerSummaryText({ ...args.options, runId: args.positionals[0] })}\n`,
191
+ }),
192
+ });
193
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.summary").mcp.handler = (args) => workerSummaryCli(args);
194
+ // ---- worker list|show|manifest|output|fail|validate (CLI + MCP) ----------
195
+ // Each worker lifecycle verb over a run. The old build routed all of these
196
+ // via src/cli/handlers/worker.ts; v2 shipped only worker.summary bound, so the
197
+ // rest fell through to the worker.usage error. positionals: [runId, workerId,
198
+ // resultFile].
199
+ function loadWorkerCli() {
200
+ return require("../../shell/worker-cli");
201
+ }
202
+ (0, registry_core_1.attachCliBinding)("worker.list", {
203
+ path: ["worker", "list"],
204
+ jsonMode: "default",
205
+ handler: (args) => ({ json: loadWorkerCli().workerListCli({ ...args.options, runId: args.positionals[0] }) }),
206
+ });
207
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.list").mcp.handler = (args) => loadWorkerCli().workerListCli(args);
208
+ (0, registry_core_1.attachCliBinding)("worker.show", {
209
+ path: ["worker", "show"],
210
+ jsonMode: "default",
211
+ handler: (args) => ({ json: loadWorkerCli().workerShowCli({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1] }) }),
212
+ });
213
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.show").mcp.handler = (args) => loadWorkerCli().workerShowCli(args);
214
+ (0, registry_core_1.attachCliBinding)("worker.manifest", {
215
+ path: ["worker", "manifest"],
216
+ jsonMode: "default",
217
+ handler: (args) => ({ json: loadWorkerCli().workerManifestCli({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1] }) }),
218
+ });
219
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.manifest").mcp.handler = (args) => loadWorkerCli().workerManifestCli(args);
220
+ (0, registry_core_1.attachCliBinding)("worker.output", {
221
+ path: ["worker", "output"],
222
+ jsonMode: "default",
223
+ handler: (args) => ({ json: loadWorkerCli().workerOutputCli({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] }) }),
224
+ });
225
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.output").mcp.handler = (args) => loadWorkerCli().workerOutputCli(args);
226
+ (0, registry_core_1.attachCliBinding)("worker.fail", {
227
+ path: ["worker", "fail"],
228
+ jsonMode: "default",
229
+ handler: (args) => ({ json: loadWorkerCli().workerFailCli({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] }) }),
230
+ });
231
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.fail").mcp.handler = (args) => loadWorkerCli().workerFailCli(args);
232
+ (0, registry_core_1.attachCliBinding)("worker.validate", {
233
+ path: ["worker", "validate"],
234
+ jsonMode: "default",
235
+ handler: (args) => {
236
+ const { violation, exitCode } = loadWorkerCli().workerValidateCli({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] });
237
+ return { json: violation, exitCode };
238
+ },
239
+ });
240
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.validate").mcp.handler = (args) => loadWorkerCli().workerValidateCli(args).violation;
241
+ // ---- feedback list|show|summary|collect|task|resolve (CLI + MCP) ---------
242
+ // The operator feedback lifecycle. MCP rows were declared but stubbed
243
+ // (notYetImplemented) and no CLI verb was bound; the old build routed all of
244
+ // these. positionals: [runId, feedbackId].
245
+ function loadFeedbackCli() {
246
+ return require("../../shell/feedback-cli");
247
+ }
248
+ // jsonMode "flag": human `Feedback` panel by default, canonical JSON under
249
+ // --json (old build's feedback.summary was flag).
250
+ (0, registry_core_1.attachCliBinding)("feedback.summary", {
251
+ path: ["feedback", "summary"],
252
+ jsonMode: "flag",
253
+ handler: (args) => {
254
+ const summary = loadFeedbackCli().feedbackSummaryCli({ ...args.options, runId: args.positionals[0] });
255
+ return { json: summary, text: `${loadOperatorUxText().formatFeedbackSummaryText(summary)}\n` };
256
+ },
257
+ });
258
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.summary").mcp.handler = (args) => loadFeedbackCli().feedbackSummaryCli(args);
259
+ (0, registry_core_1.attachCliBinding)("feedback.list", {
260
+ path: ["feedback", "list"],
261
+ jsonMode: "default",
262
+ handler: (args) => ({ json: loadFeedbackCli().feedbackListCli({ ...args.options, runId: args.positionals[0] }) }),
263
+ });
264
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.list").mcp.handler = (args) => loadFeedbackCli().feedbackListCli(args);
265
+ (0, registry_core_1.attachCliBinding)("feedback.show", {
266
+ path: ["feedback", "show"],
267
+ jsonMode: "default",
268
+ handler: (args) => ({ json: loadFeedbackCli().feedbackShowCli({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
269
+ });
270
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.show").mcp.handler = (args) => loadFeedbackCli().feedbackShowCli(args);
271
+ (0, registry_core_1.attachCliBinding)("feedback.collect", {
272
+ path: ["feedback", "collect"],
273
+ jsonMode: "default",
274
+ handler: (args) => ({ json: loadFeedbackCli().feedbackCollectCli({ ...args.options, runId: args.positionals[0] }) }),
275
+ });
276
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.collect").mcp.handler = (args) => loadFeedbackCli().feedbackCollectCli(args);
277
+ (0, registry_core_1.attachCliBinding)("feedback.task", {
278
+ path: ["feedback", "task"],
279
+ jsonMode: "default",
280
+ handler: (args) => ({ json: loadFeedbackCli().feedbackTaskCli({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
281
+ });
282
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.task").mcp.handler = (args) => loadFeedbackCli().feedbackTaskCli(args);
283
+ (0, registry_core_1.attachCliBinding)("feedback.resolve", {
284
+ path: ["feedback", "resolve"],
285
+ jsonMode: "default",
286
+ handler: (args) => ({ json: loadFeedbackCli().feedbackResolveCli({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
287
+ });
288
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.resolve").mcp.handler = (args) => loadFeedbackCli().feedbackResolveCli(args);
289
+ // ---- workbench.view / workbench.serve ---------------------------------
290
+ function loadWorkbench() {
291
+ return require("../../shell/workbench");
292
+ }
293
+ function loadWorkbenchText() {
294
+ return require("../../shell/workbench-text");
295
+ }
296
+ function loadWorkbenchHost() {
297
+ return require("../../shell/workbench-host");
298
+ }
299
+ (0, registry_core_1.attachCliBinding)("workbench.view", {
300
+ path: ["workbench", "view"],
301
+ jsonMode: "flag",
302
+ handler: (args) => {
303
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
304
+ const view = loadWorkbench().buildWorkbenchRunView(runId, args.options);
305
+ return { json: view, text: `${loadWorkbenchText().formatWorkbenchView(view)}\n` };
306
+ },
307
+ });
308
+ // The MCP path is CLI-facing byte-identical (buildWorkbenchRunView takes
309
+ // the same args shape either way) — required here since `.cli` and
310
+ // `.mcp` never share a handler object per byte-compat item 5.
311
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.view").mcp.handler = (args) => loadWorkbench().buildWorkbenchRunView((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
312
+ (0, registry_core_1.attachCliBinding)("workbench.serve", {
313
+ path: ["workbench", "serve"],
314
+ jsonMode: "flag",
315
+ handler: (args) => {
316
+ const { WorkbenchHost } = loadWorkbenchHost();
317
+ const host = new WorkbenchHost(args.options);
318
+ if (args.options.once || (0, io_1.wantsJson)(args.options)) {
319
+ return { json: host.descriptor(true) };
320
+ }
321
+ // The default (no --once, no --json) actually binds and blocks — this
322
+ // returns a promise the generic dispatcher does not await today, so
323
+ // instead we run it directly here and never return (matching the old
324
+ // build's own blocking `serve` behavior). See cli/dispatch.ts's
325
+ // renderCliResult: it is synchronous, so a genuinely blocking serve
326
+ // must perform its own stdout write and keep the event loop alive
327
+ // rather than returning a CliHandlerResult at all.
328
+ void host.run();
329
+ return { json: undefined };
330
+ },
331
+ });
332
+ // `cw_workbench_serve` NEVER starts the server — the MCP path forces
333
+ // `once: true` unconditionally, per SPEC/reporting-ux.md's "one declared
334
+ // divergence": an MCP client must never be able to make the server
335
+ // process open a persistent listening socket.
336
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").mcp.handler = (args) => new (loadWorkbenchHost().WorkbenchHost)(args).descriptor(true);
337
+ // PARITY: both surfaces route through the single core entry
338
+ // buildWorkbenchServeDescriptor and return the IDENTICAL serve
339
+ // descriptor under `cw workbench serve --json`/`--once` and
340
+ // `cw_workbench_serve`. They diverge only in side effect, not payload:
341
+ // the CLI's default `cw workbench serve` (no --once) additionally
342
+ // STARTS the blocking localhost host, which an MCP stdio host cannot do,
343
+ // so cw_workbench_serve only ever returns the descriptor. Declared
344
+ // divergence, not drift.
345
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").payloadIdentical = false;
346
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").reason =
347
+ "Both surfaces route through the single core entry buildWorkbenchServeDescriptor and return the IDENTICAL serve descriptor under `cw workbench serve --json`/`--once` and `cw_workbench_serve`. They diverge only in side effect, not payload: the CLI's default `cw workbench serve` (no --once) additionally STARTS the blocking localhost host, which an MCP stdio host cannot do, so cw_workbench_serve only ever returns the descriptor. Declared divergence, not drift.";
348
+ // ---- audit.summary / audit.multi-agent / audit.policy / audit.judge ----
349
+ function loadAuditCli() {
350
+ return require("../../shell/audit-cli");
351
+ }
352
+ function loadEvalText() {
353
+ return require("../../shell/eval-text");
354
+ }
355
+ (0, registry_core_1.attachCliBinding)("audit.summary", {
356
+ path: ["audit", "summary"],
357
+ jsonMode: "default",
358
+ handler: (args) => ({ json: loadAuditCli().auditSummaryCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
359
+ });
360
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.summary").mcp.handler = (args) => loadAuditCli().auditSummaryCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
361
+ (0, registry_core_1.attachCliBinding)("audit.multi-agent", {
362
+ path: ["audit", "multi-agent"],
363
+ jsonMode: "flag",
364
+ handler: (args) => {
365
+ const view = loadAuditCli().auditMultiAgentCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
366
+ return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
367
+ },
368
+ });
369
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.multi-agent").mcp.handler = (args) => loadAuditCli().auditMultiAgentCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
370
+ (0, registry_core_1.attachCliBinding)("audit.policy", {
371
+ path: ["audit", "policy"],
372
+ jsonMode: "flag",
373
+ handler: (args) => {
374
+ const view = loadAuditCli().auditPolicyCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
375
+ return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
376
+ },
377
+ });
378
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.policy").mcp.handler = (args) => loadAuditCli().auditPolicyCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
379
+ (0, registry_core_1.attachCliBinding)("audit.judge", {
380
+ path: ["audit", "judge"],
381
+ jsonMode: "flag",
382
+ handler: (args) => {
383
+ const view = loadAuditCli().auditJudgeCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
384
+ return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
385
+ },
386
+ });
387
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.judge").mcp.handler = (args) => loadAuditCli().auditJudgeCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
388
+ // GAP: `cw audit worker|provenance|role|blackboard|attest|decision` — the MCP
389
+ // tool rows (cw_audit_worker/provenance/role/blackboard/attest/decision) were
390
+ // declared but had no CLI path binding and their mcp.handler was still
391
+ // notYetImplemented. Wire both surfaces (port of the old cli/handlers/audit.ts
392
+ // arms). `audit worker`/`role`/`decision` read positionals[1] as the entity id.
393
+ (0, registry_core_1.attachCliBinding)("audit.worker", {
394
+ path: ["audit", "worker"],
395
+ jsonMode: "default",
396
+ handler: (args) => ({ json: loadAuditCli().auditWorkerCli((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "worker id"), args.options) }),
397
+ });
398
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.worker").mcp.handler = (args) => loadAuditCli().auditWorkerCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_1.required)((0, io_1.optionalArg)(args.workerId ?? args.worker), "worker id"), args);
399
+ (0, registry_core_1.attachCliBinding)("audit.provenance", {
400
+ path: ["audit", "provenance"],
401
+ jsonMode: "default",
402
+ handler: (args) => ({ json: loadAuditCli().auditProvenanceCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
403
+ });
404
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.provenance").mcp.handler = (args) => loadAuditCli().auditProvenanceCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
405
+ (0, registry_core_1.attachCliBinding)("audit.role", {
406
+ path: ["audit", "role"],
407
+ jsonMode: "flag",
408
+ handler: (args) => {
409
+ const view = loadAuditCli().auditRoleCli((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "role id"), args.options);
410
+ return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
411
+ },
412
+ });
413
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.role").mcp.handler = (args) => loadAuditCli().auditRoleCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_1.required)((0, io_1.optionalArg)(args.roleId ?? args.id), "role id"), args);
414
+ (0, registry_core_1.attachCliBinding)("audit.blackboard", {
415
+ path: ["audit", "blackboard"],
416
+ jsonMode: "flag",
417
+ handler: (args) => {
418
+ const view = loadAuditCli().auditBlackboardCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
419
+ return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
420
+ },
421
+ });
422
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.blackboard").mcp.handler = (args) => loadAuditCli().auditBlackboardCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
423
+ (0, registry_core_1.attachCliBinding)("audit.attest", {
424
+ path: ["audit", "attest"],
425
+ jsonMode: "default",
426
+ handler: (args) => ({ json: loadAuditCli().auditAttestCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
427
+ });
428
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.attest").mcp.handler = (args) => loadAuditCli().auditAttestCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
429
+ (0, registry_core_1.attachCliBinding)("audit.decision", {
430
+ path: ["audit", "decision"],
431
+ jsonMode: "default",
432
+ handler: (args) => ({ json: loadAuditCli().auditDecisionCli((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "worker id"), args.options) }),
433
+ });
434
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.decision").mcp.handler = (args) => loadAuditCli().auditDecisionCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_1.required)((0, io_1.optionalArg)(args.workerId), "worker id"), args);
435
+ // ---- app.list / app.show / app.validate / app.init / app.package -------