cool-workflow 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/README.md +7 -5
  4. package/apps/architecture-review/app.json +2 -2
  5. package/apps/architecture-review/workflow.js +12 -12
  6. package/apps/architecture-review-fast/app.json +1 -1
  7. package/apps/end-to-end-golden-path/app.json +1 -1
  8. package/apps/pr-review-fix-ci/app.json +1 -1
  9. package/apps/release-cut/app.json +1 -1
  10. package/apps/research-synthesis/app.json +1 -1
  11. package/dist/cli/dispatch.js +20 -88
  12. package/dist/cli/parseargv.js +6 -3
  13. package/dist/core/capability-data.js +270 -0
  14. package/dist/core/capability-table.js +15 -3519
  15. package/dist/core/format/help.js +30 -7
  16. package/dist/core/hash.js +1 -1
  17. package/dist/core/multi-agent/candidate-scoring.js +1 -1
  18. package/dist/core/multi-agent/collaboration.js +3 -2
  19. package/dist/core/multi-agent/coordinator.js +4 -3
  20. package/dist/core/multi-agent/eval-replay.js +1 -1
  21. package/dist/core/multi-agent/runtime.js +2 -2
  22. package/dist/core/multi-agent/trust-policy.js +1 -1
  23. package/dist/core/pipeline/commit-gate.js +2 -1
  24. package/dist/core/pipeline/contract.js +1 -1
  25. package/dist/core/pipeline/drive-decide.js +1 -1
  26. package/dist/core/state/contract-migration.js +1 -1
  27. package/dist/core/state/migrations.js +2 -2
  28. package/dist/core/state/node-snapshot.js +1 -1
  29. package/dist/core/state/state-explosion/digest.js +3 -2
  30. package/dist/core/state/state-explosion/graph.js +13 -12
  31. package/dist/core/state/state-explosion/helpers.js +5 -4
  32. package/dist/core/state/state-explosion/report.js +1 -1
  33. package/dist/core/state/state-explosion/size.js +1 -1
  34. package/dist/core/state/state-node.js +2 -2
  35. package/dist/core/state/types.js +1 -1
  36. package/dist/core/trust/ledger.js +3 -2
  37. package/dist/core/trust/telemetry-attestation.js +3 -3
  38. package/dist/core/trust/telemetry-ledger.js +2 -2
  39. package/dist/core/types/execution-backend.js +18 -0
  40. package/dist/core/types/observability.js +7 -0
  41. package/dist/core/util/collate.js +23 -0
  42. package/dist/core/version.js +1 -1
  43. package/dist/core/workflow-apps/app-schema.js +1 -1
  44. package/dist/mcp/dispatch.js +1 -1
  45. package/dist/mcp/server.js +1 -1
  46. package/dist/shell/agent-config.js +1 -1
  47. package/dist/shell/audit-cli.js +46 -2
  48. package/dist/shell/commit-summary.js +2 -1
  49. package/dist/shell/doctor.js +17 -4
  50. package/dist/shell/drive.js +47 -19
  51. package/dist/shell/evidence-reasoning.js +4 -3
  52. package/dist/shell/execution-backend/agent.js +42 -10
  53. package/dist/shell/execution-backend/ci.js +1 -1
  54. package/dist/shell/execution-backend/container.js +1 -1
  55. package/dist/shell/execution-backend/envelopes.js +1 -1
  56. package/dist/shell/execution-backend/local.js +1 -1
  57. package/dist/shell/execution-backend/probes.js +1 -1
  58. package/dist/shell/execution-backend/registry.js +3 -2
  59. package/dist/shell/execution-backend/remote.js +1 -1
  60. package/dist/shell/execution-backend/types.js +0 -9
  61. package/dist/shell/fs-atomic.js +15 -2
  62. package/dist/shell/ledger-io.js +1 -1
  63. package/dist/shell/metrics-cli.js +4 -2
  64. package/dist/shell/multi-agent-host.js +1 -1
  65. package/dist/shell/multi-agent-operator-ux.js +4 -3
  66. package/dist/shell/observability.js +12 -11
  67. package/dist/shell/onramp.js +17 -1
  68. package/dist/shell/operator-ux-text.js +2 -1
  69. package/dist/shell/operator-ux.js +7 -6
  70. package/dist/shell/pipeline-cli.js +82 -72
  71. package/dist/shell/reclamation-io.js +3 -2
  72. package/dist/shell/registry-cli.js +15 -0
  73. package/dist/shell/report.js +2 -1
  74. package/dist/shell/run-registry-io.js +1 -1
  75. package/dist/shell/run-store.js +17 -0
  76. package/dist/shell/sandbox-profile.js +1 -1
  77. package/dist/shell/scheduler-io.js +46 -37
  78. package/dist/shell/scheduling-io.js +32 -22
  79. package/dist/shell/state-explosion-cli.js +2 -1
  80. package/dist/shell/telemetry-ledger-io.js +1 -1
  81. package/dist/shell/term.js +1 -1
  82. package/dist/shell/topology-io.js +2 -1
  83. package/dist/shell/trust-audit.js +45 -5
  84. package/dist/shell/workbench-host.js +9 -1
  85. package/dist/shell/workbench.js +6 -11
  86. package/dist/shell/worker-cli.js +9 -1
  87. package/dist/shell/worker-isolation.js +34 -9
  88. package/dist/shell/workflow-app-loader.js +3 -2
  89. package/dist/wiring/capability-table/basics.js +66 -0
  90. package/dist/wiring/capability-table/exec-backend.js +162 -0
  91. package/dist/wiring/capability-table/index.js +42 -0
  92. package/dist/wiring/capability-table/multi-agent.js +623 -0
  93. package/dist/wiring/capability-table/parity.js +466 -0
  94. package/dist/wiring/capability-table/pipeline.js +280 -0
  95. package/dist/wiring/capability-table/registry-core.js +189 -0
  96. package/dist/wiring/capability-table/reporting.js +394 -0
  97. package/dist/wiring/capability-table/scheduling-registry.js +558 -0
  98. package/dist/wiring/capability-table/state.js +173 -0
  99. package/dist/wiring/capability-table/trust-ledger.js +134 -0
  100. package/dist/wiring/capability-table/workflow-apps.js +366 -0
  101. package/docs/agent-delegation-drive.7.md +4 -0
  102. package/docs/cli-mcp-parity.7.md +9 -2
  103. package/docs/contract-migration-tooling.7.md +4 -0
  104. package/docs/control-plane-scheduling.7.md +4 -0
  105. package/docs/durable-state-and-locking.7.md +24 -0
  106. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  107. package/docs/execution-backends.7.md +4 -0
  108. package/docs/index.md +1 -0
  109. package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
  110. package/docs/multi-agent-eval-replay-harness.7.md +4 -0
  111. package/docs/multi-agent-operator-ux.7.md +4 -0
  112. package/docs/node-snapshot-diff-replay.7.md +4 -0
  113. package/docs/observability-cost-accounting.7.md +6 -1
  114. package/docs/project-index.md +30 -5
  115. package/docs/real-execution-backends.7.md +4 -0
  116. package/docs/release-and-migration.7.md +4 -0
  117. package/docs/release-tooling.7.md +4 -0
  118. package/docs/remote-source-review.7.md +4 -4
  119. package/docs/report-verifiable-bundle.7.md +1 -1
  120. package/docs/run-registry-control-plane.7.md +4 -0
  121. package/docs/run-retention-reclamation.7.md +4 -0
  122. package/docs/security-trust-hardening.7.md +33 -1
  123. package/docs/state-explosion-management.7.md +4 -0
  124. package/docs/team-collaboration.7.md +4 -0
  125. package/docs/trust-audit-anchor.7.md +69 -0
  126. package/docs/web-desktop-workbench.7.md +15 -1
  127. package/manifest/plugin.manifest.json +1 -1
  128. package/package.json +3 -1
  129. package/scripts/agents/agent-adapter-core.js +22 -2
  130. package/scripts/agents/claude-p-agent.js +8 -3
  131. package/scripts/agents/gemini-agent.js +5 -1
  132. package/scripts/agents/opencode-agent.js +5 -1
  133. package/scripts/bump-version.js +24 -2
  134. package/scripts/canonical-apps.js +4 -4
  135. package/scripts/dogfood-release.js +1 -1
  136. package/scripts/golden-path.js +4 -4
  137. package/scripts/purity-baseline.json +68 -0
  138. package/scripts/purity-gate.js +239 -0
  139. package/scripts/release-check.js +8 -1
  140. package/scripts/version-sync-check.js +33 -12
  141. package/workflows/README.md +19 -0
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ // wiring/capability-table/exec-backend.ts — MILESTONE 5 (execution backend,
3
+ // agent spawn, sandbox) CLI bindings: sandbox.*, backend.*, app.run. Split
4
+ // out of core/capability-table.ts, byte-for-byte (extracted with sed, not
5
+ // retyped).
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const registry_core_1 = require("./registry-core");
8
+ // MILESTONE 5 (execution backend, agent spawn, sandbox) CLI bindings:
9
+ // sandbox.list|show|validate, backend.list|show|probe,
10
+ // backend.agent.config.show|set, doctor, fix. Handler BODIES live in
11
+ // shell/exec-backend-cli.ts / shell/doctor.ts (impure — env/fs reads);
12
+ // this table only wires argv shape -> handler call, per cli/dispatch.ts's
13
+ // generic executor contract. `sandbox.list`/`backend.list` are ALREADY
14
+ // declared MCP-only rows from milestone 2 (MCP_TOOL_DATA above) — this
15
+ // section layers a `cli` binding onto them (attachCliBinding) and replaces
16
+ // their milestone-2 placeholder `mcp.handler` with the real body, exactly
17
+ // as milestones 3/4 did for their own rows.
18
+ // ---------------------------------------------------------------------
19
+ const exec_backend_cli_1 = require("../../shell/exec-backend-cli");
20
+ const doctor_1 = require("../../shell/doctor");
21
+ const io_1 = require("../../cli/io");
22
+ const app_run_cli_1 = require("../../shell/app-run-cli");
23
+ (0, registry_core_1.attachCliBinding)("sandbox.list", {
24
+ path: ["sandbox", "list"],
25
+ jsonMode: "default",
26
+ handler: (args) => ({ json: (0, exec_backend_cli_1.listSandboxProfilesCli)(args.options) }),
27
+ });
28
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sandbox.list").mcp.handler = (args) => (0, exec_backend_cli_1.listSandboxProfilesCli)(args);
29
+ // GAP #24: cw_sandbox_choose / cw_sandbox_resolve + cw_app_run were declared
30
+ // MCP-only rows with the notYetImplemented placeholder handler. Wire them to
31
+ // the ported shell bodies (both are MCP-only in the old build — no CLI path).
32
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sandbox.choose").mcp.handler = (args) => (0, app_run_cli_1.sandboxChooseCli)(args);
33
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sandbox.resolve").mcp.handler = (args) => (0, app_run_cli_1.sandboxChooseCli)(args);
34
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("app.run").mcp.handler = (args) => (0, app_run_cli_1.appRunCli)(args);
35
+ (0, registry_core_1.attachCliBinding)("sandbox.show", {
36
+ path: ["sandbox", "show"],
37
+ jsonMode: "default",
38
+ handler: (args) => ({ json: (0, exec_backend_cli_1.showSandboxProfileCli)((0, io_1.required)(args.positionals[0], "profile id"), args.options) }),
39
+ });
40
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sandbox.show").mcp.handler = (args) => (0, exec_backend_cli_1.showSandboxProfileCli)((0, io_1.required)((0, io_1.optionalArg)(args.profileId), "profile id"), args);
41
+ (0, registry_core_1.attachCliBinding)("sandbox.validate", {
42
+ path: ["sandbox", "validate"],
43
+ jsonMode: "default",
44
+ handler: (args) => {
45
+ const result = (0, exec_backend_cli_1.validateSandboxProfileCli)((0, io_1.required)(args.positionals[0], "profile file"), args.options);
46
+ return { json: result, exitCode: result.valid ? undefined : 1 };
47
+ },
48
+ });
49
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sandbox.validate").mcp.handler = (args) => (0, exec_backend_cli_1.validateSandboxProfileCli)((0, io_1.required)((0, io_1.optionalArg)(args.profileFile), "profile file"), args);
50
+ // PARITY: `sandbox.choose`/`sandbox.resolve` are BOTH-surface capabilities
51
+ // per SPEC/mcp.md (old build cli.path ["sandbox","choose"]/["sandbox",
52
+ // "resolve"]) — they were left MCP-only at GAP #24 (see the comment
53
+ // above sandboxChooseCli's mcp.handler wiring). Attach the same, already-
54
+ // working shell body as the cli.handler too, so the CLI front door and
55
+ // the parity payload probe both reach it (no new business logic, same
56
+ // function both surfaces already call over MCP).
57
+ (0, registry_core_1.attachCliBinding)("sandbox.choose", {
58
+ path: ["sandbox", "choose"],
59
+ jsonMode: "default",
60
+ handler: (args) => ({ json: (0, app_run_cli_1.sandboxChooseCli)(args.options) }),
61
+ });
62
+ (0, registry_core_1.attachCliBinding)("sandbox.resolve", {
63
+ path: ["sandbox", "resolve"],
64
+ jsonMode: "default",
65
+ handler: (args) => ({ json: (0, app_run_cli_1.sandboxChooseCli)(args.options) }),
66
+ });
67
+ (0, registry_core_1.attachCliBinding)("backend.list", {
68
+ path: ["backend", "list"],
69
+ jsonMode: "default",
70
+ handler: () => ({ json: (0, exec_backend_cli_1.listBackendsCli)() }),
71
+ });
72
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.list").mcp.handler = () => (0, exec_backend_cli_1.listBackendsCli)();
73
+ (0, registry_core_1.attachCliBinding)("backend.show", {
74
+ path: ["backend", "show"],
75
+ jsonMode: "default",
76
+ handler: (args) => ({ json: (0, exec_backend_cli_1.showBackendCli)((0, io_1.required)(args.positionals[0], "backend id")) }),
77
+ });
78
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.show").mcp.handler = (args) => (0, exec_backend_cli_1.showBackendCli)((0, io_1.required)((0, io_1.optionalArg)(args.backendId), "backend id"));
79
+ (0, registry_core_1.attachCliBinding)("backend.probe", {
80
+ path: ["backend", "probe"],
81
+ jsonMode: "default",
82
+ handler: (args) => ({ json: (0, exec_backend_cli_1.probeBackendCli)(args.positionals[0], args.options) }),
83
+ });
84
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.probe").mcp.handler = (args) => (0, exec_backend_cli_1.probeBackendCli)((0, io_1.optionalArg)(args.backendId), args);
85
+ // `backend agent config [show]` = read-only; `backend agent config set
86
+ // ...` = mutating. CLI path is ["backend", "agent"] (2 tokens, matching
87
+ // dispatchTable's supported path lengths); the remaining positionals
88
+ // ("config", "show"/"set") are read inside the handler, byte-exact to the
89
+ // old build's handleBackend "agent" case (src/cli/handlers/
90
+ // operational.ts:52-62).
91
+ (0, registry_core_1.attachCliBinding)("backend.agent.config.show", {
92
+ path: ["backend", "agent"],
93
+ helpPath: ["backend", "agent", "config"],
94
+ jsonMode: "default",
95
+ handler: (args) => {
96
+ const action = args.positionals[1];
97
+ if (action === "set")
98
+ return { json: (0, exec_backend_cli_1.backendAgentConfigSet)(args.options) };
99
+ return { json: (0, exec_backend_cli_1.backendAgentConfigShow)(args.options) };
100
+ },
101
+ });
102
+ // `backend.agent.config.set` shares the SAME dispatch path/handler as
103
+ // `.show` above (dispatchTable only supports 2-token paths, and the
104
+ // show-vs-set branch lives inside that one handler on positionals[1] —
105
+ // byte-exact to the old build's handleBackend "agent" case). This second
106
+ // attachCliBinding call exists ONLY so `cw help backend` lists both rows
107
+ // (cliCommandHelpRows iterates cliCapabilities(), one row per capability),
108
+ // matching the old registry's two declared rows sharing one caseTokens
109
+ // group; dispatchTable itself never reaches this row a second time because
110
+ // `backend.agent.config.show`'s row is found first by
111
+ // findCapabilityByCliPath's linear scan and its handler already covers
112
+ // both actions.
113
+ (0, registry_core_1.attachCliBinding)("backend.agent.config.set", {
114
+ path: ["backend", "agent"],
115
+ helpPath: ["backend", "agent", "config"],
116
+ jsonMode: "default",
117
+ handler: (args) => {
118
+ const action = args.positionals[1];
119
+ if (action === "set")
120
+ return { json: (0, exec_backend_cli_1.backendAgentConfigSet)(args.options) };
121
+ return { json: (0, exec_backend_cli_1.backendAgentConfigShow)(args.options) };
122
+ },
123
+ });
124
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.agent.config.show").mcp.handler = (args) => (0, exec_backend_cli_1.backendAgentConfigShow)(args);
125
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.agent.config.set").mcp.handler = (args) => (0, exec_backend_cli_1.backendAgentConfigSet)(args);
126
+ // PARITY: `backend.agent.config.set` mutates $CW_HOME/agent-config.json
127
+ // (secret-stripped) before returning the effective config; both surfaces
128
+ // perform the same write, so it is a documented opt-out from the
129
+ // read-payload probe, not an undocumented divergence.
130
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.agent.config.set").payloadIdentical = false;
131
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("backend.agent.config.set").reason =
132
+ "Mutating: persists $CW_HOME/agent-config.json (secret-stripped) before returning the effective config; both surfaces perform the same write — it is a surface-mutating verb, not a read probe.";
133
+ (0, registry_core_1.addCliOnlyCapability)("doctor", "Diagnose the host for setup problems (Node version, agent backend, agent binary on PATH, git, writable home/repo state) and print an actionable fix per check.", {
134
+ path: ["doctor"],
135
+ jsonMode: "flag",
136
+ handler: (args) => {
137
+ const report = (0, doctor_1.runDoctor)(args.options, process.env, String(args.options.cwd || process.cwd()));
138
+ // Byte-exact port of src/cli/command-surface.ts:170-176: both text
139
+ // branches are written as `${formatX(report)}\n` UNCONDITIONALLY —
140
+ // formatDoctorFixes already ends in its own "\n" (its last joined
141
+ // element is ""), so its case needs one MORE explicit "\n" here to
142
+ // reproduce that unconditional append; cli/dispatch.ts's generic
143
+ // renderer only appends "\n" when the text does NOT already end in
144
+ // one, so a bare `formatDoctorFixes(report)` here would silently
145
+ // drop the old build's trailing blank line.
146
+ const text = (0, io_1.wantsJson)(args.options) ? undefined : args.options.fix ? `${(0, doctor_1.formatDoctorFixes)(report)}\n` : (0, doctor_1.formatDoctorReport)(report);
147
+ return { json: report, text, exitCode: report.ok ? undefined : 1 };
148
+ },
149
+ }, "Environment diagnostics are inherently local to the CLI host — Node version, $PATH, $CW_HOME/cwd writability. An MCP client diagnosing the server process's environment is not meaningful; agents already receive the same readiness facts in their typed results (e.g. status: blocked, agentConfigured). Inspired by `brew doctor`.");
150
+ (0, registry_core_1.addCliOnlyCapability)("fix", "Print consolidated fix commands for CW setup issues.", {
151
+ path: ["fix"],
152
+ jsonMode: "human",
153
+ handler: (args) => {
154
+ const report = (0, doctor_1.runDoctor)(args.options, process.env, String(args.options.cwd || process.cwd()));
155
+ // See the "doctor" handler's comment above: formatDoctorFixes
156
+ // already ends in "\n", so one more explicit "\n" here reproduces
157
+ // src/cli/command-surface.ts:126-130's unconditional
158
+ // `${formatDoctorFixes(report)}\n` write.
159
+ return { text: `${(0, doctor_1.formatDoctorFixes)(report)}\n`, exitCode: report.ok ? undefined : 1 };
160
+ },
161
+ }, "Environment fix commands are local diagnostics, same reasoning as doctor.");
162
+ // ---------------------------------------------------------------------
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // wiring/capability-table/index.ts — composes the capability table from
3
+ // registry-core (the shared machinery) plus every domain slice, in the
4
+ // EXACT original source order (REGISTRY array order is a pinned
5
+ // behavior: tools/list order, gen-parity-doc's byte-diff gate, cw help
6
+ // line order). Each slice is a plain module whose top-level
7
+ // attachCliBinding/addCliOnlyCapability/REGISTRY_BY_CAPABILITY calls run
8
+ // once, at first import — Node's module system guarantees that happens
9
+ // in exactly the order these imports are written below, the same
10
+ // guarantee the single original file relied on for its own top-to-bottom
11
+ // statement order.
12
+ //
13
+ // No slice imports another slice; every slice imports only from
14
+ // registry-core.ts, core/capability-data.ts, and shell/core as needed —
15
+ // so this file is the only place the full domain list is assembled, and
16
+ // there is no cross-slice circular dependency to reason about.
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./registry-core"), exports);
33
+ require("./basics");
34
+ require("./state");
35
+ require("./exec-backend");
36
+ require("./pipeline");
37
+ require("./trust-ledger");
38
+ require("./multi-agent");
39
+ require("./scheduling-registry");
40
+ require("./reporting");
41
+ require("./workflow-apps");
42
+ __exportStar(require("./parity"), exports);