dsh-plugin-wsl-env 0.25.0 → 0.26.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 (70) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CODE_OF_CONDUCT.zh.md +85 -0
  4. package/CONTRIBUTING.md +19 -3
  5. package/CONTRIBUTING.zh.md +200 -0
  6. package/README.md +55 -149
  7. package/SECURITY.md +2 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +4 -2
  10. package/SUPPORT.zh.md +99 -0
  11. package/client.js +409 -8
  12. package/cordis.patch.yml +13 -0
  13. package/docs/AGENT-PROTOCOL-V7.md +2 -2
  14. package/docs/API.md +2 -0
  15. package/docs/API.zh.md +38 -0
  16. package/docs/ARCHITECTURE.md +15 -4
  17. package/docs/ARCHITECTURE.zh.md +518 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +7 -10
  21. package/docs/CONFIGURATION.zh.md +7 -9
  22. package/docs/DIAGNOSTICS.md +24 -0
  23. package/docs/DIAGNOSTICS.zh.md +13 -0
  24. package/docs/LIMITATIONS.md +43 -5
  25. package/docs/LIMITATIONS.zh.md +34 -6
  26. package/docs/MIGRATION.md +10 -4
  27. package/docs/MIGRATION.zh.md +94 -0
  28. package/docs/PEER-PARITY.md +75 -47
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +29 -15
  32. package/docs/QUICKSTART.zh.md +25 -17
  33. package/docs/README.zh.md +69 -150
  34. package/docs/RELEASING.md +4 -3
  35. package/docs/REQUIREMENTS.zh.md +4 -2
  36. package/docs/ROADMAP-1.0.md +2 -2
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  39. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  40. package/docs/VALUE.md +173 -0
  41. package/docs/VALUE.zh.md +42 -13
  42. package/docs/screenshots/with-plugin.png +0 -0
  43. package/docs/screenshots/with-plugin.svg +59 -0
  44. package/docs/screenshots/with-plugin.zh.png +0 -0
  45. package/docs/screenshots/with-plugin.zh.svg +56 -0
  46. package/docs/screenshots/without-plugin.png +0 -0
  47. package/docs/screenshots/without-plugin.svg +50 -0
  48. package/docs/screenshots/without-plugin.zh.png +0 -0
  49. package/docs/screenshots/without-plugin.zh.svg +45 -0
  50. package/lib/auto-preset-seam.d.ts +45 -0
  51. package/lib/auto-preset-seam.js +47 -0
  52. package/lib/auto-preset.d.ts +33 -10
  53. package/lib/auto-preset.js +148 -44
  54. package/lib/doctor-live.d.ts +30 -0
  55. package/lib/doctor-live.js +37 -0
  56. package/lib/doctor-report.js +10 -3
  57. package/lib/messages.d.ts +19 -0
  58. package/lib/messages.js +28 -0
  59. package/lib/open-in-app.d.ts +206 -0
  60. package/lib/open-in-app.js +300 -0
  61. package/lib/peer-versions.d.ts +53 -0
  62. package/lib/peer-versions.js +137 -0
  63. package/lib/preset-choice.d.ts +13 -0
  64. package/lib/preset-choice.js +18 -1
  65. package/lib/status.js +2 -1
  66. package/lib/update-check.d.ts +2 -2
  67. package/lib/update-check.js +2 -2
  68. package/lib/wsl-doctor-command.js +4 -2
  69. package/package.json +55 -25
  70. package/scripts/doctor.mjs +127 -9
@@ -0,0 +1,117 @@
1
+ # 兼容性矩阵
2
+
3
+ [English](COMPATIBILITY.md)
4
+
5
+ 以下是 [`ROADMAP-1.0.md`](ROADMAP-1.0.md)(WSL-202)中支持分级的实测证据。
6
+ 下表的每一行都于 **2026-10-26** 在同一台机器的真实 WSL2 发行版上执行
7
+ (x86_64、Windows 11、WSL 2、内核 6.18),探针套件位于
8
+ [`test/probe/`](https://github.com/Big-Dao/dsh-plugin-wsl-env/tree/main/test/probe/),
9
+ 从每个发行版内部针对全新的 `--depth 1` 克隆运行。aarch64 原生 agent 另在 CI
10
+ 中每次 push 于 qemu 下执行——见
11
+ [`.github/workflows/ci.yml`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/workflows/ci.yml)
12
+ 中的 `native-package` 作业;仅 VM 验证是既定决策——见下文“范围决策”。
13
+
14
+ ## 矩阵
15
+
16
+ | | Ubuntu(宿主,Tier 1) | Debian 13.5 | Fedora 44 | openSUSE Tumbleweed | Arch | Alpine 3.22 |
17
+ |---|---|---|---|---|---|---|
18
+ | init | systemd | systemd | systemd | systemd | systemd | busybox/OpenRC |
19
+ | libc | glibc | glibc | glibc | glibc | glibc | musl |
20
+ | bwrap | 0.12 | 0.12 | 0.12 | 0.13.1 | 0.13.1 | 0.12 |
21
+ | node | 24 | 20.19 | 22.23 | 26.12 | 26.12 | 22.23 |
22
+ | `sandbox.sh` | 14/14 | 14/14 | 14/14 | 14/14 | 14/14 | 15/15 |
23
+ | `agent.sh` | 11/11 | 11/11 | 11/11 | 11/11 | 11/11 | 11/11 |
24
+ | `exec.sh` | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
25
+ | `substrate.sh` | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 |
26
+ | `watch.sh` | 7/7 | 7/7 | 7/7 | 7/7 | 7/7 | 5/5 |
27
+ | `session-sandbox.sh` | 10p 1s | 10p 1s | 3p 1r 1s | 3p 1r 1s | 3p 1r 1s | 3p 1d 1s |
28
+
29
+ `p` = 通过,`s` = 跳过,`r` = 竞态,`d` = 已声明限制。每行结论依据
30
+ [`ROADMAP-1.0.md`](ROADMAP-1.0.md):Ubuntu、Debian、Fedora、openSUSE 和
31
+ Arch 为**已支持**;Alpine 在非 systemd 范围声称的全部内容上为**已支持**,
32
+ 但 `sessionSandbox: auto` 范围更窄。
33
+
34
+ **Debian 已端到端验证**:除发行版内部套件外,四个 harness 级探针
35
+ (`run.sh`、`terminal.sh`、`picker.sh`、`fs-routing.sh`)也针对
36
+ `wslfs-debian` profile 通过(2026-10-26)——是完整技术栈,而非只有发行版内
37
+ 那一半。
38
+
39
+ ## 首次运行发现的陷阱:工作区根目录缺失
40
+
41
+ Debian 的 harness 级运行暴露出一个真实发现:**当工作区根目录尚不存在时,
42
+ 受限常驻进程拒绝启动**。bwrap profile 绑定工作区根目录
43
+ (`--bind <root> <root>`),bwrap 要求绑定源存在,而在刚导入的发行版上,
44
+ 探针的工作区(`~/.dsh-fsprobe`)并不存在。对该根目录执行 `mkdir -p` 后,
45
+ 十个失败步骤全部变绿。此前每次 Ubuntu 运行都因早期探针留下了该目录,所以
46
+ 这个陷阱从未在那里触发。任何工作区,只要其目录由首次写入惰性创建,在全新
47
+ 发行版上都会撞上同一堵墙。已在 aa12b49 修复:受限工厂的 prepare 钩子现在
48
+ 在 bwrap 运行前创建根目录(`mkdir -p`),握手失败时若仍发生,会携带常驻
49
+ 进程的 stderr,`substrate.sh` 还新增一条全新根目录分支,每次运行都针对不
50
+ 存在的工作区根目录启动常驻进程,并已在 Debian(glibc)和 Alpine(musl)上
51
+ 验证。
52
+
53
+ ## 两处已解释的差异
54
+
55
+ - **`session-sandbox.sh`,后台存活分支(Fedora、openSUSE、Arch)。**
56
+ 同为 systemd 的发行版在通过 `wsl.exe` 驱动时对该检查出现分化(Debian
57
+ 通过,另外三个不通过):探针只给 0.5 s 窗口,而 WSL 会话拆除与之竞态。
58
+ 这是探针上下文造成的假象,不是插件的主张——插件的后台进程保证依托
59
+ systemd 瞬态 scope,而该分支探针自身标注为“从 WSL 终端运行”。在 Alpine
60
+ 上,同一分支**按声明**失败:没有 systemd 时插件不承诺后台存活,
61
+ `sessionSandbox: auto` 改为报告更窄的按命令范围。
62
+
63
+ - **`watch.sh` 在 Alpine 上(5/5)。** 两项检查在其他发行版上走 inotify
64
+ 快速路径,在那里走轮询回退;两种行为都已发布且都有断言,所以计数更低
65
+ 反映的是该内核/libc 上被覆盖的路径更少,而不是承诺更弱。
66
+
67
+ ## Tier 2 安装说明(那些陷阱,免得下一次导入重新踩坑)
68
+
69
+ | 发行版 | 关键的安装步骤 |
70
+ |---|---|
71
+ | Debian | 首次启动可能在 OOBE 完成前卡死(`wsl.exe` exec 和 `--terminate` 都会挂起)。等状态变为 Stopped 后执行一次 `wsl --terminate <distro>`,再以 root 启动以跳过 OOBE。systemd 开箱即 PID 1。 |
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`。 |
74
+
75
+ 在最小 Alpine 镜像上,**shell** agent 的 FSB 枚举需要 GNU `findutils`
76
+ (BusyBox 的 `find` 缺少 `-printf`);随包的原生 agent 不需要,`auto` 会
77
+ 优先选择它。仅在锁定 `agentBackend: shell` 时才安装 `findutils`——doctor
78
+ 会解码该失败并指出这个包。
79
+
80
+ 各处使用的依赖:`bash bubblewrap git nodejs`(node 20–26 均通过;插件的
81
+ `engines` 下限针对 harness 宿主,而非探针节点)。每个发行版的探针运行方式,
82
+ 在发行版内部执行:
83
+
84
+ ```sh
85
+ git clone --depth 1 https://github.com/Big-Dao/dsh-plugin-wsl-env.git
86
+ cd dsh-plugin-wsl-env
87
+ for p in sandbox session-sandbox agent exec substrate watch; do bash test/probe/$p.sh; done
88
+ ```
89
+
90
+ harness 级探针(`run.sh`、`terminal.sh`、`picker.sh`、`fs-routing.sh`)还
91
+ 需要关闭应用,并使用 `run.sh` 头部给出的临时 `wslfs` profile;在第二个
92
+ 发行版上,复制该 profile 并设置其 `distro:` 键。
93
+
94
+ ## 范围决策
95
+
96
+ - **aarch64 仅在 VM 中验证;物理硬件不在范围内(决定日期 2026-10-27)。**
97
+ qemu-user CI 分支每次 push 都对随包二进制执行完整的 18 项检查套件,覆盖
98
+ agent 自身的代码路径;真实硬件唯一能补充的,是对 aarch64 芯片边缘案例的
99
+ 暴露,而本项目可触及的 Windows-on-ARM 设备都无法提供这种暴露。支持表将 aarch64
100
+ 标记为“supported (executed in CI)”,并保持如此。
101
+
102
+ - **Windows 10 未单独验证(决定日期 2026-10-27)。** 插件的全部表面是
103
+ `wsl.exe`、发行版和 UNC 共享;在 WSL2 上,这些组件在 Windows 10 与
104
+ Windows 11 上相同,版本相关行为位于上游 WSL 本身,而不在本插件挂载的
105
+ 任何内容中。上表测量的是 Windows 11;欢迎通过支持渠道提交 Win10 报告,
106
+ 但不计划单独验证。
107
+
108
+ ## 尚未测量
109
+
110
+ - 由真实 WSL 终端会话驱动的非 systemd 会话范围(探针跳过的分支)。
111
+ - ~~容器镜像~~——2026-10-27 关闭:`test/agent-container.mjs` 在 CI 中于
112
+ `debian:stable-slim`、`alpine:3`、`fedora:latest`、
113
+ `opensuse/tumbleweed` 和 `archlinux` 容器内运行真实的 shell agent
114
+ (`agent-containers` 作业,每个镜像一个),各 7 项检查——与就地 digest
115
+ 的握手、PING、带退出码和两个流的 EXEC、SETENV,以及在各系列实际有差异处
116
+ 检查 `sha256sum`/`base64` 是否存在(Alpine 上是 busybox,其他地方是
117
+ coreutils)。首次执行 35/35。
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- *The Chinese version ([CONFIGURATION.zh](CONFIGURATION.zh.md)) is authoritative; this page is its English translation.*
3
+ [中文](CONFIGURATION.zh.md)
4
4
 
5
5
  ## Profile patches
6
6
 
@@ -50,10 +50,8 @@ that row unless you pass `--force`. Prefer manual merging for existing profiles.
50
50
 
51
51
  To edit the preset manually, replace the entire `preset-wsl` row. Its config is
52
52
  not deep-merged: preserve `id`, `order`, and every item in `plugins`. Copy the
53
- current block from `cordis.patch.yml` or from
54
- `dsh --profile <name> --dump-config` (CLI distribution — the desktop app has no
55
- `dsh` command), then change the nested values. Re-copy it
56
- after a plugin upgrade that changes the preset.
53
+ current block from the profile's `cordis.patch.yml`, then change the nested
54
+ values. Re-copy it after a plugin upgrade that changes the preset.
57
55
 
58
56
  ### `wsl-shell`
59
57
 
@@ -182,7 +180,7 @@ The root router is app-level, not session-owned, so it does not use
182
180
  | `auto-preset` | `preset` | `wsl` | Preset to bind when a session workspace is inside a distro. An explicit operator selection is preserved. |
183
181
  | | `attempts` | `6` | Number of attempts to bind the preset. |
184
182
  | | `retryMs` | `150` | Delay between attempts, in milliseconds. |
185
- | | `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. |
183
+ | | `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. |
186
184
  | `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
187
185
  | | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
188
186
  | | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
@@ -426,10 +424,9 @@ language without re-probing. `--yes` skips the confirmation prompt (not the
426
424
  confirmation gate itself), and `--read-only` refuses to run together with
427
425
  `--fix` or `--install`.
428
426
  See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
429
- error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
430
- the composed profile without booting it and shows whether a row override
431
- applied; the desktop app has no `dsh` command, so read `cordis.patch.yml` and
432
- the Plugins page there.
427
+ error-code map. Whether a row override applied, read from the profile's
428
+ `cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
429
+ so the composed profile has no command-line view.
433
430
  The sidebar's **WSL environment** panel renders the same quick digest over
434
431
  `GET /api/wsl-env/status` and posts the full-run action to the same route: a
435
432
  doctor run with `--fix-owned`, which sweeps stale session scopes and purges a
@@ -1,6 +1,6 @@
1
- # Configuration
1
+ # 配置
2
2
 
3
- _本页是权威版本;英文译本见 [CONFIGURATION](CONFIGURATION.md)。_
3
+ [English](CONFIGURATION.md)
4
4
 
5
5
  ## Profile patch
6
6
 
@@ -48,9 +48,8 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
48
48
 
49
49
  要手动编辑 preset,需替换整个 `preset-wsl` 行。它的 config
50
50
  不做深度合并:保留 `id`、`order` 以及 `plugins` 中的每一项。
51
- 从 `cordis.patch.yml` 或 `dsh --profile <name> --dump-config`
52
- (CLI 发行版;桌面应用没有 `dsh` 命令)
53
- 复制当前块,再修改嵌套的值。插件升级改变了 preset 后要重新复制。
51
+ 从 profile 的 `cordis.patch.yml` 复制当前块,再修改嵌套的值。
52
+ 插件升级改变了 preset 后要重新复制。
54
53
 
55
54
  ### `wsl-shell`
56
55
 
@@ -172,7 +171,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
172
171
  | `auto-preset` | `preset` | `wsl` | 会话工作区位于发行版内时绑定的 preset。操作者的显式选择会被保留。 |
173
172
  | | `attempts` | `6` | 绑定 preset 的尝试次数。 |
174
173
  | | `retryMs` | `150` | 两次尝试之间的延迟,单位毫秒。 |
175
- | | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。 |
174
+ | | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。落在这些目录的会话会在输入框上方与 **WSL 环境** 面板中被点明,并提供回到发行版环境的办法。 |
176
175
  | `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
177
176
  | | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
178
177
  | | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
@@ -386,9 +385,8 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
386
385
  无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
387
386
  `--read-only` 拒绝与 `--fix` 或 `--install` 同用。
388
387
  判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
389
- CLI 发行版可用 `dsh --profile <name> --dump-config` 检查合成后的 profile,
390
- 无需真正启动;输出会显示某行的覆盖是否生效。桌面应用没有 `dsh` 命令,
391
- 请直接查看 `cordis.patch.yml` 与 Plugins 页面。
388
+ 某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
389
+ 桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
392
390
  侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要,
393
391
  并把完整运行动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
394
392
  session scope、清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
@@ -1,5 +1,7 @@
1
1
  # Diagnostics: the doctor and the error-code map
2
2
 
3
+ [中文](DIAGNOSTICS.zh.md)
4
+
3
5
  Every refusal this plugin produces is named. This page is the map between
4
6
  those names and the doctor: for each error code, whether the `doctor`
5
7
  (`pnpm run doctor`, or `node scripts/doctor.mjs --json`) covers its
@@ -105,6 +107,28 @@ posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
105
107
  never reports. This is the only surface that depends on the model path; use
106
108
  the command or the CLI when the plugin's runtime itself is under suspicion.
107
109
 
110
+ One check is surface-dependent by construction: `session.preset-seam` reports
111
+ whether `auto-preset` could wrap the host's `agents.createSession` in this
112
+ process. That is host-process state, so the standalone CLI cannot see it; the
113
+ command, the panel and the model tool merge the row in. A missing row in a CLI
114
+ report means "not observable from a subprocess", not "the seam is fine".
115
+
116
+ `peers.versions` is surface-dependent for the same reason: it asks which peer
117
+ copies this process loads. The host runtime projects a linked plugin's declared
118
+ peers onto the installation's single copies, so the same plugin can load the
119
+ app's versions while a separate Node process resolves something else. Before
120
+ the check learned the plugin's peer position, the standalone CLI's native
121
+ lookup walked past the mirror into an older `node_modules` above it — the tree
122
+ an earlier harness installation left behind — and compared that tree's
123
+ versions. It now stops at the first position that declares the peer (the
124
+ plugin's own), counts the copy there, and reports every other peer as
125
+ unchecked, never as a failure. The in-app surfaces (panel, `/wsl-doctor`,
126
+ `wsl_doctor`) instead hand the versions this process resolved to the doctor
127
+ child in `DSH_WSL_DOCTOR_PEERS`. A present variable is authoritative even when
128
+ the map is partial or empty: the peers it omits could not be resolved by the
129
+ host, so they are unchecked rather than looked up again in the plugin's
130
+ physical tree.
131
+
108
132
  ## The map
109
133
 
110
134
  Class legend:
@@ -1,5 +1,7 @@
1
1
  # 诊断:doctor 与错误码地图
2
2
 
3
+ [English](DIAGNOSTICS.md)
4
+
3
5
  本插件产生的每一个拒绝都有名字。本页是这些名字与 doctor 的对照表:
4
6
  对每个错误码,说明 `doctor`(`pnpm run doctor`,或
5
7
  `node scripts/doctor.mjs --json`)是否覆盖其前置条件、由哪个检查 id 应答。
@@ -83,6 +85,17 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
83
85
  会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
84
86
  结论。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,用命令或 CLI。
85
87
 
88
+ `peers.versions` 也按入口而异,因为它问的是本进程实际加载的对等包版本。宿主
89
+ 运行时会把链接插件声明的 peer 投影到安装处的同一份副本上,所以同一份插件在
90
+ 应用内加载的是应用自带的版本,而独立 Node 进程解析到的可能完全不同。修复前,
91
+ 独立 CLI 的原生查找会越过镜像、落进其上方的旧 `node_modules`——上一次
92
+ harness 安装留下的树——并比较那棵树的版本。现在查找在第一个声明该 peer 的
93
+ 位置(插件自身)停止,只计入那里的副本,其余记作 unchecked,而不是失败。
94
+ 应用内入口(面板、`/wsl-doctor`、`wsl_doctor`)则把本进程解析出的版本经
95
+ `DSH_WSL_DOCTOR_PEERS` 交给 doctor 子进程;该变量一旦出现就是权威答案,即使
96
+ 映射为空或只有部分项——缺失项说明宿主没有解析到,doctor 记作 unchecked,不再
97
+ 回退到插件目录旁的本地副本。
98
+
86
99
  ## 地图
87
100
 
88
101
  类别图例:
@@ -1,6 +1,6 @@
1
1
  # Limitations
2
2
 
3
- *The Chinese version ([LIMITATIONS.zh](LIMITATIONS.zh.md)) is authoritative; this page is its English translation.*
3
+ [中文](LIMITATIONS.zh.md)
4
4
 
5
5
  What the plugin does not do, and why. A limitation that is documented is a design
6
6
  boundary; one that is not is a bug report waiting to happen. Each entry states the
@@ -203,6 +203,24 @@ sandbox's security statement: `enforcement: partial` is untouched.
203
203
  notification.** Removing the `wsl-preflight` row silences the probe entirely.
204
204
  A blocked message marks its remedy as operator action to ask the user about;
205
205
  ready verdicts are not sent.
206
+ - **The access-mode reminder is plugin-owned UI, not a notice seam.** It renders
207
+ in the composer dock when the client's session list carries the `agentPreset`
208
+ projection; the `auto-preset` settings row supplies the target preset and the
209
+ recorded directories, and an unreadable or throwing row falls back to `wsl`
210
+ with no recorded directories — a visible warning, never silence. It never
211
+ infers an environment from the path alone. Without the web client (CLI,
212
+ headless) the same state reaches the operator only through the log, and the
213
+ model through the runtime-context entry.
214
+ - **The creation-time preset binding depends on the host's private controller
215
+ shape.** `auto-preset` wraps `sessionController.agents.createSession` so a
216
+ distro workspace's first mount is already the WSL preset; 0.2.1 replaced the
217
+ older `ensureSession(sessionId, cwd, …, presetId)` frame with that request
218
+ object. If a future host changes it again, the wrapper goes inactive: sessions
219
+ still adopt the WSL preset after creation through `agent/created`, but a first
220
+ turn that starts inside that window can run on the host environment (the
221
+ Windows ACL sandbox cannot carry a `\\wsl.localhost` path). The mount warns,
222
+ and the doctor's `session.preset-seam` row reports active/inactive — in the
223
+ in-app surfaces only, because the standalone CLI cannot see host-process state.
206
224
 
207
225
  ## Ports
208
226
 
@@ -266,10 +284,16 @@ sandbox's security statement: `enforcement: partial` is untouched.
266
284
 
267
285
  ## Host "Open in app"
268
286
 
269
- - **Opening VS Code from "Open in app" can fail independently of this plugin** — the
270
- Host runs with `ELECTRON_RUN_AS_NODE=1`, which the launcher inherits, so
271
- `Code.exe` starts as Node and exits 1. Not owned by this repository:
272
- [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md).
287
+ - **The plugin's "Open in VS Code (WSL)" menu item works; the shipped "Open in
288
+ app" item still does not.** The `wsl-open-in-app` row scrubs
289
+ `ELECTRON_RUN_AS_NODE` from the **editor child's** environment, so VS Code
290
+ starts as an application; the route converts a WSL UNC workspace to its
291
+ `vscode-remote` URI and the editor lands in Remote-WSL. The scrub is
292
+ deliberately child-scoped: deleting the name from the Host process
293
+ environment breaks Node-mode helpers such as the Windows Job runner. The
294
+ shipped item keeps inheriting the flag and still fails; that half belongs
295
+ upstream: [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md). Nothing patches
296
+ `app.asar`, so an app upgrade cannot drop the plugin's half.
273
297
  - **WSL files open again, but relative Markdown images no longer render in the
274
298
  WSL preview.** The router's `processPath` now answers in UNC host spelling —
275
299
  the shape `session.openWorkspacePath` / `workspacePathApplications` verify
@@ -277,3 +301,17 @@ sandbox's security statement: `enforcement: partial` is untouched.
277
301
  a Markdown preview's relative image does not resolve. Chat images already had
278
302
  that gap (the Session cwd is UNC). The same spelling is why the GUI change
279
303
  feed, `stat.absolutePath`, and the preview header's path label carry UNC.
304
+
305
+ ## Sidebar terminal font
306
+
307
+ - **The terminal font is a DSH user setting, not a plugin setting.** On
308
+ `0.2.2-rc.2` the sidebar terminal renders `ui-theme.terminalFontFamily` (an
309
+ empty value falls back to the built-in `ui-monospace`/Consolas stack), and
310
+ that field lives in the profile's `cordis.patch.yml`. Set it once in
311
+ **Settings → General → Fonts → terminal font** rather than hand-editing the
312
+ profile; a hand-added row is lost when Desktop's fatal recovery renames the
313
+ profile patch to a `.bak-*` sibling. If the choice must survive that recovery,
314
+ mirror the complete `ui-theme` row in `$DSH_HOME/cordis.patch.yml` — the
315
+ home-level layer is not renamed, and a patch replaces the row's whole config,
316
+ so restate every field you keep. The plugin does not own renderer typography
317
+ and never writes this setting.
@@ -1,6 +1,6 @@
1
- # Limitations
1
+ # 限制与不承诺
2
2
 
3
- _本页是权威版本;英文译本见 [LIMITATIONS](LIMITATIONS.md)。_
3
+ [English](LIMITATIONS.md)
4
4
 
5
5
  插件不做什么,以及为什么。写进文档的限制是设计边界;
6
6
  没写进文档的迟早会变成 bug 报告。每一条都说明限制本身和补救方法;
@@ -180,6 +180,19 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
180
180
  - **runtime context 条目是重复的快照,不是可关闭的通知。**
181
181
  移除 `wsl-preflight` 行即可让该探针完全静音。阻塞消息把修复标记为用户操作;
182
182
  ready 裁决不再发送。
183
+ - **访问方式提醒是插件自有 UI,不是通知接缝。** 只要客户端的会话列表带有
184
+ `agentPreset` 投影,它就渲染在输入框上方;`auto-preset` 设置行提供目标 preset
185
+ 与已记录目录,读取失败或抛错时回退到 `wsl` 且视为无记录——显示警示,绝不静默。
186
+ 它绝不只凭路径猜测环境。没有 Web 客户端时(CLI、headless),同一状态只通过
187
+ 日志到达操作者,通过 runtime context 条目到达模型。
188
+ - **创建期环境绑定依赖宿主私有的 controller 形状。** `auto-preset` 包装
189
+ `sessionController.agents.createSession`,使发行版工作区的首次挂载就是 WSL
190
+ preset;0.2.1 用这个请求对象替换了更早的
191
+ `ensureSession(sessionId, cwd, …, presetId)` 帧。宿主将来再改形状时包装会
192
+ 失效:会话仍会经 `agent/created` 在创建后切换到 WSL preset,但落在这个窗口内
193
+ 开始的首轮可能在宿主环境里运行(Windows ACL 沙箱无法承载
194
+ `\\wsl.localhost` 路径)。挂载时会告警,doctor 的 `session.preset-seam`
195
+ 行报告 active/inactive——只在应用内界面可见,独立 CLI 看不到宿主进程状态。
183
196
 
184
197
  ## 端口
185
198
 
@@ -235,13 +248,28 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
235
248
 
236
249
  ## 宿主的"在应用中打开"
237
250
 
238
- - **从"在应用中打开"启动 VS Code 可能独立于本插件而失败** ——
239
- 宿主带着 `ELECTRON_RUN_AS_NODE=1` 运行,启动器会继承它,于是
240
- `Code.exe` 以 Node 身份启动并以退出码 1 结束。不属于本仓库管:
241
- [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md)。
251
+ - **插件的"在 VS Code 中打开(WSL)"菜单项可用;随包的"在应用中打开"仍然
252
+ 失败。** `wsl-open-in-app` 行只从**编辑器子进程**的环境里删除
253
+ `ELECTRON_RUN_AS_NODE`,VS Code 因此按应用启动;路由把 WSL UNC 工作区转换为
254
+ `vscode-remote` URI,编辑器直接进入 Remote-WSL。这个清理刻意只作用于子进程:
255
+ 从 Host 进程环境删除会破坏 Windows Job runner 这类需要继承该变量的
256
+ Node 模式辅助进程。随包入口仍继承该变量,所以仍然失败;那一半属于上游:
257
+ [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md)。两半都不修改
258
+ `app.asar`,应用升级不会丢掉插件这一半。
242
259
  - **WSL 文件可以正常打开,但预览里的相对 Markdown 图片不再渲染** ——
243
260
  路由的 `processPath` 现在返回 UNC 宿主拼写,这是
244
261
  `session.openWorkspacePath` / `workspacePathApplications` 校验所要求的形态
245
262
  (issue #37);客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径,因此 Markdown
246
263
  预览中的相对图片无法解析。聊天侧因 cwd 本就是 UNC,此前已有同一缺口。
247
264
  GUI change feed、`stat.absolutePath` 与预览头部的路径标签的 UNC 形态也源于同一拼写。
265
+
266
+ ## 侧栏终端字体
267
+
268
+ - **终端字体是 DSH 用户设置,不是插件设置。** 在 `0.2.2-rc.2` 上,侧栏终端渲染
269
+ `ui-theme.terminalFontFamily`(空值回退到内置 `ui-monospace`/Consolas 栈),
270
+ 该字段存放在 profile 的 `cordis.patch.yml`。请在
271
+ **设置 → 通用 → 字体 → 终端字体** 里设置一次,不要手改 profile;Desktop 的
272
+ 致命错误恢复会把 profile patch 改名为 `.bak-*` 兄弟文件,手加的行随之丢失。
273
+ 若该选择必须熬过这次恢复,请把完整的 `ui-theme` 行镜像到
274
+ `$DSH_HOME/cordis.patch.yml`:home 层不会被改名,但 patch 会替换该行的整个
275
+ config,因此要重述所有保留字段。插件不拥有渲染层字体,也从不写这项设置。
package/docs/MIGRATION.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Configuration stability and migration
2
2
 
3
+ [中文](MIGRATION.zh.md)
4
+
3
5
  What a release may change, how a breaking configuration change is announced and
4
6
  carried, and which gates a release must clear. The version table in
5
7
  [RELEASING.md](RELEASING.md#1-decide-the-version) is the source for the bump; this
@@ -74,11 +76,12 @@ shows the composed value.
74
76
  | Gate | How | Runs where |
75
77
  |---|---|---|
76
78
  | Config docs and CHANGELOG current | review the diff; `lint:links` covers cross-references | CI |
77
- | `pnpm test` | style, links, requirement citations, doc consistency, syntax, build freshness, tsc, 50 unit files | CI (Node 22/24, Ubuntu + Windows) |
79
+ | `pnpm test` | style, links, requirement citations, doc consistency, syntax, build freshness, tsc, and the unit files | CI (Node 22/24, Ubuntu + Windows) |
78
80
  | `pnpm run test:coverage` | lines 85 / branches 84 / functions 70 | CI (Node 24, Ubuntu) |
79
- | Peer line tested | `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
81
+ | `pnpm run test:browser` | the plugin web bundle in headless Chromium (layout, clicks, badge timing); install Chromium once | CI (`browser` job, Ubuntu) and the release `Gates` |
82
+ | Peer line tested | floor `>=0.2.2-rc.2`; the `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
80
83
  | Packed install/upgrade/uninstall | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker) | manual, this machine (10/10 on 2026-11-06; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
81
- | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md) |
84
+ | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host |
82
85
  | Clean Win11 + Ubuntu first run ≤ 5 min | a clean machine, a stopwatch | **not run** (the project's machine is already configured) |
83
86
  | aarch64 executed | the native 18-check suite under qemu in CI | **run in CI** (physical aarch64 WSL is out of scope; see COMPATIBILITY.md) |
84
87
  | No open P0 bug for 30 days | issue tracker | time-based; cannot be asserted from a checkout |
@@ -94,8 +97,11 @@ ships through the tag workflow, but its notes say which gates were executed.
94
97
  ```bash
95
98
  pnpm run preset --distro default --check <profile>/cordis.patch.yml # no nested-row trap
96
99
  pnpm run doctor --json # effective environment facts
97
- dsh --profile <name> --dump-config # composed rows (CLI distribution)
100
+ pnpm run e2e:install # packed install/upgrade/uninstall chain
98
101
  ```
99
102
 
103
+ The desktop app has no `dsh` command; the composed state is the profile's
104
+ `package.json` and `cordis.patch.yml`, read directly.
105
+
100
106
  A profile that fails to boot after a migration should name the remedy in the
101
107
  error; if it does not, that is a bug — report it with the `doctor --json` output.
@@ -0,0 +1,94 @@
1
+ # 配置稳定性与迁移
2
+
3
+ [English](MIGRATION.md)
4
+
5
+ 发布可以改变什么、破坏性的配置变更如何公布与承接,以及发布必须通过哪些门禁。
6
+ [RELEASING.md](RELEASING.md#1-decide-the-version) 中的版本表是版本号递增的依据;本页是这些递增所遵循的约定。
7
+
8
+ ## 1.0 以下的冻结
9
+
10
+ 包版本低于 `1.0.0`,因此磁盘上的 profile 格式与 peer 钉版仍可能在 **minor** 中变动。
11
+ 在这一自由度内:
12
+
13
+ - **新增配置键属于 minor。** 该键必须带一个保持既有行为的 schema 默认值;
14
+ 仅因存在就改变行为的键属于 major 形态的变更,需要等待。
15
+ - **删除或重命名键属于 major**,*或*属于带启动时拒绝并指明迁移方式的 minor(见下文)。
16
+ 绝不允许静默接受已退役的键:`preset-wsl` 陷阱与 `substrate` 拒绝的存在,
17
+ 正是为了防止这类失败。
18
+ - **改变键的含义属于带迁移说明的 minor**,因为按旧含义写成的 profile 仍会继续启动。
19
+ 说明必须指出改了什么、如何保留旧姿态,以及行为在何处不同。
20
+ - **peer 兼容性按区间声明。** DSH peer 依赖声明下限;开发依赖精确钉版。
21
+ 新的上游 peer 版本线由 [peer canary](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/workflows/peer-canary.yml) 测试;
22
+ 受测基线或支持区间的变化应写入发布说明。
23
+ - **工具名与错误码是 API。** `FS_OUTSIDE_DISTRO`、`SANDBOX_UNAVAILABLE`、
24
+ `FS_STALE_VERSION` 以及诊断脚本(`doctor`、`diagnose`、`preset`、`bootstrap`)
25
+ 保留名称与契约;重命名遵循下文的弃用路径。
26
+
27
+ ## 弃用配置值
28
+
29
+ 1. **在引入弃用的版本中公布**:一条 CHANGELOG 记录,以及
30
+ [CONFIGURATION.md](CONFIGURATION.zh.md) 中的对应行。旧值在该版本中继续可用。
31
+ 2. **含义无歧义时,保留旧写法一个 minor。** 若保留旧写法会静默改变行为,
32
+ 则改为在启动时拒绝并打印迁移方式——`substrate: "share"` 即属此例:
33
+ 该值被拒绝,消息要求删除该行,因为提供 share 恰恰是插件绝不能做的事。
34
+ 3. **在下一个 minor 中移除**,并附另一条 CHANGELOG 记录。发布说明指明拒绝出现的版本。
35
+
36
+ ### 案例:`distro: ''`(0.12.0)
37
+
38
+ `distro: ''` 过去表示“WSL 的默认发行版”。0.12.0 让空值表示 **auto**:
39
+ 跟随请求工作目录的 UNC 发行版。依赖旧含义的 profile 仍能启动,但行为已经不同。
40
+ 迁移方式:
41
+
42
+ ```yaml
43
+ # 保留旧姿态:所有命令都在 WSL 的默认发行版中执行
44
+ - id: preset-wsl
45
+ config:
46
+ plugins:
47
+ # … 完整块;两行都要设置 …
48
+ - id: wsl-shell
49
+ config:
50
+ distro: default
51
+ - id: wsl-fs
52
+ config:
53
+ distro: default
54
+ ```
55
+
56
+ `pnpm run preset --distro default` 会打印该块,供手动合并。
57
+ `--out` 会替换整个目标文件,包括无关的覆盖项;
58
+ 见 [CONFIGURATION.md](CONFIGURATION.zh.md#配置-wsl-shell-和-wsl-fs)。0.12.0 的 CHANGELOG
59
+ 记录说明了该变更;本页是持久副本。`doctor` 在其 host/distro 行中报告生效的
60
+ 发行版模式,`--dump-config` 显示合成后的值。
61
+
62
+ ## 发布必须通过的门禁
63
+
64
+ | 门禁 | 方式 | 运行位置 |
65
+ |---|---|---|
66
+ | 配置文档与 CHANGELOG 为最新 | 审查 diff;`lint:links` 覆盖交叉引用 | CI |
67
+ | `pnpm test` | 风格、链接、需求引用、文档一致性、语法、构建新鲜度、tsc 与单元测试文件 | CI(Node 22/24,Ubuntu + Windows) |
68
+ | `pnpm run test:coverage` | 行 85 / 分支 84 / 函数 70 | CI(Node 24,Ubuntu) |
69
+ | `pnpm run test:browser` | 无头 Chromium 中的插件 web bundle(布局、点击、badge 时序);安装一次 Chromium | CI(`browser` job,Ubuntu)与发布的 `Gates` |
70
+ | peer 版本线受测 | 下限 `>=0.2.2-rc.2`;`peer-canary` 工作流解析 `next` 并运行临时升级 | CI 定时/手动 |
71
+ | 打包安装/升级/卸载 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker) | 手动,本机(2026-11-06 为 10/10;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
72
+ | 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17 |
73
+ | 干净 Win11 + Ubuntu 首次运行 ≤ 5 分钟 | 干净机器、秒表 | **未运行**(项目机器已配置) |
74
+ | aarch64 已执行 | CI 中 qemu 下的 native 18 项检查套件 | **已在 CI 运行**(物理 aarch64 WSL 不在范围内;见 COMPATIBILITY.md) |
75
+ | 30 天内无未关闭的 P0 bug | issue tracker | 基于时间;无法从代码检出中断言 |
76
+
77
+ 干净机器首次运行的计时与 30 天 P0 窗口在有人实际测量前保持未运行;
78
+ aarch64 qemu 是 CI 门禁。发布说明不得声称未运行的行,
79
+ [ROADMAP-1.0.md](ROADMAP-1.0.md#wsl-304--10-readiness) 跟踪 1.0 的遗留项。
80
+ 跳过其余手动行的发布仍会通过 tag 工作流发布,但其说明会写明执行了哪些门禁。
81
+
82
+ ## 在本地验证迁移
83
+
84
+ ```bash
85
+ pnpm run preset --distro default --check <profile>/cordis.patch.yml # 无嵌套行陷阱
86
+ pnpm run doctor --json # 生效的环境事实
87
+ pnpm run e2e:install # 打包安装/升级/卸载全链
88
+ ```
89
+
90
+ 桌面应用没有 `dsh` 命令;合成后的状态就是 profile 的 `package.json` 与
91
+ `cordis.patch.yml`,直接查看即可。
92
+
93
+ 迁移后启动失败的 profile 应在错误中指明补救方法;若没有,那就是 bug——
94
+ 请附上 `doctor --json` 输出报告它。