@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.
Files changed (35) hide show
  1. package/README.md +54 -120
  2. package/bin/nexuscrew.js +9 -8
  3. package/frontend/dist/assets/{index-C7bAndew.js → index-8pw4eMB-.js} +1715 -1702
  4. package/frontend/dist/assets/index-BF0tdvNT.css +1 -0
  5. package/frontend/dist/index.html +2 -2
  6. package/lib/config/manager.js +362 -0
  7. package/lib/config/models.js +408 -0
  8. package/lib/server/db/adapter.js +274 -0
  9. package/lib/server/db/drivers/sql-js.js +75 -0
  10. package/lib/server/db/migrate.js +174 -0
  11. package/lib/server/db/migrations/001_base_schema.sql +70 -0
  12. package/lib/server/middleware/auth.js +134 -0
  13. package/lib/server/middleware/rate-limit.js +63 -0
  14. package/lib/server/models/User.js +128 -0
  15. package/lib/server/routes/auth.js +168 -0
  16. package/lib/server/routes/keys.js +15 -0
  17. package/lib/server/routes/models.js +59 -4
  18. package/lib/server/routes/runtimes.js +34 -0
  19. package/lib/server/routes/send.js +28 -4
  20. package/lib/server/routes/sessions.js +34 -2
  21. package/lib/server/routes/speech.js +75 -0
  22. package/lib/server/routes/upload.js +134 -0
  23. package/lib/server/routes/wake-lock.js +95 -0
  24. package/lib/server/routes/workspaces.js +101 -0
  25. package/lib/server/server.js +48 -16
  26. package/lib/server/services/context-bridge.js +425 -0
  27. package/lib/server/services/runtime-manager.js +462 -0
  28. package/lib/server/services/summary-generator.js +309 -0
  29. package/lib/server/services/workspace-manager.js +79 -0
  30. package/lib/services/engine-discovery.js +198 -13
  31. package/lib/services/session-store.js +57 -61
  32. package/lib/utils/paths.js +107 -0
  33. package/lib/utils/termux.js +145 -0
  34. package/package.json +6 -2
  35. package/frontend/dist/assets/index-OENqI1_9.css +0 -1
package/README.md CHANGED
@@ -1,69 +1,34 @@
1
- ## Overview
1
+ # NexusCrew — tmux AI Cockpit
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.
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
- - **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
- ---
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 hosts add --name vps1 --host example.com --user user
84
- nexuscrew hosts add --name vps2 --host 192.168.1.10 --user admin --port 2222
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
- Hosts appear in the UI's model selector. Sessions created on a remote host open a tmux window there via SSH.
88
-
89
- ---
90
-
91
- ## Commands
51
+ ## Architecture
92
52
 
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 |
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
- Config stored in `~/.nexuscrew/config.json`:
112
-
64
+ `~/.nexuscrew/config.json`:
113
65
  ```json
114
66
  {
115
67
  "port": 41820,
116
68
  "tmuxSession": "nexuscrew",
117
- "logDir": "~/.nexuscrew/logs",
118
- "autoDiscovery": true,
119
- "providersPath": "~/Dev/providers.zsh"
69
+ "autoDiscovery": true
120
70
  }
121
71
  ```
122
72
 
123
- Hosts stored in `~/.nexuscrew/hosts.json`:
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
- ## Architecture
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
- 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.
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/dionanos/nexuscrew
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 License. See [LICENSE](LICENSE).
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.1.0');
19
+ .version('0.2.0');
20
20
 
21
21
  // --- init ---
22
22
  program.command('init')
23
23
  .description('First-time setup')
24
- .action(() => {
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 ---