dsh-plugin-wsl-env 0.26.3 → 0.27.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 (82) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/CONTRIBUTING.md +32 -25
  3. package/CONTRIBUTING.zh.md +3 -2
  4. package/README.md +1 -1
  5. package/SECURITY.md +21 -7
  6. package/SECURITY.zh.md +18 -5
  7. package/SUPPORT.md +2 -2
  8. package/SUPPORT.zh.md +2 -2
  9. package/client.js +351 -48
  10. package/cordis.patch.yml +26 -10
  11. package/docs/AGENT-PROTOCOL-V7.md +4 -2
  12. package/docs/API.md +3 -1
  13. package/docs/API.zh.md +3 -1
  14. package/docs/ARCHITECTURE.md +22 -4
  15. package/docs/ARCHITECTURE.zh.md +18 -4
  16. package/docs/CONFIGURATION.md +117 -17
  17. package/docs/CONFIGURATION.zh.md +97 -11
  18. package/docs/DIAGNOSTICS.md +22 -11
  19. package/docs/DIAGNOSTICS.zh.md +17 -9
  20. package/docs/LIMITATIONS.md +27 -4
  21. package/docs/LIMITATIONS.zh.md +20 -3
  22. package/docs/MIGRATION.md +2 -2
  23. package/docs/MIGRATION.zh.md +2 -2
  24. package/docs/PARITY.md +3 -1
  25. package/docs/QUICKSTART.md +31 -20
  26. package/docs/QUICKSTART.zh.md +16 -9
  27. package/docs/README.zh.md +1 -1
  28. package/docs/RELEASING.md +25 -3
  29. package/docs/REQUIREMENTS.zh.md +7 -6
  30. package/docs/ROADMAP-1.0.md +11 -7
  31. package/lib/agent-confined.d.ts +9 -1
  32. package/lib/agent-confined.js +3 -3
  33. package/lib/agent.d.ts +54 -18
  34. package/lib/agent.js +86 -19
  35. package/lib/bwrap.d.ts +16 -0
  36. package/lib/bwrap.js +9 -0
  37. package/lib/fs-routing.d.ts +6 -0
  38. package/lib/fs-routing.js +7 -0
  39. package/lib/fs-substrate.d.ts +1 -1
  40. package/lib/fs-substrate.js +10 -18
  41. package/lib/fsio-agent.d.ts +4 -0
  42. package/lib/fsio-agent.js +37 -10
  43. package/lib/listing.d.ts +2 -2
  44. package/lib/listing.js +5 -4
  45. package/lib/messages.d.ts +70 -0
  46. package/lib/messages.js +80 -0
  47. package/lib/open-in-app.js +12 -9
  48. package/lib/picker.d.ts +4 -1
  49. package/lib/picker.js +35 -11
  50. package/lib/plugin-update.d.ts +212 -0
  51. package/lib/plugin-update.js +283 -0
  52. package/lib/ports.js +8 -1
  53. package/lib/provider-common.d.ts +22 -0
  54. package/lib/provider-common.js +18 -0
  55. package/lib/provider-marker.d.ts +23 -0
  56. package/lib/provider-marker.js +21 -0
  57. package/lib/sandbox-core.d.ts +2 -0
  58. package/lib/sandbox-core.js +5 -3
  59. package/lib/session-runtime.d.ts +10 -1
  60. package/lib/session-runtime.js +3 -1
  61. package/lib/shell-env.js +1 -1
  62. package/lib/socket-isolation.d.ts +103 -0
  63. package/lib/socket-isolation.js +166 -0
  64. package/lib/status.d.ts +21 -8
  65. package/lib/status.js +61 -23
  66. package/lib/subprocess.d.ts +3 -0
  67. package/lib/subprocess.js +5 -0
  68. package/lib/takeover-report.js +4 -11
  69. package/lib/update-check.d.ts +49 -9
  70. package/lib/update-check.js +81 -28
  71. package/lib/watcher.d.ts +1 -1
  72. package/lib/watcher.js +1 -1
  73. package/lib/wsl-doctor-command.d.ts +6 -2
  74. package/lib/wsl-doctor-command.js +24 -15
  75. package/lib/wsl-doctor-tool.js +2 -0
  76. package/lib/wsl-filesystem.d.ts +53 -12
  77. package/lib/wsl-filesystem.js +90 -31
  78. package/lib/wsl-shell.d.ts +109 -40
  79. package/lib/wsl-shell.js +128 -54
  80. package/package.json +8 -3
  81. package/scripts/doctor.mjs +199 -3
  82. package/scripts/profile-preset.mjs +10 -2
@@ -12,7 +12,7 @@ profile 设置存放在 `$DSH_HOME/profiles/<name>/cordis.patch.yml`。可以用
12
12
  profile 层可以按 `id` 指向顶层行。这一层的插件行包括 `fs-routing`、
13
13
  `directory-picker-wsl`、`subprocess-wsl`、`wsl-shell-env`、`wsl-preflight`、
14
14
  `auto-preset`、`wsl-cwd-prompt`、`wsl-cwd-prompt-tool`、`wsl-update-check`、
15
- `wsl-doctor-command`、`wsl-status`、`wsl-env-client-host` 和 `preset-wsl`。
15
+ `wsl-doctor-command`、`wsl-status`、`wsl-plugin-update`、`wsl-env-client-host` 和 `preset-wsl`。
16
16
  `wsl-shell`、`wsl-fs` 与 `wsl-doctor-tool` 嵌套在
17
17
  `preset-wsl.config.plugins` 内;直接按这些 id 配置的 profile 条目会被忽略,
18
18
  并产生 `patch: entry <id> not found` 警告。
@@ -38,7 +38,8 @@ pnpm run preset --distro Ubuntu --session-sandbox false
38
38
  ```
39
39
 
40
40
  支持的修改是 `--distro`、`--session-sandbox`、`--sandbox`、
41
- `--mask-windows-drive` 和 `--agent-backend`。不带 `--out` 时,辅助脚本
41
+ `--mask-windows-drive`、`--socket-isolation`、`--strict`、`--agent-backend`
42
+ 和 `--writable-roots`。不带 `--out` 时,辅助脚本
42
43
  把完整的 `preset-wsl` 块打印出来,供你手动合并进 profile。
43
44
  使用 `pnpm run preset --check <file>` 可以检测直接指向嵌套行的
44
45
  profile 层;检测到时会打印应使用的块。`--out` 会整体替换目标文件,
@@ -64,6 +65,7 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
64
65
  | `sandbox` | `true` | 用 `bwrap` 约束命令。`bwrap` 缺失或不可用时关闭(fail closed)。`false` 则不加约束地运行命令。 |
65
66
  | `interopVisibility` | 未设置;有效默认值为 `visible` | `visible`、`masked` 或 `disabled`。设置后优先于 `maskWindowsDrive`。见 [Windows interop](#windows-interop)。 |
66
67
  | `maskWindowsDrive` | `false` | 对受限命令,在 `/mnt` 上挂载空的 tmpfs。见 [Windows interop](#windows-interop)。 |
68
+ | `socketIsolation` | `off` | 受限进程不能触达的 socket 面:`off`、`session-bus` 或 `strict`。见 [Socket isolation](#socket-isolation)。 |
67
69
  | `writableRoots` | `[]` | `workspace-write` 下额外可写的发行版目录(`~` 可用),用于工具链缓存或 linked worktree 的共享 Git 目录。条目必须是已存在的物理目录;已在工作区、`/tmp`、`/dev/shm` 内或嵌套在另一条授权内的条目会被忽略。`wsl-fs` 上应配置同一列表。见[工具链缓存](#工具链缓存与额外可写目录)。 |
68
70
  | `cwd` | `''` | 默认工作目录。空则使用发行版用户家目录。 |
69
71
  | `timeoutMs` / `maxTimeoutMs` | `120000` / `600000`(shipped) | 默认的单次调用超时,以及一次调用可请求的最大超时。 |
@@ -80,6 +82,7 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
80
82
  | `sandbox` | `true` | 按沙箱策略检查写入。`bwrap` 不可用时,受限写入关闭(fail closed)。 |
81
83
  | `sessionSandbox` | `false`;shipped 为 `true` | 使用与 `wsl-shell` 相同的会话 runtime。`auto` 在会话 runtime 不可用时回退到按策略约束的常驻 agent。 |
82
84
  | `maskWindowsDrive` | `false` | 对受限变更隐藏 `/mnt`。读取不受影响。 |
85
+ | `socketIsolation` | `off` | 与 `wsl-shell` 同义的 socket 姿态;受限写入 resident 与其 session runtime 使用。命令、写入与路由三行应保持一致。见 [Socket isolation](#socket-isolation)。 |
83
86
  | `writableRoots` | `[]` | 与 `wsl-shell` 的键同义、同规则。受限写入与命令必须看到同一挂载表,因此两行应配置同一个列表。见[工具链缓存](#工具链缓存与额外可写目录)。 |
84
87
  | `substrate` | `agent`(shipped) | 文件操作使用发行版内 agent。旧值 `share` 在启动时被拒绝。 |
85
88
  | `cwd` | `''` | 相对路径的基准目录。空则使用发行版用户家目录。 |
@@ -121,6 +124,11 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
121
124
  或 Linux 拼写),但它作用于整个 profile;同一 profile 里还有 Windows 会话时,
122
125
  用上面的插件键更安全。
123
126
 
127
+ doctor 的 `sandbox.grants` 行会列出两行配置的根、`~` 展开后的绝对路径与物理
128
+ 检查结果,并在两行列表不一致时告警;它不创建目录,也不修改配置。
129
+ `pnpm run probe:cache-write` 在真机上验证授予根可写、未授予的兄弟目录仍为
130
+ `EROFS`,覆盖 per-command profile 与 session runtime 两种形态。
131
+
124
132
  ### `fs-routing`
125
133
 
126
134
  这个顶层行为根级 `ctx.fs` 调用提供服务。它把发行版 UNC 路径
@@ -136,6 +144,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
136
144
  | `wslPath` | `wsl.exe`(shipped) | `wsl.exe` 的路径,用于解析默认发行版。 |
137
145
  | `sandbox` | `true`(shipped) | 按 `ctx.sandboxPolicy` 检查被路由的变更;`bwrap` 不可用时关闭(fail closed)。无论该围栏启用与否,该行都报告 `sandboxMode: undefined`。 |
138
146
  | `maskWindowsDrive` | `false`(shipped) | 对受限的被路由变更隐藏 `/mnt`。 |
147
+ | `socketIsolation` | `off`(shipped) | 路由根平面按策略创建的受限 resident 使用同一 socket 姿态。见 [Socket isolation](#socket-isolation)。 |
139
148
  | `restrictToDistro` | `true`(shipped) | `distro` 被固定时,拒绝属于其他发行版共享的路径。 |
140
149
  | `watchMaxDepth` | `0`(shipped) | 监视整棵树。正值深度使用有界轮询。 |
141
150
  | `distroCwd` | `''` | 默认发行版工作目录;空则使用发行版用户家目录。 |
@@ -164,6 +173,11 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
164
173
  | | `hostCwd` | 未设置 | `wsl.exe` 进程的 Windows 工作目录。可用时默认为 `%SystemRoot%`。 |
165
174
  | | `forwardEnv` | `[]` | 额外通过 `WSLENV` 转发的宿主环境变量名。 |
166
175
 
176
+ 随包还会注入宿主行 `directory-picker-browse-surface`
177
+ (`@deepseek-ai/dsh-client-ui-directory-picker-browse`)。它提供浏览器里的
178
+ 对话框本体;`directory-picker-wsl` 提供该对话框调用的后端,所以禁用选择器
179
+ 行并不会移除对话框。宿主行不接受配置。
180
+
167
181
  ### 其他顶层行
168
182
 
169
183
  | 行 | 键 | 默认值 | 说明 |
@@ -175,6 +189,8 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
175
189
  | `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
176
190
  | | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
177
191
  | | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
192
+ | `wsl-open-in-app` | `executable` | `''` | 会话页头“在应用中打开”动作使用的编辑器可执行文件。空则从常见的 Windows 安装位置解析 VS Code,再回退到 `PATH` 上的 `Code.exe`。 |
193
+ | | `watchMs` | `1500` | 每次启动的早期失败观察窗口,单位毫秒;编辑器在该窗口内退出会报告为启动失败。 |
178
194
  | `wsl-preflight` | `distro` | `''` | 要检查的发行版。空或 `auto` 跟随会话工作区。 |
179
195
  | | `wslPath` | `wsl.exe` | `wsl.exe` 的路径。 |
180
196
  | | `sandbox` | `true` | 运行会话启动时的 `bwrap` 检查。 |
@@ -183,8 +199,9 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
183
199
  | `wsl-shell-env` | `distro` | `''` | 用于填充 `DSH_WSL_*` 环境事实的发行版。 |
184
200
  | | `portsRefreshMs` | `10000` | 监听端口快照的刷新间隔,单位毫秒。 |
185
201
  | `wsl-cwd-prompt` | `enabled` | `true`(shipped) | 把 runtime context 的工作目录条目改写为发行版的 POSIX 形式。 |
186
- | `wsl-update-check` | `enabled` | `true` | 插件是否向应用的插件管理器查询更新的稳定版。结果经 `DSH_WSL_PLUGIN_UPDATE` 送达;该检查从不安装。 |
202
+ | `wsl-update-check` | `enabled` | `true` | 插件是否向应用的插件管理器查询更新的稳定版。结果经 `DSH_WSL_PLUGIN_UPDATE` 送达;后台检查从不安装(面板的一键升级是独立的显式 POST)。 |
187
203
  | | `intervalMs` | `86400000` | 检查间隔,单位毫秒(启动后 2–10 分钟首查);下限一分钟。 |
204
+ | `wsl-plugin-update` | `cacheMs` | `600000` | 面板内版本答案的新鲜时间,单位毫秒。卡片显示已安装/运行中的插件版本与最新的可安装稳定版;「一键升级」只在点击时调用宿主插件管理器的 `updateBundle`。 |
188
205
 
189
206
  GUI 文件树和预览通过 `fs-routing` 使用随包的 `workspace-files` 行;
190
207
  它们不使用单独的 WSL 提供者行。要修改其 peer 定义的限额,
@@ -260,6 +277,11 @@ unset _fnm_env
260
277
  | `masked` | 在受限 profile 中,把空的 tmpfs 挂载到 `/mnt` 上。命令无法访问 `/mnt` 下的路径;其他挂载与不受限的文件读取不在覆盖范围内。 |
261
278
  | `disabled` | 施加与 `masked` 相同的 `/mnt` 遮蔽;它不会禁用 interop,也不会修改 `wsl.conf`。请按下文单独配置发行版。 |
262
279
 
280
+ **遮蔽是命令路径的边界,不是文件系统的边界。** 受限命令看不见 `/mnt`,
281
+ 但文件工具的非受限读取面仍会经共享读 agent 访问 `/mnt/c`(下文“非受限
282
+ 文件读取”一行是同一事实的分面表述)。不要把 `masked` 理解为“发行版无法
283
+ 触达 Windows”。
284
+
263
285
  `maskWindowsDrive: true` 等价于 `interopVisibility: masked`。
264
286
  设置了 `interopVisibility` 时,它优先于
265
287
  `maskWindowsDrive`。
@@ -305,6 +327,62 @@ pnpm run preset --sandbox true --mask-windows-drive true
305
327
  由 `test/probe/interop-shell.sh` 对常驻与一次性两种命令都有覆盖。
306
328
  发行版级的 disabled 状态需要手动检查,因为它会改动 WSL 配置。
307
329
 
330
+ ## Socket isolation
331
+
332
+ 受限行上的 `socketIsolation`——`wsl-shell`(命令)、`wsl-fs`(受限写入)与
333
+ `fs-routing`(路由根平面)——决定受限进程不能触达哪些 socket 面。挂载 profile
334
+ 约束的是文件效果,不是进程权限:没有这个键,命令仍可请用户的 systemd 管理器在
335
+ 围栏外启动 unit([SECURITY.zh.md](../SECURITY.zh.md) 记录的逃逸),或使用容器
336
+ 守护进程的 socket。
337
+
338
+ | 值 | 效果 |
339
+ |---|---|
340
+ | `off`(默认) | 不遮蔽。文档化的 `enforcement: partial` 已包含这条路径。 |
341
+ | `session-bus` | 遮蔽 `$XDG_RUNTIME_DIR/bus` 与 `$XDG_RUNTIME_DIR/systemd/private`;命令内的 `systemd-run --user`、`systemctl --user` 失败。 |
342
+ | `strict` | 追加 `/run/dbus/system_bus_socket`、发行版用户可触达的容器 socket(`docker`、`podman`、`containerd`、`crio`),并遮蔽 `/run/WSL`——WSL interop 传输——profile 内的 Windows 可执行文件因此无法启动。 |
343
+
344
+ 路径在发行版内解析后以 `/dev/null` 绑定;不存在的路径不遮蔽。该键作用于
345
+ 每个受限 profile:`wsl-shell` 命令、`wsl-fs` 写入 resident 与路由根平面的
346
+ 按策略 resident。文件行运行本插件的 fsio 协议,不执行模型编写的命令,但遮蔽
347
+ 让命令面与写面保持同一张挂载表,并在该协议被攻破时保护 resident。三行应保持
348
+ 一致。
349
+
350
+ 遮蔽是收窄,不是关闭:同用户 `/proc` 与其他 IPC 仍在,因此 `enforcement`
351
+ 仍是 `partial`。`strict` 额外遮蔽 WSL interop 传输;被复制进工作区的 PE
352
+ 仍然存在,但它的 `/init` 连不到 host bridge,执行在 `connect` 处失败。这不是
353
+ 整发行版关闭:其他 distro 进程与 Windows 侧仍可 interop,完整开关仍是
354
+ `/etc/wsl.conf` 的 `[interop] enabled=false` 加 `wsl.exe --shutdown`。
355
+ `strict` 会打断受限进程内的 `systemctl --user`、D-Bus、容器客户端与 Windows
356
+ 程序启动;`off` 保持原行为。
357
+
358
+ `pnpm run probe:sandbox` 实测各档位:默认 profile 可达用户管理器,
359
+ `session-bus` 拒绝 `systemd-run --user` 并遮蔽总线与 private socket,
360
+ `strict` 还遮蔽系统总线、可达的容器 socket 与 `/run/WSL`,并阻止复制出的
361
+ Windows 可执行文件。doctor 的 `sandbox.isolation` 行报告生效档位与探测到的
362
+ 面。在命令与写入行上配置:
363
+
364
+ ```yaml
365
+ - id: wsl-shell
366
+ config:
367
+ socketIsolation: session-bus
368
+ - id: wsl-fs
369
+ config:
370
+ socketIsolation: session-bus
371
+ ```
372
+
373
+ 路由根平面使用顶层 `fs-routing` 行上的同一值:
374
+
375
+ ```yaml
376
+ - id: fs-routing
377
+ config:
378
+ socketIsolation: session-bus
379
+ ```
380
+
381
+ `pnpm run preset --socket-isolation session-bus` 写入两个嵌套行;
382
+ `pnpm run preset --strict` 在那里设置 `socketIsolation: strict` 与
383
+ `maskWindowsDrive: true`。它不重写顶层 `fs-routing` 行;使用路由根平面时需
384
+ 手工添加。
385
+
308
386
  ## 沙箱与预检
309
387
 
310
388
  `wsl-shell`、`wsl-fs` 和 `fs-routing` 的默认值都是 `sandbox: true`。
@@ -343,9 +421,11 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
343
421
 
344
422
  ### 消息语言
345
423
 
346
- 插件的拒绝与修复消息(`sessionSandbox` 预检判定、`bwrap` 的安装与修复提示、
347
- 发行版/工作目录命令错误)跟随 harness 应用的语言设置:偏好经宿主 settings
348
- 服务从 `locale` 条目的 `preference` 字段读取,切换语言无需重启应用。
424
+ 插件自作的 UI 文本全部跟随 harness 应用的语言设置:状态面板的路由错误、
425
+ open-in-app 路由的拒绝、目录选择器的标签、`/wsl-doctor` 命令文本,以及拒绝
426
+ 与修复消息(`sessionSandbox` 预检判定、`bwrap` 的安装与修复提示、发行版/
427
+ 工作目录命令错误)。偏好经宿主 settings 服务从 `locale` 条目的 `preference`
428
+ 字段读取,切换语言无需重启应用。
349
429
  内置中文(`zh`,含 `zh-CN`、`zh-Hans` 标签)与英文;其他语言渲染英文。
350
430
  没有 settings 服务的 profile、或用户从未在设置中选过语言的情况,回退到
351
431
  进程的 ICU 默认区域设置——桌面应用中即操作系统 UI 语言——因此临时渲染为
@@ -389,14 +469,20 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
389
469
  某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
390
470
  桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
391
471
  侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要,
392
- 并把完整运行动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
472
+ 并把“完整检查”动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
393
473
  session scope、清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
394
474
  每个发行版的最后一次结果存放在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
395
475
  (宿主未指定 home 时为 `~/.dsh/...`),页面刷新或应用重启后仍可见。加载时会对
396
- 正在运行的发行版在后台复核;后台失败会覆盖已存结果。不标记“已过期”——删除该
397
- 文件即可重置面板历史。按钮标签随报告切换:
398
- 存在这类可自动修复项时显示“修复”,否则显示“完整检查”;其余告警保留各自的
399
- 手动处理办法。它不会安装软件包,也不会改写 Windows 或用户所有的配置。
476
+ 正在运行的发行版在后台复核;后台失败会覆盖已存结果。不标记“已过期”——每个
477
+ 已检查行提供“清除”、卡片头部提供“清除全部”,经同一路由的 `DELETE`(可带
478
+ `?distro=`)删除本地保存的结果,不枚举、不探测也不修改发行版;直接删除该文件
479
+ 仍可等效重置面板历史。每行固定提供“快速检查”和“完整检查”两个检查动作:后者
480
+ 以 `--fix-owned` 运行完整 doctor,会修复插件自有状态(残留 session scope、
481
+ 损坏的 agent 缓存)并复检;两个按钮在结果出现后仍保持原名,再次点击即再次执行。
482
+ 其余告警保留各自的手动处理办法。它不会安装软件包,也不会改写 Windows 或用户所有的配置。
483
+ 在发行版行上方,「插件版本」卡片读取已安装与运行中的插件版本及最新的可安装稳定版;
484
+ 它的「一键升级」提交到 `/api/wsl-env/plugin-update`,只有这次点击会调用宿主插件
485
+ 管理器的 `updateBundle` 执行安装。
400
486
  使用 `scripts/bootstrap.sh <distro>` 检查发行版前置依赖。
401
487
 
402
488
  | 现象 | 结果 | 处理 |
@@ -46,7 +46,7 @@ and the verdict is recomputed — `ready`, or the remaining blockers. The
46
46
  plugin-owned state is repaired automatically: the stale-scope sweep and a
47
47
  purge of the agent cache when an entry is not executable (the handshake is
48
48
  re-probed after the purge). `--fix-owned` narrows a run to exactly those two —
49
- the sidebar panel's repair action uses it — and cannot be combined with
49
+ the sidebar panel's full-check action uses it — and cannot be combined with
50
50
  `--install`. Remedies that rewrite user- or distro-owned files (`.wslconfig`,
51
51
  `/etc/wsl.conf`, a WSL1 conversion, installing a distro) are never automated;
52
52
  the remedy text says so.
@@ -60,7 +60,10 @@ environment variables, and no telemetry.
60
60
 
61
61
  The doctor answers through three surfaces with one report; the sidebar's
62
62
  **WSL environment** panel renders the same quick digest over its own route and
63
- posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
63
+ posts the full-check action (`--fix-owned`, which also repairs plugin-owned
64
+ state). The same panel's **Plugin version** card is separate from the doctor: it reads the
65
+ installed/running plugin versions and offers the one-click upgrade through the
66
+ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
64
67
 
65
68
  - **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
66
69
  (the same line `--help` prints).
@@ -77,10 +80,12 @@ posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
77
80
  the itemized report renders detached from model history (no model turn, no
78
81
  tokens). The sidebar's **WSL environment** panel runs the same quick
79
82
  check per distro through the authenticated status route, showing a badge with
80
- numbered failing items and warnings, and a second action on a checked row: the full doctor with `--fix-owned`,
81
- labeled **修复** when the report carries a repairable finding (stale scopes
82
- or a broken agent cache) and **完整检查** otherwise, answered with its
83
- before → after fix rows. The row also states when the check ran, its source
83
+ numbered failing items and warnings. Every row offers two fixed check
84
+ actions: **快速检查** (the quick doctor scope) and **完整检查** (the full
85
+ doctor with `--fix-owned`, which also repairs plugin-owned state — stale
86
+ scopes or a broken agent cache — and answers with its before → after fix
87
+ rows). Both keep their names after a result and run again on every click;
88
+ there is no separate "recheck" action. The row also states when the check ran, its source
84
89
  (manual or the page-load background refresh), and how its results landed —
85
90
  per-status totals and per-section tallies. Each checked row expands to the
86
91
  full list of checks that run executed, grouped by section with each status
@@ -89,7 +94,10 @@ posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
89
94
  (`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`, falling back to `~/.dsh`)
90
95
  so a reload still shows it; a background refresh runs only for distros that
91
96
  are already up, and a failed one replaces the stored result as observed.
92
- Manual warnings keep their remedies; full diagnosis still uses the entry above and `/wsl-doctor`. Without a command adapter (headless, ACP) the row is a no-op and
97
+ Each checked row offers **清除** and the card offers **清除全部**; both
98
+ `DELETE` the same route, dropping the local store without starting a doctor
99
+ run or enumerating a distro. Manual warnings keep their remedies; full
100
+ diagnosis still uses the entry above and `/wsl-doctor`. Without a command adapter (headless, ACP) the row is a no-op and
93
101
  the CLI is the surface. Without `--distro` the handler names the distro from
94
102
  the session's live working directory (the agent-scoped `workingDirectory`
95
103
  service first, then the Session header's `cwd`); when neither yields a WSL
@@ -162,9 +170,9 @@ Class legend:
162
170
 
163
171
  | Code | Class | Doctor checks | In one line |
164
172
  |---|---|---|---|
165
- | `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`, `sandbox.bwrap-usable`, `functional.sandbox` | the requested confinement cannot be enforced (no usable bubblewrap) |
173
+ | `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`, `sandbox.bwrap-usable`, `functional.sandbox` | the requested confinement cannot be enforced: no usable bubblewrap, or a configured `socketIsolation` probe could not answer |
166
174
  | `FS_SANDBOX_DENIED` | policy | `functional.sandbox` (the fence shape) | the file-effect policy refused the write, or the kernel refused it at the resident's profile |
167
- | `SANDBOX_INVALID_ROOT` | configuration | — (the per-entry `writableRoots` check runs on first use; the doctor does not pre-run it) | an extra writable root is malformed, names another world, or fails the physical-directory check |
175
+ | `SANDBOX_INVALID_ROOT` | configuration | `sandbox.grants` (the `writableRoots` shape and physical directory; the `additionalWritableRoots` cross-world check still runs on first use) | an extra writable root is malformed, names another world, or fails the physical-directory check |
168
176
  | `FS_OUTSIDE_DISTRO` | policy | `config.effective` (the effective `distro`) | the path names another distro's share while the fence is pinned |
169
177
  | `FS_IO_ERROR` | environment | `distro.reachable`, `distro.disk`, `host.disk`, `agent.handshake`, `agent.home-writable`, `functional.exec`, `functional.fs` | the catch-all: an agent outage, a wedged distro, a full disk, an unmappable path |
170
178
  | `FS_NOT_FOUND` | data | — | the path does not exist — the ordinary answer |
@@ -188,8 +196,11 @@ dialect itself is [AGENT-PROTOCOL-V7.md](AGENT-PROTOCOL-V7.md).
188
196
  ## When the doctor is green but a call still fails
189
197
 
190
198
  That is the **policy** and **data** classes doing their jobs: a refusal the
191
- doctor cannot predict because it depends on the call, not the machine. If a
192
- call fails repeatedly with an **environment**-class code while the doctor
199
+ doctor cannot predict because it depends on the call, not the machine. A
200
+ configured `socketIsolation` probe failure is the one environment refusal the
201
+ doctor does not preflight: the command names the stance and the remedy, and
202
+ `pnpm run probe:sandbox` is the verification. If a call fails repeatedly with
203
+ an **environment**-class code while the doctor
193
204
  says `ready`, that is a bug — file it with the `doctor --bundle` output (a
194
205
  [setup report](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/ISSUE_TEMPLATE/setup_report.yml)
195
206
  carries it).
@@ -39,7 +39,7 @@
39
39
  受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
40
40
  插件自有状态会被自动修复:残留 scope 清扫,以及缓存条目不可执行时清理
41
41
  agent 缓存(清理后重新握手)。`--fix-owned` 把运行收窄到这两类——侧边栏
42
- 面板的“修复”动作即用它——且不能与 `--install` 同用。会改写用户或 distro
42
+ 面板的“完整检查”动作即用它——且不能与 `--install` 同用。会改写用户或 distro
43
43
  所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1 转换、安装 distro)
44
44
  永不开启自动化;补救文本会写明。
45
45
 
@@ -50,7 +50,9 @@ bundle 不含文件内容、环境变量,也没有遥测。
50
50
  ## 三个入口
51
51
 
52
52
  doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面板经自己的
53
- 路由渲染同一份快速摘要,并提交完整运行动作(`--fix-owned`,按报告标为修复或完整检查):
53
+ 路由渲染同一份快速摘要,并提交“完整检查”动作(`--fix-owned`)。
54
+ 同一面板的「插件版本」卡片独立于 doctor:它读取已安装/运行中的插件版本,并提供
55
+ 经宿主插件管理器执行的一键升级(见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md) 的 `wsl-plugin-update`)。
54
56
 
55
57
  - **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
56
58
  (与 `--help` 输出同一行)。
@@ -65,13 +67,17 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
65
67
  `/wsl-doctor [quick|full|<分区>] [--distro <名称>]`;命令面在宿主侧执行,
66
68
  handler 子进程运行独立 CLI,逐项报告直接渲染在 UI 上、不进模型历史
67
69
  (无模型回合、零 token)。侧边栏的 **WSL 环境** 面板按发行版运行同源的快速检查,
68
- 结果以状态徽标、编号的待修项与告警列出;已检查的行还提供一个完整 doctor 动作(`--fix-owned`):报告中存在可自动修复项
69
- (残留 scope 或损坏的 agent 缓存)时标为 **修复**,否则标为 **完整检查**;
70
- 返回 before → after 的修复行。行内同时给出上次检查时间、来源(手动或页面加载时的后台复核)与结果结构(各状态
70
+ 结果以状态徽标、编号的待修项与告警列出。每行固定提供两个检查动作:**快速检查**
71
+ (doctor 的 quick 范围)与 **完整检查**(完整 doctor,`--fix-owned`,会修复插件
72
+ 自有状态——残留 scope 或损坏的 agent 缓存——并返回 before → after 的修复行)。
73
+ 两个按钮在结果出现后仍保持原名,再次点击即再次执行,不存在单独的“重新检查”动作。
74
+ 行内同时给出上次检查时间、来源(手动或页面加载时的后台复核)与结果结构(各状态
71
75
  计数与分区分布)。每个已检查的行可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据;
72
76
  快速检查未触及的目录项只以“完整检查还会运行 N 项”计数,不伪装成结果。最后一次结果存放在本地(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,
73
77
  缺省回退到 `~/.dsh`),刷新后仍可见;后台复核只针对正在运行的发行版,失败时按
74
- 实际观测覆盖已存结果。手动告警保留各自处理办法;
78
+ 实际观测覆盖已存结果。每个已检查行可“清除”该发行版的结果,卡片头部可“清除全部”;
79
+ 两者经同一路由的 `DELETE` 完成,只删本地存档,不启动 doctor、不枚举发行版。
80
+ 手动告警保留各自处理办法;
75
81
  完整诊断仍走上面的入口与 `/wsl-doctor`。没有命令适配器的部署(headless、ACP)中该行是
76
82
  no-op,CLI 就是入口。未给 `--distro` 时,handler 从会话当前工作目录解析
77
83
  发行版(先读 agent 作用域的 `workingDirectory` 服务,再退回 Session 头部
@@ -125,9 +131,9 @@ realm、独立 CLI 运行)不会加这一行。
125
131
 
126
132
  | 码 | 类别 | doctor 检查 | 一句话 |
127
133
  |---|---|---|---|
128
- | `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`、`sandbox.bwrap-usable`、`functional.sandbox` | 所请求的隔离无法强制(无可用 bubblewrap) |
134
+ | `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`、`sandbox.bwrap-usable`、`functional.sandbox` | 所请求的隔离无法强制:无可用 bubblewrap,或配置的 `socketIsolation` 探针无法回答 |
129
135
  | `FS_SANDBOX_DENIED` | policy | `functional.sandbox`(围栏形状) | 文件效果策略拒绝了写入,或内核在驻留 agent 的 profile 处拒绝 |
130
- | `SANDBOX_INVALID_ROOT` | configuration | —(`writableRoots` 的逐项检查在首次使用时进行,doctor 不预跑) | 额外可写目录格式错误、指向另一个世界,或未通过物理目录检查 |
136
+ | `SANDBOX_INVALID_ROOT` | configuration | `sandbox.grants`(`writableRoots` 的格式与物理目录;`additionalWritableRoots` 的跨世界判定仍按首次使用) | 额外可写目录格式错误、指向另一个世界,或未通过物理目录检查 |
131
137
  | `FS_OUTSIDE_DISTRO` | policy | `config.effective`(生效的 `distro`) | 围栏钉死时路径指向另一 distro 的共享 |
132
138
  | `FS_IO_ERROR` | environment | `distro.reachable`、`distro.disk`、`host.disk`、`agent.handshake`、`agent.home-writable`、`functional.exec`、`functional.fs` | 兜底:agent 失联、distro 僵死、磁盘满、无法映射的路径 |
133
139
  | `FS_NOT_FOUND` | data | — | 路径不存在——普通答案 |
@@ -151,7 +157,9 @@ agent 的结构化 FS 原因(`notfound`、`notdir`、`perm`、`loop`、`stale`
151
157
  ## doctor 绿但调用仍失败
152
158
 
153
159
  那是 **policy** 与 **data** 类别在正常工作:doctor 无法预测取决于调用而非
154
- 机器的拒绝。若某个 **environment** 类错误码反复出现而 doctor 显示 `ready`,
160
+ 机器的拒绝。配置的 `socketIsolation` 探针失败是 doctor 唯一不预检的
161
+ environment 类拒绝:命令会点名档位与补救,`pnpm run probe:sandbox` 是验证。
162
+ 若某个 **environment** 类错误码反复出现而 doctor 显示 `ready`,
155
163
  那是缺陷——附上 `doctor --bundle` 输出提报
156
164
  ([setup report](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/ISSUE_TEMPLATE/setup_report.yml)
157
165
  会携带它)。
@@ -104,6 +104,20 @@ operations never use the 9p share.
104
104
  `[interop] enabled=false` remedy (printed by `doctor`) — the distro-level
105
105
  setting must still be applied manually.
106
106
  [ARCHITECTURE.md](ARCHITECTURE.md#reported-enforcement).
107
+ - **The mount profile does not govern process authority** — a confined command
108
+ can still reach sockets outside the fence: the user systemd manager (the
109
+ documented escape), the system bus, and container daemons; a PE copied into
110
+ the workspace can also start a Windows process through interop. The confined
111
+ rows' `socketIsolation: "session-bus"` binds `/dev/null` over
112
+ `$XDG_RUNTIME_DIR/bus` and `$XDG_RUNTIME_DIR/systemd/private`; `"strict"`
113
+ adds `/run/dbus/system_bus_socket`, the container sockets the distro user
114
+ can reach, and a tmpfs over `/run/WSL` (the interop transport), so a copied
115
+ PE fails at `connect`. The default is `off`; the masks are a narrowing, not
116
+ a closure (same-user `/proc` and other IPC remain; the distro-wide interop
117
+ switch is still `[interop] enabled=false`), and `enforcement` stays
118
+ `partial`. `strict` breaks `systemctl --user`, D-Bus, container clients and
119
+ Windows-program launches inside confined commands. Verified by
120
+ `pnpm run probe:sandbox`.
107
121
  - **`bubblewrap` must be installed**, or both providers fail with the install
108
122
  command; a session-start preflight surfaces the same text as an advisory warning.
109
123
  - **`workspace-write` does not grant the package-manager caches under `$HOME`
@@ -191,10 +205,9 @@ is limited to what is safe and reversible (stale scopes, the plugin-owned
191
205
  agent cache, the optional packages behind `--install` plus a confirmation, and
192
206
  the Windows git safe.directory whitelist behind the same gate). `--fix-owned`
193
207
  narrows a run to the plugin-owned two (stale scopes and the cache); the
194
- sidebar panel's full-run action is exactly that run, labeled **修复** only when
195
- one of those findings is present and **完整检查** otherwise, so it can never
196
- install a package or write Windows-owned configuration, and it never implies
197
- that a remedy-only warning is auto-fixable. The verdict never upgrades the
208
+ sidebar panel's full-check action is exactly that run, so it can never install
209
+ a package or write Windows-owned configuration, and it never implies that a
210
+ remedy-only warning is auto-fixable. The verdict never upgrades the
198
211
  sandbox's security statement: `enforcement: partial` is untouched.
199
212
 
200
213
  ## Session-start advisories
@@ -306,6 +319,16 @@ sandbox's security statement: `enforcement: partial` is untouched.
306
319
  that can still fail other bundles; this plugin no longer triggers a rollback.
307
320
  [#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) records the
308
321
  actual `0.24.0 → 0.26.2` behavior.
322
+ - **The panel's one-click upgrade needs a host plugin-manager with
323
+ `updateBundle`, and it is never automatic.** A linked checkout or a package
324
+ without a registry source is refused by the host as `not-updatable`; the
325
+ panel still shows the installed version and points at the Plugins page. The
326
+ check itself is read-only (`listVersions`); only the panel's explicit POST
327
+ calls `updateBundle`. The host may answer `restart-required` (no HMR, or a
328
+ host-module change) or roll back a failed target, and the panel reports both.
329
+ If the host process restarts or the connection drops during the update, the
330
+ browser can lose the response even though the install committed — reload the
331
+ page and read the version card before retrying.
309
332
 
310
333
  ## Host "Open in app"
311
334
 
@@ -98,6 +98,16 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
98
98
  `[interop] enabled=false` 的补救命令(由 `doctor` 打印)——发行版级设置
99
99
  仍需手工执行。
100
100
  [ARCHITECTURE.md](ARCHITECTURE.md#reported-enforcement)。
101
+ - **挂载 profile 不管辖进程权限** —— 受限进程仍可触达围栏外的 socket:
102
+ 用户 systemd 管理器(已记录的逃逸)、系统总线与容器守护进程。
103
+ 受限行的 `socketIsolation: "session-bus"` 把 `/dev/null` 绑到
104
+ `$XDG_RUNTIME_DIR/bus` 与 `$XDG_RUNTIME_DIR/systemd/private`;`"strict"`
105
+ 追加 `/run/dbus/system_bus_socket`、发行版用户可触达的容器 socket,以及
106
+ `/run/WSL` 上的 tmpfs(interop 传输),复制出的 PE 因此连不上 host bridge。
107
+ 默认 `off`;遮蔽是收窄而非关闭(同用户 `/proc` 与其他 IPC 仍在;整发行版
108
+ interop 开关仍是 `[interop] enabled=false`),`enforcement` 仍是
109
+ `partial`。`strict` 会打断受限命令内的 `systemctl --user`、D-Bus、容器
110
+ 客户端与 Windows 程序启动。由 `pnpm run probe:sandbox` 实测。
101
111
  - **必须安装 `bubblewrap`**,否则两个提供者都会带着安装命令失败;
102
112
  会话启动预检会以建议性警告的形式给出同样的文本。
103
113
  - **`workspace-write` 默认不授予 `$HOME` 下的包管理器缓存** —— npm 的
@@ -170,9 +180,9 @@ doctor 的 `verdict` 在生效配置(应用加载的 profile 层叠加在随
170
180
  携带确切的命令;可自动修复的集合仅限安全且可逆的部分(过期 scope、插件自有的
171
181
  agent 缓存、`--install` 加确认后的可选软件包、以及同一道确认门后的
172
182
  Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插件自有
173
- 的两类(过期 scope 与缓存);侧边栏面板的“修复”动作正是这次运行,存在这两类
174
- 可修复项时标为“修复”,否则标为“完整检查”,因此它永远不会安装软件包或
175
- 改写 Windows 所有的配置,也不会暗示仅能手动处理的告警可被自动修复。裁决从不升级沙箱的安全声明:
183
+ 的两类(过期 scope 与缓存);侧边栏面板的“完整检查”动作正是这次运行,因此它
184
+ 永远不会安装软件包或改写 Windows 所有的配置,也不会暗示仅能手动处理的告警
185
+ 可被自动修复。裁决从不升级沙箱的安全声明:
176
186
  `enforcement: partial` 不受影响。
177
187
 
178
188
  ## 会话启动建议
@@ -266,6 +276,13 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
266
276
  其他 bundle 仍可能失败;本插件不再触发回滚。
267
277
  [#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) 记录了
268
278
  `0.24.0 → 0.26.2` 的实际表现。
279
+ - **面板的一键升级需要宿主的插件管理器提供 `updateBundle`,且从不自动执行。**
280
+ 链接安装(linked checkout)或没有 registry 来源的包会被宿主以 `not-updatable`
281
+ 拒绝;面板仍显示已安装版本,并指向 Plugins 页。检查本身只读(`listVersions`),
282
+ 只有面板的显式 POST 才调用 `updateBundle`。宿主可能回答 `restart-required`
283
+ (无 HMR,或变更触及宿主模块),也可能回滚失败的目标版本;面板会报告这两种结果。
284
+ 若升级期间宿主进程重启或连接中断,浏览器可能丢失响应,即使安装已经完成——
285
+ 请刷新页面、读取版本卡片后再决定是否重试。
269
286
 
270
287
  ## 宿主的"在应用中打开"
271
288
 
package/docs/MIGRATION.md CHANGED
@@ -81,9 +81,9 @@ shows the composed value.
81
81
  | `pnpm run test:browser` | the plugin web bundle in headless Chromium (layout, clicks, badge timing); install Chromium once | CI (`browser` job, Ubuntu) and the release `Gates` |
82
82
  | Peer line tested | floor `>=0.2.2-rc.2`; the `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
83
83
  | Packed install/upgrade/uninstall + boot | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker; newest published stable → current, then a boot-time probe asserts all three takeovers are this plugin's classes; **host-stopped path, not the HMR update**) | manual, this machine (13/13 on 2026-11-17 with the boot leg; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
84
- | HMR update path (running profile) | install the previous published version in a temp `DSH_HOME`, start the host with a live session, upgrade to the candidate through the plugin manager; assert `application: applied` and no rollback, and after a restart that `subprocess`/`fs`/`directoryPicker` are served by this plugin's classes (the update itself may land deferred, with `providers.takeover` a warn) | **passed on 2026-11-17** with a throwaway `DSH_HOME` (web template; HMR and plugin-manager rows present), 0.26.1 from the registry, a live `standard` session, and `updateBundle` to `0.26.3-rc.0`: `application: applied`, `changed: true`, `restore: null`, and after a restart all three services were this plugin's classes. The run used the headless web composition, not the desktop GUI. The same harness with a Git-pinned dependency lost the bundle from `dsh.profile.bundles` (a separate Git-install finding, not the registry path). Record: docs/superpowers/probe-runs/2026-11-17-hmr-gate.md |
84
+ | HMR update path (running profile) | install the previous published version in a temp `DSH_HOME`, start the host with a live session, upgrade to the candidate through the plugin manager; assert `application: applied` and no rollback, and after a restart that `subprocess`/`fs`/`directoryPicker` are served by this plugin's classes (the update itself may land deferred, with `providers.takeover` a warn) | **passed on 2026-11-17** with a throwaway `DSH_HOME` (web template; HMR and plugin-manager rows present), 0.26.1 from the registry, a live `standard` session, and `updateBundle` to `0.26.3-rc.0`: `application: applied`, `changed: true`, `restore: null`, and after a restart all three services were this plugin's classes. The run used the headless web composition, not the desktop GUI. The same harness with a Git-pinned dependency lost the bundle from `dsh.profile.bundles` (a separate Git-install finding, not the registry path); **rechecked on 0.2.2-rc.5 on 2026-11-19 with the same commit pair and it no longer reproduces** — the selection is written back after remove and all three services stay this plugin's classes after a restart (record: docs/superpowers/probe-runs/2026-11-19-hmr-gate-rc5.md). Record: docs/superpowers/probe-runs/2026-11-17-hmr-gate.md; repeatable gate: `test/probe/hmr-gate.sh` (own `DSH_HOME`, needs GitHub access) |
85
85
  | Session-scoped sandbox (ADR 0001) | `pnpm run probe:session-sandbox` from a real WSL terminal (systemd user manager; not inside DSH, not in the closed-app suite) | manual; **11 passed / 0 failed / 0 skipped on 2026-11-17** — run in a fresh WSL session (`wsl.exe -d ubuntu --exec`), which sees systemd as PID 1; the probe asserts manager reachability, linger, transient-scope lifetime, `/tmp` sharing and `--unshare-pid` |
86
- | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host; `auto-preset.sh` joined the suite on 2026-11-17 (17 fast probes plus `run.sh`, 18 with `--include-fs`). The first closed-app run was **17/18**: `auto-preset.sh` failed because the `wslfs` probe profile does not compose the plugin bundle, and after that fix it still called `createSession` before auto-preset's `ctx.inject` wrapper had installed. Both causes were probe-side: the probe now layers the package patch, disables the profile's root `wsl-fs`, waits for the auto-preset fiber and the method's identity change, and reports seam/preset diagnostics. The full suite was rerun the same day (2026-11-17 20:16): **18/18, FULL PASS** (docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
86
+ | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host; `auto-preset.sh` joined the suite on 2026-11-17 (17 fast probes plus `run.sh`, 18 with `--include-fs`). The first closed-app run was **17/18**: `auto-preset.sh` failed because the `wslfs` probe profile does not compose the plugin bundle, and after that fix it still called `createSession` before auto-preset's `ctx.inject` wrapper had installed. Both causes were probe-side: the probe now layers the package patch, disables the profile's root `wsl-fs`, waits for the auto-preset fiber and the method's identity change, and reports seam/preset diagnostics. The full suite was rerun the same day (2026-11-17 20:16): **18/18, FULL PASS** (docs/superpowers/probe-runs/2026-11-17-partial-probes.md); `cache-write.sh` joined on 2026-11-19 (18 fast probes, 19 with `--include-fs`); it passed standalone the same day, and the next full closed-app run will include it |
87
87
  | Clean Win11 + Ubuntu first run ≤ 5 min | a clean machine, a stopwatch | **not run** (the project's machine is already configured) |
88
88
  | aarch64 executed | the native 18-check suite under qemu in CI | **run in CI** (physical aarch64 WSL is out of scope; see COMPATIBILITY.md) |
89
89
  | No open P0 bug for 30 days | issue tracker | time-based; cannot be asserted from a checkout |
@@ -69,9 +69,9 @@
69
69
  | `pnpm run test:browser` | 无头 Chromium 中的插件 web bundle(布局、点击、badge 时序);安装一次 Chromium | CI(`browser` job,Ubuntu)与发布的 `Gates` |
70
70
  | peer 版本线受测 | 下限 `>=0.2.2-rc.2`;`peer-canary` 工作流解析 `next` 并运行临时升级 | CI 定时/手动 |
71
71
  | 打包安装/升级/卸载 + 启动 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker;最新已发布版 → 当前版本后用探针启动,断言三个接管都是本插件的类;**宿主关闭路径,不含 HMR 更新**) | 手动,本机(2026-11-17 含启动 leg 为 13/13;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
72
- | HMR 更新路径(运行中 profile) | 临时 `DSH_HOME` 安装上一个已发布版本 → 启动 host 并保留活动会话 → 经插件管理升级到候选版本;断言 `application: applied`、无回滚,重启后 `subprocess`/`fs`/`directoryPicker` 由本插件的类提供(升级当时可能处于延迟接管,`providers.takeover` 为 warn) | **2026-11-17 通过**:临时 `DSH_HOME`(web 模板,含 HMR 与 plugin-manager 行)、registry 安装 0.26.1、活动 `standard` 会话,`updateBundle` 到 `0.26.3-rc.0` 得到 `application: applied`、`changed: true`、`restore: null`,重启后三个服务均为本插件的类。本次用 headless web composition,不是桌面 GUI 点击。同一套 harness 换成 Git 固定 commit 依赖后,`dsh.profile.bundles` 丢失 bundle(Git 安装路径的独立问题,不影响 registry 路径)。记录:docs/superpowers/probe-runs/2026-11-17-hmr-gate.md |
72
+ | HMR 更新路径(运行中 profile) | 临时 `DSH_HOME` 安装上一个已发布版本 → 启动 host 并保留活动会话 → 经插件管理升级到候选版本;断言 `application: applied`、无回滚,重启后 `subprocess`/`fs`/`directoryPicker` 由本插件的类提供(升级当时可能处于延迟接管,`providers.takeover` 为 warn) | **2026-11-17 通过**:临时 `DSH_HOME`(web 模板,含 HMR 与 plugin-manager 行)、registry 安装 0.26.1、活动 `standard` 会话,`updateBundle` 到 `0.26.3-rc.0` 得到 `application: applied`、`changed: true`、`restore: null`,重启后三个服务均为本插件的类。本次用 headless web composition,不是桌面 GUI 点击。同一套 harness 换成 Git 固定 commit 依赖后,`dsh.profile.bundles` 丢失 bundle(Git 安装路径的独立问题,不影响 registry 路径);**2026-11-19 在 0.2.2-rc.5 上用同一对 commit 复验不再复现**,选择在 remove 后写回,重启后三个服务仍为本插件的类(记录:docs/superpowers/probe-runs/2026-11-19-hmr-gate-rc5.md)。记录:docs/superpowers/probe-runs/2026-11-17-hmr-gate.md;可复跑:`bash test/probe/hmr-gate.sh`(独立 `DSH_HOME`,需要 GitHub 访问) |
73
73
  | 会话级沙箱(ADR 0001) | 在真实 WSL 终端运行 `pnpm run probe:session-sandbox`(systemd user manager;不在 DSH 内,也不在关闭应用套件里) | 手动;**2026-11-17 为 11 passed / 0 failed / 0 skipped**——在全新 WSL 会话(`wsl.exe -d ubuntu --exec`)中运行,systemd 是 PID 1;探针断言 manager 可达性、linger、transient scope 生命周期、`/tmp` 共享与 `--unshare-pid` |
74
- | 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17;`auto-preset.sh` 于 2026-11-17 加入套件(17 项快速探针,`--include-fs` 时加 `run.sh`,共 18 项)。首次关闭应用的全套结果为 **17/18**:`auto-preset.sh` 失败,原因是 `wslfs` 探针 profile 不组合插件 bundle;修好组合后又发现探针在 auto-preset 的 `ctx.inject` 包装器安装前就调用了 `createSession`。两处都是探针侧问题:探针现在追加包自身的 patch、禁用 profile 的根 `wsl-fs`、等待 auto-preset 行的 fiber 与方法身份变化,并输出 seam/preset 诊断。同日 20:16 重跑整套:**18/18,FULL PASS**(docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
74
+ | 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17;`auto-preset.sh` 于 2026-11-17 加入套件(17 项快速探针,`--include-fs` 时加 `run.sh`,共 18 项)。首次关闭应用的全套结果为 **17/18**:`auto-preset.sh` 失败,原因是 `wslfs` 探针 profile 不组合插件 bundle;修好组合后又发现探针在 auto-preset 的 `ctx.inject` 包装器安装前就调用了 `createSession`。两处都是探针侧问题:探针现在追加包自身的 patch、禁用 profile 的根 `wsl-fs`、等待 auto-preset 行的 fiber 与方法身份变化,并输出 seam/preset 诊断。同日 20:16 重跑整套:**18/18,FULL PASS**(docs/superpowers/probe-runs/2026-11-17-partial-probes.md);`cache-write.sh` 于 2026-11-19 加入(18 项快速探针,`--include-fs` 时共 19 项);同日单独运行通过,下一次关闭应用的全套会包含它 |
75
75
  | 干净 Win11 + Ubuntu 首次运行 ≤ 5 分钟 | 干净机器、秒表 | **未运行**(项目机器已配置) |
76
76
  | aarch64 已执行 | CI 中 qemu 下的 native 18 项检查套件 | **已在 CI 运行**(物理 aarch64 WSL 不在范围内;见 COMPATIBILITY.md) |
77
77
  | 30 天内无未关闭的 P0 bug | issue tracker | 基于时间;无法从代码检出中断言 |
package/docs/PARITY.md CHANGED
@@ -10,7 +10,9 @@ protocol v4, 2026-10-06. These rows are not a fresh verification of the current
10
10
  release or protocol; see [PEER-PARITY.md](PEER-PARITY.md) for the peer
11
11
  comparison. The peer pin moved to `0.2.1-rc.2` on 2026-10-17 with every
12
12
  seam package's shipped artifact byte-identical to the ones these rows were
13
- measured against; the real-machine probes were not re-run in that move.
13
+ measured against; it moved again to `0.2.2-rc.2` on 2026-11-12, and the
14
+ real-machine probes were not re-run in either move. Treat every row below as
15
+ the 0.8.0 measurement plus later delta notes, not a fresh verification.
14
16
 
15
17
  ## What parity means here
16
18
 
@@ -33,8 +33,10 @@ supplies the WSL environment.
33
33
 
34
34
  No terminal at hand? Several ways without one: the sidebar's **WSL
35
35
  environment** panel runs a quick doctor check per distro, listing the badge,
36
- numbered failing items and warnings, and offers the full run labeled **修复** for the plugin-owned state when such a
37
- finding exists (stale scopes and a broken agent cache), **完整检查** otherwise; typing `/wsl-doctor [quick|full|<section>]`
36
+ numbered failing items and warnings. Every row offers **快速检查** and
37
+ **完整检查**; the latter is the full doctor with `--fix-owned`, which also
38
+ repairs plugin-owned state (stale scopes and a broken agent cache) when
39
+ present. Both run again on every click; typing `/wsl-doctor [quick|full|<section>]`
38
40
  in the composer also runs host-side and renders in the UI — no model turn, no
39
41
  tokens; in a session, ask for a diagnosis and the model runs the `wsl_doctor`
40
42
  tool (mounted by this plugin), the verdict landing in the transcript; and the
@@ -52,7 +54,7 @@ read-only unless you pass `--fix`
52
54
  (the stale-scope sweep and a broken agent cache, both re-verified; the Windows
53
55
  git trust after a confirmation) or `--fix --install` (packages, after a
54
56
  confirmation); `--fix-owned` restricts a fix run to the plugin-owned state
55
- (the panel's repair action); `--bundle <path>` writes
57
+ (the panel's full-check action); `--bundle <path>` writes
56
58
  the diagnostic file a setup report attaches (`--redact` strips the paths
57
59
  from it). A run can be scoped — `--quick` probes the first-command
58
60
  prerequisites plus one combined optional-tool probe (~10 s), `--sections
@@ -73,12 +75,15 @@ For a profile that already overrides the preset, keep the override as the full
73
75
  targets `wsl-shell`/`wsl-fs` by id.
74
76
 
75
77
  The plugin never edits the installed `resources/app.asar`: an app upgrade
76
- cannot drop the bridge, and a plugin update only needs a reinstall and restart.
77
- Upgrade = install again on the Plugins page, then restart (the harness has no
78
- hot reload); uninstall happens on the same page, after which `~/.cache/dsh-wsl`
79
- can be deleted. If you added a local `workspace-files-wsl` workaround to your
80
- profile to restore previews, remove it after upgrading: the plugin no longer
81
- mounts that row.
78
+ cannot drop the bridge. The sidebar **WSL environment** panel's **Plugin
79
+ version** card reads the installed and running versions, checks the registry
80
+ through the host's plugin manager, and offers **一键升级** (one-click upgrade)
81
+ when a newer stable release exists; the Plugins page remains the fallback.
82
+ An upgrade takes effect after a restart, or after a page reload when the host
83
+ reports HMR applied it. Uninstall happens on the Plugins page, after which
84
+ `~/.cache/dsh-wsl` can be deleted. If you added a local `workspace-files-wsl`
85
+ workaround to your profile to restore previews, remove it after upgrading: the
86
+ plugin no longer mounts that row.
82
87
 
83
88
  ## 3. Open a WSL workspace
84
89
 
@@ -92,17 +97,23 @@ all run in that distro; a Windows folder keeps the normal Windows environment.
92
97
 
93
98
  The sidebar's **WSL environment** panel is the diagnostic page: it lists the
94
99
  installed distros, runs one distro's quick doctor check on demand (showing
95
- whether bwrap, systemd and Linger are in place), and offers **修复** on a checked
96
- row as a full doctor with `--fix-owned` — labeled **修复** when a finding is
97
- repairable (a stale session scope or a broken agent cache) and **完整检查**
98
- otherwise; the row also shows when the check ran, its source (manual, or the
99
- page-load background refresh), and its result structure (pass/warn/fail/info/
100
- skip, plus the per-section tallies). The last result survives a page reload
101
- from the local store, and a stored result for a running distro is re-checked
102
- in the background on load. The run sweeps the scopes and purges the cache when they need it,
103
- then re-verifies; every other warning keeps its manual remedy, and the action
104
- never installs packages or rewrites Windows-owned configuration (a check boots
105
- a stopped distro, so either action only runs on a click). Workspaces still open through **Add workspace**; selecting a folder inside a
100
+ whether bwrap, systemd and Linger are in place), and offers **快速检查** and
101
+ **完整检查** on every row; the latter is the full doctor with `--fix-owned`,
102
+ which also repairs plugin-owned state (a stale session scope or a broken agent
103
+ cache). Both keep their names after a result and run again on every click; the
104
+ row also shows when the check ran, its source (manual, or the page-load
105
+ background refresh), and its result structure (pass/warn/fail/info/skip, plus
106
+ the per-section tallies). Its **Plugin version** card reads the
107
+ installed/running versions and offers the one-click upgrade described above.
108
+ The last result survives a page reload from the local store, and a stored
109
+ result for a running distro is re-checked in the background on load. Each
110
+ checked row offers **清除** and the card **清除全部** to drop local results
111
+ without probing or modifying a distro. The run
112
+ sweeps the scopes and purges the cache when they need it, then re-verifies;
113
+ every other warning keeps its manual remedy, and the action never installs
114
+ packages or rewrites Windows-owned configuration (a check boots a stopped
115
+ distro, so either action only runs on a click). Workspaces still open through
116
+ **Add workspace**; selecting a folder inside a
106
117
  distro through the picker makes the app ask once how to open it: **Remote
107
118
  WSL** (the default — commands, files and the terminal all run in the distro) or
108
119
  **Windows access** (the folder as an ordinary Windows share over 9p, without the