@xingjisoft/neutrino 0.4.0 → 0.5.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/web/README.md CHANGED
@@ -19,11 +19,13 @@ A small, dependency-free single page app that is served by the Neutrino CLI at
19
19
  access;
20
20
  - switch the interface between English and 简体中文, instantly and persistently;
21
21
  - open the same plan / token card as the terminal's `ⓘ`, clear a conversation,
22
- delete a saved transcript, and review other agents' read-only history;
22
+ delete a saved transcript, and review or migrate other agents' history;
23
23
  - drive the running conversation: pause / resume the current turn and send new
24
24
  messages (they queue while the agent is busy);
25
25
  - pick up a saved conversation in the browser and keep chatting, even when no
26
- terminal is running.
26
+ terminal is running;
27
+ - run the console as a detached background service, so conversations started in
28
+ the browser survive closing the terminal and the CLI process.
27
29
 
28
30
  Nothing needs to be built — these are plain `.html`, `.css` and `.js` files.
29
31
 
@@ -40,6 +42,10 @@ permanently in the terminal's **Settings → Web console**. LAN access can be
40
42
  switched on and off at any time in the browser's **Settings → Web access**
41
43
  without restarting anything.
42
44
 
45
+ To keep the console alive after the terminal exits, turn on **Settings →
46
+ Background residency** in either workspace, or use `neutrino background` — see
47
+ [Background residency](#background-residency).
48
+
43
49
  Or serve only the saved history, without a terminal:
44
50
 
45
51
  ```sh
@@ -50,6 +56,44 @@ npm run web
50
56
 
51
57
  Then open <http://127.0.0.1:8765>.
52
58
 
59
+ ## Background residency
60
+
61
+ Background residency is off by default. It is a property of the process, so the
62
+ regular and Pro workspaces share it; changing it in either page (or in the
63
+ terminal's **Settings → Background residency**) applies immediately, including
64
+ to browser tasks already in progress.
65
+
66
+ With it on, closing the terminal or exiting the CLI does not interrupt browser
67
+ conversations. With it off, the console follows its attached terminals and lets
68
+ current browser tasks finish before it shuts down. The terminal's own
69
+ conversations remain local to the terminal. Terminal and standalone launches
70
+ share one Web console; a standalone launch reports a conflict if its requested
71
+ port, interface or password setting differs from the running console. A ready
72
+ service can be managed without a terminal:
73
+
74
+ ```sh
75
+ neutrino background start # detach the web console
76
+ neutrino background status # show its pid and address
77
+ neutrino background open # open it in the default browser
78
+ neutrino background stop # stop it
79
+ ```
80
+
81
+ On Windows the service adds a notification-area icon using the same orbit badge
82
+ as the regular console's top-left logo. Click it to open the console; its menu
83
+ opens or stops the service. `--no-tray` suppresses it, and `NEUTRINO_NO_TRAY=1`
84
+ does the same for automation. The service records its pid, address and a random
85
+ management token in `~/.neutrino/background.json` (mode `0600`) and appends
86
+ startup/stop diagnostics to `~/.neutrino/background.log`. The token protects
87
+ `/api/background/ping` and `/api/background/stop`; it is never sent to a
88
+ browser.
89
+
90
+ When a console is mounted by the terminal and the setting is off, the first
91
+ browser to open it is offered **建议开启后台常驻,避免误触中断任务** with a
92
+ highlighted **开启** and **取消**. Either answer consumes the invitation for
93
+ that CLI run — a reload does not ask again. **开启** applies immediately to the
94
+ current browser tasks. The invitation is never shown when residency is already
95
+ on or by a bare `neutrino web` server.
96
+
53
97
  ## Using it from another device
54
98
 
55
99
  The server binds to loopback by default. To open it from your phone or another
@@ -72,6 +116,11 @@ in-page switch takes over from there for the running process.
72
116
  The console can read every transcript and drive an agent with shell access, so
73
117
  keep the Web password on: anyone who can reach the port can use it.
74
118
 
119
+ On a narrow screen the console shows one pane at a time: the conversation list,
120
+ and then the open conversation. The back arrow in the header and the browser's
121
+ own Back button both return to the list, and Forward reopens the conversation
122
+ that was open.
123
+
75
124
  Startup prints the addresses to open:
76
125
 
77
126
  ```
@@ -179,29 +228,29 @@ login/logout routes are shared and stay unprefixed.
179
228
 
180
229
  ## Models and settings
181
230
 
182
- Open a conversation to see the **Provider**, **Model** and **Thinking**
183
- selectors. Choose a configured model and press **Apply to conversation**. The
184
- next turn uses that selection, and it is saved with the transcript. The same
185
- controls also update a conversation running in the terminal. Pause an active
186
- turn before applying a change; a running turn returns a clear conflict message.
231
+ Open the model card at the lower right of the composer to choose a **Provider**
232
+ and **Model**, and adjust **Thinking intensity** with the slider. Changes to an
233
+ idle or paused conversation apply immediately to its next turn and are saved
234
+ with the transcript. The same controls update a conversation running in the
235
+ terminal. Pause an active turn before changing its model.
187
236
 
188
- For saved history, **Continue with model** resumes the transcript with the chosen
189
- selection. Changing the selectors and then using **Continue here** or sending a
190
- message also uses the draft selection, so a transcript whose old model was
191
- removed can still be continued.
237
+ For saved history or a new workspace conversation, the card keeps the selection
238
+ as a draft. **Continue here** or sending a message starts the conversation with
239
+ that selection, so a transcript whose old model was removed can still continue.
192
240
 
193
241
  The **Settings** (gear) button in the sidebar opens the interface language,
194
242
  plan-first turns, the default approval mode, defaults for new conversations, the
195
243
  context compression threshold, the approval reviewer model, sound alerts, the
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.
244
+ extreme-risk automatic approval option, background residency, LAN access, and
245
+ the Web password. Save settings explicitly; cancelling leaves the saved values
246
+ intact. Conversation model changes are separate from these defaults. Models come
247
+ from the same catalog as the terminal, and API keys stay on the server. Configure
248
+ missing keys in the terminal model screen first. Intensity uses the same
249
+ Low–Ultra sampling settings as the terminal, and both only offer the levels the
250
+ selected model declares in `model.json`. The regular and [Pro](#pro-workspace)
251
+ workspaces keep their own copy of every setting here except the approval policy,
252
+ the Web password, LAN access and background residency, which belong to the whole
253
+ process.
205
254
 
206
255
  ## New conversations and working directories
207
256
 
@@ -232,6 +281,21 @@ regular and Pro workspaces remember their own choice. The terminal UI stays in
232
281
  English. New conversation content, of course, remains in the language the model
233
282
  writes.
234
283
 
284
+ ## Sidebar status marks
285
+
286
+ Every row in the sidebar carries one mark. A **blue dot** means the conversation
287
+ finished and has not been opened since, a **turning ring** means a turn is
288
+ running, and an **amber dot** means a tool call is waiting for your answer. The
289
+ amber mark only appears while the conversation really asks for approval — with
290
+ automatic review the reviewers answer for you, so the row keeps showing the
291
+ running ring.
292
+
293
+ The blue dot asks once: opening the row answers it, and the next turn that
294
+ finishes asks again. The console remembers those answers in a file of its own,
295
+ `~/.neutrino/web.json` (the regular and Pro workspaces each keep their own
296
+ record), so the terminal UI never carries data it does not read, and a reload, a
297
+ restart of the console or a change of port does not bring every dot back.
298
+
235
299
  ## History vs. live sessions
236
300
 
237
301
  A saved transcript on disk is a finished record: nothing is running, so the
@@ -272,6 +336,14 @@ the complete transcript in the conversation pane with a `read-only` badge. The
272
336
  sources are the same as the terminal's history browser; OpenCode requires Node.js
273
337
  22.13+ because it reads its SQLite database through `node:sqlite`.
274
338
 
339
+ Click **Migrate session** at the bottom right of an opened transcript to convert
340
+ its readable user/assistant text into a new, saved Neutrino conversation. The
341
+ copy opens immediately in the same working directory, using the current
342
+ Neutrino model (or the current Pro preset on `/pro`). The source is unchanged.
343
+ Foreign system prompts, tool records and non-text attachments are not imported.
344
+ The button is disabled while copying; a failed migration leaves the source open
345
+ with an error so you can retry.
346
+
275
347
  ## Plan-first turns
276
348
 
277
349
  A browser-owned turn is planned before it runs, exactly like a turn in the
@@ -328,13 +400,17 @@ to know whether a conversation is driven by the terminal or by the server.
328
400
  | GET | `/api/fs?path=…` | Folder listing for the picker (folders only, roots, parent) |
329
401
  | POST | `/api/fs/mkdir` | Create `{ "path": "…" }` and return the new path |
330
402
  | POST | `/api/conversations` | Start `{ cwd, selection?, approval_mode? }`, returns `{ key, snapshot }` |
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` |
403
+ | GET | `/api/settings` | Model catalog (each model lists its supported intensities), languages, public settings, the live bind address (`web_host`, `web_urls`) and the background state (`background`, `background_running`, `background_url`, one-time `background_prompt`); no credentials |
404
+ | POST | `/api/settings` | Save validated `{ selection?, settings? }`, including `language`, `plan_first`, `approval_mode`, `web_lan`, `background` and `web_password` |
405
+ | POST | `/api/background/dismiss` | Consume the one-time background-residency invitation for this console run |
406
+ | GET | `/api/background/ping` | Management probe of a detached service; requires `Authorization: Bearer <background.json token>` |
407
+ | POST | `/api/background/stop` | Ask a detached service to shut down; same bearer token |
333
408
  | GET | `/api/session/:id` | One saved transcript |
334
409
  | POST | `/api/session/:id/continue` | Resume a transcript with optional `{ selection }`, returns `{ key }` |
335
410
  | POST | `/api/session/:id/delete` | Delete a saved, non-running transcript |
336
411
  | GET | `/api/agents/:agent/sessions?cwd=…` | Read-only sessions from Claude Code / Codex / OpenCode |
337
412
  | GET | `/api/agents/:agent/sessions/:id` | Read-only messages of one other-agent session |
413
+ | POST | `/api/agents/:agent/sessions/:id/migrate` | Copy a source in `cwd` into a saved native conversation and return its live key; accepts optional `selection` or Pro `pro_preset` |
338
414
  | GET | `/api/live/:key` | Snapshot of a live session |
339
415
  | GET | `/api/live/:key/stream` | SSE stream of a live session |
340
416
  | POST | `/api/live/:key/pause` | Pause the running turn |
@@ -351,7 +427,10 @@ to know whether a conversation is driven by the terminal or by the server.
351
427
 
352
428
  Conversation and settings routes require the login cookie; see
353
429
  [Authentication](#authentication). `OPTIONS` is answered unauthenticated so
354
- preflights are not blocked, and it returns no data.
430
+ preflights are not blocked, and it returns no data. The `/api/background/*`
431
+ management routes are the exception: they exist only in a detached service and
432
+ authenticate with the bearer token from `background.json`, because the CLI and
433
+ the tray icon have no browser cookie.
355
434
 
356
435
  ### Approval requests
357
436