dsh-plugin-wsl-env 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +84 -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 +12 -3
  7. package/SECURITY.md +2 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +2 -0
  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 +2 -0
  17. package/docs/ARCHITECTURE.zh.md +511 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +2 -2
  21. package/docs/CONFIGURATION.zh.md +3 -3
  22. package/docs/DIAGNOSTICS.md +8 -0
  23. package/docs/DIAGNOSTICS.zh.md +2 -0
  24. package/docs/LIMITATIONS.md +43 -5
  25. package/docs/LIMITATIONS.zh.md +34 -6
  26. package/docs/MIGRATION.md +6 -3
  27. package/docs/MIGRATION.zh.md +91 -0
  28. package/docs/PEER-PARITY.md +59 -47
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +9 -1
  32. package/docs/QUICKSTART.zh.md +8 -2
  33. package/docs/README.zh.md +22 -16
  34. package/docs/RELEASING.md +2 -1
  35. package/docs/REQUIREMENTS.zh.md +3 -1
  36. package/docs/ROADMAP-1.0.md +1 -1
  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 +146 -0
  41. package/docs/VALUE.zh.md +15 -13
  42. package/lib/auto-preset-seam.d.ts +45 -0
  43. package/lib/auto-preset-seam.js +47 -0
  44. package/lib/auto-preset.d.ts +33 -10
  45. package/lib/auto-preset.js +148 -44
  46. package/lib/doctor-live.d.ts +30 -0
  47. package/lib/doctor-live.js +37 -0
  48. package/lib/doctor-report.js +2 -2
  49. package/lib/messages.d.ts +19 -0
  50. package/lib/messages.js +28 -0
  51. package/lib/open-in-app.d.ts +206 -0
  52. package/lib/open-in-app.js +300 -0
  53. package/lib/preset-choice.d.ts +13 -0
  54. package/lib/preset-choice.js +18 -1
  55. package/lib/status.js +2 -1
  56. package/lib/wsl-doctor-command.js +2 -1
  57. package/package.json +47 -24
@@ -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
 
@@ -182,7 +182,7 @@ The root router is app-level, not session-owned, so it does not use
182
182
  | `auto-preset` | `preset` | `wsl` | Preset to bind when a session workspace is inside a distro. An explicit operator selection is preserved. |
183
183
  | | `attempts` | `6` | Number of attempts to bind the preset. |
184
184
  | | `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. |
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. 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
186
  | `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
187
187
  | | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
188
188
  | | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
@@ -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
 
@@ -172,7 +172,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
172
172
  | `auto-preset` | `preset` | `wsl` | 会话工作区位于发行版内时绑定的 preset。操作者的显式选择会被保留。 |
173
173
  | | `attempts` | `6` | 绑定 preset 的尝试次数。 |
174
174
  | | `retryMs` | `150` | 两次尝试之间的延迟,单位毫秒。 |
175
- | | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。 |
175
+ | | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。落在这些目录的会话会在输入框上方与 **WSL 环境** 面板中被点明,并提供回到发行版环境的办法。 |
176
176
  | `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
177
177
  | | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
178
178
  | | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
@@ -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,12 @@ 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
+
108
116
  ## The map
109
117
 
110
118
  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 应答。
@@ -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 |
@@ -0,0 +1,91 @@
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
+ dsh --profile <name> --dump-config # 合成后的行(CLI 发行版)
88
+ ```
89
+
90
+ 迁移后启动失败的 profile 应在错误中指明补救方法;若没有,那就是 bug——
91
+ 请附上 `doctor --json` 输出报告它。
@@ -7,25 +7,25 @@ same refusal dialect on both substrates. The **read path** holds end to end;
7
7
  the **edit path** carries two declared divergences, listed at the end. This
8
8
  file records the verification against the real peers.
9
9
 
10
- - Peers: `@deepseek-ai/dsh-fs-local@0.2.2-rc.1` (the exact version the
11
- devDependencies pin, and the floor the peer range `>=0.2.2-rc.1` was
12
- verified against), plus `@deepseek-ai/dsh-fs@0.2.2-rc.1` for the
10
+ - Peers: `@deepseek-ai/dsh-fs-local@0.2.2-rc.2` (the exact version the
11
+ devDependencies pin, and the floor the peer range `>=0.2.2-rc.2` was
12
+ verified against), plus `@deepseek-ai/dsh-fs@0.2.2-rc.2` for the
13
13
  `FsVersion` brand the local package imports. Divergence 2 is measured
14
- against a third peer, `@deepseek-ai/dsh-bash-local@0.2.2-rc.1` — the shell
14
+ against a third peer, `@deepseek-ai/dsh-bash-local@0.2.2-rc.2` — the shell
15
15
  executor carries the collect-budget/spill machinery; `spill` and
16
16
  `maxSpillBytes` do not appear in `dsh-fs-local` at all.
17
- - The `0.2.2-rc.1` move grows `dsh-fs-local`'s shipped `lib/index.js` from 909
18
- to 1048 lines (patch/move/delete operations, `expandHomePrefix`, `writeIoError`,
19
- multi-key locks), so every line reference below was re-walked on 2026-11-05.
20
- Every replicated string survived verbatim; the fsio **read path** holds end
21
- to end and the **edit path** carries the same two declared divergences, listed
22
- at the end. The release also added a `FS_ERROR_CODES` const export with two
23
- new codes (`FS_PATCH_MISMATCH`, `FS_SAME_TARGET`). The plugin serves those
17
+ - The `0.2.2-rc.2` move shrinks `dsh-fs-local`'s shipped `lib/index.js` from
18
+ 1048 to 1035 lines: the local peer now routes permission/IO faults through
19
+ `fsErrorFromErrno` (imported from `dsh-fs`) instead of its own
20
+ `listingIoError`/pass-through arms. Every replicated string survived verbatim;
21
+ the fsio **read path** holds end to end and the **edit path** carries the same
22
+ two declared divergences, listed at the end. The `FS_ERROR_CODES` export with
23
+ `FS_PATCH_MISMATCH`/`FS_SAME_TARGET` remains. The plugin serves those
24
24
  operations for real over protocol v7 — see the new-peer-operations section
25
- at the end.
26
- `dsh-bash-local@0.2.2-rc.1`'s `lib/index.js` is byte-identical to
27
- `0.2.1-rc.3`'s (only manifests and locale files changed), so its references
28
- stand. `dsh-fs@0.2.2-rc.1` still has no `./invariant` export subpath; this
25
+ at the end. The references below were re-walked on 2026-11-12.
26
+ `dsh-bash-local@0.2.2-rc.2`'s `lib/index.js` is byte-identical to
27
+ `0.2.1-rc.3`'s and to `0.2.2-rc.1`'s, so its references stand.
28
+ `dsh-fs@0.2.2-rc.2` still has no `./invariant` export subpath; this
29
29
  plugin imports neither it nor `dsh-invariants`.
30
30
  - What "not imported" means: the peer's **fsio module** is not reachable from
31
31
  the package's exports, so `lib/fsio-text.js` reimplements it and imports
@@ -41,26 +41,27 @@ file records the verification against the real peers.
41
41
 
42
42
  ```sh
43
43
  mkdir -p /tmp/peer-audit && cd /tmp/peer-audit
44
- npm pack @deepseek-ai/dsh-fs-local@0.2.2-rc.1 @deepseek-ai/dsh-fs@0.2.2-rc.1 --pack-destination .
45
- openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.2-rc.1.tgz | base64 -w0
46
- tar xzf deepseek-ai-dsh-fs-local-0.2.2-rc.1.tgz # -> package/lib/index.js
47
- wc -l package/lib/index.js # expect 1048
44
+ npm pack @deepseek-ai/dsh-fs-local@0.2.2-rc.2 @deepseek-ai/dsh-fs@0.2.2-rc.2 --pack-destination .
45
+ openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.2-rc.2.tgz | base64 -w0
46
+ tar xzf deepseek-ai-dsh-fs-local-0.2.2-rc.2.tgz # -> package/lib/index.js
47
+ wc -l package/lib/index.js # expect 1035
48
48
  ```
49
49
 
50
50
  The tarballs this audit compared, by content — the same values
51
- `npm view <pkg>@0.2.2-rc.1 dist.integrity` reports (re-recorded 2026-11-05;
52
- the `0.2.1-rc.3` values they supersede are in git history):
51
+ `npm view <pkg>@0.2.2-rc.2 dist.integrity` reports (re-recorded 2026-11-12;
52
+ the `0.2.2-rc.1` values they supersede are in git history):
53
53
 
54
54
  ```
55
- @deepseek-ai/dsh-fs-local@0.2.2-rc.1 sha512-tibC9z4YJx7C6DhiWmTc9AYeF+GSh22XVaaDdumwTgBgvFuiNITNGn3E0DTL3skugB3MKnvAvrjybdveNQ7MmQ==
56
- @deepseek-ai/dsh-fs@0.2.2-rc.1 sha512-sbr+u+3dG4KAUdY7FoMLJg/gSE39gvgBMwmvVeR/6acNrlHaIducvnuxRUYAq2V0+NOVnG8fA9sdfBq2uGAfUw==
55
+ @deepseek-ai/dsh-fs-local@0.2.2-rc.2 sha512-QjzwjFskmTXVg9fUFvs8k/1lHti4JOGnu/ABF6UWUwZjqYFwDQIkbJbi5nTuz0mE50DQup7yyv0D9STgC1eEKA==
56
+ @deepseek-ai/dsh-fs@0.2.2-rc.2 sha512-y3ocU0T1mZgFIAfgqAo+4l61zqvNpdsmRM0Pp2Ek8xDu6XvtIcsur3ST/iUsudtz1m/ope8t27jeEgtTefn/TQ==
57
57
  ```
58
58
 
59
59
  Each row of the table below names the peer's `lib/index.js` line and the
60
60
  literal both sides must produce. Verified 2026-10-03; the read/edit split
61
61
  re-verified 2026-10-06; the whole table re-checked against `0.2.1-rc.2`,
62
- 2026-10-17, against `0.2.1-rc.3`, 2026-10-26, and against `0.2.2-rc.1`,
63
- 2026-11-05 (line numbers shifted; strings identical).
62
+ 2026-10-17, against `0.2.1-rc.3`, 2026-10-26, against `0.2.2-rc.1`,
63
+ 2026-11-05, and against `0.2.2-rc.2`, 2026-11-12 (line numbers shifted; strings
64
+ identical).
64
65
 
65
66
  ## Verdict
66
67
 
@@ -77,22 +78,22 @@ declared extensions, listed at the end.
77
78
 
78
79
  | Item | Evidence (peer `lib/index.js`) | Ours |
79
80
  |---|---|---|
80
- | `normalizeLineEndings` | `:628` `content.replaceAll("\r\n", "\n")` | identical |
81
- | `detectLineEndings` | `:630` 4096-char sample; `crlf > lf - crlf` | identical |
82
- | `restoreLineEndings` | `:643` LF unchanged; CRLF re-normalizes then `\n` → `\r\n` | identical (`replaceAll` vs `split/join` — equivalent) |
83
- | occurrence counting | `:650` non-overlapping left-to-right | `split(needle).length - 1` — equivalent |
84
- | `applyLiteralEdit` | `:741` empty needle, not-found, and ambiguous refusals; single-pass `split/join` without rescanning | identical |
85
- | edit refusal strings | `:743`, `:746`, `:747` — `old_string must be a non-empty string` (`FS_EDIT_NOT_FOUND`); ``old_string was not found in "${displayPath}"``; ``old_string matched ${n} times in "${displayPath}"; provide a more specific old_string or set replace_all to true`` (`FS_AMBIGUOUS_EDIT`) | identical |
86
- | invalid UTF-8, read path | `:343` — ``cannot ${verb} "${displayPath}": invalid UTF-8 text`` (`FS_NOT_TEXT`), verb `read` | identical (the edit path's verb differs; see 4) |
87
- | binary detection, read path | `:99`/`:387` (sample const, guard), stream at `:471-473` — 8192-byte sample, NUL check; ``cannot read "${displayPath}": binary file`` (`FS_NOT_TEXT`) | identical — both accept a NUL at offset 8500, past the sample; the edit path's bound differs, see 4 |
88
- | size caps | `:403`, `:414` — ``cannot read "${displayPath}": ${size} bytes exceeds the ${maxBytes}-byte limit`` and ``content exceeds the ${maxBytes}-byte limit`` (`FS_TOO_LARGE`) | identical |
89
- | `writeText` guards | `:505`, `:506-508` — not-regular (`FS_NOT_REGULAR_FILE`), `file no longer exists` / `file changed since it was read` (`FS_STALE_VERSION`) via `writeTarget` at `:1021-1025`, ``cannot overwrite existing "${displayPath}" without reading it first`` (`FS_NOT_OBSERVED`) | identical |
90
- | `editText` guards — not-regular and stale version | `:938`, `:939` — ``cannot edit "${displayPath}": not a regular file`` (`FS_NOT_REGULAR_FILE`); `file changed since it was read` (`FS_STALE_VERSION`) when the expected version differs (`requireFile` at `:1030-1032`) | identical |
91
- | `editText` guards — missing file | `:937` — one refusal for every caller: `file changed since it was read` (`FS_STALE_VERSION`), with or without an expected version | **diverges by design** — we split on the caller's evidence: with an expected version `file no longer exists` (`FS_STALE_VERSION`), without one `file does not exist` (`FS_NOT_FOUND`). See 5 |
92
- | `listDir` refusal | `:310` — ``cannot list "${displayPath}": not a directory`` (`FS_NOT_DIRECTORY`) | identical |
93
- | diff-basis gate | `:920` — `existing !== null && Buffer.byteLength(content) < diffBasisMaxBytes` — keyed on the NEW content's size, `null` above the cap (the move path inherits the same keying at `:983`/`:997`) | identical — the gate's new-size keying is inherited by design, not a divergence |
94
- | outcome shapes | `:927`, `:992` — `operation: "update" \| "create"`, the `missing:${targetKey}` sentinel version (`:1044`), `before`/`after` | identical |
95
- | version join | `:148` — `` `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}` `` (branded by `dsh-fs`'s `FsVersion`) | `versionOf` — identical shape |
81
+ | `normalizeLineEndings` | `:614` `content.replaceAll("\r\n", "\n")` | identical |
82
+ | `detectLineEndings` | `:617` 4096-char sample; `crlf > lf - crlf` | identical |
83
+ | `restoreLineEndings` | `:630` LF unchanged; CRLF re-normalizes then `\n` → `\r\n` | identical (`replaceAll` vs `split/join` — equivalent) |
84
+ | occurrence counting | `:633` non-overlapping left-to-right | `split(needle).length - 1` — equivalent |
85
+ | `applyLiteralEdit` | `:728` empty needle, not-found, and ambiguous refusals; single-pass `split/join` without rescanning | identical |
86
+ | edit refusal strings | `:730`, `:733`, `:734` — `old_string must be a non-empty string` (`FS_EDIT_NOT_FOUND`); ``old_string was not found in "${displayPath}"``; ``old_string matched ${n} times in "${displayPath}"; provide a more specific old_string or set replace_all to true`` (`FS_AMBIGUOUS_EDIT`) | identical |
87
+ | invalid UTF-8, read path | `:331` — ``cannot ${verb} "${displayPath}": invalid UTF-8 text`` (`FS_NOT_TEXT`), verb `read` | identical (the edit path's verb differs; see 4) |
88
+ | binary detection, read path | `:99`/`:373` (sample const, guard), stream at `:457-459` — 8192-byte sample, NUL check; ``cannot read "${displayPath}": binary file`` (`FS_NOT_TEXT`) | identical — both accept a NUL at offset 8500, past the sample; the edit path's bound differs, see 4 |
89
+ | size caps | `:389`, `:400` — ``cannot read "${displayPath}": ${size} bytes exceeds the ${maxBytes}-byte limit`` and ``content exceeds the ${maxBytes}-byte limit`` (`FS_TOO_LARGE`) | identical |
90
+ | `writeText` guards | `:493`, `:495` — not-regular (`FS_NOT_REGULAR_FILE`), `file no longer exists` / `file changed since it was read` (`FS_STALE_VERSION`) via `writeTarget` at `:1006-1010`, ``cannot overwrite existing "${displayPath}" without reading it first`` (`FS_NOT_OBSERVED`) | identical |
91
+ | `editText` guards — not-regular and stale version | `:924`, `:925` — ``cannot edit "${displayPath}": not a regular file`` (`FS_NOT_REGULAR_FILE`); `file changed since it was read` (`FS_STALE_VERSION`) when the expected version differs (`requireFile` at `:1015-1019`) | identical |
92
+ | `editText` guards — missing file | `:924` — one refusal for every caller: `file changed since it was read` (`FS_STALE_VERSION`), with or without an expected version | **diverges by design** — we split on the caller's evidence: with an expected version `file no longer exists` (`FS_STALE_VERSION`), without one `file does not exist` (`FS_NOT_FOUND`). See 5 |
93
+ | `listDir` refusal | `:298` — ``cannot list "${displayPath}": not a directory`` (`FS_NOT_DIRECTORY`) | identical |
94
+ | diff-basis gate | `:907` — `existing !== null && Buffer.byteLength(content) < diffBasisMaxBytes` — keyed on the NEW content's size, `null` above the cap (the move path inherits the same keying at `:966`/`:979`) | identical — the gate's new-size keying is inherited by design, not a divergence |
95
+ | outcome shapes | `:914`, `:979` — `operation: "update" \| "create"`, the `missing:${targetKey}` sentinel version (`:1031`), `before`/`after` | identical |
96
+ | version join | `:146` — `` `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}` `` (branded by `dsh-fs`'s `FsVersion`) | `versionOf` — identical shape |
96
97
 
97
98
  ## Deliberate divergences (declared, not drift)
98
99
 
@@ -103,7 +104,7 @@ declared extensions, listed at the end.
103
104
  2. **Per-stream truncation flags.** The EXEC frame carries an output budget;
104
105
  the RES line reports which streams the agent cut, surfaced as honest
105
106
  `truncated` flags. The collect-budget/spill machinery of the shell peer,
106
- `@deepseek-ai/dsh-bash-local@0.2.2-rc.1` (`lib/index.js:30`, `:110`), is the
107
+ `@deepseek-ai/dsh-bash-local@0.2.2-rc.2` (`lib/index.js:30`, `:110`), is the
107
108
  spill-file path we deliberately do not run.
108
109
  3. **The transport around the ops** (ACK, KILL, the confined resident) is
109
110
  protocol this package owns; the peer has no agent.
@@ -112,10 +113,10 @@ declared extensions, listed at the end.
112
113
  dialect, but a divergence all the same, so it is declared: an edit refused
113
114
  for its bytes reads ``cannot read "…": binary file`` or
114
115
  ``cannot read "…": invalid UTF-8 text`` — verb `read`, where the peer's
115
- `readForEdit` (`lib/index.js:664`) says ``cannot edit "…": …``. The NUL
116
+ `readForEdit` (`lib/index.js:651`) says ``cannot edit "…": …``. The NUL
116
117
  check is likewise the read path's 8192-byte sample
117
118
  (`src/fsio-agent.ts:377-384`, guard at `:380`), where the peer scans the
118
- whole buffer (`lib/index.js:668`): a file whose first 8192 bytes are clean
119
+ whole buffer (`lib/index.js:655`): a file whose first 8192 bytes are clean
119
120
  but that carries a NUL later is edited by us and refused by the peer.
120
121
  Measured on a 9000-byte fixture with a NUL at offset 8500 — ours `EDITED`,
121
122
  the peer `FS_NOT_TEXT: cannot edit "…"`.
@@ -125,7 +126,7 @@ declared extensions, listed at the end.
125
126
  behind it names a file that never answered the stat, so it takes the read
126
127
  path's missing-file dialect (`cannot edit "…": file does not exist`,
127
128
  `FS_NOT_FOUND`). The peer throws `file changed since it was read`
128
- (`FS_STALE_VERSION`, `lib/index.js:937` via `requireFile` at `:1030`) for
129
+ (`FS_STALE_VERSION`, `lib/index.js:924` via `requireFile` at `:1015`) for
129
130
  both. Pinned by `test/fs-substrate.test.mjs`.
130
131
  6. **Publication durability (shell agent, 2026-11-06).** After the publish
131
132
  rename, the shell agent fsyncs the destination's containing directory
@@ -146,9 +147,20 @@ declared extensions, listed at the end.
146
147
  always sends numerics, so this is drift-hardening at the trust boundary,
147
148
  not a behavioral change for any caller.
148
149
 
149
- ## The peer's 0.2.2-rc.1 operations: implemented over protocol v7
150
+ 8. **Permission classification on the distro path.** The rc.2 local peer routes
151
+ `EACCES`/`EPERM` through `fsErrorFromErrno` to `FS_PERMISSION_DENIED` with
152
+ ``cannot <op> "<path>": permission denied``. The WSL agent keeps ordinary
153
+ permission refusals at `FS_IO_ERROR` with the agent's stderr text; only the
154
+ sandbox's read-only-bind denial is classified as `FS_SANDBOX_DENIED`. This is
155
+ pinned by `test/fsio-agent.test.mjs` ("a write refused on ordinary
156
+ permissions keeps its I/O classification"). A consumer that switches between
157
+ the host and distro backends will see both the code and the text differ for a
158
+ plain permission refusal: the distro path carries the agent's stderr text,
159
+ not the peer's `cannot <op> "<path>": …` shape.
150
160
 
151
- `0.2.2-rc.1` added three operations to the peer's `FileSystem` base —
161
+ ## The peer's 0.2.2 operations: implemented over protocol v7
162
+
163
+ The `0.2.2` line added three operations to the peer's `FileSystem` base —
152
164
  `patchText` (hunks via `@deepseek-ai/dsh-fs-patch`, refusal
153
165
  `FS_PATCH_MISMATCH`), `deleteFile`, and `moveFile` (same-target refusal
154
166
  `FS_SAME_TARGET`). 0.18.0 shipped them as an honest refusal (an inherited
@@ -1,5 +1,7 @@
1
1
  # Performance: ext4 agent vs the 9p share
2
2
 
3
+ [中文](PERFORMANCE.zh.md)
4
+
3
5
  The plugin's reason to exist is not only correctness: a WSL workspace served
4
6
  through the Windows 9p share is measurably slower than the same files read on
5
7
  the distro's ext4 through the resident agent. This page records the measurements