dsh-hello 0.1.7 → 0.1.9

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/connect.md ADDED
@@ -0,0 +1,521 @@
1
+ # DSH Hello connection troubleshooting
2
+
3
+ You are the dsh agent reading this because a phone cannot connect to DSH Hello.
4
+ Diagnose before changing anything. The goal is a phone that can open
5
+ `http(s)://<host>:<port>/dsh-hello/health` and then pair in the app.
6
+
7
+ UI labels and quoted messages below are examples. Both dsh and the app are
8
+ localized, so match them by meaning in the user's language, not by the literal
9
+ Chinese or English text.
10
+
11
+ **Start here:** parse the prompt URL → check `/dsh-hello/health` on the Host →
12
+ check it from the phone browser → fix the first failing layer. Do not start with
13
+ pairing or config changes.
14
+
15
+ ## 0. Ground rules
16
+
17
+ - Exhaust read-only detection before changing anything. Ask before installing a tool, editing a config file, changing a firewall, or restarting dsh.
18
+ - Prefer the smallest change and the software already on the machine. Do not install a second tunnel when an existing one can work.
19
+ - Before editing a config file, back it up and tell the user how to restore it if dsh no longer starts.
20
+ - Change one thing at a time and re-test. If it does not help, roll it back before trying the next.
21
+ - Never disable TLS or expose plain HTTP to the public internet just to make a first connection work.
22
+ - The desktop renderer URL `dsh-app://app/...` is internal. Never give it to the phone.
23
+ - If the user only needs the computer (no phone), stop: no connection change is required.
24
+
25
+ **Most personal setups are plain HTTP on a LAN.** If the phone is on the same
26
+ Wi-Fi, start with 4A. The plugin's advanced options (`allowedHosts`,
27
+ `strictHostCheck`, `requireSecure`, rate limits) are config-only with safe
28
+ defaults; ignore them unless the error explicitly points there.
29
+
30
+ ### Personal LAN recipe (recommended)
31
+
32
+ 1. Computer: start `dsh web` with the LAN address, e.g. `dsh web --host 192.168.1.20`.
33
+ 2. Phone browser: open `http://192.168.1.20:<port>/dsh-hello/health`; expect `200`.
34
+ 3. Phone app: add `http://192.168.1.20:<port>` and pair.
35
+ 4. No TLS, no proxy, no `allowedHosts` change is needed.
36
+
37
+ If this fails, check the bind address, firewall, and Wi-Fi AP isolation first.
38
+
39
+ ### Least-change policy
40
+
41
+ Prefer, in order:
42
+
43
+ 1. **Use what already works** — existing LAN IP, existing VPN/tunnel, existing proxy. Change nothing.
44
+ 2. **Change the dsh start command only** — `--host`, `--port`. No new software.
45
+ 3. **Reuse software already installed or running** — Tailscale, EasyTier, ZeroTier, frp, nginx, Caddy, cloudflared, ngrok.
46
+ 4. **Change one existing config entry** — for example the desktop `webserver.port`, with a backup.
47
+ 5. **Install one new tool only when 1–4 are impossible.** Ask first, and prefer the smallest, most reversible option.
48
+
49
+ For every change, record: detected facts, why the cheaper step cannot work, the exact change, and the rollback. One change per round.
50
+
51
+ ### Environment decides the path
52
+
53
+ | Detected environment | Start with |
54
+ |---|---|
55
+ | Web profile, phone on the same LAN | 4A: use the existing LAN bind, or restart with `--host <LAN IP>` if loopback-only |
56
+ | Web profile, phone remote, Tailscale/EasyTier/ZeroTier already running | use the existing virtual IP or serve mode |
57
+ | Web profile, phone remote, frpc/cloudflared/nginx already running | reuse the existing tunnel; fix path/SSE/Host |
58
+ | Web profile, public host with nginx/Caddy | add one location block; keep `/dsh-hello` |
59
+ | Desktop app, phone on the same LAN | desktop Host is loopback-only: a local tunnel is still required |
60
+ | Desktop app, Tailscale already installed | `tailscale serve` on the fixed port |
61
+ | Desktop app, no tunnel installed | ask before installing; Tailscale is usually the smallest option |
62
+ | WSL / Docker / VM | use the host or bridged address; do not hand the phone a guest-only IP |
63
+ | No sessions needed, PC only | stop; no change |
64
+
65
+ Ask only for decisions and phone-side facts: permission to edit/restart/install, whether the phone must leave the LAN, the phone network, and the exact error. Never ask for facts listed in section 1.
66
+
67
+ ## 1. Detect locally first
68
+
69
+ Do not ask the user for facts you can obtain yourself. In particular, **never ask
70
+ "desktop app or `dsh web`?", "what port?", "what is your LAN IP?", or "what does
71
+ the browser address bar show?"** — inspect the host and the prompt, then report
72
+ what you found.
73
+
74
+ ### 1.0 The prompt URL is evidence
75
+
76
+ Parse the `{url}` in the prompt the user sent you:
77
+
78
+ | Prompt URL shape | Meaning |
79
+ |---|---|
80
+ | `dsh-app://app/...` | Desktop renderer; older builds exposed this. The phone cannot use it. |
81
+ | `http://127.0.0.1...` / `http://localhost...` | Loopback. This is the desktop host or a loopback-only web launch; the phone cannot use it. |
82
+ | `http://192.168.x.x...`, `10.x.x.x`, `172.16-31.x.x` | Private LAN address. The phone must be on the same LAN or VPN. |
83
+ | `https://domain...` / `http://public-ip...` | Reverse proxy, tunnel, or public exposure. Check DNS, TLS, and the proxy. |
84
+
85
+ The port and `/dsh-hello` base path are also in that URL. Use them for the local
86
+ health check. Do not ask the user which case applies; the prompt already shows it.
87
+ Current builds rewrite the desktop case to the desktop host's real loopback
88
+ origin, so `127.0.0.1` in the prompt means "the host is on the same computer",
89
+ not "the phone should use 127.0.0.1".
90
+
91
+ ### 1.1 Launch mode
92
+
93
+ - Desktop app: the host runs under Electron's Node mode, so
94
+ `ELECTRON_RUN_AS_NODE=1` is set, and the process tree contains
95
+ `dsh-desktop-host`.
96
+ - `dsh web`: the process tree contains `@deepseek-ai/dsh/lib/bin.js web` (or the
97
+ `dsh web` launcher), and `ELECTRON_RUN_AS_NODE` is absent.
98
+
99
+ Inspect the ancestor process and its command line:
100
+
101
+ ```sh
102
+ # Windows
103
+ Get-CimInstance Win32_Process | Where-Object {
104
+ $_.CommandLine -match 'dsh-desktop-host|dsh[\\/]lib[\\/]bin\.js'
105
+ } | Select-Object ProcessId, CommandLine
106
+
107
+ # Linux / macOS
108
+ ps -eo pid,args | grep -E 'dsh-desktop-host|dsh/lib/bin.js'
109
+ ```
110
+
111
+ The environment marker is inherited by plugin children, so this also works:
112
+
113
+ ```sh
114
+ # Windows
115
+ $env:ELECTRON_RUN_AS_NODE
116
+ # Linux / macOS
117
+ printenv ELECTRON_RUN_AS_NODE
118
+ ```
119
+
120
+ ### 1.2 Bind address and port
121
+
122
+ Read the active profile's `cordis.patch.yml`:
123
+
124
+ - Web: `~/.dsh/profiles/web/cordis.patch.yml`
125
+ - Desktop: `~/.dsh/profiles/desktop/cordis.patch.yml`
126
+
127
+ Look for `id: webserver` and its `host` / `port`. If the port is `0` or absent
128
+ (the desktop default is a random port), find the dsh host process from 1.1 and
129
+ list its TCP listeners:
130
+
131
+ ```sh
132
+ # Windows; use the host PID found above
133
+ Get-NetTCPConnection -OwningProcess <host-pid> -State Listen
134
+
135
+ # Linux / macOS
136
+ ss -ltnp | grep <host-pid>
137
+ ```
138
+
139
+ Then confirm the plugin from the computer:
140
+
141
+ ```sh
142
+ curl -i http://127.0.0.1:<port>/dsh-hello/health
143
+ ```
144
+
145
+ The response's `origin`, `host`, and `port` confirm what the Host is serving.
146
+
147
+ ### 1.3 Network interfaces and topology
148
+
149
+ Enumerate non-internal IPv4 addresses; do not ask the user for their IP:
150
+
151
+ ```sh
152
+ node -e "const os=require('os'); for (const [name,list] of Object.entries(os.networkInterfaces())) for (const a of list||[]) if (a.family==='IPv4' && !a.internal) console.log(name, a.address)"
153
+ ```
154
+
155
+ Pick the address on the same network as the phone. Ignore Docker, WSL, VM-only,
156
+ and VPN interfaces unless the phone is on that network. If the Host runs inside
157
+ WSL, Docker, or a VM, the guest IP is not necessarily the LAN IP; find the
158
+ host-side or bridged address instead.
159
+
160
+ ### 1.4 Firewall and listener scope
161
+
162
+ The listener address from 1.2 already tells you whether the port is loopback-only
163
+ or bound to the LAN address. Then check the local firewall:
164
+
165
+ ```sh
166
+ # Windows
167
+ Get-NetFirewallProfile | Select-Object Name, Enabled
168
+
169
+ # Linux
170
+ ufw status verbose 2>/dev/null
171
+ firewall-cmd --list-all 2>/dev/null
172
+ nft list ruleset 2>/dev/null | head -80
173
+
174
+ # macOS
175
+ /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
176
+ ```
177
+
178
+ A cloud security group is not visible from the host; check it only when the Host
179
+ is a cloud VM and the local checks pass.
180
+
181
+ ### 1.5 Proxy, tunnel, and exposure
182
+
183
+ Detect what is running on this computer:
184
+
185
+ ```sh
186
+ tailscale status
187
+ tailscale serve status
188
+ # Windows
189
+ Get-Process | Where-Object { $_.ProcessName -match 'nginx|caddy|cloudflared|ngrok|frpc' }
190
+ Get-NetTCPConnection -State Listen | Where-Object LocalPort -in 80,443
191
+ # Linux / macOS
192
+ ps -eo pid,args | grep -E 'nginx|caddy|cloudflared|ngrok|frpc'
193
+ ss -ltnp | grep -E ':(80|443)\b'
194
+ ```
195
+
196
+ Also check `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`, and reverse-proxy config
197
+ files reachable from the host. If no local proxy or tunnel exists, the one
198
+ thing you cannot see is router/NAT port forwarding — ask about that only if the
199
+ phone is outside the LAN.
200
+
201
+ ### 1.6 Plugin health, logs, and settings
202
+
203
+ ```sh
204
+ curl -s http://127.0.0.1:<port>/dsh-hello/health
205
+ ```
206
+
207
+ Use the response:
208
+
209
+ - `dshCompatible: false` — version mismatch; not a network problem.
210
+ - `pairingOpen: false` — pairing is locked; new phones are refused.
211
+ - `pairingFixed` — a permanent code is in force.
212
+ - `deviceCount` — whether any device has ever paired.
213
+ - `origin`, `host`, `port` — what the Host is actually serving.
214
+
215
+ Read the profile's plugin entry only when a status points there: `basePath`
216
+ (404), `allowedHosts`/`strictHostCheck` (403), `requireSecure` (426). Do not
217
+ change these for a plain LAN setup.
218
+
219
+ If a device is paired, its recorded `authorities`, `platform`, and `appVersion`
220
+ are in the Settings page / admin data; do not ask for them again.
221
+
222
+ In the dsh startup log, `[dsh-hello]` lines confirm: route mount, listening
223
+ origin, pairing code, version check, and request failures. A `404` means the
224
+ path/basePath is wrong; `503 connect-doc-unavailable` means the installed package
225
+ is missing `connect.md`.
226
+
227
+ ### 1.7 Versions
228
+
229
+ - dsh: `dsh --version`, or `dshVersion` from `/dsh-hello/health`.
230
+ - Plugin: `version` from `/dsh-hello/health` or its `package.json`.
231
+ - App: the paired-device table may show `appVersion`; otherwise ask only if it
232
+ matters for the failure.
233
+
234
+ ## 2. Report first, ask only what cannot be detected
235
+
236
+ Before asking anything, state the detected facts, for example:
237
+
238
+ > You are running the desktop app on port 3080, LAN address 192.168.1.20, and no
239
+ > local proxy or tunnel is running. Is your phone on the same Wi-Fi?
240
+
241
+ Prefer **one focused question** (or the six symptom choices in 2.1) over a long
242
+ questionnaire, and never ask again for something section 1 can detect. Ask only
243
+ the remaining unknowns:
244
+
245
+ 1. **Where is the phone?** Same Wi-Fi/LAN, mobile data, another network, VPN?
246
+ The Host cannot see the phone's network.
247
+ 2. **What exactly fails on the phone?** DNS error, timeout, certificate
248
+ warning, 401/403/426/429, or "connected but no sessions".
249
+ 3. **Anything configured outside this computer?** Router port forwarding,
250
+ external tunnel, DNS, or a firewall rule not visible from the host.
251
+ 4. **Phone OS / app version**, only when it is not in the paired-device table.
252
+
253
+ ### 2.1 Phone symptom map (app-dsh)
254
+
255
+ The app's six symptom choices correspond to these real states. **The app is
256
+ localized by the user's app/OS language.** Strings in parentheses are Chinese
257
+ (`zh`) examples for recognition — match the state and meaning, not the literal
258
+ text.
259
+
260
+ | User reports | What app-dsh actually does | First check |
261
+ |---|---|---|
262
+ | Spinner / connection timeout | States: onboarding discovery timeout after 12 s; live-event handshake timeout after 10 s; ordinary API timeout after 20 s. zh examples: `连接超时`, `服务器没有响应(连接超时)`, `连不上服务器:检查手机网络和服务器地址后重试`. | Server running, port, firewall, VPN, wrong host |
263
+ | Cannot connect / DNS error | Onboarding's `/manifest.webmanifest` fetch failed → a "connect failed" message with detail (`Network request failed`, native DNS text). A reachable non-dsh server → a "not a dsh service" message. A loopback address is rejected with its own message. zh examples: `无法连接服务器:<detail>`, `这里没有 dsh 服务(manifest ...)`. | URL, DNS, port; test `/manifest.webmanifest`; never use `127.0.0.1` |
264
+ | Certificate / HTTPS warning | TLS fails before HTTP. The app has no dedicated certificate screen and may collapse native SSL errors into a "connect failed" or "cannot read plugin state" message. zh examples: `无法连接服务器`, `无法读取插件状态`. | Trusted certificate, matching hostname, no self-signed cert; or Tailscale / LAN |
265
+ | Connected but no sessions (blank) | Drawer states: not connected, empty list, no archived sessions, no sessions with tag X, no search matches, archive state unsupported. zh examples: `DSH 暂不可达…`, `还没有会话…`, `没有已归档的会话`, `没有带「x」标签的会话`, `没有匹配的会话`, `当前服务器插件还没有返回归档状态`. Older app builds did not render `sessionsError`, so a failed `/dsh-hello/sessions` also looked like `还没有会话`; current builds show the error. | Call `/dsh-hello/sessions` with the device token; clear workspace/tag/archive filters; check plugin version and feature flags |
266
+ | Pairing code error / new devices refused | Host codes `pair-invalid`, `pair-expired`, `pair-locked`, `pair-rate-limited`. Current builds localize all four; older builds localized only the locked case and might show the Host's English message. Health 404 → "plugin missing". zh examples: `这台主机已暂停新设备配对…`, `找到了 DSH,但没有检测到 dsh-hello 插件`. | Code age (5 min), lock, attempt limit (429), plugin installed, code belongs to this Host |
267
+ | 401 / 403 / 426 / 429 | After pairing, app maps `unauthenticated` → token revoked, `host-refused` → Host/allowedHosts, `tls-required` → HTTPS, `rate-limited` → slow down. During onboarding the same status often appears as a health-check HTTP failure or a "not a dsh service" manifest message. zh examples: `插件健康检查失败(HTTP xxx)`, `这里没有 dsh 服务(manifest 返回 xxx)`. | Status-code list in section 5; 403 also check proxy Host header |
268
+ | Phone offline | The phone's own network is offline; the app has not reached the Host at all. zh example: `本机没有网络`. | Phone Wi-Fi/mobile data, VPN, airplane mode |
269
+ | Web UI opens but the app cannot connect | The browser may accept a certificate or proxy path that the app does not. | Compare the exact phone-browser URL with the app's server address |
270
+
271
+ If the phone opens `127.0.0.1` or `localhost`, stop: that address means "this
272
+ phone", not the computer. This is the most common mistake.
273
+
274
+ ## 3. Define success before fixing
275
+
276
+ On the computer:
277
+
278
+ ```sh
279
+ curl -i http://127.0.0.1:<port>/dsh-hello/health
280
+ ```
281
+
282
+ Expect `200` with `"ok": true` and `"dshCompatible": true`.
283
+ If the plugin uses another `basePath`, replace `/dsh-hello`.
284
+
285
+ Then ask the user to open this in the **phone browser**:
286
+
287
+ ```text
288
+ http://<computer LAN IP>:<port>/dsh-hello/health
289
+ ```
290
+
291
+ - Phone gets `200`: networking is fine; debug the app, pairing, token, or version (section 5).
292
+ - Phone times out: bind address, firewall, LAN isolation, VPN, or the URL is wrong.
293
+ - Any other status or a certificate warning: see section 5.
294
+
295
+ Only after the phone browser sees `200` should you debug pairing.
296
+
297
+ ## 4. Choose the deployment path
298
+
299
+ ### A. Web profile, same LAN, no proxy
300
+
301
+ 1. Check how dsh is bound:
302
+
303
+ ```sh
304
+ dsh web --help
305
+ ```
306
+
307
+ `--host` takes one concrete local IPv4/IPv6 address; wildcard addresses are rejected.
308
+ If dsh already listens on a reachable LAN address, do not change the command; fix the URL or firewall instead.
309
+ 2. If dsh is only on loopback, ask the user to restart it with the computer's LAN address:
310
+
311
+ ```sh
312
+ dsh web --host 192.168.1.20 --port 3080
313
+ ```
314
+
315
+ Replace the address with the computer's actual LAN IPv4. Ask before restarting.
316
+ 3. Check the computer firewall and, on a cloud host, the security group, for the chosen port.
317
+ 4. Check that the phone is on the same network and that guest Wi-Fi/AP isolation is off.
318
+ 5. Phone URL: `http://<LAN IP>:<port>/dsh-hello/health`; then add the same address in the app.
319
+
320
+ Do not use `0.0.0.0` as `--host`; dsh rejects wildcard bind addresses.
321
+
322
+ ### B. Web profile behind a reverse proxy or tunnel
323
+
324
+ 1. Forward the `/dsh-hello/` path unchanged. Do not strip the prefix.
325
+ 2. Preserve the original `Host` header. If the proxy rewrites it, expect `403 host-refused`.
326
+ 3. Disable response buffering for SSE and raise read timeouts. Minimal nginx shape:
327
+
328
+ ```nginx
329
+ location /dsh-hello/ {
330
+ proxy_pass http://127.0.0.1:3080;
331
+ proxy_http_version 1.1;
332
+ proxy_set_header Host $host;
333
+ proxy_buffering off;
334
+ proxy_read_timeout 3600s;
335
+ }
336
+ ```
337
+
338
+ 4. Use a trusted TLS certificate. For a self-signed certificate, the app may refuse the connection.
339
+ 5. If dsh must advertise a public URL, restart it with `--public-url https://example.com/` and, when the browser-trust fence rejects the authority, add `--trusted-host example.com` (repeatable).
340
+ 6. If the plugin rejects the authority (`403 host-refused`), **re-pair through that domain first** — it records the authority without a config change. Add the domain to the existing `dsh-hello` entry's `allowedHosts` only when an old token must keep working. Defaults: empty list, `strictHostCheck` off.
341
+
342
+ Tailscale example (do not install it without consent):
343
+
344
+ ```sh
345
+ tailscale serve --bg 3080
346
+ tailscale serve status
347
+ ```
348
+
349
+ Use the HTTPS URL Tailscale prints, not a made-up `:3080` URL. The Tailscale daemon runs on the same computer, so it can reach `127.0.0.1:3080`.
350
+
351
+ ### C. Desktop app
352
+
353
+ The desktop Host is designed to bind loopback only. The renderer loads from
354
+ `dsh-app://app/`, which is not a network address. A phone can never use it.
355
+
356
+ 1. **Fix the port only if it is random.** If the profile already has a
357
+ `webserver` entry with a non-zero port, skip this step and change nothing.
358
+ Otherwise open **Settings → 打开配置文件 (Open config file)** and edit the
359
+ profile's `cordis.patch.yml`. Back it up first. Add or merge this entry; do not
360
+ create a duplicate `webserver` entry if one already exists:
361
+
362
+ ```yaml
363
+ - id: webserver
364
+ name: "@deepseek-ai/dsh-host-webserver"
365
+ config:
366
+ host: 127.0.0.1
367
+ port: 3080
368
+ tls: null
369
+ compression: gzip
370
+ compressionLevel: 1
371
+ compressionThresholdBytes: 1024
372
+ ```
373
+
374
+ Use another free port if 3080 is taken. Ask before restarting the app.
375
+ If the app no longer starts, restore the backup and restart.
376
+
377
+ 2. **Expose that loopback port to the phone only if the phone needs it.** The
378
+ desktop Host must keep listening on `127.0.0.1`; a proxy on another machine
379
+ cannot reach it. If the user only uses the desktop locally, stop here. Otherwise
380
+ reuse a tunnel already installed; only install one with consent:
381
+
382
+ ```sh
383
+ tailscale serve --bg 3080
384
+ tailscale serve status
385
+ ```
386
+
387
+ Then use the HTTPS URL Tailscale prints. Cloudflare Tunnel, ngrok, or a
388
+ local nginx with TLS are equivalent options.
389
+
390
+ 3. Verify the tunnel from the phone:
391
+
392
+ ```text
393
+ https://<tunnel-host>/dsh-hello/health
394
+ ```
395
+
396
+ 4. The Settings QR is generated from the request origin. In the desktop app
397
+ that origin is the loopback address, so the QR may encode
398
+ `http://127.0.0.1:3080/dsh-hello`, which the phone cannot use. Add the
399
+ tunnel URL manually in the app instead of scanning the QR.
400
+
401
+ ### D. Web profile, phone outside the LAN
402
+
403
+ A private LAN address will not work from mobile data or another network.
404
+ Use a tunnel with HTTPS, or port-forward with TLS. Do not expose plain HTTP;
405
+ the device token and pairing code would travel in clear text.
406
+
407
+ ### E. Mesh VPNs and reverse tunnels
408
+
409
+ The plugin has no provider-specific integration. Any tool that gives the phone
410
+ an HTTP(S) origin to this Host works. Two common families:
411
+
412
+ | Family | Examples | What the user does |
413
+ |---|---|---|
414
+ | Mesh VPN / virtual LAN | Tailscale, EasyTier, ZeroTier | Join the phone to the same virtual network; use `http://<virtual-ip>:<port>` |
415
+ | Reverse tunnel / reverse proxy | frp, Cloudflare Tunnel, nginx, Caddy | Expose `127.0.0.1:<port>`; phone uses the tunnel URL |
416
+ | Router port forward + DDNS | — | Forward the port; use HTTP only on a trusted network, HTTPS for public |
417
+
418
+ Other mesh VPNs and transparent HTTP/TCP tunnels work the same way.
419
+
420
+ Compatibility requirements, whatever the tool:
421
+
422
+ - Forward `/dsh-hello/*` unchanged; do not strip the prefix.
423
+ - Pass `text/event-stream` without buffering or compression delays; keep the
424
+ connection open (SSE heartbeats are every few seconds).
425
+ - Forward the `Authorization: Bearer ...` header unchanged.
426
+ - Keep the authority the phone uses. `allowedHosts` defaults to `[]` and
427
+ `strictHostCheck` is `false`; pairing records the authority. Re-pair through a
428
+ new tunnel domain, or add it to `allowedHosts` if an old token must keep working.
429
+ - For HTTPS, the phone must trust the certificate. A free tunnel usually provides
430
+ a trusted certificate; a self-signed LAN certificate usually does not.
431
+
432
+ EasyTier:
433
+
434
+ - If it is not already installed, ask first. Join the computer and phone to the
435
+ same network, then read the computer's virtual IP.
436
+ - Web profile: `dsh web --host <easytier-virtual-ip>` (a concrete local interface
437
+ address), then use `http://<easytier-virtual-ip>:<port>`.
438
+ - Desktop app: its Host stays on `127.0.0.1`. Put a local forwarder bound to the
439
+ EasyTier IP in front of it (nginx/socat), or use another tool with a serve mode.
440
+ - Mesh VPNs are L3, so SSE buffering is not an issue; the phone VPN must stay up.
441
+
442
+ frp:
443
+
444
+ - Use an `http` proxy with `customDomains` or a `tcp` proxy with `remotePort`.
445
+ - Disable frp transport compression for the SSE stream; test with
446
+ `/dsh-hello/health` and then open a conversation.
447
+ - Pair through the frp domain/address so the Host authority is recorded.
448
+ - Terminate TLS with a trusted certificate; for a `tcp` proxy, the plugin can
449
+ serve HTTPS itself with `--tls-cert` / `--tls-key`.
450
+
451
+ Caveats:
452
+
453
+ - **ngrok free** may show an HTML interstitial to non-browser clients; the app
454
+ cannot add the skip header. Use a paid/custom domain or another tunnel.
455
+ - **Cloudflare Access** puts a login page in front of the app; the native client
456
+ cannot authenticate there. Use a hostname without Access for the plugin path.
457
+
458
+ ## 5. Pairing and token failures
459
+
460
+ - One-time code expires after five minutes; read the current code again.
461
+ - Locked mode refuses new devices; already paired devices keep working.
462
+ - Too many failed attempts return `429`; wait for the window to reset.
463
+ - A removed or revoked device returns `401`; remove the server in the app and pair again.
464
+ - After changing domain, port, or tunnel, re-pairing is usually faster than debugging the old token.
465
+ - `403 host-refused`: the request authority is not allowed. Re-pair through the new address first; add it to `allowedHosts` only for an old token, or fix the proxy's `Host` header.
466
+ - `426 tls-required`: `requireSecure` is on but the request is plain HTTP. Use HTTPS, or disable it only on a trusted LAN. If TLS terminates at a proxy, the plugin itself sees HTTP; keep `requireSecure` off unless the proxy forwards TLS to the plugin.
467
+
468
+ `403 host-refused` and `426 tls-required` only appear when a proxy/domain or
469
+ `requireSecure` is involved. For a plain LAN HTTP setup, they should not.
470
+
471
+ ### Device removed in the plugin
472
+
473
+ This is the common "it worked, then stopped" case:
474
+
475
+ 1. The app was connected and has a valid device token.
476
+ 2. The user removes the device in **Settings → DSH Hello** on the computer, or
477
+ reinstalls the plugin/clears its credentials.
478
+ 3. The plugin closes the device's event streams. The app may keep cached session
479
+ rows and show a disconnected banner (zh example: `连接已断开`).
480
+ 4. `/dsh-hello/sessions` now returns `401 unauthenticated`; retrying alone never
481
+ succeeds.
482
+
483
+ Check it with the stored device token:
484
+
485
+ ```sh
486
+ curl -i -H "Authorization: Bearer <device-token>" \
487
+ http://127.0.0.1:<port>/dsh-hello/sessions
488
+ ```
489
+
490
+ A `401` here confirms the token was revoked. The fix is to remove the server in
491
+ the app and pair again with a fresh code. Current builds show the localized
492
+ "token revoked" hint (zh example: `配对令牌失效或已被撤销…`). If the user sees
493
+ only an empty list, confirm `/sessions` returns `401`.
494
+
495
+ What the app shows for these (localized; zh examples below):
496
+
497
+ | Server response | After pairing | During onboarding |
498
+ |---|---|---|
499
+ | `401 unauthenticated` | `配对令牌失效或已被撤销…` | `插件健康检查失败(HTTP 401)` |
500
+ | `403 host-refused` | `服务器拒绝了当前 Host:检查反代域名是否在 dsh-hello 的 allowedHosts 里` | `插件健康检查失败(HTTP 403)` |
501
+ | `426 tls-required` | `服务器要求 HTTPS…` | `插件健康检查失败(HTTP 426)` |
502
+ | `429 rate-limited` / `pair-rate-limited` | `请求太频繁:等一分钟再试…` | `插件健康检查失败(HTTP 429)`, or the Host's pairing-rate message |
503
+
504
+ ## 6. Final checklist
505
+
506
+ - [ ] Phone browser shows `200` for `/dsh-hello/health`.
507
+ - [ ] The URL uses the computer's reachable address, not `127.0.0.1` or `dsh-app://`.
508
+ - [ ] Pairing code is current and pairing is not locked.
509
+ - [ ] The app server address matches the URL that returned `200`.
510
+ - [ ] TLS is trusted or the connection is on a trusted private network.
511
+ - [ ] If a proxy/tunnel is used, the path is unchanged and SSE is not buffered.
512
+ - [ ] The plugin and app versions are current.
513
+
514
+ If it still fails, collect:
515
+
516
+ - Phone model, OS, app version.
517
+ - dsh and plugin versions, the `/dsh-hello/health` response.
518
+ - The phone browser result for `/dsh-hello/health`.
519
+ - `[dsh-hello]` log lines.
520
+ - Whether a proxy, tunnel, VPN, Tailscale, or cloud security group is involved.
521
+ - The exact error text or HTTP status code.
package/icon.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1024" height="1024">
2
+ <g transform="translate(143.36 297.27) scale(1.24121)" fill="#2D3038" fill-rule="evenodd">
3
+ <path d="M 315.053 1.947 C 311.911 5.089, 310.706 11.532, 311.303 22 C 312.355 40.465, 318.802 54.830, 331.993 68.102 C 341.190 77.356, 349.666 82.348, 361.241 85.328 C 368.948 87.312, 372.893 89.771, 376.424 94.795 C 378.935 98.369, 379.375 99.933, 379.375 105.294 C 379.375 113.542, 376.401 119.751, 368.924 127.117 C 358.438 137.445, 346.577 141.603, 330.004 140.760 C 307.503 139.616, 288.771 126.823, 266.377 97.308 C 256.083 83.741, 238.554 66.649, 226.437 58.364 C 201.475 41.296, 176.646 33.658, 146 33.619 C 105.880 33.568, 72.600 47.361, 43.889 75.942 C 22.297 97.434, 9.736 121.092, 2.840 153.251 C -0.305 167.914, -0.288 192.161, 2.877 206.934 C 9.365 237.216, 26.401 264.706, 52 286.200 C 68.274 299.864, 87.880 311.488, 106.322 318.406 C 116.462 322.209, 137.147 327.732, 148.500 329.667 C 159.533 331.548, 201.548 332.207, 212.330 330.668 L 218.160 329.836 211.830 323.168 L 205.500 316.500 187 316.379 C 158.915 316.194, 134.216 311.945, 111.928 303.463 C 77.712 290.443, 47.735 265.858, 31.175 237.237 C 26.660 229.433, 20.377 213.289, 21.442 212.225 C 21.841 211.826, 30.568 211.514, 40.834 211.530 C 61.186 211.564, 68.442 212.635, 85.834 218.175 C 101.136 223.049, 109.533 227.112, 131.047 240.054 C 157.957 256.242, 171.228 262.210, 189.367 266.281 L 195.233 267.598 198.413 276.049 C 208.446 302.713, 227.880 324.784, 251.655 336.516 C 271.790 346.452, 296.934 348.794, 304.308 341.419 C 307.684 338.043, 308.096 333.772, 305.843 325.500 C 304.794 321.650, 302.582 313.353, 300.926 307.062 C 297.184 292.838, 293.701 286.220, 284.968 276.743 L 278.123 269.314 286.142 267.591 C 309.381 262.597, 339.122 248.820, 355.668 235.385 C 357.961 233.523, 360.128 232, 360.485 232 C 361.556 232, 352.002 243.783, 344.096 252.213 C 336.355 260.466, 321.216 273.132, 312.250 278.856 C 309.363 280.700, 307 282.534, 307 282.932 C 307 283.709, 311.989 296.278, 312.519 296.835 C 313.009 297.351, 327.560 287.416, 336.500 280.461 C 340.900 277.038, 349.470 269.121, 355.545 262.869 C 393.151 224.159, 412.379 181.339, 415.940 128.373 C 416.988 112.789, 418.971 105.816, 424.363 98.746 C 429.186 92.423, 434.272 89.453, 447.933 84.980 C 462.702 80.145, 471.092 74.981, 480.041 65.214 C 487.122 57.487, 492.843 46.381, 495.607 35 C 498.009 25.105, 498.055 8.818, 495.692 4.321 C 493.023 -0.759, 490.903 -0.753, 480.647 4.360 C 473.223 8.062, 468.727 9.478, 456.781 11.876 C 439.181 15.409, 430.310 19.298, 421.370 27.397 C 414.549 33.577, 409.909 40.215, 406.434 48.765 C 404.597 53.285, 403.984 54.056, 403.479 52.483 C 401.129 45.165, 393.981 33.040, 389.304 28.436 C 380.316 19.591, 369.797 15.020, 349.435 11.113 C 339.885 9.280, 332.418 6.669, 323.539 2.057 C 318.631 -0.491, 317.506 -0.506, 315.053 1.947 M 498.065 97.028 C 471.597 102.583, 450.937 118.609, 439.516 142.445 C 433.311 155.397, 431.583 163.073, 431.626 177.500 C 431.668 191.512, 433.251 198.583, 439.044 210.646 L 442.956 218.791 435.900 237.484 C 432.019 247.765, 429.075 256.408, 429.357 256.690 C 429.639 256.972, 438.362 254.473, 448.741 251.135 L 467.612 245.067 476.421 249.488 C 489.594 256.099, 500.804 258.394, 516.785 257.752 C 531.484 257.160, 540.899 254.606, 552.500 248.062 C 573.402 236.272, 586.218 219.336, 592.230 195.562 C 593.910 188.918, 594.168 185.410, 593.775 174.543 C 593.366 163.251, 592.872 160.225, 590.092 152 C 581.093 125.375, 564.205 108.537, 537.293 99.356 C 530.658 97.093, 527.495 96.653, 516 96.398 C 508.575 96.232, 500.504 96.516, 498.065 97.028 M 501.994 106.056 C 494.629 107.141, 483.261 111.328, 475.683 115.746 C 464.128 122.482, 451.453 137.352, 446.218 150.312 C 440.488 164.498, 439.640 183.137, 444.071 197.506 C 446.386 205.012, 450.322 213.463, 451.981 214.488 C 453.787 215.605, 453.084 219.172, 449 229.619 C 446.800 235.245, 445 240.509, 445 241.316 C 445 242.471, 447.696 241.933, 457.711 238.779 C 467.651 235.649, 470.757 235.025, 471.961 235.919 C 472.807 236.548, 477.550 239.042, 482.500 241.462 C 510.073 254.942, 541.439 249.735, 563.083 228.085 C 571.815 219.351, 578.074 209.388, 581.810 198.278 C 584.102 191.464, 584.425 188.890, 584.415 177.500 C 584.404 165.412, 584.171 163.818, 581.083 154.773 C 569.486 120.802, 537.137 100.875, 501.994 106.056 M 478.250 159.641 C 477.435 159.984, 477 162.397, 477 166.583 L 477 173 470.500 173 L 464 173 464 166.500 L 464 160 459.977 160 L 455.954 160 456.227 177.750 L 456.500 195.500 460 195.500 L 463.500 195.500 463.794 188.250 L 464.088 181 470.500 181 L 476.912 181 477.206 188.250 L 477.500 195.500 481.250 195.810 C 484.885 196.111, 485.001 196.020, 485.032 192.810 C 485.049 190.990, 485.249 184.975, 485.477 179.445 C 485.704 173.914, 485.574 167.164, 485.188 164.445 C 484.571 160.105, 484.180 159.476, 481.993 159.307 C 480.622 159.201, 478.938 159.351, 478.250 159.641 M 519.443 160.287 C 519.172 160.994, 519.074 169.207, 519.225 178.537 L 519.500 195.500 523 195.500 L 526.500 195.500 526.775 178.632 C 526.963 167.041, 526.691 161.332, 525.902 160.382 C 524.457 158.641, 520.100 158.576, 519.443 160.287 M 532.227 177.750 L 532.500 195.500 536 195.500 L 539.500 195.500 539.773 177.750 L 540.046 160 536 160 L 531.954 160 532.227 177.750 M 136.500 167.502 C 131.614 169.230, 127.492 173.626, 125.958 178.746 C 122.457 190.432, 134.683 202.509, 146.447 198.984 C 154.479 196.578, 158.931 188.975, 157.696 179.773 C 156.979 174.424, 154.406 171.023, 148.980 168.250 C 143.909 165.659, 142.031 165.547, 136.500 167.502 M 495.420 170.885 C 491.303 173.396, 489.647 177.728, 490.209 184.513 C 490.969 193.673, 497.828 198.470, 506.736 196.071 C 510.472 195.065, 515 191.127, 515 188.884 C 515 186.776, 510.055 186.900, 507.102 189.082 C 504.536 190.980, 503.652 191.162, 501.585 190.221 C 500.231 189.604, 498.630 188.177, 498.027 187.050 C 496.959 185.054, 497.167 185, 505.891 185 C 515.965 185, 516.368 184.666, 514.671 177.733 C 512.733 169.822, 502.900 166.325, 495.420 170.885 M 548.357 172.312 C 545.359 175.059, 544.661 176.471, 544.265 180.591 C 543.338 190.241, 548.455 196.323, 557.500 196.323 C 565.751 196.323, 571 190.948, 571 182.500 C 571 173.706, 566.131 169, 557.035 169 C 552.696 169, 551.453 169.474, 548.357 172.312 M 498.653 176.831 C 496.483 179.229, 497.420 180, 502.500 180 C 507.417 180, 508.279 179.390, 506.930 176.869 C 505.631 174.441, 500.835 174.420, 498.653 176.831 M 553.557 177.223 C 550.025 182.265, 552.728 190, 558.022 190 C 559.873 190, 561.306 189.297, 561.965 188.066 C 563.536 185.129, 563.221 178.363, 561.429 176.571 C 559.173 174.316, 555.372 174.630, 553.557 177.223" stroke="none" fill="#2D3038" fill-rule="evenodd"/>
4
+ </g>
5
+ </svg>