dsh-plugin-wsl-env 0.24.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 (94) hide show
  1. package/CHANGELOG.md +136 -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 +18 -6
  7. package/SECURITY.md +12 -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 +17 -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 +30 -9
  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 +45 -2
  21. package/docs/CONFIGURATION.zh.md +39 -3
  22. package/docs/DIAGNOSTICS.md +12 -2
  23. package/docs/DIAGNOSTICS.zh.md +5 -1
  24. package/docs/LIMITATIONS.md +60 -9
  25. package/docs/LIMITATIONS.zh.md +45 -9
  26. package/docs/MIGRATION.md +6 -3
  27. package/docs/MIGRATION.zh.md +91 -0
  28. package/docs/PEER-PARITY.md +63 -51
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +21 -6
  32. package/docs/QUICKSTART.zh.md +16 -4
  33. package/docs/README.zh.md +28 -19
  34. package/docs/RELEASING.md +19 -14
  35. package/docs/REQUIREMENTS.zh.md +6 -3
  36. package/docs/ROADMAP-1.0.md +1 -1
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
  39. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  40. package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
  41. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  42. package/docs/VALUE.md +146 -0
  43. package/docs/VALUE.zh.md +15 -13
  44. package/docs/root-fs-routing.md +1 -1
  45. package/lib/agent-confined.d.ts +7 -1
  46. package/lib/agent-confined.js +3 -3
  47. package/lib/auto-preset-seam.d.ts +45 -0
  48. package/lib/auto-preset-seam.js +47 -0
  49. package/lib/auto-preset.d.ts +33 -10
  50. package/lib/auto-preset.js +148 -44
  51. package/lib/bwrap.d.ts +14 -0
  52. package/lib/bwrap.js +11 -0
  53. package/lib/cwd-prompt.d.ts +41 -3
  54. package/lib/cwd-prompt.js +125 -8
  55. package/lib/doctor-live.d.ts +30 -0
  56. package/lib/doctor-live.js +37 -0
  57. package/lib/doctor-report.d.ts +50 -0
  58. package/lib/doctor-report.js +172 -0
  59. package/lib/fs-routing.d.ts +1 -1
  60. package/lib/fs-routing.js +1 -1
  61. package/lib/fs.d.ts +1 -1
  62. package/lib/fs.js +1 -1
  63. package/lib/index.d.ts +6 -1464
  64. package/lib/index.js +5 -2120
  65. package/lib/messages.d.ts +20 -1
  66. package/lib/messages.js +31 -3
  67. package/lib/open-in-app.d.ts +206 -0
  68. package/lib/open-in-app.js +300 -0
  69. package/lib/preflight.d.ts +7 -4
  70. package/lib/preflight.js +27 -13
  71. package/lib/preset-choice.d.ts +13 -0
  72. package/lib/preset-choice.js +18 -1
  73. package/lib/provider-common.d.ts +58 -0
  74. package/lib/provider-common.js +123 -0
  75. package/lib/sandbox-core.d.ts +1 -0
  76. package/lib/sandbox-core.js +4 -2
  77. package/lib/session-runtime.d.ts +7 -1
  78. package/lib/session-runtime.js +9 -2
  79. package/lib/shell.d.ts +1 -1
  80. package/lib/shell.js +1 -1
  81. package/lib/status.js +2 -1
  82. package/lib/writable-roots.d.ts +109 -0
  83. package/lib/writable-roots.js +257 -0
  84. package/lib/wsl-doctor-command.js +2 -1
  85. package/lib/wsl-doctor-tool.js +2 -2
  86. package/lib/wsl-filesystem.d.ts +692 -0
  87. package/lib/wsl-filesystem.js +897 -0
  88. package/lib/wsl-shell.d.ts +742 -0
  89. package/lib/wsl-shell.js +965 -0
  90. package/lib/wsl.d.ts +1 -1
  91. package/lib/wsl.js +1 -1
  92. package/package.json +48 -24
  93. package/scripts/doctor.mjs +1 -1
  94. package/scripts/profile-preset.mjs +17 -5
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
@@ -43,14 +44,14 @@ build step at pack time.
43
44
  The coverage thresholds are 85 lines / 84 branches / 70 functions. The
44
45
  branch threshold is one point under the others deliberately: the
45
46
  integration layer is now measured, and part of what it leaves uncovered
46
- needs a live `wsl.exe` — the distro-bound paths in `lib/index.js` (the
47
- resolved home, the distro home, arming the watcher), the `wsl.exe` calls
47
+ needs a live `wsl.exe` — the distro-bound paths in `lib/wsl-filesystem.js` and
48
+ `lib/wsl-shell.js` (the resolved home, the distro home, arming the watcher), the `wsl.exe` calls
48
49
  in `lib/wsl.js` (`defaultDistro`'s no-distro throw, `linuxHomePath`,
49
50
  and the other distro calls), and the real spawn internals
50
51
  in `lib/watcher.js`. The real-machine probes cover that tail, not CI.
51
52
  The rest of the uncovered branches — the host-path arm of
52
- `wslWritableRoots`, the sandbox-error and rethrow arms, the
53
- unrestricted-path result, all in `lib/index.js` — is ordinary
53
+ `wslWritableRoots` in `lib/provider-common.js`, the sandbox-error and rethrow
54
+ arms, and the unrestricted-path result in `lib/wsl-filesystem.js` — are ordinary
54
55
  CI-coverable code. Do not raise the branch number without either covering
55
56
  the `wsl.exe` tail on the Windows CI legs or moving the coverage job
56
57
  (currently `runs-on: ubuntu-latest` in `.github/workflows/ci.yml`) to
@@ -213,25 +214,29 @@ the mirror does not, or one that differs.
213
214
  That destination is outside a session workspace, so a confined agent session is
214
215
  refused there and has to approve a wider permission for the one command.
215
216
 
216
- ## 8.5. Announce on the upstream discussion
217
+ ## 8.5. Announce on the upstream discussions
217
218
 
218
- Every release appends an update comment to the plugin's upstream thread,
219
- [deepseek-ai/deepseek-harness discussion #8644](https://github.com/deepseek-ai/deepseek-harness/discussions/8644)
220
- (node id `D_kwDOT3T1g84AptnQ`), so followers of that thread see each version
219
+ Every release appends an update comment to both plugin threads in
220
+ [deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness):
221
+ [discussion #8644](https://github.com/deepseek-ai/deepseek-harness/discussions/8644)
222
+ (node id `D_kwDOT3T1g84AptnQ`) and
223
+ [discussion #11251](https://github.com/deepseek-ai/deepseek-harness/discussions/11251)
224
+ (node id `D_kwDOT3T1g84AqhvH`), so followers of either thread see each version
221
225
  without watching this repository:
222
226
 
223
- - One comment per release, in Chinese (the thread's established language for
224
- updates; the English original stays as the top post, refreshed on notable
225
- releases).
227
+ - One comment per release in **each** thread, in Chinese (the established
228
+ language for updates; the English original stays as the top post, refreshed
229
+ on notable releases).
226
230
  - Content: the version, the two or three headline changes, the current
227
231
  verification snapshot in one line (unit tests, matrix, container and qemu
228
232
  legs, nightly probes), and the release link.
229
233
  - Post it with the same GraphQL mutation the 2026-10-27 update used
230
234
  (`addDiscussionComment` on the discussion's node id) from a session that
231
235
  holds the maintainer's GitHub credentials — the release workflow's
232
- `GITHUB_TOKEN` is scoped to this repository and cannot write there.
236
+ `GITHUB_TOKEN` is scoped to this repository and cannot write there. Post the
237
+ same body to both, then read each back and compare it to the local source.
233
238
 
234
- This is a hard checklist item, not a nicety: the thread is where the DSH
239
+ This is a hard checklist item, not a nicety: the threads are where the DSH
235
240
  community found the plugin, and a stale thread reads as an abandoned one.
236
241
 
237
242
  ## 9. If a version turns out to be bad
@@ -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) |
@@ -45,7 +45,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
45
45
  | R9 | bubblewrap 沙箱:与 Linux runner 同参数、fail-closed、`enforcement: partial` 诚实上报 | ARCHITECTURE「Sandbox」全节;SECURITY「Sandbox enforcement is `partial` by design」 | ①②③⑤⑥:选型依据(ACL 令牌触不到 WSL)、探针失败不缓存、interop 洞 + `maskWindowsDrive` 收窄及其自身极限(binfmt 按内容分发)、完全关闭唯一路径(`wsl.conf`)、`sandbox: false` 退出——行为到边界到逃生门完整成链 | `sandbox.test.mjs`、`probe-cache.test.mjs`;probe:sandbox、probe:sandbox-off | interop 使 enforcement 恒为 partial——已声明的设计边界 |
46
46
  | R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap 指引;grep 回退被拒绝且理由明文(不读 `.gitignore`,非 rg 替身) | `search-route.test.mjs`、`search-exec.test.mjs` | — |
47
47
  | R11 | watch():inotify 优先(无界目录),轮询回退;粗粒度失效 | PARITY「Contract audit」第 1 条;LIMITATIONS watch 两条 | ①②③:契约向上追溯到宿主接缝(`changed()` 无载荷 → 粗粒度失效即可);inotify 递归且 0.5s 合并、文件/限深/无 inotify-tools 回退轮询;更旧 mtime 盲区只属轮询路径、`watchMaxDepth` 旋钮、目标消失响亮报错成文 | `watcher.test.mjs`;probe:watch(无 inotify 时 7/7;装 inotify-tools 后盲区检查改为期望事件) | 轮询回退的 mtime 盲区已声明;inotify 路径依赖发行版的 inotify-tools |
48
- | R12 | share 基座退役:携带 `substrate: "share"` 的 profile 在 boot 被拒并附迁移 | README/CONFIGURATION/LIMITATIONS 三处一致 | ①②⑤:旧值处置与用户所见成文,迁移指引内嵌 | `fs-decisions.test.mjs`(拒绝消息与迁移指引文案) | boot 期拒绝分支无测试(构造器调 `shareSubstrateRefusal`,`src/index.ts:1595`):`fs.boot.test.mjs` 只以 `sandbox: true` 启动该行,仓内没有构造 `substrate: "share"` profile 的测试 |
48
+ | R12 | share 基座退役:携带 `substrate: "share"` 的 profile 在 boot 被拒并附迁移 | README/CONFIGURATION/LIMITATIONS 三处一致 | ①②⑤:旧值处置与用户所见成文,迁移指引内嵌 | `fs-decisions.test.mjs`(拒绝消息与迁移指引文案) | boot 期拒绝分支无测试(构造器调 `shareSubstrateRefusal`,`src/wsl-filesystem.ts:225`):`fs.boot.test.mjs` 只以 `sandbox: true` 启动该行,仓内没有构造 `substrate: "share"` profile 的测试 |
49
49
  | R13 | 会话级 systemd scope:命令共享后台进程/真实 `/tmp`/`ps`,scope 随会话结束停止;systemd + linger 缺失时预检带修复拒绝 | ADR 0001;README/CONFIGURATION/LIMITATIONS 的 `sessionSandbox` 条 | ①②③⑤:scope 生命周期(agent 为主进程、refcount、dispose stop)、`sessionSandbox: false` 退出与 `auto` 回退、systemd/linger/systemd-run 四项预检与缓存策略成文;`/tmp` 与后台进程的保真边界限定在 runtime 开时 | `session-scope.test.mjs`、`session-runtime.test.mjs`、`provider.test.mjs`;真机会话验证(active scope、跨命令后台/`/tmp`、会话结束 0 units) | 硬崩溃可能留下 stale scope(启动清扫未随发,入 LIMITATIONS);受限写入已共享 runtime,读仍走无约束共享 agent,根级 fs-routing 不持有 session runtime |
50
50
  | R14 | bootstrap:bwrap/ripgrep 等的就地体检与安装 | README「Install」「Troubleshooting」;CONFIGURATION | ①②⑤:`--install` 与只读体检两式、体检对象、错误消息补救指引成文 | 0.7.4 起脚本随包(`files` 收录,补救指引在 npm 安装下可用) | 脚本本身无 CI 腿(真机排错路径覆盖) |
51
51
  | R15 | 错误码方言:每个 `FS_*` 码给出抛出者、含义、解除条件;`wsl.exe` 自身失败显式收编 | ARCHITECTURE「Error codes」表 | ①②:逐码三列成表;两类历史隐形失败(UTF-16 stdout、cwd 回退 exit 0)收编;`FS_OUTSIDE_DISTRO` 独立成码的理由明文 | `fs-decisions.test.mjs`、`fsio-agent.test.mjs`、`fs-substrate.test.mjs`、`provider.test.mjs`(断言码与消息) | — |
@@ -53,7 +53,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
53
53
  | R17 | 常驻 agent 协议:ACK 计时看门狗、只读帧才重放、逐流输出上限、sha256 部署校验、租约存活、进程组两段杀 | CHANGELOG 0.3.0/0.6.0/0.7.3;PARITY Phase 1/Phase 3 | ①②④:每条健壮性属性有规格出处与实证记录;「EXEC/变异 FS 帧禁止盲重发」是写明的不变量 | `agent-protocol.test.mjs`(HELLO 版本+摘要)、`agent.test.mjs`、`agent-exec.test.mjs`(truncated 旗标)、`agent-fs-script.test.mjs`;probe:agent、probe:exec | — |
54
54
  | R18 | 配置面:每键默认值成文;层组合语义(整行替换、不深合并、后层胜) | CONFIGURATION;`cordis.patch.yml` 头注 | ⑤:随发键成表、未列表键点名;覆盖方式的正确心智模型(整行替换)成文 | `composition.test.mjs`(层组合);`style.mjs`(`files` 契约) | — |
55
55
  | R19 | 非目标集:不做什么与为什么 | LIMITATIONS 开篇原则;PARITY「Not applicable」 | ③:已知极限入册;不适用项「记下来免得像遗漏」 | —(文档性) | — |
56
- | R20 | 验证策略:三层(fake → 真脚本过真线 → 真机探针)+ CI 矩阵 + 覆盖率阈值 | ARCHITECTURE「Test layers」;README「Development」 | ④:CI 在 Node 22/24 × Linux/Windows 上跑 `pnpm test`,`pnpm run test:coverage` 只在 Node 24 上跑(门槛旗标需 Node 22.8);Node 20 有意排除(`engines` 下限);覆盖率阈值 85/84/70(行/分支/函数),测量集合覆盖 `test/` 下 48 个测试文件,且 `lib/*.js` 必须逐个实测或带理由豁免 | `pnpm test`、`pnpm run test:coverage`;CI(ci.yml) | 真机验证依赖 Windows 和可用的 WSL 发行版;非功能无量化目标(OI-1) |
56
+ | R20 | 验证策略:三层(fake → 真脚本过真线 → 真机探针)+ CI 矩阵 + 覆盖率阈值 | ARCHITECTURE「Test layers」;README「Development」 | ④:CI 在 Node 22/24 × Linux/Windows 上跑 `pnpm test`,`pnpm run test:coverage` 只在 Node 24 上跑(门槛旗标需 Node 22.8);Node 20 有意排除(`engines` 下限);覆盖率阈值 85/84/70(行/分支/函数),测量集合覆盖 `test/` 下 50 个测试文件,且 `lib/*.js` 必须逐个实测或带理由豁免 | `pnpm test`、`pnpm run test:coverage`;CI(ci.yml) | 真机验证依赖 Windows 和可用的 WSL 发行版;非功能无量化目标(OI-1) |
57
57
  | R21 | 安全过程:范围内外、响应时限、partial 属设计边界、凭据政策 | SECURITY 全文 | ②③⑥:范围、3/10/30 个工作日时限(标注「目标非合同」)、partial 定性、凭据零容忍成文 | —(过程性) | — |
58
58
  | R22 | 支持矩阵:Windows 10/11 + WSL2 + Node `^22.19.0 \|\| >=24.0.0` + peer 版本范围 | SUPPORT 全文 | ⑥:支持与不受支持清单、peer 范围及精确开发依赖成文;Node 20 在范围外(理由见 SUPPORT,`engines` 为准) | `peerDependencies`、`devDependencies` 与 `engines`(`package.json`);CI 矩阵(ci.yml) | 新 peer 版本仍需验证 |
59
59
  | R23 | 根平面 `ctx.fs` 按坐标路由:发行版 UNC 由发行版内 agent 服务(inotify 或轮询 watch),盘符路径留在宿主;接替随发的 `fs-sandbox` 行 | README「Architecture」;ARCHITECTURE「The root-plane filesystem takeover」;CONFIGURATION `fs-routing` 行;root-fs-routing.md(设计) | ①②③⑤:路由判定与接替理由(写围栏在根平面无消费者)成文;`distro` 的 `auto`/`default`/pin 三态、每个 UNC 目标由自身 distro 服务、pin 下拒外来路径,以及 `distroCwd`/`restrictToDistro`/`sandbox`/`maskWindowsDrive`/`watchMaxDepth` 逐键成表,且自成一行、不与会话级行联动;`sandbox` 失败关闭成文 | `fs-routing.test.mjs`(纯谓词与路径助手)、`provider.test.mjs`(per-distro substrate/worldPath) | 类本体无单测(需 DSH peers 与实机);由组合测试与真机探针覆盖 |
@@ -62,6 +62,9 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
62
62
  | R26 | 诊断三入口同一份逐项报告:独立 CLI、`/wsl-doctor` UI 命令(宿主侧、不进模型历史)、`wsl_doctor` 模型工具(进程内合并常驻状态);报告按 distro 分组逐项带显式状态标记与失败修复;`--quick`/`--sections`(工具侧 `depth`/`section`)收窄范围且未运行项显式列为跳过 | DIAGNOSTICS「The surfaces」;README「Install」;CONFIGURATION「Diagnose configuration and refusals」 | ①②④:三入口的分工与边界成文;范围化报告携带 `scope`、`--fix` 要求完整运行成文;逐项化与跳过行的形态由 parity 测试钉住 | `wsl-doctor-tool.test.mjs`(digest/渲染/CHECK_CATALOG parity)、`wsl-doctor-command.test.mjs`(语法/handler/子进程面)、`doctor.test.mjs`(CLI 采集) | 真机多 distro 报告依赖实机;报告形态的宿主渲染(命令面 UI)无单测 |
63
63
  | R27 | doctor CLI 独立性:不加载 peer 依赖与宿主服务,插件运行时本身损坏时仍可诊断;固定骨架本地化(Windows 区域设置检测,`--locale`/`DSH_WSL_DOCTOR_LOCALE` 覆盖),逐项事实保持英文,`--json` 语言无关 | DIAGNOSTICS「The surfaces」;CONFIGURATION「Message language」;LIMITATIONS「消息本地化」条 | ①②④:peer-free 内联与防漂移对拍成文;catalog 键 parity 与占位符行为有测试 | `doctor.test.mjs`(inlining parity、locale catalog、检测与覆盖) | 语言检测需 Windows registry(非 Windows 上回退英文,`run` 不抛错) |
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
+ | 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
+
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) |
65
68
 
66
69
  登记覆盖面:上表登记 README 与 docs/ 中对外成文的行为承诺(含随发的服务面)。
67
70
  **有意未接线**的模块不设条目——`lib/file-reference-wsl.js`(`@` 补全的发行版侧
@@ -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
@@ -116,12 +116,13 @@ The rest of the module stays. `BINARY_SAMPLE_BYTES`, `FsCodedError`,
116
116
  (`src/fsio-text.ts:23`, `:30`, `:53`, `:67`, `:86`, `:179`) have no counterpart
117
117
  in the fsio declarations, and the module's other consumers keep importing them
118
118
  locally (`src/fsio-agent.ts:27-34`, `src/fs-substrate.ts:37`,
119
- `src/index.ts:57`). `lib/fsio-text.js` is not deleted; four of its ten exports
119
+ `src/wsl-filesystem.ts:15`). `lib/fsio-text.js` is not deleted; four of its ten exports
120
120
  are.
121
121
 
122
- Importing from the entry costs this consumer nothing new: it already imports
123
- `LocalFileSystem` from the same entry (`src/index.ts:46`,
124
- `src/fs-routing.ts:36`) and `@deepseek-ai/dsh-fs` (`src/index.ts:47`). The
122
+ Importing from the entry costs this consumer nothing new: the filesystem
123
+ provider imports `LocalFileSystem` from the same entry
124
+ (`src/wsl-filesystem.ts:3`, `src/fs-routing.ts:36`) and the `@deepseek-ai/dsh-fs`
125
+ types (`src/wsl-filesystem.ts:24`). The
125
126
  entry's non-builtin static imports are `chokidar` (`lib/index.js:3`),
126
127
  `@deepseek-ai/schemastery` (`:6`) and the `@deepseek-ai/dsh-fs` peer (`:7`) —
127
128
  all three already in this consumer's graph; `koffi` loads lazily (`await
@@ -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.
@@ -0,0 +1,85 @@
1
+ # Upstream prompt adapters
2
+
3
+ *Status: temporary plugin-side adapters, 2026-11-11. Host line: DeepSeek Harness
4
+ 0.2.2-rc.1. Remove each adapter once its upstream issue ships, then re-run the
5
+ prompt checks and the WSL probe suite.*
6
+
7
+ The plugin can present the WSL session correctly without waiting for the host,
8
+ because the host's generic prompt facts are written for a Windows workspace. The
9
+ adapters are deliberately narrow: each either replaces a host contribution or
10
+ adds one sentence, and each names the upstream change that retires it. See `src/cwd-prompt.ts` for the implementation and `test/cwd-prompt.test.mjs`
11
+ for the pinned behavior.
12
+
13
+ ## 1. Shell note (`wsl:shell`)
14
+
15
+ **Adapter.** One system-prompt section after `tool:bash` says commands run in the
16
+ distro's login shell with `-lc`, not necessarily bash, and that `~/.bashrc` is
17
+ not read. It names `$DSH_WSL_SHELL` as the exact-shell source.
18
+
19
+ **Why.** The host's `dsh-tool-bash` hardcodes the tool name `bash` and the
20
+ description `bash -c`; a WSL preset actually runs the distro user's login shell
21
+ (e.g. `zsh -lc`). See [LIMITATIONS](LIMITATIONS.md#shell-startup-semantics-wsl-shell).
22
+
23
+ **Upstream issue.** `dsh-tool-bash` should consume `ShellExecutor.shellName()` and
24
+ derive the model-facing tool name and description from the mounted executor. The
25
+ longer-term rename is `dsh-tool-shell`: a POSIX-shell package named `shell`
26
+ (model tool `shell`, actual shell in the description), with
27
+ `dsh-tool-bash` kept as a compatibility alias. The package name and the
28
+ model-facing tool name are separate decisions: the latter is what the model
29
+ reads, so both must move together. The plugin deletes this section after the
30
+ short-term change ships.
31
+
32
+ ## 2. POSIX policy (`sandbox:policy`)
33
+
34
+ **Adapter.** A session-scoped `sandbox:policy` context replaces the host line. It
35
+ reads `ctx.sandboxPolicy.resolve({ session })`, converts the workspace and any
36
+ additional writable roots to POSIX, omits anything without a POSIX spelling, and
37
+ adds the conditional partial-enforcement note. No UNC or Windows path is printed.
38
+
39
+ **Why.** The host renders `workspaceRoot` verbatim; a WSL workspace is a
40
+ `\\wsl.localhost\...` UNC. Its policy line also omits the plugin's `partial`
41
+ enforcement (WSL interop is outside bwrap). The model should not need to translate
42
+ a coordinate system or infer isolation the plugin does not provide.
43
+
44
+ **Upstream issue.** `dsh-sandbox-policy` should accept/render an execution-world
45
+ display path from the provider (POSIX for the WSL preset) and carry the
46
+ provider's `enforcement` fact. The adapter lists the host policy's
47
+ `additionalWritableRoots` and omits every non-POSIX spelling; the plugin rows'
48
+ own `writableRoots` are not part of that host policy, so the upstream contract
49
+ also needs the provider's effective writable roots. The plugin deletes this
50
+ replacement after that ships.
51
+
52
+ ## 3. Host source (`harness:source`)
53
+
54
+ **Adapter.** A session-scoped empty `harness:source` section and context shadow
55
+ the host values in a WSL session. Nothing is printed.
56
+
57
+ **Why.** The host names the installed `app.asar` path (`C:\...`) as an
58
+ "implementation checkout" and tells the model it may inspect or extend it. In a
59
+ WSL session that path is a Windows path, not a readable source checkout; the
60
+ model gains nothing from it and may spend calls proving it.
61
+
62
+ **Upstream issue.** `dsh-harness-dev-context` should detect a packaged
63
+ installation and either omit the value or label it as a packaged installation.
64
+ The plugin deletes the shadow after that ships.
65
+
66
+ ## 4. Preflight notice (`wsl-preflight`)
67
+
68
+ **Adapter.** Only a blocked preflight verdict is published as a runtime-context
69
+ entry, with its remedy marked as operator action. A ready verdict is log-only.
70
+
71
+ **Why.** DSH 0.2.1 has no session-notice seam; the runtime context is the only
72
+ visible channel. A ready verdict is not an action, so it is noise.
73
+
74
+ **Upstream issue.** A session notice seam would let the blocked advisory leave
75
+ the model's durable context. See
76
+ [UPSTREAM-SESSION-NOTICE.md](UPSTREAM-SESSION-NOTICE.md). The plugin then drops
77
+ the runtime-context entry.
78
+
79
+ ## Explicit diagnostic exception
80
+
81
+ `wsl_doctor` is not injected proactively. When the user explicitly asks for a
82
+ host diagnosis, its report may name Windows paths for the host-owned checks
83
+ (`.wslconfig`, the Windows git trust, and similar). That output is the
84
+ diagnostic subject, not prompt context; the adapter set above keeps the
85
+ proactive prompt POSIX-only.
@@ -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) |
@@ -69,7 +69,7 @@ home 缓存,所以同一个根平面可以同时服务多个发行版;`distr
69
69
  客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径(§2.2)——真有消费者时需要
70
70
  按需覆写。
71
71
  - `processPathFromHostPath` 也是宿主实现(绝对宿主路径取 `resolve`)。被路由的
72
- `WslFileSystem` 自己有一份 distro 映射(`src/index.ts:2133`),那份映射不经
72
+ `WslFileSystem` 自己有一份 distro 映射(`src/wsl-filesystem.ts:530`),那份映射不经
73
73
  本路由。
74
74
 
75
75
  ### 2.2 有意的行为差异(对照原根 fs-sandbox)