@cotal-ai/tmux

中文文档
0.157.2发布于 2026/11/11Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 5.7万

Cotal tmux integration: a tmux Runtime provider for spawning agents into tmux windows.

原始使用文档
文档目录3 节
  1. What it does
  2. Usage
  3. Differences from @cotal-ai/cmux

@cotal-ai/tmux

The tmux integration: a thin driver over the tmux CLI (open/close a window, send keys) plus a self-registering tmux Runtime provider. Importing it registers the runtime with the core Registry, so the manager can spawn agents into tmux windows without depending on this package.

Tier: extensions/. Peer-depends @cotal-ai/core; self-registers on import.

What it does

  • Runtime (tmux): each agent gets its own window in a shared per-space tmux session (cotal-<space>). Spawned unfocused; switch to session:name to watch it. Env is isolated (env -i) so the tmux server's environment doesn't reach agents. That env is written to an owner-only launch script, which keeps it off tmux's command line, and the script removes its directory before it starts the agent. When it cannot remove the directory, the agent does not start. Graceful stop types /exit then closes the seat's pane; hard stop closes that pane immediately. Stop and interrupt follow the pane when it moves between windows. Their tmux commands check the opening server's identity, including the delayed graceful close, so a replacement server cannot receive an old handle's input or close. Status and exit waits bind the pane to that server too. Native attach guidance selects the seat's current window and pane by its stable pane ID, so moving the pane or renaming its window does not redirect the operator to another seat. A dead server proves exit; an unreachable recorded server that still runs remains unknown. Exit waits honor tmux's pane_dead state, including remain-on-exit; provider errors fail the wait closed. Direct window closes still accept only tmux's own gone-window/session reports. Each handle carries a reference to its tmux server, window and pane, so a later manager can reap the seat after the one that spawned it is gone. The reap closes the window while the session still holds it, even when the agent's pane already exited. It refuses a pane that has moved out of that window, whether it still runs or has exited, and a window that has moved out of the session, including one that moves while the reap runs.

Session-name, pane-capture, session-creation, window-selection and text/key delivery failures name the operation, include tmux's error text and retain the failed call as cause. A failed capture returns no screen only when the pane's exit is confirmed. A failed exit probe still throws. Runtime spawn refusals also carry the session-creation reason.

The package tests include native write controls on a fresh private socket when tmux is installed. They check failure diagnostics, successful delivery and the server-identity fence without using operator sessions.

Usage

cotal ext add @cotal-ai/tmux
cotal supervise --runtime tmux

Library composition roots can instead import it explicitly:

import "@cotal-ai/tmux"; // self-registers; no other setup needed

Differences from @cotal-ai/cmux

cmux opens a per-agent workspace (tab) in the cmux app; this package opens a per-agent window in a tmux session. Both are native-watch (no PTY streaming). No cli.ts helper is included: the driver runs the tmux on PATH and needs no bundled binary path.

See docs/architecture.mdx (Manager supervision) and the root AGENTS.md for the tier rules.

The launcher contract checks in package.smoke.ts are POSIX-only. On Windows they use the shared skipSuite helper to report a skip with zero passing cells.

版本与发布记录

@cotal-ai/tmux 共发布 413 个版本,首次发布于 2026/06/25;过去 12 个月发布了 413 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.157.2latest2026/11/11今天
0.157.12026/11/11今天
0.157.02026/11/11今天
0.156.02026/11/11今天
0.155.22026/11/10今天
0.155.12026/11/10今天

其他发布通道:hack → 0.28.0-hack-20260823234508。

关于 @cotal-ai/tmux 的常见问题

@cotal-ai/tmux 是什么?

Cotal tmux integration: a tmux Runtime provider for spawning agents into tmux windows.

如何安装 @cotal-ai/tmux?

在项目目录运行 npm install @cotal-ai/tmux,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@cotal-ai/core(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cotal-ai/tmux 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cotal-ai/tmux 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cotal-ai/tmux 可以商用吗?

@cotal-ai/tmux 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@cotal-ai/tmux 的下载量有多少?

根据 npm 官方下载统计,@cotal-ai/tmux 在 2026/10/11 – 2026/11/09 这 30 天内被下载 56,796 次,日均约 1,893 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cotal-ai/tmux 还在维护吗?

最新版本 0.157.2 发布于 2026/11/11(今天);至今共发布 413 个版本,其中过去 12 个月发布了 413 个;首次发布于 2026/06/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。