cool-workflow 0.1.82 → 0.1.84

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 (92) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/.codex-plugin/plugin.json +4 -4
  3. package/README.md +128 -120
  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/capability-core.js +16 -8
  11. package/dist/capability-registry.js +270 -0
  12. package/dist/cli/command-surface.js +1320 -0
  13. package/dist/cli.js +2 -1307
  14. package/dist/commit.js +5 -1
  15. package/dist/doctor.js +153 -0
  16. package/dist/mcp-server.js +15 -1451
  17. package/dist/mcp-surface.js +1441 -0
  18. package/dist/orchestrator.js +13 -0
  19. package/dist/reclamation/hash.js +72 -0
  20. package/dist/reclamation.js +25 -78
  21. package/dist/run-registry/queue.js +6 -7
  22. package/dist/run-registry.js +35 -24
  23. package/dist/scheduler.js +78 -53
  24. package/dist/version.js +1 -1
  25. package/dist/worker-accept/acceptance.js +114 -0
  26. package/dist/worker-accept/blackboard-fanout.js +80 -0
  27. package/dist/worker-accept/blackboard-linkage.js +19 -0
  28. package/dist/worker-accept/context.js +2 -0
  29. package/dist/worker-accept/telemetry-ledger.js +116 -0
  30. package/dist/worker-accept/validation.js +77 -0
  31. package/dist/worker-accept/verifier-completion.js +73 -0
  32. package/dist/worker-isolation.js +41 -446
  33. package/docs/agent-delegation-drive.7.md +94 -86
  34. package/docs/agent-framework.md +33 -32
  35. package/docs/candidate-scoring.7.md +26 -24
  36. package/docs/canonical-workflow-apps.7.md +40 -40
  37. package/docs/capability-topology-registry.7.md +24 -24
  38. package/docs/cli-mcp-parity.7.md +230 -154
  39. package/docs/contract-migration-tooling.7.md +52 -41
  40. package/docs/control-plane-scheduling.7.md +49 -41
  41. package/docs/coordinator-blackboard.7.md +30 -30
  42. package/docs/dogfood-one-real-repo.7.md +44 -44
  43. package/docs/durable-state-and-locking.7.md +38 -30
  44. package/docs/end-to-end-golden-path.7.md +29 -29
  45. package/docs/error-feedback.7.md +27 -27
  46. package/docs/evidence-adoption-reasoning-chain.7.md +66 -58
  47. package/docs/execution-backends.7.md +88 -80
  48. package/docs/getting-started.md +35 -18
  49. package/docs/index.md +3 -3
  50. package/docs/mcp-app-surface.7.md +64 -64
  51. package/docs/multi-agent-cli-mcp-surface.7.md +86 -77
  52. package/docs/multi-agent-eval-replay-harness.7.md +63 -55
  53. package/docs/multi-agent-operator-ux.7.md +73 -65
  54. package/docs/multi-agent-runtime-core.7.md +39 -39
  55. package/docs/multi-agent-topologies.7.md +24 -24
  56. package/docs/multi-agent-trust-policy-audit.7.md +38 -38
  57. package/docs/node-snapshot-diff-replay.7.md +30 -22
  58. package/docs/observability-cost-accounting.7.md +53 -45
  59. package/docs/operator-ux.7.md +30 -30
  60. package/docs/pipeline-runner.7.md +31 -31
  61. package/docs/project-index.md +16 -5
  62. package/docs/real-execution-backends.7.md +51 -43
  63. package/docs/release-and-migration.7.md +46 -38
  64. package/docs/release-tooling.7.md +67 -50
  65. package/docs/routines.md +16 -16
  66. package/docs/run-registry-control-plane.7.md +124 -116
  67. package/docs/run-retention-reclamation.7.md +49 -41
  68. package/docs/sandbox-profiles.7.md +32 -32
  69. package/docs/scheduled-tasks.md +14 -14
  70. package/docs/security-trust-hardening.7.md +29 -29
  71. package/docs/source-context-profiles.7.md +28 -28
  72. package/docs/state-explosion-management.7.md +67 -59
  73. package/docs/state-node.7.md +8 -8
  74. package/docs/team-collaboration.7.md +66 -58
  75. package/docs/trust-model.md +126 -126
  76. package/docs/unix-principles.md +80 -80
  77. package/docs/vendor-manifest-loadability.7.md +20 -20
  78. package/docs/verifier-gated-commit.7.md +16 -16
  79. package/docs/web-desktop-workbench.7.md +73 -65
  80. package/docs/worker-isolation.7.md +34 -37
  81. package/docs/workflow-app-framework.7.md +38 -38
  82. package/manifest/plugin.manifest.json +4 -4
  83. package/package.json +3 -2
  84. package/scripts/bump-version.js +9 -1
  85. package/scripts/canonical-apps.js +4 -4
  86. package/scripts/dogfood-release.js +1 -1
  87. package/scripts/gen-parity-doc.js +106 -0
  88. package/scripts/golden-path.js +4 -4
  89. package/scripts/parity-check.js +27 -57
  90. package/scripts/release-flow.js +7 -6
  91. package/scripts/sync-project-index.js +1 -1
  92. package/dist/verifier-registry.js +0 -46
package/dist/commit.js CHANGED
@@ -584,7 +584,11 @@ function readGitHead(cwd) {
584
584
  return (0, node_child_process_1.execFileSync)("git", ["rev-parse", "HEAD"], {
585
585
  cwd,
586
586
  encoding: "utf8",
587
- stdio: ["ignore", "pipe", "ignore"]
587
+ stdio: ["ignore", "pipe", "ignore"],
588
+ // Bound the call: a hung filesystem, a held .git/index.lock, or a
589
+ // credential-helper prompt must not block the commit path forever. A
590
+ // timeout throws, which the catch below maps to "no git head".
591
+ timeout: 5000
588
592
  }).trim();
589
593
  }
590
594
  catch {
package/dist/doctor.js ADDED
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runDoctor = runDoctor;
7
+ exports.formatDoctorReport = formatDoctorReport;
8
+ // `cw doctor` — environment diagnostics, in the spirit of `brew doctor`.
9
+ //
10
+ // Homebrew's `doctor` turned "something is subtly wrong with your setup" into a
11
+ // proactive, named list of problems each paired with a concrete fix. We borrow
12
+ // that idea: instead of letting a missing agent / old Node / unwritable state
13
+ // surface as a confusing mid-run failure, `cw doctor` probes the host up front
14
+ // and prints WHAT is wrong and WHAT TO DO about it.
15
+ //
16
+ // Discipline:
17
+ // - READ-ONLY. Probes versions, $PATH, and the WRITABILITY of the nearest
18
+ // existing ancestor dir (via access(2)) — it never creates `.cw/` or $CW_HOME
19
+ // as a side effect, so running `doctor` changes nothing on disk.
20
+ // - FAIL CLOSED. Any `fail` check ⇒ `ok:false` ⇒ the CLI exits non-zero. A
21
+ // `warn` (e.g. no agent yet — demo/preview still work) does not fail.
22
+ // - TWO RENDERINGS. Human text by default; a stable `--json` payload for scripts.
23
+ const node_fs_1 = __importDefault(require("node:fs"));
24
+ const node_os_1 = __importDefault(require("node:os"));
25
+ const node_path_1 = __importDefault(require("node:path"));
26
+ const node_child_process_1 = require("node:child_process");
27
+ const agent_config_1 = require("./agent-config");
28
+ /** Resolve a bare binary name against $PATH (or accept an explicit path). Returns
29
+ * the resolved path, or undefined when not found. No spawning. */
30
+ function whichBinary(bin, env) {
31
+ if (bin.includes("/") || bin.includes("\\")) {
32
+ try {
33
+ return node_fs_1.default.statSync(bin).isFile() ? bin : undefined;
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ }
39
+ const dirs = (env.PATH || "").split(node_path_1.default.delimiter).filter(Boolean);
40
+ const exts = process.platform === "win32" ? (env.PATHEXT || ".EXE;.CMD;.BAT").split(";") : [""];
41
+ for (const dir of dirs) {
42
+ for (const ext of exts) {
43
+ const candidate = node_path_1.default.join(dir, bin + ext);
44
+ try {
45
+ if (node_fs_1.default.statSync(candidate).isFile())
46
+ return candidate;
47
+ }
48
+ catch { /* keep looking */ }
49
+ }
50
+ }
51
+ return undefined;
52
+ }
53
+ /** True when `target` could be created/written: walk up to the nearest EXISTING
54
+ * ancestor and require it to be a writable DIRECTORY. (A file in the path is not
55
+ * writable-as-a-dir even though access(2) W_OK on the file itself would pass.)
56
+ * Does NOT create anything — a diagnostic must not have side effects. */
57
+ function dirWritable(target) {
58
+ let dir = node_path_1.default.resolve(target);
59
+ for (;;) {
60
+ let stat;
61
+ try {
62
+ stat = node_fs_1.default.statSync(dir);
63
+ }
64
+ catch {
65
+ const parent = node_path_1.default.dirname(dir);
66
+ if (parent === dir)
67
+ return false;
68
+ dir = parent;
69
+ continue;
70
+ }
71
+ if (!stat.isDirectory())
72
+ return false; // an existing file blocks mkdir beneath it
73
+ try {
74
+ node_fs_1.default.accessSync(dir, node_fs_1.default.constants.W_OK);
75
+ return true;
76
+ }
77
+ catch {
78
+ return false;
79
+ }
80
+ }
81
+ }
82
+ function runDoctor(args = {}, env = process.env, cwd = process.cwd()) {
83
+ const checks = [];
84
+ // 1. Node runtime — the one hard prerequisite (README: v18+).
85
+ const major = Number((process.version.match(/^v(\d+)/) || [])[1]);
86
+ checks.push(Number.isFinite(major) && major >= 18
87
+ ? { name: "node", status: "ok", detail: `Node ${process.version} (>= 18).` }
88
+ : { name: "node", status: "fail", detail: `Node ${process.version} is below the required v18.`, fix: "Install Node.js 18+ (e.g. `brew install node`, or https://nodejs.org)." });
89
+ // 2. Agent backend — CW delegates execution; without one, real runs park.
90
+ const cfg = (0, agent_config_1.resolveAgentConfig)(args, env);
91
+ if (cfg.source === "none") {
92
+ checks.push({
93
+ name: "agent",
94
+ status: "warn",
95
+ detail: "No agent backend configured — `demo` and `--preview` work, but a real run reports status: blocked.",
96
+ fix: 'Pass --agent-command "claude -p", set $CW_AGENT_COMMAND, or use --agent-command builtin:claude.'
97
+ });
98
+ }
99
+ else {
100
+ const binToken = cfg.command ? String(cfg.command).split(/\s+/)[0] : undefined;
101
+ checks.push({
102
+ name: "agent",
103
+ status: "ok",
104
+ detail: `Agent configured from ${cfg.source}${binToken ? `: ${binToken}` : cfg.endpoint ? " (HTTP endpoint)" : ""}.`
105
+ });
106
+ // 2b. If it is a command agent, is the binary actually on PATH?
107
+ if (binToken) {
108
+ const resolved = whichBinary(binToken, env);
109
+ checks.push(resolved
110
+ ? { name: "agent-binary", status: "ok", detail: `Agent binary "${binToken}" found at ${resolved}.` }
111
+ : { name: "agent-binary", status: "warn", detail: `Configured agent binary "${binToken}" is not on $PATH.`, fix: `Install "${binToken}", or correct --agent-command / $CW_AGENT_COMMAND.` });
112
+ }
113
+ }
114
+ // 3. git — only needed for commit provenance (git HEAD); a warn, not a hard fail.
115
+ const git = (0, node_child_process_1.spawnSync)("git", ["--version"], { encoding: "utf8", timeout: 5000 });
116
+ checks.push(!git.error && git.status === 0
117
+ ? { name: "git", status: "ok", detail: (String(git.stdout || "git").trim()) + "." }
118
+ : { name: "git", status: "warn", detail: "git is not available — commit provenance (git HEAD) is recorded as absent.", fix: "Install git (e.g. `brew install git`) if you want commit provenance." });
119
+ // 4. Home registry — the cross-repo run index lives here; must be writable.
120
+ const home = env.CW_HOME && String(env.CW_HOME).trim()
121
+ ? node_path_1.default.resolve(String(env.CW_HOME))
122
+ : node_path_1.default.join(node_os_1.default.homedir(), ".local", "state", "cool-workflow");
123
+ checks.push(dirWritable(home)
124
+ ? { name: "home-registry", status: "ok", detail: `Home registry location is writable (${home}).` }
125
+ : { name: "home-registry", status: "fail", detail: `Home registry location is not writable: ${home}`, fix: "Set $CW_HOME to a writable directory, or fix the permissions." });
126
+ // 5. Working-dir state — per-repo runs land under <cwd>/.cw.
127
+ const cwState = node_path_1.default.join(node_path_1.default.resolve(cwd), ".cw");
128
+ checks.push(dirWritable(cwState)
129
+ ? { name: "repo-state", status: "ok", detail: `Run state location is writable (${cwState}).` }
130
+ : { name: "repo-state", status: "warn", detail: `Cannot write run state under ${cwState}.`, fix: "Run from a writable working directory, or pass --cwd PATH." });
131
+ const fails = checks.filter((c) => c.status === "fail").length;
132
+ const warns = checks.filter((c) => c.status === "warn").length;
133
+ const ok = fails === 0;
134
+ const summary = ok
135
+ ? warns === 0
136
+ ? "ready — all checks passed"
137
+ : `ready, with ${warns} warning${warns === 1 ? "" : "s"}`
138
+ : `${fails} blocking problem${fails === 1 ? "" : "s"} found`;
139
+ return { schemaVersion: 1, ok, checks, summary };
140
+ }
141
+ /** Human rendering (TTY/default). `--json` callers use the report object directly. */
142
+ function formatDoctorReport(report) {
143
+ const glyph = { ok: "✓", warn: "!", fail: "✗" };
144
+ const lines = ["cw doctor"];
145
+ for (const check of report.checks) {
146
+ lines.push(` ${glyph[check.status]} ${check.name}: ${check.detail}`);
147
+ if (check.fix && check.status !== "ok")
148
+ lines.push(` fix: ${check.fix}`);
149
+ }
150
+ lines.push("");
151
+ lines.push(`${report.ok ? "✓" : "✗"} ${report.summary}`);
152
+ return lines.join("\n");
153
+ }