@cotal-ai/cmux 0.1.0 → 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.
package/dist/driver.d.ts CHANGED
@@ -1,13 +1,21 @@
1
+ /** A terminal target — a workspace (tab) or a specific surface, by id/ref. */
2
+ export interface Target {
3
+ workspace?: string;
4
+ surface?: string;
5
+ }
1
6
  /** True if a cmux app is reachable (`cmux ping`). */
2
7
  export declare function available(): boolean;
3
- /** Open a new workspace (tab) with a declarative split layout (JSON). */
8
+ /** Open a new workspace (tab) with a declarative split layout (JSON). Returns the
9
+ * new workspace's stable UUID so callers can later target or close it. */
4
10
  export declare function openWorkspace(name: string, layout: string, opts?: {
5
11
  focus?: boolean;
6
- }): void;
12
+ }): string;
13
+ /** Close a workspace (tab) by id/ref. */
14
+ export declare function closeWorkspace(workspace: string): void;
7
15
  /** Split the focused pane; the new pane becomes focused. */
8
16
  export declare function newSplit(direction: "left" | "right" | "up" | "down"): void;
9
- /** Type text into the focused pane. */
10
- export declare function send(text: string): void;
11
- /** Send a key press (e.g. "enter") to the focused pane. */
12
- export declare function sendKey(key: string): void;
17
+ /** Type text into a terminal surface (the focused one, or a targeted background tab). */
18
+ export declare function send(text: string, target?: Target): void;
19
+ /** Send a key press (e.g. "enter") to a terminal surface. */
20
+ export declare function sendKey(key: string, target?: Target): void;
13
21
  //# sourceMappingURL=driver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAgBA,qDAAqD;AACrD,wBAAgB,SAAS,IAAI,OAAO,CAOnC;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,IAAI,CAGhG;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,uCAAuC;AACvC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC"}
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAkBA,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AASD,qDAAqD;AACrD,wBAAgB,SAAS,IAAI,OAAO,CAOnC;AAED;2EAC2E;AAC3E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAkBlG;AAED,yCAAyC;AACzC,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,yFAAyF;AACzF,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAE1D"}
package/dist/driver.js CHANGED
@@ -9,7 +9,16 @@ const CMUX_BIN = process.env.CMUX_BUNDLED_CLI_PATH ?? "cmux";
9
9
  * anywhere else.
10
10
  */
11
11
  function cmux(args) {
12
- execFileSync(CMUX_BIN, args, { stdio: "ignore" });
12
+ return execFileSync(CMUX_BIN, args, { encoding: "utf8" }).trim();
13
+ }
14
+ const UUID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
15
+ function targetArgs(t) {
16
+ const a = [];
17
+ if (t?.workspace)
18
+ a.push("--workspace", t.workspace);
19
+ if (t?.surface)
20
+ a.push("--surface", t.surface);
21
+ return a;
13
22
  }
14
23
  /** True if a cmux app is reachable (`cmux ping`). */
15
24
  export function available() {
@@ -21,21 +30,42 @@ export function available() {
21
30
  return false;
22
31
  }
23
32
  }
24
- /** Open a new workspace (tab) with a declarative split layout (JSON). */
33
+ /** Open a new workspace (tab) with a declarative split layout (JSON). Returns the
34
+ * new workspace's stable UUID so callers can later target or close it. */
25
35
  export function openWorkspace(name, layout, opts = {}) {
26
36
  const focus = opts.focus ?? true;
27
- cmux(["new-workspace", "--name", name, "--focus", String(focus), "--layout", layout]);
37
+ const out = cmux([
38
+ "--id-format",
39
+ "uuids",
40
+ "new-workspace",
41
+ "--name",
42
+ name,
43
+ "--focus",
44
+ String(focus),
45
+ "--layout",
46
+ layout,
47
+ ]);
48
+ // cmux prints a UUID under `--id-format uuids`, but write ops like new-workspace
49
+ // confirm with `OK workspace:<n>` (a short ref) — accept either.
50
+ const id = UUID.exec(out)?.[0] ?? /workspace:\d+/.exec(out)?.[0];
51
+ if (!id)
52
+ throw new Error(`cmux new-workspace: couldn't read the new workspace id from "${out}"`);
53
+ return id;
54
+ }
55
+ /** Close a workspace (tab) by id/ref. */
56
+ export function closeWorkspace(workspace) {
57
+ cmux(["close-workspace", "--workspace", workspace]);
28
58
  }
29
59
  /** Split the focused pane; the new pane becomes focused. */
30
60
  export function newSplit(direction) {
31
61
  cmux(["new-split", direction]);
32
62
  }
33
- /** Type text into the focused pane. */
34
- export function send(text) {
35
- cmux(["send", text]);
63
+ /** Type text into a terminal surface (the focused one, or a targeted background tab). */
64
+ export function send(text, target) {
65
+ cmux(["send", ...targetArgs(target), "--", text]);
36
66
  }
37
- /** Send a key press (e.g. "enter") to the focused pane. */
38
- export function sendKey(key) {
39
- cmux(["send-key", key]);
67
+ /** Send a key press (e.g. "enter") to a terminal surface. */
68
+ export function sendKey(key, target) {
69
+ cmux(["send-key", ...targetArgs(target), "--", key]);
40
70
  }
41
71
  //# sourceMappingURL=driver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,qFAAqF;AACrF,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,MAAM,CAAC;AAE7D;;;;;GAKG;AACH,SAAS,IAAI,CAAC,IAAc;IAC1B,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC;QACH,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAc,EAAE,OAA4B,EAAE;IACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;IACjC,IAAI,CAAC,CAAC,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,QAAQ,CAAC,SAA2C;IAClE,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AACjC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AAC,CAAC,CAAC;AACvD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- /** @cotal-ai/cmux — a thin driver over the cmux CLI. No mesh logic, no self-
2
- * registration: the manager's `cmux` runtime and example launch scripts call
3
- * these to place agents into cmux tabs. */
1
+ /** @cotal-ai/cmux — the cmux integration: a thin driver over the cmux CLI plus a
2
+ * self-registering `cmux` Runtime. Importing the package registers the runtime
3
+ * with the core Registry (like a connector), so the manager can spawn into cmux
4
+ * tabs without ever depending on this package. The driver itself stays mesh-free;
5
+ * launch scripts import `./driver.js` directly to avoid the registration side effect. */
4
6
  export * as cmux from "./driver.js";
7
+ export { CmuxRuntime, cmuxRuntimeProvider } from "./runtime.js";
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;4CAE4C;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAC1F,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
- /** @cotal-ai/cmux — a thin driver over the cmux CLI. No mesh logic, no self-
2
- * registration: the manager's `cmux` runtime and example launch scripts call
3
- * these to place agents into cmux tabs. */
1
+ /** @cotal-ai/cmux — the cmux integration: a thin driver over the cmux CLI plus a
2
+ * self-registering `cmux` Runtime. Importing the package registers the runtime
3
+ * with the core Registry (like a connector), so the manager can spawn into cmux
4
+ * tabs without ever depending on this package. The driver itself stays mesh-free;
5
+ * launch scripts import `./driver.js` directly to avoid the registration side effect. */
4
6
  export * as cmux from "./driver.js";
7
+ export { CmuxRuntime, cmuxRuntimeProvider } from "./runtime.js"; // importing registers the cmux runtime
5
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;4CAE4C;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAC1F,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC,CAAC,uCAAuC"}
@@ -0,0 +1,18 @@
1
+ import { type AgentHandle, type LaunchSpec, type Runtime, type RuntimeProvider } from "@cotal-ai/core";
2
+ /**
3
+ * Spawns each agent into its own new cmux tab (workspace), so spawned teammates get
4
+ * room instead of crowding the spawner. cmux can't run a command in a fresh surface
5
+ * directly, so we write the launch as a temp bash script and point the tab's terminal
6
+ * at it — sidestepping nushell↔bash quoting. Opened unfocused so the human stays put;
7
+ * switch to the new tab to watch the worker. Like tmux, you watch it natively, so
8
+ * `attach()` throws — but teardown is real: we keep the tab's workspace + surface ids
9
+ * to drive and close it.
10
+ */
11
+ export declare class CmuxRuntime implements Runtime {
12
+ readonly kind = "cmux";
13
+ spawn(name: string, spec: LaunchSpec, cwd: string): AgentHandle;
14
+ }
15
+ /** Self-registering runtime provider — `import "@cotal-ai/cmux"` makes the manager's
16
+ * `cmux` runtime available, without the manager depending on this package. */
17
+ export declare const cmuxRuntimeProvider: RuntimeProvider;
18
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAgBxB;;;;;;;;GAQG;AACH,qBAAa,WAAY,YAAW,OAAO;IACzC,QAAQ,CAAC,IAAI,UAAU;IAEvB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW;CAuDhE;AAED;+EAC+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,eAKjC,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { tmpdir } from "node:os";
4
+ import { registry, } from "@cotal-ai/core";
5
+ import * as cmux from "./driver.js";
6
+ /** Grace window for a clean exit before a graceful stop force-closes the tab. */
7
+ const GRACE_MS = 1_500;
8
+ /** Background snippet that auto-accepts a one-time confirm prompt by pressing Enter on the
9
+ * pane's own cmux surface a few times. Gated on the cmux env vars so it's a no-op off cmux. */
10
+ const ENTER_LOOP = '[ -n "$CMUX_SURFACE_ID" ] && [ -n "$CMUX_BUNDLED_CLI_PATH" ] && ' +
11
+ '( for _ in 1 2 3 4 5; do sleep 1; "$CMUX_BUNDLED_CLI_PATH" send-key --surface "$CMUX_SURFACE_ID" enter >/dev/null 2>&1; done ) &';
12
+ function shellQuote(s) {
13
+ return `'${s.replace(/'/g, "'\\''")}'`;
14
+ }
15
+ /**
16
+ * Spawns each agent into its own new cmux tab (workspace), so spawned teammates get
17
+ * room instead of crowding the spawner. cmux can't run a command in a fresh surface
18
+ * directly, so we write the launch as a temp bash script and point the tab's terminal
19
+ * at it — sidestepping nushell↔bash quoting. Opened unfocused so the human stays put;
20
+ * switch to the new tab to watch the worker. Like tmux, you watch it natively, so
21
+ * `attach()` throws — but teardown is real: we keep the tab's workspace + surface ids
22
+ * to drive and close it.
23
+ */
24
+ export class CmuxRuntime {
25
+ kind = "cmux";
26
+ spawn(name, spec, cwd) {
27
+ // `name` becomes a temp-script filename and a `cotal-<name>` tab id — keep it a bare token
28
+ // so it can't traverse paths or break the workspace label.
29
+ if (!/^[A-Za-z0-9_.-]+$/.test(name))
30
+ throw new Error(`cmux runtime: unsafe agent name ${JSON.stringify(name)} (allowed: letters, digits, _ . -)`);
31
+ if (!cmux.available())
32
+ throw new Error(`the cmux CLI (${process.env.CMUX_BUNDLED_CLI_PATH ?? "cmux"}) couldn't reach the app — ` +
33
+ "is cmux running, and is this process inside a cmux surface (CMUX_SOCKET_PATH set)?");
34
+ const envPrefix = Object.entries(spec.env ?? {}).map(([k, v]) => `${k}=${shellQuote(v)}`);
35
+ const cmd = [...envPrefix, shellQuote(spec.command), ...spec.args.map(shellQuote)].join(" ");
36
+ // If the launch shows a one-time confirm (Claude's dev-channels prompt), auto-clear it by
37
+ // sending Enter to this tab's own surface a few times — so a spawned teammate joins the mesh
38
+ // without anyone switching to its tab to press Enter. (Same trick as run-agent.sh.)
39
+ const autoConfirm = spec.confirm ? `${ENTER_LOOP}\n` : "";
40
+ // `exec env …` (not `exec …`): exec can't take KEY=val assignments — `env` applies them
41
+ // then execs the agent. Without it the script dies with "exec: COTAL_SPACE=…: not found".
42
+ const script = `#!/usr/bin/env bash\ncd ${shellQuote(cwd)}\n${autoConfirm}exec env ${cmd}\n`;
43
+ const scriptPath = join(tmpdir(), `cotal-spawn-${name}.sh`);
44
+ writeFileSync(scriptPath, script, { mode: 0o755 });
45
+ const layout = JSON.stringify({
46
+ pane: { surfaces: [{ type: "terminal", command: `bash ${scriptPath}` }] },
47
+ });
48
+ // Keep the new tab's workspace ref so we can drive (send keys to its terminal)
49
+ // and close it later. cmux targets the tab's single terminal surface by workspace.
50
+ const workspace = cmux.openWorkspace(`cotal-${name}`, layout, { focus: false });
51
+ return {
52
+ name,
53
+ kind: "cmux",
54
+ status: () => "running",
55
+ stop: (opts) => {
56
+ if (opts?.graceful === false) {
57
+ cmux.closeWorkspace(workspace);
58
+ return;
59
+ }
60
+ // Graceful: type `/exit` so the Claude session shuts down cleanly (its
61
+ // SessionEnd hook leaves the mesh), then close the now-idle tab regardless.
62
+ try {
63
+ cmux.send("/exit", { workspace });
64
+ cmux.sendKey("enter", { workspace });
65
+ }
66
+ catch {
67
+ /* keystroke delivery failed — still ensure the tab is gone below */
68
+ }
69
+ setTimeout(() => cmux.closeWorkspace(workspace), GRACE_MS);
70
+ },
71
+ interrupt: () => {
72
+ cmux.sendKey("ctrl+c", { workspace });
73
+ },
74
+ attach: () => {
75
+ throw new Error(`cmux runtime: switch to the "cotal-${name}" cmux tab to watch it`);
76
+ },
77
+ };
78
+ }
79
+ }
80
+ /** Self-registering runtime provider — `import "@cotal-ai/cmux"` makes the manager's
81
+ * `cmux` runtime available, without the manager depending on this package. */
82
+ export const cmuxRuntimeProvider = {
83
+ kind: "runtime",
84
+ name: "cmux",
85
+ available: () => cmux.available(),
86
+ create: () => new CmuxRuntime(),
87
+ };
88
+ registry.register(cmuxRuntimeProvider);
89
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,QAAQ,GAKT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,iFAAiF;AACjF,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB;gGACgG;AAChG,MAAM,UAAU,GACd,kEAAkE;IAClE,kIAAkI,CAAC;AAErI,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AACzC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAW;IACb,IAAI,GAAG,MAAM,CAAC;IAEvB,KAAK,CAAC,IAAY,EAAE,IAAgB,EAAE,GAAW;QAC/C,2FAA2F;QAC3F,2DAA2D;QAC3D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S;IACf,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,WAAW,EAAE;CAChC,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@cotal-ai/cmux",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Cotal-AI/Cotal.git",
8
+ "directory": "extensions/cmux"
9
+ },
5
10
  "type": "module",
6
11
  "main": "./dist/index.js",
7
12
  "types": "./dist/index.d.ts",
@@ -11,6 +16,9 @@
11
16
  "import": "./dist/index.js"
12
17
  }
13
18
  },
19
+ "dependencies": {
20
+ "@cotal-ai/core": "0.1.3"
21
+ },
14
22
  "devDependencies": {
15
23
  "tsx": "^4.22.4"
16
24
  },