@xingjisoft/neutrino 0.3.0 → 0.4.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 (42) hide show
  1. package/README.md +312 -464
  2. package/assets/pro/backend_output_model.txt +5 -0
  3. package/assets/pro/claude-module-prompt.txt +65 -0
  4. package/assets/pro/common.txt +9 -0
  5. package/assets/pro/confirm_model.txt +5 -0
  6. package/assets/pro/front_output_model.txt +9 -0
  7. package/assets/pro/genimage_model.txt +1 -0
  8. package/assets/pro/main_model.txt +5 -0
  9. package/assets/pro/model-template.json +376 -0
  10. package/assets/pro/modeling_model.txt +5 -0
  11. package/assets/pro/plan_model.txt +8 -0
  12. package/assets/pro/thinking_model.txt +3 -0
  13. package/dist/app.js +43 -7
  14. package/dist/bin.js +5 -2
  15. package/dist/browser.js +57 -0
  16. package/dist/config.js +170 -26
  17. package/dist/index.js +1 -1
  18. package/dist/llm/approval.js +6 -2
  19. package/dist/llm/client.js +197 -28
  20. package/dist/llm/subagent.js +37 -1
  21. package/dist/pro/agents.js +104 -0
  22. package/dist/pro/config.js +88 -0
  23. package/dist/pro/preflight.js +172 -0
  24. package/dist/screens/chat.js +14 -8
  25. package/dist/screens/modelSelect.js +15 -4
  26. package/dist/screens/settings.js +9 -7
  27. package/dist/screens/start.js +48 -15
  28. package/dist/ui.js +58 -0
  29. package/dist/web/hub.js +22 -4
  30. package/dist/web/server.js +279 -66
  31. package/dist/web/session.js +258 -22
  32. package/dist/web/settings.js +91 -24
  33. package/package.json +37 -37
  34. package/web/README.md +87 -13
  35. package/web/app.js +304 -14
  36. package/web/i18n.js +382 -345
  37. package/web/index.html +90 -14
  38. package/web/neutrino-pro.gif +0 -0
  39. package/web/neutrino.png +0 -0
  40. package/web/pro.js +184 -0
  41. package/web/settings.js +322 -247
  42. package/web/style.css +297 -0
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "name": "@xingjisoft/neutrino",
3
- "version": "0.3.0",
4
- "description": "XINGJI Neutrino - a CLI coding agent in the terminal.",
5
- "type": "module",
6
- "license": "Apache-2.0",
7
- "bin": {
8
- "neutrino": "dist/bin.js"
9
- },
10
- "main": "dist/app.js",
11
- "files": [
12
- "dist",
13
- "assets",
14
- "web"
15
- ],
16
- "engines": {
17
- "node": ">=18.0.0"
18
- },
19
- "scripts": {
20
- "build": "tsc -p tsconfig.json",
21
- "test": "npm run build && node scripts/test-paste.mjs && node scripts/test-mouse.mjs && node scripts/test-cursor.mjs && node scripts/test-selection.mjs && node scripts/test-drag-scroll.mjs && node scripts/test-selection-performance.mjs && node scripts/test-copy.mjs && node scripts/test-scrollbar.mjs && node scripts/test-render.mjs && node scripts/test-drift.mjs && node scripts/test-sanitize.mjs && node scripts/test-markdown.mjs && node scripts/test-wrap.mjs && node scripts/test-fetch.mjs && node scripts/test-compact.mjs && node scripts/test-history-fold.mjs && node scripts/test-web-history.mjs && node scripts/test-web-default.mjs && node scripts/test-turn-fold.mjs && node scripts/test-plan.mjs && node scripts/test-subagent.mjs && node scripts/test-web-settings.mjs && node scripts/test-web-markdown.mjs && node scripts/test-web-i18n.mjs && node scripts/test-web-workspaces.mjs && node scripts/test-tools.mjs && node scripts/test-approval.mjs && node scripts/test-approval-review.mjs && node scripts/test-approval-ui.mjs && node scripts/test-web-approval-details.mjs && node scripts/test-approval-mode.mjs && node scripts/test-approval-context.mjs && node scripts/test-settings-render.mjs && node scripts/test-approval-flow.mjs && node scripts/test-web.mjs && node scripts/test-web-settings-http.mjs && node scripts/test-web-auth.mjs && node scripts/test-web-auth-ui.mjs && node scripts/test-interrupt.mjs && node scripts/test-terminal-lifecycle.mjs && node scripts/test-persistence.mjs && node scripts/test-resilience.mjs && node scripts/test-approval-timeout.mjs && node scripts/test-approval-hardening.mjs && node scripts/test-approval-extreme.mjs && node scripts/test-approval-reason.mjs",
22
- "prepare": "npm run build",
23
- "web": "node dist/bin.js web"
24
- },
25
- "keywords": [
26
- "cli",
27
- "agent",
28
- "ai",
29
- "terminal",
30
- "llm",
31
- "coding"
32
- ],
33
- "devDependencies": {
34
- "@types/node": "^22.0.0",
35
- "typescript": "^5.5.0"
36
- }
37
- }
1
+ {
2
+ "name": "@xingjisoft/neutrino",
3
+ "version": "0.4.0",
4
+ "description": "XINGJI Neutrino - a CLI coding agent in the terminal.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "bin": {
8
+ "neutrino": "dist/bin.js"
9
+ },
10
+ "main": "dist/app.js",
11
+ "files": [
12
+ "dist",
13
+ "assets",
14
+ "web"
15
+ ],
16
+ "engines": {
17
+ "node": ">=18.0.0"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "test": "npm run build && node scripts/test-paste.mjs && node scripts/test-mouse.mjs && node scripts/test-cursor.mjs && node scripts/test-selection.mjs && node scripts/test-drag-scroll.mjs && node scripts/test-selection-performance.mjs && node scripts/test-copy.mjs && node scripts/test-scrollbar.mjs && node scripts/test-render.mjs && node scripts/test-drift.mjs && node scripts/test-sanitize.mjs && node scripts/test-markdown.mjs && node scripts/test-wrap.mjs && node scripts/test-fetch.mjs && node scripts/test-compact.mjs && node scripts/test-history-fold.mjs && node scripts/test-web-history.mjs && node scripts/test-web-default.mjs && node scripts/test-turn-fold.mjs && node scripts/test-plan.mjs && node scripts/test-subagent.mjs && node scripts/test-web-settings.mjs && node scripts/test-model-intensity.mjs && node scripts/test-web-markdown.mjs && node scripts/test-web-i18n.mjs && node scripts/test-web-workspaces.mjs && node scripts/test-tools.mjs && node scripts/test-approval.mjs && node scripts/test-approval-review.mjs && node scripts/test-approval-ui.mjs && node scripts/test-web-approval-details.mjs && node scripts/test-approval-mode.mjs && node scripts/test-approval-context.mjs && node scripts/test-settings-render.mjs && node scripts/test-approval-flow.mjs && node scripts/test-web.mjs && node scripts/test-web-settings-http.mjs && node scripts/test-web-lan.mjs && node scripts/test-web-auth.mjs && node scripts/test-web-auth-ui.mjs && node scripts/test-web-pro.mjs && node scripts/test-pro-preflight.mjs && node scripts/test-pro-runtime.mjs && node scripts/test-pro-team.mjs && node scripts/test-pro-ui.mjs && node scripts/test-interrupt.mjs && node scripts/test-terminal-lifecycle.mjs && node scripts/test-persistence.mjs && node scripts/test-resilience.mjs && node scripts/test-approval-timeout.mjs && node scripts/test-approval-hardening.mjs && node scripts/test-approval-extreme.mjs && node scripts/test-approval-reason.mjs",
22
+ "prepare": "npm run build",
23
+ "web": "node dist/bin.js web"
24
+ },
25
+ "keywords": [
26
+ "cli",
27
+ "agent",
28
+ "ai",
29
+ "terminal",
30
+ "llm",
31
+ "coding"
32
+ ],
33
+ "devDependencies": {
34
+ "@types/node": "^22.0.0",
35
+ "typescript": "^5.5.0"
36
+ }
37
+ }
package/web/README.md CHANGED
@@ -15,7 +15,8 @@ A small, dependency-free single page app that is served by the Neutrino CLI at
15
15
  - switch the workspace between every known folder and **All directories**;
16
16
  - switch the provider, model and intensity for the next turn;
17
17
  - edit every terminal setting — defaults, interface language, plan-first turns,
18
- default approval mode, context compression, reviewer and Web password;
18
+ default approval mode, context compression, reviewer, Web password, and LAN
19
+ access;
19
20
  - switch the interface between English and 简体中文, instantly and persistently;
20
21
  - open the same plan / token card as the terminal's `ⓘ`, clear a conversation,
21
22
  delete a saved transcript, and review other agents' read-only history;
@@ -35,7 +36,9 @@ neutrino
35
36
  ```
36
37
 
37
38
  Use `--port` to move it, `--no-web` to skip it for that run, or turn it off
38
- permanently in the terminal's **Settings → Web console**.
39
+ permanently in the terminal's **Settings → Web console**. LAN access can be
40
+ switched on and off at any time in the browser's **Settings → Web access**
41
+ without restarting anything.
39
42
 
40
43
  Or serve only the saved history, without a terminal:
41
44
 
@@ -58,6 +61,17 @@ neutrino --host 100.64.0.7 # TUI + web UI, one specific addres
58
61
  neutrino web --port 8765 --lan # headless web UI, every interface
59
62
  ```
60
63
 
64
+ You can also switch this at runtime from the browser: **Settings → Web access →
65
+ Allow access from other devices (LAN, 0.0.0.0)**. The server re-binds the same
66
+ port to `0.0.0.0` immediately — no restart, and the tab you are using keeps its
67
+ open connections — and saves the choice in `config.json`, so the next launch
68
+ starts on the LAN too. Turning the switch off returns the console to
69
+ `127.0.0.1`. An explicit `--host`/`--lan` decides the interface at startup; the
70
+ in-page switch takes over from there for the running process.
71
+
72
+ The console can read every transcript and drive an agent with shell access, so
73
+ keep the Web password on: anyone who can reach the port can use it.
74
+
61
75
  Startup prints the addresses to open:
62
76
 
63
77
  ```
@@ -108,6 +122,61 @@ headers, token URLs, `--token` and `NEUTRINO_WEB_TOKEN` are no longer used.
108
122
  Static files and the login/logout routes stay public. `--no-auth` explicitly
109
123
  disables password login.
110
124
 
125
+ ## Pro workspace
126
+
127
+ The composer has a preset card at its bottom-right. Open it and drag the slider
128
+ to select a team. There are eight roles: main, reasoning, frontend, backend,
129
+ approval, planning, modeling and reserved image generation. Presets are copied
130
+ unchanged from the supplied example into `~/.neutrino/pro/model.json` on first
131
+ use. Edit role assignments there; **Settings** controls the default preset and
132
+ maximum delegation depth (10 by default).
133
+
134
+ Every task checks all active models with a small completion request. Unavailable
135
+ roles recurse down to lower presets independently, and a popup shows the
136
+ replacements. These changes are task-local. The planner then writes the plan
137
+ before main execution; nested specialist calls and commands use the same
138
+ approval gate, with the approval role providing automated reviews.
139
+
140
+ Pro API additions: settings return `pro.presets`, `pro.preset` and
141
+ `pro.max_recursion_depth`; settings patches accept `pro_preset` and
142
+ `pro_max_recursion_depth`. New and resumed conversations accept `pro_preset`.
143
+ `POST /pro/api/live/:key/pro-preset` with `{"preset":"medium"}` changes an idle
144
+ or paused conversation. Snapshots include `pro.checking`, effective `pro.models`,
145
+ `pro.fallbacks`, `pro.checkId` and any `pro.error`.
146
+
147
+ The console has two workspaces. The regular one lives at `/`; the isolated **Pro** workspace lives at `/pro`. Both use the same page, the
148
+ same login cookie and the same model catalog, but nothing else is shared:
149
+
150
+ - **Conversations** — Pro transcripts are saved under
151
+ `~/.neutrino/pro/session/`, so neither sidebar ever lists the other
152
+ workspace's history. Live sessions are separated too: a Pro tab cannot read,
153
+ stream, drive or close a regular session, and vice versa.
154
+ - **Settings** — Pro has its own `~/.neutrino/pro/config.json` with its own
155
+ language, sound alerts, default preset, delegation depth and recent folders.
156
+ `~/.neutrino/pro/model.json` records role models, effort and context capacities;
157
+ provider credentials stay in the shared ordinary model catalog.
158
+ - **Shared on purpose** — the Web password, the approval policy (default
159
+ approval mode, extreme-risk auto-approval) and the console's LAN access. They
160
+ protect or configure the whole machine, so both workspaces, the terminal and
161
+ every browser read and write the same values.
162
+
163
+ In the regular console, click the orbit badge to the left of the **Neutrino**
164
+ title (or the blue hint pointing at it). A `#151515` curtain fades in and plays
165
+ the `neutrino-pro.gif` wordmark in the centre; after three seconds it fades out
166
+ onto `/pro`. The X on the blue hint dismisses it permanently for this browser.
167
+ In the terminal, the **启用Pro模式** box below the status bar starts the Web
168
+ console if necessary and opens `/pro` in the default browser. Pro mode uses the
169
+ static `web/neutrino.png` wordmark as its top-left logo, renames the sidebar
170
+ brand to **Neutrino Pro**, and puts an **Exit Pro mode / 返回普通模式** button
171
+ at the top-right of the workspace, which returns to the regular console at
172
+ `/`. The rest of the workspace is identical to the regular one. The interface
173
+ is available in English and 简体中文 in both workspaces (each remembers its own
174
+ choice).
175
+
176
+ Every API route below has an isolated twin under `/pro/api/` — for example,
177
+ `/pro/api/overview`, `/pro/api/settings` and `/pro/api/live/:key/stream`. The
178
+ login/logout routes are shared and stay unprefixed.
179
+
111
180
  ## Models and settings
112
181
 
113
182
  Open a conversation to see the **Provider**, **Model** and **Thinking**
@@ -124,12 +193,15 @@ removed can still be continued.
124
193
  The **Settings** (gear) button in the sidebar opens the interface language,
125
194
  plan-first turns, the default approval mode, defaults for new conversations, the
126
195
  context compression threshold, the approval reviewer model, sound alerts, the
127
- extreme-risk automatic approval option, and the Web password. Save settings
128
- explicitly; cancelling leaves the saved values intact. Conversation model changes
129
- are separate from these defaults. Models come from the same catalog as the
130
- terminal, and API keys stay on the server. Configure missing keys in the terminal
131
- model screen first. Intensity uses the same Low–Ultra sampling settings as the
132
- terminal.
196
+ extreme-risk automatic approval option, LAN access, and the Web password. Save
197
+ settings explicitly; cancelling leaves the saved values intact. Conversation
198
+ model changes are separate from these defaults. Models come from the same
199
+ catalog as the terminal, and API keys stay on the server. Configure missing keys
200
+ in the terminal model screen first. Intensity uses the same Low–Ultra sampling
201
+ settings as the terminal, and both only offer the levels the selected model
202
+ declares in `model.json`. The regular and [Pro](#pro-workspace) workspaces keep
203
+ their own copy of every setting here except the approval policy, the Web password
204
+ and LAN access, which belong to the whole process.
133
205
 
134
206
  ## New conversations and working directories
135
207
 
@@ -154,9 +226,11 @@ that has no conversations yet is still listed after a restart.
154
226
 
155
227
  The sidebar footer and **Settings → Interface** both offer English and 简体中文.
156
228
  The change is applied to the already-open page (labels, messages, status line,
157
- plan card and dialogs) without a reload, is stored in `config.json`, and is
158
- shared by every browser. The terminal UI stays in English. New conversation
159
- content, of course, remains in the language the model writes.
229
+ plan card and dialogs) without a reload, is stored in the workspace's
230
+ `config.json`, and is shared by every browser showing that workspace. The
231
+ regular and Pro workspaces remember their own choice. The terminal UI stays in
232
+ English. New conversation content, of course, remains in the language the model
233
+ writes.
160
234
 
161
235
  ## History vs. live sessions
162
236
 
@@ -254,8 +328,8 @@ to know whether a conversation is driven by the terminal or by the server.
254
328
  | GET | `/api/fs?path=…` | Folder listing for the picker (folders only, roots, parent) |
255
329
  | POST | `/api/fs/mkdir` | Create `{ "path": "…" }` and return the new path |
256
330
  | POST | `/api/conversations` | Start `{ cwd, selection?, approval_mode? }`, returns `{ key, snapshot }` |
257
- | GET | `/api/settings` | Model catalog, languages and public settings; no credentials |
258
- | POST | `/api/settings` | Save validated `{ selection?, settings? }`, including `language`, `plan_first`, `approval_mode` and `web_password` |
331
+ | GET | `/api/settings` | Model catalog (each model lists its supported intensities), languages, public settings, and the live bind address (`web_host`, `web_urls`); no credentials |
332
+ | POST | `/api/settings` | Save validated `{ selection?, settings? }`, including `language`, `plan_first`, `approval_mode`, `web_lan` and `web_password` |
259
333
  | GET | `/api/session/:id` | One saved transcript |
260
334
  | POST | `/api/session/:id/continue` | Resume a transcript with optional `{ selection }`, returns `{ key }` |
261
335
  | POST | `/api/session/:id/delete` | Delete a saved, non-running transcript |