cotal-ai 0.14.1 → 0.14.3

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.
package/dist/cotal.js CHANGED
@@ -1,37 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Composition root for the `cotal` operator CLI, published as `cotal-ai`. Importing an
4
- * implementation self-registers its commands into the shared registry — base mesh commands
5
- * plus `spawn`/`console` (@cotal-ai/cli) and the manager's control plane + daemon runners
6
- * (@cotal-ai/manager). The root just picks which surfaces to pull in; `runCli` resolves
7
- * whatever registered. A new surface (another connector, a control client …) is one more import line.
3
+ * Executable entry for the `cotal` CLI (published as `cotal-ai`): a Node-version preflight, then a
4
+ * hand-off to the real composition root (./run.js) via dynamic import.
5
+ *
6
+ * Why this file exists separately: the CLI's UI stack (ink, @clack/prompts, string-width) and the
7
+ * bundled `nats-server` optional dependency (@eplightning/nats-server-*) all require Node >= 22 —
8
+ * and npm SILENTLY SKIPS an optional dependency whose `engines` the running Node doesn't satisfy,
9
+ * so on an older Node the bundled broker is never installed at all. On top of that, string-width
10
+ * uses a Node-20+ regex flag that is a hard parse error on older Node. An ESM entry parses its whole
11
+ * static-import graph before its own body runs, so a version check inside ./run.ts would come too
12
+ * late — it would crash while parsing string-width. This shim therefore keeps ZERO static imports
13
+ * of that chain: the check runs first, and ./run.js is only pulled in (dynamically) once it passes.
8
14
  */
9
- // NOTE: registration order across these imports is NOT guaranteed (tsx's entry interop can
10
- // evaluate the smaller daemon graphs first) — display order is a non-goal here; `help` ranks
11
- // its groups explicitly (GROUP_ORDER in @cotal-ai/cli).
12
- import { runCli } from "@cotal-ai/cli"; // self-registers the base surface incl. spawn (foreground + --detach) / stop / ps / attach
13
- import "@cotal-ai/manager"; // self-registers `supervise` — the agent-supervisor daemon
14
- import "@cotal-ai/delivery"; // self-registers `deliver` — the server-side Plane-3 delivery daemon
15
- import "@cotal-ai/auth"; // self-registers login / logout — per-user IdP sessions (device-code sign-in)
16
- import { registry } from "@cotal-ai/core";
17
- // A CLI must exit quietly when its stdout is closed early — piped to `head`, a pager that quits,
18
- // or a shell's process substitution (`source <(cotal completion bash)`). Node otherwise turns the
19
- // closed-pipe write into a fatal unhandled 'error' event with a stack trace. Mirror SIGPIPE: exit
20
- // 0. Registered before any command can write.
21
- process.stdout.on("error", (e) => {
22
- if (e.code === "EPIPE")
23
- process.exit(0);
24
- throw e;
25
- });
26
- // The four agent connectors (claude/opencode/hermes/pi) are NOT imported here: they are removable,
27
- // install-seeded `cotal ext` plugins loaded through the manifest, exactly like a third-party
28
- // connector (and like the `@cotal-ai/orca` runtime already is). `runCli` seeds them on first run and
29
- // materializes each lazily when a command resolves it; the default agent is `COTAL_DEFAULT_AGENT`
30
- // (else claude), resolved manager-side. The old `"cotal"` default-agent alias is gone with them.
31
- //
32
- // Bare `cotal` prints help; explicit `cotal setup` runs guided setup. The published binary is
33
- // the ONE composition root that loads operator-installed extensions (`cotal ext add …`) — commands,
34
- // runtimes, connectors, and local process components all self-register from those packages. Library
35
- // roots keep the explicit-import model.
36
- const argv = process.argv.slice(2);
37
- await runCli(registry, argv, { extensions: true });
15
+ const MIN_NODE_MAJOR = 22;
16
+ const nodeMajor = Number.parseInt(process.versions.node.split(".")[0] ?? "", 10);
17
+ if (!Number.isInteger(nodeMajor) || nodeMajor < MIN_NODE_MAJOR) {
18
+ process.stderr.write(`\ncotal-ai requires Node.js >= ${MIN_NODE_MAJOR}, but this is ${process.version}.\n` +
19
+ `The bundled nats-server broker (and the CLI's UI stack) need Node >= ${MIN_NODE_MAJOR}; on an\n` +
20
+ `older Node, npm silently skips the broker binary and the CLI cannot start.\n\n` +
21
+ `Install a newer Node (https://nodejs.org). With nvm:\n` +
22
+ ` nvm install ${MIN_NODE_MAJOR} && nvm use ${MIN_NODE_MAJOR}\n\n` +
23
+ `If you already ran cotal once under the old Node, also clear the npx cache so the bundled\n` +
24
+ `nats-server is fetched cleanly, then retry:\n` +
25
+ ` rm -rf ~/.npm/_npx # or: npx clear-npx-cache\n\n`);
26
+ process.exit(1);
27
+ }
28
+ await import("./run.js");
29
+ export {};
package/dist/run.js ADDED
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Composition root for the `cotal` operator CLI, published as `cotal-ai`. Importing an
3
+ * implementation self-registers its commands into the shared registry — base mesh commands
4
+ * plus `spawn`/`console` (@cotal-ai/cli) and the manager's control plane + daemon runners
5
+ * (@cotal-ai/manager). The root just picks which surfaces to pull in; `runCli` resolves
6
+ * whatever registered. A new surface (another connector, a control client …) is one more import line.
7
+ *
8
+ * Reached only via ./cotal.ts, which runs the Node-version preflight first: everything imported
9
+ * here requires Node >= 22 (the UI stack and the bundled nats-server optional dep), so this module
10
+ * must never be the executable entry — importing it on an old Node crashes at parse time.
11
+ */
12
+ // NOTE: registration order across these imports is NOT guaranteed (tsx's entry interop can
13
+ // evaluate the smaller daemon graphs first) — display order is a non-goal here; `help` ranks
14
+ // its groups explicitly (GROUP_ORDER in @cotal-ai/cli).
15
+ import { runCli } from "@cotal-ai/cli"; // self-registers the base surface incl. spawn (foreground + --detach) / stop / ps / attach
16
+ import "@cotal-ai/manager"; // self-registers `supervise` — the agent-supervisor daemon
17
+ import "@cotal-ai/delivery"; // self-registers `deliver` — the server-side Plane-3 delivery daemon
18
+ import "@cotal-ai/auth"; // self-registers login / logout — per-user IdP sessions (device-code sign-in)
19
+ import { registry } from "@cotal-ai/core";
20
+ // A CLI must exit quietly when its stdout is closed early — piped to `head`, a pager that quits,
21
+ // or a shell's process substitution (`source <(cotal completion bash)`). Node otherwise turns the
22
+ // closed-pipe write into a fatal unhandled 'error' event with a stack trace. Mirror SIGPIPE: exit
23
+ // 0. Registered before any command can write.
24
+ process.stdout.on("error", (e) => {
25
+ if (e.code === "EPIPE")
26
+ process.exit(0);
27
+ throw e;
28
+ });
29
+ // The four agent connectors (claude/opencode/hermes/pi) are NOT imported here: they are removable,
30
+ // install-seeded `cotal ext` plugins loaded through the manifest, exactly like a third-party
31
+ // connector (and like the `@cotal-ai/orca` runtime already is). `runCli` seeds them on first run and
32
+ // materializes each lazily when a command resolves it; the default agent is `COTAL_DEFAULT_AGENT`
33
+ // (else claude), resolved manager-side. The old `"cotal"` default-agent alias is gone with them.
34
+ //
35
+ // Bare `cotal` prints help; explicit `cotal setup` runs guided setup. The published binary is
36
+ // the ONE composition root that loads operator-installed extensions (`cotal ext add …`) — commands,
37
+ // runtimes, connectors, and local process components all self-register from those packages. Library
38
+ // roots keep the explicit-import model.
39
+ const argv = process.argv.slice(2);
40
+ await runCli(registry, argv, { extensions: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cotal-ai",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "Cotal — lateral agent coordination over NATS. Run `npx cotal-ai` for the CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -23,25 +23,25 @@
23
23
  "cotal": "./dist/cotal.js"
24
24
  },
25
25
  "engines": {
26
- "node": ">=20"
26
+ "node": ">=22"
27
27
  },
28
28
  "dependencies": {
29
- "@cotal-ai/auth": "0.14.1",
30
- "@cotal-ai/cli": "0.14.1",
31
- "@cotal-ai/delivery": "0.14.1",
32
- "@cotal-ai/core": "0.14.1",
33
- "@cotal-ai/connector-core": "0.14.1",
34
- "@cotal-ai/manager": "0.14.1",
35
- "@cotal-ai/workspace": "0.14.1"
29
+ "@cotal-ai/auth": "0.14.3",
30
+ "@cotal-ai/connector-core": "0.14.3",
31
+ "@cotal-ai/cli": "0.14.3",
32
+ "@cotal-ai/core": "0.14.3",
33
+ "@cotal-ai/manager": "0.14.3",
34
+ "@cotal-ai/delivery": "0.14.3",
35
+ "@cotal-ai/workspace": "0.14.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@nats-io/jetstream": "^3.4.0",
39
39
  "@nats-io/transport-node": "^3.4.0",
40
- "@cotal-ai/connector-hermes": "0.14.1",
41
- "@cotal-ai/connector-opencode": "0.14.1",
42
- "@cotal-ai/pi": "0.14.1",
43
- "@cotal-ai/web": "0.14.1",
44
- "@cotal-ai/connector-claude-code": "0.14.1"
40
+ "@cotal-ai/connector-claude-code": "0.14.3",
41
+ "@cotal-ai/connector-hermes": "0.14.3",
42
+ "@cotal-ai/connector-opencode": "0.14.3",
43
+ "@cotal-ai/web": "0.14.3",
44
+ "@cotal-ai/pi": "0.14.3"
45
45
  },
46
46
  "files": [
47
47
  "dist",