@mmmbuto/nexuscli 0.9.7005-termux → 0.10.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 (54) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +89 -152
  3. package/bin/nexuscli.js +12 -0
  4. package/frontend/dist/assets/{index-D8XkscmI.js → index-Bztt9hew.js} +1704 -1704
  5. package/frontend/dist/assets/{index-CoLEGBO4.css → index-Dj7jz2fy.css} +1 -1
  6. package/frontend/dist/index.html +2 -2
  7. package/frontend/dist/sw.js +1 -1
  8. package/lib/cli/api.js +19 -1
  9. package/lib/cli/config.js +27 -5
  10. package/lib/cli/engines.js +84 -202
  11. package/lib/cli/init.js +56 -2
  12. package/lib/cli/model.js +17 -7
  13. package/lib/cli/start.js +37 -24
  14. package/lib/cli/stop.js +12 -41
  15. package/lib/cli/update.js +28 -0
  16. package/lib/cli/workspaces.js +4 -0
  17. package/lib/config/manager.js +112 -8
  18. package/lib/config/models.js +388 -192
  19. package/lib/server/db/migrations/001_ultra_light_schema.sql +1 -1
  20. package/lib/server/db/migrations/006_runtime_lane_tracking.sql +79 -0
  21. package/lib/server/lib/getPty.js +51 -0
  22. package/lib/server/lib/pty-adapter.js +101 -57
  23. package/lib/server/lib/pty-provider.js +63 -0
  24. package/lib/server/lib/pty-utils-loader.js +136 -0
  25. package/lib/server/middleware/auth.js +27 -4
  26. package/lib/server/models/Conversation.js +7 -3
  27. package/lib/server/models/Message.js +29 -5
  28. package/lib/server/routes/chat.js +27 -4
  29. package/lib/server/routes/codex.js +35 -8
  30. package/lib/server/routes/config.js +9 -1
  31. package/lib/server/routes/gemini.js +24 -5
  32. package/lib/server/routes/jobs.js +15 -156
  33. package/lib/server/routes/models.js +12 -10
  34. package/lib/server/routes/qwen.js +26 -7
  35. package/lib/server/routes/runtimes.js +68 -0
  36. package/lib/server/server.js +3 -0
  37. package/lib/server/services/claude-wrapper.js +60 -62
  38. package/lib/server/services/codex-wrapper.js +79 -10
  39. package/lib/server/services/gemini-wrapper.js +9 -4
  40. package/lib/server/services/job-runner.js +156 -0
  41. package/lib/server/services/qwen-wrapper.js +26 -11
  42. package/lib/server/services/runtime-manager.js +467 -0
  43. package/lib/server/services/session-manager.js +56 -14
  44. package/lib/server/tests/integration.test.js +12 -0
  45. package/lib/server/tests/runtime-manager.test.js +46 -0
  46. package/lib/server/tests/runtime-persistence.test.js +97 -0
  47. package/lib/setup/postinstall-pty-check.js +183 -0
  48. package/lib/setup/postinstall.js +60 -41
  49. package/lib/utils/restart-warning.js +18 -0
  50. package/lib/utils/server.js +88 -0
  51. package/lib/utils/termux.js +1 -1
  52. package/lib/utils/update-check.js +153 -0
  53. package/lib/utils/update-runner.js +62 -0
  54. package/package.json +6 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,84 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.9.13] - 2026-01-09
6
+ ### Chore
7
+ - Add .npmignore to avoid publish warning
8
+
9
+ ## [0.9.12] - 2026-01-09
10
+ ### Fixed
11
+ - Guard PTY utils loading to avoid hard crash when dependency is broken or missing
12
+ - Safer fallback adapter when native PTY stack is unavailable
13
+ - Updated @mmmbuto/pty-termux-utils to ^1.1.3
14
+
15
+ ## [0.9.11] - 2026-01-09
16
+ ### Fixed
17
+ - Added PTY dependency verification in postinstall
18
+ - Added platform-specific PTY provider installation
19
+ - Added @mmmbuto/pty-termux-utils installation check
20
+ - All PTY dependencies now verified during npm install
21
+ - Updated @mmmbuto/pty-termux-utils to ^1.1.2
22
+
23
+ ## [0.9.10] - 2026-01-09
24
+ ### Fixed
25
+ - Added PTY dependency check in postinstall to verify node-pty installation
26
+ - Added pty-termux-utils verification to ensure .cjs files are built
27
+ - Platform detection now installs correct PTY provider:
28
+ - `@mmmbuto/node-pty-android-arm64` for Termux
29
+ - `@lydell/node-pty-linux-arm64` for Linux ARM64
30
+ - Provides helpful error messages when PTY dependencies are missing
31
+
32
+
33
+ ## [0.9.9] - 2026-01-01
34
+ ### Added
35
+ - Auto-update check on `nexuscli start` (npm + GitHub) with interactive prompt.
36
+ - `nexuscli update` / `nexuscli upgrade` command to update and restart server.
37
+ - Warnings when changing config while server is running.
38
+ - Live refresh of default model in UI (periodic + on focus).
39
+
40
+ ## [0.9.8] - 2025-12-30
41
+ ### Changed
42
+ - Update GLM routing to GLM-4.7 for Z.ai in Claude wrapper and model catalog.
43
+ ### Docs
44
+ - README updated for GLM-4.7 and release version.
45
+
46
+ ## [0.9.7004-termux] - 2025-12-28
47
+ ### Fixed
48
+ - Force Qwen model selection so `vision-model` is honored for image prompts.
49
+ - Parse Qwen stream-json tool events to keep statusbar live.
50
+ - Improve light theme contrast and update mobile statusbar theme colors.
51
+
52
+ ## [0.9.7-termux] - 2025-12-28
53
+ ### Added
54
+ - QWEN engine integration (Qwen Code CLI) with SSE streaming.
55
+ - QWEN models in catalog: `coder-model`, `vision-model`.
56
+ - QWEN session import + resume support.
57
+ ### Changed
58
+ - Statusbar now reflects QWEN tool activity in real time (stream-json parsing).
59
+
60
+ ## [0.9.6] - 2025-12-26
61
+ ### Fixed
62
+ - Restore Jobs CLI wrapper and Termux PTY adapter removed during cleanup.
63
+ - Use Termux-safe shell/runtime resolution for job execution (no hardcoded /bin or /usr/bin paths).
64
+ - Surface job stream errors correctly in the UI.
65
+
66
+ ## [0.9.5] - 2025-12-25
67
+ ### Added
68
+ - GPT-5.2 Codex set as default Codex model.
69
+ ### Changed
70
+ - Updated Codex model catalog to match OpenAI CLI.
71
+ ### Fixed
72
+ - i18n import after cleanup.
73
+
74
+ ## [0.9.4] - 2025-12-25
75
+ ### Added
76
+ - Dark/Light theme toggle with CSS variables and localStorage persistence.
77
+ - Rate limiting on chat endpoints (10 req/min per user).
78
+ - Architecture documentation (`docs/ARCHITECTURE.md`).
79
+
80
+ ## [0.9.3] - 2025-12-19
81
+ ### Fixed
82
+ - Normalize Termux workspace paths (auto-correct `/data/data/com/termux/...`) to prevent Claude spawn ENOENT and stalled GLM-4.6/DeepSeek runs.
83
+ - Workspaces API now filters and merges invalid paths to keep the UI dropdown clean.
84
+ - Session importer reads `cwd` from Claude session files when available for accurate workspace mapping.
package/README.md CHANGED
@@ -1,223 +1,160 @@
1
- # NexusCLI — AI Terminal Cockpit
2
-
3
- <p align="center">
4
- <img src=".github/header/header.png" width="900" />
5
- </p>
6
-
7
- ---
8
-
9
1
  ## Overview
10
2
 
11
- NexusCLI is a lightweight, Termux-first AI cockpit that orchestrates Claude Code, Codex CLI, Gemini CLI, and Qwen Code CLI from a single web/terminal UI. It supports live streaming, interrupts, session resume, workspace isolation, and remote voice input with auto HTTPS setup.
12
-
13
- ---
14
-
15
- [![npm](https://img.shields.io/npm/v/@mmmbuto/nexuscli?style=flat-square&logo=npm)](https://www.npmjs.com/package/@mmmbuto/nexuscli)
16
- [![downloads](https://img.shields.io/npm/dt/@mmmbuto/nexuscli?style=flat-square)](https://www.npmjs.com/package/@mmmbuto/nexuscli)
17
- [![ko-fi](https://img.shields.io/badge/☕_Support-Ko--fi-FF5E5B?style=flat-square&logo=ko-fi)](https://ko-fi.com/dionanos)
3
+ NexusCLI is a lightweight AI cockpit that orchestrates Claude Code, Codex CLI, Gemini CLI, and Qwen Code from a single web and terminal interface.
18
4
 
19
- ---
5
+ The project is runtime-aware:
20
6
 
21
- ## Screenshots
7
+ - each engine can expose `native` and `custom` lanes
8
+ - model selection is tied to a concrete runtime
9
+ - the UI can inspect runtime availability and update state
10
+ - sessions and messages persist runtime metadata in the local database
22
11
 
23
- <p align="center">
24
- <img src="docs/assets/screenshots/nexuscli-multilang-preview.png" width="45%" />
25
- <img src="docs/assets/screenshots/nexuscli-mobile-terminal.png" width="45%" />
26
- </p>
12
+ NexusCLI is `npm-first` and targets Linux, macOS, and Termux without requiring desktop-native builds for the core application.
27
13
 
28
14
  ---
29
15
 
30
- ## Highlights (v0.9.7004-termux)
31
-
32
- - **QWEN CLI**: Integrated Qwen Code CLI with `coder-model` and `vision-model`
33
- - **Statusbar Realtime**: Qwen tool events streamed live in the UI
34
- - **Light Theme**: Higher contrast + correct mobile statusbar colors
35
-
36
- ### Stable (v0.9.6)
37
-
38
- - Jobs runner restored with Termux-safe execution
39
- - Cleaner job SSE errors in UI
40
-
41
16
  ## Features
42
17
 
43
- - Multi-engine orchestration (Claude, Codex, Gemini, Qwen)
44
- - SSE streaming with realtime tool statusbar
45
- - Interrupt/stop per engine
46
- - Session resume + native session import across engines
18
+ - Multi-engine orchestration for Claude, Codex, Gemini, and Qwen
19
+ - Runtime-aware model catalog with `native` and `custom` lanes
20
+ - SSE streaming with realtime tool and status updates
21
+ - Interrupt and resume support per engine
22
+ - Session import and history sync from native CLI stores
47
23
  - Workspace isolation, switching, and history
48
- - File & image attachments (vision models supported)
49
- - Model selector (think mode + reasoning levels where available)
50
- - Voice input (browser STT, optional Whisper via OpenAI key)
51
- - Conversation search + pin/bookmark
52
- - Built-in jobs runner API for shell tasks
53
- - Config API + rate limiting on chat endpoints
54
-
55
- ## Supported Engines
56
-
57
- | Engine | Models | Provider |
58
- |--------|--------|----------|
59
- | **Claude (native)** | Opus 4.5, Sonnet 4.5, Haiku 4.5 | Anthropic |
60
- | **Claude-compatible** | DeepSeek (deepseek-*), GLM-4.6 | DeepSeek, Z.ai |
61
- | **Codex** | GPT-5.2 Codex, GPT-5.2, GPT-5.1 Codex (Mini/Max), GPT-5.1 | OpenAI |
62
- | **Gemini** | Gemini 3 Pro Preview, Gemini 3 Flash Preview | Google |
63
- | **Qwen** | coder-model, vision-model | Alibaba |
24
+ - File and image attachments where supported
25
+ - Runtime inventory API and UI runtime manager
26
+ - Conversation search, bookmark/pin, and job runner API
27
+ - Voice input support with HTTPS auto-setup
64
28
 
65
29
  ---
66
30
 
67
- ## Install
31
+ ## Current Model Support
68
32
 
69
- ```bash
70
- # From npm
71
- npm install -g @mmmbuto/nexuscli
33
+ | Engine | Lane | Examples |
34
+ |--------|------|----------|
35
+ | Claude | Native | `sonnet`, `opus`, `haiku` |
36
+ | Claude | Custom | `deepseek-*`, `glm-4.7`, `glm-5`, `qwen3.5-plus`, `qwen3-max-2026-01-23`, `kimi-k2.5`, `MiniMax-M2.7` |
37
+ | Codex | Native | `gpt-5.4`, `gpt-5.3-codex`, `gpt-5.2-codex`, `gpt-5.1-codex-max`, `codex-mini-latest` |
38
+ | Codex | Custom | `qwen3-coder-plus`, `qwen3-coder-next`, `qwen3.5-plus`, `glm-5`, `deepseek-ai/DeepSeek-V3.2-TEE` |
39
+ | Gemini | Native | `gemini-3-pro-preview`, `gemini-3-flash-preview`, `gemini-2.5-pro`, `gemini-2.5-flash` |
40
+ | Qwen | Native | `qwen3-coder-plus`, `qwen3-coder-next`, `qwen3.5-plus`, `qwen3-max` |
41
+ | Qwen | Custom | `glm-4.7`, `kimi-k2.5` |
72
42
 
73
- # From GitHub
74
- npm install -g github:DioNanos/nexuscli
75
- ```
43
+ See [docs/RUNTIME_MODEL.md](docs/RUNTIME_MODEL.md) for the runtime model and provider mapping.
44
+
45
+ ---
76
46
 
77
- ### Release Channels
47
+ ## Install
78
48
 
79
49
  ```bash
80
- # Latest (default)
81
50
  npm install -g @mmmbuto/nexuscli
82
-
83
- # Stable channel (pinned)
84
- npm install -g @mmmbuto/nexuscli@stable
85
51
  ```
86
52
 
87
- ## Setup
53
+ Then initialize:
88
54
 
89
55
  ```bash
90
56
  nexuscli init
91
57
  ```
92
58
 
93
- ## Start
59
+ And start the server:
94
60
 
95
61
  ```bash
96
62
  nexuscli start
97
63
  ```
98
64
 
99
- ### Network Access
65
+ ---
100
66
 
101
- | Protocol | Port | URL | Use Case |
102
- |----------|------|-----|----------|
103
- | **HTTP** | 41800 | `http://localhost:41800` | Local access |
104
- | **HTTPS** | 41801 | `https://<ip>:41801` | Remote access, voice input |
67
+ ## Runtime Management
105
68
 
106
- > **Note**: HTTPS is required for microphone access from remote devices (browser security).
107
- > Self-signed certificates are auto-generated on first run.
69
+ NexusCLI separates:
108
70
 
109
- ---
71
+ - `engine`
72
+ - `lane`
73
+ - `runtime`
74
+ - `provider`
75
+ - `model`
110
76
 
111
- ## Commands (CLI)
77
+ Runtime inventory is available through:
112
78
 
113
- | Command | Description |
114
- |---------|-------------|
115
- | `nexuscli init` | Setup wizard (config, certs, data) |
116
- | `nexuscli start` | Start server (HTTP 41800 / HTTPS 41801) |
117
- | `nexuscli stop` | Stop server |
118
- | `nexuscli status` | Status and available engines |
119
- | `nexuscli engines` | Manage engines |
120
- | `nexuscli workspaces` | Manage workspaces |
121
- | `nexuscli model` | Default model |
122
- | `nexuscli api` | Additional API keys (e.g., Whisper) |
123
- | `nexuscli logs` | View server logs |
124
- | `nexuscli users` | Users |
125
- | `nexuscli setup-termux` | Termux helpers (services, paths) |
126
- | `nexuscli uninstall` | Remove NexusCLI |
79
+ - UI runtime manager
80
+ - `GET /api/v1/runtimes`
81
+ - `POST /api/v1/runtimes/check`
82
+ - `POST /api/v1/runtimes/install`
83
+ - `POST /api/v1/runtimes/update`
127
84
 
128
85
  ---
129
86
 
130
87
  ## API Keys
131
88
 
132
- Configure API keys for additional providers:
89
+ Provider keys can be stored locally via:
133
90
 
134
91
  ```bash
135
- nexuscli api list # List configured keys
136
- nexuscli api set deepseek <key> # DeepSeek models
137
- nexuscli api set zai <key> # GLM-4.6 (Z.ai Anthropic-compatible)
138
- nexuscli api set openai <key> # Voice input (Whisper STT)
139
- nexuscli api set openrouter <key> # Future: Multi-provider gateway
140
- nexuscli api delete <provider> # Remove key
92
+ nexuscli api list
93
+ nexuscli api set deepseek <key>
94
+ nexuscli api set zai <key>
95
+ nexuscli api set alibaba <key>
96
+ nexuscli api set chutes <key>
97
+ nexuscli api set minimax <key>
98
+ nexuscli api set openai <key>
141
99
  ```
142
100
 
143
- > **Note**: Claude/Codex/Gemini/Qwen keys are managed by their respective CLIs.
144
- > OpenAI key enables voice input via Whisper. HTTPS auto-generated for remote mic access.
101
+ These keys are used only for custom provider lanes that need compatible API routing.
145
102
 
146
103
  ---
147
104
 
148
- ## Requirements
105
+ ## Commands
149
106
 
150
- - Node.js 18+
151
- - At least one CLI installed:
152
- - Claude Code CLI (`claude`)
153
- - Codex CLI (`codex`)
154
- - Gemini CLI (`gemini`)
155
- - Qwen Code CLI (`qwen`)
107
+ | Command | Description |
108
+ |---------|-------------|
109
+ | `nexuscli init` | Setup wizard |
110
+ | `nexuscli start` | Start server |
111
+ | `nexuscli stop` | Stop server |
112
+ | `nexuscli status` | Show server status |
113
+ | `nexuscli engines` | Inspect/configure runtime-aware engines |
114
+ | `nexuscli model` | Set/get default model |
115
+ | `nexuscli config` | Read/edit configuration |
116
+ | `nexuscli api` | Manage provider API keys |
117
+ | `nexuscli workspaces` | Manage workspaces |
118
+ | `nexuscli logs` | View server logs |
119
+ | `nexuscli setup-termux` | Termux bootstrap helpers |
120
+ | `nexuscli update` | Update NexusCLI |
121
+ | `nexuscli uninstall` | Remove NexusCLI |
156
122
 
157
123
  ---
158
124
 
159
- ## Termux-First Architecture
160
-
161
- NexusCLI is designed primarily for **Termux** on Android devices.
162
-
163
- ### Stack
125
+ ## Network Access
164
126
 
165
- - **Termux** - primary runtime environment
166
- - **tmux** - session management
167
- - **Node.js + SSE** - lightweight backend
168
- - **React** - minimal UI
127
+ | Protocol | Default Port | Use Case |
128
+ |----------|--------------|----------|
129
+ | HTTP | `41800` | Local access |
130
+ | HTTPS | `41801` | Remote access and browser microphone support |
169
131
 
170
- ### Purpose
171
-
172
- This project exists to study:
173
-
174
- - terminal-driven AI orchestration
175
- - ultra-light architectures for constrained devices
176
- - mobile development workflows
177
-
178
- It is a **research and learning tool**.
179
-
180
- ---
181
-
182
- ## API Endpoints
183
-
184
- | Endpoint | Engine | Description |
185
- |----------|--------|-------------|
186
- | `POST /api/v1/chat` | Claude | SSE streaming chat |
187
- | `POST /api/v1/codex` | Codex | SSE streaming chat |
188
- | `POST /api/v1/gemini` | Gemini | SSE streaming chat |
189
- | `POST /api/v1/qwen` | Qwen | SSE streaming chat |
190
- | `POST /api/v1/chat/interrupt` | Claude | Stop running generation |
191
- | `POST /api/v1/codex/interrupt` | Codex | Stop running generation |
192
- | `POST /api/v1/gemini/interrupt` | Gemini | Stop running generation |
193
- | `POST /api/v1/qwen/interrupt` | Qwen | Stop running generation |
194
- | `GET /api/v1/models` | All | List available models |
195
- | `GET /api/v1/config` | - | Get user preferences (default model) |
196
- | `POST /api/v1/sessions/import` | - | Import native sessions (admin) |
197
- | `POST /api/v1/jobs` | - | Run a background job (SSE stream) |
198
- | `GET /api/v1/workspaces` | - | List workspaces from sessions |
199
- | `GET /health` | - | Health check |
132
+ HTTPS certificates are auto-generated on first run.
200
133
 
201
134
  ---
202
135
 
203
136
  ## Development
204
137
 
205
138
  ```bash
206
- # Clone
207
- git clone https://github.com/DioNanos/nexuscli.git
139
+ git clone <upstream-or-fork-url> nexuscli
208
140
  cd nexuscli
209
-
210
- # Install deps
211
141
  npm install
212
142
  cd frontend && npm install && npm run build && cd ..
213
-
214
- # Run dev
215
143
  npm run dev
216
144
  ```
217
145
 
218
146
  ---
219
147
 
148
+ ## Documentation
149
+
150
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
151
+ - [docs/API.md](docs/API.md)
152
+ - [docs/GUIDE.md](docs/GUIDE.md)
153
+ - [docs/RUNTIME_MODEL.md](docs/RUNTIME_MODEL.md)
154
+ - [docs/PTY_ARCHITECTURE.md](docs/PTY_ARCHITECTURE.md)
155
+
156
+ ---
157
+
220
158
  ## License
221
159
 
222
- MIT License.
223
- See `LICENSE` for details.
160
+ MIT License. See [LICENSE](LICENSE).
package/bin/nexuscli.js CHANGED
@@ -22,6 +22,7 @@ const workspacesCommand = require('../lib/cli/workspaces');
22
22
  const usersCommand = require('../lib/cli/users');
23
23
  const uninstallCommand = require('../lib/cli/uninstall');
24
24
  const setupTermuxCommand = require('../lib/cli/setup-termux');
25
+ const updateCommand = require('../lib/cli/update');
25
26
  const { modelCommand } = require('../lib/cli/model');
26
27
 
27
28
  program
@@ -122,6 +123,17 @@ program
122
123
  .description('Prepare for uninstallation (optional data removal)')
123
124
  .action(uninstallCommand);
124
125
 
126
+ // nexuscli update / upgrade
127
+ program
128
+ .command('update')
129
+ .description('Update NexusCLI and restart server')
130
+ .action(updateCommand);
131
+
132
+ program
133
+ .command('upgrade')
134
+ .description('Alias for update')
135
+ .action(updateCommand);
136
+
125
137
  // Parse arguments
126
138
  program.parse();
127
139