@mmmbuto/nexuscrew 0.1.0-beta.1 → 0.2.0
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.md +54 -120
- package/bin/nexuscrew.js +9 -8
- package/frontend/dist/assets/{index-C7bAndew.js → index-8pw4eMB-.js} +1715 -1702
- package/frontend/dist/assets/index-BF0tdvNT.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/lib/config/manager.js +362 -0
- package/lib/config/models.js +408 -0
- package/lib/server/db/adapter.js +274 -0
- package/lib/server/db/drivers/sql-js.js +75 -0
- package/lib/server/db/migrate.js +174 -0
- package/lib/server/db/migrations/001_base_schema.sql +70 -0
- package/lib/server/middleware/auth.js +134 -0
- package/lib/server/middleware/rate-limit.js +63 -0
- package/lib/server/models/User.js +128 -0
- package/lib/server/routes/auth.js +168 -0
- package/lib/server/routes/keys.js +15 -0
- package/lib/server/routes/models.js +59 -4
- package/lib/server/routes/runtimes.js +34 -0
- package/lib/server/routes/send.js +28 -4
- package/lib/server/routes/sessions.js +34 -2
- package/lib/server/routes/speech.js +75 -0
- package/lib/server/routes/upload.js +134 -0
- package/lib/server/routes/wake-lock.js +95 -0
- package/lib/server/routes/workspaces.js +101 -0
- package/lib/server/server.js +48 -16
- package/lib/server/services/context-bridge.js +425 -0
- package/lib/server/services/runtime-manager.js +462 -0
- package/lib/server/services/summary-generator.js +309 -0
- package/lib/server/services/workspace-manager.js +79 -0
- package/lib/services/engine-discovery.js +198 -13
- package/lib/services/session-store.js +57 -61
- package/lib/utils/paths.js +107 -0
- package/lib/utils/termux.js +145 -0
- package/package.json +6 -2
- package/frontend/dist/assets/index-OENqI1_9.css +0 -1
package/README.md
CHANGED
|
@@ -1,69 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
# NexusCrew — tmux AI Cockpit
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
6
|
-
|
|
7
|
-
> **Status**: Beta — experimental, API may change
|
|
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
|
-
---
|
|
3
|
+
**Mobile-first** web cockpit for AI CLI tools. Persistent sessions via tmux.
|
|
22
4
|
|
|
23
5
|
## Features
|
|
24
6
|
|
|
25
7
|
- **Persistent sessions** — tmux windows survive server restarts
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
---
|
|
8
|
+
- **4 engines** — Claude Code, Codex CLI, Gemini CLI, Qwen Code
|
|
9
|
+
- **Mobile-first** — Termux (Android) primary target, then Linux/Mac
|
|
10
|
+
- **Zero native deps** — sql.js (WASM SQLite), no compilation needed
|
|
11
|
+
- **Auth** — JWT with localhost auto-bypass
|
|
12
|
+
- **Dark/Light theme** — CSS variables, instant toggle
|
|
13
|
+
- **i18n** — 6 languages (en, it, es, ja, ru, zh)
|
|
14
|
+
- **STT/TTS** — Speech-to-text (Web Speech API + OpenAI Whisper) + Read aloud
|
|
15
|
+
- **File upload** — 50MB attachments
|
|
16
|
+
- **Session dots** — Green (alive), Yellow (idle), Red (dead) tmux state
|
|
17
|
+
- **Lane-aware models** — Native + Custom per engine
|
|
18
|
+
- **Shell discovery** — Scans .zshrc, .bashrc, providers.zsh for aliases
|
|
19
|
+
- **Remote hosts** — SSH to any machine
|
|
20
|
+
- **SSE streaming** — Real-time AI output
|
|
21
|
+
- **6 languages UI** — Auto-detects browser language
|
|
46
22
|
|
|
47
23
|
## Install
|
|
48
24
|
|
|
49
25
|
```bash
|
|
50
26
|
npm install -g @mmmbuto/nexuscrew
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Then initialize:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
27
|
nexuscrew init
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
And start:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
28
|
nexuscrew start
|
|
29
|
+
# Open http://localhost:41820
|
|
63
30
|
```
|
|
64
31
|
|
|
65
|
-
Open `http://localhost:41820` in your browser.
|
|
66
|
-
|
|
67
32
|
### Termux (Android)
|
|
68
33
|
|
|
69
34
|
```bash
|
|
@@ -73,103 +38,72 @@ nexuscrew init
|
|
|
73
38
|
nexuscrew start
|
|
74
39
|
```
|
|
75
40
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## Remote Hosts
|
|
79
|
-
|
|
80
|
-
Add SSH hosts to manage tmux sessions on remote machines:
|
|
41
|
+
## Quick Start
|
|
81
42
|
|
|
82
43
|
```bash
|
|
83
|
-
nexuscrew
|
|
84
|
-
nexuscrew
|
|
44
|
+
nexuscrew init # First-time setup
|
|
45
|
+
nexuscrew start # Start server + tmux
|
|
46
|
+
nexuscrew status # Check server + sessions
|
|
47
|
+
nexuscrew attach # Attach to tmux directly
|
|
48
|
+
nexuscrew engines # Discover AI CLIs
|
|
85
49
|
```
|
|
86
50
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Commands
|
|
51
|
+
## Architecture
|
|
92
52
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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 |
|
|
53
|
+
```
|
|
54
|
+
Browser/WebView ←SSE/REST→ Express :41820 ←tmux→ CLI AI processes
|
|
55
|
+
|
|
|
56
|
+
sql.js DB (WASM)
|
|
57
|
+
JWT Auth
|
|
58
|
+
```
|
|
106
59
|
|
|
107
|
-
|
|
60
|
+
Each AI session = one tmux window. Output captured via `tee`, streamed to UI via SSE.
|
|
108
61
|
|
|
109
62
|
## Configuration
|
|
110
63
|
|
|
111
|
-
|
|
112
|
-
|
|
64
|
+
`~/.nexuscrew/config.json`:
|
|
113
65
|
```json
|
|
114
66
|
{
|
|
115
67
|
"port": 41820,
|
|
116
68
|
"tmuxSession": "nexuscrew",
|
|
117
|
-
"
|
|
118
|
-
"autoDiscovery": true,
|
|
119
|
-
"providersPath": "~/Dev/providers.zsh"
|
|
69
|
+
"autoDiscovery": true
|
|
120
70
|
}
|
|
121
71
|
```
|
|
122
72
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
[
|
|
127
|
-
{ "name": "local", "type": "local", "default": true },
|
|
128
|
-
{ "name": "vps1", "type": "ssh", "host": "example.com", "user": "user", "port": "22" }
|
|
129
|
-
]
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Network
|
|
135
|
-
|
|
136
|
-
| Protocol | Default Port | Use Case |
|
|
137
|
-
|----------|--------------|----------|
|
|
138
|
-
| HTTP | `41820` | Local access |
|
|
139
|
-
|
|
140
|
-
---
|
|
73
|
+
## Commands
|
|
141
74
|
|
|
142
|
-
|
|
75
|
+
| Command | Description |
|
|
76
|
+
|---------|-------------|
|
|
77
|
+
| `nexuscrew init` | First-time setup |
|
|
78
|
+
| `nexuscrew start` | Start server + tmux |
|
|
79
|
+
| `nexuscrew stop` | Stop server |
|
|
80
|
+
| `nexuscrew status` | Server + tmux + hosts |
|
|
81
|
+
| `nexuscrew engines` | Discover CLIs + aliases |
|
|
82
|
+
| `nexuscrew sessions` | List tmux windows |
|
|
83
|
+
| `nexuscrew attach` | Attach to tmux |
|
|
84
|
+
| `nexuscrew config` | View/edit config |
|
|
85
|
+
| `nexuscrew hosts add` | Add SSH host |
|
|
143
86
|
|
|
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
|
-
```
|
|
87
|
+
## API
|
|
150
88
|
|
|
151
|
-
|
|
89
|
+
Public: `/health`, `/api/v1/auth/login`, `/api/v1/models`, `/api/v1/runtimes`
|
|
90
|
+
Protected (JWT/localhost): `/api/v1/send`, `/api/v1/sessions`, `/api/v1/upload`, `/api/v1/workspaces`
|
|
152
91
|
|
|
153
|
-
|
|
92
|
+
Default login: `admin` / `admin` (change after first login)
|
|
154
93
|
|
|
155
94
|
## Development
|
|
156
95
|
|
|
157
96
|
```bash
|
|
158
|
-
git clone https://github.com/
|
|
159
|
-
cd nexuscrew
|
|
160
|
-
npm install
|
|
97
|
+
git clone https://github.com/DioNanos/nexuscrew
|
|
98
|
+
cd nexuscrew && npm install
|
|
161
99
|
cd frontend && npm install && npm run build && cd ..
|
|
162
100
|
npm run dev
|
|
163
101
|
```
|
|
164
102
|
|
|
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.
|
|
103
|
+
## Related
|
|
170
104
|
|
|
171
|
-
|
|
105
|
+
- [NexusCLI](https://www.npmjs.com/package/@mmmbuto/nexuscli) — PTY-based variant
|
|
172
106
|
|
|
173
107
|
## License
|
|
174
108
|
|
|
175
|
-
MIT
|
|
109
|
+
MIT
|
package/bin/nexuscrew.js
CHANGED
|
@@ -16,15 +16,16 @@ const program = new Command();
|
|
|
16
16
|
program
|
|
17
17
|
.name('nexuscrew')
|
|
18
18
|
.description('tmux-based AI cockpit')
|
|
19
|
-
.version('0.
|
|
19
|
+
.version('0.2.0');
|
|
20
20
|
|
|
21
21
|
// --- init ---
|
|
22
22
|
program.command('init')
|
|
23
23
|
.description('First-time setup')
|
|
24
|
-
.
|
|
24
|
+
.option('-s, --silent', 'Silent mode (no output)')
|
|
25
|
+
.action((opts) => {
|
|
25
26
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
26
27
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
27
|
-
console.log('Created ~/.nexuscrew/');
|
|
28
|
+
if (!opts.silent) console.log('Created ~/.nexuscrew/');
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// Default config
|
|
@@ -36,7 +37,7 @@ program.command('init')
|
|
|
36
37
|
autoDiscovery: true,
|
|
37
38
|
providersPath: ''
|
|
38
39
|
}, null, 2));
|
|
39
|
-
console.log('Created config.json');
|
|
40
|
+
if (!opts.silent) console.log('Created config.json');
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// Default hosts
|
|
@@ -44,7 +45,7 @@ program.command('init')
|
|
|
44
45
|
fs.writeFileSync(HOSTS_PATH, JSON.stringify([
|
|
45
46
|
{ name: 'local', type: 'local', default: true }
|
|
46
47
|
], null, 2));
|
|
47
|
-
console.log('Created hosts.json');
|
|
48
|
+
if (!opts.silent) console.log('Created hosts.json');
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
// Log dir
|
|
@@ -56,12 +57,12 @@ program.command('init')
|
|
|
56
57
|
// Check tmux
|
|
57
58
|
try {
|
|
58
59
|
execSync('which tmux', { stdio: 'pipe' });
|
|
59
|
-
console.log('tmux: OK');
|
|
60
|
+
if (!opts.silent) console.log('tmux: OK');
|
|
60
61
|
} catch {
|
|
61
|
-
console.error('tmux not found! Install: apt install tmux (or pkg install tmux)');
|
|
62
|
+
if (!opts.silent) console.error('tmux not found! Install: apt install tmux (or pkg install tmux)');
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
console.log('\nDone! Run: nexuscrew start');
|
|
65
|
+
if (!opts.silent) console.log('\nDone! Run: nexuscrew start');
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
// --- start ---
|