@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.1-nightly.20260616.a68b2e1e7
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/bundled/loop/SKILL.md +2 -1
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/common-workflow.md +4 -4
- package/bundled/qc-helper/docs/configuration/auth.md +1 -1
- package/bundled/qc-helper/docs/configuration/model-providers.md +13 -6
- package/bundled/qc-helper/docs/configuration/settings.md +90 -89
- package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
- package/bundled/qc-helper/docs/features/commands.md +33 -11
- package/bundled/qc-helper/docs/features/dual-output.md +37 -3
- package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/skills.md +29 -3
- package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
- package/bundled/qc-helper/docs/qwen-serve.md +250 -31
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
- package/chunks/{agent-QB7TZ4HW.js → agent-PXMT2XR5.js} +25 -24
- package/chunks/agent-headless-SY7VJUHV.js +51 -0
- package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
- package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-NDNFGC35.js} +45 -3
- package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
- package/chunks/{chunk-CNSMKPK6.js → chunk-26QELEL2.js} +1 -1
- package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
- package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
- package/chunks/{chunk-2ZTWI7KH.js → chunk-6WPY6ES3.js} +62 -22
- package/chunks/{chunk-ZK4AMNIU.js → chunk-A3OEZT2F.js} +1294 -314
- package/chunks/{chunk-HXJE7VOG.js → chunk-ABRZC6FA.js} +1074 -144
- package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
- package/chunks/chunk-BJ5HQ23U.js +178 -0
- package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
- package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
- package/chunks/{chunk-QCG6KPNM.js → chunk-H4ZDM3N6.js} +18039 -11622
- package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
- package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
- package/chunks/{chunk-MVIVIPCU.js → chunk-IDYDPBBN.js} +361 -583
- package/chunks/{chunk-JVQOQ3OU.js → chunk-IQHSD7K5.js} +1 -1
- package/chunks/{chunk-CNHFPN7T.js → chunk-JZFEL3RB.js} +1 -1
- package/chunks/{chunk-UAMOBVVW.js → chunk-LXYWINWF.js} +1 -1
- package/chunks/{chunk-P4J26VDS.js → chunk-LYRSMKLS.js} +2 -2
- package/chunks/{chunk-Y7R6H6FT.js → chunk-LYSND7KR.js} +9 -4
- package/chunks/{chunk-AVW55ZCO.js → chunk-M5PJ5QAF.js} +37 -16
- package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
- package/chunks/chunk-OMX7CUOE.js +356 -0
- package/chunks/{chunk-HV3ZZ7G4.js → chunk-OT6JA3KQ.js} +2 -2
- package/chunks/{chunk-C6WMLUNB.js → chunk-QP4R5FTG.js} +1 -1
- package/chunks/chunk-QQDPRDVW.js +25 -0
- package/chunks/chunk-SFRV6BGY.js +243 -0
- package/chunks/{chunk-NW5QBUYO.js → chunk-TSBXGR73.js} +14 -14
- package/chunks/{chunk-7YKXFA3D.js → chunk-UOB6KPGG.js} +11 -11
- package/chunks/{chunk-USE2VQ5P.js → chunk-VU6A2OBJ.js} +41 -6
- package/chunks/{chunk-PAEBHDIO.js → chunk-VXHYMZXW.js} +1 -1
- package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
- package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
- package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
- package/chunks/chunk-ZOFNJQNJ.js +607 -0
- package/chunks/computer-use-7SEQDSHB.js +2052 -0
- package/chunks/contextCommand-KM5OWV65.js +53 -0
- package/chunks/cron-create-7CXEAJ2K.js +184 -0
- package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-2FQYYNQ6.js} +28 -5
- package/chunks/{cron-list-QNNZGMN3.js → cron-list-QCAJ73XE.js} +40 -7
- package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
- package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
- package/chunks/{dist-R2SXPG74.js → dist-2UCAYOX7.js} +2 -2
- package/chunks/{dist-TE5QKMGR.js → dist-33LHH26D.js} +1 -1
- package/chunks/{dist-BXDUQ2QY.js → dist-KF43SZZV.js} +1 -1
- package/chunks/{dist-ZMQ4TXD5.js → dist-PF2IYSMD.js} +2 -2
- package/chunks/{edit-6UBTS2J5.js → edit-BMUKPLA7.js} +27 -28
- package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
- package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-LXJ5WJ5A.js} +25 -24
- package/chunks/enterPlanMode-QWRZ54ZF.js +159 -0
- package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-5HTQPNZO.js} +25 -24
- package/chunks/exitPlanMode-5WQAXNDA.js +743 -0
- package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
- package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-CAKHT5YE.js} +7 -7
- package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
- package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
- package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
- package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
- package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
- package/chunks/{glob-OLCX57MD.js → glob-5DN6NSCD.js} +25 -24
- package/chunks/{grep-7HXIMDOW.js → grep-BJILOLCD.js} +37 -30
- package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
- package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
- package/chunks/{ls-6PEZUK6O.js → ls-XVGXRYWD.js} +4 -4
- package/chunks/{lsp-JZSJOVT7.js → lsp-S6SHPULC.js} +3 -3
- package/chunks/{monitor-SQO7MVAV.js → monitor-SUEMSRN3.js} +25 -24
- package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-6F6Z5P6U.js} +26 -25
- package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-DO27LL6O.js} +15 -15
- package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
- package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-DQLGLQSH.js} +27 -26
- package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
- package/chunks/{read-file-UA64EEQC.js → read-file-3TBLYTOQ.js} +11 -11
- package/chunks/ripGrep-3INYT3QV.js +49 -0
- package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
- package/chunks/{scheduler-VBASHOCA.js → scheduler-23KQW6CX.js} +25 -24
- package/chunks/{send-message-OYJZ5TPG.js → send-message-SMNR5DBG.js} +3 -3
- package/chunks/{serve-A7E2OJDR.js → serve-Y5E4LKUI.js} +13164 -3840
- package/chunks/{shell-3NFOT6F5.js → shell-4H6XQXVY.js} +25 -24
- package/chunks/{skill-RA5YUREY.js → skill-SE6FECZR.js} +64 -113
- package/chunks/{src-NFCMARMT.js → src-76DUBH3A.js} +176 -44
- package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-KMNF7YG6.js} +4 -4
- package/chunks/{task-create-Y3ZKTJIG.js → task-create-LIJHK75G.js} +8 -7
- package/chunks/{task-list-ONXJ3I3A.js → task-list-S4GNSILM.js} +7 -6
- package/chunks/{task-stop-UHDC4N5B.js → task-stop-3GBRYJHM.js} +3 -3
- package/chunks/{task-update-TCNOU3P5.js → task-update-F3UTVJMS.js} +21 -9
- package/chunks/{team-create-6SR4OVRG.js → team-create-Q5DTDDH4.js} +28 -26
- package/chunks/{team-delete-EJ4U4DDP.js → team-delete-54434EB7.js} +9 -6
- package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-4ENGSBUX.js} +5 -5
- package/chunks/{tool-search-OD435A3X.js → tool-search-ABZMSDTU.js} +11 -11
- package/chunks/{web-fetch-6W67H5PO.js → web-fetch-RHZMF3MP.js} +5 -5
- package/chunks/workflow-NEMDQB75.js +1414 -0
- package/chunks/{write-file-475L5OPP.js → write-file-VAEHZPSL.js} +26 -25
- package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
- package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
- package/cli-entry.js +19 -0
- package/cli.js +11155 -6656
- package/examples/starter/QWEN.md +30 -0
- package/examples/starter/README.md +59 -0
- package/examples/starter/agents/diary.md +86 -0
- package/examples/starter/commands/writing/polish.md +13 -0
- package/examples/starter/example.ts +64 -0
- package/examples/starter/package.json +18 -0
- package/examples/starter/qwen-extension.json +12 -0
- package/examples/starter/skills/synonyms/SKILL.md +48 -0
- package/examples/starter/tsconfig.json +13 -0
- package/fzfWorker.js +1083 -0
- package/locales/ca.js +20 -2
- package/locales/de.js +21 -2
- package/locales/en.js +13 -4
- package/locales/fr.js +22 -2
- package/locales/ja.js +22 -2
- package/locales/pt.js +21 -2
- package/locales/ru.js +20 -2
- package/locales/zh-TW.js +11 -4
- package/locales/zh.js +11 -4
- package/package.json +5 -3
- package/chunks/agent-headless-APVHH7QM.js +0 -50
- package/chunks/chunk-AJIR24J2.js +0 -59
- package/chunks/chunk-SKBPNJEW.js +0 -45
- package/chunks/chunk-XBFVXFB2.js +0 -216
- package/chunks/computer-use-B7VIUI7F.js +0 -825
- package/chunks/contextCommand-63RZ3O5R.js +0 -52
- package/chunks/cron-create-FI5LJVUS.js +0 -140
- package/chunks/exitPlanMode-H323NHB2.js +0 -235
- package/chunks/ripGrep-WSYCWZVK.js +0 -48
- package/chunks/workflow-62DHH4EO.js +0 -708
|
@@ -18,14 +18,21 @@ Slash commands are used to manage Qwen Code sessions, interface, and basic behav
|
|
|
18
18
|
|
|
19
19
|
These commands help you save, restore, and summarize work progress.
|
|
20
20
|
|
|
21
|
-
| Command
|
|
22
|
-
|
|
|
23
|
-
| `/init`
|
|
24
|
-
| `/summary`
|
|
25
|
-
| `/compress`
|
|
26
|
-
| `/
|
|
27
|
-
| `/
|
|
28
|
-
| `/
|
|
21
|
+
| Command | Description | Usage Examples |
|
|
22
|
+
| ---------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------- |
|
|
23
|
+
| `/init` | Analyze current directory and create initial context file | `/init` |
|
|
24
|
+
| `/summary` | Generate project summary based on conversation history | `/summary` |
|
|
25
|
+
| `/compress` | Replace chat history with summary to save Tokens | `/compress` |
|
|
26
|
+
| `/compress-fast` | Fast compression without AI — strips old tool outputs and thinking parts | `/compress-fast` |
|
|
27
|
+
| `/resume` | Resume a previous conversation session | `/resume` |
|
|
28
|
+
| `/recap` | Generate a one-line session recap now | `/recap` |
|
|
29
|
+
| `/restore` | Revert project files to the checkpoint before a tool call ran | `/restore` (list) or `/restore <ID>` |
|
|
30
|
+
| `/delete` | Delete a previous session | `/delete` |
|
|
31
|
+
| `/branch` | Fork the current conversation into a new session | `/branch` |
|
|
32
|
+
| `/fork` | Spawn a background agent that inherits the full conversation | `/fork <directive>` |
|
|
33
|
+
| `/rewind` | Rewind conversation to a previous turn | `/rewind` or `/rollback` |
|
|
34
|
+
| `/export` | Export session history to file | `/export html`, `/export md`, `/export json`, `/export jsonl` |
|
|
35
|
+
| `/rename` | Rename or tag the current session | `/rename My Feature` or `/tag` |
|
|
29
36
|
|
|
30
37
|
### 1.2 Interface and Workspace Control
|
|
31
38
|
|
|
@@ -43,6 +50,7 @@ Commands for adjusting interface appearance and work environment.
|
|
|
43
50
|
| `/editor` | Open dialog to select supported editor | `/editor` |
|
|
44
51
|
| `/statusline` | Open interactive [status line](./status-line.md) preset dialog | `/statusline` |
|
|
45
52
|
| `/statusline <text>` | Generate a command-mode [status line](./status-line.md) via agent | `/statusline show model and git branch` |
|
|
53
|
+
| `/terminal-setup` | Configure terminal keybindings for multiline input | `/terminal-setup` |
|
|
46
54
|
|
|
47
55
|
### 1.3 Language Settings
|
|
48
56
|
|
|
@@ -71,6 +79,7 @@ Commands for managing AI tools and models.
|
|
|
71
79
|
| →`plan` | Analysis only, no execution | Secure review |
|
|
72
80
|
| →`default` | Require approval for edits | Daily use |
|
|
73
81
|
| →`auto-edit` | Automatically approve edits | Trusted environment |
|
|
82
|
+
| →`auto` | Classifier-evaluated approval | Autonomous sessions with safety guardrails |
|
|
74
83
|
| →`yolo` | Automatically approve all | Quick prototyping |
|
|
75
84
|
| `/model` | Switch model used in current session | `/model` |
|
|
76
85
|
| `/model --fast` | Set a lighter model for prompt suggestions | `/model --fast qwen3-coder-flash` |
|
|
@@ -79,6 +88,14 @@ Commands for managing AI tools and models.
|
|
|
79
88
|
| `/remember` | Save a durable memory | `/remember Prefer terse responses` |
|
|
80
89
|
| `/forget` | Remove matching entries from auto-memory | `/forget <query>` |
|
|
81
90
|
| `/dream` | Manually run auto-memory consolidation | `/dream` |
|
|
91
|
+
| `/hooks` | Manage Qwen Code hooks | `/hooks`, `/hooks list` |
|
|
92
|
+
| `/permissions` | Manage permission rules | `/permissions` |
|
|
93
|
+
| `/agents` | Manage subagents | `/agents manage`, `/agents create` |
|
|
94
|
+
| `/arena` | Manage Arena sessions | `/arena start`, `/arena status` |
|
|
95
|
+
| `/goal` | Set a goal — keep working until condition met | `/goal <condition>`, `/goal clear` |
|
|
96
|
+
| `/tasks` | List background tasks | `/tasks` |
|
|
97
|
+
| `/lsp` | Show LSP server status | `/lsp` |
|
|
98
|
+
| `/trust` | Manage folder trust settings | `/trust` |
|
|
82
99
|
|
|
83
100
|
### 1.5 Built-in Skills
|
|
84
101
|
|
|
@@ -192,7 +209,7 @@ progress; otherwise it waits for the current turn to finish and then fires).
|
|
|
192
209
|
Unlike the manual command, the auto-trigger is fully silent on failure: if
|
|
193
210
|
generation errors or there is nothing to summarize, no message is added to
|
|
194
211
|
the history. Controlled by the `general.showSessionRecap` setting
|
|
195
|
-
(default: `
|
|
212
|
+
(default: `false`); the manual `/recap` command always works regardless of
|
|
196
213
|
this setting.
|
|
197
214
|
|
|
198
215
|
**Example:**
|
|
@@ -209,8 +226,8 @@ this setting.
|
|
|
209
226
|
>
|
|
210
227
|
> Configure a fast model via `/model --fast <model>` (e.g.
|
|
211
228
|
> `qwen3-coder-flash`) to make `/recap` fast and cheap. Set
|
|
212
|
-
> `general.showSessionRecap` to `
|
|
213
|
-
>
|
|
229
|
+
> `general.showSessionRecap` to `true` to enable the auto-trigger; the
|
|
230
|
+
> manual `/recap` command always works regardless of this setting.
|
|
214
231
|
|
|
215
232
|
### 1.8 Diff Viewer (`/diff`)
|
|
216
233
|
|
|
@@ -278,6 +295,11 @@ Commands for obtaining information and performing system settings.
|
|
|
278
295
|
| `/stats tools` | Show per-tool call counts | `/stats tools` |
|
|
279
296
|
| `/settings` | Open settings editor | `/settings` |
|
|
280
297
|
| `/auth` | Change authentication method | `/auth` |
|
|
298
|
+
| `/doctor` | Run installation and environment diagnostics | `/doctor`, `/doctor memory` |
|
|
299
|
+
| `/docs` | Open full Qwen Code documentation in browser | `/docs` |
|
|
300
|
+
| `/ide` | Manage IDE integration | `/ide status`, `/ide install` |
|
|
301
|
+
| `/insight` | Generate programming insights from chat history | `/insight` |
|
|
302
|
+
| `/setup-github` | Set up GitHub Actions | `/setup-github` |
|
|
281
303
|
| `/bug` | Submit issue about Qwen Code | `/bug Button click unresponsive` |
|
|
282
304
|
| `/copy` | Copy AI output to clipboard (`/copy N` = Nth-last AI message) | `/copy` or `/copy 2` |
|
|
283
305
|
| `/quit` | Exit Qwen Code immediately | `/quit` or `/exit` |
|
|
@@ -199,10 +199,10 @@ wrappers that throw away stdout anyway.
|
|
|
199
199
|
|
|
200
200
|
## Quick start
|
|
201
201
|
|
|
202
|
-
Run Qwen Code with
|
|
202
|
+
Run Qwen Code with both channels enabled using regular files:
|
|
203
203
|
|
|
204
204
|
```bash
|
|
205
|
-
|
|
205
|
+
touch /tmp/qwen-events.jsonl /tmp/qwen-input.jsonl
|
|
206
206
|
qwen \
|
|
207
207
|
--json-file /tmp/qwen-events.jsonl \
|
|
208
208
|
--input-file /tmp/qwen-input.jsonl
|
|
@@ -211,7 +211,7 @@ qwen \
|
|
|
211
211
|
In a second terminal, tail the event stream:
|
|
212
212
|
|
|
213
213
|
```bash
|
|
214
|
-
|
|
214
|
+
tail -f /tmp/qwen-events.jsonl
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
In a third terminal, push a prompt into the running TUI:
|
|
@@ -223,6 +223,33 @@ echo '{"type":"submit","text":"Explain this repo"}' >> /tmp/qwen-input.jsonl
|
|
|
223
223
|
The prompt appears in the TUI exactly as if the user typed it, and the
|
|
224
224
|
streaming response is mirrored on `/tmp/qwen-events.jsonl`.
|
|
225
225
|
|
|
226
|
+
### Using FIFOs (named pipes) for event output
|
|
227
|
+
|
|
228
|
+
FIFOs deliver lower latency than regular files (no disk I/O) and work
|
|
229
|
+
well when both sides are on the same host. The bridge opens FIFOs with
|
|
230
|
+
`O_RDWR | O_NONBLOCK`, so it **does not block** even if no reader is
|
|
231
|
+
connected yet — events are buffered in the kernel pipe buffer until a
|
|
232
|
+
reader attaches.
|
|
233
|
+
|
|
234
|
+
> **Note:** `--input-file` requires a regular file (not a FIFO) because
|
|
235
|
+
> the watcher relies on `stat.size` to detect new data, which is always
|
|
236
|
+
> 0 for FIFOs.
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
mkfifo /tmp/qwen-events.jsonl
|
|
240
|
+
touch /tmp/qwen-input.jsonl
|
|
241
|
+
qwen \
|
|
242
|
+
--json-file /tmp/qwen-events.jsonl \
|
|
243
|
+
--input-file /tmp/qwen-input.jsonl
|
|
244
|
+
# TUI starts immediately — no need to start a reader first.
|
|
245
|
+
|
|
246
|
+
# In a second terminal, connect whenever ready:
|
|
247
|
+
cat /tmp/qwen-events.jsonl
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
If no reader ever connects, the bridge auto-disables once the internal
|
|
251
|
+
buffer exceeds 1 MB. The TUI continues running normally.
|
|
252
|
+
|
|
226
253
|
## Output event schema
|
|
227
254
|
|
|
228
255
|
Events are emitted as JSON Lines (one object per line). The schema is the same
|
|
@@ -325,6 +352,13 @@ polling — events are written synchronously as the TUI emits them.
|
|
|
325
352
|
- **Consumer disconnect.** If the reader on the other side of the channel
|
|
326
353
|
goes away (`EPIPE`), the bridge silently disables itself and the TUI
|
|
327
354
|
keeps running. No retry.
|
|
355
|
+
- **FIFO buffer overflow.** When writing to a FIFO with no reader
|
|
356
|
+
attached, events buffer in the kernel pipe (~64 KB on Linux) and the
|
|
357
|
+
Node.js WriteStream. Once the pipe is full or the internal buffer
|
|
358
|
+
exceeds 1 MB, the bridge disables itself and closes the fd. No
|
|
359
|
+
`session_end` is emitted in this case — consumers should treat a
|
|
360
|
+
closed stream without `session_end` as an abnormal termination. The
|
|
361
|
+
TUI continues running normally.
|
|
328
362
|
- **Adapter exception.** Any exception thrown while emitting an event is
|
|
329
363
|
caught, logged, and disables the bridge. The TUI is never crashed by a
|
|
330
364
|
dual-output failure.
|
|
@@ -32,7 +32,7 @@ Suggestions are generated when all of the following conditions are met:
|
|
|
32
32
|
- There are no errors in the most recent response
|
|
33
33
|
- No confirmation dialogs are pending (e.g., shell confirmation, permissions)
|
|
34
34
|
- The approval mode is not set to `plan`
|
|
35
|
-
- The feature is enabled in settings (
|
|
35
|
+
- The feature is enabled in settings (disabled by default — set `ui.enableFollowupSuggestions` to `true` to turn it on)
|
|
36
36
|
|
|
37
37
|
Suggestions will not appear in non-interactive mode (e.g., headless/SDK mode).
|
|
38
38
|
|
|
@@ -72,7 +72,7 @@ These settings can be configured in `settings.json`:
|
|
|
72
72
|
|
|
73
73
|
| Setting | Type | Default | Description |
|
|
74
74
|
| ------------------------------ | ------- | ------- | ------------------------------------------------------------------ |
|
|
75
|
-
| `ui.enableFollowupSuggestions` | boolean | `
|
|
75
|
+
| `ui.enableFollowupSuggestions` | boolean | `false` | Enable or disable followup suggestions |
|
|
76
76
|
| `ui.enableCacheSharing` | boolean | `true` | Use cache-aware forked queries to reduce cost (experimental) |
|
|
77
77
|
| `ui.enableSpeculation` | boolean | `false` | Speculatively execute suggestions before submission (experimental) |
|
|
78
78
|
| `fastModel` | string | `""` | Model for prompt suggestions and speculative execution |
|
|
@@ -118,9 +118,35 @@ Notes:
|
|
|
118
118
|
|
|
119
119
|
- Globs are matched relative to the project root with [picomatch](https://github.com/micromatch/picomatch); files outside the project root never trigger activation.
|
|
120
120
|
- A path-gated Skill **stays activated for the rest of the session** once a matching file is touched. A new session, or a `refreshCache` triggered by editing any Skill file, resets activations.
|
|
121
|
-
- `paths:` only gates **model** discovery, and only at the SkillTool listing level.
|
|
121
|
+
- `paths:` only gates **model** discovery, and only at the SkillTool listing level. Unless `user-invocable: false` is set, you can always invoke a path-gated Skill yourself via `/<skill-name>` or the `/skills` picker — that user path runs the Skill body regardless of activation state. The model side, however, stays gated until a matching file is touched: a slash invocation does **not** unlock model-side activation, so if you want the model to chain off your invocation (call `Skill { skill: ... }` itself), also access a file matching the skill's `paths:` first.
|
|
122
122
|
- Combining `paths:` with `disable-model-invocation: true` is allowed but the gate has no effect — the Skill is hidden from the model regardless, so path activation never advertises it.
|
|
123
123
|
|
|
124
|
+
### Optional: control user and model invocation
|
|
125
|
+
|
|
126
|
+
Skills are user-invocable by default. To hide a Skill from direct slash-command use while keeping it available for model invocation, set `user-invocable: false`:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
---
|
|
130
|
+
name: model-only-helper
|
|
131
|
+
description: Helper the model can call when appropriate
|
|
132
|
+
user-invocable: false
|
|
133
|
+
---
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This removes the Skill from `/<skill-name>` invocation and `/skills` picker results. It does not hide the Skill from the model.
|
|
137
|
+
|
|
138
|
+
To hide a Skill from model invocation while keeping direct user invocation available, set `disable-model-invocation: true`:
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
---
|
|
142
|
+
name: manual-helper
|
|
143
|
+
description: Helper you invoke manually
|
|
144
|
+
disable-model-invocation: true
|
|
145
|
+
---
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
You can combine both fields, but then the Skill is not reachable through the normal user or model invocation paths.
|
|
149
|
+
|
|
124
150
|
## Add supporting files
|
|
125
151
|
|
|
126
152
|
Create additional files alongside `SKILL.md`:
|
|
@@ -170,9 +196,9 @@ To view available Skills, ask Qwen Code directly:
|
|
|
170
196
|
What Skills are available?
|
|
171
197
|
```
|
|
172
198
|
|
|
173
|
-
> **Heads up — model vs. user view.** Asking the model only surfaces Skills the model can currently see. If a Skill uses `paths:` (see "Optional: gate a Skill on file paths" above), it stays out of that listing until a matching file has been touched. The
|
|
199
|
+
> **Heads up — model vs. user view.** Asking the model only surfaces Skills the model can currently see. If a Skill uses `paths:` (see "Optional: gate a Skill on file paths" above), it stays out of that listing until a matching file has been touched. The `/skills` slash command shows Skills you can invoke directly; Skills with `user-invocable: false` remain visible on disk and may still be visible to the model.
|
|
174
200
|
|
|
175
|
-
Or browse the
|
|
201
|
+
Or browse the user-invocable list with the slash command (including path-gated Skills that have not activated yet):
|
|
176
202
|
|
|
177
203
|
```text
|
|
178
204
|
/skills
|
|
@@ -135,7 +135,7 @@ Subagents are configured using Markdown files with YAML frontmatter. This format
|
|
|
135
135
|
name: agent-name
|
|
136
136
|
description: Brief description of when and how to use this agent
|
|
137
137
|
model: inherit # Optional: inherit, fast, modelId, or authType:modelId
|
|
138
|
-
approvalMode: auto-edit # Optional: default, plan, auto-edit, yolo
|
|
138
|
+
approvalMode: auto-edit # Optional: default, plan, auto-edit, yolo, bubble
|
|
139
139
|
tools: # Optional: allowlist of tools
|
|
140
140
|
- tool1
|
|
141
141
|
- tool2
|
|
@@ -202,6 +202,7 @@ Use the optional `approvalMode` frontmatter field to control how a subagent's to
|
|
|
202
202
|
- `plan`: Analyze-only mode — the agent plans but does not execute changes
|
|
203
203
|
- `auto-edit`: Tools are auto-approved without prompting (recommended for most agents)
|
|
204
204
|
- `yolo`: All tools auto-approved, including potentially destructive ones
|
|
205
|
+
- `bubble`: Background-agent tool approvals are surfaced in the parent session
|
|
205
206
|
|
|
206
207
|
If you omit this field, the subagent's permission mode is determined automatically:
|
|
207
208
|
|
|
@@ -282,13 +283,15 @@ can drop a CC agent file into `.qwen/agents/` and have the supported fields
|
|
|
282
283
|
parse identically. Optional fields with invalid values are silently dropped
|
|
283
284
|
at parse time rather than rejected — the same lenient posture CC uses.
|
|
284
285
|
|
|
285
|
-
| Field | Type | Notes
|
|
286
|
-
| ---------------- | ---------------- |
|
|
287
|
-
| `permissionMode` | enum string | `acceptEdits`, `auto`, `bypassPermissions`, `default`, `dontAsk`, `plan`. Mapped to `approvalMode` at parse time; when both are set, the explicit `approvalMode` wins.
|
|
288
|
-
| `maxTurns` | positive integer | Caps the agent's turn budget. Wired into `runConfig.max_turns` at runtime; when both are set, the top-level field wins.
|
|
289
|
-
| `color` | enum string | Display color. Allowlist: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan` (mirrors CC's `_Y`). The legacy qwen sentinel `auto` is
|
|
286
|
+
| Field | Type | Notes |
|
|
287
|
+
| ---------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
288
|
+
| `permissionMode` | enum string | `acceptEdits`, `auto`, `bypassPermissions`, `default`, `dontAsk`, `plan`. Mapped to `approvalMode` at parse time; when both are set, the explicit `approvalMode` wins. |
|
|
289
|
+
| `maxTurns` | positive integer | Caps the agent's turn budget. Wired into `runConfig.max_turns` at runtime; when both are set, the top-level field wins. The legacy nested value is pruned from the on-disk file on save to avoid two sources of truth. |
|
|
290
|
+
| `color` | enum string | Display color. Allowlist: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan` (mirrors CC's `_Y`). The legacy qwen sentinel `auto` is preserved for backward compatibility. Other values are silently dropped on parse. |
|
|
291
|
+
| `mcpServers` | record of specs | Per-agent MCP server overrides. Merged with the session-level MCP server set when the agent spawns; on key collision the agent's spec wins (matching CC's `scope: 'agent'` semantics). Malformed entries are dropped per-key with a warning rather than failing the whole agent. |
|
|
292
|
+
| `hooks` | record of arrays | Per-agent hooks. Keys are CC hook event names (`PreToolUse`, `PostToolUse`, `UserPromptSubmit`, …); values are arrays of `{ matcher?, hooks: [...] }` definitions in the same shape as `settings.json`'s `hooks` field. Registered while the agent runs, removed when it stops. |
|
|
290
293
|
|
|
291
|
-
Example:
|
|
294
|
+
Example with all of the above:
|
|
292
295
|
|
|
293
296
|
```
|
|
294
297
|
---
|
|
@@ -301,6 +304,17 @@ tools:
|
|
|
301
304
|
- read_file
|
|
302
305
|
- grep_search
|
|
303
306
|
- glob
|
|
307
|
+
mcpServers:
|
|
308
|
+
filesystem:
|
|
309
|
+
type: stdio
|
|
310
|
+
command: node
|
|
311
|
+
args: [/usr/local/lib/mcp-fs/server.js]
|
|
312
|
+
hooks:
|
|
313
|
+
PreToolUse:
|
|
314
|
+
- matcher: Bash
|
|
315
|
+
hooks:
|
|
316
|
+
- type: command
|
|
317
|
+
command: echo "review-agent about to run a shell command"
|
|
304
318
|
---
|
|
305
319
|
|
|
306
320
|
You are a code reviewer. Analyze the code thoroughly and report findings
|
|
@@ -308,11 +322,19 @@ ordered by severity.
|
|
|
308
322
|
```
|
|
309
323
|
|
|
310
324
|
The remaining CC frontmatter fields — `effort`, `skills`, `initialPrompt`,
|
|
311
|
-
`memory`, `isolation
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
325
|
+
`memory`, `isolation` — are documented in the declarative-agent design doc
|
|
326
|
+
and land in follow-up PRs once the prerequisite infrastructure exists
|
|
327
|
+
(`effort` needs a model-layer parameter; `memory` needs a scoped memory
|
|
328
|
+
subsystem; `--agent` CLI flag enables `initialPrompt`; etc.).
|
|
329
|
+
|
|
330
|
+
> **`hooks` v1 limitation.** While a subagent declaring `hooks` is running,
|
|
331
|
+
> its hook entries fire for every matching event in the session, not only
|
|
332
|
+
> for that subagent's own tool calls. If two subagents with different
|
|
333
|
+
> per-agent hook sets run concurrently, both sets fire for both agents.
|
|
334
|
+
> Per-agent scope filtering at hook-firing time is left to a follow-up;
|
|
335
|
+
> for v1, prefer per-agent hooks that are safe to fire globally for the
|
|
336
|
+
> duration of the agent's run (e.g. logging) over hooks that mutate
|
|
337
|
+
> behavior.
|
|
316
338
|
|
|
317
339
|
#### Example Usage
|
|
318
340
|
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Local launch templates for `qwen serve` (v0.16-alpha)
|
|
2
|
+
|
|
3
|
+
Reference templates for running `qwen serve` as a long-lived background process on a developer workstation. Pairs with the [v0.16-alpha known limits](./qwen-serve.md#v016-alpha-known-limits) — local-only, single-user, BYO bearer token. Containerized / multi-host / TLS-fronted deployments defer to v0.16.x.
|
|
4
|
+
|
|
5
|
+
> **Audience**: dogfooding developers who want the daemon up across reboots, with logs going somewhere durable, and a clean `restart-on-failure` story. If you only need the daemon for the duration of a single shell session, plain `qwen serve` (foreground, Ctrl-C to stop) is fine.
|
|
6
|
+
|
|
7
|
+
## Generate a bearer token (once)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
openssl rand -hex 32 > ~/.qwen-serve-token # user-managed, NOT a built-in path
|
|
11
|
+
chmod 600 ~/.qwen-serve-token
|
|
12
|
+
export QWEN_SERVER_TOKEN="$(cat ~/.qwen-serve-token)"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The path / filename is yours to choose; v0.16-alpha does not auto-generate or auto-locate a token file (deferred to v0.16.x). See the [Authentication](./qwen-serve.md#authentication) section of the user guide for the canonical BYO setup.
|
|
16
|
+
|
|
17
|
+
> **Scope this `export` to the current shell session only.** Don't add it to `~/.bashrc` / `~/.zshrc` — a profile-level export exposes the bearer token to every process spawned from that shell (IDE subprocesses, browser debuggers, `npm` scripts from unrelated projects). For long-running setups, use the systemd `EnvironmentFile=` / launchd `EnvironmentVariables` mechanisms below — both scope the token to just the daemon process.
|
|
18
|
+
|
|
19
|
+
The daemon reads the bearer token from either `--token <value>` on the CLI or the `QWEN_SERVER_TOKEN` env var (whitespace stripped from both). The TypeScript SDK's `DaemonClient` constructor falls back to `QWEN_SERVER_TOKEN` when no `token` option is passed (PR 27 fallback — clients with the env var set never need to thread the value through their script).
|
|
20
|
+
|
|
21
|
+
One shell-level `export` covers both server boot and SDK client construction (just keep it scoped to the session, per the note above).
|
|
22
|
+
|
|
23
|
+
## Linux: systemd user unit
|
|
24
|
+
|
|
25
|
+
> **Find your `qwen` binary first.** The unit file's `ExecStart=` must hold an **absolute path** — service managers don't read your shell's `PATH`. Run `which qwen` to discover it. Common locations: `/usr/local/bin/qwen` (Linuxbrew, manual installs), `~/.nvm/versions/node/vX.Y.Z/bin/qwen` (nvm), `~/.fnm/aliases/default/bin/qwen` (fnm), `~/.volta/bin/qwen` (Volta). Substitute the actual path everywhere the templates below show `/PATH/TO/qwen`.
|
|
26
|
+
|
|
27
|
+
`~/.config/systemd/user/qwen-serve.service`:
|
|
28
|
+
|
|
29
|
+
```ini
|
|
30
|
+
[Unit]
|
|
31
|
+
Description=Qwen Code daemon (loopback HTTP + SSE)
|
|
32
|
+
After=network.target
|
|
33
|
+
|
|
34
|
+
[Service]
|
|
35
|
+
Type=simple
|
|
36
|
+
# Replace with your project; %h expands to $HOME under user units.
|
|
37
|
+
WorkingDirectory=%h/your-project
|
|
38
|
+
# Run `which qwen` to find the absolute path. systemd does NOT read $PATH.
|
|
39
|
+
ExecStart=/PATH/TO/qwen serve --hostname 127.0.0.1 --port 4170
|
|
40
|
+
# Read the bearer token from a chmod 600 file rather than inlining it
|
|
41
|
+
# in the unit. `Environment=` would expose the token in the unit file
|
|
42
|
+
# (typically 644 = world-readable). EnvironmentFile keeps the token in
|
|
43
|
+
# the user-owned secret file you already created with `chmod 600`.
|
|
44
|
+
EnvironmentFile=%h/.qwen-serve-token-env
|
|
45
|
+
Restart=on-failure
|
|
46
|
+
RestartSec=5
|
|
47
|
+
StandardOutput=journal
|
|
48
|
+
StandardError=journal
|
|
49
|
+
|
|
50
|
+
[Install]
|
|
51
|
+
WantedBy=default.target
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Build the env file once (the token file from the setup step holds the raw value; this wraps it in `KEY=value` form so systemd reads it as an env assignment):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
echo "QWEN_SERVER_TOKEN=$(cat ~/.qwen-serve-token)" > ~/.qwen-serve-token-env
|
|
58
|
+
chmod 600 ~/.qwen-serve-token-env
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Manage:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
systemctl --user daemon-reload
|
|
65
|
+
systemctl --user enable --now qwen-serve.service
|
|
66
|
+
loginctl enable-linger "$(whoami)" # keep the user manager running after logout / across reboot
|
|
67
|
+
journalctl --user -u qwen-serve -f # tail logs
|
|
68
|
+
systemctl --user restart qwen-serve.service # after token rotation
|
|
69
|
+
systemctl --user disable --now qwen-serve.service
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Without `loginctl enable-linger`, the user-level systemd instance shuts down when the user logs out and only restarts on next login — on a headless dev box the daemon would not survive an SSH session ending. `enable-linger` is what makes "across reboots" actually work.
|
|
73
|
+
|
|
74
|
+
**System-wide alternative** (shared dev hosts, less common): drop the unit at `/etc/systemd/system/qwen-serve@.service` with `User=%i`, manage via `sudo systemctl enable --now qwen-serve@<username>.service`. Same `[Service]` body otherwise — but world-readable `Environment=` exposure is even more problematic at this level, so always use `EnvironmentFile=` pointing at the user's `chmod 600` file. Pick user-level + linger for single-user workstations.
|
|
75
|
+
|
|
76
|
+
## macOS: launchd user agent
|
|
77
|
+
|
|
78
|
+
> **Find your `qwen` binary first.** Same constraint as systemd — `ProgramArguments` must hold an **absolute path**. Run `which qwen` to discover it. Common locations on macOS: `/opt/homebrew/bin/qwen` (Homebrew on Apple Silicon), `/usr/local/bin/qwen` (Homebrew on Intel, manual installs), `~/.nvm/versions/node/vX.Y.Z/bin/qwen` (nvm), `~/.volta/bin/qwen` (Volta). Substitute below where the template shows `/PATH/TO/qwen`.
|
|
79
|
+
|
|
80
|
+
`~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist`:
|
|
81
|
+
|
|
82
|
+
```xml
|
|
83
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
84
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
85
|
+
<plist version="1.0">
|
|
86
|
+
<dict>
|
|
87
|
+
<key>Label</key>
|
|
88
|
+
<string>com.qwenlm.qwen-serve</string>
|
|
89
|
+
<key>ProgramArguments</key>
|
|
90
|
+
<array>
|
|
91
|
+
<!-- Run `which qwen` to find the absolute path; launchd does NOT read $PATH. -->
|
|
92
|
+
<string>/PATH/TO/qwen</string>
|
|
93
|
+
<string>serve</string>
|
|
94
|
+
<string>--hostname</string>
|
|
95
|
+
<string>127.0.0.1</string>
|
|
96
|
+
<string>--port</string>
|
|
97
|
+
<string>4170</string>
|
|
98
|
+
</array>
|
|
99
|
+
<!-- launchd does NOT expand `~` or `$HOME` — use absolute paths. -->
|
|
100
|
+
<key>WorkingDirectory</key>
|
|
101
|
+
<string>/Users/YOUR-USERNAME/your-project</string>
|
|
102
|
+
<key>EnvironmentVariables</key>
|
|
103
|
+
<dict>
|
|
104
|
+
<!-- DO NOT COMMIT this file with a real token. Also chmod 600 the
|
|
105
|
+
plist itself so the inlined token is not world-readable. -->
|
|
106
|
+
<key>QWEN_SERVER_TOKEN</key>
|
|
107
|
+
<string>PASTE-YOUR-TOKEN-HERE</string>
|
|
108
|
+
</dict>
|
|
109
|
+
<key>RunAtLoad</key>
|
|
110
|
+
<true/>
|
|
111
|
+
<!-- Restart only on non-zero exits (matches systemd Restart=on-failure).
|
|
112
|
+
A bare `<true/>` would respawn even after a clean SIGTERM, making
|
|
113
|
+
`kill <pid>` impossible to use as a stop signal — operator would
|
|
114
|
+
have to `launchctl unload`. SuccessfulExit=false fixes that. -->
|
|
115
|
+
<key>KeepAlive</key>
|
|
116
|
+
<dict>
|
|
117
|
+
<key>SuccessfulExit</key>
|
|
118
|
+
<false/>
|
|
119
|
+
</dict>
|
|
120
|
+
<!-- Throttle restart storms on persistent failures (mirrors systemd
|
|
121
|
+
RestartSec=5; launchd's default would respawn every <1s). -->
|
|
122
|
+
<key>ThrottleInterval</key>
|
|
123
|
+
<integer>10</integer>
|
|
124
|
+
<!-- Log into the user's Library, not /tmp. /tmp is world-writable
|
|
125
|
+
(symlink-attack risk on shared workstations) and gets cleaned by
|
|
126
|
+
periodic-daily after 3 days; `~/Library/Logs/qwen-serve/` is
|
|
127
|
+
user-scoped and survives. launchd truncates these on every
|
|
128
|
+
`load`, so the unload→load token-rotation cycle wipes prior
|
|
129
|
+
diagnostic logs — back them up if you need post-incident
|
|
130
|
+
inspection. -->
|
|
131
|
+
<key>StandardOutPath</key>
|
|
132
|
+
<string>/Users/YOUR-USERNAME/Library/Logs/qwen-serve/out.log</string>
|
|
133
|
+
<key>StandardErrorPath</key>
|
|
134
|
+
<string>/Users/YOUR-USERNAME/Library/Logs/qwen-serve/err.log</string>
|
|
135
|
+
</dict>
|
|
136
|
+
</plist>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Manage:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
mkdir -p ~/Library/Logs/qwen-serve # first time only
|
|
143
|
+
chmod 600 ~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist # plist holds the inline token
|
|
144
|
+
launchctl load ~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist
|
|
145
|
+
launchctl unload ~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist # to stop
|
|
146
|
+
tail -f ~/Library/Logs/qwen-serve/out.log ~/Library/Logs/qwen-serve/err.log
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
After editing the plist (e.g., rotating the token) you must `unload` then `load` again — `launchctl` does not auto-reload on plist changes the way `systemd daemon-reload` does. Note: each `load` truncates the log files, so save them off if you're investigating an incident before rotating.
|
|
150
|
+
|
|
151
|
+
## tmux session (interactive supervision)
|
|
152
|
+
|
|
153
|
+
Assumes `QWEN_SERVER_TOKEN` is already exported in your shell (see the setup section above):
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
tmux new -d -s qwen-serve "cd ~/your-project && qwen serve --hostname 127.0.0.1"
|
|
157
|
+
tmux attach -t qwen-serve # see live logs; Ctrl-b d to detach
|
|
158
|
+
tmux kill-session -t qwen-serve
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`tmux new -d` inherits the parent shell's environment, so `QWEN_SERVER_TOKEN` flows through automatically. Best when you want to occasionally watch the daemon's stdout (auth warnings, MCP discovery progress, slow-client warnings) without committing to a service unit. Survives terminal close but not host reboot.
|
|
162
|
+
|
|
163
|
+
## nohup one-liner (quick + dirty)
|
|
164
|
+
|
|
165
|
+
Assumes `QWEN_SERVER_TOKEN` is already exported in your shell:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
nohup bash -c 'cd ~/your-project && qwen serve --hostname 127.0.0.1' > qwen-serve.log 2>&1 &
|
|
169
|
+
echo $! # daemon PID; capture if you want to `kill` cleanly later
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The wrapping `bash -c '...'` ensures the daemon binds to `~/your-project` rather than wherever you happened to run the command. Without that `cd`, `qwen serve` defaults to `process.cwd()` and a `POST /session` from a client expecting your project workspace returns `400 workspace_mismatch` — silent foot-gun.
|
|
173
|
+
|
|
174
|
+
OK for one-off "let me run this in the background while I poke at the API" workflows. **Not recommended** for anything beyond a single session — no restart-on-crash, log file grows unbounded, no clean way to find the daemon if you forget the PID. Prefer tmux for interactive supervision or systemd / launchd for anything you want to outlast a reboot.
|
|
175
|
+
|
|
176
|
+
## Verifying the daemon is up
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
curl http://127.0.0.1:4170/health # → {"status":"ok"}
|
|
180
|
+
curl -H "Authorization: Bearer $QWEN_SERVER_TOKEN" \
|
|
181
|
+
http://127.0.0.1:4170/capabilities | jq .protocolVersions # daemon's feature set
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
When auth is configured (i.e., the daemon was started with `--token` / `QWEN_SERVER_TOKEN` set, OR `--require-auth=true`), every route except `/health` on loopback binds requires `Authorization: Bearer <token>`. If you started the daemon without a token on the loopback default (the `qwen serve` zero-config path), neither call requires a header. The templates above all configure a token, so the `Authorization` header is needed in practice. If `/capabilities` returns `401`, the unit / plist token doesn't match the env-exported token your `curl` is using.
|
|
185
|
+
|
|
186
|
+
## Token rotation
|
|
187
|
+
|
|
188
|
+
1. Generate a new token + write the env file the unit references:
|
|
189
|
+
```bash
|
|
190
|
+
openssl rand -hex 32 > ~/.qwen-serve-token
|
|
191
|
+
chmod 600 ~/.qwen-serve-token
|
|
192
|
+
echo "QWEN_SERVER_TOKEN=$(cat ~/.qwen-serve-token)" > ~/.qwen-serve-token-env
|
|
193
|
+
chmod 600 ~/.qwen-serve-token-env
|
|
194
|
+
```
|
|
195
|
+
(For the launchd / nohup / tmux templates: edit the plist's `<string>` value or re-`export QWEN_SERVER_TOKEN`. Don't forget `chmod 600` on the plist if you regenerate it.)
|
|
196
|
+
2. Restart the daemon:
|
|
197
|
+
- **systemd**: `systemctl --user restart qwen-serve.service`
|
|
198
|
+
- **launchd**: `launchctl unload ~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist && launchctl load ~/Library/LaunchAgents/com.qwenlm.qwen-serve.plist`
|
|
199
|
+
- **tmux / nohup**: `kill <pid>` then re-run with the new token in env
|
|
200
|
+
3. Update any client SDKs / scripts. The TypeScript SDK's `DaemonClient` reads `QWEN_SERVER_TOKEN` automatically (PR 27 fallback) — re-`export` the new value in any client shell and reconstruct the client.
|
|
201
|
+
|
|
202
|
+
## Restart and crash behavior
|
|
203
|
+
|
|
204
|
+
Service-manager restart semantics differ across the templates:
|
|
205
|
+
|
|
206
|
+
- **systemd `Restart=on-failure`** — restart only on non-zero exit / signal. A clean SIGTERM (`systemctl stop`) does **not** trigger a restart loop.
|
|
207
|
+
- **launchd `KeepAlive` with `SuccessfulExit=false`** (the template above) — matches systemd behavior. A bare `<true/>` would have respawned even after a clean exit. `ThrottleInterval=10` rate-limits restart storms on persistent failures, mirroring systemd's `RestartSec=5`.
|
|
208
|
+
- **tmux / nohup** — no automatic restart. A daemon crash leaves you with a dead PID until you re-run.
|
|
209
|
+
|
|
210
|
+
Within a **single daemon process lifetime**, client disconnects recover via SSE `Last-Event-ID` resume per the [Durability model](./qwen-serve.md#durability-model) section of the user guide — the replay ring is in-memory.
|
|
211
|
+
|
|
212
|
+
A daemon **restart** drops all in-memory sessions; clients reconnect and start fresh. Cross-restart durability of session content (prompts, tool calls, conversation history) is **NOT** in v0.16-alpha.
|
|
213
|
+
|
|
214
|
+
## Out of scope (defers to v0.16.x or later)
|
|
215
|
+
|
|
216
|
+
- **Containerized deployment** — Dockerfile, docker-compose, Kubernetes manifests, nginx + TLS reverse proxy, multi-instance token isolation. Defers to v0.16.x once an enterprise pilot is committed; the doc would otherwise rot from no-one-validating.
|
|
217
|
+
- **Cross-host federation / multi-daemon coordination on one host** — `1 daemon = 1 workspace × N sessions` is enforced. Instance-path token keying + stale-token cleanup defer to v0.16.x.
|
|
218
|
+
- **Auto-generated daemon tokens** — alpha is BYO-token. Auto-gen + token-store infrastructure defers to v0.16.x.
|
|
219
|
+
- **Windows native service** (`nssm`, Service Control Manager wrapper) — for now use [WSL2](https://learn.microsoft.com/en-us/windows/wsl/) and follow the systemd section above.
|
|
220
|
+
|
|
221
|
+
See the [v0.16-alpha known limits](./qwen-serve.md#v016-alpha-known-limits) callout in the main user guide for the full deferred-features list, and [#4175](https://github.com/QwenLM/qwen-code/issues/4175) for the v0.16-alpha rollout tracking issue.
|