cool-workflow 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/.gemini-plugin/mcp.json +10 -0
  4. package/.gemini-plugin/plugin.json +40 -0
  5. package/.opencode-plugin/mcp.json +10 -0
  6. package/.opencode-plugin/plugin.json +40 -0
  7. package/README.md +202 -48
  8. package/apps/architecture-review/app.json +1 -1
  9. package/apps/architecture-review-fast/app.json +1 -1
  10. package/apps/end-to-end-golden-path/app.json +1 -1
  11. package/apps/pr-review-fix-ci/app.json +1 -1
  12. package/apps/release-cut/app.json +1 -1
  13. package/apps/research-synthesis/app.json +1 -1
  14. package/dist/cli/dispatch.js +33 -4
  15. package/dist/cli/entry.js +11 -19
  16. package/dist/cli/global-flags.js +113 -0
  17. package/dist/cli/io.js +6 -20
  18. package/dist/cli/parseargv.js +7 -1
  19. package/dist/core/capability-data.js +339 -10
  20. package/dist/core/format/help.js +80 -4
  21. package/dist/core/format/recovery-hint.js +32 -0
  22. package/dist/core/multi-agent/collaboration.js +35 -6
  23. package/dist/core/multi-agent/runtime.js +7 -0
  24. package/dist/core/multi-agent/trust-policy.js +7 -1
  25. package/dist/core/pipeline/contract.js +7 -0
  26. package/dist/core/pipeline/error-feedback.js +2 -2
  27. package/dist/core/trust/evidence-grounding.js +13 -1
  28. package/dist/core/util/cli-args.js +55 -0
  29. package/dist/core/version.js +1 -1
  30. package/dist/mcp/dispatch.js +22 -2
  31. package/dist/mcp/server.js +124 -13
  32. package/dist/mcp-server.js +20 -0
  33. package/dist/shell/commit.js +8 -2
  34. package/dist/shell/coordinator-io.js +73 -1
  35. package/dist/shell/drive.js +129 -64
  36. package/dist/shell/error-feedback-io.js +6 -0
  37. package/dist/shell/execution-backend/agent.js +205 -24
  38. package/dist/shell/execution-backend/container.js +44 -10
  39. package/dist/shell/execution-backend/local.js +47 -10
  40. package/dist/shell/fs-atomic.js +93 -12
  41. package/dist/shell/ledger-cli.js +9 -2
  42. package/dist/shell/multi-agent-cli.js +5 -1
  43. package/dist/shell/onramp.js +48 -5
  44. package/dist/shell/pipeline-cli.js +20 -2
  45. package/dist/shell/pipeline.js +2 -1
  46. package/dist/shell/reclamation-io.js +76 -7
  47. package/dist/shell/registry-cli.js +4 -0
  48. package/dist/shell/run-export.js +52 -4
  49. package/dist/shell/run-registry-io.js +1 -0
  50. package/dist/shell/run-store.js +156 -0
  51. package/dist/shell/scheduler-io.js +101 -10
  52. package/dist/shell/telemetry-ledger-io.js +36 -24
  53. package/dist/shell/trust-audit.js +104 -10
  54. package/dist/shell/workbench-host.js +121 -10
  55. package/dist/shell/workbench.js +79 -5
  56. package/dist/shell/worker-isolation.js +1 -1
  57. package/dist/shell/workflow-app-loader.js +67 -1
  58. package/dist/wiring/capability-table/basics.js +7 -2
  59. package/dist/wiring/capability-table/exec-backend.js +42 -24
  60. package/dist/wiring/capability-table/multi-agent.js +69 -69
  61. package/dist/wiring/capability-table/pipeline.js +60 -28
  62. package/dist/wiring/capability-table/registry-core.js +29 -6
  63. package/dist/wiring/capability-table/reporting.js +45 -39
  64. package/dist/wiring/capability-table/scheduling-registry.js +66 -60
  65. package/dist/wiring/capability-table/state.js +34 -34
  66. package/dist/wiring/capability-table/trust-ledger.js +66 -24
  67. package/dist/wiring/capability-table/workflow-apps.js +15 -15
  68. package/docs/agent-delegation-drive.7.md +17 -0
  69. package/docs/cli-mcp-parity.7.md +43 -13
  70. package/docs/contract-migration-tooling.7.md +4 -0
  71. package/docs/control-plane-scheduling.7.md +38 -0
  72. package/docs/cross-agent-ledger.7.md +20 -8
  73. package/docs/durable-state-and-locking.7.md +4 -0
  74. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  75. package/docs/execution-backends.7.md +4 -0
  76. package/docs/fix.7.md +4 -4
  77. package/docs/getting-started.md +40 -32
  78. package/docs/index.md +17 -0
  79. package/docs/launch/demo.tape +4 -3
  80. package/docs/mcp-app-surface.7.md +6 -0
  81. package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
  82. package/docs/multi-agent-eval-replay-harness.7.md +4 -0
  83. package/docs/multi-agent-operator-ux.7.md +4 -0
  84. package/docs/node-snapshot-diff-replay.7.md +4 -0
  85. package/docs/observability-cost-accounting.7.md +4 -0
  86. package/docs/project-index.md +43 -9
  87. package/docs/real-execution-backends.7.md +4 -0
  88. package/docs/release-and-migration.7.md +4 -0
  89. package/docs/release-tooling.7.md +22 -0
  90. package/docs/routine.7.md +22 -0
  91. package/docs/run-registry-control-plane.7.md +4 -0
  92. package/docs/run-retention-reclamation.7.md +28 -3
  93. package/docs/state-explosion-management.7.md +4 -0
  94. package/docs/team-collaboration.7.md +4 -0
  95. package/docs/trust-audit-anchor.7.md +4 -0
  96. package/docs/web-desktop-workbench.7.md +26 -2
  97. package/docs/workflow-app-framework.7.md +31 -0
  98. package/manifest/plugin.manifest.json +1 -1
  99. package/manifest/source-context-profiles.json +4 -3
  100. package/package.json +5 -2
  101. package/scripts/agents/agent-adapter-core.js +26 -0
  102. package/scripts/agents/claude-p-agent.js +4 -1
  103. package/scripts/agents/codex-agent.js +4 -0
  104. package/scripts/agents/cw-attest-wrap.js +1 -1
  105. package/scripts/agents/gemini-agent.js +4 -0
  106. package/scripts/agents/opencode-agent.js +5 -0
  107. package/scripts/block-unapproved-tag.js +160 -0
  108. package/scripts/bump-version.js +27 -10
  109. package/scripts/canonical-apps.js +4 -4
  110. package/scripts/children/batch-delegate-child.js +72 -4
  111. package/scripts/children/http-batch-delegate-child.js +132 -0
  112. package/scripts/children/http-delegate-child.js +8 -0
  113. package/scripts/dogfood-release.js +2 -2
  114. package/scripts/fake-date-for-reproduction.js +1 -1
  115. package/scripts/golden-path.js +4 -4
  116. package/scripts/lang-policy-check.js +82 -0
  117. package/scripts/purity-baseline.json +0 -30
  118. package/scripts/purity-gate.js +16 -3
  119. package/scripts/release-check.js +2 -1
  120. package/scripts/release-flow.js +264 -41
  121. package/scripts/release-gate.js +184 -0
  122. package/scripts/release-oneclick.js +438 -0
  123. package/scripts/release-tags.js +47 -0
  124. package/scripts/verdict-keygen.js +2 -2
  125. package/scripts/verify-bump-reproduction.js +193 -0
  126. package/scripts/verify-verdict-signature.js +1 -1
  127. package/scripts/version-sync-check.js +39 -22
  128. package/ui/workbench/app.css +41 -9
  129. package/ui/workbench/app.js +160 -27
  130. package/ui/workbench/index.html +2 -2
  131. package/docs/agent-framework.md +0 -177
  132. package/docs/designs/handoff-ledger.md +0 -145
  133. package/docs/dogfood/resume-drive-real-agent-2026-06-14.md +0 -40
  134. package/docs/launch/launch-kit.md +0 -195
  135. package/docs/launch/pre-launch-checklist.md +0 -53
  136. package/docs/readme-v0.1.87-full.md +0 -301
  137. package/docs/routines.md +0 -101
  138. package/docs/scheduled-tasks.md +0 -80
  139. package/scripts/agents/claude-p-agent.sh +0 -9
  140. package/scripts/block-unapproved-tag.sh +0 -60
  141. package/scripts/release-gate.sh +0 -94
  142. package/scripts/verify-bump-reproduction.sh +0 -148
  143. package/scripts/verify-container-selfref.js +0 -64
@@ -6,8 +6,8 @@
6
6
  // retyped).
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const registry_core_1 = require("./registry-core");
9
- const io_1 = require("../../cli/io");
10
- const io_2 = require("../../cli/io");
9
+ const cli_args_1 = require("../../core/util/cli-args");
10
+ const cli_args_2 = require("../../core/util/cli-args");
11
11
  // MILESTONE 6+7 (combined; see docs/rebuild/PLAN.md Open risk 10) CLI bindings:
12
12
  // plan, quickstart, run --drive, run drive (preview), dispatch, result,
13
13
  // commit. Handler BODIES live in shell/pipeline-cli.ts (impure — they
@@ -28,7 +28,7 @@ function loadCommitSummary() {
28
28
  path: ["plan"],
29
29
  jsonMode: "default",
30
30
  handler: (args) => {
31
- const workflowId = (0, io_2.optionalArg)(args.positionals[0]);
31
+ const workflowId = (0, cli_args_2.optionalArg)(args.positionals[0]);
32
32
  if (!workflowId) {
33
33
  throw new Error('Missing workflow id.\n Tip: plan an architecture review with "cw plan architecture-review"');
34
34
  }
@@ -45,13 +45,20 @@ function loadCommitSummary() {
45
45
  // only so `cw help run` lists both capabilities.
46
46
  (0, registry_core_1.attachCliBinding)("run.drive.step", {
47
47
  path: ["run"],
48
+ // NOTE: the doubled "cw run drive" command column (this row + run.drive's
49
+ // preview row below) is pinned by SPEC/cli-probe.md "Odd things" item 5
50
+ // ("run drive (preview + drive)" — "A rebuild's help printer must keep
51
+ // these doubled rows"), same as `cw sched policy`. So the UI/UX fix for
52
+ // the two look-alike rows lives in the SUMMARIES (each now names its own
53
+ // invocation spelling — see the summary edits where these capabilities
54
+ // are declared), never in the row count or the command column.
48
55
  helpPath: ["run", "drive"],
49
56
  jsonMode: "default",
50
57
  handler: async (args) => {
51
58
  const registrySubcommands = new Set(["drive", "search", "list", "show", "resume", "archive", "rerun", "export", "import", "verify-import", "inspect-archive", "restore"]);
52
59
  const target = args.positionals[0];
53
60
  if (args.options.drive && !registrySubcommands.has(String(target || ""))) {
54
- const runId = (0, io_2.optionalArg)(args.options.run) || (0, io_2.optionalArg)(args.options.runId);
61
+ const runId = (0, cli_args_2.optionalArg)(args.options.run) || (0, cli_args_2.optionalArg)(args.options.runId);
55
62
  if (args.options.preview)
56
63
  return { json: loadPipelineCli().runDrivePreview({ ...args.options, runId: runId || target }) };
57
64
  const driveArgs = { ...args.options };
@@ -69,29 +76,29 @@ function loadCommitSummary() {
69
76
  driveArgs.runId = id;
70
77
  return { json: await loadPipelineCli().runDriveStep(driveArgs) };
71
78
  }
72
- return { json: loadPipelineCli().runDrivePreview({ ...args.options, runId: (0, io_1.required)(id, "run id") }) };
79
+ return { json: loadPipelineCli().runDrivePreview({ ...args.options, runId: (0, cli_args_1.required)(id, "run id") }) };
73
80
  }
74
81
  // MILESTONE 11 (reporting/run-export) — the archive family. Handler
75
82
  // bodies live in shell/run-export-cli.ts; this arm only wires argv
76
83
  // shape -> handler call.
77
84
  if (subcommand === "export") {
78
- const result = loadRunExportCli().runExportCli((0, io_1.required)(id, "run id"), args.options);
85
+ const result = loadRunExportCli().runExportCli((0, cli_args_1.required)(id, "run id"), args.options);
79
86
  return { json: result };
80
87
  }
81
88
  if (subcommand === "import") {
82
- const result = loadRunExportCli().runImportCli((0, io_1.required)(id, "archive path"), args.options);
89
+ const result = loadRunExportCli().runImportCli((0, cli_args_1.required)(id, "archive path"), args.options);
83
90
  return { json: result };
84
91
  }
85
92
  if (subcommand === "verify-import") {
86
- const result = loadRunExportCli().runVerifyImportCli((0, io_1.required)(id, "run id"), args.options);
93
+ const result = loadRunExportCli().runVerifyImportCli((0, cli_args_1.required)(id, "run id"), args.options);
87
94
  return { json: result, exitCode: args.options.strict && !result.ok ? 1 : undefined };
88
95
  }
89
96
  if (subcommand === "inspect-archive") {
90
- const result = loadRunExportCli().runInspectArchiveCli((0, io_1.required)(id, "archive path"), args.options);
97
+ const result = loadRunExportCli().runInspectArchiveCli((0, cli_args_1.required)(id, "archive path"), args.options);
91
98
  return { json: result, exitCode: result.ok ? undefined : 1 };
92
99
  }
93
100
  if (subcommand === "restore") {
94
- const result = loadRunExportCli().runRestoreCli((0, io_1.required)(id, "archive path"), args.options);
101
+ const result = loadRunExportCli().runRestoreCli((0, cli_args_1.required)(id, "archive path"), args.options);
95
102
  return { json: result, exitCode: result.ok ? undefined : 1 };
96
103
  }
97
104
  throw new Error("Usage: cw run search|list|show|resume|archive|rerun|drive|export|import|verify-import|inspect-archive|restore [run-id|archive] [--scope repo|home] [--json] | cw run <app> --drive [--once] [--incremental] [--repo R --question Q]");
@@ -119,11 +126,24 @@ function loadCommitSummary() {
119
126
  driveArgs.runId = id;
120
127
  return { json: await loadPipelineCli().runDriveStep(driveArgs) };
121
128
  }
122
- return { json: loadPipelineCli().runDrivePreview({ ...args.options, runId: (0, io_1.required)(id, "run id") }) };
129
+ return { json: loadPipelineCli().runDrivePreview({ ...args.options, runId: (0, cli_args_1.required)(id, "run id") }) };
123
130
  },
124
131
  });
125
132
  registry_core_1.REGISTRY_BY_CAPABILITY.get("run.drive").mcp.handler = (args) => loadPipelineCli().runDrivePreview(args);
126
133
  registry_core_1.REGISTRY_BY_CAPABILITY.get("run.drive.step").mcp.handler = (args) => loadPipelineCli().runDriveStep(args);
134
+ // UI/UX fix: `cw help run` prints TWO "cw run drive" rows — the doubling
135
+ // itself is pinned by SPEC/cli-probe.md "Odd things" item 5 ("run drive
136
+ // (preview + drive)": a rebuild's help printer must keep these doubled
137
+ // rows), so the command column and the row count must not change. What CAN
138
+ // change is the summary text: it used to leave a reader no way to tell
139
+ // which spelling gets which behavior. Each summary now ends with the exact
140
+ // command form that reaches it. Help-page-only: `summary` is overridden on
141
+ // the Capability row, `mcp.description` (the tools/list byte surface) is
142
+ // already captured by buildMcpBinding and stays untouched.
143
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.drive").summary =
144
+ "Preview the next agent-delegation drive step for a run (read-only, deterministic). Use: cw run drive <run-id>.";
145
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.drive.step").summary =
146
+ "Drive a run by delegating each worker to the agent backend (plan->dispatch->fulfill->accept->commit; --once for one step). Use: cw run <app> --drive.";
127
147
  // PARITY: `run.drive.step` advances the run by spawning the external
128
148
  // agent per worker and recording attested output — not a read probe.
129
149
  // CLI (--drive/--step) and MCP route through the same drive() core; the
@@ -180,11 +200,11 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("commit").reason =
180
200
  function loadRunExportCli() {
181
201
  return require("../../shell/run-export-cli");
182
202
  }
183
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.export").mcp.handler = (args) => loadRunExportCli().runExportCli((0, io_1.required)((0, io_2.optionalArg)(args.runId), "run id"), args);
184
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.import").mcp.handler = (args) => loadRunExportCli().runImportCli((0, io_1.required)((0, io_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
185
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.verify-import").mcp.handler = (args) => loadRunExportCli().runVerifyImportCli((0, io_1.required)((0, io_2.optionalArg)(args.runId), "run id"), args);
186
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.inspect-archive").mcp.handler = (args) => loadRunExportCli().runInspectArchiveCli((0, io_1.required)((0, io_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
187
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) => loadRunExportCli().runRestoreCli((0, io_1.required)((0, io_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
203
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.export").mcp.handler = (args) => loadRunExportCli().runExportCli((0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.runId), "run id"), args);
204
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.import").mcp.handler = (args) => loadRunExportCli().runImportCli((0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
205
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.verify-import").mcp.handler = (args) => loadRunExportCli().runVerifyImportCli((0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.runId), "run id"), args);
206
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.inspect-archive").mcp.handler = (args) => loadRunExportCli().runInspectArchiveCli((0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
207
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) => loadRunExportCli().runRestoreCli((0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.archive || args.path || args.file), "archive path"), args);
188
208
  // `run export|import|verify-import|inspect-archive|restore` each carry their
189
209
  // own two-token cli.path (found before the ["run"] run.drive.step catch-all
190
210
  // per the reversed candidate order), calling the same shell fns with the
@@ -195,20 +215,20 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
195
215
  path: ["run", "export"],
196
216
  jsonMode: "default",
197
217
  hiddenFromHelp: true,
198
- handler: (args) => ({ json: loadRunExportCli().runExportCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
218
+ handler: (args) => ({ json: loadRunExportCli().runExportCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options) }),
199
219
  });
200
220
  (0, registry_core_1.attachCliBinding)("run.import", {
201
221
  path: ["run", "import"],
202
222
  jsonMode: "default",
203
223
  hiddenFromHelp: true,
204
- handler: (args) => ({ json: loadRunExportCli().runImportCli((0, io_1.required)(args.positionals[0], "archive path"), args.options) }),
224
+ handler: (args) => ({ json: loadRunExportCli().runImportCli((0, cli_args_1.required)(args.positionals[0], "archive path"), args.options) }),
205
225
  });
206
226
  (0, registry_core_1.attachCliBinding)("run.verify-import", {
207
227
  path: ["run", "verify-import"],
208
228
  jsonMode: "default",
209
229
  hiddenFromHelp: true,
210
230
  handler: (args) => {
211
- const result = loadRunExportCli().runVerifyImportCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
231
+ const result = loadRunExportCli().runVerifyImportCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
212
232
  return { json: result, exitCode: args.options.strict && !result.ok ? 1 : undefined };
213
233
  },
214
234
  });
@@ -217,7 +237,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
217
237
  jsonMode: "default",
218
238
  hiddenFromHelp: true,
219
239
  handler: (args) => {
220
- const result = loadRunExportCli().runInspectArchiveCli((0, io_1.required)(args.positionals[0], "archive path"), args.options);
240
+ const result = loadRunExportCli().runInspectArchiveCli((0, cli_args_1.required)(args.positionals[0], "archive path"), args.options);
221
241
  return { json: result, exitCode: result.ok ? undefined : 1 };
222
242
  },
223
243
  });
@@ -226,7 +246,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
226
246
  jsonMode: "default",
227
247
  hiddenFromHelp: true,
228
248
  handler: (args) => {
229
- const result = loadRunExportCli().runRestoreCli((0, io_1.required)(args.positionals[0], "archive path"), args.options);
249
+ const result = loadRunExportCli().runRestoreCli((0, cli_args_1.required)(args.positionals[0], "archive path"), args.options);
230
250
  return { json: result, exitCode: result.ok ? undefined : 1 };
231
251
  },
232
252
  });
@@ -237,7 +257,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
237
257
  caseTokens: ["quickstart", "audit-run"],
238
258
  jsonMode: "default",
239
259
  handler: async (args) => {
240
- const appId = (0, io_2.optionalArg)(args.positionals[0]);
260
+ const appId = (0, cli_args_2.optionalArg)(args.positionals[0]);
241
261
  const result = (await loadPipelineCli().quickstartRun({ ...args.options, appId }));
242
262
  // Fail closed on both known bad outcomes: a --check preflight that
243
263
  // found a blocking gap, OR a --bundle that did not self-verify.
@@ -246,12 +266,24 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
246
266
  const exitCode = (result.mode === "check" && result.ok === false) || bundleFailed ? 1 : undefined;
247
267
  return { json: result, exitCode };
248
268
  },
269
+ // UI/UX fix: `cw help quickstart` used to list only the one-line
270
+ // summary above, so a first-run user had no way to learn these flags
271
+ // without reading source. Real flag names verified against
272
+ // shell/pipeline-cli.ts's quickstartRun.
273
+ flags: [
274
+ { name: "--check", summary: "Check setup only; do not plan, run, or write anything." },
275
+ { name: "--preview", summary: "Show the next step, but do not run it." },
276
+ { name: "--bundle", summary: "Seal a finished run into a portable, self-checked bundle." },
277
+ { name: "--with-trust-key KEY", summary: "Add a public key to the bundle for a strict check." },
278
+ { name: "--resume", summary: "Move a stopped run forward one step, or to the end with --run ID." },
279
+ { name: "--link URL", summary: "Review a remote repo by its URL." },
280
+ ],
249
281
  }, "quickstart composes plan/runDrive/report; SPEC/mcp.md's declared cli-only list names it explicitly (no MCP peer). `audit-run` is a CLI-only alias of the same wrapper.", "quickstart");
250
282
  (0, registry_core_1.attachCliBinding)("dispatch", {
251
283
  path: ["dispatch"],
252
284
  jsonMode: "default",
253
285
  handler: (args) => {
254
- const runId = (0, io_1.required)((0, io_2.optionalArg)(args.positionals[0]), "run id");
286
+ const runId = (0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.positionals[0]), "run id");
255
287
  return { json: loadPipelineCli().dispatchRun({ ...args.options, runId }) };
256
288
  },
257
289
  });
@@ -259,9 +291,9 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
259
291
  path: ["result"],
260
292
  jsonMode: "default",
261
293
  handler: (args) => {
262
- const runId = (0, io_1.required)((0, io_2.optionalArg)(args.positionals[0]), "run id");
263
- const taskId = (0, io_1.required)((0, io_2.optionalArg)(args.positionals[1]), "task id");
264
- const resultPath = (0, io_1.required)((0, io_2.optionalArg)(args.positionals[2]), "result file path");
294
+ const runId = (0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.positionals[0]), "run id");
295
+ const taskId = (0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.positionals[1]), "task id");
296
+ const resultPath = (0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.positionals[2]), "result file path");
265
297
  return { json: loadPipelineCli().recordResultRun({ ...args.options, runId, taskId, resultPath }) };
266
298
  },
267
299
  });
@@ -269,7 +301,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
269
301
  path: ["commit"],
270
302
  jsonMode: "default",
271
303
  handler: (args) => {
272
- const runId = (0, io_1.required)((0, io_2.optionalArg)(args.positionals[0]), "run id");
304
+ const runId = (0, cli_args_1.required)((0, cli_args_2.optionalArg)(args.positionals[0]), "run id");
273
305
  return { json: loadPipelineCli().commitRun({ ...args.options, runId }) };
274
306
  },
275
307
  });
@@ -284,7 +316,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.restore").mcp.handler = (args) =
284
316
  jsonMode: "flag",
285
317
  handler: (args) => {
286
318
  const commitSummary = loadCommitSummary();
287
- const summary = commitSummary.commitSummaryCli({ ...args.options, runId: (0, io_1.required)(args.positionals[0], "run id") });
319
+ const summary = commitSummary.commitSummaryCli({ ...args.options, runId: (0, cli_args_1.required)(args.positionals[0], "run id") });
288
320
  return { json: summary, text: `${commitSummary.formatCommitSummaryText(summary)}\n` };
289
321
  },
290
322
  });
@@ -32,7 +32,7 @@ exports.mcpToolDefinitions = mcpToolDefinitions;
32
32
  exports.declaredMcpTools = declaredMcpTools;
33
33
  exports.findCapabilityByMcpTool = findCapabilityByMcpTool;
34
34
  const capability_data_1 = require("../../core/capability-data");
35
- const io_1 = require("../../cli/io");
35
+ const cli_args_1 = require("../../core/util/cli-args");
36
36
  // Every capability-table module (this file plus each domain slice) is
37
37
  // required unconditionally at CLI/MCP startup, for every single command
38
38
  // (index.ts's whole point is to populate REGISTRY before dispatch can
@@ -65,8 +65,8 @@ const MCP_REAL_HANDLERS = {
65
65
  list: () => listBundledWorkflows(),
66
66
  "sandbox.list": () => listBundledSandboxProfiles(),
67
67
  status: (args) => statusPayload(optionalString(args.runId)),
68
- "summary.refresh": (args) => loadStateExplosionCli().summaryRefreshCli((0, io_1.required)(optionalString(args.runId), "run id"), args),
69
- "summary.show": (args) => loadStateExplosionCli().summaryShowCli((0, io_1.required)(optionalString(args.runId), "run id"), args),
68
+ "summary.refresh": (args) => loadStateExplosionCli().summaryRefreshCli((0, cli_args_1.required)(optionalString(args.runId), "run id"), args),
69
+ "summary.show": (args) => loadStateExplosionCli().summaryShowCli((0, cli_args_1.required)(optionalString(args.runId), "run id"), args),
70
70
  };
71
71
  function optionalString(value) {
72
72
  return typeof value === "string" && value.trim() ? value.trim() : undefined;
@@ -113,11 +113,13 @@ function buildMcpBinding(row) {
113
113
  // into its separate AND-groups here (the one place the row shape is turned
114
114
  // into the runtime McpBinding.requiredArgs contract).
115
115
  const requiredArgs = row.requiredArgs.flatMap((group) => group.split(",").map((entry) => entry.trim()).filter(Boolean));
116
+ const annotations = capability_data_1.MCP_TOOL_ANNOTATIONS[row.tool];
116
117
  return {
117
118
  tool: row.tool,
118
119
  requiredArgs: requiredArgs.length ? requiredArgs : undefined,
119
120
  properties: row.properties,
120
121
  description: row.description,
122
+ ...(annotations ? { annotations } : {}),
121
123
  handler,
122
124
  };
123
125
  }
@@ -179,7 +181,19 @@ function findCapabilityByCliPath(path) {
179
181
  function cliCapabilities() {
180
182
  return exports.REGISTRY.filter((row) => Boolean(row.cli));
181
183
  }
182
- /** `tools/list`'s exact array, in the pinned source order. */
184
+ /** `tools/list`'s exact array, in the pinned source order. Each
185
+ * property's shape comes from the first hit, in order: a per-tool
186
+ * `PROPERTY_OVERRIDES` entry, then the shared `COMMON_PROPERTY_TYPES`
187
+ * entry for that property name, then the plain `stringProperty`
188
+ * fallback for any name neither table covers.
189
+ *
190
+ * `inputSchema.required` is built from `row.mcp.requiredArgs`, which
191
+ * mcp/dispatch.ts's `requiredToolArguments` also reads: each array
192
+ * entry is one AND-required group, already split from the transcript's
193
+ * comma form (see `buildMcpBinding` above). A group holding `|` is an
194
+ * OR-group — at least one of the named keys must be present, so no
195
+ * single name from it can go into the flat, AND-only `required` list;
196
+ * a group with no `|` is one plain required name. */
183
197
  function mcpToolDefinitions() {
184
198
  const definitions = [];
185
199
  for (const row of exports.REGISTRY) {
@@ -188,12 +202,21 @@ function mcpToolDefinitions() {
188
202
  const overrides = capability_data_1.PROPERTY_OVERRIDES[row.mcp.tool] ?? {};
189
203
  const properties = {};
190
204
  for (const propName of row.mcp.properties) {
191
- properties[propName] = overrides[propName] ?? (0, capability_data_1.stringProperty)(propName);
205
+ properties[propName] = overrides[propName] ?? capability_data_1.COMMON_PROPERTY_TYPES[propName] ?? (0, capability_data_1.stringProperty)(propName);
192
206
  }
207
+ const required = (row.mcp.requiredArgs ?? []).filter((group) => !group.includes("|"));
193
208
  definitions.push({
194
209
  name: row.mcp.tool,
195
210
  description: row.mcp.description,
196
- inputSchema: { type: "object", properties, additionalProperties: true },
211
+ // Additive behavior hints (MCP_TOOL_ANNOTATIONS): present only for
212
+ // tools whose handler was checked by hand; omitted otherwise.
213
+ ...(row.mcp.annotations ? { annotations: row.mcp.annotations } : {}),
214
+ inputSchema: {
215
+ type: "object",
216
+ properties,
217
+ additionalProperties: true,
218
+ ...(required.length ? { required } : {}),
219
+ },
197
220
  });
198
221
  }
199
222
  return definitions;
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
39
39
  })();
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  const registry_core_1 = require("./registry-core");
42
- const io_1 = require("../../cli/io");
42
+ const cli_args_1 = require("../../core/util/cli-args");
43
43
  const state_explosion_text_1 = require("../../core/format/state-explosion-text");
44
44
  // This file is required at startup for every command. Loading these shell
45
45
  // modules only when their handler runs, not at import time, keeps that
@@ -67,7 +67,7 @@ function loadOperatorUxText() {
67
67
  path: ["report"],
68
68
  jsonMode: "flag",
69
69
  handler: (args) => {
70
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
70
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
71
71
  const reportViewCli = loadReportViewCli();
72
72
  const result = reportViewCli.reportWriteCli(runId, args.options);
73
73
  if (args.options.show || args.options.summary) {
@@ -77,7 +77,7 @@ function loadOperatorUxText() {
77
77
  return { json: result, text: `${result.path}\n` };
78
78
  },
79
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);
80
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("report").mcp.handler = (args) => loadReportViewCli().reportWriteCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
81
81
  // `status` already carries a milestone-2 CLI binding (`attachCliBinding("status", ...)`
82
82
  // above); replace its handler here with the real run-id-aware body while
83
83
  // keeping the same row/path (no reshape needed — see byte-compat item 5).
@@ -89,7 +89,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").cli = {
89
89
  // resolve the same run — the flag form used to be silently ignored
90
90
  // (positionals[0] only), so a bogus id given via --run and a real one
91
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);
92
+ const runId = (0, cli_args_1.optionalArg)(args.positionals[0]) || (0, cli_args_1.optionalArg)(args.options.run) || (0, cli_args_1.optionalArg)(args.options.runId);
93
93
  const reportViewCli = loadReportViewCli();
94
94
  if (!runId)
95
95
  return { json: reportViewCli.statusCli(undefined, args.options), text: `No run selected\n\nNext Action\n${adviseNoRunLines()}` };
@@ -99,7 +99,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").cli = {
99
99
  return { json: reportViewCli.statusCli(runId, args.options), text: `${reportViewCli.statusFullText(runId, args.options)}\n` };
100
100
  },
101
101
  };
102
- registry_core_1.REGISTRY_BY_CAPABILITY.get("status").mcp.handler = (args) => loadReportViewCli().statusCli((0, io_1.optionalArg)(args.runId), args);
102
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("status").mcp.handler = (args) => loadReportViewCli().statusCli((0, cli_args_1.optionalArg)(args.runId), args);
103
103
  function adviseNoRunLines() {
104
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
105
  }
@@ -107,17 +107,17 @@ function adviseNoRunLines() {
107
107
  path: ["graph"],
108
108
  jsonMode: "flag",
109
109
  handler: (args) => {
110
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
110
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
111
111
  const reportViewCli = loadReportViewCli();
112
112
  return { json: reportViewCli.graphCli(runId, args.options), text: `${reportViewCli.graphText(runId, args.options)}\n` };
113
113
  },
114
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);
115
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("graph").mcp.handler = (args) => loadReportViewCli().graphCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
116
116
  (0, registry_core_1.attachCliBinding)("operator.status", {
117
117
  path: ["operator", "status"],
118
118
  jsonMode: "flag",
119
119
  handler: (args) => {
120
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
120
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
121
121
  const reportViewCli = loadReportViewCli();
122
122
  if (args.options.summary || args.options.brief) {
123
123
  return { json: reportViewCli.operatorStatusCli(runId, args.options), text: `${reportViewCli.statusSummaryText(runId, args.options)}\n` };
@@ -125,17 +125,17 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("graph").mcp.handler = (args) => load
125
125
  return { json: reportViewCli.operatorStatusCli(runId, args.options), text: `${reportViewCli.statusFullText(runId, args.options)}\n` };
126
126
  },
127
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);
128
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.status").mcp.handler = (args) => loadReportViewCli().operatorStatusCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
129
129
  (0, registry_core_1.attachCliBinding)("operator.report", {
130
130
  path: ["operator", "report"],
131
131
  jsonMode: "flag",
132
132
  handler: (args) => {
133
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
133
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
134
134
  const reportViewCli = loadReportViewCli();
135
135
  return { json: reportViewCli.operatorReportCli(runId, args.options), text: `${reportViewCli.operatorReportText(runId, args.options)}\n` };
136
136
  },
137
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);
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("operator.report").mcp.handler = (args) => loadReportViewCli().operatorReportCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
139
139
  // ---- metrics.show / metrics.summary -----------------------------------
140
140
  function loadMetricsCli() {
141
141
  return require("../../shell/metrics-cli");
@@ -147,12 +147,12 @@ function loadObservability() {
147
147
  path: ["metrics", "show"],
148
148
  jsonMode: "flag",
149
149
  handler: (args) => {
150
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
150
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
151
151
  const report = loadMetricsCli().metricsShowCli(runId, args.options);
152
152
  return { json: report, text: `${loadObservability().formatMetricsReport(report)}\n` };
153
153
  },
154
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);
155
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("metrics.show").mcp.handler = (args) => loadMetricsCli().metricsShowCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
156
156
  (0, registry_core_1.attachCliBinding)("metrics.summary", {
157
157
  path: ["metrics", "summary"],
158
158
  jsonMode: "flag",
@@ -168,12 +168,12 @@ function loadWorkerIsolation() {
168
168
  }
169
169
  const workerPath = __importStar(require("node:path"));
170
170
  function workerSummaryCli(args) {
171
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
171
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id");
172
172
  const run = loadRunStore().loadRunFromCwd(runId, invocationCwdFor(args));
173
173
  return loadWorkerIsolation().summarizeWorkers(run);
174
174
  }
175
175
  function workerSummaryText(args) {
176
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id");
176
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id");
177
177
  const run = loadRunStore().loadRunFromCwd(runId, invocationCwdFor(args));
178
178
  return loadWorkerIsolation().formatWorkerSummaryText(run);
179
179
  }
@@ -300,7 +300,7 @@ function loadWorkbenchHost() {
300
300
  path: ["workbench", "view"],
301
301
  jsonMode: "flag",
302
302
  handler: (args) => {
303
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
303
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
304
304
  const view = loadWorkbench().buildWorkbenchRunView(runId, args.options);
305
305
  return { json: view, text: `${loadWorkbenchText().formatWorkbenchView(view)}\n` };
306
306
  },
@@ -308,14 +308,14 @@ function loadWorkbenchHost() {
308
308
  // The MCP path is CLI-facing byte-identical (buildWorkbenchRunView takes
309
309
  // the same args shape either way) — required here since `.cli` and
310
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);
311
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.view").mcp.handler = (args) => loadWorkbench().buildWorkbenchRunView((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
312
312
  (0, registry_core_1.attachCliBinding)("workbench.serve", {
313
313
  path: ["workbench", "serve"],
314
314
  jsonMode: "flag",
315
315
  handler: (args) => {
316
316
  const { WorkbenchHost } = loadWorkbenchHost();
317
317
  const host = new WorkbenchHost(args.options);
318
- if (args.options.once || (0, io_1.wantsJson)(args.options)) {
318
+ if (args.options.once || (0, cli_args_1.wantsJson)(args.options)) {
319
319
  return { json: host.descriptor(true) };
320
320
  }
321
321
  // The default (no --once, no --json) actually binds and blocks — this
@@ -325,7 +325,13 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("workbench.view").mcp.handler = (args
325
325
  // renderCliResult: it is synchronous, so a genuinely blocking serve
326
326
  // must perform its own stdout write and keep the event loop alive
327
327
  // rather than returning a CliHandlerResult at all.
328
- void host.run();
328
+ // run() already fails closed internally (a `cw:` line + exit 1) for the
329
+ // known bind failures; this .catch is a backstop so any future throw
330
+ // path can never surface as an unhandled-rejection stack dump.
331
+ void host.run().catch((error) => {
332
+ process.stderr.write(`cw: ${error instanceof Error ? error.message : String(error)}\n`);
333
+ process.exitCode = 1;
334
+ });
329
335
  return { json: undefined };
330
336
  },
331
337
  });
@@ -355,36 +361,36 @@ function loadEvalText() {
355
361
  (0, registry_core_1.attachCliBinding)("audit.summary", {
356
362
  path: ["audit", "summary"],
357
363
  jsonMode: "default",
358
- handler: (args) => ({ json: loadAuditCli().auditSummaryCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
364
+ handler: (args) => ({ json: loadAuditCli().auditSummaryCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options) }),
359
365
  });
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);
366
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.summary").mcp.handler = (args) => loadAuditCli().auditSummaryCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
361
367
  (0, registry_core_1.attachCliBinding)("audit.multi-agent", {
362
368
  path: ["audit", "multi-agent"],
363
369
  jsonMode: "flag",
364
370
  handler: (args) => {
365
- const view = loadAuditCli().auditMultiAgentCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
371
+ const view = loadAuditCli().auditMultiAgentCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
366
372
  return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
367
373
  },
368
374
  });
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);
375
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.multi-agent").mcp.handler = (args) => loadAuditCli().auditMultiAgentCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
370
376
  (0, registry_core_1.attachCliBinding)("audit.policy", {
371
377
  path: ["audit", "policy"],
372
378
  jsonMode: "flag",
373
379
  handler: (args) => {
374
- const view = loadAuditCli().auditPolicyCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
380
+ const view = loadAuditCli().auditPolicyCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
375
381
  return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
376
382
  },
377
383
  });
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);
384
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.policy").mcp.handler = (args) => loadAuditCli().auditPolicyCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
379
385
  (0, registry_core_1.attachCliBinding)("audit.judge", {
380
386
  path: ["audit", "judge"],
381
387
  jsonMode: "flag",
382
388
  handler: (args) => {
383
- const view = loadAuditCli().auditJudgeCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
389
+ const view = loadAuditCli().auditJudgeCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
384
390
  return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
385
391
  },
386
392
  });
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);
393
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.judge").mcp.handler = (args) => loadAuditCli().auditJudgeCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
388
394
  // GAP: `cw audit worker|provenance|role|blackboard|attest|decision` — the MCP
389
395
  // tool rows (cw_audit_worker/provenance/role/blackboard/attest/decision) were
390
396
  // declared but had no CLI path binding and their mcp.handler was still
@@ -393,43 +399,43 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.judge").mcp.handler = (args) =
393
399
  (0, registry_core_1.attachCliBinding)("audit.worker", {
394
400
  path: ["audit", "worker"],
395
401
  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) }),
402
+ handler: (args) => ({ json: loadAuditCli().auditWorkerCli((0, cli_args_1.required)(args.positionals[0], "run id"), (0, cli_args_1.required)(args.positionals[1], "worker id"), args.options) }),
397
403
  });
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);
404
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.worker").mcp.handler = (args) => loadAuditCli().auditWorkerCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.workerId ?? args.worker), "worker id"), args);
399
405
  (0, registry_core_1.attachCliBinding)("audit.provenance", {
400
406
  path: ["audit", "provenance"],
401
407
  jsonMode: "default",
402
- handler: (args) => ({ json: loadAuditCli().auditProvenanceCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
408
+ handler: (args) => ({ json: loadAuditCli().auditProvenanceCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options) }),
403
409
  });
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);
410
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.provenance").mcp.handler = (args) => loadAuditCli().auditProvenanceCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
405
411
  (0, registry_core_1.attachCliBinding)("audit.role", {
406
412
  path: ["audit", "role"],
407
413
  jsonMode: "flag",
408
414
  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);
415
+ const view = loadAuditCli().auditRoleCli((0, cli_args_1.required)(args.positionals[0], "run id"), (0, cli_args_1.required)(args.positionals[1], "role id"), args.options);
410
416
  return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
411
417
  },
412
418
  });
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);
419
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.role").mcp.handler = (args) => loadAuditCli().auditRoleCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.roleId ?? args.id), "role id"), args);
414
420
  (0, registry_core_1.attachCliBinding)("audit.blackboard", {
415
421
  path: ["audit", "blackboard"],
416
422
  jsonMode: "flag",
417
423
  handler: (args) => {
418
- const view = loadAuditCli().auditBlackboardCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
424
+ const view = loadAuditCli().auditBlackboardCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
419
425
  return { json: view, text: loadOperatorUxText().formatMultiAgentTrustAudit(view) };
420
426
  },
421
427
  });
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);
428
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.blackboard").mcp.handler = (args) => loadAuditCli().auditBlackboardCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
423
429
  (0, registry_core_1.attachCliBinding)("audit.attest", {
424
430
  path: ["audit", "attest"],
425
431
  jsonMode: "default",
426
- handler: (args) => ({ json: loadAuditCli().auditAttestCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
432
+ handler: (args) => ({ json: loadAuditCli().auditAttestCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options) }),
427
433
  });
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);
434
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.attest").mcp.handler = (args) => loadAuditCli().auditAttestCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
429
435
  (0, registry_core_1.attachCliBinding)("audit.decision", {
430
436
  path: ["audit", "decision"],
431
437
  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) }),
438
+ handler: (args) => ({ json: loadAuditCli().auditDecisionCli((0, cli_args_1.required)(args.positionals[0], "run id"), (0, cli_args_1.required)(args.positionals[1], "worker id"), args.options) }),
433
439
  });
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);
440
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.decision").mcp.handler = (args) => loadAuditCli().auditDecisionCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.workerId), "worker id"), args);
435
441
  // ---- app.list / app.show / app.validate / app.init / app.package -------