@mmmbuto/nexuscli 0.9.7004-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 (57) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +89 -158
  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/cli-loader.js +1 -1
  39. package/lib/server/services/codex-wrapper.js +79 -10
  40. package/lib/server/services/gemini-wrapper.js +9 -4
  41. package/lib/server/services/job-runner.js +156 -0
  42. package/lib/server/services/qwen-wrapper.js +26 -11
  43. package/lib/server/services/runtime-manager.js +467 -0
  44. package/lib/server/services/session-importer.js +6 -1
  45. package/lib/server/services/session-manager.js +56 -14
  46. package/lib/server/services/workspace-manager.js +121 -0
  47. package/lib/server/tests/integration.test.js +12 -0
  48. package/lib/server/tests/runtime-manager.test.js +46 -0
  49. package/lib/server/tests/runtime-persistence.test.js +97 -0
  50. package/lib/setup/postinstall-pty-check.js +183 -0
  51. package/lib/setup/postinstall.js +60 -41
  52. package/lib/utils/restart-warning.js +18 -0
  53. package/lib/utils/server.js +88 -0
  54. package/lib/utils/termux.js +1 -1
  55. package/lib/utils/update-check.js +153 -0
  56. package/lib/utils/update-runner.js +62 -0
  57. 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,229 +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 to orchestrate Claude Code, Codex CLI, Gemini CLI, and Qwen Code CLI from a single web/terminal UI. It supports live interrupts, native session resume, and voice input with HTTPS auto-setup for remote devices.
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 Vision Fix**: `vision-model` now correctly selected for image prompts
33
- - **Statusbar Realtime**: Qwen tool events streamed live in the UI
34
- - **Light Theme**: Improved contrast + proper statusbar color on mobile
35
-
36
- ### v0.9.6
37
-
38
- - **Jobs Runner Restored**: `jobs` route works again after cleanup regression
39
- - **Termux-Safe Execution**: no hardcoded `/bin` or `/usr/bin` paths for job tools
40
- - **Cleaner Errors**: job SSE errors now display correctly in UI
41
-
42
- ### v0.9.5
16
+ ## Features
43
17
 
44
- - **GPT-5.2 Codex**: Added latest frontier agentic coding model as default
45
- - Updated Codex model catalog to match latest OpenAI CLI
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
23
+ - Workspace isolation, switching, and history
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
46
28
 
47
- ### v0.9.4
29
+ ---
48
30
 
49
- - **Dark/Light Theme**: Toggle between themes via UserMenu (persisted in localStorage)
50
- - **Rate Limiting**: Chat endpoints now protected (10 req/min per user)
51
- - **Architecture Docs**: New `docs/ARCHITECTURE.md` with system diagrams
52
- - CSS refactored to use CSS variables for theming support
31
+ ## Current Model Support
53
32
 
54
- ## Features
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` |
55
42
 
56
- - Multi-engine support (Claude, Codex, Gemini, Qwen)
57
- - Session continuity with explicit workspace selection
58
- - SSE streaming responses
59
- - Model selector with think-mode toggle and default model preference
60
- - Workspace management and conversation history
61
- - Config API endpoint for user preferences
62
- - Stop/Interrupt button across engines
63
- - Dark/Light theme toggle with localStorage persistence
64
- - Rate limiting on chat endpoints (10 req/min per user)
65
-
66
- ## Supported Engines
67
-
68
- | Engine | Models | Provider |
69
- |--------|--------|----------|
70
- | **Claude (native)** | Opus 4.5, Sonnet 4.5, Haiku 4.5 | Anthropic |
71
- | **Claude-compatible** | DeepSeek (deepseek-*), GLM-4.6 | DeepSeek, Z.ai |
72
- | **Codex** | GPT-5.2 Codex, GPT-5.2, GPT-5.1 Codex (Mini/Max), GPT-5.1 | OpenAI |
73
- | **Gemini** | Gemini 3 Pro Preview, Gemini 3 Flash Preview | Google |
74
- | **Qwen** | coder-model, vision-model | Alibaba |
43
+ See [docs/RUNTIME_MODEL.md](docs/RUNTIME_MODEL.md) for the runtime model and provider mapping.
75
44
 
76
45
  ---
77
46
 
78
47
  ## Install
79
48
 
80
49
  ```bash
81
- # From npm
82
50
  npm install -g @mmmbuto/nexuscli
83
-
84
- # From GitHub
85
- npm install -g github:DioNanos/nexuscli
86
51
  ```
87
52
 
88
- ### Release Channels
89
-
90
- ```bash
91
- # Stable channel (pinned)
92
- npm install -g @mmmbuto/nexuscli@stable
93
-
94
- # Testing channel
95
- npm install -g @mmmbuto/nexuscli@testing
96
- ```
97
-
98
- ## Setup
53
+ Then initialize:
99
54
 
100
55
  ```bash
101
56
  nexuscli init
102
57
  ```
103
58
 
104
- ## Start
59
+ And start the server:
105
60
 
106
61
  ```bash
107
62
  nexuscli start
108
63
  ```
109
64
 
110
- ### Network Access
65
+ ---
111
66
 
112
- | Protocol | Port | URL | Use Case |
113
- |----------|------|-----|----------|
114
- | **HTTP** | 41800 | `http://localhost:41800` | Local access |
115
- | **HTTPS** | 41801 | `https://<ip>:41801` | Remote access, voice input |
67
+ ## Runtime Management
116
68
 
117
- > **Note**: HTTPS is required for microphone access from remote devices (browser security).
118
- > Self-signed certificates are auto-generated on first run.
69
+ NexusCLI separates:
119
70
 
120
- ---
71
+ - `engine`
72
+ - `lane`
73
+ - `runtime`
74
+ - `provider`
75
+ - `model`
121
76
 
122
- ## Commands (CLI)
77
+ Runtime inventory is available through:
123
78
 
124
- | Command | Description |
125
- |---------|-------------|
126
- | `nexuscli init` | Setup wizard (config, certs, data) |
127
- | `nexuscli start` | Start server (HTTP 41800 / HTTPS 41801) |
128
- | `nexuscli stop` | Stop server |
129
- | `nexuscli status` | Status and available engines |
130
- | `nexuscli engines` | Manage engines |
131
- | `nexuscli workspaces` | Manage workspaces |
132
- | `nexuscli model` | Default model |
133
- | `nexuscli api` | Additional API keys (e.g., Whisper) |
134
- | `nexuscli users` | Users |
135
- | `POST /api/v1/sessions/import` | Import native sessions (admin) |
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`
136
84
 
137
85
  ---
138
86
 
139
87
  ## API Keys
140
88
 
141
- Configure API keys for additional providers:
89
+ Provider keys can be stored locally via:
142
90
 
143
91
  ```bash
144
- nexuscli api list # List configured keys
145
- nexuscli api set deepseek <key> # DeepSeek models
146
- nexuscli api set zai <key> # GLM-4.6 (Z.ai Anthropic-compatible)
147
- nexuscli api set openai <key> # Voice input (Whisper STT)
148
- nexuscli api set openrouter <key> # Future: Multi-provider gateway
149
- 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>
150
99
  ```
151
100
 
152
- > **Note**: Claude/Codex/Gemini/Qwen keys are managed by their respective CLIs.
153
- > 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.
154
102
 
155
103
  ---
156
104
 
157
- ## Requirements
105
+ ## Commands
158
106
 
159
- - Node.js 18+
160
- - At least one CLI installed:
161
- - Claude Code CLI (`claude`)
162
- - Codex CLI (`codex`)
163
- - Gemini CLI (`gemini`)
164
- - 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 |
165
122
 
166
123
  ---
167
124
 
168
- ## Termux-First Architecture
169
-
170
- NexusCLI is designed primarily for **Termux** on Android devices.
171
-
172
- ### Stack
173
-
174
- - **Termux** - primary runtime environment
175
- - **tmux** - session management
176
- - **Node.js + SSE** - lightweight backend
177
- - **React** - minimal UI
125
+ ## Network Access
178
126
 
179
- ### Purpose
127
+ | Protocol | Default Port | Use Case |
128
+ |----------|--------------|----------|
129
+ | HTTP | `41800` | Local access |
130
+ | HTTPS | `41801` | Remote access and browser microphone support |
180
131
 
181
- This project exists to study:
182
-
183
- - terminal-driven AI orchestration
184
- - ultra-light architectures for constrained devices
185
- - mobile development workflows
186
-
187
- It is a **research and learning tool**.
188
-
189
- ---
190
-
191
- ## API Endpoints
192
-
193
- | Endpoint | Engine | Description |
194
- |----------|--------|-------------|
195
- | `POST /api/v1/chat` | Claude | SSE streaming chat |
196
- | `POST /api/v1/codex` | Codex | SSE streaming chat |
197
- | `POST /api/v1/gemini` | Gemini | SSE streaming chat |
198
- | `POST /api/v1/qwen` | Qwen | SSE streaming chat |
199
- | `POST /api/v1/chat/interrupt` | Claude | Stop running generation |
200
- | `POST /api/v1/codex/interrupt` | Codex | Stop running generation |
201
- | `POST /api/v1/gemini/interrupt` | Gemini | Stop running generation |
202
- | `POST /api/v1/qwen/interrupt` | Qwen | Stop running generation |
203
- | `GET /api/v1/models` | All | List available models |
204
- | `GET /api/v1/config` | - | Get user preferences (default model) |
205
- | `GET /health` | - | Health check |
132
+ HTTPS certificates are auto-generated on first run.
206
133
 
207
134
  ---
208
135
 
209
136
  ## Development
210
137
 
211
138
  ```bash
212
- # Clone
213
- git clone https://github.com/DioNanos/nexuscli.git
139
+ git clone <upstream-or-fork-url> nexuscli
214
140
  cd nexuscli
215
-
216
- # Install deps
217
141
  npm install
218
142
  cd frontend && npm install && npm run build && cd ..
219
-
220
- # Run dev
221
143
  npm run dev
222
144
  ```
223
145
 
224
146
  ---
225
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
+
226
158
  ## License
227
159
 
228
- MIT License.
229
- 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