cool-workflow 0.1.97 → 0.2.0

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 (309) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/README.md +11 -2
  4. package/apps/architecture-review/app.json +1 -1
  5. package/apps/architecture-review-fast/app.json +1 -1
  6. package/apps/end-to-end-golden-path/app.json +1 -1
  7. package/apps/pr-review-fix-ci/app.json +1 -1
  8. package/apps/release-cut/app.json +1 -1
  9. package/apps/research-synthesis/app.json +1 -1
  10. package/dist/cli/dispatch.js +236 -0
  11. package/dist/cli/entry.js +120 -0
  12. package/dist/cli/io.js +21 -4
  13. package/dist/cli/parseargv.js +157 -0
  14. package/dist/cli.js +6 -33
  15. package/dist/core/capability-table.js +3534 -0
  16. package/dist/core/format/help.js +314 -0
  17. package/dist/{state-explosion/format.js → core/format/state-explosion-text.js} +10 -1
  18. package/dist/core/hash.js +137 -0
  19. package/dist/core/multi-agent/candidate-scoring.js +219 -0
  20. package/dist/core/multi-agent/collaboration.js +481 -0
  21. package/dist/core/multi-agent/coordinator.js +515 -0
  22. package/dist/core/multi-agent/eval-replay.js +306 -0
  23. package/dist/core/multi-agent/runtime.js +929 -0
  24. package/dist/core/multi-agent/topology.js +298 -0
  25. package/dist/core/multi-agent/trust-policy.js +197 -0
  26. package/dist/core/pipeline/commit-gate.js +320 -0
  27. package/dist/{pipeline-contract.js → core/pipeline/contract.js} +24 -37
  28. package/dist/core/pipeline/dispatch.js +103 -0
  29. package/dist/core/pipeline/drive-decide.js +227 -0
  30. package/dist/core/pipeline/error-feedback.js +161 -0
  31. package/dist/core/pipeline/loop-expansion.js +124 -0
  32. package/dist/{result-normalize.js → core/pipeline/result-normalize.js} +14 -37
  33. package/dist/core/pipeline/runner.js +230 -0
  34. package/dist/{contract-migration.js → core/state/contract-migration.js} +68 -92
  35. package/dist/{state-migrations.js → core/state/migrations.js} +103 -96
  36. package/dist/core/state/node-projection.js +95 -0
  37. package/dist/core/state/node-snapshot.js +230 -0
  38. package/dist/core/state/run-paths.js +93 -0
  39. package/dist/{schema-validate.js → core/state/schema-validate.js} +35 -28
  40. package/dist/core/state/schema.js +50 -0
  41. package/dist/core/state/state-explosion/digest.js +243 -0
  42. package/dist/core/state/state-explosion/graph.js +527 -0
  43. package/dist/{state-explosion → core/state/state-explosion}/helpers.js +34 -3
  44. package/dist/core/state/state-explosion/report.js +187 -0
  45. package/dist/{state-explosion → core/state/state-explosion}/size.js +25 -7
  46. package/dist/{state-node.js → core/state/state-node.js} +90 -113
  47. package/dist/core/state/types.js +19 -0
  48. package/dist/{validation.js → core/state/validation.js} +64 -131
  49. package/dist/core/trust/evidence-grounding.js +134 -0
  50. package/dist/core/trust/ledger.js +199 -0
  51. package/dist/{telemetry-attestation.js → core/trust/telemetry-attestation.js} +94 -68
  52. package/dist/core/trust/telemetry-ledger.js +127 -0
  53. package/dist/core/types.js +20 -0
  54. package/dist/core/version.js +16 -0
  55. package/dist/{workflow-app-framework.js → core/workflow-apps/app-schema.js} +337 -426
  56. package/dist/mcp/dispatch.js +104 -0
  57. package/dist/mcp/server.js +144 -0
  58. package/dist/mcp-server.js +6 -84
  59. package/dist/{agent-config.js → shell/agent-config.js} +118 -71
  60. package/dist/shell/app-run-cli.js +88 -0
  61. package/dist/shell/audit-cli.js +259 -0
  62. package/dist/shell/audit-provenance.js +83 -0
  63. package/dist/shell/candidate-scoring-io.js +459 -0
  64. package/dist/shell/collaboration-io.js +264 -0
  65. package/dist/shell/commit-summary.js +104 -0
  66. package/dist/shell/commit.js +290 -0
  67. package/dist/shell/coordinator-io.js +476 -0
  68. package/dist/shell/demo-cli.js +19 -0
  69. package/dist/shell/dispatch.js +162 -0
  70. package/dist/{doctor.js → shell/doctor.js} +123 -56
  71. package/dist/shell/drive.js +873 -0
  72. package/dist/shell/error-feedback-io.js +305 -0
  73. package/dist/shell/eval-io.js +473 -0
  74. package/dist/{multi-agent-eval/format.js → shell/eval-text.js} +78 -49
  75. package/dist/{evidence-reasoning.js → shell/evidence-reasoning.js} +124 -255
  76. package/dist/shell/exec-backend-cli.js +88 -0
  77. package/dist/shell/execution-backend/agent.js +475 -0
  78. package/dist/shell/execution-backend/ci.js +15 -0
  79. package/dist/shell/execution-backend/container.js +69 -0
  80. package/dist/shell/execution-backend/envelopes.js +55 -0
  81. package/dist/shell/execution-backend/local.js +113 -0
  82. package/dist/shell/execution-backend/probes.js +175 -0
  83. package/dist/shell/execution-backend/registry.js +402 -0
  84. package/dist/shell/execution-backend/remote.js +128 -0
  85. package/dist/shell/execution-backend/types.js +11 -0
  86. package/dist/shell/feedback-cli.js +81 -0
  87. package/dist/shell/feedback-operations.js +48 -0
  88. package/dist/shell/fs-atomic.js +276 -0
  89. package/dist/shell/harness.js +98 -0
  90. package/dist/shell/ledger-cli.js +212 -0
  91. package/dist/shell/ledger-io.js +169 -0
  92. package/dist/shell/man-cli.js +89 -0
  93. package/dist/shell/metrics-cli.js +98 -0
  94. package/dist/shell/multi-agent-cli.js +1002 -0
  95. package/dist/shell/multi-agent-host.js +563 -0
  96. package/dist/shell/multi-agent-io.js +387 -0
  97. package/dist/{multi-agent-operator-ux.js → shell/multi-agent-operator-ux.js} +234 -191
  98. package/dist/shell/node-store.js +124 -0
  99. package/dist/{observability/format.js → shell/observability-format.js} +7 -1
  100. package/dist/{observability/intake.js → shell/observability-intake.js} +79 -56
  101. package/dist/{observability.js → shell/observability.js} +159 -332
  102. package/dist/{onramp.js → shell/onramp.js} +11 -0
  103. package/dist/{operator-ux/format.js → shell/operator-ux-text.js} +250 -239
  104. package/dist/shell/operator-ux.js +431 -0
  105. package/dist/shell/orchestrator.js +231 -0
  106. package/dist/shell/pipeline-cli.js +667 -0
  107. package/dist/shell/pipeline.js +217 -0
  108. package/dist/shell/reclamation-io.js +1366 -0
  109. package/dist/shell/registry-cli.js +329 -0
  110. package/dist/{remote-source.js → shell/remote-source.js} +12 -5
  111. package/dist/shell/report-cli.js +101 -0
  112. package/dist/shell/report-view-cli.js +117 -0
  113. package/dist/{orchestrator → shell}/report.js +289 -282
  114. package/dist/shell/reporter.js +62 -0
  115. package/dist/shell/run-export-cli.js +106 -0
  116. package/dist/shell/run-export.js +680 -0
  117. package/dist/shell/run-registry-io.js +1014 -0
  118. package/dist/shell/run-store.js +164 -0
  119. package/dist/{sandbox-profile.js → shell/sandbox-profile.js} +134 -95
  120. package/dist/{scheduler.js → shell/scheduler-io.js} +248 -48
  121. package/dist/shell/scheduling-io.js +311 -0
  122. package/dist/shell/state-cli.js +181 -0
  123. package/dist/shell/state-explosion-cli.js +197 -0
  124. package/dist/shell/telemetry-cli.js +85 -0
  125. package/dist/{telemetry-demo.js → shell/telemetry-demo.js} +149 -119
  126. package/dist/shell/telemetry-ledger-io.js +132 -0
  127. package/dist/{term.js → shell/term.js} +36 -46
  128. package/dist/shell/topology-io.js +361 -0
  129. package/dist/shell/trust-audit.js +471 -0
  130. package/dist/{multi-agent-trust.js → shell/trust-policy-io.js} +67 -205
  131. package/dist/shell/verifier.js +48 -0
  132. package/dist/shell/workbench-host.js +250 -0
  133. package/dist/shell/workbench-text.js +18 -0
  134. package/dist/shell/workbench.js +175 -0
  135. package/dist/shell/worker-cli.js +124 -0
  136. package/dist/shell/worker-isolation.js +852 -0
  137. package/dist/shell/workflow-app-loader.js +650 -0
  138. package/docs/agent-delegation-drive.7.md +4 -0
  139. package/docs/cli-mcp-parity.7.md +284 -211
  140. package/docs/contract-migration-tooling.7.md +4 -0
  141. package/docs/control-plane-scheduling.7.md +4 -0
  142. package/docs/cross-agent-ledger.7.md +217 -0
  143. package/docs/designs/handoff-ledger.md +145 -0
  144. package/docs/durable-state-and-locking.7.md +4 -0
  145. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  146. package/docs/execution-backends.7.md +4 -0
  147. package/docs/handoff-setup.md +120 -0
  148. package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
  149. package/docs/multi-agent-eval-replay-harness.7.md +4 -0
  150. package/docs/multi-agent-operator-ux.7.md +4 -0
  151. package/docs/node-snapshot-diff-replay.7.md +4 -0
  152. package/docs/observability-cost-accounting.7.md +4 -0
  153. package/docs/project-index.md +143 -71
  154. package/docs/real-execution-backends.7.md +4 -0
  155. package/docs/release-and-migration.7.md +4 -0
  156. package/docs/release-tooling.7.md +4 -0
  157. package/docs/run-registry-control-plane.7.md +4 -0
  158. package/docs/run-retention-reclamation.7.md +25 -0
  159. package/docs/state-explosion-management.7.md +4 -0
  160. package/docs/team-collaboration.7.md +4 -0
  161. package/docs/web-desktop-workbench.7.md +4 -0
  162. package/manifest/plugin.manifest.json +1 -1
  163. package/manifest/source-context-profiles.json +9 -13
  164. package/package.json +1 -1
  165. package/scripts/agents/codex-agent.js +34 -4
  166. package/scripts/agents/cw-attest-wrap.js +2 -2
  167. package/scripts/bump-version.js +4 -3
  168. package/scripts/canonical-apps.js +4 -4
  169. package/scripts/children/batch-delegate-child.js +30 -10
  170. package/scripts/dogfood-architecture-review.js +2 -3
  171. package/scripts/dogfood-release.js +3 -3
  172. package/scripts/gen-parity-doc.js +15 -2
  173. package/scripts/golden-path.js +4 -4
  174. package/scripts/onramp-check.js +1 -1
  175. package/scripts/parity-check.js +38 -21
  176. package/scripts/release-flow.js +9 -3
  177. package/scripts/sync-project-index.js +51 -27
  178. package/scripts/validate-run-state-schema.js +2 -2
  179. package/scripts/version-sync-check.js +30 -30
  180. package/dist/candidate-scoring.js +0 -729
  181. package/dist/capability-core.js +0 -1186
  182. package/dist/capability-registry.js +0 -879
  183. package/dist/cli/command-surface.js +0 -490
  184. package/dist/cli/format.js +0 -56
  185. package/dist/cli/handlers/audit.js +0 -82
  186. package/dist/cli/handlers/blackboard.js +0 -81
  187. package/dist/cli/handlers/candidate.js +0 -40
  188. package/dist/cli/handlers/clones.js +0 -34
  189. package/dist/cli/handlers/collaboration.js +0 -61
  190. package/dist/cli/handlers/eval.js +0 -40
  191. package/dist/cli/handlers/maintenance.js +0 -107
  192. package/dist/cli/handlers/multi-agent.js +0 -165
  193. package/dist/cli/handlers/node.js +0 -41
  194. package/dist/cli/handlers/operational.js +0 -155
  195. package/dist/cli/handlers/operator.js +0 -146
  196. package/dist/cli/handlers/registry.js +0 -68
  197. package/dist/cli/handlers/run.js +0 -153
  198. package/dist/cli/handlers/scheduling.js +0 -132
  199. package/dist/cli/handlers/workbench.js +0 -41
  200. package/dist/cli/handlers/worker.js +0 -45
  201. package/dist/cli/run-summary.js +0 -45
  202. package/dist/clones.js +0 -162
  203. package/dist/collaboration.js +0 -726
  204. package/dist/commit.js +0 -592
  205. package/dist/compare.js +0 -18
  206. package/dist/coordinator/classify.js +0 -45
  207. package/dist/coordinator/paths.js +0 -42
  208. package/dist/coordinator/util.js +0 -126
  209. package/dist/coordinator.js +0 -990
  210. package/dist/daemon.js +0 -44
  211. package/dist/dispatch.js +0 -250
  212. package/dist/drive.js +0 -827
  213. package/dist/error-feedback.js +0 -419
  214. package/dist/evidence-grounding.js +0 -184
  215. package/dist/execution-backend/agent.js +0 -294
  216. package/dist/execution-backend/probes.js +0 -112
  217. package/dist/execution-backend/util.js +0 -47
  218. package/dist/execution-backend.js +0 -961
  219. package/dist/gates.js +0 -48
  220. package/dist/harness.js +0 -61
  221. package/dist/loop-expansion.js +0 -60
  222. package/dist/mcp/tool-call.js +0 -434
  223. package/dist/mcp/tool-definitions.js +0 -1040
  224. package/dist/mcp-surface.js +0 -30
  225. package/dist/multi-agent/graph.js +0 -84
  226. package/dist/multi-agent/helpers.js +0 -141
  227. package/dist/multi-agent/ids.js +0 -20
  228. package/dist/multi-agent/paths.js +0 -22
  229. package/dist/multi-agent-eval/normalize.js +0 -51
  230. package/dist/multi-agent-eval.js +0 -678
  231. package/dist/multi-agent-host.js +0 -777
  232. package/dist/multi-agent.js +0 -984
  233. package/dist/node-projection.js +0 -59
  234. package/dist/node-snapshot.js +0 -260
  235. package/dist/operator-ux.js +0 -631
  236. package/dist/orchestrator/app-operations.js +0 -211
  237. package/dist/orchestrator/audit-operations.js +0 -182
  238. package/dist/orchestrator/candidate-operations.js +0 -117
  239. package/dist/orchestrator/cli-options.js +0 -294
  240. package/dist/orchestrator/collaboration-operations.js +0 -86
  241. package/dist/orchestrator/feedback-operations.js +0 -81
  242. package/dist/orchestrator/host-operations.js +0 -78
  243. package/dist/orchestrator/lifecycle-operations.js +0 -626
  244. package/dist/orchestrator/migration-operations.js +0 -44
  245. package/dist/orchestrator/multi-agent-operations.js +0 -362
  246. package/dist/orchestrator/topology-operations.js +0 -84
  247. package/dist/orchestrator.js +0 -917
  248. package/dist/pipeline-runner.js +0 -285
  249. package/dist/reclamation/hash.js +0 -72
  250. package/dist/reclamation.js +0 -812
  251. package/dist/reporter.js +0 -67
  252. package/dist/run-export.js +0 -784
  253. package/dist/run-registry/derive.js +0 -175
  254. package/dist/run-registry/format.js +0 -124
  255. package/dist/run-registry/gc.js +0 -251
  256. package/dist/run-registry/policy.js +0 -16
  257. package/dist/run-registry/queue.js +0 -115
  258. package/dist/run-registry.js +0 -850
  259. package/dist/run-state-schema.js +0 -68
  260. package/dist/scheduling.js +0 -184
  261. package/dist/state-explosion.js +0 -1014
  262. package/dist/state.js +0 -367
  263. package/dist/telemetry-ledger.js +0 -196
  264. package/dist/topology.js +0 -565
  265. package/dist/triggers.js +0 -184
  266. package/dist/trust-audit.js +0 -644
  267. package/dist/types/blackboard.js +0 -2
  268. package/dist/types/candidate.js +0 -2
  269. package/dist/types/collaboration.js +0 -2
  270. package/dist/types/core.js +0 -2
  271. package/dist/types/drive.js +0 -10
  272. package/dist/types/error-feedback.js +0 -2
  273. package/dist/types/evidence-reasoning.js +0 -2
  274. package/dist/types/execution-backend.js +0 -2
  275. package/dist/types/multi-agent.js +0 -2
  276. package/dist/types/observability.js +0 -2
  277. package/dist/types/pipeline.js +0 -2
  278. package/dist/types/reclamation.js +0 -8
  279. package/dist/types/report-bundle.js +0 -6
  280. package/dist/types/result.js +0 -2
  281. package/dist/types/run-registry.js +0 -2
  282. package/dist/types/run.js +0 -2
  283. package/dist/types/sandbox.js +0 -2
  284. package/dist/types/schedule.js +0 -2
  285. package/dist/types/state-node.js +0 -2
  286. package/dist/types/topology.js +0 -2
  287. package/dist/types/trust.js +0 -2
  288. package/dist/types/workbench.js +0 -2
  289. package/dist/types/worker.js +0 -2
  290. package/dist/types/workflow-app.js +0 -2
  291. package/dist/types.js +0 -44
  292. package/dist/util/fingerprint.js +0 -19
  293. package/dist/util/fingerprint.test.js +0 -27
  294. package/dist/verifier.js +0 -78
  295. package/dist/version.js +0 -8
  296. package/dist/workbench-host.js +0 -182
  297. package/dist/workbench.js +0 -192
  298. package/dist/worker-accept/acceptance.js +0 -114
  299. package/dist/worker-accept/blackboard-fanout.js +0 -80
  300. package/dist/worker-accept/blackboard-linkage.js +0 -19
  301. package/dist/worker-accept/context.js +0 -2
  302. package/dist/worker-accept/telemetry-ledger.js +0 -126
  303. package/dist/worker-accept/validation.js +0 -77
  304. package/dist/worker-accept/verifier-completion.js +0 -73
  305. package/dist/worker-isolation/helpers.js +0 -51
  306. package/dist/worker-isolation/paths.js +0 -46
  307. package/dist/worker-isolation.js +0 -656
  308. package/dist/workflow-api.js +0 -131
  309. /package/dist/{types → core/types}/boundary.js +0 -0
@@ -1,490 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.runCli = runCli;
40
- const node_fs_1 = __importDefault(require("node:fs"));
41
- const node_path_1 = __importDefault(require("node:path"));
42
- const node_child_process_1 = require("node:child_process");
43
- const readline = __importStar(require("node:readline"));
44
- const orchestrator_1 = require("../orchestrator");
45
- const capability_core_1 = require("../capability-core");
46
- const scheduler_1 = require("../scheduler");
47
- const triggers_1 = require("../triggers");
48
- const io_1 = require("./io");
49
- const run_summary_1 = require("./run-summary");
50
- const audit_1 = require("./handlers/audit");
51
- const candidate_1 = require("./handlers/candidate");
52
- const operator_1 = require("./handlers/operator");
53
- const registry_1 = require("./handlers/registry");
54
- const multi_agent_1 = require("./handlers/multi-agent");
55
- const run_1 = require("./handlers/run");
56
- const collaboration_1 = require("./handlers/collaboration");
57
- const blackboard_1 = require("./handlers/blackboard");
58
- const eval_1 = require("./handlers/eval");
59
- const node_1 = require("./handlers/node");
60
- const maintenance_1 = require("./handlers/maintenance");
61
- const operational_1 = require("./handlers/operational");
62
- const scheduling_1 = require("./handlers/scheduling");
63
- const worker_1 = require("./handlers/worker");
64
- const clones_1 = require("./handlers/clones");
65
- const workbench_1 = require("./handlers/workbench");
66
- const operator_ux_1 = require("../operator-ux");
67
- const doctor_1 = require("../doctor");
68
- const orchestrator_2 = require("../orchestrator");
69
- const version_1 = require("../version");
70
- async function runCli(argv = process.argv.slice(2)) {
71
- const args = (0, orchestrator_1.parseArgv)(argv);
72
- // Top-level flags: accept --version / -v / --help / -h before command lookup.
73
- if (args.command?.startsWith("-") || !args.command) {
74
- if (args.command === "--version" || args.command === "-v" || args.options.v || args.options.version) {
75
- process.stdout.write(`${version_1.CURRENT_COOL_WORKFLOW_VERSION}\n`);
76
- return;
77
- }
78
- if (!args.command || args.command === "--help" || args.command === "-h" || args.options.h || args.options.help) {
79
- process.stdout.write((0, orchestrator_1.formatHelp)() + "\n");
80
- return;
81
- }
82
- }
83
- // Map vendor shorthand flags (-claude, -codex, -gemini, -deepseek) to --agent-command.
84
- if (args.options.claude)
85
- args.options["agent-command"] = "builtin:claude";
86
- if (args.options.codex)
87
- args.options["agent-command"] = "builtin:codex";
88
- if (args.options.gemini)
89
- args.options["agent-command"] = "builtin:gemini";
90
- if (args.options.deepseek)
91
- args.options["agent-command"] = "builtin:deepseek";
92
- // -dir / --dir / -d : an intuitive alias for --repo — the project folder to review,
93
- // so `cw -q "…" -dir /path` works from any directory (no cd). Explicit --repo wins.
94
- if (!args.options.repo && args.options.dir)
95
- args.options.repo = args.options.dir;
96
- // Presentation flags — set BEFORE any drive spawn so the out-of-process agent wrapper
97
- // inherits them via process.env (presentation-only; stdout/the cw:result fence are untouched):
98
- // --verbose full agent narration inline (default is compact: current action + summary)
99
- // --no-color disable ANSI everywhere (CW_NO_COLOR is honored by term.colorEnabled AND the
100
- // wrapper); complements NO_COLOR/FORCE_COLOR
101
- // --full also stream full narration AND print the report inline at run end
102
- if (args.options.verbose)
103
- process.env.CW_VERBOSE = "1";
104
- if (args.options["no-color"])
105
- process.env.CW_NO_COLOR = "1";
106
- if (args.options.full)
107
- process.env.CW_OUTPUT = "full";
108
- // `cw <verb> --help` / `-h` -> per-command help (the verb's subcommands +
109
- // one-line summaries), derived from the capability registry. Additive: the
110
- // bare `cw` / `cw --help` top-level help is handled above.
111
- if ((args.options.help || args.options.h) && args.command && !args.command.startsWith("-")) {
112
- process.stdout.write((0, orchestrator_1.formatCommandHelp)(args.command) + "\n");
113
- return;
114
- }
115
- // Bare -q / --question -> redirect to quickstart (auto-detect repo/agent/app).
116
- // CONSUME the positional (shift) so the question never survives as positionals[0]
117
- // — otherwise the quickstart handler reads it as the app id ("Workflow app not found").
118
- if (args.command === "-q" || args.command === "--question") {
119
- if (!args.options.question && args.positionals[0])
120
- args.options.question = args.positionals.shift();
121
- args.command = "quickstart";
122
- }
123
- else if (!args.command && typeof args.options.question === "string") {
124
- args.command = "quickstart";
125
- }
126
- const runner = new orchestrator_1.CoolWorkflowRunner({
127
- pluginRoot: node_path_1.default.resolve(__dirname, "../..")
128
- });
129
- const scheduler = new scheduler_1.Scheduler(String(args.options.cwd || process.cwd()));
130
- const triggers = new triggers_1.RoutineTriggerBridge(String(args.options.cwd || process.cwd()));
131
- switch (args.command) {
132
- case "help": {
133
- const [topic] = args.positionals;
134
- process.stdout.write((topic ? (0, orchestrator_1.formatCommandHelp)(topic) : (0, orchestrator_1.formatHelp)()) + "\n");
135
- return;
136
- }
137
- case undefined:
138
- process.stdout.write((0, orchestrator_1.formatHelp)() + "\n");
139
- return;
140
- case "version":
141
- process.stdout.write(`${version_1.CURRENT_COOL_WORKFLOW_VERSION}\n`);
142
- return;
143
- case "update": {
144
- process.stderr.write("Updating cool-workflow...\n");
145
- const npm = (0, node_child_process_1.spawnSync)("npm", ["update", "-g", "cool-workflow"], { encoding: "utf8", stdio: "inherit" });
146
- if (npm.status !== 0) {
147
- process.stderr.write("Update failed, trying install...\n");
148
- const install = (0, node_child_process_1.spawnSync)("npm", ["install", "-g", "cool-workflow@latest"], { encoding: "utf8", stdio: "inherit" });
149
- if (install.status !== 0) {
150
- process.stderr.write("Install failed. Check npm and try again.\n");
151
- process.exitCode = 1;
152
- }
153
- }
154
- return;
155
- }
156
- case "fix": {
157
- const report = (0, doctor_1.runDoctor)(args.options, process.env, String(args.options.cwd || process.cwd()));
158
- process.stdout.write(`${(0, doctor_1.formatDoctorFixes)(report)}\n`);
159
- if (!report.ok)
160
- process.exitCode = 1;
161
- return;
162
- }
163
- case "list":
164
- (0, io_1.printJson)(runner.listWorkflows());
165
- return;
166
- case "search": {
167
- const keyword = args.positionals.join(" ");
168
- if (!keyword.trim())
169
- throw new Error("Missing search keyword.\n Tip: cw search architecture to find workflows about architecture.");
170
- const apps = runner.listApps();
171
- const lower = keyword.toLowerCase();
172
- const results = apps.filter((a) => a.title.toLowerCase().includes(lower) || a.summary.toLowerCase().includes(lower) || a.id.toLowerCase().includes(lower)).map((a) => ({ id: a.id, title: a.title, summary: a.summary }));
173
- if ((0, io_1.wantsJson)(args.options))
174
- (0, io_1.printJson)(results);
175
- else
176
- process.stdout.write(`${(0, orchestrator_2.formatSearchResults)(keyword, results)}\n`);
177
- return;
178
- }
179
- case "man": {
180
- const [topic] = args.positionals;
181
- if (!topic)
182
- throw new Error("Missing topic.\n Tip: cw man release-tooling for the release tooling manual.");
183
- const docsDir = node_path_1.default.resolve(runner.pluginRoot, "docs");
184
- const candidates = [
185
- node_path_1.default.join(docsDir, `${topic}.7.md`),
186
- node_path_1.default.join(docsDir, `${topic}.md`),
187
- node_path_1.default.join(docsDir, `${topic}`)
188
- ];
189
- let found;
190
- for (const c of candidates) {
191
- try {
192
- if (node_fs_1.default.statSync(c).isFile()) {
193
- found = c;
194
- break;
195
- }
196
- }
197
- catch { /* keep looking */ }
198
- }
199
- if (!found)
200
- throw new Error(`Man page not found: ${topic}.\n Tip: cw list for workflow topics, or browse docs/ for manuals.`);
201
- process.stdout.write(node_fs_1.default.readFileSync(found, "utf8"));
202
- return;
203
- }
204
- case "info": {
205
- const [appId] = args.positionals;
206
- if (!appId)
207
- throw new Error("Missing workflow app id.\n Tip: list apps with \"cw list\", then \"cw info <id>\" for details");
208
- const data = runner.showApp(appId);
209
- if ((0, io_1.wantsJson)(args.options))
210
- (0, io_1.printJson)(data);
211
- else
212
- process.stdout.write(`${(0, orchestrator_2.formatInfo)(appId, data)}\n`);
213
- return;
214
- }
215
- case "doctor": {
216
- const report = (0, doctor_1.runDoctor)(args.options, process.env, String(args.options.cwd || process.cwd()));
217
- if ((0, io_1.wantsJson)(args.options))
218
- (0, io_1.printJson)(report);
219
- else if (args.options.fix)
220
- process.stdout.write(`${(0, doctor_1.formatDoctorFixes)(report)}\n`);
221
- else
222
- process.stdout.write(`${(0, doctor_1.formatDoctorReport)(report)}\n`);
223
- if (!report.ok)
224
- process.exitCode = 1;
225
- return;
226
- }
227
- case "init": {
228
- const [workflowId] = args.positionals;
229
- if (!workflowId)
230
- throw new Error("Missing workflow id.\n Tip: create one with \"cw init my-workflow\" or list with \"cw list\"");
231
- (0, io_1.printJson)(runner.init(workflowId, args.options));
232
- return;
233
- }
234
- case "app": {
235
- const [subcommand, appIdOrPath] = args.positionals;
236
- switch (subcommand) {
237
- case "list":
238
- (0, io_1.printJson)(runner.listApps());
239
- return;
240
- case "show":
241
- (0, io_1.printJson)(runner.showApp((0, io_1.required)(appIdOrPath, "app id")));
242
- return;
243
- case "validate": {
244
- const result = runner.validateApp((0, io_1.required)(appIdOrPath, "app path or id"));
245
- (0, io_1.printJson)(result);
246
- if (!result.valid)
247
- process.exitCode = 1;
248
- return;
249
- }
250
- case "init":
251
- (0, io_1.printJson)(runner.initApp((0, io_1.required)(appIdOrPath, "app id"), args.options));
252
- return;
253
- case "package":
254
- (0, io_1.printJson)(runner.packageApp((0, io_1.required)(appIdOrPath, "app id"), args.options));
255
- return;
256
- case "run":
257
- (0, io_1.printJson)((0, capability_core_1.appRun)(runner, { ...args.options, appId: (0, io_1.required)(appIdOrPath, "app id") }));
258
- return;
259
- default:
260
- throw new Error("Usage: cw.js app list|show|validate|init|package|run [app-id|path]");
261
- }
262
- }
263
- case "quickstart":
264
- case "audit-run": {
265
- // ONE-COMMAND first value (v0.1.38+): plan(app) -> run --drive -> report in a
266
- // single invocation. A thin UX wrapper over the EXISTING drive() pipeline — it
267
- // DELEGATES worker execution to the operator's configured agent backend and
268
- // fails closed (status=blocked) when none is set. No new executor/scheduler.
269
- const [appId] = args.positionals;
270
- const runId = (0, io_1.optionalArg)(args.options.run) || (0, io_1.optionalArg)(args.options.runId);
271
- await promptQuestion(args.options);
272
- const qs = (0, capability_core_1.quickstart)(runner, { ...args.options, ...(appId ? { appId } : {}), ...(runId ? { runId } : {}) });
273
- (0, io_1.printJson)(qs);
274
- const qr = qs;
275
- // Clean human summary on stderr (TTY-gated, inside the reporter). Suppressed under --json so
276
- // machine mode emits ONLY the stdout payload — no stderr chrome to parse around. The type
277
- // guard also skips --check/--preview results (no reportPath of their own). The summary is the
278
- // COMPACT findings table (re-parsed from each completed worker's cw:result), the report path,
279
- // and where the per-worker transcripts live — NOT the full prose (that's report.md/--full).
280
- if (!(0, io_1.wantsJson)(args.options) && typeof qr.runId === "string" && typeof qr.reportPath === "string") {
281
- (0, run_summary_1.emitRunSummary)(runner, args.options, {
282
- runId: qr.runId,
283
- reportPath: qr.reportPath,
284
- status: String(qr.status || ""),
285
- statePath: typeof qr.statePath === "string" ? qr.statePath : undefined,
286
- completedWorkers: typeof qr.completedWorkers === "number" ? qr.completedWorkers : undefined,
287
- plannedWorkers: typeof qr.plannedWorkers === "number" ? qr.plannedWorkers : undefined,
288
- agentConfigured: typeof qr.agentConfigured === "boolean" ? qr.agentConfigured : undefined
289
- });
290
- }
291
- if (qs.mode === "check" && qs.ok === false) {
292
- process.exitCode = 1;
293
- }
294
- // Fail closed: if --bundle produced an artifact that does not self-verify, exit
295
- // non-zero so `cw quickstart ... --bundle && send-to-client` cannot ship a report
296
- // whose bundle a client could not verify. Mirrors `report bundle`.
297
- if (qs.bundle && qs.bundle.ok === false) {
298
- process.exitCode = 1;
299
- }
300
- return;
301
- }
302
- case "plan": {
303
- const [workflowId] = args.positionals;
304
- if (!workflowId)
305
- throw new Error("Missing workflow id.\n Tip: plan an architecture review with \"cw plan architecture-review\"");
306
- (0, io_1.printJson)((0, capability_core_1.planSummary)(runner, workflowId, args.options));
307
- return;
308
- }
309
- case "status":
310
- if (!args.positionals[0]) {
311
- const nextActions = (0, operator_ux_1.adviseNoRun)();
312
- if ((0, io_1.wantsJson)(args.options))
313
- (0, io_1.printJson)({ runId: null, nextActions });
314
- else
315
- process.stdout.write(`No run selected\n\nNext Action\n${nextActions.map((action) => ` ${action.command}\n reason: ${action.reason}`).join("\n")}\n`);
316
- }
317
- else if ((0, io_1.wantsJson)(args.options))
318
- (0, io_1.printJson)(runner.status(args.positionals[0]));
319
- else {
320
- const summary = runner.operatorStatus(args.positionals[0]);
321
- process.stdout.write(`${(args.options.summary || args.options.brief ? (0, operator_ux_1.formatOperatorSummary)(summary) : (0, operator_ux_1.formatOperatorStatus)(summary))}\n`);
322
- }
323
- return;
324
- case "next":
325
- (0, io_1.printJson)(runner.next((0, io_1.required)(args.positionals[0], "run id"), args.options));
326
- return;
327
- case "dispatch":
328
- (0, io_1.printJson)(runner.dispatch((0, io_1.required)(args.positionals[0], "run id"), args.options));
329
- return;
330
- case "result": {
331
- const [runId, taskId, resultPath] = args.positionals;
332
- (0, io_1.printJson)(runner.recordResult((0, io_1.required)(runId, "run id"), (0, io_1.required)(taskId, "task id"), (0, io_1.required)(resultPath, "result file"), args.options));
333
- return;
334
- }
335
- case "state": {
336
- const [subcommand, runId] = args.positionals;
337
- switch (subcommand) {
338
- case "check": {
339
- const report = runner.checkState((0, io_1.required)(runId, "run id"), args.options);
340
- (0, io_1.printJson)(report);
341
- if (report.status === "unsupported")
342
- process.exitCode = 1;
343
- return;
344
- }
345
- default:
346
- throw new Error("Usage: cw.js state check <run-id> [--state PATH] [--write]");
347
- }
348
- }
349
- case "commit":
350
- if (args.positionals[0] === "summary") {
351
- const summary = runner.summarizeCommitRecords((0, io_1.required)(args.positionals[1], "run id"));
352
- if ((0, io_1.wantsJson)(args.options))
353
- (0, io_1.printJson)(summary);
354
- else
355
- process.stdout.write(`${(0, operator_ux_1.formatCommitSummary)(summary)}\n`);
356
- return;
357
- }
358
- (0, io_1.printJson)(runner.commit((0, io_1.required)(args.positionals[0], "run id"), args.options));
359
- return;
360
- case "report":
361
- (0, operator_1.handleReport)(args, runner);
362
- return;
363
- case "operator":
364
- (0, operator_1.handleOperator)(args, runner);
365
- return;
366
- case "graph":
367
- (0, operator_1.handleGraph)(args, runner);
368
- return;
369
- case "topology":
370
- (0, operator_1.handleTopology)(args, runner);
371
- return;
372
- case "summary":
373
- (0, operator_1.handleSummary)(args, runner);
374
- return;
375
- case "multi-agent":
376
- (0, multi_agent_1.handleMultiAgent)(args, runner);
377
- return;
378
- case "eval":
379
- (0, eval_1.handleEval)(args, runner);
380
- return;
381
- case "blackboard":
382
- (0, blackboard_1.handleBlackboard)(args, runner);
383
- return;
384
- case "coordinator":
385
- (0, blackboard_1.handleCoordinator)(args, runner);
386
- return;
387
- case "sandbox":
388
- (0, operational_1.handleSandbox)(args, runner);
389
- return;
390
- case "backend":
391
- (0, operational_1.handleBackend)(args, runner);
392
- return;
393
- case "contract":
394
- (0, operational_1.handleContract)(args, runner);
395
- return;
396
- case "node":
397
- (0, node_1.handleNode)(args, runner);
398
- return;
399
- case "migration":
400
- (0, operational_1.handleMigration)(args, runner);
401
- return;
402
- case "feedback":
403
- (0, operational_1.handleFeedback)(args, runner);
404
- return;
405
- case "worker":
406
- (0, worker_1.handleWorker)(args, runner);
407
- return;
408
- case "audit":
409
- (0, audit_1.handleAudit)(args, runner);
410
- return;
411
- case "candidate":
412
- (0, candidate_1.handleCandidate)(args, runner);
413
- return;
414
- // ---- Team Collaboration (v0.1.32) ------------------------------------
415
- case "approve":
416
- (0, collaboration_1.handleApprove)(args, runner);
417
- return;
418
- case "reject":
419
- (0, collaboration_1.handleReject)(args, runner);
420
- return;
421
- case "comment":
422
- (0, collaboration_1.handleComment)(args, runner);
423
- return;
424
- case "handoff":
425
- (0, collaboration_1.handleHandoff)(args, runner);
426
- return;
427
- case "review":
428
- (0, collaboration_1.handleReview)(args, runner);
429
- return;
430
- case "loop": {
431
- (0, io_1.printJson)(scheduler.create({ ...args.options, kind: "loop" }));
432
- return;
433
- }
434
- case "schedule":
435
- await (0, scheduling_1.handleSchedule)(args, scheduler);
436
- return;
437
- case "routine":
438
- (0, scheduling_1.handleRoutine)(args, triggers);
439
- return;
440
- case "registry":
441
- (0, registry_1.handleRegistry)(args, runner);
442
- return;
443
- case "metrics":
444
- (0, operational_1.handleMetrics)(args, runner);
445
- return;
446
- case "run":
447
- (0, run_1.handleRun)(args, runner);
448
- return;
449
- case "queue":
450
- (0, registry_1.handleQueue)(args, runner);
451
- return;
452
- case "sched":
453
- (0, scheduling_1.handleSched)(args, runner);
454
- return;
455
- case "clones":
456
- (0, clones_1.handleClones)(args);
457
- return;
458
- case "gc":
459
- (0, maintenance_1.handleGc)(args, runner);
460
- return;
461
- case "history":
462
- (0, registry_1.handleHistory)(args, runner);
463
- return;
464
- case "telemetry":
465
- (0, maintenance_1.handleTelemetry)(args, runner);
466
- return;
467
- case "demo":
468
- (0, maintenance_1.handleDemo)(args, runner);
469
- return;
470
- case "workbench":
471
- await (0, workbench_1.handleWorkbench)(args, runner);
472
- return;
473
- default:
474
- throw new Error(`Unknown command: ${args.command}${((0, orchestrator_1.suggestCommand)(String(args.command || "")) ? `. Did you mean: ${(0, orchestrator_1.suggestCommand)(String(args.command))}?` : "")}`);
475
- }
476
- }
477
- /** Prompt the user for a question interactively when --question is missing on a TTY. */
478
- async function promptQuestion(options) {
479
- if (options.question || !process.stdin.isTTY)
480
- return;
481
- const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
482
- return new Promise((resolve) => {
483
- rl.question("Question: ", (answer) => {
484
- rl.close();
485
- if (answer.trim())
486
- options.question = answer.trim();
487
- resolve();
488
- });
489
- });
490
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.humanBytes = humanBytes;
4
- exports.formatClonesList = formatClonesList;
5
- exports.formatClonesGc = formatClonesGc;
6
- exports.formatWorkbenchView = formatWorkbenchView;
7
- function humanBytes(n) {
8
- if (n < 1024)
9
- return `${n}B`;
10
- const units = ["KiB", "MiB", "GiB"];
11
- let v = n / 1024;
12
- let i = 0;
13
- while (v >= 1024 && i < units.length - 1) {
14
- v /= 1024;
15
- i += 1;
16
- }
17
- return `${v.toFixed(1)}${units[i]}`;
18
- }
19
- function formatClonesList(result) {
20
- if (result.count === 0)
21
- return `No cached remote checkouts in ${result.clonesDir}.`;
22
- const rows = result.entries.map((e) => {
23
- const when = e.fetchedAt ? e.fetchedAt.replace("T", " ").replace(/\..*$/, "Z") : "unknown";
24
- return ` ${e.kind.padEnd(7)} ${humanBytes(e.bytes).padStart(8)} ${when} ${e.url}${e.ref ? `@${e.ref}` : ""}`;
25
- });
26
- return [
27
- `${result.count} cached checkout${result.count === 1 ? "" : "s"} — ${humanBytes(result.totalBytes)} in ${result.clonesDir}`,
28
- " KIND SIZE FETCHED SOURCE",
29
- ...rows,
30
- `\nReclaim with: cw clones gc --older-than-days 30 (or --all)`
31
- ].join("\n");
32
- }
33
- function formatClonesGc(result) {
34
- const scope = result.all ? "all entries" : `entries older than ${result.olderThanDays} day(s)`;
35
- if (result.removed.length === 0)
36
- return `Nothing to reclaim (${scope}); ${result.keptCount} kept in ${result.clonesDir}.`;
37
- const rows = result.removed.map((r) => ` ${humanBytes(r.bytes).padStart(8)} ${r.url}`);
38
- return [
39
- `Reclaimed ${result.removed.length} checkout${result.removed.length === 1 ? "" : "s"} (${scope}) — freed ${humanBytes(result.freedBytes)}; ${result.keptCount} kept`,
40
- ...rows
41
- ].join("\n");
42
- }
43
- function formatWorkbenchView(view) {
44
- const lines = [
45
- `Workbench view ${view.runId} (${view.resolved ? "resolved" : "UNRESOLVED"})`,
46
- view.error ? ` error: ${view.error}` : ""
47
- ].filter(Boolean);
48
- for (const [group, panels] of Object.entries(view.panels)) {
49
- lines.push(` ${group}:`);
50
- for (const [name, panel] of Object.entries(panels)) {
51
- const note = panel.status === "present" ? panel.capability : `absent (${panel.error || "unreadable"})`;
52
- lines.push(` ${name}: ${panel.status} — ${note}`);
53
- }
54
- }
55
- return lines.join("\n");
56
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleAudit = handleAudit;
4
- const capability_core_1 = require("../../capability-core");
5
- const operator_ux_1 = require("../../operator-ux");
6
- const io_1 = require("../io");
7
- /** `cw audit summary|verify|worker|provenance|multi-agent|policy|role|blackboard|judge|attest|decision <run-id> [worker-id|role-id]`. */
8
- function handleAudit(args, runner) {
9
- const [subcommand, runId, id] = args.positionals;
10
- switch (subcommand) {
11
- case "summary":
12
- (0, io_1.printJson)(runner.auditSummary((0, io_1.required)(runId, "run id")));
13
- return;
14
- case "verify": {
15
- const result = (0, capability_core_1.auditVerify)(runner, { ...args.options, runId: (0, io_1.required)(runId, "run id") });
16
- (0, io_1.printJson)(result);
17
- // Fail-closed: any unverified chain exits non-zero so `cw audit verify
18
- // <run> && deploy` stops — mirrors the telemetry-verify guard. verifyTrustAudit
19
- // returns verified:true for a truly absent/empty chain (nothing to prove),
20
- // so this stays exit 0 there; a FULLY-corrupt log reports present:false but
21
- // verified:false (corruptLines>0) and must NOT be conflated with absent — the
22
- // earlier `present && ...` guard let that severe tamper escape (exit 0).
23
- if (!result.verified)
24
- process.exitCode = 1;
25
- return;
26
- }
27
- case "worker":
28
- (0, io_1.printJson)(runner.workerAudit((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "worker id")));
29
- return;
30
- case "provenance":
31
- (0, io_1.printJson)(runner.evidenceProvenance((0, io_1.required)(runId, "run id"), args.options));
32
- return;
33
- case "multi-agent": {
34
- const view = runner.auditMultiAgent((0, io_1.required)(runId, "run id"));
35
- if ((0, io_1.wantsJson)(args.options))
36
- (0, io_1.printJson)(view);
37
- else
38
- process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
39
- return;
40
- }
41
- case "policy": {
42
- const view = runner.auditPolicy((0, io_1.required)(runId, "run id"));
43
- if ((0, io_1.wantsJson)(args.options))
44
- (0, io_1.printJson)(view);
45
- else
46
- process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
47
- return;
48
- }
49
- case "role": {
50
- const view = runner.auditRole((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "role id"));
51
- if ((0, io_1.wantsJson)(args.options))
52
- (0, io_1.printJson)(view);
53
- else
54
- process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
55
- return;
56
- }
57
- case "blackboard": {
58
- const view = runner.auditBlackboard((0, io_1.required)(runId, "run id"));
59
- if ((0, io_1.wantsJson)(args.options))
60
- (0, io_1.printJson)(view);
61
- else
62
- process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
63
- return;
64
- }
65
- case "judge": {
66
- const view = runner.auditJudge((0, io_1.required)(runId, "run id"));
67
- if ((0, io_1.wantsJson)(args.options))
68
- (0, io_1.printJson)(view);
69
- else
70
- process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
71
- return;
72
- }
73
- case "attest":
74
- (0, io_1.printJson)(runner.recordAuditAttestation((0, io_1.required)(runId, "run id"), args.options));
75
- return;
76
- case "decision":
77
- (0, io_1.printJson)(runner.recordAuditDecision((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "worker id"), args.options));
78
- return;
79
- default:
80
- throw new Error("Usage: cw.js audit summary|worker|provenance|multi-agent|policy|role|blackboard|judge|attest|decision <run-id> [worker-id|role-id]");
81
- }
82
- }