dsh-plugin-wsl-env 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CODE_OF_CONDUCT.zh.md +85 -0
  4. package/CONTRIBUTING.md +19 -3
  5. package/CONTRIBUTING.zh.md +200 -0
  6. package/README.md +55 -149
  7. package/SECURITY.md +2 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +4 -2
  10. package/SUPPORT.zh.md +99 -0
  11. package/client.js +409 -8
  12. package/cordis.patch.yml +13 -0
  13. package/docs/AGENT-PROTOCOL-V7.md +2 -2
  14. package/docs/API.md +2 -0
  15. package/docs/API.zh.md +38 -0
  16. package/docs/ARCHITECTURE.md +15 -4
  17. package/docs/ARCHITECTURE.zh.md +518 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +7 -10
  21. package/docs/CONFIGURATION.zh.md +7 -9
  22. package/docs/DIAGNOSTICS.md +24 -0
  23. package/docs/DIAGNOSTICS.zh.md +13 -0
  24. package/docs/LIMITATIONS.md +43 -5
  25. package/docs/LIMITATIONS.zh.md +34 -6
  26. package/docs/MIGRATION.md +10 -4
  27. package/docs/MIGRATION.zh.md +94 -0
  28. package/docs/PEER-PARITY.md +75 -47
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +29 -15
  32. package/docs/QUICKSTART.zh.md +25 -17
  33. package/docs/README.zh.md +69 -150
  34. package/docs/RELEASING.md +4 -3
  35. package/docs/REQUIREMENTS.zh.md +4 -2
  36. package/docs/ROADMAP-1.0.md +2 -2
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  39. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  40. package/docs/VALUE.md +173 -0
  41. package/docs/VALUE.zh.md +42 -13
  42. package/docs/screenshots/with-plugin.png +0 -0
  43. package/docs/screenshots/with-plugin.svg +59 -0
  44. package/docs/screenshots/with-plugin.zh.png +0 -0
  45. package/docs/screenshots/with-plugin.zh.svg +56 -0
  46. package/docs/screenshots/without-plugin.png +0 -0
  47. package/docs/screenshots/without-plugin.svg +50 -0
  48. package/docs/screenshots/without-plugin.zh.png +0 -0
  49. package/docs/screenshots/without-plugin.zh.svg +45 -0
  50. package/lib/auto-preset-seam.d.ts +45 -0
  51. package/lib/auto-preset-seam.js +47 -0
  52. package/lib/auto-preset.d.ts +33 -10
  53. package/lib/auto-preset.js +148 -44
  54. package/lib/doctor-live.d.ts +30 -0
  55. package/lib/doctor-live.js +37 -0
  56. package/lib/doctor-report.js +10 -3
  57. package/lib/messages.d.ts +19 -0
  58. package/lib/messages.js +28 -0
  59. package/lib/open-in-app.d.ts +206 -0
  60. package/lib/open-in-app.js +300 -0
  61. package/lib/peer-versions.d.ts +53 -0
  62. package/lib/peer-versions.js +137 -0
  63. package/lib/preset-choice.d.ts +13 -0
  64. package/lib/preset-choice.js +18 -1
  65. package/lib/status.js +2 -1
  66. package/lib/update-check.d.ts +2 -2
  67. package/lib/update-check.js +2 -2
  68. package/lib/wsl-doctor-command.js +4 -2
  69. package/package.json +55 -25
  70. package/scripts/doctor.mjs +127 -9
package/docs/README.zh.md CHANGED
@@ -6,61 +6,67 @@
6
6
  [![npm](https://img.shields.io/npm/v/dsh-plugin-wsl-env)](https://www.npmjs.com/package/dsh-plugin-wsl-env)
7
7
  [![license](https://img.shields.io/npm/l/dsh-plugin-wsl-env)](../LICENSE)
8
8
 
9
- 一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件,在 Windows 的 WSL 2 发行版中打开项目工作区。
9
+ 把 WSL 2 发行版变成 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 桌面会话的执行环境:命令、文件、终端都在发行版内运行,harness 留在 Windows。DeepSeek Harness 有两种形态——带 Web UI 的 npm CLI,与 macOS/Windows 桌面应用;本插件只服务其中一种组合:Windows 桌面应用 + WSL 2 中的项目。发行版内不装服务、不开端口;受限命令经 `bubblewrap` 沙箱。
10
10
 
11
- Harness 进程仍在 Windows 上。命令执行、shell 脚本和文件访问都在发行版的 Linux 空间内完成,以获得全套 Linux shell 工具链。发行版内不安装辅助服务或守护进程,也不开放端口,受限命令在 `bubblewrap` 中运行。
11
+ ![没有插件:桌面应用全部运行在 Windows——命令落在 CMD/PowerShell,文件经 9p 共享访问发行版](screenshots/without-plugin.zh.svg)
12
12
 
13
- 仅支持 Windows + WSL 2。
13
+ ![有插件:界面与模型调用留在 Windows,命令与文件进发行版,中间只有一条 stdio 管道](screenshots/with-plugin.zh.svg)
14
14
 
15
- **刚接触?** 从 [docs/QUICKSTART.zh.md](QUICKSTART.zh.md) 开始:前置条件、常用配方与兼容性表。
15
+ **刚接触?** 从 [QUICKSTART.zh.md](QUICKSTART.zh.md) 开始。
16
16
 
17
- ## 需要这个插件吗?
17
+ ## 为什么用这个插件
18
18
 
19
- 如果 harness 本身可以跑在发行版里,更简单的做法是**不用**这个插件:把 CLI 装在
20
- 发行版里,直接在发行版终端运行。没有 UNC 路径、没有 9p 往返,也没有
21
- Windows→发行版的 agent。
19
+ 「agent 在 WSL 项目上反复失败时,让桌面应用直接在发行版环境里工作——不搬家、不装服务、不放弃沙箱。」
22
20
 
23
- ```bash
24
- # 在发行版内执行;CLI 要求 Node >= 24.9
25
- npm install -g @deepseek-ai/dsh
26
- dsh web # 浏览器界面,经 WSL 的 localhost 转发访问
27
- dsh headless "run the tests" # 单任务、输出答案后退出
28
- ```
21
+ - 模型的强项是 POSIX,弱项是 CMD/PowerShell:Windows 工作区只能用弱项,WSL 工作区经 `wsl.exe` 逐条包装又丢失环境与状态。本插件让脚本在持久的发行版会话里原样运行。
22
+ - 命令跑在发行版登录 shell:`PATH`、`nvm`、`cargo`、`pyenv`、rc 文件全部生效。
23
+ - 发行版内无服务、无端口;唯一持久物是 `~/.cache/dsh-wsl/agent/` 下的 agent 缓存。
24
+ - 受限命令默认经 `bubblewrap`;缺 bwrap 时命令失败,不脱箱。
25
+ - 环境按会话生效:发行版目录会话进发行版,Windows 目录会话不变,可同进程并存。
26
+ - 与 GUI 集成:文件夹选择器列出发行版,终端在发行版内打开,模型可见监听端口。
29
27
 
30
- 需要 harness 留在 Windows 时,才用本插件:
28
+ 完整论证(为什么是 Linux 而不是 PowerShell、价值与代价)见 [VALUE.zh.md](VALUE.zh.md)。
31
29
 
32
- | 你的场景 | 用什么 |
33
- |---|---|
34
- | 工作区在 WSL 内,终端或浏览器界面够用 | 装在发行版里的 CLI |
35
- | 想要 Windows 桌面应用,命令与文件落在发行版 | 本插件 |
36
- | 同一会话要同时访问 Windows 与 WSL 工作区 | 本插件(按路径路由正是它的价值) |
30
+ ## 安装
37
31
 
38
- 两者混用有一个坑:`desktop` 这个 profile 名由 Electron 应用独占,npm CLI 拒绝
39
- 管理它的插件——桌面场景请用应用内的 Plugins 页面。[VALUE.zh.md](VALUE.zh.md)
40
- 有完整对照和"不适用"清单。
32
+ 桌面应用没有 `dsh` 可执行程序;插件经 **Plugins** 页安装。三步:
41
33
 
42
- ## 为什么用这个插件
34
+ 1. `wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap`
35
+ 2. Plugins 页:**Add plugin** → `dsh-plugin-wsl-env`,启用。
36
+ 3. 重启应用,打开发行版内的文件夹;输入 `/wsl-doctor`(宿主侧执行)得到 `ready`/`blocked` 裁决。
43
37
 
44
- Windows 上的编程工具要在 WSL 项目中工作,有三条路:把整个工具装进发行版、连接发行版内的辅助服务,或由插件直接提供发行版环境。本插件是第三条。两类会话共用一套流程,同时保留发行版的真实工具和命令沙箱。
38
+ 其余前置(发行版内不需要 Node.js):
45
39
 
46
- - **真实的 Linux 环境。** 命令在发行版自己的登录 shell 中运行,`PATH`、`nvm`、`cargo`、`pyenv` 和 rc 文件都生效。文件工具通过发行版内的 agent 访问发行版路径,底层文件系统取决于路径。
47
- - **发行版内没有服务。** 没有辅助服务、没有守护进程、没有监听端口。唯一持久化的内容是 `~/.cache/dsh-wsl/agent/` 下按内容寻址的原生 agent 副本。
48
- - **默认有沙箱。** 受限命令在发行版内的 `bubblewrap` 中运行。缺少 `bubblewrap` 时命令直接失败,不会脱箱运行。
49
- - **按会话生效。** 打开发行版文件夹的会话获得发行版环境;打开 Windows 文件夹的会话保留 Windows 工具。两者可同时运行在一个 harness 进程中。
50
- - **与 GUI 集成。** 文件夹选择器列出已安装的发行版,终端在发行版内打开 shell,模型能看到监听端口。侧边栏的 **WSL 环境** 面板按发行版运行 doctor 快速检查——宿主侧执行,不进模型对话;会话启动预检在每次会话打开时把环境判定写进日志,只有 blocked 判定同时进入会话上下文。
40
+ | 前置 | 说明 |
41
+ |---|---|
42
+ | Windows 10/11 + WSL 2 + ≥1 个发行版 | `wsl.exe -l -v` 显示 `VERSION 2`;缺则 `wsl.exe --install` |
43
+ | systemd + Linger(默认会话沙箱需要) | `/etc/wsl.conf` 设 `[boot] systemd=true`,`wsl --shutdown`,执行一次 `loginctl enable-linger "$USER"`;无 systemd 时设 `sessionSandbox` 为 `auto` 或 `false` |
44
+ | 可选:`ripgrep`、`git`、`inotify-tools` | `pnpm run bootstrap <发行版>` 打印安装命令 |
51
45
 
52
- ### 为什么是 Linux,而不是 PowerShell
46
+ 插件不修改已安装的 `resources/app.asar`。升级 = 重新安装后重启;卸载在 Plugins 页面,之后可删 `~/.cache/dsh-wsl`。细节见 [QUICKSTART.zh.md](QUICKSTART.zh.md)。
53
47
 
54
- 多数编程 agent 的训练材料以 Linux 为主,开源工具链也大多先在 Linux 上构建和测试。让 agent 在 Windows shell 里工作,等于要求它在每次调用时做一层翻译:
48
+ ## 需要这个插件吗?
55
49
 
56
- - **训练先验。** 示例、CI 脚本、Dockerfile 和大多数公开答案用的是 POSIX shell 和 GNU 工具;模型的第一反应是 `bash`,不是 PowerShell。
57
- - **工具链支持。** Node、Python、Rust、Go、C/C++ 和多数构建系统先在 Linux 上验证。Windows 支持往往是移植,引号、路径、换行和文件锁都不一样。
58
- - **Shell 语义。** PowerShell 和 `cmd` 在引号、转义、管道、环境变量、退出码和路径分隔符上都与 POSIX 不同。混用两套语法,很容易产生看起来像模型犯的低级错误。
59
- - **环境漂移。** Windows 侧的 PowerShell 版本、执行策略、PATH 和已装工具因人而异;Linux 环境更容易复现和容器化。
50
+ harness 能整个跑在发行版里时,不用本插件更简单:把 CLI 装进发行版即可(命令见 [QUICKSTART §0](QUICKSTART.zh.md))。harness 必须留在 Windows 时才用本插件:
60
51
 
61
- 结果是更多失败的命令、更多重试,以及更多时间花在语法而不是任务上。生成的代码也一样:shell 片段、构建命令和 CI 风格的一行命令通常按 POSIX 编写,发行版才是它们原样运行的地方。真实的 Linux 登录 shell 去掉了这层翻译。现代 PowerShell 和 Windows 原生工具在缩小差距,但默认先验和多数项目脚本仍然假设 POSIX。
52
+ | 场景 | 用什么 |
53
+ |---|---|
54
+ | 终端或浏览器界面够用 | 发行版内的 CLI |
55
+ | 要 Windows 桌面应用,命令与文件在发行版 | 本插件 |
56
+ | 一个会话同时访问 Windows 与 WSL 目录 | 本插件 |
62
57
 
63
- 本插件把 GUI 留在 Windows,只把执行环境移进发行版,让 agent 得到它的训练和工具链都假设的那个 shell。
58
+ 坑:`desktop` profile 名由 Electron 应用独占,npm CLI 拒绝管理它的插件——用应用内 Plugins 页。完整对照见 [VALUE.zh.md](VALUE.zh.md)。
59
+
60
+ ## 使用
61
+
62
+ 打开发行版文件夹作为工作区,如 `\\wsl.localhost\ubuntu\home\you\project`。
63
+
64
+ - 打开哪个发行版的文件夹,就在哪个发行版执行。
65
+ - 命令在发行版登录 shell 中运行;`/home/you/x` 与 `\\wsl.localhost\ubuntu\home\you\x` 是同一文件。
66
+ - **New terminal** 在同一发行版、同一目录打开 shell。
67
+ - 模型可见监听端口并返回 dev server URL(WSL 2 转发 localhost)。
68
+ - 权限:`read-only` / `workspace-write`(默认)/ `danger-full-access`;只有最后一档不经沙箱。
69
+ - 侧边栏 **WSL 环境** 面板按发行版诊断,见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
64
70
 
65
71
  ## 方案对比
66
72
 
@@ -71,121 +77,36 @@ Windows 上的编程工具要在 WSL 项目中工作,有三条路:把整个
71
77
  | 命令沙箱 | 无 | `bubblewrap` |
72
78
  | 卸载 | 删除服务 | 删除缓存 |
73
79
 
74
- 桌面远程重连更快、更成熟。如果 CLI agent 能覆盖你的工作,直接装进 WSL 更简单。本插件面向的场景是:harness 留在 Windows,同时要求命令有沙箱。
75
-
76
- ## 要求
77
-
78
- - Windows 10 或 11,启用 WSL 2,并至少有一个发行版。
79
- - 发行版内安装 `bubblewrap`,必需。
80
- - 默认的会话沙箱需要 systemd:在 `/etc/wsl.conf` 设置 `[boot] systemd=true`,重启 WSL,然后执行一次 `loginctl enable-linger "$USER"`。没有 systemd 时,在 `wsl-shell` 和 `wsl-fs` 上把 `sessionSandbox` 设为 `auto`(可用时仍用 scope,否则每条命令单独约束)或显式 `false`。
81
- - 可选:`ripgrep` 用于搜索,`git` 用于变更快照,`inotify-tools` 用于文件监视。
82
-
83
- 发行版内不需要 Node.js。
84
-
85
- ## 安装
86
-
87
- Windows 桌面应用**没有 `dsh` 可执行程序**:安装器只写 `DeepSeek Harness.exe`,
88
- CLI 入口在 `resources/app.asar` 内部(探针脚本通过 `ELECTRON_RUN_AS_NODE` 启动它)。
89
- 按你手上的发行版二选一。
90
-
91
- **桌面应用**:在侧边栏打开 **插件**,点 **Add plugin**,填精确包名
92
- `dsh-plugin-wsl-env` 并启用。插件管理器写入当前 profile 的 `package.json`
93
- (依赖项与 `dsh.profile.bundles`),与下面的 CLI 命令得到的状态一致。从检出
94
- 目录运行时,改为以链接形式添加该目录。启动方式与安装器创建的快捷方式一致:
95
- `DeepSeek Harness.exe`,不带参数。桌面应用打开的是它自己配置的 profile——也就是
96
- Plugins 页面写入的那个;要用别的 profile 属于 CLI 发行版的事
97
- (`dsh --profile <名字>`)。
98
-
99
- **CLI 发行版**(`dsh` 在 `PATH` 上),在 Windows 终端执行:
100
-
101
- ```powershell
102
- dsh wsl --from-default-profile web --dump-config # 创建 profile
103
- dsh plugin --profile wsl add dsh-plugin-wsl-env # 安装插件及其配置
104
- dsh --profile wsl --dump-config # 检查:输出 "# == dsh-plugin-wsl-env"
105
- dsh --profile wsl # 启动
106
- ```
107
-
108
- 第一条命令之前安装 `bubblewrap`:
109
-
110
- ```powershell
111
- wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
112
- ```
113
-
114
- 在插件检出目录中,`pnpm run doctor` 是一键环境体检:Windows/WSL 平台、每个发行版的 WSL 模式与身份、`.wslconfig` 与 `/etc/wsl.conf` 交叉核对、发行版与宿主卷、时钟与 DNS、bubblewrap 可用性、systemd / user manager / Linger、可选工具、peer 版本、native agent 与其缓存、新 agent 握手、证明链路完好的 shell 冒烟腿(帧 I/O、受限围栏、批量 substrate)与一条 native HELLO 腿、残留会话 scope、已知的 profile 补丁与废弃键陷阱。报告逐项列出每个检查——按 distro 分组,每项带显式状态标记,失败项下附可复制的处理办法——并以裁决收尾:`ready`(本次运行覆盖的检查全部通过,不保证每条命令都成功)或 `blocked`(列明待修项),按生效配置计算。运行可以收窄范围:`--quick` 只探首条命令的前置项(约 10 秒),`--sections <分区清单>`(逗号分隔)只运行指定分区,且范围化报告会把未运行的检查显式列为跳过项。`--json` 供脚本使用;`--fix` 会复核它修过的项——插件自有的残留 scope 清扫与 agent 缓存清理是安全自动的,安装包需要 `--fix --install` 并显式确认,`--fix-owned` 只运行插件自有的这两类(即侧边栏面板的“修复”动作)——`--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact` 将路径脱敏)。固定骨架按宿主语言渲染——从 Windows 区域设置检测,可用 `--locale <标签>` 或 `DSH_WSL_DOCTOR_LOCALE` 覆盖;`--json` 保持语言无关。同一份报告经三个入口给出:本 CLI、`/wsl-doctor` 命令(在输入框输入——宿主侧执行,不进模型对话)、以及 `wsl_doctor` 模型工具(进程内采集,合并常驻 agent 的实时状态)。`DSH_WSL_DOCTOR` 还携带一条现成命令(`sh -c "$DSH_WSL_DOCTOR --json"`),可在发行版内直接重放 doctor。`pnpm run diagnose` 是 CLI 的只读别名。`pnpm run bootstrap <发行版>` 仍是较窄的工具安装助手。
115
-
116
- 插件大约每天自行检查一次更新(启动后 2–10 分钟内首查),方式是询问应用的插件管理器——它从不自行联网。当存在更新的稳定版时,每个发行版会话中受管的 `DSH_WSL_PLUGIN_UPDATE` 变量会携带该事实;补丁配置里的 `wsl-update-check.enabled: false` 可关闭该检查。升级保持手动,因为 harness 没有热重载:重新安装(Plugins 页面或 `add` 命令),然后重启。
117
-
118
- 卸载:在 Plugins 页面移除,或在 CLI 发行版执行 `dsh plugin --profile wsl remove dsh-plugin-wsl-env`;之后可删除 `~/.cache/dsh-wsl`。如果你为了恢复预览在 profile 里加过 `workspace-files-wsl` 的临时覆盖,升级后请删掉:插件不再挂载该行。
119
-
120
- ## 使用
121
-
122
- 打开一个发行版文件夹作为工作区,例如 `\\wsl.localhost\ubuntu\home\you\project`。
123
-
124
- - 打开哪个发行版的文件夹,就在哪个发行版执行——即使它不是 WSL 的默认发行版。
125
- - 命令在发行版登录 shell 中运行。`/home/you/x` 与 `\\wsl.localhost\ubuntu\home\you\x` 是同一个文件。
126
- - **New terminal** 在同一发行版、同一目录打开 shell。
127
- - 模型能看到监听端口,并返回 dev server 的 URL。WSL 2 会把 localhost 转发到 Windows。
128
- - 权限选择器:`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` 中。
80
+ 桌面远程更成熟;CLI 装进 WSL 更简单。本插件用于:harness 留在 Windows,且命令需要沙箱。
130
81
 
131
82
  ## 配置
132
83
 
133
- 配置写在 `$DSH_HOME/profiles/<名字>/cordis.patch.yml` 的命名行上。主要设置:
134
-
135
- | 行 | 键 | 默认值 | 作用 |
136
- |---|---|---|---|
137
- | `wsl-shell` | `distro` | `''` | 发行版模式;空/`auto` 跟随工作区,`default` 强制 WSL 默认 |
138
- | | `sandbox` | `true` | 用 `bubblewrap` 约束命令 |
139
- | | `sessionSandbox` | `false`;随包 `true` | 会话命令跑在同一个 systemd user scope 中 |
140
- | | `agentBackend` | `auto` | 发行版内 agent:`auto`、`native` 或 `shell` |
141
- | | `maskWindowsDrive` | `false` | 让受限命令看不到 `/mnt` |
142
- | | `writableRoots` | `[]` | 额外可写的发行版目录(工具链缓存等;`wsl-fs` 上配同一列表) |
143
- | `wsl-fs` | `distro` | `''` | 发行版模式;空/`auto` 跟随每个目标路径 |
144
- | | `restrictToDistro` | `true` | 固定发行版(`default` 或名字)时拒绝属于其他发行版的路径 |
145
- | | `sandbox` | `true` | 按策略检查受限写入 |
146
- | | `sessionSandbox` | `false`;随包 `true` | 受限写入跑在会话 runtime 中 |
147
- | | `substrate` | `agent` | 发行版内 agent;`share` 在启动时被拒绝 |
148
- | | `writableRoots` | `[]` | 与 `wsl-shell` 相同的额外可写目录列表 |
149
- | `directory-picker-wsl` | `includeHostHome` | `true` | 同时提供 Windows 路径分支(从驱动器开始) |
150
- | `subprocess-wsl` | `distro` | `''` | 发行版模式;空/`auto` 跟随启动目录 |
151
- | `wsl-preflight` | `distro` | `''` | 环境检查探测的发行版;空/`auto` 跟随会话工作区 |
152
- | | `startup` | `true` | 插件加载时预先运行同一组检查,让判定在任何会话打开之前就出现在日志里 |
153
-
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) 是随包值的注释参考。
84
+ 配置在 `$DSH_HOME/profiles/<名字>/cordis.patch.yml` 的命名行上。`wsl-shell`/`wsl-fs` 嵌套在 `preset-wsl` 里,按 id 覆盖无效,须整行覆盖。全部键与配方见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md);[`cordis.patch.yml`](../cordis.patch.yml) 是随包值的注释参考。
155
85
 
156
86
  ## 架构
157
87
 
158
- 一个 harness 进程可同时服务 Windows 文件夹会话和发行版文件夹会话。服务分两层挂载:
159
-
160
88
  ```text
161
- 应用层(每个进程一份)
89
+ 应用层(每进程)
162
90
  ├─ directory-picker-wsl、workspace-files、subprocess-wsl
163
- ├─ fs-routing:根级文件系统,按路径分流
164
- └─ auto-preset:会话打开发行版文件夹时绑定 wsl preset
91
+ ├─ fs-routing:根级文件系统按路径分流
92
+ └─ auto-preset:会话打开发行版目录时绑定 wsl preset
165
93
 
166
- wsl preset(每个会话)
94
+ wsl preset(每会话)
167
95
  ├─ wsl-shell:命令
168
96
  └─ wsl-fs:文件操作
169
97
  ```
170
98
 
171
- - `wsl-shell` 通过 systemd user scope 内的一个常驻 agent 执行命令。agent 默认是发行版架构(`x86_64` 或 `aarch64`)对应的包内静态 musl `dsh-wsl-agent`,shell agent 作为回退。每条命令在登录 shell 中、`bubblewrap` mount profile 下运行。scope 比命令活得久,所以后台服务存活,`ps` 能看到整个会话。设置 `sessionSandbox: false` 后,agent 仍按发行版常驻,但每条命令使用自己的 profile。
172
- - `wsl-fs` 通过同一个发行版内 agent 提供读写。受限写入运行在 mount profile 与策略一致的常驻 agent 中,由内核执行写入边界。没有宿主机侧的文件回退:agent 不可用时文件操作直接失败。
173
- - GUI 文件树和预览使用随包的 `workspace-files` 行,而不是插件的替换行:它的客户端半边是浏览器的 `file` 资源提供者。WSL 路径经根级路由读取,仍在发行版内,但会多几次 agent 往返。
174
- - 应用层服务按路径分流:发行版 UNC 路径走发行版,Windows 盘符路径留在宿主。见 [docs/root-fs-routing.md](root-fs-routing.md)。
99
+ 命令与文件走发行版内常驻 agent(systemd user scope + `bubblewrap` profile)。发行版 UNC 路径进发行版,盘符路径留宿主。详见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md)。
175
100
 
176
101
  ## 沙箱
177
102
 
178
103
  | 模式 | 命令可以做什么 |
179
104
  |---|---|
180
- | `read-only` | 读整个发行版;挂载新的 `/dev`,其余不可写 |
181
- | `workspace-write` | 上面的权限,加上会话工作区与配置的 `writableRoots`;会话 runtime 下 `/tmp` 是发行版真实 `/tmp` |
182
- | `danger-full-access` | 不经过沙箱 |
183
-
184
- 设置 `sessionSandbox: false` 时,`workspace-write` 命令使用私有的 `/tmp`,而不是发行版的真实 `/tmp`;`read-only` 不挂载可写的 `/tmp`。
105
+ | `read-only` | 读整个发行版;仅新挂载的 `/dev`,其余不可写 |
106
+ | `workspace-write` | 加上会话工作区与配置的 `writableRoots` |
107
+ | `danger-full-access` | 不经沙箱 |
185
108
 
186
- `bubblewrap` 是必需项。缺失或损坏时,受限命令报 `SANDBOX_UNAVAILABLE`,不会运行。在对应的行设置 `sandbox: false` 可关闭沙箱;模型会收到"该操作无沙箱"的说明。
187
-
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)。
109
+ 缺 `bubblewrap` 时受限命令报 `SANDBOX_UNAVAILABLE`,不运行。隔离为 `partial`:发行版内进程仍可经 `/mnt/c` 启动 Windows 程序。详见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#沙箱) 与 [SECURITY.zh.md](../SECURITY.zh.md)。
189
110
 
190
111
  ## 常见问题
191
112
 
@@ -195,11 +116,11 @@ wsl preset(每个会话)
195
116
  | 会话在第一条命令前就被拒绝 | 运行 `pnpm run doctor`;启用 systemd 和 linger,或把 `wsl-shell`、`wsl-fs` 上的 `sessionSandbox` 设为 `auto` 或 `false` |
196
117
  | 发行版内 `glob`、`grep` 很慢 | 运行 `pnpm run bootstrap <发行版>`,使用打印的安装命令安装 `ripgrep` |
197
118
  | `npm install` / `pnpm add` 报 `EROFS` | 沙箱默认只授予工作区;在 `wsl-shell` 和 `wsl-fs` 上配置 `writableRoots`(如 `~/.npm`、`~/.cache`、`~/.local/share/pnpm`),见 [CONFIGURATION](CONFIGURATION.zh.md#工具链缓存与额外可写目录) |
198
- | `dsh plugin add` 没有输出,或 Plugins 页面装完没有日志 | 以 profile 的 `package.json` 与 `dsh.profile.bundles` 为准:列出插件即安装成功 |
119
+ | Plugins 页面装完没有任何日志 | 以 profile 的 `package.json` 与 `dsh.profile.bundles` 为准:列出插件即安装成功 |
199
120
  | 对 `wsl-shell`/`wsl-fs` 的 profile 补丁不生效 | 这些行嵌套在 `preset-wsl` 里。运行 `pnpm run preset --check <补丁>`;它会失败并输出需要粘贴的完整块 |
200
121
  | 改了 `lib/` 但不生效 | 运行 `pnpm run sync:windows`,然后重启应用 |
201
122
 
202
- 更多错误码和拒绝原因见 [docs/ARCHITECTURE.md](ARCHITECTURE.md#error-codes),插件不做的事见 [docs/LIMITATIONS.md](LIMITATIONS.md)。
123
+ 更多错误码见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#错误码),插件不做的事见 [LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
203
124
 
204
125
  ## 开发
205
126
 
@@ -211,28 +132,26 @@ pnpm run test:coverage # 带覆盖率阈值的单元测试
211
132
  pnpm run sync:windows # 更新应用加载的 Windows 侧副本
212
133
  ```
213
134
 
214
- 工具链跟随 harness 宿主:Node `^22.19.0 || >=24.0.0`。`src/` 是 TypeScript,`lib/` 是生成并提交的产物,必须保持同步。应用加载的是 Windows 侧的 `lib/` 副本,所以构建后要运行 `sync:windows` 并重启应用。
215
-
216
- 真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.md](../CONTRIBUTING.md) 和 `test/probe/`。
135
+ Node `^22.19.0 || >=24.0.0`;`src/` 是 TypeScript,`lib/` 是提交进仓的构建产物。真机探针仅 Windows + WSL。见 [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) 与 `test/probe/`。
217
136
 
218
137
  ## 文档
219
138
 
220
139
  | 文档 | 内容 |
221
140
  |---|---|
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) | 插件不做的事 |
141
+ | [QUICKSTART.zh.md](QUICKSTART.zh.md) | 首次运行、常用配方、兼容性 |
142
+ | [PERFORMANCE.zh.md](PERFORMANCE.zh.md) | ext4 agent 对比 9p 的实测延迟与复现方法 |
143
+ | [MIGRATION.zh.md](MIGRATION.zh.md) | 从早期版本升级、发布门槛 |
144
+ | [COMPATIBILITY.zh.md](COMPATIBILITY.zh.md) | 已测的 Windows/WSL/发行版矩阵与范围决定 |
145
+ | [API.zh.md](API.zh.md) | 包的子路径导出一览 |
146
+ | [CONFIGURATION.zh.md](CONFIGURATION.zh.md) | 所有配置键及覆盖方法 |
147
+ | [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md) | 服务、路径路由、沙箱、错误码 |
148
+ | [LIMITATIONS.zh.md](LIMITATIONS.zh.md) | 插件不做的事 |
230
149
  | [docs/ROADMAP.md](ROADMAP.md) | 当前计划和推迟项 |
231
150
  | [docs/ROADMAP-1.0.md](ROADMAP-1.0.md) | 1.0 与生态优化计划 |
232
151
  | [docs/VALUE.zh.md](VALUE.zh.md) | 价值与取舍 |
233
- | [CONTRIBUTING.md](../CONTRIBUTING.md) | 开发循环、质量门、探针 |
234
- | [SECURITY.md](../SECURITY.md) | 私下上报漏洞 |
235
- | [SUPPORT.md](../SUPPORT.md) | 支持范围与提问渠道 |
152
+ | [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) | 开发循环、质量门、探针 |
153
+ | [SECURITY.zh.md](../SECURITY.zh.md) | 私下上报漏洞 |
154
+ | [SUPPORT.zh.md](../SUPPORT.zh.md) | 支持范围与提问渠道 |
236
155
  | [docs/RELEASING.md](RELEASING.md) | 发布检查单 |
237
156
 
238
157
  ## 许可
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
@@ -145,7 +146,7 @@ A manual publish does not create the GitHub Release, so do step 7 by hand.
145
146
 
146
147
  `npm publish` prints `+ dsh-plugin-wsl-env@x.y.z` when the upload is accepted. That
147
148
  is not the same as the version being visible. The version and the `dist-tags`
148
- appear in the registry a minute or two later, so poll instead of checking once:
149
+ appear in the registry several minutes later (0.26.0 took about six), so poll instead of checking once — the release workflow waits up to ten minutes:
149
150
 
150
151
  ```bash
151
152
  # expect 200, not 404
@@ -260,7 +261,7 @@ npm does not let a published version be replaced, so the fix goes forward:
260
261
 
261
262
  | Fact | What it means in practice |
262
263
  |---|---|
263
- | `npm publish` prints success at upload time | The version may still return 404 for a minute or two. Poll the registry, and do not conclude that the publish failed. |
264
+ | `npm publish` prints success at upload time | The version may still return 404 for several minutes (0.26.0 took about six). Poll the registry for up to ten minutes, and do not conclude that the publish failed. |
264
265
  | A repeated publish of the same version is refused | npm checks the registry first and stops with `You cannot publish over the previously published versions: x.y.z.`; a registry-side conflict surfaces as `EPUBLISHCONFLICT` ("Cannot publish over existing version."). Either one means the first publish landed. Verify it instead of publishing again — the release workflow's already-published check exists for the same reason. |
265
266
  | The npm readme is chosen from the candidate files at the package root, and the rule is not fully explained. With `README.md` and `README.zh.md` side by side, version 0.1.1 published as `readmeFilename: README.zh.md`, so its npm page rendered Chinese — even though the tarball listed `README.md` first. Both names match the npm CLI's own selection code (`@npmcli/package-json/lib/normalize.js` globs `{README,README.*}` and accepts `/\.m?a?r?k?d?o?w?n?$/i`, which does match `.md`), so neither name is screened out. | Do not rely on the rule. Keep exactly one readme candidate at the package root, which `pnpm run lint:style` checks. The Chinese README lives in `docs/` for this reason. |
266
267
  | A local `~/.npmrc` may point at a mirror | Pass `--registry=https://registry.npmjs.org/` on every publish and every verification. |
@@ -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) |
@@ -58,12 +58,14 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
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 与实机);由组合测试与真机探针覆盖 |
60
60
  | R24 | GUI 文件树与预览在发行版内服务:沿用随包 `workspace-files` 行(server/client 成对),经根级 `fs-routing` 读写 distro UNC;盘符 scope 交宿主 | README「Architecture」;ARCHITECTURE「The root-plane filesystem takeover」;CONFIGURATION `workspace-files` 行 | ①②③⑤:沿用官方 server/client,浏览器 `file` provider 不丢,预览可用;路由与宿主/发行版 scope 成文;容量键由官方行承载、可覆盖;较直连多 4–6 次往返及其取舍在 LIMITATIONS 成文 | `fs-routing.test.mjs`、组合测试(`workspace-files` 保持启用、接管行不存在) | — |
61
- | R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实 dsh CLI + Windows) | 无自动化守护 |
61
+ | R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实 Windows 桌面应用 + WSL;打包链路由 `e2e:install` 覆盖) | 无自动化守护 |
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
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
 
@@ -131,7 +131,7 @@ correct once configured" and "the plugin is correct on first contact".
131
131
  |---|---|---|---|
132
132
  | [P1.1](#wsl-201--sessionsandbox-auto) | `sessionSandbox: auto` for distros without systemd | Non-systemd distro runs the first command under per-command bwrap and reports the narrower scope; explicit `true` still refuses | M |
133
133
  | [P1.2](#wsl-202--compatibility-matrix-and-aarch64) | Compatibility matrix and real validation | Tier 1 (Ubuntu/Debian, systemd, x86_64) green; aarch64 spike runs under qemu; Tier 2 status documented | L |
134
- | [P1.3](#wsl-203--installupgradeuninstall-e2e) | Install/upgrade/uninstall E2E | Temporary `DSH_HOME`, packed tarball, profile install (Plugins page or `dsh plugin add`), `--dump-config` where the CLI exists, remove; upgrade from the previous minor | M |
134
+ | [P1.3](#wsl-203--installupgradeuninstall-e2e) | Install/upgrade/uninstall E2E | Temporary `DSH_HOME`, packed tarball, profile install (the Plugins page), composed state via the profile's `cordis.patch.yml`, remove; upgrade from the previous minor | M |
135
135
  | [P1.4](#wsl-204---references-seam) | `@` references seam | Measure the 9p cost; land the upstream `FileReferenceTraversal` seam or a declared, tested fallback | L |
136
136
  | [P1.5](#wsl-205--lsp-provider-spike) | LSP provider spike | A documented plan and prototype for `ctx.lsp` over fs + subprocess, conditional on the desktop composition mounting LSP | M |
137
137
  | [P1.6](#wsl-206--gui-preview-performance) | GUI preview performance | Baseline measured; p95 <= 1s/MiB for a representative page; v6 only if the measurement justifies it | M |
@@ -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: