@mmmbuto/nexuscrew 0.1.0-beta.1 → 0.2.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.
Files changed (49) hide show
  1. package/README.md +67 -120
  2. package/bin/nexuscrew.js +468 -264
  3. package/frontend/dist/apple-touch-icon.png +0 -0
  4. package/frontend/dist/assets/{index-C7bAndew.js → index-BG1N7bSL.js} +1710 -1702
  5. package/frontend/dist/assets/index-CiAtinNP.css +1 -0
  6. package/frontend/dist/favicon.svg +20 -0
  7. package/frontend/dist/icon-192.png +0 -0
  8. package/frontend/dist/icon-512.png +0 -0
  9. package/frontend/dist/index.html +11 -3
  10. package/frontend/dist/site.webmanifest +29 -0
  11. package/lib/config/hosts.js +67 -0
  12. package/lib/config/manager.js +379 -0
  13. package/lib/config/models.js +408 -0
  14. package/lib/server/db/adapter.js +274 -0
  15. package/lib/server/db/drivers/sql-js.js +75 -0
  16. package/lib/server/db/migrate.js +174 -0
  17. package/lib/server/db/migrations/001_base_schema.sql +70 -0
  18. package/lib/server/middleware/auth.js +134 -0
  19. package/lib/server/middleware/rate-limit.js +63 -0
  20. package/lib/server/models/User.js +128 -0
  21. package/lib/server/routes/auth.js +168 -0
  22. package/lib/server/routes/hosts.js +11 -20
  23. package/lib/server/routes/keys.js +28 -0
  24. package/lib/server/routes/models.js +59 -4
  25. package/lib/server/routes/runtimes.js +34 -0
  26. package/lib/server/routes/send.js +76 -12
  27. package/lib/server/routes/sessions.js +39 -10
  28. package/lib/server/routes/speech.js +46 -0
  29. package/lib/server/routes/status.js +8 -6
  30. package/lib/server/routes/upload.js +135 -0
  31. package/lib/server/routes/wake-lock.js +95 -0
  32. package/lib/server/routes/workspaces.js +101 -0
  33. package/lib/server/server.js +66 -33
  34. package/lib/server/services/attachment-manager.js +57 -0
  35. package/lib/server/services/context-bridge.js +425 -0
  36. package/lib/server/services/runtime-manager.js +462 -0
  37. package/lib/server/services/speech-manager.js +76 -0
  38. package/lib/server/services/summary-generator.js +309 -0
  39. package/lib/server/services/workspace-manager.js +79 -0
  40. package/lib/services/engine-discovery.js +198 -13
  41. package/lib/services/log-watcher.js +40 -22
  42. package/lib/services/remote-pane-watcher.js +155 -0
  43. package/lib/services/session-store.js +60 -64
  44. package/lib/services/tmux-manager.js +127 -116
  45. package/lib/setup/postinstall.js +38 -0
  46. package/lib/utils/paths.js +124 -0
  47. package/lib/utils/termux.js +182 -0
  48. package/package.json +8 -4
  49. package/frontend/dist/assets/index-OENqI1_9.css +0 -1
package/README.md CHANGED
@@ -1,175 +1,122 @@
1
- ## Overview
1
+ # NexusCrew
2
2
 
3
- NexusCrew is a **tmux-based** AI cockpit that orchestrates Claude Code, Codex CLI, Gemini CLI, and Qwen Code through persistent tmux sessions.
3
+ Mobile-first `tmux` cockpit for local and remote AI CLI sessions.
4
4
 
5
- This is a **study project** exploring an alternative approach to AI CLI orchestration, based on experience with [NexusCLI](https://www.npmjs.com/package/@mmmbuto/nexuscli). Instead of managing PTY processes in-memory, NexusCrew delegates session lifecycle to **tmux** — sessions survive server restarts, can be accessed directly from the terminal, and extend to remote hosts via SSH.
5
+ NexusCrew is built for `Termux` and smartphone-first workflows, but also runs on Linux and macOS. It keeps CLI sessions alive inside `tmux`, exposes them through a web UI, and lets you switch between local and SSH hosts without reopening everything by hand.
6
6
 
7
- > **Status**: Beta — experimental, API may change
7
+ ## Highlights
8
8
 
9
- ---
10
-
11
- ## Why tmux?
12
-
13
- | Problem | NexusCLI (PTY) | NexusCrew (tmux) |
14
- |---------|---------------|-------------------|
15
- | Server crash | All sessions die | Sessions survive |
16
- | Direct access | Web UI only | Web UI + `tmux attach` |
17
- | Remote machines | Not supported | SSH to any host |
18
- | Native deps | node-pty required | Zero native deps |
19
- | Session recovery | Manual | Automatic |
20
-
21
- ---
22
-
23
- ## Features
24
-
25
- - **Persistent sessions** — tmux windows survive server restarts
26
- - **Multi-engine** — Claude Code, Codex CLI, Gemini CLI, Qwen Code
27
- - **Auto-discovery** — detects installed CLIs + parses shell aliases/functions from `providers.zsh`
28
- - **Remote hosts** — manage tmux sessions on any machine via SSH
29
- - **Unified web UI** — same interface across all engines and hosts
30
- - **SSE streaming** — real-time output from tmux sessions
31
- - **Zero native deps** — no node-pty, no compilation required
32
- - **Cross-platform** — Linux, macOS, Termux (Android)
33
-
34
- ---
35
-
36
- ## Engine Discovery
37
-
38
- NexusCrew automatically detects:
39
-
40
- 1. **Standard CLIs** — `claude`, `codex`, `gemini`, `qwen` via PATH and common install paths
41
- 2. **Shell aliases** — parses `~/Dev/providers.zsh` (or configured path) for wrapper functions like:
42
- - `claude-glm-a`, `codex-alibaba-qwen35`, `claude-minimax27`, etc.
43
- - Each alias becomes available as a custom lane in the model selector
44
-
45
- ---
9
+ - Persistent `tmux` sessions for Claude, Codex, Gemini and Qwen
10
+ - Local + SSH host switching from one mobile-first UI
11
+ - Remote streaming via `tmux capture-pane`
12
+ - File and image attachments, including remote SSH staging
13
+ - Local STT with `whisper.cpp`, browser fallback, system TTS
14
+ - Dark/light theme
15
+ - Installable web app shell with mobile icon/manifest
16
+ - Termux-oriented CLI with setup, start, status and host management
46
17
 
47
18
  ## Install
48
19
 
49
20
  ```bash
50
21
  npm install -g @mmmbuto/nexuscrew
22
+ nexuscrew setup
23
+ nexuscrew start
51
24
  ```
52
25
 
53
- Then initialize:
54
-
55
- ```bash
56
- nexuscrew init
57
- ```
26
+ `nexuscrew start` runs the server in background, waits for health, and can open the browser for you.
58
27
 
59
- And start:
28
+ Default URL:
60
29
 
61
- ```bash
62
- nexuscrew start
30
+ ```text
31
+ http://localhost:41820
63
32
  ```
64
33
 
65
- Open `http://localhost:41820` in your browser.
34
+ ## Termux
66
35
 
67
- ### Termux (Android)
36
+ Recommended base packages:
68
37
 
69
38
  ```bash
70
- pkg install tmux nodejs
39
+ pkg install nodejs tmux openssh termux-services
71
40
  npm install -g @mmmbuto/nexuscrew
72
- nexuscrew init
73
- nexuscrew start
41
+ nexuscrew setup
74
42
  ```
75
43
 
76
- ---
44
+ The setup wizard can also:
77
45
 
78
- ## Remote Hosts
46
+ - prepare `Termux:Boot`
47
+ - create and enable the native `runit` service via `termux-services`
48
+ - configure SSH hosts
49
+ - prepare local STT checks for `whisper.cpp`
79
50
 
80
- Add SSH hosts to manage tmux sessions on remote machines:
51
+ ## Core Commands
81
52
 
82
53
  ```bash
83
- nexuscrew hosts add --name vps1 --host example.com --user user
84
- nexuscrew hosts add --name vps2 --host 192.168.1.10 --user admin --port 2222
54
+ nexuscrew setup
55
+ nexuscrew start
56
+ nexuscrew stop
57
+ nexuscrew status
58
+ nexuscrew attach
59
+ nexuscrew sessions
60
+ nexuscrew hosts list
61
+ nexuscrew hosts add --name mybox --host example.com --user dag
62
+ nexuscrew stt doctor
85
63
  ```
86
64
 
87
- Hosts appear in the UI's model selector. Sessions created on a remote host open a tmux window there via SSH.
65
+ ## How It Works
88
66
 
89
- ---
90
-
91
- ## Commands
92
-
93
- | Command | Description |
94
- |---------|-------------|
95
- | `nexuscrew init` | First-time setup (config, hosts, tmux check) |
96
- | `nexuscrew start` | Start server + tmux session |
97
- | `nexuscrew stop` | Stop server |
98
- | `nexuscrew status` | Server + tmux + hosts status |
99
- | `nexuscrew engines` | Discover available AI CLIs and aliases |
100
- | `nexuscrew sessions` | List tmux windows |
101
- | `nexuscrew attach` | Attach to tmux session directly |
102
- | `nexuscrew config` | View/edit configuration |
103
- | `nexuscrew hosts list` | List configured hosts |
104
- | `nexuscrew hosts add` | Add remote SSH host |
105
- | `nexuscrew hosts remove` | Remove a host |
67
+ ```text
68
+ Browser/WebView <-> Express API <-> tmux session/windows <-> AI CLI processes
69
+ |
70
+ +-> local machine
71
+ +-> SSH hosts
72
+ ```
106
73
 
107
- ---
74
+ Each conversation runs in its own `tmux` window. Local sessions stream from log watchers; remote sessions stream from incremental pane capture.
108
75
 
109
76
  ## Configuration
110
77
 
111
- Config stored in `~/.nexuscrew/config.json`:
78
+ Main config:
112
79
 
113
- ```json
114
- {
115
- "port": 41820,
116
- "tmuxSession": "nexuscrew",
117
- "logDir": "~/.nexuscrew/logs",
118
- "autoDiscovery": true,
119
- "providersPath": "~/Dev/providers.zsh"
120
- }
80
+ ```text
81
+ ~/.nexuscrew/config.json
121
82
  ```
122
83
 
123
- Hosts stored in `~/.nexuscrew/hosts.json`:
84
+ Host registry:
124
85
 
125
- ```json
126
- [
127
- { "name": "local", "type": "local", "default": true },
128
- { "name": "vps1", "type": "ssh", "host": "example.com", "user": "user", "port": "22" }
129
- ]
86
+ ```text
87
+ ~/.nexuscrew/hosts.json
130
88
  ```
131
89
 
132
- ---
90
+ Important defaults include:
133
91
 
134
- ## Network
92
+ - `server.port`
93
+ - `tmuxSession`
94
+ - `hosts.default`
95
+ - `workspaces.default`
96
+ - `stt.provider`
97
+ - `termux.boot_start`
98
+ - `termux.service_enabled`
135
99
 
136
- | Protocol | Default Port | Use Case |
137
- |----------|--------------|----------|
138
- | HTTP | `41820` | Local access |
100
+ ## Authentication
139
101
 
140
- ---
102
+ Localhost use is optimized for local device workflows.
141
103
 
142
- ## Architecture
143
-
144
- ```
145
- Browser ←SSE→ Express Server ←tmux→ tmux session "nexuscrew"
146
- ├─ window: nc-abc12345 (claude)
147
- ├─ window: nc-def67890 (codex)
148
- └─ window: nc-ghi11111 (gemini)
149
- ```
150
-
151
- Each AI session = one tmux window. Output captured via `tee` to log files, parsed by engine-specific parsers, and streamed to the UI via SSE.
152
-
153
- ---
104
+ For remote or network exposure, review and configure authentication before relying on the instance outside localhost. Do not expose an unreviewed dev setup directly to the public internet.
154
105
 
155
106
  ## Development
156
107
 
157
108
  ```bash
158
- git clone https://github.com/dionanos/nexuscrew
109
+ git clone https://github.com/DioNanos/nexuscrew
159
110
  cd nexuscrew
160
111
  npm install
161
- cd frontend && npm install && npm run build && cd ..
112
+ npm run build
162
113
  npm run dev
163
114
  ```
164
115
 
165
- ---
166
-
167
- ## Relation to NexusCLI
168
-
169
- NexusCrew is a **study branch** inspired by [NexusCLI](https://www.npmjs.com/package/@mmmbuto/nexuscli). It shares the same web UI but replaces the PTY-based process management with tmux-based persistent sessions. The goal is to explore whether tmux provides a simpler, more robust foundation for AI CLI orchestration — especially for remote hosts and crash recovery.
116
+ ## Related
170
117
 
171
- ---
118
+ - [NexusCLI](https://www.npmjs.com/package/@mmmbuto/nexuscli) - PTY-based sibling project
172
119
 
173
120
  ## License
174
121
 
175
- MIT License. See [LICENSE](LICENSE).
122
+ MIT