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,59 @@
1
+ # 性能:ext4 agent 对比 9p 共享
2
+
3
+ [English](PERFORMANCE.md)
4
+
5
+ 本插件存在的理由不只是正确性:通过 Windows 9p 共享提供的 WSL 工作区,
6
+ 明显慢于经常驻 agent 在发行版 ext4 上读取同样的文件。本页记录测量结果及
7
+ 复现方法;不对测量范围之外做推断。
8
+
9
+ ## 两种 substrate
10
+
11
+ | | 9p 共享(`\\wsl.localhost\...`) | 本插件 |
12
+ |---|---|---|
13
+ | 文件 I/O | 宿主栈每次操作都跨越 VM 边界 | 常驻 agent 在发行版内、目标的后备文件系统上提供读写 |
14
+ | 变更通知 | 轮询该共享 | 可用时对无界目录使用 inotify,否则轮询 |
15
+ | 命令 | 宿主进程 | 经 `wsl.exe` 的发行版登录 shell |
16
+
17
+ 插件的根文件系统将每条 WSL 路径路由到发行版后端(`fs-routing`),因此
18
+ GUI 文件树、预览和模型的文件工具都走 agent 路径。设计与权衡见
19
+ [root-fs-routing.md](root-fs-routing.md);已知限制见
20
+ [LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
21
+
22
+ ## 测量数字
23
+
24
+ 机器:Windows 11 + WSL 2,Ubuntu,x86_64,即本项目的开发机。绝对数字
25
+ 取决于机器;比例和预算才是重点。
26
+
27
+ | 场景 | 9p 共享 | Agent(ext4) | 来源 |
28
+ |---|---|---|---|
29
+ | 16 个并发共享读取,shell agent 对比 native agent | — | shell:342–614 ms(排队最高 583 ms);native:A7 之后 **2.4–4.1 ms**,首次启动约 70 ms(仅一次) | [ADR 0002 fs 队列](adr/0002-native-agent.md#fs-queue-measurement-a6-2026-10-18) |
30
+ | 单次 FS 操作(宿主往返) | — | p95 ≈ 22 ms | [ROADMAP-1.0.md](ROADMAP-1.0.md#7-metrics) |
31
+ | GUI 预览后端:`stat` | — | p95 **2.7 ms** | `pnpm run probe:gui-preview`(20 次迭代,2026-10-19) |
32
+ | GUI 预览后端:目录列举 | — | p95 **5.1 ms** | 同上 |
33
+ | GUI 预览后端:1 MiB 页面 | — | p95 **63.5 ms/MiB** | 同上 |
34
+
35
+ GUI 预览数字覆盖一次预览所支付的、经路由的后端操作。随包的
36
+ `workspace-files` 服务会在其上追加自己的调用;该服务的形态在
37
+ [LIMITATIONS.zh.md](LIMITATIONS.zh.md) 中保持定性描述。1 s/MiB 预算余量
38
+ 很大,因此这些测量并不构成进一步优化(被推迟的 v6 FS 并发)的理由。
39
+
40
+ ## 复现
41
+
42
+ 在发行版内,使用该 checkout:
43
+
44
+ ```bash
45
+ pnpm run probe:gui-preview # stat / listDir / 1 MiB page read, p50/p95
46
+ node test/probe/fs-queue.mjs # the agent queue, sequential vs concurrent, with per-op latency
47
+ ```
48
+
49
+ 两者都需要 WSL 互操作、可用的发行版和 Node;都不启动 harness。队列测量还
50
+ 需要 systemd 和可用的原生二进制;它打印实际耗时和队列指标,但不强制延迟
51
+ 预算。GUI 预览探针报告 p50/p95/max,并在超出预算时失败。
52
+
53
+ ## 未测量的内容
54
+
55
+ - 端到端 GUI 绘制时间(浏览器和服务自身的工作不在这些探针范围内)。
56
+ - 大文件或大量小文件的 9p 数字;A6 比较的是 shell 与 native agent,而不是
57
+ Windows 侧的 9p 共享。
58
+ - 物理 aarch64 硬件上的 WSL 延迟(原生 18 项检查套件在 CI 中于 qemu 下
59
+ 运行;那是功能正确性,不是宿主往返测量)。
@@ -1,6 +1,6 @@
1
1
  # Quickstart
2
2
 
3
- *The Chinese version ([QUICKSTART.zh](QUICKSTART.zh.md)) is authoritative; this page is its English translation.*
3
+ [中文](QUICKSTART.zh.md)
4
4
 
5
5
  Steps from a Windows + WSL 2 machine to a working WSL session.
6
6
  This page is the entry point; every claim links to the document that owns it.
@@ -101,6 +101,9 @@ WSL** (the default — commands, files and the terminal all run in the distro) o
101
101
  **Windows access** (the folder as an ordinary Windows share over 9p, without the
102
102
  Linux toolchain). The choice is recorded in the `auto-preset` row's
103
103
  `windowsWorkspaces` and applies to later sessions in that workspace too.
104
+ A Windows-access directory is called out in the session itself: a distro workspace
105
+ running a non-WSL preset keeps a warning above the composer, with a one-click switch
106
+ while the session is still blank and the access-record fix once a turn has started.
104
107
  Two distros can be open at once, each with its own environment.
105
108
 
106
109
  ### Open the workspace in VS Code (Remote-WSL)
@@ -120,6 +123,11 @@ code --folder-uri "vscode-remote://wsl+ubuntu/home/me/proj"
120
123
  Requires the `code` shim on PATH (VS Code installer adds it) and the
121
124
  Remote-WSL extension.
122
125
 
126
+ In the desktop GUI, the Session header menu also carries
127
+ **在 VS Code 中打开(WSL)**: it converts the Session workspace to the same URI
128
+ and launches the editor with a cleaned environment, so it does not depend on a
129
+ patched `app.asar`.
130
+
123
131
  ![The directory picker listing a WSL distro's folders](screenshots/picker.png)
124
132
 
125
133
  The terminal panel runs in the same distro — `uname -a` answers with the
@@ -1,6 +1,6 @@
1
- # Quickstart
1
+ # 快速开始
2
2
 
3
- _本页是权威版本;英文译本见 [QUICKSTART](QUICKSTART.md)。_
3
+ [English](QUICKSTART.md)
4
4
 
5
5
  从一台 Windows + WSL 2 机器到可用的 WSL 会话,只需以下步骤。
6
6
  本页是入口;每条说明都链接到负责该主题的文档。
@@ -86,6 +86,8 @@ scope 或损坏的 agent 缓存)时标为 **修复**,否则标为 **完整
86
86
  文件与终端都在发行版内)或 **Windows 访问**(把该文件夹当作普通 Windows 共享,经 9p
87
87
  读写,没有 Linux 工具链)。选择记录在 `auto-preset` 行的 `windowsWorkspaces` 里,
88
88
  对该工作区之后新建的会话同样生效。
89
+ Windows 访问目录也会在会话内被点明:运行非 WSL preset 的发行版工作区在输入框上方
90
+ 常驻一条警示;会话尚未开始时一键切换,已开始后修正访问记录。
89
91
 
90
92
  ### 在 VS Code 中打开工作区(Remote-WSL)
91
93
 
@@ -104,6 +106,10 @@ code --folder-uri "vscode-remote://wsl+ubuntu/home/me/proj"
104
106
  要求 PATH 上有 `code` shim(VS Code 安装器会添加),以及
105
107
  Remote-WSL 扩展。
106
108
 
109
+ 桌面 GUI 的会话头部菜单还提供 **在 VS Code 中打开(WSL)**:它把会话工作区
110
+ 转换成同一个 URI,并在清理过的环境里启动编辑器,因此不依赖打过补丁的
111
+ `app.asar`。
112
+
107
113
  ![The directory picker listing a WSL distro's folders](screenshots/picker.png)
108
114
 
109
115
  终端面板运行在同一个发行版中——`uname -a` 返回的是
package/docs/README.zh.md CHANGED
@@ -96,6 +96,12 @@ CLI 入口在 `resources/app.asar` 内部(探针脚本通过 `ELECTRON_RUN_AS_
96
96
  Plugins 页面写入的那个;要用别的 profile 属于 CLI 发行版的事
97
97
  (`dsh --profile <名字>`)。
98
98
 
99
+ **不对宿主打补丁。** 插件从不修改已安装的 `resources/app.asar`。
100
+ **在 VS Code 中打开(WSL)** 的桥完全在插件行内,因此应用升级不会丢掉它,
101
+ 插件升级也只需重新安装并重启——没有重新打 archive 补丁的步骤。应用自带的
102
+ "Open in app" 是独立的上游缺陷,见
103
+ [docs/UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md)。
104
+
99
105
  **CLI 发行版**(`dsh` 在 `PATH` 上),在 Windows 终端执行:
100
106
 
101
107
  ```powershell
@@ -126,7 +132,7 @@ wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
126
132
  - **New terminal** 在同一发行版、同一目录打开 shell。
127
133
  - 模型能看到监听端口,并返回 dev server 的 URL。WSL 2 会把 localhost 转发到 Windows。
128
134
  - 权限选择器:`read-only`、`workspace-write`(默认)、`danger-full-access`。只有 `danger-full-access` 不经过沙箱。
129
- - 侧边栏的 **WSL 环境** 面板是诊断页:列出已安装的发行版,可对单个发行版运行 doctor 快速检查(bwrap / systemd / Linger 等前置项),并提供一次完整运行(`--fix-owned`,存在插件可修复项时标为 **修复**,否则标为 **完整检查**)——清扫残留 session scope、清理损坏的 agent 缓存并逐一复检,不安装软件包、不改写 Windows 配置;其余告警保留各自的手动处理办法。每个已检查的行还显示上次检查时间、来源(**手动** 或页面加载时的 **后台** 复核)与结果结构——各状态计数与分区分布。每个已检查的行还可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据(快速检查未触及的目录项只计数、不伪装成结果),绿色或异常的行都能被审计而不只是被相信。不必再打开 doctor 就能决定下一步。每个发行版的最后一次结果保存在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`(缺省回退到 `~/.dsh`),页面刷新或应用重启后仍可见;加载时只对正在运行的发行版在后台复核(不会启动已停止的发行版),后台运行失败会按实际观测覆盖已存结果。不标记“已过期”:时间戳就是时间戳。经 **添加工作区** 选中发行版目录时,会问一次 **Remote WSL**(默认,发行版内执行)还是 **Windows 访问**(按 9p 共享打开,没有 Linux 工具链),后者记录在 `auto-preset` 行的 `windowsWorkspaces` 中。
135
+ - 侧边栏的 **WSL 环境** 面板是诊断页:列出已安装的发行版,可对单个发行版运行 doctor 快速检查(bwrap / systemd / Linger 等前置项),并提供一次完整运行(`--fix-owned`,存在插件可修复项时标为 **修复**,否则标为 **完整检查**)——清扫残留 session scope、清理损坏的 agent 缓存并逐一复检,不安装软件包、不改写 Windows 配置;其余告警保留各自的手动处理办法。每个已检查的行还显示上次检查时间、来源(**手动** 或页面加载时的 **后台** 复核)与结果结构——各状态计数与分区分布。每个已检查的行还可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据(快速检查未触及的目录项只计数、不伪装成结果),绿色或异常的行都能被审计而不只是被相信。不必再打开 doctor 就能决定下一步。每个发行版的最后一次结果保存在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`(缺省回退到 `~/.dsh`),页面刷新或应用重启后仍可见;加载时只对正在运行的发行版在后台复核(不会启动已停止的发行版),后台运行失败会按实际观测覆盖已存结果。不标记“已过期”:时间戳就是时间戳。经 **添加工作区** 选中发行版目录时,会问一次 **Remote WSL**(默认,发行版内执行)还是 **Windows 访问**(按 9p 共享打开,没有 Linux 工具链),后者记录在 `auto-preset` 行的 `windowsWorkspaces` 中。这些记录下来的目录也会出现在能感知后果的位置:运行非 WSL preset 的发行版工作区会在输入框上方常驻一条警示(会话尚未开始时可一键切换;已开始后可修正访问记录),会话页头在警示收起后保留 **WSL工作区正以Windows模式打开** 小标记,面板里也列出已记录的目录供审计。
130
136
 
131
137
  ## 配置
132
138
 
@@ -151,7 +157,7 @@ wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
151
157
  | `wsl-preflight` | `distro` | `''` | 环境检查探测的发行版;空/`auto` 跟随会话工作区 |
152
158
  | | `startup` | `true` | 插件加载时预先运行同一组检查,让判定在任何会话打开之前就出现在日志里 |
153
159
 
154
- `fs-routing` 是根级 `ctx.fs` 调用的顶层路由:它的发行版设置独立于 `wsl-fs`,也是按 id 在顶层补丁中覆盖的行。`wsl-shell` 和 `wsl-fs` 位于随包的 `wsl` preset 中,按 id 覆盖无效。要改就覆盖整个 `preset-wsl` 行;配方和其余键见 [docs/CONFIGURATION.md](CONFIGURATION.md)。[`cordis.patch.yml`](../cordis.patch.yml) 是随包值的注释参考。
160
+ `fs-routing` 是根级 `ctx.fs` 调用的顶层路由:它的发行版设置独立于 `wsl-fs`,也是按 id 在顶层补丁中覆盖的行。`wsl-shell` 和 `wsl-fs` 位于随包的 `wsl` preset 中,按 id 覆盖无效。要改就覆盖整个 `preset-wsl` 行;配方和其余键见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md)。[`cordis.patch.yml`](../cordis.patch.yml) 是随包值的注释参考。
155
161
 
156
162
  ## 架构
157
163
 
@@ -185,7 +191,7 @@ wsl preset(每个会话)
185
191
 
186
192
  `bubblewrap` 是必需项。缺失或损坏时,受限命令报 `SANDBOX_UNAVAILABLE`,不会运行。在对应的行设置 `sandbox: false` 可关闭沙箱;模型会收到"该操作无沙箱"的说明。
187
193
 
188
- 隔离上报为 `partial`。发行版内的命令仍可通过 `/mnt/c` 启动 Windows 程序,`bubblewrap` 无法控制 Windows 进程。`maskWindowsDrive: true` 让受限视图看不到 `/mnt`,但会被 `interopVisibility: visible` 覆盖;遮罩只能收窄这个洞,不能关死。关闭 WSL interop 需要另行在发行版的 `/etc/wsl.conf` 中设置 `[interop] enabled=false`。见 [docs/ARCHITECTURE.md](ARCHITECTURE.md#sandbox) 和 [SECURITY.md](../SECURITY.md)。
194
+ 隔离上报为 `partial`。发行版内的命令仍可通过 `/mnt/c` 启动 Windows 程序,`bubblewrap` 无法控制 Windows 进程。`maskWindowsDrive: true` 让受限视图看不到 `/mnt`,但会被 `interopVisibility: visible` 覆盖;遮罩只能收窄这个洞,不能关死。关闭 WSL interop 需要另行在发行版的 `/etc/wsl.conf` 中设置 `[interop] enabled=false`。见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#沙箱) 和 [SECURITY.zh.md](../SECURITY.zh.md)。
189
195
 
190
196
  ## 常见问题
191
197
 
@@ -199,7 +205,7 @@ wsl preset(每个会话)
199
205
  | 对 `wsl-shell`/`wsl-fs` 的 profile 补丁不生效 | 这些行嵌套在 `preset-wsl` 里。运行 `pnpm run preset --check <补丁>`;它会失败并输出需要粘贴的完整块 |
200
206
  | 改了 `lib/` 但不生效 | 运行 `pnpm run sync:windows`,然后重启应用 |
201
207
 
202
- 更多错误码和拒绝原因见 [docs/ARCHITECTURE.md](ARCHITECTURE.md#error-codes),插件不做的事见 [docs/LIMITATIONS.md](LIMITATIONS.md)。
208
+ 更多错误码和拒绝原因见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#错误码),插件不做的事见 [LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
203
209
 
204
210
  ## 开发
205
211
 
@@ -213,26 +219,26 @@ pnpm run sync:windows # 更新应用加载的 Windows 侧副本
213
219
 
214
220
  工具链跟随 harness 宿主:Node `^22.19.0 || >=24.0.0`。`src/` 是 TypeScript,`lib/` 是生成并提交的产物,必须保持同步。应用加载的是 Windows 侧的 `lib/` 副本,所以构建后要运行 `sync:windows` 并重启应用。
215
221
 
216
- 真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.md](../CONTRIBUTING.md) 和 `test/probe/`。
222
+ 真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) 和 `test/probe/`。
217
223
 
218
224
  ## 文档
219
225
 
220
226
  | 文档 | 内容 |
221
227
  |---|---|
222
- | [docs/QUICKSTART.md](QUICKSTART.md) | 首次运行、常用配方、兼容性 |
223
- | [docs/PERFORMANCE.md](PERFORMANCE.md) | ext4 agent 对比 9p 的实测延迟与复现方法 |
224
- | [docs/MIGRATION.md](MIGRATION.md) | 从早期版本升级、发布门槛 |
225
- | [docs/COMPATIBILITY.md](COMPATIBILITY.md) | 已测的 Windows/WSL/发行版矩阵与范围决定 |
226
- | [docs/API.md](API.md) | 包的子路径导出一览 |
227
- | [docs/CONFIGURATION.md](CONFIGURATION.md) | 所有配置键及覆盖方法 |
228
- | [docs/ARCHITECTURE.md](ARCHITECTURE.md) | 服务、路径路由、沙箱、错误码 |
229
- | [docs/LIMITATIONS.md](LIMITATIONS.md) | 插件不做的事 |
228
+ | [QUICKSTART.zh.md](QUICKSTART.zh.md) | 首次运行、常用配方、兼容性 |
229
+ | [PERFORMANCE.zh.md](PERFORMANCE.zh.md) | ext4 agent 对比 9p 的实测延迟与复现方法 |
230
+ | [MIGRATION.zh.md](MIGRATION.zh.md) | 从早期版本升级、发布门槛 |
231
+ | [COMPATIBILITY.zh.md](COMPATIBILITY.zh.md) | 已测的 Windows/WSL/发行版矩阵与范围决定 |
232
+ | [API.zh.md](API.zh.md) | 包的子路径导出一览 |
233
+ | [CONFIGURATION.zh.md](CONFIGURATION.zh.md) | 所有配置键及覆盖方法 |
234
+ | [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md) | 服务、路径路由、沙箱、错误码 |
235
+ | [LIMITATIONS.zh.md](LIMITATIONS.zh.md) | 插件不做的事 |
230
236
  | [docs/ROADMAP.md](ROADMAP.md) | 当前计划和推迟项 |
231
237
  | [docs/ROADMAP-1.0.md](ROADMAP-1.0.md) | 1.0 与生态优化计划 |
232
238
  | [docs/VALUE.zh.md](VALUE.zh.md) | 价值与取舍 |
233
- | [CONTRIBUTING.md](../CONTRIBUTING.md) | 开发循环、质量门、探针 |
234
- | [SECURITY.md](../SECURITY.md) | 私下上报漏洞 |
235
- | [SUPPORT.md](../SUPPORT.md) | 支持范围与提问渠道 |
239
+ | [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) | 开发循环、质量门、探针 |
240
+ | [SECURITY.zh.md](../SECURITY.zh.md) | 私下上报漏洞 |
241
+ | [SUPPORT.zh.md](../SUPPORT.zh.md) | 支持范围与提问渠道 |
236
242
  | [docs/RELEASING.md](RELEASING.md) | 发布检查单 |
237
243
 
238
244
  ## 许可
package/docs/RELEASING.md CHANGED
@@ -31,9 +31,10 @@ legs a CI run cannot execute) are in [MIGRATION.md](MIGRATION.md#gates-a-release
31
31
  ```bash
32
32
  pnpm test
33
33
  pnpm run test:coverage
34
+ pnpm run test:browser # once: pnpm exec playwright install chromium
34
35
  ```
35
36
 
36
- The release workflow runs both of these before it publishes.
37
+ The release workflow runs all three before it publishes.
37
38
 
38
39
  `pnpm test` includes the build-freshness gate: modules whose source lives in
39
40
  `src/*.ts` must be rebuilt (`pnpm run build`) and the result committed under
@@ -36,7 +36,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
36
36
  |---|---|---|---|---|---|
37
37
  | R1 | 命令在发行版内执行:`wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>`,登录 shell 不硬编码 | README「Using it」;ARCHITECTURE「The three service providers」「Failure mode」 | ①②④⑤⑥:命令形态与 `-lc` 语义成文;`WSL_E_*`(stdout/UTF-16/exit 255)与 cwd 回退 exit-0 两类陷阱显式转报错;agent/one-shot 双路径定义 | `shell.test.mjs`、`wsl.test.mjs`、`agent-exec.test.mjs`;probe:sandbox-shell;probe:agent 三条 on/off 对比腿 | — |
38
38
  | R2 | 文件工具读写真实发行版文件:单一 agent 基座(ext4),share 基座不复存在 | ARCHITECTURE「The filesystem substrate」;LIMITATIONS 首节 | ①②③⑤:读/写/身份在 ext4、原生符号链接与 mode 位;`createIfAbsent` no-replace 关闭 TOCTOU、版本随写 op 下发并在 rename 前复核(`FS_STALE_VERSION`);新文件 0600、agent 失联 fail-closed 均为明文;0600 与反斜杠文件名为已声明极限 | `fs-substrate.test.mjs`、`fsio-agent.test.mjs`、`agent-fs-script.test.mjs`、`provider.test.mjs`(守卫链)、`fs.boot.test.mjs`;probe:substrate 8/8 | rename 后无目录 fsync(OI-5,已入 LIMITATIONS) |
39
- | R3 | 会话级环境绑定:distro 目录自动绑 `wsl` preset,Windows 目录保持原生 | ARCHITECTURE「How the pieces are mounted」;README「Architecture」 | ①②④:触发条件与 isolate realms 机制成文;registry/agent-loop 两棵树不相交的设计约束可复核 | `preset-choice.test.mjs` | 猴补上游 `ensureSession` 的接缝风险已转 promotion-map 跟踪(非本仓可独立修) |
39
+ | R3 | 会话级环境绑定:distro 目录自动绑 `wsl` preset,Windows 目录保持原生 | ARCHITECTURE「How the pieces are mounted」;README「Architecture」 | ①②④:触发条件与 isolate realms 机制成文;registry/agent-loop 两棵树不相交的设计约束可复核 | `preset-choice.test.mjs`、`auto-preset.test.mjs`;doctor `session.preset-seam` | 猴补上游 `agents.createSession` 的接缝风险已转 promotion-map 跟踪;doctor 暴露其 active/inactive(非本仓可独立修) |
40
40
  | R4 | GUI 终端按会话路由:WSL 目录会话得发行版 shell,Windows 目录会话得 PowerShell(`hostSessions`) | ARCHITECTURE「Why the terminal provider is app-level」;LIMITATIONS 终端诸条 | ①②③⑤:路由判定、无目录启动落发行版、idle/busy/unknown 三态回收(`unknown` 必须暂停回收)逐项规定;tab 标题极限给出根因、上游提案与用户缓解 | `terminal.test.mjs`(terminalRoute 判定)、`terminal-activity.test.mjs`;probe:terminal | tab 标题读 `WSL`(UPSTREAM-TERMINAL-TITLE);host 终端 unknown 不回收——均为已声明边界 |
41
41
  | R5 | 目录选择器分层为 Windows 路径与 WSL 发行版两支,并列出已装发行版及其层级 | README「Install」;CONFIGURATION `directory-picker-wsl` 行 | ①②③⑤:根级列表、`includeHostHome`/`maxEntries`/`preferredDistro`、常驻 out 时 one-shot 回退;换行符文件名极限的边界论证闭合(`/` 不可能出现在名字里) | `listing.test.mjs`(`maxEntries` 封顶、行解析);probe:picker | `preferredDistro` 决定的根级 `path`/`home` 领位、`includeHostHome` 的排序姿态:单测与探针都没有断言(探针只查成员构成与截断旗标) |
42
42
  | R6 | 端口可见性:`DSH_WSL_PORTS` 按节奏经常驻 agent 刷新 | README「Using it」;CONFIGURATION「`wsl-shell-env`」表 | ①⑤:机制(`/proc/net/tcp{,6}` 扫描)、`portsRefreshMs` 默认 10s、与 WSL2 localhost 转发的关系(平台行为)成文 | `ports.test.mjs`(解析层) | 轮询使常驻 agent 永不闲置回收(OI-4,已入 LIMITATIONS) |
@@ -64,6 +64,8 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
64
64
  | R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false` 可关闭 | README「Install」;CONFIGURATION `wsl-update-check` 行 | ①②⑤:委托路径、TTL、关闭开关成文 | `update-check.test.mjs` | doctor 不再自行查询 registry:更新提示只走这条委托路径 |
65
65
  | R29 | `workspace-write` 的额外可写目录:`writableRoots`(两行同列表)与共享 `additionalWritableRoots` 解析为同一组 Linux 根,经一次物理目录检查后绑定进命令、受限写入 resident 与 session runtime;已被工作区/临时区覆盖或嵌套的条目不绑定 | CONFIGURATION「工具链缓存与额外可写目录」;ARCHITECTURE「Sandbox」;LIMITATIONS「workspace-write 默认不授予…」 | ①②③⑤⑥:`~` 展开、UNC/Linux 拼写、跨发行版/盘符拒绝、together-grant、cached key、安全代价与 `partial` 成文 | `writable-roots.test.mjs`、`agent.test.mjs`(bwrap argv)、`provider.test.mjs`(围栏与命令两条路径)、`session-runtime.test.mjs`(key 与前缀);probe:sandbox 的授权根腿 | 真机端到端 `pnpm install` 尚未纳入探针套件;`additionalWritableRoots` 的宿主会话语义仍由上游策略决定 |
66
66
 
67
+ | R30 | 发行版工作区落在非 WSL 环境时可见:会话内常驻警示(空白会话可一键切换、已开始则修正 `windowsWorkspaces`)、页头 **WSL工作区正以Windows模式打开** 标记、面板列出 Windows 访问目录,且 `auto-preset` 以日志与模型运行时上下文说明 PowerShell/9p 环境 | README「Using it」;QUICKSTART「Open a WSL workspace」;CONFIGURATION `auto-preset` 行;UPSTREAM-SESSION-NOTICE.md | ①②③⑤:判定口径(UNC 工作区 + 投影 preset 与 `auto-preset.preset` 不同)、两种成因与各自动作、投影缺失时不猜测、子代理不重复播报成文 | `auto-preset.test.mjs`(宿主侧告警与子代理/锁定/预设缺失分支)、`preset-choice.test.mjs`(访问目录判定)、`client.test.mjs`(加载器级警示状态机:显示/隐藏、切换/收起/忘记动作、badge 同步、面板目录列表);`test/browser/` 下的 Chromium 套件覆盖布局、可见性、点击与 badge 时序 | Desktop 外壳的真实装配仍靠真机探针;通用 notice 接缝仍缺(UPSTREAM-SESSION-NOTICE) |
68
+
67
69
  登记覆盖面:上表登记 README 与 docs/ 中对外成文的行为承诺(含随发的服务面)。
68
70
  **有意未接线**的模块不设条目——`lib/file-reference-wsl.js`(`@` 补全的发行版侧
69
71
  遍历)按 ARCHITECTURE 的说明 built but deliberately unwired,没有对外承诺可登记;
@@ -63,7 +63,7 @@ North-star metrics:
63
63
  | Onboarding | `doctor`, `bootstrap` / `bootstrap-import`, session preflight, `profile-preset` helper | Clean-machine first-run timing still unmeasured; session UI has no toast seam |
64
64
  | Configuration | Every shipped key documented; nested `preset-wsl` rows edited through the helper | An id patch of `wsl-shell` / `wsl-fs` still only warns |
65
65
  | Quality | Unit files including `fs-routing`; coverage 85/84/70; qemu aarch64 18-check; five-family container agent; COMPATIBILITY.md | Nightly `probes` job is GitHub-hosted `windows-latest` (skips without WSL); physical aarch64 out of scope |
66
- | Ecosystem | npm package, bundle patch, bilingual locale, issue templates | Upstream seams remain: `ensureSession` monkey patch, argv-shape search interception, missing `FileReferenceTraversal` |
66
+ | Ecosystem | npm package, bundle patch, bilingual locale, issue templates | Upstream seams remain: `createSession` monkey patch, argv-shape search interception, missing `FileReferenceTraversal` |
67
67
 
68
68
  ### 0.12.0 baseline (historical)
69
69
 
@@ -3,7 +3,7 @@
3
3
  Status: measured and deferred (2026-10-19; checked against a
4
4
  `dsh-v0.2.1-rc.2`-era upstream — the checked version was not recorded at
5
5
  the time. Plugin-side behavior re-verified 2026-11-02 against the peer floor
6
- then in force, `>=0.2.1-rc.3`; the floor has since moved to `>=0.2.2-rc.1` in
6
+ then in force, `>=0.2.1-rc.3`; the floor has since moved to `>=0.2.2-rc.2` in
7
7
  `package.json`). Online check 2026-11-06: upstream `v0.2.2-rc.1` (2026-11-04) still mounts no
8
8
  `FileReferenceTraversal`; the interface lives in open discussion
9
9
  [#10264](https://github.com/deepseek-ai/deepseek-harness/discussions/10264) with no implementation. The `@` completion in
@@ -11,15 +11,19 @@ Update 2026-11-06: the `0.2.1-rc.5` line cleared the flag in
11
11
  `launchDetachedApp` (`clearedElectronFlag`, extracted in
12
12
  [app.asar.0.2.1-rc.5.open-in-app.index.js](upstream/app.asar.0.2.1-rc.5.open-in-app.index.js)),
13
13
  and **`0.2.2-rc.1` lost that clearing** — the regression is back on the
14
- current runtime. The local machine carries a re-applied patch to the
15
- installed `app.asar` (same helper, both `lib/index.js` and
16
- `lib/types/resolver.js` of `@deepseek-ai/dsh-host-open-in-app`);
17
- `test/probe/open-in-app-patch.sh` detects which state an install is in
18
- (upstream-fixed / locally-patched / broken) and must be run after every app
19
- upgrade, because an upgrade replaces the archive and silently drops the
20
- local patch.
14
+ current runtime.
21
15
 
22
- ### Local patch 2 — WSL workspaces open through `--folder-uri` (verified 2026-11-06)
16
+ **No host patch is required for this plugin's path.** The `wsl-open-in-app`
17
+ row (below) registers its own authenticated launch route and scrubs
18
+ `ELECTRON_RUN_AS_NODE` from the editor child's environment, so the plugin's
19
+ **在 VS Code 中打开(WSL)** menu item works on an unpatched archive and lands in
20
+ Remote-WSL. The shipped "Open in app" item still inherits the flag and still
21
+ fails; that half remains the upstream ask. The local archive patches described
22
+ below are historical. `test/probe/open-in-app-patch.sh` now reports the plugin
23
+ bridge's presence and the archive's state as diagnostic facts; it no longer
24
+ prescribes re-patching, because an app upgrade cannot drop the plugin row.
25
+
26
+ ### Historical local patch 2 — WSL workspaces open through `--folder-uri` (verified 2026-11-06)
23
27
 
24
28
  Riding on the same re-patch: a WSL UNC workspace
25
29
  (`\\wsl.localhost\<distro>\...`) passed as a plain path opens a plain-folder
@@ -36,6 +40,24 @@ content is the URI text, so the explicit `--folder-uri=` form is required.
36
40
  The patched module is archived in
37
41
  [app.asar.0.2.2-rc.1.open-in-app.index.js](upstream/app.asar.0.2.2-rc.1.open-in-app.index.js).
38
42
 
43
+ ### Bridge in this repository
44
+
45
+ `src/open-in-app.ts` replaces the archive patch with two Host-side facts:
46
+
47
+ - the `wsl-open-in-app` row scrubs `ELECTRON_RUN_AS_NODE` from the **editor
48
+ child's** environment before spawning it, so an Electron editor starts as an
49
+ application; the Host process environment is left alone, because deleting the
50
+ name there breaks Node-mode helpers such as the Windows Job runner;
51
+ - the row registers `POST /api/wsl-env/open-in-app` on the authenticated
52
+ `/api` channel. The browser's session-header menu posts the Session cwd; the
53
+ handler accepts only a `\\wsl...` UNC path, builds the
54
+ `vscode-remote://wsl%2B<distro>/<path>` URI, and launches the editor with
55
+ `--folder-uri`.
56
+
57
+ An app upgrade replaces `app.asar` but not the plugin, so the fix survives
58
+ upgrades; no local patch is needed. If upstream clears the flag itself, the
59
+ first step becomes a no-op.
60
+
39
61
  Upstream ask, extended: besides clearing `ELECTRON_RUN_AS_NODE`, resolve a
40
62
  WSL UNC workspace to its `vscode-remote` URI for Electron editors, so the
41
63
  launched window is already in Remote-WSL.
@@ -85,6 +107,6 @@ Drop `ELECTRON_RUN_AS_NODE` in `launchDetachedApp()` (or in the shared
85
107
  `scrubbedParentEnv()`), matching `dsh-subprocess-local`. Any Electron
86
108
  target (VS Code, Cursor, …) hits the same path.
87
109
 
88
- This repository will not work around the Host spawn: the plugin does not
89
- own that launcher, and a WSL-specific env filter would not help Windows
90
- workspaces.
110
+ The plugin owns a narrow launch bridge because the upstream launcher offers no
111
+ configuration seam: one environment-name deletion plus one WSL-only route. The
112
+ upstream ask above remains the permanent fix.
@@ -29,6 +29,13 @@ client slot for one. The plugin's `wsl-preflight` therefore warns into the log
29
29
  and the runtime context, and the full check is `pnpm run doctor`
30
30
  ([`scripts/doctor.mjs`](../scripts/doctor.mjs)).
31
31
 
32
+ One narrow exception is worth naming: a plugin that already owns a surface can
33
+ render its own UI in a list slot. The access-mode reminder uses
34
+ `conversation.input.dock` for the one state it can identify client-side (a distro
35
+ workspace on a non-WSL preset), which is a plugin-owned banner — not a general
36
+ advisory seam. An arbitrary session-start finding still has nowhere dedicated to
37
+ appear, which is what this proposal asks for.
38
+
32
39
  ## What an advisory needs
33
40
 
34
41
  `wsl-preflight` runs when a distro session opens. Its findings are advisory:
package/docs/VALUE.md ADDED
@@ -0,0 +1,146 @@
1
+ # dsh-plugin-wsl-env value proposition
2
+
3
+ [中文](VALUE.zh.md)
4
+
5
+ This page answers one question only: **why it is worth installing this plugin to work on WSL projects with DeepSeek Harness on Windows.**
6
+ Features, installation, and per-item behavior are covered in [README](../README.md) and [ARCHITECTURE.md](ARCHITECTURE.md); this page discusses benefits, costs, and applicable boundaries.
7
+ Every claim here points to evidence that can be reviewed in the repository; the baseline is v0.22.0 (2026-11-08). Earlier entries were introduced on the v0.9.0 baseline, and versions, tool surface, and the gate chain were reviewed on 2026-11-09.
8
+
9
+ > **In one sentence**: it turns a WSL distribution into the real execution environment of a DSH session — commands, files, terminals, and the directory picker all complete inside the distribution,
10
+ > while DSH's permission model and the distribution's bubblewrap sandbox are preserved; it installs no service of its own into the distribution and opens no port.
11
+
12
+ ## 1. Without it, three mismatches
13
+
14
+ DSH is a Windows desktop app, and the project lives on WSL's ext4. Without integration, three things are misaligned at once:
15
+
16
+ | Mismatch | Concrete symptom | Consequence |
17
+ |---|---|---|
18
+ | Location | The app only understands `\\wsl.localhost\<distro>\...`, while tools expect `/home/...` | Paths must be translated back and forth; the 9p share is noticeably slow with many small files; symlinks and permission bits are no longer faithful across the share layer |
19
+ | Environment | Commands execute on the Windows side | The distribution's `PATH`, `nvm`, `cargo`, `pyenv`, rc configuration, and native `rg` are all unusable; scripts either cannot find an interpreter or silently use a different binary |
20
+ | Security | The Windows sandbox's restricted token cannot reach WSL (`wsl.exe` returns `Wsl/E_ACCESSDENIED`) | Usually you can only choose one of "can operate on WSL" and "commands have boundaries" |
21
+
22
+ Available options each have a cost: installing the whole CLI inside WSL is cleanest, but DSH is a desktop app and cannot be moved there; desktop remote (VS Code Remote-WSL, ZCode and similar) is mature, but requires placing a service directory in the distribution, opening a port, and commands have no sandbox; doing nothing leaves the three mismatches above.
23
+ This plugin fills the combination beyond those three: **the app stays on Windows, the execution world moves into the distribution, and the boundary stays outside the command.**
24
+
25
+ ## 2. Six sources of value
26
+
27
+ ### Value 1: the first command is already in the right environment
28
+
29
+ **Mechanism.** When a session opens a distribution directory, `auto-preset` automatically attaches the `wsl` preset; `wsl-shell` executes `wsl.exe --exec <shell> -lc <cmd>` using the login shell configured for the distribution (it does not hard-code bash). `PATH`, version managers, and rc files therefore all take effect.
30
+
31
+ **Perceivable difference.** There is nothing to `source` first, and no need to tell the model the paths of `nvm`/`pyenv` by hand. When the model says "run the tests", it uses the same `node`, `pnpm`, and `cargo` you would use in that terminal. The first command is already correct; there is no "warm up the environment with one command first" step.
32
+
33
+ **Evidence.** [README "Using it"](../README.md#using-it); `test/shell.test.mjs`, `test/preset-choice.test.mjs`; `pnpm run probe:sandbox-shell`.
34
+
35
+ ### Value 2: files are the distribution's real files
36
+
37
+ **Mechanism.** Reads, writes, and searches land on ext4 through a resident agent: native symlinks, native mode bits, and the distribution's own `rg`. The GUI file tree and preview are likewise served from inside the distribution. Search arguments are forwarded verbatim to the distribution's `rg`; results, output format, and exit code are rg's own, and the directory's `.gitignore` is honored.
38
+
39
+ **Perceivable difference.** `chmod +x`, `ln -s`, git hooks, and tools dispatched by content behave as they do on a Linux host; `glob`/`grep` no longer cross the slow 9p bridge, nor use the Windows-side copy of rg to read Linux directories. `/home/you/x` in the folder and `\\wsl.localhost\ubuntu\home\you\x` in the GUI are the same file, not copies.
40
+
41
+ **Evidence.** [ARCHITECTURE "The filesystem substrate"](ARCHITECTURE.md#the-filesystem-substrate), [LIMITATIONS](LIMITATIONS.md); `test/search-route.test.mjs`, `test/search-exec.test.mjs`, `test/fs-substrate.test.mjs`; `pnpm run probe:substrate` (8/8). Known limits are in section 4: new files 0600, filenames containing backslashes, watch using polling.
42
+
43
+ ### Value 3: the sandbox is the default, and failure is loud
44
+
45
+ **Mechanism.** A session's restricted commands run through a `bubblewrap` mount profile inside the same systemd user scope (background processes, a real `/tmp`, visible to `ps`), and the scope stops when the session ends; the three permission tiers (`read-only` / `workspace-write` / `danger-full-access`) take effect tier by tier; file writes are checked against the same policy, and writes under restricted policies are additionally rejected by the kernel inside the bwrap configuration. When no usable bwrap exists, the command reports `SANDBOX_UNAVAILABLE` instead of running outside the sandbox.
46
+
47
+ **Perceivable difference.** Restricted commands and writes are bound by the workspace policy, but this is not complete isolation: Windows interop and other routes can still cross the Linux-side write boundary. When denied, the model receives an offer to "retry with just enough permission", not a direct request for `danger-full-access`. Auditing yields the mode actually enforced at the time and the denial reason; in configurations that explicitly pin a distribution, file tools reject cross-distribution paths with `FS_OUTSIDE_DISTRO`, and widening permissions does not lift it.
48
+
49
+ **Honest boundary.** Reporting is `enforcement: partial`, because processes inside the distribution can still launch Windows programs through interop; `maskWindowsDrive` narrows this hole (`/mnt` disappears from the restricted view), but binfmt dispatches by content, so it is still not closed; fully disabling it requires `[interop] enabled=false` at the distribution level. The plugin does not describe partial enforcement as full.
50
+
51
+ **Evidence.** [ARCHITECTURE "Sandbox"](ARCHITECTURE.md#sandbox), [SECURITY](../SECURITY.md); `test/sandbox.test.mjs`, `test/fs-decisions.test.mjs`; `pnpm run probe:sandbox`, `pnpm run probe:sandbox-off`.
52
+
53
+ ### Value 4: one process, two kinds of session, the same toolbox
54
+
55
+ **Mechanism.** The composition layer routes by path coordinate: distribution UNC paths go to the agent implementation, and drive-letter paths stay with the host backend; the GUI terminal routes by session — WSL directory sessions get the distribution shell, Windows directory sessions still get PowerShell; `wsl-shell`/`wsl-fs` are mounted at the preset layer, so the environment takes effect per session.
56
+
57
+ **Perceivable difference.** There is no separate app or profile for WSL, and no need to switch the whole app into "WSL mode". In the same window, a session that opens a Windows folder is unaffected, while a session that opens `\\wsl.localhost\...` automatically enters the distribution. Changing projects is just changing the open folder. This matters especially on the model side: the plugin adds exactly one model tool, `wsl_doctor` (plus the `/wsl-doctor` command); every other existing tool keeps its name, parameters, and return semantics — only the world it actually acts on changes.
58
+
59
+ **Evidence.** [README "Architecture"](../README.md#architecture), [docs/root-fs-routing.md](root-fs-routing.md); `test/composition.test.mjs`, `test/terminal.test.mjs`, `test/fs.boot.test.mjs`.
60
+
61
+ ### Value 5: no service installed, no port opened, no residue
62
+
63
+ **Mechanism.** No service is installed in the distribution, and no port is listening; the plugin replaces DSH's service implementations and adds the `wsl_doctor` tool and the `/wsl-doctor` command. File operations and commands go through a resident agent cached per distribution — it is a transport layer, not a registered system service, and the agent script verifies sha256 during the handshake.
64
+
65
+ **Perceivable difference.** No extra directories such as `~/.vscode-server` appear, no conflict with local ports arises, and after uninstalling there is no server-side directory in the distribution left to clean up by hand. After a WSL upgrade or a distribution restart, the next call rebuilds the transport; only if the agent dies while "a request is in flight" can it exhaust its one rebuild allowance (see [LIMITATIONS](LIMITATIONS.md)) — a declared boundary, not the everyday path.
66
+
67
+ **Note the distinction.** "No service installed" is not "zero dependencies": bubblewrap is a hard dependency of the default path; the session runtime also requires systemd as PID 1 and the user manager to have `enable-linger` applied (a transient scope, not an installed resident service). ripgrep, git, and inotify-tools are checked by `pnpm run bootstrap`. The plugin does not bundle these tools, nor does it install a resident service in the distribution.
68
+
69
+ **Evidence.** [README "How it compares"](../README.md#how-it-compares); `agent/wsl-agent.sh`, `test/agent.test.mjs`; `scripts/bootstrap.sh`.
70
+
71
+ ### Value 6: the model gets facts, not guesses
72
+
73
+ **Mechanism.** The session environment exposes `DSH_WSL_DISTRO`, `DSH_WSL_SHELL`, `DSH_WSL_HOME`, and `DSH_WSL_PORTS` to the model; ports refresh on a cadence of about 10 seconds. Error codes are classified by their thrower (`FS_OUTSIDE_DISTRO`, `SANDBOX_UNAVAILABLE`, `FS_STALE_VERSION`, and so on), each stating who denied and how to resolve it. If tools are missing when a session opens, it gives the installation command for that distribution directly.
74
+
75
+ **Perceivable difference.** The model can name the exact address of the dev server it started (WSL2 forwards localhost to Windows, so a browser can open it directly); path denials, missing sandboxes, and stale files each have their own code, so troubleshooting does not begin by guessing from "the command failed". What this reduces is round trips, not merely how nice the error message looks.
76
+
77
+ **Evidence.** [ARCHITECTURE "Error codes"](ARCHITECTURE.md#error-codes), [README "Troubleshooting"](../README.md#troubleshooting); `test/ports.test.mjs`, `test/preflight.test.mjs`, `test/terminal.test.mjs`.
78
+
79
+ ## 3. Value comparison with alternatives
80
+
81
+ | | No integration (open UNC on the Windows side) | Desktop remote (VS Code Remote-WSL, etc.) | Install the CLI inside WSL | This plugin |
82
+ |---|---|---|---|---|
83
+ | Command environment | Windows | Distribution | Distribution | Distribution |
84
+ | File semantics | 9p share, slow and loses POSIX details | Native inside the distribution | Native inside the distribution | Native inside the distribution (ext4) |
85
+ | Command sandbox | Windows sandbox cannot reach WSL | None | Depends on the CLI | In-distribution bubblewrap + systemd session scope |
86
+ | In-distribution install | None | One service directory | The whole tool | No own service (depends on system tools) |
87
+ | Port | None | Listens on one port | None | None |
88
+ | Uninstall residue | None | Manually delete the service directory | Delete the tool | None |
89
+ | Applicability | Can accept slowness and loss of semantics | Use VS Code / the corresponding desktop client | The tool can be moved entirely into WSL | Windows + DSH GUI + WSL2 |
90
+
91
+ **Say plainly where others are stronger.** Reopening a workspace in desktop remote is instantaneous, and the service is always resident; VS Code's remote has years of production hardening. A CLI installed inside WSL needs no bridge at all. This plugin does not try to win on those dimensions; it solves one combination: **DSH on Windows, the project in WSL, and commands that must be sandboxed.**
92
+
93
+ ## 4. Costs, boundaries, and non-applicability
94
+
95
+ Value is benefit minus cost. The following should be known before installation:
96
+
97
+ - **bubblewrap is a hard dependency.** Without it the default path fails every restricted command (deliberate fail-closed); restricted file writes need it too. The session runtime also requires systemd as PID 1 and the user manager to have `enable-linger` applied; a failed preflight is refused with a repair command. `pnpm run bootstrap <distro>` checks and prints install commands.
98
+ - **enforcement is partial.** Interop lets processes inside the distribution launch Windows programs. `maskWindowsDrive` only narrows it; completely closing it requires `[interop] enabled=false` in `wsl.conf`. For scenarios that require "absolute isolation from the Windows side as well", this plugin cannot deliver.
99
+ - **Two `/tmp`s.** Under `workspace-write`, commands in the session runtime and file tools use the distribution's real `/tmp`; with the session runtime off, commands use a private tmpfs while file tools still use the real `/tmp`, and the two cannot see each other. Files crossing the boundary must go through the session workspace.
100
+ - **watch prefers inotify and falls back to polling.** For unbounded directories with `inotify-tools` installed, it uses recursive inotify, coalescing at 0.5s into coarse invalidation; for file targets, depth-limited directories, or missing tools it falls back to polling, and extreme cases such as in-place `cp -p` or unpacking that restores directory mtimes can still be missed.
101
+ - **Filenames containing backslashes cannot be addressed**, because the UNC display form is the identity. Renaming is the only workaround.
102
+ - **New files publish as 0600** (the host backend's publishing semantics); `chmod` yourself when they must be executable. Published writes survive process death, but the parent directory is not fsynced, so a machine crash may lose the rename.
103
+ - **Platform and versions.** Windows + WSL2 only; Node `^22.19.0 || >=24.0.0`; DSH peer versions declare a floor, development dependencies are pinned exactly, and upgrades must be re-validated.
104
+ - **Not suitable for.** Workflows whose CLI can be installed entirely inside WSL; editor remote capabilities (IntelliSense, debugger, extensions); enterprise-grade strong isolation or multi-tenancy; projects mainly on a Windows drive (the plugin works, but the value is not there).
105
+
106
+ These are not a "will be fixed later" list but design boundaries: each one states its reason in [LIMITATIONS.md](LIMITATIONS.md). **Writing the boundaries clearly is itself a value** — it keeps "not done" from being misread as "already done".
107
+
108
+ ## 5. How the value is proven
109
+
110
+ | Level | Evidence |
111
+ |---|---|
112
+ | Every commit | `pnpm test`: style, relative links, requirement references, documentation consistency, syntax, byte-for-byte build consistency, `tsc --noEmit`, all unit tests pass |
113
+ | Coverage | `pnpm run test:coverage`, thresholds 85/84/70 (lines/branches/functions) |
114
+ | Real machine | Probe suite (`test/probe/run-all-when-closed.sh --include-fs`), including sandbox boundary demonstrations, agent/one-shot dual-path cross-checks, the filesystem substrate, terminal, and picker |
115
+ | CI | Node 22 / 24 × Linux / Windows run `pnpm test`; coverage on Node 24 |
116
+ | Upstream seams | peer pins compared byte for byte, [PEER-PARITY.md](PEER-PARITY.md), [upstream/promotion-map.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/upstream/promotion-map.md) |
117
+ | Behavior commitments | 28 registered requirements (R1–R28) and the traceability matrix in [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md) |
118
+
119
+ The real-machine probe is a manual step (hosted runners have no WSL distribution); this is a recorded verification gap (OI-2 in REQUIREMENTS), not a hidden omission.
120
+
121
+ ## 6. Decision rules
122
+
123
+ **Install it if all of the following hold:**
124
+
125
+ 1. You use the DeepSeek Harness GUI on Windows;
126
+ 2. The project is on the ext4 of a WSL2 distribution, and you want the model to work with Linux paths;
127
+ 3. You want commands to have boundaries, and you accept installing bubblewrap for that.
128
+
129
+ **Do not install it if any of the following holds:**
130
+
131
+ - Your workflow is a CLI that can be installed entirely inside WSL — installing it there directly is simpler;
132
+ - You need editor-level remote capabilities (debugging, IntelliSense, extensions);
133
+ - You need absolute isolation from Windows interop as well;
134
+ - Your project is mainly on a Windows drive, and you do not need a Linux toolchain.
135
+
136
+ ## 7. Evidence index
137
+
138
+ | What you want to know | Where to look |
139
+ |---|---|
140
+ | Features, installation, configuration | [README](../README.md) / [Chinese README](README.zh.md) |
141
+ | How the pieces are mounted, path coordinates, sandbox design | [ARCHITECTURE.md](ARCHITECTURE.md) |
142
+ | What it does not do, and why | [LIMITATIONS.md](LIMITATIONS.md) |
143
+ | Every configuration key | [CONFIGURATION.md](CONFIGURATION.md) |
144
+ | Parity audit against VS Code Remote-WSL | [PARITY.md](PARITY.md) |
145
+ | Byte-for-byte contract with upstream fsio | [PEER-PARITY.md](PEER-PARITY.md) |
146
+ | Security boundaries and reporting channel | [SECURITY.md](../SECURITY.md) |
package/docs/VALUE.zh.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # dsh-plugin-wsl-env 价值说明
2
2
 
3
+ [English](VALUE.md)
4
+
3
5
  本文只回答一个问题:**在 Windows 上用 DeepSeek Harness 做 WSL 项目,为什么值得装这个插件。**
4
- 功能、安装与逐项行为见 [README](../README.md) 和 [ARCHITECTURE.md](ARCHITECTURE.md),这里谈收益、代价与适用边界。
6
+ 功能、安装与逐项行为见 [README](README.zh.md) 和 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md),这里谈收益、代价与适用边界。
5
7
  文中每条主张都指向仓库内可复核的证据;基线为 v0.22.0(2026-11-08)。早期条目在 v0.9.0 基线上引入,2026-11-09 对版本、工具面与门禁链做了复核。
6
8
 
7
9
  > **一句话**:它把 WSL 发行版变成 DSH 会话真正的执行环境——命令、文件、终端、目录选择器都在发行版内完成,
@@ -28,7 +30,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
28
30
 
29
31
  **可感知的差别。** 不需要先 `source` 什么,也不需要把 `nvm`/`pyenv` 的路径手工告诉模型。模型说「跑一下测试」,用的就是你在那个终端里会用的 `node`、`pnpm`、`cargo`。第一条命令已经是对的,不存在「先热身一条命令把环境带起来」。
30
32
 
31
- **证据。** [README「Using it」](../README.md#using-it);`test/shell.test.mjs`、`test/preset-choice.test.mjs`;`pnpm run probe:sandbox-shell`。
33
+ **证据。** [README「使用」](README.zh.md#使用);`test/shell.test.mjs`、`test/preset-choice.test.mjs`;`pnpm run probe:sandbox-shell`。
32
34
 
33
35
  ### 价值二:文件是发行版的真实文件
34
36
 
@@ -36,7 +38,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
36
38
 
37
39
  **可感知的差别。** `chmod +x`、`ln -s`、git hook、按内容分发的工具,行为与 Linux 主机一致;`glob`/`grep` 不再跨 9p 慢桥,也不再用 Windows 侧那份 rg 去读 Linux 目录。文件夹里的 `/home/you/x` 与 GUI 里的 `\\wsl.localhost\ubuntu\home\you\x` 是同一个文件,不是副本。
38
40
 
39
- **证据。** [ARCHITECTURE「The filesystem substrate」](ARCHITECTURE.md#the-filesystem-substrate)、[LIMITATIONS](LIMITATIONS.md);`test/search-route.test.mjs`、`test/search-exec.test.mjs`、`test/fs-substrate.test.mjs`;`pnpm run probe:substrate`(8/8)。已知极限见第 4 节:新文件 0600、含反斜杠的文件名、watch 为轮询。
41
+ **证据。** [ARCHITECTURE「文件系统 substrate」](ARCHITECTURE.zh.md#文件系统-substrate)、[LIMITATIONS](LIMITATIONS.zh.md);`test/search-route.test.mjs`、`test/search-exec.test.mjs`、`test/fs-substrate.test.mjs`;`pnpm run probe:substrate`(8/8)。已知极限见第 4 节:新文件 0600、含反斜杠的文件名、watch 为轮询。
40
42
 
41
43
  ### 价值三:沙箱是默认,失败是响亮的
42
44
 
@@ -46,7 +48,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
46
48
 
47
49
  **诚实边界。** 上报是 `enforcement: partial`,因为发行版内的进程仍可通过 interop 启动 Windows 程序;`maskWindowsDrive` 收窄这个洞(`/mnt` 在受限视图里消失),但 binfmt 按内容分发,所以它仍不是闭合;完全关闭要在发行版层面设 `[interop] enabled=false`。插件不把 partial 说成 full。
48
50
 
49
- **证据。** [ARCHITECTURE「Sandbox」](ARCHITECTURE.md#sandbox)、[SECURITY](../SECURITY.md);`test/sandbox.test.mjs`、`test/fs-decisions.test.mjs`;`pnpm run probe:sandbox`、`pnpm run probe:sandbox-off`。
51
+ **证据。** [ARCHITECTURE「沙箱」](ARCHITECTURE.zh.md#沙箱)、[SECURITY](../SECURITY.zh.md);`test/sandbox.test.mjs`、`test/fs-decisions.test.mjs`;`pnpm run probe:sandbox`、`pnpm run probe:sandbox-off`。
50
52
 
51
53
  ### 价值四:一个进程,两种会话,工具箱不变
52
54
 
@@ -54,17 +56,17 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
54
56
 
55
57
  **可感知的差别。** 不需要为 WSL 单开一个应用或 profile,也不需要把整个应用切成「WSL 模式」。同一个窗口里,开 Windows 文件夹的会话不受影响,开 `\\wsl.localhost\...` 的会话自动进入发行版。换项目只是换一个打开的文件夹。模型侧尤其重要:插件只新增 `wsl_doctor` 一个模型工具(另有 `/wsl-doctor` 命令);其余现有工具的名字、参数、返回语义不变,变的只是它们实际作用的世界。
56
58
 
57
- **证据。** [README「Architecture」](../README.md#architecture)、[docs/root-fs-routing.md](root-fs-routing.md);`test/composition.test.mjs`、`test/terminal.test.mjs`、`test/fs.boot.test.mjs`。
59
+ **证据。** [README「架构」](README.zh.md#架构)、[docs/root-fs-routing.md](root-fs-routing.md);`test/composition.test.mjs`、`test/terminal.test.mjs`、`test/fs.boot.test.mjs`。
58
60
 
59
61
  ### 价值五:不装服务、不开端口、没有残留
60
62
 
61
63
  **机制。** 发行版里没有安装任何服务,也没有监听端口;插件替换 DSH 的服务实现,并新增 `wsl_doctor` 工具与 `/wsl-doctor` 命令。文件操作与命令走发行版内按 distro 缓存的常驻 agent——它是传输层,不注册系统服务,agent 脚本在握手时校验 sha256。
62
64
 
63
- **可感知的差别。** 不会多出 `~/.vscode-server` 这类目录,不会和本机端口冲突,卸载后发行版里没有需要手动清理的服务端目录。WSL 升级或发行版重启后,下一次调用重建传输;只有 agent 在「有请求在飞」时死亡才可能耗尽它的一次重建额度(见 [LIMITATIONS](LIMITATIONS.md)),这是已声明的边界,不是日常路径。
65
+ **可感知的差别。** 不会多出 `~/.vscode-server` 这类目录,不会和本机端口冲突,卸载后发行版里没有需要手动清理的服务端目录。WSL 升级或发行版重启后,下一次调用重建传输;只有 agent 在「有请求在飞」时死亡才可能耗尽它的一次重建额度(见 [LIMITATIONS](LIMITATIONS.zh.md)),这是已声明的边界,不是日常路径。
64
66
 
65
67
  **注意区分。** 「不装服务」不等于「零依赖」:bubblewrap 是默认路径的硬依赖;会话 runtime 还需要 systemd 为 PID 1 且 user manager 已 `enable-linger`(临时 scope,不是安装的常驻服务)。ripgrep、git、inotify-tools 由 `pnpm run bootstrap` 体检。插件不把这些工具打包进来,也不在发行版里安装常驻服务。
66
68
 
67
- **证据。** [README「How it compares」](../README.md#how-it-compares);`agent/wsl-agent.sh`、`test/agent.test.mjs`;`scripts/bootstrap.sh`。
69
+ **证据。** [README「方案对比」](README.zh.md#方案对比);`agent/wsl-agent.sh`、`test/agent.test.mjs`;`scripts/bootstrap.sh`。
68
70
 
69
71
  ### 价值六:模型拿到事实,不用猜
70
72
 
@@ -72,7 +74,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
72
74
 
73
75
  **可感知的差别。** 模型能说出它启动的 dev server 的确切地址(WSL2 把 localhost 转发给 Windows,浏览器可直接打开);路径拒绝、沙箱缺失、文件过期各有各的码,排错不用从「命令失败了」开始猜。这减少的是往返次数,不只是错误信息的好看程度。
74
76
 
75
- **证据。** [ARCHITECTURE「Error codes」](ARCHITECTURE.md#error-codes)、[README「Troubleshooting」](../README.md#troubleshooting);`test/ports.test.mjs`、`test/preflight.test.mjs`、`test/terminal.test.mjs`。
77
+ **证据。** [ARCHITECTURE「错误码」](ARCHITECTURE.zh.md#错误码)、[README「常见问题」](README.zh.md#常见问题);`test/ports.test.mjs`、`test/preflight.test.mjs`、`test/terminal.test.mjs`。
76
78
 
77
79
  ## 3. 和替代方案的价值对照
78
80
 
@@ -101,7 +103,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
101
103
  - **平台与版本。** 仅 Windows + WSL2;Node `^22.19.0 || >=24.0.0`;DSH peer 声明版本下限,开发依赖精确钉版,升级须重新验证。
102
104
  - **不适合的情况。** 工作流本来就能整个装进 WSL 的 CLI;需要 VS Code 远程的编辑器能力(IntelliSense、调试器、扩展);需要企业级强隔离或多租户;项目主要在 Windows 盘上(插件能用,但价值不在这里)。
103
105
 
104
- 这些不是「以后会修」的清单,而是设计边界:每一条都在 [LIMITATIONS.md](LIMITATIONS.md) 里写明原因。**把边界写清楚本身也是价值**——它让「没做到」不被误读成「已经做到」。
106
+ 这些不是「以后会修」的清单,而是设计边界:每一条都在 [LIMITATIONS.zh.md](LIMITATIONS.zh.md) 里写明原因。**把边界写清楚本身也是价值**——它让「没做到」不被误读成「已经做到」。
105
107
 
106
108
  ## 5. 价值如何被证明
107
109
 
@@ -135,10 +137,10 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
135
137
 
136
138
  | 想知道 | 看 |
137
139
  |---|---|
138
- | 功能、安装、配置 | [README](../README.md) / [中文 README](README.zh.md) |
139
- | 部件如何挂载、路径坐标、沙箱设计 | [ARCHITECTURE.md](ARCHITECTURE.md) |
140
- | 不做什么、为什么 | [LIMITATIONS.md](LIMITATIONS.md) |
140
+ | 功能、安装、配置 | [中文 README](README.zh.md) / [English](../README.md) |
141
+ | 部件如何挂载、路径坐标、沙箱设计 | [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md) |
142
+ | 不做什么、为什么 | [LIMITATIONS.zh.md](LIMITATIONS.zh.md) |
141
143
  | 每个配置键 | [CONFIGURATION.md](CONFIGURATION.md) |
142
144
  | 与 VS Code Remote-WSL 的 parity 审计 | [PARITY.md](PARITY.md) |
143
145
  | 与上游 fsio 的逐字节合同 | [PEER-PARITY.md](PEER-PARITY.md) |
144
- | 安全边界与上报渠道 | [SECURITY.md](../SECURITY.md) |
146
+ | 安全边界与上报渠道 | [SECURITY.zh.md](../SECURITY.zh.md) |