dsh-plugin-wsl-env 0.26.4 → 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.
- package/CHANGELOG.md +61 -0
- package/CONTRIBUTING.md +7 -4
- package/CONTRIBUTING.zh.md +3 -2
- package/README.md +1 -1
- package/SECURITY.md +21 -7
- package/SECURITY.zh.md +18 -5
- package/client.js +351 -48
- package/cordis.patch.yml +26 -10
- package/docs/API.md +2 -1
- package/docs/API.zh.md +2 -1
- package/docs/ARCHITECTURE.md +22 -4
- package/docs/ARCHITECTURE.zh.md +18 -4
- package/docs/CONFIGURATION.md +96 -12
- package/docs/CONFIGURATION.zh.md +80 -8
- package/docs/DIAGNOSTICS.md +22 -11
- package/docs/DIAGNOSTICS.zh.md +17 -9
- package/docs/LIMITATIONS.md +27 -4
- package/docs/LIMITATIONS.zh.md +20 -3
- package/docs/MIGRATION.md +2 -2
- package/docs/MIGRATION.zh.md +2 -2
- package/docs/QUICKSTART.md +31 -20
- package/docs/QUICKSTART.zh.md +16 -9
- package/docs/README.zh.md +1 -1
- package/docs/REQUIREMENTS.zh.md +3 -2
- package/lib/agent-confined.d.ts +9 -1
- package/lib/agent-confined.js +3 -3
- package/lib/bwrap.d.ts +16 -0
- package/lib/bwrap.js +9 -0
- package/lib/fs-routing.d.ts +3 -0
- package/lib/fs-routing.js +2 -0
- package/lib/messages.js +2 -2
- package/lib/plugin-update.d.ts +212 -0
- package/lib/plugin-update.js +283 -0
- package/lib/sandbox-core.d.ts +2 -0
- package/lib/sandbox-core.js +5 -3
- package/lib/session-runtime.d.ts +10 -1
- package/lib/session-runtime.js +3 -1
- package/lib/shell-env.js +1 -1
- package/lib/socket-isolation.d.ts +103 -0
- package/lib/socket-isolation.js +166 -0
- package/lib/status.d.ts +21 -8
- package/lib/status.js +53 -18
- package/lib/update-check.d.ts +49 -9
- package/lib/update-check.js +81 -28
- package/lib/wsl-doctor-tool.js +2 -0
- package/lib/wsl-filesystem.d.ts +39 -1
- package/lib/wsl-filesystem.js +51 -4
- package/lib/wsl-shell.d.ts +67 -3
- package/lib/wsl-shell.js +75 -12
- package/package.json +8 -3
- package/scripts/doctor.mjs +199 -3
- package/scripts/profile-preset.mjs +10 -2
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
|
|
40
40
|
插件自有状态会被自动修复:残留 scope 清扫,以及缓存条目不可执行时清理
|
|
41
41
|
agent 缓存(清理后重新握手)。`--fix-owned` 把运行收窄到这两类——侧边栏
|
|
42
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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` |
|
|
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 |
|
|
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
|
-
|
|
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
|
会携带它)。
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -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-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
|
package/docs/LIMITATIONS.zh.md
CHANGED
|
@@ -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
|
-
|
|
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 |
|
package/docs/MIGRATION.zh.md
CHANGED
|
@@ -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
|
|
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/QUICKSTART.md
CHANGED
|
@@ -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
|
|
37
|
-
|
|
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
|
|
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
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
|
96
|
-
row
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
package/docs/QUICKSTART.zh.md
CHANGED
|
@@ -30,8 +30,9 @@ dsh headless "run the tests" # 单任务、输出答案后退出
|
|
|
30
30
|
| Node `^22.19.0` 或 `>=24.0.0` | 仅源码/开发工作需要 | 使用已发布的插件时,发行版内不需要 Node |
|
|
31
31
|
|
|
32
32
|
手边没有终端?有几条不依赖终端的路:侧边栏的 **WSL 环境** 面板按发行版运行
|
|
33
|
-
doctor
|
|
34
|
-
|
|
33
|
+
doctor 快速检查,结果以状态徽标、编号的待修项与告警列出;每行固定提供 **快速检查**
|
|
34
|
+
与 **完整检查**,后者以 `--fix-owned` 运行完整 doctor,并修复插件自有状态
|
|
35
|
+
(残留 scope、损坏的 agent 缓存);两个按钮再次点击即再次执行;在输入框里输入
|
|
35
36
|
`/wsl-doctor [quick|full|<分区>]` 同样在宿主侧执行、直接渲染在 UI,不进模型
|
|
36
37
|
对话、零 token;在会话里请求诊断,模型会运行本插件挂载的 `wsl_doctor` 工具,
|
|
37
38
|
判定落在对话里;会话启动预检在每次会话打开时把同样的判定写进日志,只有 blocked
|
|
@@ -44,7 +45,7 @@ doctor(`scripts/doctor.mjs`,或在检出目录中运行 `pnpm run doctor`)
|
|
|
44
45
|
读取,无需单独确认。doctor 默认只读,除非传入 `--fix`(清理过期 scope、清理损坏的
|
|
45
46
|
agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
|
|
46
47
|
`--fix --install`(安装软件包,需确认);`--fix-owned` 把修复限定在
|
|
47
|
-
|
|
48
|
+
插件自有状态(面板的“完整检查”动作);
|
|
48
49
|
`--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact`
|
|
49
50
|
将其中的路径脱敏)。运行可以收窄范围——`--quick` 只探首条命令的前置项
|
|
50
51
|
与一次合并的可选工具探测(约 10 秒),`--sections <分区清单>`(逗号分隔)
|
|
@@ -63,9 +64,11 @@ agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
|
|
|
63
64
|
`preset-wsl` 块——当某个层直接按 id 指向 `wsl-shell`/`wsl-fs` 时,
|
|
64
65
|
`pnpm run preset --check <patch>` 会明确报错。
|
|
65
66
|
|
|
66
|
-
插件不修改已安装的 `resources/app.asar
|
|
67
|
-
|
|
68
|
-
Plugins
|
|
67
|
+
插件不修改已安装的 `resources/app.asar`:应用升级不受影响。侧栏 **WSL 环境**
|
|
68
|
+
面板的「插件版本」卡片显示已安装与运行中的版本,经宿主的插件管理器检查 registry,
|
|
69
|
+
并在有更新的稳定版时提供「一键升级」;Plugins 页重新安装仍是备用路径。升级在
|
|
70
|
+
重启后生效;宿主报告 HMR 已应用时,刷新页面即可。卸载在 Plugins 页,之后可删
|
|
71
|
+
`~/.cache/dsh-wsl`。曾为恢复预览加过 `workspace-files-wsl`
|
|
69
72
|
临时覆盖的,升级后删除:插件不再挂载该行。
|
|
70
73
|
|
|
71
74
|
## 3. 打开 WSL 工作区
|
|
@@ -79,11 +82,15 @@ Plugins 页,之后可删 `~/.cache/dsh-wsl`。曾为恢复预览加过 `worksp
|
|
|
79
82
|
两个发行版可以同时打开,各自拥有自己的环境。
|
|
80
83
|
|
|
81
84
|
侧边栏的 **WSL 环境** 面板是诊断页:它列出已安装的发行版,可对单个发行版运行
|
|
82
|
-
一次 doctor 快速检查,显示 bwrap、systemd、Linger
|
|
83
|
-
|
|
85
|
+
一次 doctor 快速检查,显示 bwrap、systemd、Linger 等前置项是否正常;顶部的
|
|
86
|
+
「插件版本」卡片显示已安装与运行中的版本,并提供上文的一键升级;每行固定提供
|
|
87
|
+
“快速检查”和“完整检查”两个按钮,后者运行完整 doctor(`--fix-owned`),会修复
|
|
88
|
+
插件自有状态(残留 session scope 或损坏的 agent 缓存);两个按钮在结果出现后
|
|
89
|
+
仍保持原名,再次点击即再次执行;行内还显示上次
|
|
84
90
|
检查时间、来源(手动,或页面加载时的后台复核)与结果结构(通过/告警/失败/
|
|
85
91
|
信息/跳过,以及分区分布);最后一次结果会从本地存档恢复,正在运行的发行版会在
|
|
86
|
-
|
|
92
|
+
页面加载时后台复核;已检查行可“清除”该发行版的结果,卡片头部可“清除全部”;
|
|
93
|
+
清除只删除本地存档,不探测、不修改发行版;运行时按需清扫
|
|
87
94
|
残留 scope、清理缓存并逐一复检,其余告警保留各自的手动处理办法,不安装软件包、
|
|
88
95
|
不改写 Windows 配置(检查会让停止的发行版启动,所以两种动作都只在点击时执行)。工作区仍在 **添加工作区** 里打开;选中发行版内的文件夹时,应用会问一次打开方式:**Remote WSL**(默认,命令、
|
|
89
96
|
文件与终端都在发行版内)或 **Windows 访问**(把该文件夹当作普通 Windows 共享,经 9p
|
package/docs/README.zh.md
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
| systemd + Linger(默认会话沙箱需要) | `/etc/wsl.conf` 设 `[boot] systemd=true`,`wsl --shutdown`,执行一次 `loginctl enable-linger "$USER"`;无 systemd 时设 `sessionSandbox` 为 `auto` 或 `false` |
|
|
44
44
|
| 可选:`ripgrep`、`git`、`inotify-tools` | `pnpm run bootstrap <发行版>` 打印安装命令 |
|
|
45
45
|
|
|
46
|
-
插件不修改已安装的 `resources/app.asar
|
|
46
|
+
插件不修改已安装的 `resources/app.asar`。侧栏 **WSL 环境** 面板显示已安装与运行中的插件版本,经宿主的插件管理器检查 registry,并在有更新的稳定版时提供一键升级;在 Plugins 页重新安装仍是备用路径。升级在重启后生效;宿主报告 HMR 已应用时,刷新页面即可。卸载在 Plugins 页面,之后可删 `~/.cache/dsh-wsl`。细节见 [QUICKSTART.zh.md](QUICKSTART.zh.md)。
|
|
47
47
|
|
|
48
48
|
## 需要这个插件吗?
|
|
49
49
|
|
package/docs/REQUIREMENTS.zh.md
CHANGED
|
@@ -62,9 +62,10 @@ R29 的基线为 0.25.0(2026-11-11),R30 的基线为 0.26.0(2026-11-12
|
|
|
62
62
|
| R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实 Windows 桌面应用 + WSL;打包链路由 `e2e:install` 覆盖) | 无自动化守护 |
|
|
63
63
|
| 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)无单测 |
|
|
64
64
|
| 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` 不抛错) |
|
|
65
|
-
| R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false`
|
|
66
|
-
| 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
|
|
65
|
+
| R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false` 可关闭;面板的「插件版本」卡片显示已安装/运行中版本、升级提醒与显式一键升级(`wsl-plugin-update`:GET 只读检查,POST 才调用 `updateBundle`) | README「Install」;QUICKSTART「Install」;CONFIGURATION `wsl-update-check` / `wsl-plugin-update` 行 | ①②⑤:委托路径、TTL、关闭开关、检查只读与点击安装的边界成文 | `update-check.test.mjs`、`plugin-update.test.mjs` | doctor 不再自行查询 registry:更新提示只走这条委托路径;一键升级依赖宿主 `updateBundle`,旧宿主/链接安装按 LIMITATIONS 手动升级 |
|
|
66
|
+
| 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 的授权根腿;`doctor.test.mjs`(`sandbox.grants`);`test/probe/cache-write.sh`(真机,per-command 与 session runtime) | 真机端到端 `pnpm install` 尚未纳入探针套件;`additionalWritableRoots` 的宿主会话语义仍由上游策略决定 |
|
|
67
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
|
+
| R31 | 受限 profile 的 socket 面隔离:`socketIsolation`(`wsl-shell`/`wsl-fs`/`fs-routing`)的 `off`/`session-bus`/`strict`;`session-bus` 遮蔽 `$XDG_RUNTIME_DIR/bus` 与 `$XDG_RUNTIME_DIR/systemd/private`,`strict` 追加 `/run/dbus/system_bus_socket`、可达的容器 socket 与 `/run/WSL`(interop 传输,复制进工作区的 PE 在 host bridge 处失败);默认 `off`,`enforcement` 仍为 `partial`;doctor `sandbox.isolation` 报告档位与探测面,`preset --socket-isolation`/`--strict` 写入嵌套行 | CONFIGURATION「Socket isolation」;SECURITY「Sandbox enforcement is partial」;LIMITATIONS「挂载 profile 不管辖进程权限」 | ①③⑤:默认不破坏、两档遮蔽面、三行一致、`strict` 代价与残余(同用户 `/proc`、interop)成文 | `socket-isolation.test.mjs`、`sandbox.test.mjs`、`session-runtime.test.mjs`、`provider.test.mjs`、`agent.test.mjs`(confined key)、`doctor.test.mjs`(`sandbox.isolation`)、`profile-preset.test.mjs`;`probe:sandbox` 的 socket 腿与 strict interop 腿 | 不关闭同用户 `/proc` / interop;顶层 `fs-routing` 行需手工同步,`fs`/`routing` 的 fsio agent 不执行模型命令 |
|
|
68
69
|
|
|
69
70
|
登记覆盖面:上表登记 README 与 docs/ 中对外成文的行为承诺(含随发的服务面)。
|
|
70
71
|
**有意未接线**的模块不设条目——`lib/file-reference-wsl.js`(`@` 补全的发行版侧
|
package/lib/agent-confined.d.ts
CHANGED
|
@@ -71,6 +71,14 @@ interface ConfinedAgentRequest {
|
|
|
71
71
|
* key because the mount table is fixed for the resident's lifetime.
|
|
72
72
|
*/
|
|
73
73
|
writableRoots?: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Existing socket paths the resident's profile masks with `/dev/null`.
|
|
76
|
+
* Resolved by the provider from the row's `socketIsolation`; part of the key
|
|
77
|
+
* because the mount table is fixed for the resident's lifetime.
|
|
78
|
+
*/
|
|
79
|
+
socketMasks?: readonly string[];
|
|
80
|
+
/** Shadow `/run/WSL`, the WSL interop transport, in the resident's profile. */
|
|
81
|
+
maskInterop?: boolean;
|
|
74
82
|
}
|
|
75
83
|
/**
|
|
76
84
|
* The confined agent for one distro and one resolved policy, created on first
|
|
@@ -80,7 +88,7 @@ interface ConfinedAgentRequest {
|
|
|
80
88
|
* @param request - the confinement request.
|
|
81
89
|
* @returns the confined resident for this key.
|
|
82
90
|
*/
|
|
83
|
-
export declare function confinedAgent({ distro, wslPath, policy, maskWindowsDrive, realTmp, writableRoots }: ConfinedAgentRequest): WslAgent;
|
|
91
|
+
export declare function confinedAgent({ distro, wslPath, policy, maskWindowsDrive, realTmp, writableRoots, socketMasks, maskInterop }: ConfinedAgentRequest): WslAgent;
|
|
84
92
|
/** Test hook: forget every confined resident (the plain agent has no factory state). */
|
|
85
93
|
export declare function resetConfinedAgents(): void;
|
|
86
94
|
export {};
|
package/lib/agent-confined.js
CHANGED
|
@@ -105,8 +105,8 @@ export async function runSpawnChecklist({ wslPath, distro, root, runFn }) {
|
|
|
105
105
|
* @param request - the confinement request.
|
|
106
106
|
* @returns the confined resident for this key.
|
|
107
107
|
*/
|
|
108
|
-
export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindowsDrive = false, realTmp = true, writableRoots = [] }) {
|
|
109
|
-
const key = `${wslPath}\0${distro}\0${policy.mode}\0${policy.workspaceRoot}\0${maskWindowsDrive ? "masked" : "visible"}\0${realTmp ? "real" : "ephemeral"}\0${writableRoots.join("\0")}`;
|
|
108
|
+
export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindowsDrive = false, realTmp = true, writableRoots = [], socketMasks = [], maskInterop = false }) {
|
|
109
|
+
const key = `${wslPath}\0${distro}\0${policy.mode}\0${policy.workspaceRoot}\0${maskWindowsDrive ? "masked" : "visible"}\0${realTmp ? "real" : "ephemeral"}\0${writableRoots.join("\0")}\0${socketMasks.join("\0")}\0${maskInterop ? "interop-masked" : "interop-visible"}`;
|
|
110
110
|
let agent = confinedAgents.get(key);
|
|
111
111
|
if (agent === undefined) {
|
|
112
112
|
const linuxRoot = toLinuxPath(policy.workspaceRoot);
|
|
@@ -120,7 +120,7 @@ export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindows
|
|
|
120
120
|
// `wsl.exe --exec` and the `sh <script>` pair (`lib/agent.js`'s
|
|
121
121
|
// `spawnDefault`). Both confinement sites share that assembly in
|
|
122
122
|
// `lib/bwrap.js`, whose module doc records what happened when they did not.
|
|
123
|
-
argvPrefix: bwrapArgvPrefix({ mode: policy.mode, workspaceRoot: linuxRoot }, { maskWindowsDrive, realTmp, writableRoots }),
|
|
123
|
+
argvPrefix: bwrapArgvPrefix({ mode: policy.mode, workspaceRoot: linuxRoot }, { maskWindowsDrive, realTmp, writableRoots, socketMasks, maskInterop }),
|
|
124
124
|
// workspace-write is the only mode that binds the workspace root, and
|
|
125
125
|
// bwrap refuses a missing bind source (WSL-305): on a freshly imported
|
|
126
126
|
// distro the first write's workspace may not exist yet, and the resident
|
package/lib/bwrap.d.ts
CHANGED
|
@@ -48,6 +48,22 @@ interface BwrapProfileOptions {
|
|
|
48
48
|
* Inert under `read-only`: the mode grants no write outside `/`.
|
|
49
49
|
*/
|
|
50
50
|
writableRoots?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Existing socket paths to shadow with `/dev/null`: the user systemd
|
|
53
|
+
* manager's sockets (`session-bus`) and, for `strict`, the system bus and
|
|
54
|
+
* the container sockets the distro user can reach. The caller resolves and
|
|
55
|
+
* filters the paths (`lib/socket-isolation.js`); binding a missing or
|
|
56
|
+
* symlinked path fails in bwrap, so this module never invents one.
|
|
57
|
+
*/
|
|
58
|
+
socketMasks?: readonly string[];
|
|
59
|
+
/**
|
|
60
|
+
* Shadow `/run/WSL` with an empty tmpfs: the WSL interop transport. `/init`
|
|
61
|
+
* stays executable and the kernel keeps its binfmt handler, but the host
|
|
62
|
+
* bridge socket is gone, so a PE executed inside the profile fails at
|
|
63
|
+
* `connect`. The complete distro-wide closure is still `[interop]
|
|
64
|
+
* enabled=false`; this is the command-profile narrowing.
|
|
65
|
+
*/
|
|
66
|
+
maskInterop?: boolean;
|
|
51
67
|
}
|
|
52
68
|
/**
|
|
53
69
|
* Build the bwrap profile arguments for one file-effect policy, exactly as
|
package/lib/bwrap.js
CHANGED
|
@@ -69,6 +69,15 @@ export function bwrapProfileArgs(policy, options = {}) {
|
|
|
69
69
|
if (options.pidNamespace !== false)
|
|
70
70
|
args.push("--unshare-pid");
|
|
71
71
|
args.push("--proc", "/proc", "--die-with-parent");
|
|
72
|
+
// After `--dev /dev`, so `/dev/null` exists to bind from, and after the
|
|
73
|
+
// read-only root, so the mount lands over the socket the command would
|
|
74
|
+
// otherwise reach. The paths are existing sockets the caller verified.
|
|
75
|
+
for (const socket of options.socketMasks ?? [])
|
|
76
|
+
args.push("--ro-bind", "/dev/null", socket);
|
|
77
|
+
// `/run/WSL` is the interop bridge's directory, so it takes a tmpfs (a
|
|
78
|
+
// directory cannot be shadowed with the `/dev/null` bind used for sockets).
|
|
79
|
+
if (options.maskInterop)
|
|
80
|
+
args.push("--tmpfs", "/run/WSL");
|
|
72
81
|
if (policy.mode === "workspace-write") {
|
|
73
82
|
if (options.realTmp) {
|
|
74
83
|
args.push("--bind", "/tmp", "/tmp");
|
package/lib/fs-routing.d.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @module dsh-plugin-wsl-env/fs-routing
|
|
32
32
|
*/
|
|
33
|
+
import type { SocketIsolation } from "./socket-isolation.js";
|
|
33
34
|
import { PLUGIN_PROVIDER } from "./provider-marker.js";
|
|
34
35
|
import z from "@deepseek-ai/schemastery";
|
|
35
36
|
import { LocalFileSystem } from "@deepseek-ai/dsh-fs-local";
|
|
@@ -66,6 +67,8 @@ interface RoutingConfig {
|
|
|
66
67
|
sandbox?: boolean;
|
|
67
68
|
/** Whether confined profiles shadow `/mnt`. */
|
|
68
69
|
maskWindowsDrive?: boolean;
|
|
70
|
+
/** Which socket surfaces the routed backend's confined resident cannot reach. */
|
|
71
|
+
socketIsolation?: SocketIsolation;
|
|
69
72
|
/** Whether the routed backend refuses paths outside the distro. */
|
|
70
73
|
restrictToDistro?: boolean;
|
|
71
74
|
/** How deep the in-distro watch scan walks. */
|
package/lib/fs-routing.js
CHANGED
|
@@ -116,6 +116,7 @@ export class WslRoutingFileSystem extends LocalFileSystem {
|
|
|
116
116
|
distroCwd: z.string().default(""),
|
|
117
117
|
sandbox: z.boolean().default(true),
|
|
118
118
|
maskWindowsDrive: z.boolean().default(false),
|
|
119
|
+
socketIsolation: z.union(["off", "session-bus", "strict"]).default("off"),
|
|
119
120
|
restrictToDistro: z.boolean().default(true),
|
|
120
121
|
watchMaxDepth: z.natural().default(0),
|
|
121
122
|
}),
|
|
@@ -166,6 +167,7 @@ export class WslRoutingFileSystem extends LocalFileSystem {
|
|
|
166
167
|
diffBasisMaxBytes: config.diffBasisMaxBytes,
|
|
167
168
|
sandbox: config.sandbox ?? true,
|
|
168
169
|
maskWindowsDrive: config.maskWindowsDrive ?? false,
|
|
170
|
+
socketIsolation: config.socketIsolation ?? "off",
|
|
169
171
|
restrictToDistro: config.restrictToDistro ?? true,
|
|
170
172
|
watchMaxDepth: config.watchMaxDepth ?? 0,
|
|
171
173
|
// The root router is app-level, not session-owned: its backend must not
|
package/lib/messages.js
CHANGED
|
@@ -107,7 +107,7 @@ const en = {
|
|
|
107
107
|
`9p share, and the distro's Linux toolchain is unavailable. Do not assume Linux commands, paths, or tooling ` +
|
|
108
108
|
`here; the operator can run /wsl-doctor to diagnose the profile.`,
|
|
109
109
|
/** `wsl-status`: the route's method guard. */
|
|
110
|
-
statusMethodNotAllowed: () => "Only GET and
|
|
110
|
+
statusMethodNotAllowed: () => "Only GET, POST and DELETE are supported",
|
|
111
111
|
/** `wsl-status`: `wsl.exe -l -q` did not answer. */
|
|
112
112
|
statusDistroListFailed: ({ detail }) => `Cannot read the distro list: ${detail}`,
|
|
113
113
|
/** `wsl-status`: a repair POST named no distro. */
|
|
@@ -232,7 +232,7 @@ const zh = {
|
|
|
232
232
|
hostModePresetUnavailable: ({ cwd, distro }) => `工作区 "${cwd}" 位于 WSL 发行版 "${distro}" 内,但本 profile 未装配 WSL preset,` +
|
|
233
233
|
`因此本会话运行在宿主(Windows)环境:命令经 PowerShell 执行,文件访问经过 9p 共享,发行版的 Linux 工具链不可用。` +
|
|
234
234
|
`不要在此假设 Linux 命令、路径或工具;操作者可运行 /wsl-doctor 诊断该 profile。`,
|
|
235
|
-
statusMethodNotAllowed: () => "只支持 GET 与
|
|
235
|
+
statusMethodNotAllowed: () => "只支持 GET、POST 与 DELETE",
|
|
236
236
|
statusDistroListFailed: ({ detail }) => `无法读取发行版清单:${detail}`,
|
|
237
237
|
statusRepairNeedsDistro: () => "修复需要指定发行版",
|
|
238
238
|
statusUnknownDistro: ({ distro }) => `未知发行版:${distro}`,
|