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.
- package/CHANGELOG.md +142 -0
- package/CONTRIBUTING.md +32 -25
- package/CONTRIBUTING.zh.md +3 -2
- package/README.md +1 -1
- package/SECURITY.md +21 -7
- package/SECURITY.zh.md +18 -5
- package/SUPPORT.md +2 -2
- package/SUPPORT.zh.md +2 -2
- package/client.js +351 -48
- package/cordis.patch.yml +26 -10
- package/docs/AGENT-PROTOCOL-V7.md +4 -2
- package/docs/API.md +3 -1
- package/docs/API.zh.md +3 -1
- package/docs/ARCHITECTURE.md +22 -4
- package/docs/ARCHITECTURE.zh.md +18 -4
- package/docs/CONFIGURATION.md +117 -17
- package/docs/CONFIGURATION.zh.md +97 -11
- 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/PARITY.md +3 -1
- package/docs/QUICKSTART.md +31 -20
- package/docs/QUICKSTART.zh.md +16 -9
- package/docs/README.zh.md +1 -1
- package/docs/RELEASING.md +25 -3
- package/docs/REQUIREMENTS.zh.md +7 -6
- package/docs/ROADMAP-1.0.md +11 -7
- package/lib/agent-confined.d.ts +9 -1
- package/lib/agent-confined.js +3 -3
- package/lib/agent.d.ts +54 -18
- package/lib/agent.js +86 -19
- package/lib/bwrap.d.ts +16 -0
- package/lib/bwrap.js +9 -0
- package/lib/fs-routing.d.ts +6 -0
- package/lib/fs-routing.js +7 -0
- package/lib/fs-substrate.d.ts +1 -1
- package/lib/fs-substrate.js +10 -18
- package/lib/fsio-agent.d.ts +4 -0
- package/lib/fsio-agent.js +37 -10
- package/lib/listing.d.ts +2 -2
- package/lib/listing.js +5 -4
- package/lib/messages.d.ts +70 -0
- package/lib/messages.js +80 -0
- package/lib/open-in-app.js +12 -9
- package/lib/picker.d.ts +4 -1
- package/lib/picker.js +35 -11
- package/lib/plugin-update.d.ts +212 -0
- package/lib/plugin-update.js +283 -0
- package/lib/ports.js +8 -1
- package/lib/provider-common.d.ts +22 -0
- package/lib/provider-common.js +18 -0
- package/lib/provider-marker.d.ts +23 -0
- package/lib/provider-marker.js +21 -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 +61 -23
- package/lib/subprocess.d.ts +3 -0
- package/lib/subprocess.js +5 -0
- package/lib/takeover-report.js +4 -11
- package/lib/update-check.d.ts +49 -9
- package/lib/update-check.js +81 -28
- package/lib/watcher.d.ts +1 -1
- package/lib/watcher.js +1 -1
- package/lib/wsl-doctor-command.d.ts +6 -2
- package/lib/wsl-doctor-command.js +24 -15
- package/lib/wsl-doctor-tool.js +2 -0
- package/lib/wsl-filesystem.d.ts +53 -12
- package/lib/wsl-filesystem.js +90 -31
- package/lib/wsl-shell.d.ts +109 -40
- package/lib/wsl-shell.js +128 -54
- package/package.json +8 -3
- package/scripts/doctor.mjs +199 -3
- package/scripts/profile-preset.mjs +10 -2
|
@@ -166,10 +166,12 @@ the executor already runs on any handshake mismatch.
|
|
|
166
166
|
|
|
167
167
|
## The SETENV verb: implemented, host-refused
|
|
168
168
|
|
|
169
|
-
`SETENV
|
|
169
|
+
`SETENV|<key>|<value-b64>` is a protocol-6 verb both agent implementations
|
|
170
170
|
still answer (`agent/wsl-agent.sh`, the native binary) and the suite still
|
|
171
171
|
tests, but no host code sends it: per-request environment rides the EXEC
|
|
172
172
|
frame's env block, and a global mutation would outlive the request that
|
|
173
|
-
made it. The
|
|
173
|
+
made it. The frame has TWO fields after the verb — there is no request id
|
|
174
|
+
and no `ACK`/`RES`; the key must be a POSIX identifier or the agent answers
|
|
175
|
+
`ERR||protocol`. The verb is reserved — a host that wants idempotent
|
|
174
176
|
environment pre-warming can adopt it without a protocol bump. Until then
|
|
175
177
|
it is dormant surface, kept because removing it means a native rebuild.
|
package/docs/API.md
CHANGED
|
@@ -24,10 +24,12 @@ this page is the quick tour.
|
|
|
24
24
|
| `./file-reference-wsl` | `traversalArgv`, `parseTraversalListing`, `FileReferenceTraversal`, … | the distro-side traversal strategy for `@` completion (pure library — built and tested, not yet wired to a row; see ARCHITECTURE) |
|
|
25
25
|
| `./wsl-doctor-tool` | the `wsl-doctor-tool` row | the `wsl_doctor` model tool: in-process diagnosis with scoping (`depth`, `section`) |
|
|
26
26
|
| `./wsl-doctor-command` | the `wsl-doctor-command` row | the `/wsl-doctor` UI command: spawns the standalone doctor CLI, renders detached from model history |
|
|
27
|
-
| `./status` | the `wsl-status` row | the sidebar panel's route over `/api`: installed distros, one distro's quick doctor, and the `--fix-owned` full
|
|
27
|
+
| `./status` | the `wsl-status` row | the sidebar panel's route over `/api`: installed distros, one distro's quick doctor, and the `--fix-owned` full check (which also repairs plugin-owned state); the last result persists across reloads and running distros' stored results refresh in the background; `DELETE` clears one stored result (`?distro=<name>`) or every result without enumerating or probing a distro |
|
|
28
|
+
| `./plugin-update` | the `wsl-plugin-update` row | the panel's version and upgrade route over `/api`: installed/running plugin versions, the newest installable stable release and its compatibility, and the confirmed one-click `updateBundle` action |
|
|
28
29
|
| `./paths` | `uncToPosix`, `toLinuxPath`, `toWorldPath`, … | the coordinate mappers |
|
|
29
30
|
| `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
|
|
30
31
|
| `./auto-preset` | the `auto-preset` row | first-run profile bootstrap |
|
|
32
|
+
| `./open-in-app` | the `wsl-open-in-app` row | the authenticated route behind the session-header menu: launches VS Code at the workspace's `vscode-remote` URI with `ELECTRON_RUN_AS_NODE` scrubbed from the editor child only |
|
|
31
33
|
| `./shell-env` | the `wsl-shell-env` row | the `DSH_WSL_*` facts registry |
|
|
32
34
|
| `./update-check` | the `wsl-update-check` row | the once-a-day update notice (fact store + host-delegated check) |
|
|
33
35
|
|
package/docs/API.zh.md
CHANGED
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
| `./file-reference-wsl` | `traversalArgv`、`parseTraversalListing`、`FileReferenceTraversal`、… | 用于 `@` 补全的发行版侧遍历策略(纯库——已构建并测试,尚未接入行;见 ARCHITECTURE) |
|
|
24
24
|
| `./wsl-doctor-tool` | `wsl-doctor-tool` 行 | `wsl_doctor` 模型工具:带作用域(`depth`、`section`)的进程内诊断 |
|
|
25
25
|
| `./wsl-doctor-command` | `wsl-doctor-command` 行 | `/wsl-doctor` UI 命令:启动独立 doctor CLI,渲染结果不进入模型历史 |
|
|
26
|
-
| `./status` | `wsl-status` 行 | 侧栏面板经 `/api` 的路由:已安装发行版、单个发行版的快速 doctor,以及 `--fix-owned`
|
|
26
|
+
| `./status` | `wsl-status` 行 | 侧栏面板经 `/api` 的路由:已安装发行版、单个发行版的快速 doctor,以及 `--fix-owned` 完整检查(同时修复插件自有状态);最近结果跨重载保留,运行中发行版的已存结果在后台刷新;`DELETE` 清除单个(`?distro=<名称>`)或全部已存结果,不枚举、不探测发行版 |
|
|
27
|
+
| `./plugin-update` | `wsl-plugin-update` 行 | 面板经 `/api` 的版本与升级路由:已安装/运行中的插件版本、最新的可安装稳定版及其兼容性,以及点击确认后的一键 `updateBundle` |
|
|
27
28
|
| `./paths` | `uncToPosix`、`toLinuxPath`、`toWorldPath`、… | 坐标映射器 |
|
|
28
29
|
| `./picker` | `WslDirectoryPicker` | 能感知发行版的目录选择器 |
|
|
29
30
|
| `./auto-preset` | `auto-preset` 行 | 首次运行的 profile 引导 |
|
|
31
|
+
| `./open-in-app` | `wsl-open-in-app` 行 | 会话页头菜单背后的认证路由:以工作区的 `vscode-remote` URI 启动 VS Code,只从编辑器子进程环境中删除 `ELECTRON_RUN_AS_NODE` |
|
|
30
32
|
| `./shell-env` | `wsl-shell-env` 行 | `DSH_WSL_*` 事实注册表 |
|
|
31
33
|
| `./update-check` | `wsl-update-check` 行 | 每天一次的更新提示(事实存储 + 委托宿主的检查) |
|
|
32
34
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -76,11 +76,12 @@ functions.
|
|
|
76
76
|
| `dsh-plugin-wsl-env/shell-env` | `wsl-shell-env` | [`lib/shell-env.js`](../lib/shell-env.js) | Contributes `DSH_WSL_DISTRO`, `DSH_WSL_SHELL`, `DSH_WSL_HOME` and `DSH_WSL_PORTS` to the managed `DSH_*` namespace, choosing the session workspace's distro (default/pinned facts are probed at mount; other distros are warmed when their session appears). The port list is a snapshot per active distro, refreshed every `portsRefreshMs` (10000 by default), so a server started moments ago may not be listed yet. |
|
|
77
77
|
| `dsh-plugin-wsl-env/preflight` | `wsl-preflight` | [`lib/preflight.js`](../lib/preflight.js) | Runs the environment advisory at session start — and, with `startup: true` (the default), once at plugin load — surfacing the doctor-style verdict as a non-gating warning. |
|
|
78
78
|
| `dsh-plugin-wsl-env/update-check` | `wsl-update-check` | [`lib/update-check.js`](../lib/update-check.js) | Asks the app's plugin manager about a newer stable release about once a day and carries the fact in `DSH_WSL_PLUGIN_UPDATE`; never fetches on its own. |
|
|
79
|
+
| `dsh-plugin-wsl-env/plugin-update` | `wsl-plugin-update` | [`lib/plugin-update.js`](../lib/plugin-update.js) | The sidebar panel's version and upgrade route (`GET`/`POST /api/wsl-env/plugin-update`): reports the installed/running plugin versions and the newest installable stable release from the host plugin manager's `listVersions`, cached for `cacheMs`; `POST` calls `updateBundle` only after a click in the panel and reports the host's restart, rollback, or refusal outcome. |
|
|
79
80
|
| `dsh-plugin-wsl-env/cwd-prompt` | `wsl-cwd-prompt` | [`lib/cwd-prompt.js`](../lib/cwd-prompt.js) | Rewrites the runtime context's working-directory entry to the distro's POSIX form; adds the one-sentence `wsl:shell` note; replaces `sandbox:policy` with a POSIX-only rendering; and suppresses the host `harness:source` value in WSL sessions. The last three are temporary adapters tracked in [UPSTREAM-PROMPT-ADAPTERS.md](UPSTREAM-PROMPT-ADAPTERS.md). |
|
|
80
81
|
| `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | Serves the model's read/`cd` tool with the same semantics the harness ships, rewriting the returned `cwd` to the distro's POSIX form. |
|
|
81
82
|
| `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | The `wsl_doctor` model tool: the doctor in-process (merging the live resident's state), scoped by `depth`/`section`, rendered as the itemized digest. |
|
|
82
83
|
| `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | The `/wsl-doctor` UI command: spawns the standalone doctor CLI as a host subprocess and renders the same digest detached from model history. |
|
|
83
|
-
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | The sidebar panel's route (`GET /api/wsl-env/status`): lists the installed distros and runs one distro's quick doctor; `POST` on the same route runs the full doctor with `--fix-owned` (
|
|
84
|
+
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | The sidebar panel's route (`GET /api/wsl-env/status`): lists the installed distros and runs one distro's quick doctor; `POST` on the same route runs the full doctor with `--fix-owned` (which also repairs stale scopes or a broken agent cache and re-verifies both). `DELETE` on the same route clears one stored result (`?distro=<name>`) or every stored result, without listing or probing a distro. Answered over the Host connection's authenticated exact-Fetch channel; the last result per distro is persisted under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` and stored results for running distros are refreshed in the background. |
|
|
84
85
|
| `dsh-plugin-wsl-env` (bare name) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | The deliberate no-op host half whose bare-name mount lets the web client roster serve `./client`: the sidebar's WSL environment panel and the post-add access-mode prompt. |
|
|
85
86
|
|
|
86
87
|
Three path and interop helpers import no DSH package.
|
|
@@ -108,7 +109,7 @@ The environment is per session, not per process:
|
|
|
108
109
|
| `subprocess-wsl` | at the app level, called the composition; the shipped `subprocess` row is disabled | because no session identity reaches the terminal controller, see below |
|
|
109
110
|
| `workspace-files` | shipped, not replaced | its client half is the browser `file` resource provider the Sidebar previews need; it reads WSL paths through the routed root filesystem |
|
|
110
111
|
| `fs-routing` | at the app level; the shipped `fs-sandbox` row is disabled | the root `ctx.fs` is session-less, and its write fence has no root-plane consumers |
|
|
111
|
-
| `directory-picker-wsl`, `wsl-shell-env`, `auto-preset`, `wsl-preflight`, `wsl-update-check`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`, `wsl-doctor-command`, `wsl-status`, `wsl-env-client-host` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace, and the advisory/diagnosis rows must answer even when a session never opens |
|
|
112
|
+
| `directory-picker-wsl`, `wsl-shell-env`, `auto-preset`, `wsl-preflight`, `wsl-update-check`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`, `wsl-doctor-command`, `wsl-status`, `wsl-plugin-update`, `wsl-env-client-host` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace, and the advisory/diagnosis rows must answer even when a session never opens |
|
|
112
113
|
| `wsl-doctor-tool` | inside `preset-wsl` (model-facing) | the tool surface follows the preset: a session on a Windows folder keeps the shipped tools |
|
|
113
114
|
|
|
114
115
|
The preset mount requires the isolate realms. Without them the registry rejects the
|
|
@@ -289,6 +290,20 @@ through `checkedTarget`, so the fence covers every mutation the provider can
|
|
|
289
290
|
serve. Both providers report their mode through `sandboxMode`. The tool layer
|
|
290
291
|
and the Permissions selector read that value.
|
|
291
292
|
|
|
293
|
+
**Socket isolation.** `bwrapProfileArgs` also accepts `socketMasks`: existing
|
|
294
|
+
socket paths bound `/dev/null` after the read-only root, plus `maskInterop`,
|
|
295
|
+
which mounts an empty tmpfs over `/run/WSL` — the WSL interop transport. The
|
|
296
|
+
confined providers (`wsl-shell`, `wsl-fs`, `fs-routing`) resolve them from
|
|
297
|
+
their `socketIsolation` stance — `session-bus` masks
|
|
298
|
+
the user systemd manager's bus and private socket, `strict` adds the system bus
|
|
299
|
+
and the container sockets the distro user can reach; `strict` also sets the
|
|
300
|
+
interop mask, so a copied PE fails at the host bridge. The masks close the
|
|
301
|
+
process-authority path the mount profile leaves open; they do not change the
|
|
302
|
+
file hierarchy, and same-user `/proc` and other IPC remain (the interop
|
|
303
|
+
closure for the rest of the distro is still `[interop] enabled=false`). The
|
|
304
|
+
in-distro probe that finds the paths lives in `lib/socket-isolation.js`; a
|
|
305
|
+
probe failure refuses the command instead of running unmasked.
|
|
306
|
+
|
|
292
307
|
### Reported enforcement
|
|
293
308
|
|
|
294
309
|
`WslSandbox` reports `enforcement: partial`, not `full`. A process inside the
|
|
@@ -419,7 +434,7 @@ leaves behind — neither feeds the runtime nor counts in the check.
|
|
|
419
434
|
| Doc consistency | [`scripts/check-doc-consistency.mjs`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/scripts/check-doc-consistency.mjs) | no; repeated facts, doctor surface and bilingual pair completeness |
|
|
420
435
|
| Sandbox probe | [`test/probe/sandbox.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sandbox.sh) | no; it applies the profile arguments directly |
|
|
421
436
|
| Harness probes | [`test/probe/run.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/run.sh), `terminal.sh`, `sandbox-shell.sh`, `interop-shell.sh`, `picker.sh`, `fs-routing.sh`, `missing-wsl.sh`, `sandbox-off.sh`, `native-session.sh` | yes: Windows, WSL2, a mounted profile, and a linked checkout |
|
|
422
|
-
| Distro probes | [`test/probe/substrate.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/substrate.sh), `watch.sh`, `agent.sh`, `exec.sh`, `session-sandbox.sh`, `gui-preview.sh`, `file-reference-9p.sh` | Windows and WSL2, but no harness boot and no profile: they run from a distro terminal with Node available, reaching `wsl.exe` through interop |
|
|
437
|
+
| Distro probes | [`test/probe/substrate.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/substrate.sh), `watch.sh`, `agent.sh`, `exec.sh`, `session-sandbox.sh`, `cache-write.sh`, `gui-preview.sh`, `file-reference-9p.sh` | Windows and WSL2, but no harness boot and no profile: they run from a distro terminal with Node available, reaching `wsl.exe` through interop |
|
|
423
438
|
| Host probe | [`test/probe/mode.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/mode.sh) | Windows Node, no harness |
|
|
424
439
|
| Probe plugins | the `*-probe.mjs` and `*-probe.yml` files in `test/probe/` (plus standalone measurers such as `gui-preview.mjs`, `native-session.mjs`, `fs-probe.mjs`, `fs-queue.mjs`) | loaded or invoked by the scripts above |
|
|
425
440
|
|
|
@@ -516,6 +531,7 @@ src/messages.ts the en/zh message catalogs and the host-locale wiri
|
|
|
516
531
|
src/native-agent.ts native binary selection and preparation
|
|
517
532
|
src/paths.ts pure conversion between the three path formats
|
|
518
533
|
src/picker.ts WslDirectoryPicker (ctx.directoryPicker)
|
|
534
|
+
src/plugin-update.ts the panel's version and one-click upgrade route
|
|
519
535
|
src/ports.ts the listening-port snapshot behind DSH_WSL_PORTS
|
|
520
536
|
src/preflight.ts session-start environment advisories
|
|
521
537
|
src/preset-choice.ts whether a new session adopts the WSL preset (pure)
|
|
@@ -529,6 +545,8 @@ src/session-runtime.ts shared session runtime and agent lifecycle
|
|
|
529
545
|
src/session-scope.ts systemd scope creation and cleanup
|
|
530
546
|
src/shell.ts the ctx.shell subpath entry point
|
|
531
547
|
src/shell-env.ts registers the DSH_WSL_* environment variables
|
|
548
|
+
src/socket-isolation.ts the socket facts probe and the /dev/null masks a
|
|
549
|
+
confined command's stance binds
|
|
532
550
|
src/subprocess.ts WslSubprocessRuntime (ctx.subprocess), the GUI
|
|
533
551
|
terminal window
|
|
534
552
|
src/terminal-activity.ts the distro-side activity probe for idle terminal
|
|
@@ -579,7 +597,7 @@ standalone CLI (peer-free by design, so it starts when the plugin's own
|
|
|
579
597
|
runtime is broken), the `/wsl-doctor` UI command (spawns the CLI host-side,
|
|
580
598
|
renders detached from model history), and the `wsl_doctor` model tool
|
|
581
599
|
(in-process, merging the live resident's state through `lib/doctor-live.js`).
|
|
582
|
-
The sidebar panel renders the quick digest and posts the
|
|
600
|
+
The sidebar panel renders the quick digest and posts the full-check action the
|
|
583
601
|
same way (`--fix-owned`: plugin-owned state only). A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
|
|
584
602
|
`section` on the tool), and the report itemizes every check grouped by
|
|
585
603
|
distro. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the surfaces and the
|
package/docs/ARCHITECTURE.zh.md
CHANGED
|
@@ -67,11 +67,12 @@ GUI 文件树与预览保留随包的 `workspace-files` 行。它的客户端半
|
|
|
67
67
|
| `dsh-plugin-wsl-env/shell-env` | `wsl-shell-env` | [`lib/shell-env.js`](../lib/shell-env.js) | 向受管的 `DSH_*` 命名空间贡献 `DSH_WSL_DISTRO`、`DSH_WSL_SHELL`、`DSH_WSL_HOME` 和 `DSH_WSL_PORTS`,并选取会话工作区所属的发行版(默认/钉死的事实于挂载时探测;其他发行版在其会话出现时预热)。端口列表是每个活跃发行版的快照,每 `portsRefreshMs`(默认 10000)刷新一次,因此刚启动的服务器可能尚未列出。 |
|
|
68
68
|
| `dsh-plugin-wsl-env/preflight` | `wsl-preflight` | [`lib/preflight.js`](../lib/preflight.js) | 在会话开始时运行环境提示——若 `startup: true`(默认值),还在插件加载时运行一次——把 doctor 风格的判定作为不阻断的警告呈现。 |
|
|
69
69
|
| `dsh-plugin-wsl-env/update-check` | `wsl-update-check` | [`lib/update-check.js`](../lib/update-check.js) | 大约每天一次向应用的插件管理器询问是否有更新的稳定版本,并把该事实带在 `DSH_WSL_PLUGIN_UPDATE` 中;自身从不抓取。 |
|
|
70
|
+
| `dsh-plugin-wsl-env/plugin-update` | `wsl-plugin-update` | [`lib/plugin-update.js`](../lib/plugin-update.js) | 侧边栏面板的版本与升级路由(`GET`/`POST /api/wsl-env/plugin-update`):经宿主插件管理器的 `listVersions` 报告已安装/运行中的插件版本与最新的可安装稳定版,按 `cacheMs` 缓存;只有点击后 `POST` 才调用 `updateBundle`,并报告宿主的重启、回滚或拒绝结果。 |
|
|
70
71
|
| `dsh-plugin-wsl-env/cwd-prompt` | `wsl-cwd-prompt` | [`lib/cwd-prompt.js`](../lib/cwd-prompt.js) | 把运行时上下文的工作目录条目改写为发行版的 POSIX 形式;新增一句 `wsl:shell` 说明;把 `sandbox:policy` 替换为仅 POSIX 的渲染;并在 WSL 会话中抑制宿主的 `harness:source` 值。后三项是临时适配器,跟踪于 [UPSTREAM-PROMPT-ADAPTERS.md](UPSTREAM-PROMPT-ADAPTERS.md)。 |
|
|
71
72
|
| `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | 以 harness 随包提供的相同语义提供模型的 read/`cd` 工具,把返回的 `cwd` 改写为发行版的 POSIX 形式。 |
|
|
72
73
|
| `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | `wsl_doctor` 模型工具:进程内的 doctor(合并活跃常驻 agent 的状态),按 `depth`/`section` 限定范围,渲染为逐项摘要。 |
|
|
73
74
|
| `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | `/wsl-doctor` UI 命令:把独立的 doctor CLI 作为宿主子进程启动,并在与模型历史分离的界面中渲染同一份摘要。 |
|
|
74
|
-
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | 侧边栏面板的路由(`GET /api/wsl-env/status`):列出已安装的发行版,并对其中一个发行版运行 quick doctor;同一路由上的 `POST`
|
|
75
|
+
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | 侧边栏面板的路由(`GET /api/wsl-env/status`):列出已安装的发行版,并对其中一个发行版运行 quick doctor;同一路由上的 `POST` 运行 `--fix-owned` 完整检查(同时修复陈旧的 scope 或损坏的 agent 缓存并重新验证);同一路由上的 `DELETE` 清除单个(`?distro=<名称>`)或全部已存结果,不枚举、不探测发行版。响应经 Host 连接已认证的 exact-Fetch 通道返回;每个发行版的最近结果持久化在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,运行中发行版的已存结果会在后台刷新。 |
|
|
75
76
|
| `dsh-plugin-wsl-env`(裸名) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | 有意为之的空操作宿主半边;它的裸名挂载让 web 客户端名册能够提供 `./client`:侧边栏的 WSL 环境面板,以及添加后的访问模式提示。 |
|
|
76
77
|
|
|
77
78
|
三个路径与 interop 助手不导入任何 DSH 包。
|
|
@@ -97,7 +98,7 @@ YAML 数组;桌面应用通过侧边栏 **Plugins** 页面(**Add plugin**)
|
|
|
97
98
|
| `subprocess-wsl` | 在应用层(即组合层);随包的 `subprocess` 行被禁用 | 因为没有会话标识能到达终端控制器,见下文 |
|
|
98
99
|
| `workspace-files` | 随包、未替换 | 其客户端半边是侧边栏预览所需的浏览器 `file` 资源提供者;它通过被路由的根文件系统读取 WSL 路径 |
|
|
99
100
|
| `fs-routing` | 在应用层;随包的 `fs-sandbox` 行被禁用 | 根 `ctx.fs` 无会话,且其写围栏在根平面没有消费者 |
|
|
100
|
-
| `directory-picker-wsl`、`wsl-shell-env`、`auto-preset`、`wsl-preflight`、`wsl-update-check`、`wsl-cwd-prompt`、`wsl-cwd-prompt-tool`、`wsl-doctor-command`、`wsl-status`、`wsl-env-client-host` | 在应用层 | 它们回答的问题不限定于单个 preset;`shell-env` 按会话工作区解析其事实,而提示/诊断类行必须在会话从未打开时也能应答 |
|
|
101
|
+
| `directory-picker-wsl`、`wsl-shell-env`、`auto-preset`、`wsl-preflight`、`wsl-update-check`、`wsl-cwd-prompt`、`wsl-cwd-prompt-tool`、`wsl-doctor-command`、`wsl-status`、`wsl-plugin-update`、`wsl-env-client-host` | 在应用层 | 它们回答的问题不限定于单个 preset;`shell-env` 按会话工作区解析其事实,而提示/诊断类行必须在会话从未打开时也能应答 |
|
|
101
102
|
| `wsl-doctor-tool` | 位于 `preset-wsl` 内(面向模型) | 工具面跟随 preset:在 Windows 文件夹上的会话保留随包工具 |
|
|
102
103
|
|
|
103
104
|
preset 挂载需要隔离域。缺少时,registry 以
|
|
@@ -251,6 +252,16 @@ UNC/Linux 写法),丢弃已在工作区、`/tmp` 或 `/dev/shm` 下可写的
|
|
|
251
252
|
`checkedTarget`,因此围栏覆盖该提供者能服务的每个变更。两个提供者都通过
|
|
252
253
|
`sandboxMode` 上报模式。工具层和 Permissions 选择器读取该值。
|
|
253
254
|
|
|
255
|
+
**Socket 隔离。** `bwrapProfileArgs` 还接受 `socketMasks`:在只读根之后把已存在
|
|
256
|
+
的 socket 路径绑定到 `/dev/null`,以及 `maskInterop`:在 `/run/WSL`(WSL
|
|
257
|
+
interop 传输)上挂空的 tmpfs。受限提供者(`wsl-shell`、`wsl-fs`、
|
|
258
|
+
`fs-routing`)按各自的 `socketIsolation` 档位解析它们——`session-bus` 遮蔽用户
|
|
259
|
+
systemd 管理器的 bus 与 private socket,
|
|
260
|
+
`strict` 追加系统总线与发行版用户可触达的容器 socket。遮蔽关闭的是挂载 profile
|
|
261
|
+
留下的进程权限路径;不改变文件层级,同用户 `/proc`、interop 与其他 IPC 仍在。
|
|
262
|
+
在发行版内寻找这些路径的探针位于 `lib/socket-isolation.js`;探针失败时命令
|
|
263
|
+
被拒绝,而不是无遮蔽运行。
|
|
264
|
+
|
|
254
265
|
### 上报的强制程度
|
|
255
266
|
|
|
256
267
|
`WslSandbox` 上报 `enforcement: partial`,而不是 `full`。发行版内的进程仍可
|
|
@@ -368,7 +379,7 @@ peer 投影到安装处的同一份副本,因此镜像与运行中的应用共
|
|
|
368
379
|
| 文档一致性 | [`scripts/check-doc-consistency.mjs`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/scripts/check-doc-consistency.mjs) | 否;覆盖重复事实、doctor 面与双语对完整性 |
|
|
369
380
|
| 沙箱探针 | [`test/probe/sandbox.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sandbox.sh) | 否;它直接应用 profile 参数 |
|
|
370
381
|
| Harness 探针 | [`test/probe/run.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/run.sh)、`terminal.sh`、`sandbox-shell.sh`、`interop-shell.sh`、`picker.sh`、`fs-routing.sh`、`missing-wsl.sh`、`sandbox-off.sh`、`native-session.sh` | 是:Windows、WSL2、已挂载的 profile 和链接的检出目录 |
|
|
371
|
-
| 发行版探针 | [`test/probe/substrate.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/substrate.sh)、`watch.sh`、`agent.sh`、`exec.sh`、`session-sandbox.sh`、`gui-preview.sh`、`file-reference-9p.sh` | 需要 Windows 和 WSL2,但不需要启动 harness,也不需要 profile:它们在装有 Node 的发行版终端中运行,经 interop 触达 `wsl.exe` |
|
|
382
|
+
| 发行版探针 | [`test/probe/substrate.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/substrate.sh)、`watch.sh`、`agent.sh`、`exec.sh`、`session-sandbox.sh`、`cache-write.sh`、`gui-preview.sh`、`file-reference-9p.sh` | 需要 Windows 和 WSL2,但不需要启动 harness,也不需要 profile:它们在装有 Node 的发行版终端中运行,经 interop 触达 `wsl.exe` |
|
|
372
383
|
| 宿主探针 | [`test/probe/mode.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/mode.sh) | Windows Node,无 harness |
|
|
373
384
|
| 探针插件 | `test/probe/` 中的 `*-probe.mjs` 与 `*-probe.yml` 文件(以及诸如 `gui-preview.mjs`、`native-session.mjs`、`fs-probe.mjs`、`fs-queue.mjs` 之类的独立测量器) | 由上述脚本加载或调用 |
|
|
374
385
|
|
|
@@ -464,6 +475,7 @@ src/messages.ts the en/zh message catalogs and the host-locale wiri
|
|
|
464
475
|
src/native-agent.ts native binary selection and preparation
|
|
465
476
|
src/paths.ts pure conversion between the three path formats
|
|
466
477
|
src/picker.ts WslDirectoryPicker (ctx.directoryPicker)
|
|
478
|
+
src/plugin-update.ts the panel's version and one-click upgrade route
|
|
467
479
|
src/ports.ts the listening-port snapshot behind DSH_WSL_PORTS
|
|
468
480
|
src/preflight.ts session-start environment advisories
|
|
469
481
|
src/preset-choice.ts whether a new session adopts the WSL preset (pure)
|
|
@@ -477,6 +489,8 @@ src/session-runtime.ts shared session runtime and agent lifecycle
|
|
|
477
489
|
src/session-scope.ts systemd scope creation and cleanup
|
|
478
490
|
src/shell.ts the ctx.shell subpath entry point
|
|
479
491
|
src/shell-env.ts registers the DSH_WSL_* environment variables
|
|
492
|
+
src/socket-isolation.ts the socket facts probe and the /dev/null masks a
|
|
493
|
+
confined command's stance binds
|
|
480
494
|
src/subprocess.ts WslSubprocessRuntime (ctx.subprocess), the GUI
|
|
481
495
|
terminal window
|
|
482
496
|
src/terminal-activity.ts the distro-side activity probe for idle terminal
|
|
@@ -521,7 +535,7 @@ peer 下限、新 agent 握手和陈旧的会话 scope,并报告带版本的 `
|
|
|
521
535
|
同一份报告通过三个界面应答:这个独立 CLI(设计上无 peer 依赖,因此插件自身
|
|
522
536
|
运行时损坏时它仍能启动)、`/wsl-doctor` UI 命令(在宿主侧启动 CLI,渲染与
|
|
523
537
|
模型历史分离),以及 `wsl_doctor` 模型工具(进程内,通过 `lib/doctor-live.js`
|
|
524
|
-
合并活跃常驻 agent
|
|
538
|
+
合并活跃常驻 agent 的状态)。侧边栏面板以同样方式渲染快速摘要并提交完整检查动作
|
|
525
539
|
(`--fix-owned`:仅插件自有状态)。运行可以限定范围(CLI 上的 `--quick`、
|
|
526
540
|
`--sections <csv>`;工具上的 `depth` / `section`),报告按发行版分组逐项列出
|
|
527
541
|
每项检查。各界面与判定契约见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -12,10 +12,11 @@ rows and values shipped by this plugin.
|
|
|
12
12
|
A profile layer can target a top-level row by `id`. Plugin rows at that level
|
|
13
13
|
include `fs-routing`, `directory-picker-wsl`, `subprocess-wsl`, `wsl-shell-env`,
|
|
14
14
|
`wsl-preflight`, `auto-preset`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`,
|
|
15
|
-
`wsl-update-check`, `wsl-doctor-command`, `wsl-status`, `wsl-
|
|
16
|
-
`preset-wsl`. The `wsl-shell`, `wsl-fs` and
|
|
17
|
-
inside `preset-wsl.config.plugins`; a profile
|
|
18
|
-
is ignored with a `patch: entry <id> not
|
|
15
|
+
`wsl-update-check`, `wsl-doctor-command`, `wsl-status`, `wsl-plugin-update`,
|
|
16
|
+
`wsl-env-client-host`, and `preset-wsl`. The `wsl-shell`, `wsl-fs` and
|
|
17
|
+
`wsl-doctor-tool` rows are nested inside `preset-wsl.config.plugins`; a profile
|
|
18
|
+
entry targeting those ids directly is ignored with a `patch: entry <id> not
|
|
19
|
+
found` warning.
|
|
19
20
|
|
|
20
21
|
A root-level `- id: wsl-shell` / `wsl-fs` entry patches a top-level row that
|
|
21
22
|
does not exist in the shipped composition, so it is ignored with a warning.
|
|
@@ -40,7 +41,8 @@ pnpm run preset --distro Ubuntu --session-sandbox false
|
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
Supported edits are `--distro`, `--session-sandbox`, `--sandbox`,
|
|
43
|
-
`--mask-windows-drive`,
|
|
44
|
+
`--mask-windows-drive`, `--socket-isolation`, `--strict`, `--agent-backend` and
|
|
45
|
+
`--writable-roots`. Without `--out`, the helper
|
|
44
46
|
prints the full `preset-wsl` block to merge into the profile manually. Use
|
|
45
47
|
`pnpm run preset --check <file>` to detect profile layers that target nested
|
|
46
48
|
rows directly; on detecting them it prints the block to use. `--out` replaces
|
|
@@ -66,6 +68,7 @@ values. Re-copy it after a plugin upgrade that changes the preset.
|
|
|
66
68
|
| `sandbox` | `true` | Confine commands with `bwrap`. A missing or unusable `bwrap` fails closed. `false` runs commands without confinement. |
|
|
67
69
|
| `interopVisibility` | Unset; effective default is `visible` | `visible`, `masked`, or `disabled`. When set, this takes precedence over `maskWindowsDrive`. See [Windows interop](#windows-interop). |
|
|
68
70
|
| `maskWindowsDrive` | `false` | For confined commands, mount an empty tmpfs over `/mnt`. See [Windows interop](#windows-interop). |
|
|
71
|
+
| `socketIsolation` | `off` | Which socket surfaces a confined process cannot reach: `off`, `session-bus`, or `strict`. See [Socket isolation](#socket-isolation). |
|
|
69
72
|
| `writableRoots` | `[]` | Extra distro directories granted read-write under `workspace-write` (`~` allowed), for toolchain caches or a linked worktree's shared Git directory. Each entry must be an existing physical directory; entries already inside the workspace, `/tmp` or `/dev/shm`, or nested inside another grant, are ignored. Put the same list on `wsl-fs`. See [Toolchain caches](#toolchain-caches-and-extra-writable-roots). |
|
|
70
73
|
| `cwd` | `''` | Default workdir. Empty uses the distro user's home. |
|
|
71
74
|
| `timeoutMs` / `maxTimeoutMs` | `120000` / `600000` (shipped) | Default per-call timeout and the maximum timeout a call may request. |
|
|
@@ -82,6 +85,7 @@ values. Re-copy it after a plugin upgrade that changes the preset.
|
|
|
82
85
|
| `sandbox` | `true` | Check writes against the sandbox policy. Confined writes fail closed if `bwrap` is unavailable. |
|
|
83
86
|
| `sessionSandbox` | `false`; shipped `true` | Use the same session runtime as `wsl-shell`. `auto` falls back to a per-policy confined resident when the session runtime is unavailable. |
|
|
84
87
|
| `maskWindowsDrive` | `false` | Hide `/mnt` from confined mutations. Reads are unaffected. |
|
|
88
|
+
| `socketIsolation` | `off` | Same stance as on `wsl-shell`; the confined write resident and its session runtime use it. Keep the command, write and routing rows equal. See [Socket isolation](#socket-isolation). |
|
|
85
89
|
| `writableRoots` | `[]` | Same key and rules as on `wsl-shell`. Confined writes and commands must see one mount table, so configure the same list on both rows. See [Toolchain caches](#toolchain-caches-and-extra-writable-roots). |
|
|
86
90
|
| `substrate` | `agent` (shipped) | File operations use the in-distro agent. The legacy `share` value is refused at startup. |
|
|
87
91
|
| `cwd` | `''` | Base directory for relative paths. Empty uses the distro user's home. |
|
|
@@ -130,6 +134,13 @@ Rules:
|
|
|
130
134
|
UNC or Linux spelling), but it applies to the whole profile. When the same
|
|
131
135
|
profile also serves Windows sessions, prefer the plugin key above.
|
|
132
136
|
|
|
137
|
+
The doctor's `sandbox.grants` row lists both rows' configured roots, the
|
|
138
|
+
`~`-expanded absolute paths, and the physical check result, and warns when the
|
|
139
|
+
two lists differ; it creates no directory and edits no configuration.
|
|
140
|
+
`pnpm run probe:cache-write` proves the same path on a real machine — the
|
|
141
|
+
granted root is writable, an ungranted sibling stays `EROFS` — for both the
|
|
142
|
+
per-command profile and the session runtime.
|
|
143
|
+
|
|
133
144
|
### `fs-routing`
|
|
134
145
|
|
|
135
146
|
This top-level row serves root-level `ctx.fs` calls. It routes distro UNC paths
|
|
@@ -145,6 +156,7 @@ field value uses its schema default.
|
|
|
145
156
|
| `wslPath` | `wsl.exe` (shipped) | Path to `wsl.exe`, used to resolve the default distro. |
|
|
146
157
|
| `sandbox` | `true` (shipped) | Check routed mutations against `ctx.sandboxPolicy`; fail closed if `bwrap` is unavailable. The row reports `sandboxMode: undefined` whether the fence is enabled or disabled. |
|
|
147
158
|
| `maskWindowsDrive` | `false` (shipped) | Hide `/mnt` from confined routed mutations. |
|
|
159
|
+
| `socketIsolation` | `off` (shipped) | Same stance for the routed root's per-policy confined resident. See [Socket isolation](#socket-isolation). |
|
|
148
160
|
| `restrictToDistro` | `true` (shipped) | Refuse paths in another distro's share when `distro` is pinned. |
|
|
149
161
|
| `watchMaxDepth` | `0` (shipped) | Watch the full tree. A positive depth uses bounded polling. |
|
|
150
162
|
| `distroCwd` | `''` | Default distro workdir; empty uses the distro user's home. |
|
|
@@ -173,6 +185,12 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
173
185
|
| | `hostCwd` | Unset | Windows workdir for the `wsl.exe` process. Defaults to `%SystemRoot%` when available. |
|
|
174
186
|
| | `forwardEnv` | `[]` | Additional host environment names to forward through `WSLENV`. |
|
|
175
187
|
|
|
188
|
+
The bundle also inserts the host row `directory-picker-browse-surface`
|
|
189
|
+
(`@deepseek-ai/dsh-client-ui-directory-picker-browse`). It supplies the
|
|
190
|
+
browser dialog itself; `directory-picker-wsl` supplies the backend that dialog
|
|
191
|
+
calls, so disabling the picker row does not remove the dialog. The host row
|
|
192
|
+
takes no configuration.
|
|
193
|
+
|
|
176
194
|
### Other top-level rows
|
|
177
195
|
|
|
178
196
|
| Row | Key | Default | Description |
|
|
@@ -184,6 +202,8 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
184
202
|
| `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
|
|
185
203
|
| | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
|
|
186
204
|
| | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
|
|
205
|
+
| `wsl-open-in-app` | `executable` | `''` | Editor executable for the session-header "open in app" action. Empty resolves VS Code from its usual Windows install locations, then `Code.exe` on `PATH`. |
|
|
206
|
+
| | `watchMs` | `1500` | Early-failure watch window per launch, in milliseconds; an editor that exits inside it is reported as a launch failure. |
|
|
187
207
|
| `wsl-preflight` | `distro` | `''` | Distro to check. Empty or `auto` follows the session workspace. |
|
|
188
208
|
| | `wslPath` | `wsl.exe` | Path to `wsl.exe`. |
|
|
189
209
|
| | `sandbox` | `true` | Run the session-start `bwrap` check. |
|
|
@@ -192,8 +212,9 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
192
212
|
| `wsl-shell-env` | `distro` | `''` | Distro used to populate the `DSH_WSL_*` environment facts. |
|
|
193
213
|
| | `portsRefreshMs` | `10000` | Listening-port snapshot interval, in milliseconds. |
|
|
194
214
|
| `wsl-cwd-prompt` | `enabled` | `true` (shipped) | Rewrite the runtime context's working-directory entry to the distro's POSIX form. |
|
|
195
|
-
| `wsl-update-check` | `enabled` | `true` | Whether the plugin checks the app's plugin manager for a newer stable release. The result is served as `DSH_WSL_PLUGIN_UPDATE`; the check never installs. |
|
|
215
|
+
| `wsl-update-check` | `enabled` | `true` | Whether the plugin checks the app's plugin manager for a newer stable release. The result is served as `DSH_WSL_PLUGIN_UPDATE`; the background check never installs (the panel's one-click upgrade is a separate explicit POST). |
|
|
196
216
|
| | `intervalMs` | `86400000` | Check interval, in milliseconds (first check 2–10 minutes after startup); floored at one minute. |
|
|
217
|
+
| `wsl-plugin-update` | `cacheMs` | `600000` | How long the panel's version answer stays fresh, in milliseconds. The card shows the installed/running plugin versions and the newest installable stable release; **一键升级** calls the host plugin manager's `updateBundle` only on a click. |
|
|
197
218
|
|
|
198
219
|
The GUI file tree and previews use the bundled `workspace-files` row through
|
|
199
220
|
`fs-routing`; they do not use a separate WSL provider row. To change its
|
|
@@ -271,6 +292,12 @@ gives the `visible` behavior.
|
|
|
271
292
|
| `masked` | Mounts an empty tmpfs over `/mnt` in confined profiles. Commands cannot access paths under `/mnt`; other mounts and unrestricted file reads are not covered. |
|
|
272
293
|
| `disabled` | Applies the same `/mnt` mask as `masked`; it does not disable interop or edit `wsl.conf`. Configure the distro separately as described below. |
|
|
273
294
|
|
|
295
|
+
**The mask is a command-path boundary, not a filesystem boundary.** Confined
|
|
296
|
+
commands cannot see `/mnt`; the file tools' unrestricted read side still
|
|
297
|
+
reaches `/mnt/c` through the shared read agent (the "Unrestricted read" row
|
|
298
|
+
below is the same fact, stated per surface). Do not read `masked` as "the
|
|
299
|
+
distro cannot reach Windows".
|
|
300
|
+
|
|
274
301
|
`maskWindowsDrive: true` is equivalent to `interopVisibility: masked`.
|
|
275
302
|
When `interopVisibility` is set, it takes precedence over
|
|
276
303
|
`maskWindowsDrive`.
|
|
@@ -321,6 +348,68 @@ is covered by `test/probe/interop-shell.sh` for both resident and one-shot
|
|
|
321
348
|
commands. The distro-level disabled state requires a manual check because it
|
|
322
349
|
changes WSL configuration.
|
|
323
350
|
|
|
351
|
+
## Socket isolation
|
|
352
|
+
|
|
353
|
+
`socketIsolation` on the confined rows — `wsl-shell` (commands), `wsl-fs`
|
|
354
|
+
(confined writes) and `fs-routing` (the routed root) — decides which socket
|
|
355
|
+
surfaces a confined process cannot reach. The mount profile confines file
|
|
356
|
+
effects, not process authority: without this key a command can still ask the
|
|
357
|
+
user's systemd manager to start a unit outside the fence (the escape in
|
|
358
|
+
[SECURITY.md](../SECURITY.md)), or use a container daemon socket.
|
|
359
|
+
|
|
360
|
+
| Value | Effect |
|
|
361
|
+
|---|---|
|
|
362
|
+
| `off` (default) | Nothing masked. The documented `enforcement: partial` includes this path. |
|
|
363
|
+
| `session-bus` | Masks `$XDG_RUNTIME_DIR/bus` and `$XDG_RUNTIME_DIR/systemd/private`; `systemd-run --user` and `systemctl --user` fail inside the command. |
|
|
364
|
+
| `strict` | Adds `/run/dbus/system_bus_socket`, the container sockets (`docker`, `podman`, `containerd`, `crio`) that exist and are reachable by the distro user, and shadows `/run/WSL` — the WSL interop transport — so a Windows executable fails to start inside the profile. |
|
|
365
|
+
|
|
366
|
+
The paths are resolved inside the distro and bound `/dev/null`; a path that
|
|
367
|
+
does not exist is not masked. The key applies to every confined profile:
|
|
368
|
+
`wsl-shell` commands, the `wsl-fs` write resident, and the routed root's
|
|
369
|
+
per-policy resident. The filesystem rows run this plugin's fsio protocol,
|
|
370
|
+
never model-authored commands, but the masks keep one mount table across the
|
|
371
|
+
command and write planes and defend the resident if that protocol is ever
|
|
372
|
+
compromised. Keep the three rows equal.
|
|
373
|
+
|
|
374
|
+
The masks are a narrowing, not a closure: same-user `/proc` and other IPC
|
|
375
|
+
remain, so `enforcement` stays `partial`. `strict` additionally hides the WSL
|
|
376
|
+
interop transport; a PE copied into the workspace still exists but its
|
|
377
|
+
`/init` cannot reach the host bridge, so it fails at `connect`. That is not
|
|
378
|
+
the distro-wide closure: other distro processes and the Windows side still
|
|
379
|
+
interop, and `[interop] enabled=false` in `/etc/wsl.conf` plus `wsl.exe
|
|
380
|
+
--shutdown` remains the complete switch. `strict` breaks `systemctl --user`,
|
|
381
|
+
D-Bus, container clients and Windows-program launches inside confined
|
|
382
|
+
processes; `off` keeps the previous behavior.
|
|
383
|
+
|
|
384
|
+
`pnpm run probe:sandbox` measures the stances: the default profile reaches the
|
|
385
|
+
user manager, `session-bus` refuses `systemd-run --user` and masks the user
|
|
386
|
+
bus and private socket, and `strict` also masks the system bus, the reachable
|
|
387
|
+
container sockets and `/run/WSL`, and blocks a copied Windows executable. The
|
|
388
|
+
doctor's `sandbox.isolation` row reports the effective stance and the detected
|
|
389
|
+
surfaces. Configure it on the command and write rows:
|
|
390
|
+
|
|
391
|
+
```yaml
|
|
392
|
+
- id: wsl-shell
|
|
393
|
+
config:
|
|
394
|
+
socketIsolation: session-bus
|
|
395
|
+
- id: wsl-fs
|
|
396
|
+
config:
|
|
397
|
+
socketIsolation: session-bus
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
For the routed root, set the same value on the top-level `fs-routing` row:
|
|
401
|
+
|
|
402
|
+
```yaml
|
|
403
|
+
- id: fs-routing
|
|
404
|
+
config:
|
|
405
|
+
socketIsolation: session-bus
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
`pnpm run preset --socket-isolation session-bus` writes the two nested rows;
|
|
409
|
+
`pnpm run preset --strict` sets `socketIsolation: strict` and
|
|
410
|
+
`maskWindowsDrive: true` there. It does not rewrite the top-level `fs-routing`
|
|
411
|
+
row; add that by hand when the routed root is in use.
|
|
412
|
+
|
|
324
413
|
## Sandbox and preflight
|
|
325
414
|
|
|
326
415
|
`sandbox: true` is the default for `wsl-shell`, `wsl-fs`, and
|
|
@@ -365,11 +454,13 @@ blocks the verdict.
|
|
|
365
454
|
|
|
366
455
|
### Message language
|
|
367
456
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
457
|
+
All plugin-authored UI text follows the harness app's Language setting: the
|
|
458
|
+
status panel's route errors, the open-in-app route's refusals, the directory
|
|
459
|
+
picker's labels, the `/wsl-doctor` command text, and the refusal and remedy
|
|
460
|
+
messages (the `sessionSandbox` preflight verdicts, the `bwrap` install and
|
|
461
|
+
repair hints, and the distro/workdir command errors). The preference is read
|
|
462
|
+
from the host `locale` entry's `preference` field through the host settings
|
|
463
|
+
service, and a language switch takes effect without a restart.
|
|
373
464
|
Chinese (`zh`, including `zh-CN` and `zh-Hans` tags) and English ship; every
|
|
374
465
|
other language renders English. A profile without the settings service, or
|
|
375
466
|
one whose user never picked a language, falls back to the process's ICU
|
|
@@ -429,7 +520,7 @@ error-code map. Whether a row override applied, read from the profile's
|
|
|
429
520
|
`cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
|
|
430
521
|
so the composed profile has no command-line view.
|
|
431
522
|
The sidebar's **WSL environment** panel renders the same quick digest over
|
|
432
|
-
`GET /api/wsl-env/status` and posts the full-
|
|
523
|
+
`GET /api/wsl-env/status` and posts the full-check action to the same route: a
|
|
433
524
|
doctor run with `--fix-owned`, which sweeps stale session scopes and purges a
|
|
434
525
|
broken agent cache, then re-verifies both. Each row states when the check ran, its source (manual or background) and its
|
|
435
526
|
result structure (per-status totals and per-section tallies). The last result
|
|
@@ -437,11 +528,20 @@ per distro is stored at `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
|
|
|
437
528
|
(`~/.dsh/...` when the host names no home), so a page reload or app restart
|
|
438
529
|
still shows it. On load, a stored result for a distro that is currently
|
|
439
530
|
running is re-checked in the background; a failed background run overwrites
|
|
440
|
-
the stored result. Nothing is labeled expired —
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
531
|
+
the stored result. Nothing is labeled expired — each checked row offers
|
|
532
|
+
**清除** and the card offers **清除全部**; both `DELETE` the same route
|
|
533
|
+
(optionally with `?distro=`) to drop the stored verdict without enumerating,
|
|
534
|
+
probing or modifying a distro. Deleting the file still resets the panel's
|
|
535
|
+
history equivalently. Every row offers **快速检查** and **完整检查**: the
|
|
536
|
+
latter is the full doctor with `--fix-owned`, which repairs plugin-owned state
|
|
537
|
+
(stale session scopes or a broken agent cache) and re-verifies it. Both keep
|
|
538
|
+
their names after a result and run again on every click; every other warning
|
|
539
|
+
keeps its manual remedy. It never installs packages or rewrites Windows-owned
|
|
540
|
+
or user configuration.
|
|
541
|
+
Above the distro rows, the **Plugin version** card reads the installed and
|
|
542
|
+
running plugin versions and the newest installable stable release; its
|
|
543
|
+
**一键升级** button posts to `/api/wsl-env/plugin-update`, and only that click
|
|
544
|
+
asks the host plugin manager's `updateBundle` to install.
|
|
445
545
|
Use `scripts/bootstrap.sh <distro>` to inspect distro prerequisites.
|
|
446
546
|
|
|
447
547
|
| Symptom | Result | Action |
|