dsh-plugin-wsl-env 0.29.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +342 -0
  2. package/CONTRIBUTING.md +68 -12
  3. package/CONTRIBUTING.zh.md +34 -4
  4. package/README.md +1 -1
  5. package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
  6. package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
  7. package/agent/wsl-agent.sh +15 -4
  8. package/client.js +454 -110
  9. package/cordis.patch.yml +28 -7
  10. package/docs/AGENT-PROTOCOL-V7.md +4 -2
  11. package/docs/ARCHITECTURE.md +3 -1
  12. package/docs/ARCHITECTURE.zh.md +3 -1
  13. package/docs/COMPATIBILITY.md +1 -1
  14. package/docs/COMPATIBILITY.zh.md +1 -1
  15. package/docs/CONFIGURATION.md +19 -7
  16. package/docs/CONFIGURATION.zh.md +13 -5
  17. package/docs/DIAGNOSTICS.md +31 -5
  18. package/docs/DIAGNOSTICS.zh.md +22 -5
  19. package/docs/LIMITATIONS.md +65 -6
  20. package/docs/LIMITATIONS.zh.md +51 -6
  21. package/docs/PERFORMANCE.md +29 -1
  22. package/docs/PERFORMANCE.zh.md +23 -1
  23. package/docs/QUICKSTART.md +1 -1
  24. package/docs/QUICKSTART.zh.md +1 -1
  25. package/docs/README.zh.md +1 -1
  26. package/docs/RELEASING.md +29 -6
  27. package/docs/RELEASING.zh.md +9 -0
  28. package/docs/adr/0002-native-agent.md +50 -2
  29. package/lib/agent-confined.js +15 -4
  30. package/lib/agent-errors.d.ts +16 -0
  31. package/lib/agent-errors.js +19 -0
  32. package/lib/agent-exec.d.ts +8 -1
  33. package/lib/agent-exec.js +2 -1
  34. package/lib/agent-shared.d.ts +85 -2
  35. package/lib/agent-shared.js +167 -38
  36. package/lib/agent.d.ts +60 -6
  37. package/lib/agent.js +177 -28
  38. package/lib/auto-preset.js +7 -2
  39. package/lib/doctor-live.d.ts +36 -7
  40. package/lib/doctor-live.js +61 -12
  41. package/lib/doctor-process.d.ts +68 -0
  42. package/lib/doctor-process.js +139 -0
  43. package/lib/doctor-report.js +11 -109
  44. package/lib/fs-substrate.js +3 -3
  45. package/lib/fsio-agent.d.ts +57 -6
  46. package/lib/fsio-agent.js +168 -75
  47. package/lib/git-exec.d.ts +7 -1
  48. package/lib/git-exec.js +14 -2
  49. package/lib/native-agent.d.ts +25 -4
  50. package/lib/native-agent.js +52 -9
  51. package/lib/picker.d.ts +2 -1
  52. package/lib/picker.js +30 -13
  53. package/lib/plugin-update.js +18 -14
  54. package/lib/provider-common.d.ts +112 -0
  55. package/lib/provider-common.js +171 -0
  56. package/lib/sandbox-core.js +52 -13
  57. package/lib/search-exec.d.ts +6 -0
  58. package/lib/search-exec.js +10 -2
  59. package/lib/session-runtime.d.ts +46 -1
  60. package/lib/session-runtime.js +57 -7
  61. package/lib/session-scope.d.ts +22 -1
  62. package/lib/session-scope.js +33 -7
  63. package/lib/shell-env.js +125 -12
  64. package/lib/socket-isolation.d.ts +12 -4
  65. package/lib/socket-isolation.js +27 -10
  66. package/lib/status.js +53 -4
  67. package/lib/subprocess.js +3 -3
  68. package/lib/terminal-activity.js +6 -9
  69. package/lib/wsl-doctor-command.js +36 -80
  70. package/lib/wsl-filesystem.d.ts +9 -4
  71. package/lib/wsl-filesystem.js +26 -10
  72. package/lib/wsl-shell.d.ts +27 -17
  73. package/lib/wsl-shell.js +83 -24
  74. package/lib/wsl.d.ts +3 -1
  75. package/lib/wsl.js +82 -7
  76. package/package.json +5 -4
  77. package/scripts/bootstrap.sh +36 -12
  78. package/scripts/doctor.mjs +514 -201
package/cordis.patch.yml CHANGED
@@ -302,18 +302,24 @@
302
302
  # Generated from the shipped standard preset so the embedded plan-mode
303
303
  # section and every nested group survive byte-for-byte: this copy is
304
304
  # `packages/bundle/web-app/presets/standard.patch.yml` of the
305
- # `dsh-v0.2.2-rc.1` source tree, changed
306
- # in exactly three ways —
305
+ # `dsh-v0.2.2-rc.2` source tree — the line the dev pins name — changed
306
+ # in exactly four ways:
307
307
  # 1. every shipped row mounts inside `wsl-env`, so the preset's tools see
308
308
  # the distro's shell and fs (the realm is declared on the group);
309
309
  # 2. `tool-bash` is enabled and `tool-pwsh` disabled outright, where the
310
310
  # shipped copy derives the choice from `process.platform`;
311
311
  # 3. the identity and display metadata: row `preset-wsl`, preset `wsl`,
312
- # `name`/`description` for the mode selector, `order: 1`.
313
- # Regenerate it when an app update changes the preset: take
314
- # `packages/bundle/web-app/presets/standard.patch.yml` from the harness tree
315
- # the peer pins track, replace this row to the end of the file with its
316
- # content, then re-apply changes 1–3 by hand.
312
+ # `name`/`description` for the mode selector, `order: 1`;
313
+ # 4. this plugin's own rows: `wsl-shell` and `wsl-fs` first, and
314
+ # `wsl-doctor-tool` after `tool-jobs`.
315
+ # Everything else — the row set, its order, every config and `!!js`
316
+ # expression — is the shipped preset's, and scripts/preset-sync.mjs
317
+ # (`pnpm run preset:sync`) holds the copy to it against a snapshot of that
318
+ # file (test/fixtures/standard.patch.dsh-<version>.yml).
319
+ # Regenerate it when an app update changes the preset: replace the
320
+ # snapshot with the new tag's file, run the check to see what moved,
321
+ # replace this row to the end of the file with the upstream content, then
322
+ # re-apply changes 1–4 by hand.
317
323
  # ═════════════════════════════════════════════════════════════════════════════
318
324
  - id: preset-wsl
319
325
  name: '@deepseek-ai/dsh-agent-preset'
@@ -432,6 +438,17 @@
432
438
  name: '@deepseek-ai/dsh-tool-schedule'
433
439
  - id: skill-filesystem
434
440
  name: '@deepseek-ai/dsh-skill-filesystem'
441
+ config:
442
+ # The preset package's own skills directory, as the shipped
443
+ # preset names it. The expression is upstream's, unchanged:
444
+ # `baseUrl` is the root Include's base for every row of the
445
+ # composition — this bundle's rows included — so it resolves
446
+ # to the installation's copy wherever this package is
447
+ # installed. The directory is then read through THIS preset's
448
+ # filesystem, i.e. inside the distro; docs/LIMITATIONS.md
449
+ # names the one installation shape where it is not readable.
450
+ customSkillDirs:
451
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
435
452
  - id: tool-skill
436
453
  name: '@deepseek-ai/dsh-tool-skill'
437
454
  - id: command-goal
@@ -484,6 +501,8 @@
484
501
  config:
485
502
  - id: tool-subagent-control
486
503
  name: '@deepseek-ai/dsh-tool-subagent-control'
504
+ config:
505
+ interrupt: false
487
506
  - id: tool-subagent
488
507
  name: '@deepseek-ai/dsh-tool-subagent'
489
508
  config:
@@ -515,6 +534,8 @@
515
534
  searchTimeoutMs: 60000
516
535
  - id: present
517
536
  name: '@deepseek-ai/dsh-tool-present'
537
+ - id: tool-office
538
+ name: '@deepseek-ai/dsh-tool-office'
518
539
  - id: tool-plugin-manager
519
540
  name: '@deepseek-ai/dsh-plugin-manager/tools'
520
541
  disabled: !!js "!ctx.get('profileContext')"
@@ -16,7 +16,7 @@ negotiation rule, four capabilities.
16
16
  |---|---|---|---|---|
17
17
  | Capability advertisement | HELLO gains a 6th field | `conc,batch` | `batch` | capability-aware FS scheduling |
18
18
  | Structured FS errors | new `FSERR\|id\|reason\|b64 message` line | yes | yes | direct FsError mapping (the `dsh-fs\|…` stderr-line sniffing stays as a fallback for older agents) |
19
- | Batched FS reads | new `FSB\|id\|timeout\|nops` frame, `OP\|op\|nargs` op specs follow | sequential under `fs_lock`, one RES | sequential in one worker, one RES | GUI-preview-shaped page reads in one round trip |
19
+ | Batched FS reads | new `FSB\|id\|timeout\|nops` frame, `OP\|op\|nargs` op specs follow | sequential in one worker, one RES (`fs_lock` only when the batch holds a mutation) | sequential in one worker, one RES | GUI-preview-shaped page reads in one round trip |
20
20
  | `delete` / `move` FS ops | new op names in the FS frame vocabulary | yes | yes | guarded, mapped to `FsDeleteOutcome` / `FsMoveOutcome` |
21
21
  | `patchText` | **no wire change** — host-side hunk application + a guarded `replace` write | n/a | n/a | hunks applied in-process via `@deepseek-ai/dsh-fs-patch` (a new peer dependency, the peer's own `applyHunks` — perfect error parity, `FS_PATCH_MISMATCH` free) |
22
22
 
@@ -42,7 +42,9 @@ Concurrency capability is negotiated separately, because the two backends
42
42
  honestly differ:
43
43
 
44
44
  - `conc` — the agent runs FS ops concurrently and may answer out of order
45
- (the native agent already does: worker threads + `fs_lock` on mutations).
45
+ (the native agent already does: worker threads, with `fs_lock` for mutations
46
+ only — a read never waits behind a write, and the `ACK` reports the dequeue
47
+ before any lock is taken, so the host's watchdog measures execution).
46
48
  - `batch` — the agent accepts `FSB` (any backend; a batch is sequential
47
49
  inside one worker, which is exactly why it is safe everywhere).
48
50
  - The SHELL agent does **not** advertise `conc`: its read loop is serial and
@@ -21,7 +21,7 @@ smaller integrations listed below.
21
21
 
22
22
  | Service | Class | File | What it does |
23
23
  |---|---|---|---|
24
- | `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | Runs each command in the distro's login shell over the resident in-distro agent (the default), wrapped in a distro-side `bwrap` sandbox; while the agent is out, or with `agent: false`, the same command falls back to one `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` process. |
24
+ | `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | Runs each command in the distro's login shell over the resident in-distro agent (the default), wrapped in a distro-side `bwrap` sandbox; while the agent is out, or with `agent: false`, the same command falls back to one `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` process; a command that was already running when the resident died is the exception — it fails as "state is unknown" and is not run again. |
25
25
  | `ctx.fs` | `WslFileSystem` | [`lib/wsl-filesystem.js`](../lib/wsl-filesystem.js) | Serves WSL-routed file operations through the resident in-distro agent; the former Windows-side share substrate is retired (see below). |
26
26
  | `ctx.subprocess` | `WslSubprocessRuntime` | [`lib/subprocess.js`](../lib/subprocess.js) | Opens the GUI terminal inside the distro, in the session workspace, and rewrites the file-search and git-snapshot spawns into the distro (see below). |
27
27
 
@@ -528,6 +528,8 @@ src/index.ts public provider exports
528
528
  src/wsl-shell.ts WslShellExecutor (ctx.shell)
529
529
  src/wsl-filesystem.ts WslFileSystem (ctx.fs)
530
530
  src/doctor-report.ts in-process doctor collector used by the tool
531
+ src/doctor-process.ts the bounded doctor subprocess collector shared by the
532
+ report and command runners
531
533
  src/provider-common.ts distro, home, runtime and writable-root helpers
532
534
  src/listing.ts pure directory listing and breadcrumb helpers
533
535
  src/messages.ts the en/zh message catalogs and the host-locale wiring
@@ -20,7 +20,7 @@ DSH 以服务的形式暴露自身能力。面向模型的工具(`bash`、`rea
20
20
 
21
21
  | 服务 | 类 | 文件 | 作用 |
22
22
  |---|---|---|---|
23
- | `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | 在发行版的登录 shell 中运行每条命令,默认经由常驻的发行版内 agent,并包在发行版侧的 `bwrap` 沙箱里;agent 不在时,或设置 `agent: false` 时,同一条命令退回到一个 `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` 进程。 |
23
+ | `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | 在发行版的登录 shell 中运行每条命令,默认经由常驻的发行版内 agent,并包在发行版侧的 `bwrap` 沙箱里;agent 不在时,或设置 `agent: false` 时,同一条命令退回到一个 `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` 进程;常驻 agent 在命令执行途中死亡的情况除外——该命令以「状态未知」失败,不会重跑。 |
24
24
  | `ctx.fs` | `WslFileSystem` | [`lib/wsl-filesystem.js`](../lib/wsl-filesystem.js) | 通过常驻的发行版内 agent 服务 WSL 路由的文件操作;此前的 Windows 侧 share 底座已退役(见下文)。 |
25
25
  | `ctx.subprocess` | `WslSubprocessRuntime` | [`lib/subprocess.js`](../lib/subprocess.js) | 在发行版内、会话工作区中打开 GUI 终端,并把文件搜索与 git 快照的 spawn 改写到发行版内(见下文)。 |
26
26
 
@@ -471,6 +471,8 @@ src/index.ts public provider exports
471
471
  src/wsl-shell.ts WslShellExecutor (ctx.shell)
472
472
  src/wsl-filesystem.ts WslFileSystem (ctx.fs)
473
473
  src/doctor-report.ts in-process doctor collector used by the tool
474
+ src/doctor-process.ts the bounded doctor subprocess collector shared by the
475
+ report and command runners
474
476
  src/provider-common.ts distro, home, runtime and writable-root helpers
475
477
  src/listing.ts pure directory listing and breadcrumb helpers
476
478
  src/messages.ts the en/zh message catalogs and the host-locale wiring
@@ -76,7 +76,7 @@ Alpine (musl).
76
76
  |---|---|
77
77
  | Debian | First launch can wedge before OOBE completes (`wsl.exe` exec and `--terminate` both hang). `wsl --terminate <distro>` once it is Stopped, then start as root to bypass OOBE. systemd is PID 1 out of the box. |
78
78
  | Alpine | Import the **minirootfs** tarball (`wsl --import`), not the standard/cloud images. Create a normal user and set `[user] default=…` in `/etc/wsl.conf` — the imported default is root, and a root agent writes 0600 files the probe user cannot read. Install `coreutils util-linux` (busybox `mktemp`/`ps` lack the used options) and `shadow` for `useradd`. |
79
- | Fedora / openSUSE / Arch | systemd PID 1 out of the box. openSUSE: `zypper --non-interactive` (the plain `-y` still prompts); Arch: `pacman -Sy --needed`. |
79
+ | Fedora / openSUSE / Arch | systemd PID 1 out of the box. openSUSE: `zypper --non-interactive` (the plain `-y` still prompts); Arch: `pacman -S --needed`; refresh first with `pacman -Syu` when the index is missing or stale (Arch advises against an index-only `-Sy`). |
80
80
 
81
81
  On a minimal Alpine image the **shell** agent's FSB enumeration needs GNU
82
82
  `findutils` (BusyBox `find` lacks `-printf`); the packaged native agent does
@@ -70,7 +70,7 @@ Debian 的 harness 级运行暴露出一个真实发现:**当工作区根目
70
70
  |---|---|
71
71
  | Debian | 首次启动可能在 OOBE 完成前卡死(`wsl.exe` exec 和 `--terminate` 都会挂起)。等状态变为 Stopped 后执行一次 `wsl --terminate <distro>`,再以 root 启动以跳过 OOBE。systemd 开箱即 PID 1。 |
72
72
  | Alpine | 导入 **minirootfs** tarball(`wsl --import`),不要用 standard/cloud 镜像。创建普通用户并在 `/etc/wsl.conf` 中设置 `[user] default=…`——导入后的默认用户是 root,而 root agent 写出的 0600 文件探针用户无法读取。安装 `coreutils util-linux`(busybox 的 `mktemp`/`ps` 缺少所用选项)以及用于 `useradd` 的 `shadow`。 |
73
- | Fedora / openSUSE / Arch | systemd 开箱即 PID 1。openSUSE:用 `zypper --non-interactive`(裸 `-y` 仍会提示);Arch:`pacman -Sy --needed`。 |
73
+ | Fedora / openSUSE / Arch | systemd 开箱即 PID 1。openSUSE:用 `zypper --non-interactive`(裸 `-y` 仍会提示);Arch:`pacman -S --needed`;索引缺失或过期时先 `pacman -Syu`(Arch 不建议只刷新索引的 `-Sy`)。 |
74
74
 
75
75
  在最小 Alpine 镜像上,**shell** agent 的 FSB 枚举需要 GNU `findutils`
76
76
  (BusyBox 的 `find` 缺少 `-printf`);随包的原生 agent 不需要,`auto` 会
@@ -200,7 +200,7 @@ takes no configuration.
200
200
  | | `retryMs` | `150` | Delay between attempts, in milliseconds. |
201
201
  | | `windowsWorkspaces` | `[]` | Distro directories opened for Windows access (UNC paths). Sessions under them keep the host preset; the add-workspace prompt writes here, and Settings can change it back. A session in one of them is called out above the composer and in the **WSL environment** panel, with the way back to the distro environment. |
202
202
  | `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
203
- | | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
203
+ | | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. The doctor's `--probe-timeout` is derived from it (`2T + 2s` below the budget), so a stuck probe settles into its own verdict instead of vanishing under the outer kill. |
204
204
  | | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
205
205
  | `wsl-open-in-app` | `executable` | `''` | Editor executable for the session-header "open in app" action. Empty resolves VS Code from its usual Windows install locations, then `Code.exe` on `PATH`. |
206
206
  | | `watchMs` | `1500` | Early-failure watch window per launch, in milliseconds; an editor that exits inside it is reported as a launch failure. |
@@ -426,10 +426,13 @@ scripts/bootstrap.sh <distro> --install
426
426
  ```
427
427
 
428
428
  Without `--install`, the helper performs a read-only check. On apt-based
429
- distros, the direct install command is:
429
+ distros, the direct install command is (the package index is refreshed first —
430
+ a freshly installed Debian or Ubuntu has none; the `sh -c "…"` quotes keep the
431
+ `&&` inside the distro when the line is pasted into cmd, PowerShell 5.1 or
432
+ PowerShell 7 alike):
430
433
 
431
434
  ```bash
432
- wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
435
+ wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap"
433
436
  ```
434
437
 
435
438
  The `wsl-preflight` row runs these checks when a session opens, and — with
@@ -466,7 +469,10 @@ other language renders English. A profile without the settings service, or
466
469
  one whose user never picked a language, falls back to the process's ICU
467
470
  default locale — the OS UI language in the desktop app — so a zh-CN Windows
468
471
  with a provisional-Chinese UI still renders Chinese; an explicit Settings
469
- choice always wins over that fallback. Commands, config keys and file paths
472
+ choice always wins over that fallback. One surface is the exception: the web
473
+ client's status panel and the add-workspace access prompt carry Chinese-only
474
+ static text for now (not routed through the message catalogs); the route data
475
+ they render follows the rules above. Commands, config keys and file paths
470
476
  inside a message are never translated. Two message groups stay English by
471
477
  design: the `FS_*` refusal texts in `fs-decisions` and the fsio replica (the
472
478
  tool layer matches on those strings byte-for-byte). The standalone
@@ -514,7 +520,11 @@ checks every installed distro, `--bundle
514
520
  and `--locale <tag>` (or `DSH_WSL_DOCTOR_LOCALE`) selects the skeleton
515
521
  language without re-probing. `--yes` skips the confirmation prompt (not the
516
522
  confirmation gate itself), and `--read-only` refuses to run together with
517
- `--fix` or `--install`.
523
+ `--fix` or `--install`. `--wsl <path>` replaces the `wsl.exe` the whole run
524
+ probes with, and `--cmd <path>` the `cmd.exe` the Windows-side reads use; a
525
+ path ending in `.mjs` runs as a Node script under the current runtime — the
526
+ seam the tests drive their fakes through, since Windows resolves the real
527
+ `System32` binaries before `PATH`.
518
528
  See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
519
529
  error-code map. Whether a row override applied, read from the profile's
520
530
  `cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
@@ -528,8 +538,10 @@ result structure (per-status totals and per-section tallies). The last result
528
538
  per distro is stored at `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
529
539
  (`~/.dsh/...` when the host names no home), so a page reload or app restart
530
540
  still shows it. On load, a stored result for a distro that is currently
531
- running is re-checked in the background; a failed background run overwrites
532
- the stored result. Nothing is labeled expired — each checked row offers
541
+ running is re-checked in the background with a quick check; a failed
542
+ background run overwrites the stored result, while a **full diagnosis** or a
543
+ **repair** result is never replaced by the background re-check. Nothing is
544
+ labeled expired — each checked row offers
533
545
  **清除** and the card offers **清除全部**; both `DELETE` the same route
534
546
  (optionally with `?distro=`) to drop the stored verdict without enumerating,
535
547
  probing or modifying a distro. Deleting the file still resets the panel's
@@ -187,7 +187,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
187
187
  | | `retryMs` | `150` | 两次尝试之间的延迟,单位毫秒。 |
188
188
  | | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。落在这些目录的会话会在输入框上方与 **WSL 环境** 面板中被点明,并提供回到发行版环境的办法。 |
189
189
  | `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
190
- | | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
190
+ | | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。doctor 的 `--probe-timeout` 由它推导(`2T + 2s` 低于该预算),一次卡住的探针在自己的截止时间内落地,而不是被外层整体杀掉。 |
191
191
  | | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
192
192
  | `wsl-open-in-app` | `executable` | `''` | 会话页头“在应用中打开”动作使用的编辑器可执行文件。空则从常见的 Windows 安装位置解析 VS Code,再回退到 `PATH` 上的 `Code.exe`。 |
193
193
  | | `watchMs` | `1500` | 每次启动的早期失败观察窗口,单位毫秒;编辑器在该窗口内退出会报告为启动失败。 |
@@ -398,10 +398,12 @@ scripts/bootstrap.sh <distro> --install
398
398
  ```
399
399
 
400
400
  不带 `--install` 时,辅助脚本只做只读检查。在基于 apt 的
401
- 发行版上,直接安装命令是:
401
+ 发行版上,直接安装命令是(先刷新软件包索引——新装的 Debian/Ubuntu 还没有
402
+ 索引;`sh -c "…"` 的引号让 `&&` 留在发行版内,cmd、PowerShell 5.1 与
403
+ PowerShell 7 粘贴执行都一样):
402
404
 
403
405
  ```bash
404
- wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
406
+ wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap"
405
407
  ```
406
408
 
407
409
  会话打开时,`wsl-preflight` 行会运行这些检查;`startup: true`(默认)时,
@@ -430,6 +432,8 @@ open-in-app 路由的拒绝、目录选择器的标签、`/wsl-doctor` 命令文
430
432
  没有 settings 服务的 profile、或用户从未在设置中选过语言的情况,回退到
431
433
  进程的 ICU 默认区域设置——桌面应用中即操作系统 UI 语言——因此临时渲染为
432
434
  中文界面的 zh-CN Windows 仍显示中文;显式的设置选择始终优先于该回退。
435
+ 一个例外:web 客户端的状态面板与添加工作区的访问方式弹窗目前使用纯中文
436
+ 静态文案(未接入消息 catalog);它们渲染的路由数据仍遵循上述规则。
433
437
  消息内的命令、配置键与文件路径一律不翻译。两组消息按设计保持英文:
434
438
  `fs-decisions` 中的 `FS_*` 拒绝文本与 fsio 复刻(工具层按字节匹配这些
435
439
  字符串)。独立运行的 `scripts/doctor.mjs` 自带 catalog:固定骨架按宿主
@@ -464,7 +468,10 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
464
468
  限定在插件自有的这两类),`--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加的诊断文件
465
469
  (`--redact` 脱敏路径),`--locale <标签>`(或 `DSH_WSL_DOCTOR_LOCALE`)
466
470
  无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
467
- `--read-only` 拒绝与 `--fix` 或 `--install` 同用。
471
+ `--read-only` 拒绝与 `--fix` 或 `--install` 同用。`--wsl <路径>` 替换整次
472
+ 运行探测所用的 `wsl.exe`,`--cmd <路径>` 替换 Windows 侧读取用的 `cmd.exe`;
473
+ 以 `.mjs` 结尾的路径会作为 Node 脚本在当前运行时下执行——这是测试驱动假件
474
+ 的接缝,因为 Windows 解析真实的 `System32` 二进制先于 `PATH`。
468
475
  判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
469
476
  某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
470
477
  桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
@@ -474,7 +481,8 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
474
481
  清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
475
482
  每个发行版的最后一次结果存放在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
476
483
  (宿主未指定 home 时为 `~/.dsh/...`),页面刷新或应用重启后仍可见。加载时会对
477
- 正在运行的发行版在后台复核;后台失败会覆盖已存结果。不标记“已过期”——每个
484
+ 正在运行的发行版在后台做一次快速复核;后台失败会覆盖已存结果,但“完整诊断”和
485
+ “修复”的结果不会被后台复核替换。不标记“已过期”——每个
478
486
  已检查行提供“清除”、卡片头部提供“清除全部”,经同一路由的 `DELETE`(可带
479
487
  `?distro=`)删除本地保存的结果,不枚举、不探测也不修改发行版;直接删除该文件
480
488
  仍可等效重置面板历史。每行提供“快速检查”和“完整诊断”两个只读检查动作;完整
@@ -43,6 +43,15 @@ that the file is broken. Rerun the doctor for a clean answer.
43
43
  `--fix` ends in a re-verified report: every fix is followed by a fresh probe
44
44
  of what it claims to have fixed, the affected checks carry the after state,
45
45
  and the verdict is recomputed — `ready`, or the remaining blockers. The
46
+ recheck takes the same flake retry as every other read, and a recheck that
47
+ still does not answer makes the `fix.*` row `unknown` (an empty read is no
48
+ longer counted as "0 stale scopes" or "0 invalid cache entries");
49
+ `runtime.scopes` is `unknown` too, while `agent.cache` keeps its
50
+ before-the-fix verdict until a read answers. A failed fix quotes the tail of
51
+ the command's output in its `fix.*` row (the doctor prints none of it
52
+ elsewhere). The handshake probe waits 15 s for a HELLO and retries a
53
+ transport flake once (a timeout or wsl.exe's own error); a deterministic
54
+ failure is answered at once. The
46
55
  plugin-owned state is repaired automatically: the stale-scope sweep and a
47
56
  purge of the agent cache when an entry is not executable (the handshake is
48
57
  re-probed after the purge). `--fix-owned` narrows a repair to exactly those two
@@ -54,7 +63,8 @@ the remedy text says so.
54
63
  `--bundle <path>` writes a local JSON file (report + versions + effective
55
64
  configuration) for a setup report; `--redact` replaces home and DSH paths
56
65
  with `<redacted-*>` placeholders. The bundle contains no file contents, no
57
- environment variables, and no telemetry.
66
+ environment variables, and no telemetry. The note that it was written and the
67
+ confirmation prompts go to stderr; with `--json`, stdout is the report alone.
58
68
 
59
69
  ## The surfaces
60
70
 
@@ -66,13 +76,23 @@ version** card is separate from the doctor: it reads the
66
76
  installed/running plugin versions and offers the one-click upgrade through the
67
77
  host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
68
78
 
69
- - **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
79
+ - **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--probe-timeout <ms>] [--wsl <path>] [--cmd <path>] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
70
80
  (the same line `--help` prints).
71
81
  The authoritative surface: it loads **no peer dependency and no host
72
82
  service**, so it still starts when the plugin's own runtime is the thing
73
83
  that is broken. Only pure, peer-free `lib/` modules are imported; the one
74
84
  helper that used to live behind a peer-tainted module (`lib/index.js`) is
75
- inlined and drift-pinned against the lib export by `test/doctor.test.mjs`. Exit 0 = `ready`, 1 = `blocked`, 2 = refused
85
+ inlined and drift-pinned against the lib export by `test/doctor.test.mjs`.
86
+ The in-distro reads go out as composed batches: the pure reads in one
87
+ `wsl.exe`, the systemd-class commands in a small batch of their own, each
88
+ under its own `timeout` — a distro's probes drop from a dozen-plus spawns
89
+ to about 2 in the quick profile and 8 in a full run. The fix rechecks (the
90
+ scope sweep, the cache purge, the bwrap install) keep their standalone
91
+ probes, so a hung command costs its own slice. `--probe-timeout <ms>`
92
+ bounds one batch probe's deadline (the shared 60 s default stands without
93
+ it); a deadline hit is a transport flake, retried once after the 2 s settle,
94
+ so the worst path is `2T + 2s`.
95
+ Exit 0 = `ready`, 1 = `blocked`, 2 = refused
76
96
  (`--read-only` with `--fix`/`--install`, `--fix-owned` with `--install`, or
77
97
  `--fix` on a scoped run).
78
98
  - **The `/wsl-doctor` UI command** — typing
@@ -94,7 +114,10 @@ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
94
114
  (`N more in the full run`), not listed as results. The last result is stored locally
95
115
  (`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`, falling back to `~/.dsh`)
96
116
  so a reload still shows it; a background refresh runs only for distros that
97
- are already up, and a failed one replaces the stored result as observed.
117
+ are already up and is always a quick check — it never replaces a full
118
+ diagnosis or a repair result — and a failed one replaces the stored quick
119
+ result as observed. Requests for the same distro and mode while one is
120
+ running share that run, and **刷新** is disabled while any check is in flight.
98
121
  Each checked row offers **清除** and the card offers **清除全部**; both
99
122
  `DELETE` the same route, dropping the local store without starting a doctor
100
123
  run or enumerating a distro. Manual warnings keep their remedies. Without a command adapter (headless, ACP) the row is a no-op and
@@ -105,7 +128,10 @@ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
105
128
  probes **every** installed distro — a sweep that costs minutes on a machine
106
129
  with several (a scoped quick run is seconds). The handler therefore bounds
107
130
  the subprocess (120 s when it has a distro, 60 s when the configuration has
108
- to choose, both below the command dispatcher's own deadline) so a stalled or
131
+ to choose, both below the command dispatcher's own deadline) and passes
132
+ `--probe-timeout` so that `2T + 2s` stays below the budget — a stuck probe
133
+ settles into its own `unknown` verdict instead of vanishing under the outer
134
+ kill — so a stalled or
109
135
  unscoped run settles with a message naming the target it examined and how to
110
136
  narrow it.
111
137
  - **The `wsl_doctor` model tool** — in-process via `doctorReport()`, so the
@@ -37,6 +37,12 @@
37
37
 
38
38
  `--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
39
39
  受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
40
+ 复验走与其他读数相同的抖动重试;复验仍未应答时,`fix.*` 行记 `unknown`
41
+ (空读数不再算作「0 个残留 scope / 0 个无效缓存」),`runtime.scopes` 同样记
42
+ `unknown`,`agent.cache` 则保留修复前的裁决,直到读数给出答案。失败的修复在
43
+ `fix.*` 行里引用命令输出的末尾(doctor 不另行打印这些输出)。握手探测等
44
+ 15 秒 HELLO,传输抖动(超时或 wsl.exe 自身报错)重试一次,确定性失败立即
45
+ 应答。
40
46
  插件自有状态可自动修复:残留 scope 清扫,以及缓存条目不可执行时清理
41
47
  agent 缓存(清理后重新握手)。`--fix-owned` 把修复收窄到这两类,且不能与 `--install` 同用。会改写用户或 distro
42
48
  所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1 转换、安装 distro)
@@ -44,7 +50,8 @@ agent 缓存(清理后重新握手)。`--fix-owned` 把修复收窄到这两
44
50
 
45
51
  `--bundle <path>` 写出本地 JSON 文件(报告 + 版本 + 生效配置)供 setup
46
52
  report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
47
- bundle 不含文件内容、环境变量,也没有遥测。
53
+ bundle 不含文件内容、环境变量,也没有遥测。写入提示与确认提问走 stderr,
54
+ `--json` 的 stdout 只有报告本身。
48
55
 
49
56
  ## 三个入口
50
57
 
@@ -54,12 +61,18 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
54
61
  同一面板的「插件版本」卡片独立于 doctor:它读取已安装/运行中的插件版本,并提供
55
62
  经宿主插件管理器执行的一键升级(见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md) 的 `wsl-plugin-update`)。
56
63
 
57
- - **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
64
+ - **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--probe-timeout <毫秒>] [--wsl <路径>] [--cmd <路径>] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
58
65
  (与 `--help` 输出同一行)。
59
66
  这是权威入口:它**不加载任何 peer 依赖、任何宿主服务**,即使插件的运行时
60
67
  本身就是故障源,它也能启动。只 import 纯净、无 peer 的 `lib/` 模块;原先
61
68
  挂在 peer 污染模块(`lib/index.js`)后面的唯一 helper 已内联,并由
62
69
  `test/doctor.test.mjs` 与 lib 导出对拍防漂移。
70
+ 发行版内的读取以合成批次发出:纯读事实一次 `wsl.exe`,systemd 类命令
71
+ 另一小批且各自包 `timeout`——每个发行版的探针从十几次启动降到 quick 约 2 次、
72
+ full 约 8 次;修复复查(scope 清扫、缓存清理、bwrap 安装)仍用独立探针,
73
+ 卡住的命令只损失自己的时间片。`--probe-timeout <毫秒>` 限定一次批次探针的
74
+ 截止时间(缺省仍是共享的 60 秒):一次截止触发的传输抖动按重试间隔(2 秒)
75
+ 再试一次,所以最坏路径是 `2T + 2s`。
63
76
  退出码 0 = `ready`,1 = `blocked`,2 = 拒绝(`--read-only` 与
64
77
  `--fix`/`--install` 同用、`--fix-owned` 与 `--install` 同用,或对范围化
65
78
  运行使用 `--fix`)。
@@ -75,8 +88,10 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
75
88
  行内同时给出上次检查时间、来源(手动或页面加载时的后台复核)与结果结构(各状态
76
89
  计数与分区分布)。每个已检查的行可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据;
77
90
  快速检查未触及的目录项只以“完整诊断还会运行 N 项”计数,不伪装成结果。最后一次结果存放在本地(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,
78
- 缺省回退到 `~/.dsh`),刷新后仍可见;后台复核只针对正在运行的发行版,失败时按
79
- 实际观测覆盖已存结果。每个已检查行可“清除”该发行版的结果,卡片头部可“清除全部”;
91
+ 缺省回退到 `~/.dsh`),刷新后仍可见;后台复核只针对正在运行的发行版,并且只
92
+ 是快速检查,不会替换“完整诊断”和“修复”的结果,失败时按实际观测覆盖已存的
93
+ 快速结果。同一发行版同一种检查在途时,重复请求共用同一次运行;有检查在途时
94
+ “刷新”按钮禁用。每个已检查行可“清除”该发行版的结果,卡片头部可“清除全部”;
80
95
  两者经同一路由的 `DELETE` 完成,只删本地存档,不启动 doctor、不枚举发行版。
81
96
  手动告警保留各自处理办法;完整诊断与修复是两个独立动作。
82
97
  完整诊断仍走上面的入口与 `/wsl-doctor`。没有命令适配器的部署(headless、ACP)中该行是
@@ -86,7 +101,9 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
86
101
  随包预设的 `auto` 会逐个检查**所有**已安装发行版——多发行版机器上是数分钟
87
102
  的开销(收窄到单个发行版的 quick 运行只需数秒)。因此 handler 给子进程设了
88
103
  时限(解析出发行版时 120 秒、交给配置决定时 60 秒,均低于命令面自身的
89
- 截止时间),停摆或未收窄的运行会给出消息,说明本次检查的目标与如何收窄。
104
+ 截止时间),并按 `2T + 2s < 预算` 传入 `--probe-timeout`,让一次卡住的探针
105
+ 在自己的截止时间内落地为 `unknown`,而不是被外层整体超时掩盖;停摆或未收窄
106
+ 的运行会给出消息,说明本次检查的目标与如何收窄。
90
107
  - **`wsl_doctor` 模型工具**——经 `doctorReport()` 进程内采集,会合并常驻
91
108
  agent 的实时状态。采集是异步的:doctor 子进程不再阻塞宿主,工具调用的取消
92
109
  会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
@@ -48,8 +48,8 @@ operations never use the 9p share.
48
48
  fails explicitly too (rg's error code 2, because `1` means "no matches").
49
49
  Commands and the resident agent both inherit `wsl.exe`'s default PATH, so a
50
50
  user-local install under `~/.local/bin` is invisible — install it
51
- system-wide, or somewhere on that PATH. Install: `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
52
- git ripgrep inotify-tools` (or the detected family's spelling). `--install` runs it
51
+ system-wide, or somewhere on that PATH. Install: `wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap git ripgrep inotify-tools"`
52
+ (or the detected family's spelling). `--install` runs it
53
53
  only for a missing `bubblewrap`.
54
54
  - **`watch()` is coarse invalidation, not per-file notifications**: inotify events
55
55
  coalesced to 0.5 s, or a `find -newer` poll loop otherwise. The polling path misses
@@ -61,6 +61,14 @@ operations never use the 9p share.
61
61
  - `editText` reads the whole file into memory before writing it back.
62
62
  - A distro that dies with a request in flight spends the resident's one rebuild;
63
63
  still down, the resident stays out until the app restarts.
64
+ - **The native agent is demoted only on evidence, and tried again** — there is
65
+ one shared agent instance per distro, and it recovers through its own rebuild
66
+ and revival budget rather than being replaced. The reads move to the shell
67
+ agent only when the native entry fails a start and the shell entry then
68
+ starts on the same distro, and native is tried again after five minutes. A
69
+ distro that is down fails both entries alike, which is not held against the
70
+ native one; a failed preparation (copy, digest, execute check) is not
71
+ remembered as a verdict either — the next start prepares again.
64
72
 
65
73
  ## The GUI workspace-files service
66
74
 
@@ -81,23 +89,67 @@ operations never use the 9p share.
81
89
  upstream `FileReferenceTraversal` seam:
82
90
  [UPSTREAM-FILE-REFERENCE-SEAM.md](UPSTREAM-FILE-REFERENCE-SEAM.md).
83
91
 
92
+ ## Bundled skills
93
+
94
+ `preset-wsl` keeps the row set of the app's own standard mode, and its
95
+ `skill-filesystem` row carries the upstream `customSkillDirs` unchanged: the
96
+ `skills` directory the agent preset package ships inside the app's
97
+ installation. That directory is on the host, while this preset's filesystem is
98
+ the distro's:
99
+
100
+ - **Bundled skills are read through the distro's `/mnt/<drive>/…`**: `wsl-fs`
101
+ maps a host drive path to the distro's mount point and the resident agent
102
+ reads it (measured 2026-11-24: an unpacked host directory resolves and
103
+ lists). A distro that mounts its drives elsewhere (`automount.root` in
104
+ `/etc/wsl.conf`) cannot read them.
105
+ - **A WSL session on the Desktop package has no bundled skills**: the app's
106
+ `node_modules` live inside the `app.asar` archive, `/mnt/c/…/app.asar/…` is
107
+ not a directory inside the distro, and `wsl-fs` refuses it with
108
+ `FS_NOT_DIRECTORY` (measured 2026-11-24). The skill provider treats such a
109
+ root as absent and skips it, so the bundled `dsh-doc` never reaches the tool
110
+ surface, while the other skill roots (the project's and the user's
111
+ directories) are unaffected. The host mode reads the archive through the app
112
+ process and has no such limit.
113
+
84
114
  ## The sandbox
85
115
 
86
116
  - **The one-shot fallback has only the host deadline** — a killed `wsl.exe` does not
87
117
  relay the kill into the distro, so the Linux process tree can outlive the call.
88
118
  Prefer `agent: true` and the session runtime for long commands.
119
+ - **A command in flight when the resident is lost is not run again** — a command the
120
+ resident never took (dead, backing off, handshake failed) falls back to the one-shot
121
+ `wsl.exe`. When the resident dies while a command is running, the command may
122
+ already have taken effect: it fails as "state is unknown", with the advice to
123
+ inspect the distro first, and is not executed a second time on the one-shot path.
89
124
  - **Batch reads share one native agent per distro** (16 concurrent calls in
90
125
  2.4-4.1 ms; first call pays ~70 ms preparation).
91
126
  - **aarch64 runs under qemu in CI only** (no Windows-on-ARM machine in reach —
92
127
  [COMPATIBILITY.md](COMPATIBILITY.md#scope-decisions)). `auto` still selects the
93
128
  packaged binary; `native` refuses on preparation failure; `shell` forces the shell
94
129
  agent.
130
+ - **The hosted cloud WSL gate runs the full probe suite as the distro's root
131
+ user** — `.github/workflows/cloud-wsl-gate.yml` executes
132
+ `run-all-when-closed.sh` through `-u root` and enables linger for root only. A
133
+ real deployment uses an ordinary distro user: the unprivileged user namespace,
134
+ the user-level systemd manager and its linger are a different path, so passing
135
+ as root does not prove the non-root path. That path stays with the
136
+ maintainer-run real-machine probes; this gate does not claim to cover it
137
+ (#88).
95
138
  - **The session runtime needs systemd and a lingering user manager** — refused on the
96
139
  first command with the remedy otherwise; `sessionSandbox` set to `auto`
97
140
  (per-command without systemd) or `false` keeps the old per-command shape.
98
141
  A hard app crash can leave a stale `dsh-wsl-*.scope`; the
99
142
  preflight sweeps stale scopes on the next WSL session (never another live
100
143
  session's).
144
+ - **A session runtime is released with the session's agent** — when the agent is
145
+ disposed (upstream's `agent/disposed`), both providers drop their references
146
+ for that session, the scope stops, and the background processes inside it are
147
+ reaped. The current harness (≤ 0.2.2-rc.5) does not dispose an agent when a
148
+ session view is closed — agents live until the app exits — so until then every
149
+ session that ran a command keeps one runtime. A fallback sweep underneath ends
150
+ a session whose runtimes have been quiet for ten minutes with no live agent
151
+ behind them (or that never named a session); a live session's runtime has no
152
+ idle limit.
101
153
  - **The sandbox does not govern WSL interop** — reported as `enforcement: partial`.
102
154
  `maskWindowsDrive` and `interopVisibility` narrow `/mnt` but are not a closure;
103
155
  even `interopVisibility: "disabled"` only produces the `wsl.conf`
@@ -170,7 +222,10 @@ absolute path to pin one.
170
222
  (`doctorReport` merges `WslAgent.status()` via `mergeLiveResidentStatus`,
171
223
  0.18.0), but the CLI's handshake check still names its probe source
172
224
  (`probed: a fresh resident`); without an app-side call the `lastError`
173
- stays in the app log.
225
+ stays in the app log. A resident that is dead fails the merged check and the
226
+ report's verdict follows; a resident that recovered keeps the fresh probe's
227
+ verdict, and when the reads are not on the native agent the merged detail
228
+ says why.
174
229
  - **`dsh-wsl-*.scope` counts are point-in-time**; `--fix` runs the preflight's sweep.
175
230
  - **The doctor's `git.win-safe` probe reports the Windows git trust through interop
176
231
  `git.exe`** — the `safe.directory` whitelist that WSL change review needs when
@@ -243,9 +298,13 @@ sandbox's security statement: `enforcement: partial` is untouched.
243
298
 
244
299
  ## Ports
245
300
 
246
- - **The port poller keeps the resident agent permanently warm** per active distro
247
- (refresh 10 s). Raising `portsRefreshMs` past the agent's idle timeout restores
248
- idle shutdown, at the cost of staler port facts.
301
+ - **The port poller keeps the resident agent warm for the distros in use** — it
302
+ refreshes every `portsRefreshMs` (10 s by default) while a live session works
303
+ in a distro, and stops with the last of them, which is when the agent can
304
+ idle out. Each round asks WSL which distros are running first: a stopped
305
+ distro is not probed (the probe would boot it) and `DSH_WSL_PORTS` reads
306
+ empty for it. Raising `portsRefreshMs` past the agent's idle timeout brings
307
+ idle shutdown forward, at the cost of staler port facts.
249
308
 
250
309
  ## The directory picker
251
310