cool-workflow 0.2.1 → 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 (93) 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 +18 -86
  10. package/dist/cli/parseargv.js +5 -2
  11. package/dist/core/capability-data.js +270 -0
  12. package/dist/core/capability-table.js +16 -3504
  13. package/dist/core/format/help.js +28 -5
  14. package/dist/core/multi-agent/collaboration.js +3 -2
  15. package/dist/core/multi-agent/coordinator.js +4 -3
  16. package/dist/core/pipeline/commit-gate.js +2 -1
  17. package/dist/core/state/state-explosion/digest.js +3 -2
  18. package/dist/core/state/state-explosion/graph.js +9 -8
  19. package/dist/core/state/state-explosion/helpers.js +2 -1
  20. package/dist/core/trust/ledger.js +2 -1
  21. package/dist/core/types/execution-backend.js +18 -0
  22. package/dist/core/types/observability.js +7 -0
  23. package/dist/core/util/collate.js +23 -0
  24. package/dist/core/version.js +1 -1
  25. package/dist/shell/audit-cli.js +46 -2
  26. package/dist/shell/commit-summary.js +2 -1
  27. package/dist/shell/drive.js +26 -10
  28. package/dist/shell/evidence-reasoning.js +4 -3
  29. package/dist/shell/execution-backend/registry.js +2 -1
  30. package/dist/shell/execution-backend/types.js +0 -9
  31. package/dist/shell/fs-atomic.js +14 -1
  32. package/dist/shell/multi-agent-operator-ux.js +4 -3
  33. package/dist/shell/observability.js +12 -11
  34. package/dist/shell/onramp.js +17 -1
  35. package/dist/shell/operator-ux-text.js +2 -1
  36. package/dist/shell/operator-ux.js +7 -6
  37. package/dist/shell/pipeline-cli.js +82 -72
  38. package/dist/shell/reclamation-io.js +2 -1
  39. package/dist/shell/report.js +2 -1
  40. package/dist/shell/run-store.js +17 -0
  41. package/dist/shell/state-explosion-cli.js +2 -1
  42. package/dist/shell/topology-io.js +2 -1
  43. package/dist/shell/trust-audit.js +41 -2
  44. package/dist/shell/worker-cli.js +9 -1
  45. package/dist/shell/worker-isolation.js +34 -9
  46. package/dist/shell/workflow-app-loader.js +3 -2
  47. package/dist/wiring/capability-table/basics.js +66 -0
  48. package/dist/wiring/capability-table/exec-backend.js +162 -0
  49. package/dist/wiring/capability-table/index.js +42 -0
  50. package/dist/wiring/capability-table/multi-agent.js +623 -0
  51. package/dist/wiring/capability-table/parity.js +466 -0
  52. package/dist/wiring/capability-table/pipeline.js +280 -0
  53. package/dist/wiring/capability-table/registry-core.js +189 -0
  54. package/dist/wiring/capability-table/reporting.js +394 -0
  55. package/dist/wiring/capability-table/scheduling-registry.js +558 -0
  56. package/dist/wiring/capability-table/state.js +173 -0
  57. package/dist/wiring/capability-table/trust-ledger.js +134 -0
  58. package/dist/wiring/capability-table/workflow-apps.js +366 -0
  59. package/docs/agent-delegation-drive.7.md +2 -0
  60. package/docs/cli-mcp-parity.7.md +7 -2
  61. package/docs/contract-migration-tooling.7.md +2 -0
  62. package/docs/control-plane-scheduling.7.md +2 -0
  63. package/docs/durable-state-and-locking.7.md +22 -0
  64. package/docs/evidence-adoption-reasoning-chain.7.md +2 -0
  65. package/docs/execution-backends.7.md +2 -0
  66. package/docs/index.md +1 -0
  67. package/docs/multi-agent-cli-mcp-surface.7.md +2 -0
  68. package/docs/multi-agent-eval-replay-harness.7.md +2 -0
  69. package/docs/multi-agent-operator-ux.7.md +2 -0
  70. package/docs/node-snapshot-diff-replay.7.md +2 -0
  71. package/docs/observability-cost-accounting.7.md +2 -0
  72. package/docs/project-index.md +25 -5
  73. package/docs/real-execution-backends.7.md +2 -0
  74. package/docs/release-and-migration.7.md +2 -0
  75. package/docs/release-tooling.7.md +2 -0
  76. package/docs/run-registry-control-plane.7.md +2 -0
  77. package/docs/run-retention-reclamation.7.md +2 -0
  78. package/docs/security-trust-hardening.7.md +30 -0
  79. package/docs/state-explosion-management.7.md +2 -0
  80. package/docs/team-collaboration.7.md +2 -0
  81. package/docs/trust-audit-anchor.7.md +69 -0
  82. package/docs/web-desktop-workbench.7.md +2 -0
  83. package/manifest/plugin.manifest.json +1 -1
  84. package/package.json +3 -1
  85. package/scripts/bump-version.js +24 -2
  86. package/scripts/canonical-apps.js +4 -4
  87. package/scripts/dogfood-release.js +1 -1
  88. package/scripts/golden-path.js +4 -4
  89. package/scripts/purity-baseline.json +68 -0
  90. package/scripts/purity-gate.js +239 -0
  91. package/scripts/release-check.js +8 -1
  92. package/scripts/version-sync-check.js +33 -12
  93. package/workflows/README.md +19 -0
@@ -0,0 +1,394 @@
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
+ const state_explosion_cli_1 = require("../../shell/state-explosion-cli");
45
+ const run_store_1 = require("../../shell/run-store");
46
+ // MILESTONE 11 (reporting, observability, doctor/fix, workbench, run
47
+ // export/bundle) CLI bindings: report, status (real run id), graph,
48
+ // operator.status|report|graph. Handler bodies live in shell/report-
49
+ // view-cli.ts (impure — they load run state and, for `report`/`operator
50
+ // report`, re-write report.md); this table only wires argv shape ->
51
+ // handler call, per cli/dispatch.ts's generic executor contract.
52
+ // ---------------------------------------------------------------------
53
+ const report_view_cli_1 = require("../../shell/report-view-cli");
54
+ const operator_ux_text_1 = require("../../shell/operator-ux-text");
55
+ (0, registry_core_1.attachCliBinding)("report", {
56
+ path: ["report"],
57
+ jsonMode: "flag",
58
+ handler: (args) => {
59
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
60
+ const result = (0, report_view_cli_1.reportWriteCli)(runId, args.options);
61
+ if (args.options.show || args.options.summary) {
62
+ const stateExplosion = (0, state_explosion_text_1.formatStateExplosionReport)((0, state_explosion_cli_1.summaryShowCli)(runId, args.options));
63
+ return { json: result, text: `${(0, report_view_cli_1.operatorReportText)(runId, args.options)}\n\n${stateExplosion}\n` };
64
+ }
65
+ return { json: result, text: `${result.path}\n` };
66
+ },
67
+ });
68
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("report").mcp.handler = (args) => (0, report_view_cli_1.reportWriteCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
69
+ // `status` already carries a milestone-2 CLI binding (`attachCliBinding("status", ...)`
70
+ // above); replace its handler here with the real run-id-aware body while
71
+ // keeping the same row/path (no reshape needed — see byte-compat item 5).
72
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").cli = {
73
+ path: ["status"],
74
+ jsonMode: "flag",
75
+ handler: (args) => {
76
+ const runId = (0, io_1.optionalArg)(args.positionals[0]);
77
+ if (!runId)
78
+ return { json: (0, report_view_cli_1.statusCli)(undefined, args.options), text: `No run selected\n\nNext Action\n${adviseNoRunLines()}` };
79
+ if (args.options.summary || args.options.brief) {
80
+ return { json: (0, report_view_cli_1.statusCli)(runId, args.options), text: `${(0, report_view_cli_1.statusSummaryText)(runId, args.options)}\n` };
81
+ }
82
+ return { json: (0, report_view_cli_1.statusCli)(runId, args.options), text: `${(0, report_view_cli_1.statusFullText)(runId, args.options)}\n` };
83
+ },
84
+ };
85
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").mcp.handler = (args) => (0, report_view_cli_1.statusCli)((0, io_1.optionalArg)(args.runId), args);
86
+ function adviseNoRunLines() {
87
+ return " node scripts/cw.js plan <workflow-id> --repo <path>\n reason: No run id is available yet; create a workflow run before dispatching or recording evidence.\n";
88
+ }
89
+ (0, registry_core_1.attachCliBinding)("graph", {
90
+ path: ["graph"],
91
+ jsonMode: "flag",
92
+ handler: (args) => {
93
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
94
+ return { json: (0, report_view_cli_1.graphCli)(runId, args.options), text: `${(0, report_view_cli_1.graphText)(runId, args.options)}\n` };
95
+ },
96
+ });
97
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("graph").mcp.handler = (args) => (0, report_view_cli_1.graphCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
98
+ (0, registry_core_1.attachCliBinding)("operator.status", {
99
+ path: ["operator", "status"],
100
+ jsonMode: "flag",
101
+ handler: (args) => {
102
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
103
+ if (args.options.summary || args.options.brief) {
104
+ return { json: (0, report_view_cli_1.operatorStatusCli)(runId, args.options), text: `${(0, report_view_cli_1.statusSummaryText)(runId, args.options)}\n` };
105
+ }
106
+ return { json: (0, report_view_cli_1.operatorStatusCli)(runId, args.options), text: `${(0, report_view_cli_1.statusFullText)(runId, args.options)}\n` };
107
+ },
108
+ });
109
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.status").mcp.handler = (args) => (0, report_view_cli_1.operatorStatusCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
110
+ (0, registry_core_1.attachCliBinding)("operator.report", {
111
+ path: ["operator", "report"],
112
+ jsonMode: "flag",
113
+ handler: (args) => {
114
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
115
+ return { json: (0, report_view_cli_1.operatorReportCli)(runId, args.options), text: `${(0, report_view_cli_1.operatorReportText)(runId, args.options)}\n` };
116
+ },
117
+ });
118
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.report").mcp.handler = (args) => (0, report_view_cli_1.operatorReportCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
119
+ // ---- metrics.show / metrics.summary -----------------------------------
120
+ const metrics_cli_1 = require("../../shell/metrics-cli");
121
+ const observability_1 = require("../../shell/observability");
122
+ (0, registry_core_1.attachCliBinding)("metrics.show", {
123
+ path: ["metrics", "show"],
124
+ jsonMode: "flag",
125
+ handler: (args) => {
126
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
127
+ const report = (0, metrics_cli_1.metricsShowCli)(runId, args.options);
128
+ return { json: report, text: `${(0, observability_1.formatMetricsReport)(report)}\n` };
129
+ },
130
+ });
131
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("metrics.show").mcp.handler = (args) => (0, metrics_cli_1.metricsShowCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
132
+ (0, registry_core_1.attachCliBinding)("metrics.summary", {
133
+ path: ["metrics", "summary"],
134
+ jsonMode: "flag",
135
+ handler: (args) => {
136
+ const report = (0, metrics_cli_1.metricsSummaryCli)(args.options);
137
+ return { json: report, text: `${(0, observability_1.formatMetricsSummary)(report)}\n` };
138
+ },
139
+ });
140
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("metrics.summary").mcp.handler = (args) => (0, metrics_cli_1.metricsSummaryCli)(args);
141
+ // ---- worker.summary (the workbench worker panel + `cw worker summary`) ----
142
+ const worker_isolation_1 = require("../../shell/worker-isolation");
143
+ const workerPath = __importStar(require("node:path"));
144
+ function workerSummaryCli(args) {
145
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
146
+ const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwdFor(args));
147
+ return (0, worker_isolation_1.summarizeWorkers)(run);
148
+ }
149
+ function workerSummaryText(args) {
150
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
151
+ const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwdFor(args));
152
+ return (0, worker_isolation_1.formatWorkerSummaryText)(run);
153
+ }
154
+ function invocationCwdFor(args) {
155
+ return typeof args.cwd === "string" && args.cwd.trim() ? workerPath.resolve(args.cwd) : process.cwd();
156
+ }
157
+ // jsonMode "flag": human `Workers` panel by default, canonical JSON under
158
+ // --json (old build's worker.summary was flag, cli/handlers/worker.ts).
159
+ (0, registry_core_1.attachCliBinding)("worker.summary", {
160
+ path: ["worker", "summary"],
161
+ jsonMode: "flag",
162
+ handler: (args) => ({
163
+ json: workerSummaryCli({ ...args.options, runId: args.positionals[0] }),
164
+ text: `${workerSummaryText({ ...args.options, runId: args.positionals[0] })}\n`,
165
+ }),
166
+ });
167
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.summary").mcp.handler = (args) => workerSummaryCli(args);
168
+ // ---- worker list|show|manifest|output|fail|validate (CLI + MCP) ----------
169
+ // Each worker lifecycle verb over a run. The old build routed all of these
170
+ // via src/cli/handlers/worker.ts; v2 shipped only worker.summary bound, so the
171
+ // rest fell through to the worker.usage error. positionals: [runId, workerId,
172
+ // resultFile].
173
+ const worker_cli_1 = require("../../shell/worker-cli");
174
+ (0, registry_core_1.attachCliBinding)("worker.list", {
175
+ path: ["worker", "list"],
176
+ jsonMode: "default",
177
+ handler: (args) => ({ json: (0, worker_cli_1.workerListCli)({ ...args.options, runId: args.positionals[0] }) }),
178
+ });
179
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.list").mcp.handler = (args) => (0, worker_cli_1.workerListCli)(args);
180
+ (0, registry_core_1.attachCliBinding)("worker.show", {
181
+ path: ["worker", "show"],
182
+ jsonMode: "default",
183
+ handler: (args) => ({ json: (0, worker_cli_1.workerShowCli)({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1] }) }),
184
+ });
185
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.show").mcp.handler = (args) => (0, worker_cli_1.workerShowCli)(args);
186
+ (0, registry_core_1.attachCliBinding)("worker.manifest", {
187
+ path: ["worker", "manifest"],
188
+ jsonMode: "default",
189
+ handler: (args) => ({ json: (0, worker_cli_1.workerManifestCli)({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1] }) }),
190
+ });
191
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.manifest").mcp.handler = (args) => (0, worker_cli_1.workerManifestCli)(args);
192
+ (0, registry_core_1.attachCliBinding)("worker.output", {
193
+ path: ["worker", "output"],
194
+ jsonMode: "default",
195
+ handler: (args) => ({ json: (0, worker_cli_1.workerOutputCli)({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] }) }),
196
+ });
197
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.output").mcp.handler = (args) => (0, worker_cli_1.workerOutputCli)(args);
198
+ (0, registry_core_1.attachCliBinding)("worker.fail", {
199
+ path: ["worker", "fail"],
200
+ jsonMode: "default",
201
+ handler: (args) => ({ json: (0, worker_cli_1.workerFailCli)({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] }) }),
202
+ });
203
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.fail").mcp.handler = (args) => (0, worker_cli_1.workerFailCli)(args);
204
+ (0, registry_core_1.attachCliBinding)("worker.validate", {
205
+ path: ["worker", "validate"],
206
+ jsonMode: "default",
207
+ handler: (args) => {
208
+ const { violation, exitCode } = (0, worker_cli_1.workerValidateCli)({ ...args.options, runId: args.positionals[0], workerId: args.positionals[1], resultPath: args.positionals[2] });
209
+ return { json: violation, exitCode };
210
+ },
211
+ });
212
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("worker.validate").mcp.handler = (args) => (0, worker_cli_1.workerValidateCli)(args).violation;
213
+ // ---- feedback list|show|summary|collect|task|resolve (CLI + MCP) ---------
214
+ // The operator feedback lifecycle. MCP rows were declared but stubbed
215
+ // (notYetImplemented) and no CLI verb was bound; the old build routed all of
216
+ // these. positionals: [runId, feedbackId].
217
+ const feedback_cli_1 = require("../../shell/feedback-cli");
218
+ // jsonMode "flag": human `Feedback` panel by default, canonical JSON under
219
+ // --json (old build's feedback.summary was flag).
220
+ (0, registry_core_1.attachCliBinding)("feedback.summary", {
221
+ path: ["feedback", "summary"],
222
+ jsonMode: "flag",
223
+ handler: (args) => {
224
+ const summary = (0, feedback_cli_1.feedbackSummaryCli)({ ...args.options, runId: args.positionals[0] });
225
+ return { json: summary, text: `${(0, operator_ux_text_1.formatFeedbackSummaryText)(summary)}\n` };
226
+ },
227
+ });
228
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.summary").mcp.handler = (args) => (0, feedback_cli_1.feedbackSummaryCli)(args);
229
+ (0, registry_core_1.attachCliBinding)("feedback.list", {
230
+ path: ["feedback", "list"],
231
+ jsonMode: "default",
232
+ handler: (args) => ({ json: (0, feedback_cli_1.feedbackListCli)({ ...args.options, runId: args.positionals[0] }) }),
233
+ });
234
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.list").mcp.handler = (args) => (0, feedback_cli_1.feedbackListCli)(args);
235
+ (0, registry_core_1.attachCliBinding)("feedback.show", {
236
+ path: ["feedback", "show"],
237
+ jsonMode: "default",
238
+ handler: (args) => ({ json: (0, feedback_cli_1.feedbackShowCli)({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
239
+ });
240
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.show").mcp.handler = (args) => (0, feedback_cli_1.feedbackShowCli)(args);
241
+ (0, registry_core_1.attachCliBinding)("feedback.collect", {
242
+ path: ["feedback", "collect"],
243
+ jsonMode: "default",
244
+ handler: (args) => ({ json: (0, feedback_cli_1.feedbackCollectCli)({ ...args.options, runId: args.positionals[0] }) }),
245
+ });
246
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.collect").mcp.handler = (args) => (0, feedback_cli_1.feedbackCollectCli)(args);
247
+ (0, registry_core_1.attachCliBinding)("feedback.task", {
248
+ path: ["feedback", "task"],
249
+ jsonMode: "default",
250
+ handler: (args) => ({ json: (0, feedback_cli_1.feedbackTaskCli)({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
251
+ });
252
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.task").mcp.handler = (args) => (0, feedback_cli_1.feedbackTaskCli)(args);
253
+ (0, registry_core_1.attachCliBinding)("feedback.resolve", {
254
+ path: ["feedback", "resolve"],
255
+ jsonMode: "default",
256
+ handler: (args) => ({ json: (0, feedback_cli_1.feedbackResolveCli)({ ...args.options, runId: args.positionals[0], feedbackId: args.positionals[1] }) }),
257
+ });
258
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("feedback.resolve").mcp.handler = (args) => (0, feedback_cli_1.feedbackResolveCli)(args);
259
+ // ---- workbench.view / workbench.serve ---------------------------------
260
+ const workbench_1 = require("../../shell/workbench");
261
+ const workbench_text_1 = require("../../shell/workbench-text");
262
+ const workbench_host_1 = require("../../shell/workbench-host");
263
+ (0, registry_core_1.attachCliBinding)("workbench.view", {
264
+ path: ["workbench", "view"],
265
+ jsonMode: "flag",
266
+ handler: (args) => {
267
+ const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
268
+ const view = (0, workbench_1.buildWorkbenchRunView)(runId, args.options);
269
+ return { json: view, text: `${(0, workbench_text_1.formatWorkbenchView)(view)}\n` };
270
+ },
271
+ });
272
+ // The MCP path is CLI-facing byte-identical (buildWorkbenchRunView takes
273
+ // the same args shape either way) — required here since `.cli` and
274
+ // `.mcp` never share a handler object per byte-compat item 5.
275
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.view").mcp.handler = (args) => (0, workbench_1.buildWorkbenchRunView)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
276
+ (0, registry_core_1.attachCliBinding)("workbench.serve", {
277
+ path: ["workbench", "serve"],
278
+ jsonMode: "flag",
279
+ handler: (args) => {
280
+ const host = new workbench_host_1.WorkbenchHost(args.options);
281
+ if (args.options.once || (0, io_1.wantsJson)(args.options)) {
282
+ return { json: host.descriptor(true) };
283
+ }
284
+ // The default (no --once, no --json) actually binds and blocks — this
285
+ // returns a promise the generic dispatcher does not await today, so
286
+ // instead we run it directly here and never return (matching the old
287
+ // build's own blocking `serve` behavior). See cli/dispatch.ts's
288
+ // renderCliResult: it is synchronous, so a genuinely blocking serve
289
+ // must perform its own stdout write and keep the event loop alive
290
+ // rather than returning a CliHandlerResult at all.
291
+ void host.run();
292
+ return { json: undefined };
293
+ },
294
+ });
295
+ // `cw_workbench_serve` NEVER starts the server — the MCP path forces
296
+ // `once: true` unconditionally, per SPEC/reporting-ux.md's "one declared
297
+ // divergence": an MCP client must never be able to make the server
298
+ // process open a persistent listening socket.
299
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").mcp.handler = (args) => new workbench_host_1.WorkbenchHost(args).descriptor(true);
300
+ // PARITY: both surfaces route through the single core entry
301
+ // buildWorkbenchServeDescriptor and return the IDENTICAL serve
302
+ // descriptor under `cw workbench serve --json`/`--once` and
303
+ // `cw_workbench_serve`. They diverge only in side effect, not payload:
304
+ // the CLI's default `cw workbench serve` (no --once) additionally
305
+ // STARTS the blocking localhost host, which an MCP stdio host cannot do,
306
+ // so cw_workbench_serve only ever returns the descriptor. Declared
307
+ // divergence, not drift.
308
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").payloadIdentical = false;
309
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.serve").reason =
310
+ "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.";
311
+ // ---- audit.summary / audit.multi-agent / audit.policy / audit.judge ----
312
+ const audit_cli_1 = require("../../shell/audit-cli");
313
+ const operator_ux_text_2 = require("../../shell/operator-ux-text");
314
+ (0, registry_core_1.attachCliBinding)("audit.summary", {
315
+ path: ["audit", "summary"],
316
+ jsonMode: "default",
317
+ handler: (args) => ({ json: (0, audit_cli_1.auditSummaryCli)((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
318
+ });
319
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.summary").mcp.handler = (args) => (0, audit_cli_1.auditSummaryCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
320
+ (0, registry_core_1.attachCliBinding)("audit.multi-agent", {
321
+ path: ["audit", "multi-agent"],
322
+ jsonMode: "flag",
323
+ handler: (args) => {
324
+ const view = (0, audit_cli_1.auditMultiAgentCli)((0, io_1.required)(args.positionals[0], "run id"), args.options);
325
+ return { json: view, text: (0, operator_ux_text_2.formatMultiAgentTrustAudit)(view) };
326
+ },
327
+ });
328
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.multi-agent").mcp.handler = (args) => (0, audit_cli_1.auditMultiAgentCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
329
+ (0, registry_core_1.attachCliBinding)("audit.policy", {
330
+ path: ["audit", "policy"],
331
+ jsonMode: "flag",
332
+ handler: (args) => {
333
+ const view = (0, audit_cli_1.auditPolicyCli)((0, io_1.required)(args.positionals[0], "run id"), args.options);
334
+ return { json: view, text: (0, operator_ux_text_2.formatMultiAgentTrustAudit)(view) };
335
+ },
336
+ });
337
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.policy").mcp.handler = (args) => (0, audit_cli_1.auditPolicyCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
338
+ (0, registry_core_1.attachCliBinding)("audit.judge", {
339
+ path: ["audit", "judge"],
340
+ jsonMode: "flag",
341
+ handler: (args) => {
342
+ const view = (0, audit_cli_1.auditJudgeCli)((0, io_1.required)(args.positionals[0], "run id"), args.options);
343
+ return { json: view, text: (0, operator_ux_text_2.formatMultiAgentTrustAudit)(view) };
344
+ },
345
+ });
346
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.judge").mcp.handler = (args) => (0, audit_cli_1.auditJudgeCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
347
+ // GAP: `cw audit worker|provenance|role|blackboard|attest|decision` — the MCP
348
+ // tool rows (cw_audit_worker/provenance/role/blackboard/attest/decision) were
349
+ // declared but had no CLI path binding and their mcp.handler was still
350
+ // notYetImplemented. Wire both surfaces (port of the old cli/handlers/audit.ts
351
+ // arms). `audit worker`/`role`/`decision` read positionals[1] as the entity id.
352
+ (0, registry_core_1.attachCliBinding)("audit.worker", {
353
+ path: ["audit", "worker"],
354
+ jsonMode: "default",
355
+ handler: (args) => ({ json: (0, audit_cli_1.auditWorkerCli)((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "worker id"), args.options) }),
356
+ });
357
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.worker").mcp.handler = (args) => (0, audit_cli_1.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);
358
+ (0, registry_core_1.attachCliBinding)("audit.provenance", {
359
+ path: ["audit", "provenance"],
360
+ jsonMode: "default",
361
+ handler: (args) => ({ json: (0, audit_cli_1.auditProvenanceCli)((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
362
+ });
363
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.provenance").mcp.handler = (args) => (0, audit_cli_1.auditProvenanceCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
364
+ (0, registry_core_1.attachCliBinding)("audit.role", {
365
+ path: ["audit", "role"],
366
+ jsonMode: "flag",
367
+ handler: (args) => {
368
+ const view = (0, audit_cli_1.auditRoleCli)((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "role id"), args.options);
369
+ return { json: view, text: (0, operator_ux_text_2.formatMultiAgentTrustAudit)(view) };
370
+ },
371
+ });
372
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.role").mcp.handler = (args) => (0, audit_cli_1.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);
373
+ (0, registry_core_1.attachCliBinding)("audit.blackboard", {
374
+ path: ["audit", "blackboard"],
375
+ jsonMode: "flag",
376
+ handler: (args) => {
377
+ const view = (0, audit_cli_1.auditBlackboardCli)((0, io_1.required)(args.positionals[0], "run id"), args.options);
378
+ return { json: view, text: (0, operator_ux_text_2.formatMultiAgentTrustAudit)(view) };
379
+ },
380
+ });
381
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.blackboard").mcp.handler = (args) => (0, audit_cli_1.auditBlackboardCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
382
+ (0, registry_core_1.attachCliBinding)("audit.attest", {
383
+ path: ["audit", "attest"],
384
+ jsonMode: "default",
385
+ handler: (args) => ({ json: (0, audit_cli_1.auditAttestCli)((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
386
+ });
387
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.attest").mcp.handler = (args) => (0, audit_cli_1.auditAttestCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
388
+ (0, registry_core_1.attachCliBinding)("audit.decision", {
389
+ path: ["audit", "decision"],
390
+ jsonMode: "default",
391
+ handler: (args) => ({ json: (0, audit_cli_1.auditDecisionCli)((0, io_1.required)(args.positionals[0], "run id"), (0, io_1.required)(args.positionals[1], "worker id"), args.options) }),
392
+ });
393
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.decision").mcp.handler = (args) => (0, audit_cli_1.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);
394
+ // ---- app.list / app.show / app.validate / app.init / app.package -------