botmux 1.12.0 → 1.13.1
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/README.en.md +249 -142
- package/README.md +251 -133
- package/dist/cli.js +133 -54
- package/dist/cli.js.map +1 -1
- package/dist/core/worker-pool.d.ts.map +1 -1
- package/dist/core/worker-pool.js +4 -1
- package/dist/core/worker-pool.js.map +1 -1
- package/dist/daemon.d.ts +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +17 -8
- package/dist/daemon.js.map +1 -1
- package/dist/im/lark/message-parser.js +13 -8
- package/dist/im/lark/message-parser.js.map +1 -1
- package/dist/index-daemon.js +4 -2
- package/dist/index-daemon.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -1
- package/dist/services/session-store.d.ts +6 -0
- package/dist/services/session-store.d.ts.map +1 -1
- package/dist/services/session-store.js +69 -3
- package/dist/services/session-store.js.map +1 -1
- package/dist/worker.js +4 -0
- package/dist/worker.js.map +1 -1
- package/package.json +6 -6
package/README.en.md
CHANGED
|
@@ -4,84 +4,276 @@
|
|
|
4
4
|
<img src="cover.svg" alt="botmux cover" width="800">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License MIT"></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js >= 20">
|
|
10
|
+
<a href="https://www.npmjs.com/package/botmux"><img src="https://img.shields.io/npm/v/botmux.svg" alt="npm version"></a>
|
|
11
|
+
<a href="https://github.com/deepcoldy/botmux"><img src="https://img.shields.io/github/stars/deepcoldy/botmux?style=social" alt="GitHub Stars"></a>
|
|
12
|
+
</p>
|
|
12
13
|
|
|
13
14
|
<p align="center">
|
|
14
|
-
<
|
|
15
|
+
<a href="#design-philosophy">Design</a> ·
|
|
16
|
+
<a href="#key-advantages">Advantages</a> ·
|
|
17
|
+
<a href="#5-minute-setup">Quick Start</a> ·
|
|
18
|
+
<a href="#usage">Usage</a> ·
|
|
19
|
+
<a href="#configuration">Config</a>
|
|
15
20
|
</p>
|
|
16
21
|
|
|
22
|
+
[中文](README.md) | English
|
|
23
|
+
|
|
24
|
+
**Plug any AI coding CLI into Lark (Feishu) topic groups — one thread per session, streaming cards, web terminal, zero glue code.**
|
|
25
|
+
|
|
26
|
+
| Lark Streaming Cards | Web Terminal | tmux Session Management | Multi-Bot Collaboration |
|
|
27
|
+
|:-:|:-:|:-:|:-:|
|
|
28
|
+
| <img src="gif/fold&unfold.gif" width="220" /> | <img src="gif/web_terminal.gif" width="220" /> | <img src="gif/tmux.gif" width="220" /> | <img src="docs/setup/multi-bot-collab.png" width="220" /> |
|
|
29
|
+
|
|
17
30
|
<details>
|
|
18
|
-
<summary
|
|
31
|
+
<summary>Full demo video</summary>
|
|
19
32
|
|
|
20
33
|
[Demo Video](https://github.com/user-attachments/assets/3ba4c681-0a7e-4a03-89c8-b8d26b544a65)
|
|
21
34
|
</details>
|
|
22
35
|
|
|
23
|
-
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Why botmux?
|
|
39
|
+
|
|
40
|
+
### Design Philosophy
|
|
41
|
+
|
|
42
|
+
Core philosophy: **Bridge CLIs, don't rebuild them**. botmux doesn't reimplement Agent capabilities — it bridges existing AI coding CLIs (Claude Code, Codex, Aiden, CoCo, Gemini, OpenCode) directly. Memory, context management, tool use, permission systems — these capabilities are evolving rapidly within the CLIs themselves. botmux rides on top of that evolution rather than rebuilding in parallel. Every CLI upgrade benefits botmux automatically with zero adaptation.
|
|
43
|
+
|
|
44
|
+
### Key Advantages
|
|
45
|
+
|
|
46
|
+
Compared to OpenClaw-style approaches built on Agent SDKs:
|
|
47
|
+
|
|
48
|
+
| Feature | botmux | OpenClaw-style |
|
|
49
|
+
|---------|--------|---------------|
|
|
50
|
+
| Architecture | Bridges full CLI processes directly | Rebuilds on Agent SDK |
|
|
51
|
+
| CLI Capabilities | Full runtime (hooks, memory, plan mode, MCP ecosystem, `/` commands) | SDK API subset, missing features must be reimplemented |
|
|
52
|
+
| CLI Upgrades | Zero-adaptation automatic benefit | Must track SDK version changes |
|
|
53
|
+
| Memory / Context | Reuses CLI's built-in memory system, improves as the CLI evolves | Must build custom memory system, duplicating CLI-native capabilities |
|
|
54
|
+
| Multi-CLI Support | 6 CLIs, switch with one config (Claude Code / Codex / Aiden / CoCo / Gemini / OpenCode) | Tied to a single SDK, cannot switch CLIs |
|
|
55
|
+
| Web Terminal | Interactive full terminal, mobile shortcut toolbar, phone/desktop/Lark tri-screen sync | Usually web chat UI or read-only output |
|
|
56
|
+
| Multi-Bot Collaboration | Multiple bots in same group via @mention routing, isolated processes, different CLIs sparring | Usually single bot |
|
|
57
|
+
| Terminal Access | tmux attach directly into the CLI process, same as local dev experience | No direct terminal access |
|
|
58
|
+
| Installation | `npm install -g botmux`, 5-min Lark setup | Easy to install, but more configuration needed |
|
|
24
59
|
|
|
25
|
-
|
|
26
|
-
- **Multi-CLI support** — adapter architecture supports Claude Code, Aiden, CoCo, Codex, Gemini, and is extensible
|
|
27
|
-
- **Live streaming cards** — real-time terminal output rendered in Feishu cards with markdown support, per-turn card lifecycle
|
|
28
|
-
- **Web terminal (xterm.js)** — full PTY output in the browser with a mobile shortcut toolbar and on-demand write access via DM link
|
|
29
|
-
- **Session persistence** — sessions survive daemon restarts; with tmux backend, CLI processes persist across restarts with zero interruption
|
|
30
|
-
- **Scheduled tasks** — cron-based recurring prompts with natural language scheduling (Chinese supported)
|
|
31
|
-
- **Project management** — interactive repo selector, per-session working directory
|
|
32
|
-
- **MCP integration** — CLI can reply to Lark threads, read message history, and add reactions via MCP tools
|
|
33
|
-
- **Access control** — allowlist for users, token-based write access for terminals, button restrictions on cards
|
|
60
|
+
---
|
|
34
61
|
|
|
35
62
|
## Prerequisites
|
|
36
63
|
|
|
37
64
|
- **Node.js** >= 20
|
|
38
65
|
- **AI coding CLI** installed and authenticated (`claude`, `aiden`, `coco`, `codex`, `gemini`, or `opencode` in PATH)
|
|
39
|
-
- **Lark app** with Bot and Message permissions (WebSocket event subscription)
|
|
40
66
|
- **tmux** >= 3.x (optional — auto-enabled when installed for persistent CLI sessions)
|
|
41
67
|
|
|
42
|
-
##
|
|
68
|
+
## 5-Minute Setup
|
|
43
69
|
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
### Step 1: Create a Lark App
|
|
71
|
+
|
|
72
|
+
Go to the [Lark Open Platform](https://open.larkoffice.com/app) and click "Create Custom App".
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
### Step 2: Get Credentials
|
|
77
|
+
|
|
78
|
+
Open the app details page → "Credentials & Basic Info", and copy the **App ID** and **App Secret**.
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
### Step 3: Add Permissions
|
|
83
|
+
|
|
84
|
+
Go to "Permissions & Scopes" → "Batch Import/Export", and paste the following JSON to import all permissions at once:
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
<details>
|
|
89
|
+
<summary>Click to expand batch import JSON</summary>
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"scopes": {
|
|
94
|
+
"tenant": [
|
|
95
|
+
"contact:user.base:readonly",
|
|
96
|
+
"contact:user.id:readonly",
|
|
97
|
+
"im:chat:read",
|
|
98
|
+
"im:chat.members:bot_access",
|
|
99
|
+
"im:chat.members:read",
|
|
100
|
+
"im:message",
|
|
101
|
+
"im:message:readonly",
|
|
102
|
+
"im:message:send_as_bot",
|
|
103
|
+
"im:message:update",
|
|
104
|
+
"im:message.group_at_msg",
|
|
105
|
+
"im:message.group_at_msg:readonly",
|
|
106
|
+
"im:message.group_msg",
|
|
107
|
+
"im:message.p2p_msg:readonly",
|
|
108
|
+
"im:message.reactions:write_only",
|
|
109
|
+
"im:resource"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
46
113
|
```
|
|
114
|
+
</details>
|
|
47
115
|
|
|
48
|
-
|
|
116
|
+
### Step 4: Install & Start botmux
|
|
49
117
|
|
|
50
118
|
```bash
|
|
51
|
-
#
|
|
119
|
+
# Install
|
|
120
|
+
npm install -g botmux
|
|
121
|
+
|
|
122
|
+
# Interactive setup — enter the App ID and App Secret from Step 2
|
|
52
123
|
botmux setup
|
|
53
124
|
|
|
54
|
-
#
|
|
125
|
+
# Start (must be running before configuring WebSocket subscription — Lark checks for an active connection)
|
|
55
126
|
botmux start
|
|
56
127
|
```
|
|
57
128
|
|
|
58
|
-
|
|
59
|
-
- Creating a Lark app (with required permissions listed)
|
|
60
|
-
- Entering App ID, App Secret, Chat ID
|
|
61
|
-
- Optional: Claude model, working directory, access control
|
|
129
|
+
### Step 5: Configure Event Subscription
|
|
62
130
|
|
|
63
|
-
|
|
131
|
+
Back in the Lark Open Platform, go to "Events & Callbacks":
|
|
132
|
+
|
|
133
|
+
1. **Subscription mode**: Click the edit icon, select "Receive events via persistent connection" (WebSocket) — requires botmux to be running so Lark can detect the connection
|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+
2. **Add event**: Click "Add Event", search and add `im.message.receive_v1` (Receive messages v2.0)
|
|
138
|
+
|
|
139
|
+

|
|
140
|
+
|
|
141
|
+
3. **Enable callback**: Switch to the "Callback Configuration" tab, turn on "Card action callback" (`card.action.trigger`)
|
|
142
|
+
|
|
143
|
+
### Step 6: Publish the App
|
|
144
|
+
|
|
145
|
+
Go to "Version Management & Release", click "Create Version" and publish. Set availability to "Visible to me only" for automatic approval.
|
|
146
|
+
|
|
147
|
+

|
|
148
|
+
|
|
149
|
+
### Step 7: Create a Group and Start Chatting
|
|
150
|
+
|
|
151
|
+
1. Create a **topic-enabled group** in Lark
|
|
152
|
+
2. Go to Group Settings → Bots → Add the bot you just created
|
|
153
|
+
3. Send a message in the group — the bot responds automatically
|
|
154
|
+
|
|
155
|
+

|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Features
|
|
160
|
+
|
|
161
|
+
### Streaming Cards
|
|
162
|
+
|
|
163
|
+
Each conversation turn gets a live-updating Feishu card that shows:
|
|
164
|
+
|
|
165
|
+
- Real-time terminal output rendered as Markdown, TUI chrome auto-filtered to show only actual work output
|
|
166
|
+
- Status indicator: Starting > Working > Idle
|
|
167
|
+
- Action buttons: Open Terminal, Get Write Link, Restart CLI, Close Session
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### Web Terminal (Interactive)
|
|
171
|
+
|
|
172
|
+
Each session exposes a web terminal at `http://<WEB_EXTERNAL_HOST>:<port>`.
|
|
173
|
+
|
|
174
|
+
- **Read-only link** — shown on the streaming card in the group thread
|
|
175
|
+
- **Write-enabled link** — sent via DM on demand (click "Get Write Link" on the card)
|
|
176
|
+
|
|
177
|
+
On mobile/tablet, a floating shortcut toolbar provides Esc, Ctrl+C, Tab, arrow keys and other control keys missing from virtual keyboards — full CLI control from your phone.
|
|
178
|
+
|
|
179
|
+
### Multi-Bot Collaboration
|
|
180
|
+
|
|
181
|
+
Run multiple Lark bots on a single machine, each mapped to a different CLI. In the same group chat, messages are routed via @mention — each bot gets its own isolated CLI process. With a single bot in the group, it responds automatically without @.
|
|
182
|
+
|
|
183
|
+
### Tmux Persistence
|
|
184
|
+
|
|
185
|
+
When tmux is installed, botmux automatically uses it. CLI processes persist inside tmux sessions — all features work unchanged.
|
|
186
|
+
|
|
187
|
+
**Key benefit: daemon restarts don't interrupt the CLI.** During `botmux restart`, the worker process exits but the tmux session (and the CLI inside it) keeps running. The next incoming message triggers a re-attach — no `--resume` context reload needed.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Recommended: interactive session picker — select and attach to tmux
|
|
191
|
+
npx botmux list
|
|
192
|
+
|
|
193
|
+
# Or manually attach (session name = bmx-<first 8 chars of session ID>)
|
|
194
|
+
tmux attach -t bmx-<first-8-chars-of-session-id>
|
|
195
|
+
# Ctrl+B, D to detach — CLI keeps running
|
|
196
|
+
|
|
197
|
+
# Force pure pty mode (disable tmux)
|
|
198
|
+
BACKEND_TYPE=pty botmux start
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`botmux list` provides an interactive TUI showing all active sessions with ID, title, working directory, PID, uptime, and status. Use arrow keys to select and Enter to attach. Use `botmux list --plain` for plain-text table output suitable for scripting.
|
|
202
|
+
|
|
203
|
+
**Session naming:** `bmx-<first 8 chars of session UUID>`
|
|
204
|
+
|
|
205
|
+
**Lifecycle:**
|
|
206
|
+
|
|
207
|
+
| Event | tmux session | CLI process |
|
|
208
|
+
|-------|-------------|-------------|
|
|
209
|
+
| `botmux restart` | Survives | Survives (re-attaches on next message) |
|
|
210
|
+
| `/close` or close button | Destroyed | Terminated (SIGHUP) |
|
|
211
|
+
| CLI exits / crashes | Closes with it | Already exited (auto-restart creates new session) |
|
|
212
|
+
|
|
213
|
+
### Scheduled Tasks
|
|
214
|
+
|
|
215
|
+
Create recurring tasks with natural language:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
/schedule every day at 17:50 check AI news
|
|
219
|
+
/schedule weekdays at 9:00 run health check
|
|
220
|
+
/schedule every Monday at 10:00 generate weekly report
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### MCP Integration
|
|
224
|
+
|
|
225
|
+
botmux exposes MCP tools so the CLI can interact with Lark directly:
|
|
226
|
+
|
|
227
|
+
- Reply to the current Lark thread
|
|
228
|
+
- Read message history from the thread
|
|
229
|
+
- Add emoji reactions to messages
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Usage
|
|
234
|
+
|
|
235
|
+
### Workflow
|
|
236
|
+
|
|
237
|
+
1. Send a message in your Lark topic group to create a new thread
|
|
238
|
+
2. The bot shows a repo selection card — pick a project or click "Start directly"
|
|
239
|
+
3. The CLI spawns in the selected directory
|
|
240
|
+
4. A live streaming card appears in the thread, showing real-time terminal output with markdown rendering
|
|
241
|
+
5. Each reply creates a new streaming card for that turn; previous cards freeze at their last state
|
|
242
|
+
6. Click "Get Write Link" on the card to receive a write-enabled terminal URL via DM
|
|
243
|
+
7. The CLI replies in the thread via MCP tools
|
|
244
|
+
|
|
245
|
+
### Slash Commands
|
|
64
246
|
|
|
65
247
|
| Command | Description |
|
|
66
248
|
|---------|-------------|
|
|
67
|
-
| `
|
|
68
|
-
|
|
|
69
|
-
| `
|
|
70
|
-
|
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
249
|
+
| `/repo` | Show project selector card |
|
|
250
|
+
| `/repo <N>` | Switch to Nth project from last scan |
|
|
251
|
+
| `/skip` | Skip repo selection, start session directly |
|
|
252
|
+
| `/cd <path>` | Change working directory |
|
|
253
|
+
| `/status` | Show session info (uptime, terminal URL, etc.) |
|
|
254
|
+
| `/cost` | Show token usage and estimated cost |
|
|
255
|
+
| `/restart` | Restart CLI process |
|
|
256
|
+
| `/close` | Close session and terminate CLI |
|
|
257
|
+
| `/clear` | Clear context (new session, same thread) |
|
|
258
|
+
| `/schedule` | Manage scheduled tasks |
|
|
259
|
+
| `/help` | Show available commands |
|
|
260
|
+
|
|
261
|
+
### Scheduled Task Management
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
/schedule list
|
|
265
|
+
/schedule remove <id>
|
|
266
|
+
/schedule enable <id>
|
|
267
|
+
/schedule disable <id>
|
|
268
|
+
/schedule run <id>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
78
272
|
|
|
79
273
|
## Configuration
|
|
80
274
|
|
|
81
275
|
Configure bots via `~/.botmux/bots.json`. Run `botmux setup` to create it interactively, or edit manually.
|
|
82
276
|
|
|
83
|
-
Supports running multiple Lark bots on a single machine, each mapped to a different CLI. Multiple bots in the same group chat route messages via @mention; a single bot responds automatically without @.
|
|
84
|
-
|
|
85
277
|
```bash
|
|
86
278
|
# Interactive setup
|
|
87
279
|
botmux setup
|
|
@@ -130,7 +322,7 @@ botmux setup
|
|
|
130
322
|
| `SESSION_DATA_DIR` | `~/.botmux/data` | Where sessions and queues are stored |
|
|
131
323
|
| `DEBUG` | _(unset)_ | Set to `1` for debug logging |
|
|
132
324
|
|
|
133
|
-
|
|
325
|
+
### File Locations
|
|
134
326
|
|
|
135
327
|
| Path | Description |
|
|
136
328
|
|------|-------------|
|
|
@@ -138,110 +330,25 @@ botmux setup
|
|
|
138
330
|
| `~/.botmux/data/` | Session data, message queues |
|
|
139
331
|
| `~/.botmux/logs/` | Daemon logs |
|
|
140
332
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
### Workflow
|
|
144
|
-
|
|
145
|
-
1. Send a message in your Lark topic group to create a new thread
|
|
146
|
-
2. The bot shows a repo selection card — pick a project or click "Start directly"
|
|
147
|
-
3. Claude Code spawns in the selected directory
|
|
148
|
-
4. A live streaming card appears in the thread, showing real-time terminal output with markdown rendering
|
|
149
|
-
5. Each reply creates a new streaming card for that turn; previous cards freeze at their last state
|
|
150
|
-
6. Click "🔑 Get Write Link" on the card to receive a write-enabled terminal URL via DM
|
|
151
|
-
7. Claude replies in the thread via MCP tools
|
|
333
|
+
---
|
|
152
334
|
|
|
153
|
-
|
|
335
|
+
## CLI Commands
|
|
154
336
|
|
|
155
337
|
| Command | Description |
|
|
156
338
|
|---------|-------------|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
169
|
-
### Scheduled Tasks
|
|
170
|
-
|
|
171
|
-
Create recurring tasks with natural language:
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
/schedule every day at 17:50 check AI news
|
|
175
|
-
/schedule weekdays at 9:00 run health check
|
|
176
|
-
/schedule every Monday at 10:00 generate weekly report
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Manage tasks:
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
/schedule list
|
|
183
|
-
/schedule remove <id>
|
|
184
|
-
/schedule enable <id>
|
|
185
|
-
/schedule disable <id>
|
|
186
|
-
/schedule run <id>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Streaming Cards
|
|
190
|
-
|
|
191
|
-
Each conversation turn gets a live-updating Feishu card that shows:
|
|
192
|
-
|
|
193
|
-
- Real-time terminal output (rendered via headless xterm + Feishu Card v2 markdown)
|
|
194
|
-
- Status indicator: 🟡 Starting > 🔵 Working > 🟢 Idle
|
|
195
|
-
- Action buttons: Open Terminal, Get Write Link, Restart Claude, Close Session
|
|
196
|
-
|
|
197
|
-
The card content is captured from a headless xterm terminal that filters out TUI chrome (logo, status bar, prompts, box-drawing characters) and shows only Claude's actual work output.
|
|
198
|
-
|
|
199
|
-
### Web Terminal
|
|
200
|
-
|
|
201
|
-
<p align="center">
|
|
202
|
-
<img src="gif/web_terminal.gif" alt="Web terminal live output" width="600">
|
|
203
|
-
</p>
|
|
204
|
-
|
|
205
|
-
Each session exposes a web terminal at `http://<WEB_EXTERNAL_HOST>:<port>`.
|
|
206
|
-
|
|
207
|
-
- **Read-only link** — shown on the streaming card in the group thread
|
|
208
|
-
- **Write-enabled link** — sent via DM on demand (click "🔑 Get Write Link" on the card)
|
|
209
|
-
|
|
210
|
-
Features: xterm.js with fit/unicode11/web-links addons, TokyoNight theme, scrollback buffer. On mobile/tablet, a floating shortcut toolbar provides Esc, Ctrl+C, Tab, arrow keys and other control keys missing from virtual keyboards, with automatic keyboard avoidance.
|
|
211
|
-
|
|
212
|
-
### Tmux Persistent Sessions
|
|
213
|
-
|
|
214
|
-
<p align="center">
|
|
215
|
-
<img src="gif/tmux.gif" alt="botmux list — interactive tmux session management" width="600">
|
|
216
|
-
</p>
|
|
217
|
-
|
|
218
|
-
When tmux is installed, botmux automatically uses the tmux backend. CLI processes run inside tmux sessions while the daemon attaches via node-pty to capture output — streaming cards, idle detection, and web terminal all work unchanged.
|
|
219
|
-
|
|
220
|
-
**Key benefit: daemon restarts don't interrupt the CLI.** During `botmux restart`, the worker process exits but the tmux session (and the CLI inside it) keeps running. The next incoming message triggers a re-attach — no `--resume` context reload needed.
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# Recommended: interactive session picker — select and attach to tmux
|
|
224
|
-
npx botmux list
|
|
225
|
-
|
|
226
|
-
# Or manually attach (session name = bmx-<first 8 chars of session ID>)
|
|
227
|
-
tmux attach -t bmx-<first-8-chars-of-session-id>
|
|
228
|
-
# Ctrl+B, D to detach — CLI keeps running
|
|
229
|
-
|
|
230
|
-
# Force pure pty mode (disable tmux)
|
|
231
|
-
BACKEND_TYPE=pty botmux start
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
`botmux list` provides an interactive TUI showing all active sessions with ID, title, working directory, PID, uptime, and status. Use arrow keys to select and Enter to attach. Use `botmux list --plain` for plain-text table output suitable for scripting.
|
|
235
|
-
|
|
236
|
-
**Session naming:** `bmx-<first 8 chars of session UUID>`
|
|
237
|
-
|
|
238
|
-
**Lifecycle:**
|
|
339
|
+
| `botmux setup` | Interactive setup (first-time or add bots) |
|
|
340
|
+
| `botmux start` | Start daemon (PM2 managed) |
|
|
341
|
+
| `botmux stop` | Stop daemon |
|
|
342
|
+
| `botmux restart` | Restart daemon (auto-restores active sessions) |
|
|
343
|
+
| `botmux logs` | View daemon logs (`--lines N` for more) |
|
|
344
|
+
| `botmux status` | Show daemon status |
|
|
345
|
+
| `botmux upgrade` | Upgrade to latest version |
|
|
346
|
+
| `botmux list` | List all active sessions (alias: `ls`) |
|
|
347
|
+
| `botmux delete <id>` | Close a session by ID prefix (alias: `del`/`rm`) |
|
|
348
|
+
| `botmux delete all` | Close all active sessions |
|
|
349
|
+
| `botmux delete stopped` | Clean up zombie sessions with dead processes |
|
|
239
350
|
|
|
240
|
-
|
|
241
|
-
|-------|-------------|-------------|
|
|
242
|
-
| `botmux restart` | Survives | Survives (re-attaches on next message) |
|
|
243
|
-
| `/close` or close button | Destroyed | Terminated (SIGHUP) |
|
|
244
|
-
| CLI exits / crashes | Closes with it | Already exited (auto-restart creates new session) |
|
|
351
|
+
---
|
|
245
352
|
|
|
246
353
|
## Contributing
|
|
247
354
|
|