Skip to content

Commit f720c7b

Browse files
chapterjasonclaude
andcommitted
Document tmux in README
Call out the tmux requirement and explain the reattach-on-startup persistence model so readers know shells survive Node restarts but not host reboots. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 910d609 commit f720c7b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# web-shell
22

3-
Persistent browser terminal. Spawns PTY sessions on a Node.js backend and streams them over WebSocket to [xterm.js](https://xtermjs.org/). Sessions live server-side with a scrollback buffer, so refreshing the page — or reattaching from another deviceresumes the same shell exactly where you left it.
3+
Persistent browser terminal. Spawns shells inside `tmux` sessions on a Node.js backend and streams them over WebSocket to [xterm.js](https://xtermjs.org/). Sessions live server-side with a scrollback buffer and survive page refreshes, device switches, _and_ server restarts`tmux` keeps the shells running, and the server reattaches to them on boot.
44

55
## Stack
66

7-
- **Server**: Node.js + TypeScript, `node-pty`, `ws`
7+
- **Server**: Node.js + TypeScript, `node-pty`, `ws`, `tmux` (required on `$PATH`)
88
- **Client**: TypeScript + SCSS + Vite, `xterm.js`
99
- Strict TS everywhere (`noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`, …)
1010

11+
## Requirements
12+
13+
- Node.js 20+
14+
- `tmux` installed and on `$PATH` — every session is a `tmux new-session -A -s webshell-<id>` under the hood.
15+
1116
## Layout
1217

1318
```
@@ -86,7 +91,9 @@ Server → client:
8691

8792
## Persistence model
8893

89-
`SessionManager` owns the live `Session` instances. Each session keeps the last 256 KB of PTY output in a ring buffer. New WebSocket connections receive a `history` frame with the current buffer before live `output` streams, so the terminal repaints to the current state on refresh.
94+
Each `Session` is a `tmux` session named `webshell-<uuid>`, spawned under `node-pty` with a bundled `tmux.conf` (`server/tmux.conf`). `SessionManager` owns the live wrappers and keeps the last 256 KB of PTY output in a ring buffer per session. New WebSocket connections receive a sanitized `history` frame with the current buffer before live `output` streams, so the terminal repaints to the current state on refresh.
95+
96+
Because the shells run inside `tmux`, they outlive the Node process. On startup, the server enumerates existing `webshell-*` tmux sessions, reattaches to each one, and seeds its scrollback from `tmux capture-pane`. Killing a session via the API runs `tmux kill-session`.
9097

9198
The active session id is stored in `localStorage` so reloads reopen the same session automatically.
9299

0 commit comments

Comments
 (0)