feat: xterm.js + node-pty architecture for Claude CLI web terminal

Complete rewrite from tmux + JSONL parsing to a clean PTY-based approach.
The proxy spawns Claude CLI in a pseudo-terminal via node-pty and relays
terminal I/O as binary WebSocket frames to the simple-chat backend,
which forwards them to the browser where xterm.js renders a full terminal.

- node-pty PTY manager with 50KB replay buffer per session
- Binary frame protocol with chatId multiplexing
- WebSocket client with auto-reconnection and heartbeat
- Directory listing and session listing for the web UI
- README with setup instructions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 00:24:29 +03:00
commit 4a91896732
17 changed files with 6146 additions and 0 deletions

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "claude-cli-proxy",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"start": "tsx src/main.ts",
"dev": "tsx watch src/main.ts",
"lint": "eslint src/",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
"@xterm/addon-fit": "^0.11.0",
"@xterm/addon-web-links": "^0.12.0",
"@xterm/xterm": "^6.0.0",
"chokidar": "^4.0.0",
"dotenv": "^16.4.7",
"ws": "^8.18.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/ws": "^8.5.0",
"@vigdorov/eslint-config": "^1.0.1",
"@vigdorov/prettier-config": "^1.0.0",
"@vigdorov/typescript-config": "^1.1.0",
"eslint": "^9.39.2",
"tsx": "^4.19.0",
"typescript": "^5.7.0",
"typescript-eslint": "^8.54.0"
}
}