dsh-plugin-wsl-env 0.25.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/CODE_OF_CONDUCT.md +85 -0
- package/CODE_OF_CONDUCT.zh.md +85 -0
- package/CONTRIBUTING.md +19 -3
- package/CONTRIBUTING.zh.md +200 -0
- package/README.md +55 -149
- package/SECURITY.md +2 -0
- package/SECURITY.zh.md +108 -0
- package/SUPPORT.md +4 -2
- package/SUPPORT.zh.md +99 -0
- package/client.js +409 -8
- package/cordis.patch.yml +13 -0
- package/docs/AGENT-PROTOCOL-V7.md +2 -2
- package/docs/API.md +2 -0
- package/docs/API.zh.md +38 -0
- package/docs/ARCHITECTURE.md +15 -4
- package/docs/ARCHITECTURE.zh.md +518 -0
- package/docs/COMPATIBILITY.md +2 -0
- package/docs/COMPATIBILITY.zh.md +117 -0
- package/docs/CONFIGURATION.md +7 -10
- package/docs/CONFIGURATION.zh.md +7 -9
- package/docs/DIAGNOSTICS.md +24 -0
- package/docs/DIAGNOSTICS.zh.md +13 -0
- package/docs/LIMITATIONS.md +43 -5
- package/docs/LIMITATIONS.zh.md +34 -6
- package/docs/MIGRATION.md +10 -4
- package/docs/MIGRATION.zh.md +94 -0
- package/docs/PEER-PARITY.md +75 -47
- package/docs/PERFORMANCE.md +2 -0
- package/docs/PERFORMANCE.zh.md +59 -0
- package/docs/QUICKSTART.md +29 -15
- package/docs/QUICKSTART.zh.md +25 -17
- package/docs/README.zh.md +69 -150
- package/docs/RELEASING.md +4 -3
- package/docs/REQUIREMENTS.zh.md +4 -2
- package/docs/ROADMAP-1.0.md +2 -2
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
- package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
- package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
- package/docs/VALUE.md +173 -0
- package/docs/VALUE.zh.md +42 -13
- package/docs/screenshots/with-plugin.png +0 -0
- package/docs/screenshots/with-plugin.svg +59 -0
- package/docs/screenshots/with-plugin.zh.png +0 -0
- package/docs/screenshots/with-plugin.zh.svg +56 -0
- package/docs/screenshots/without-plugin.png +0 -0
- package/docs/screenshots/without-plugin.svg +50 -0
- package/docs/screenshots/without-plugin.zh.png +0 -0
- package/docs/screenshots/without-plugin.zh.svg +45 -0
- package/lib/auto-preset-seam.d.ts +45 -0
- package/lib/auto-preset-seam.js +47 -0
- package/lib/auto-preset.d.ts +33 -10
- package/lib/auto-preset.js +148 -44
- package/lib/doctor-live.d.ts +30 -0
- package/lib/doctor-live.js +37 -0
- package/lib/doctor-report.js +10 -3
- package/lib/messages.d.ts +19 -0
- package/lib/messages.js +28 -0
- package/lib/open-in-app.d.ts +206 -0
- package/lib/open-in-app.js +300 -0
- package/lib/peer-versions.d.ts +53 -0
- package/lib/peer-versions.js +137 -0
- package/lib/preset-choice.d.ts +13 -0
- package/lib/preset-choice.js +18 -1
- package/lib/status.js +2 -1
- package/lib/update-check.d.ts +2 -2
- package/lib/update-check.js +2 -2
- package/lib/wsl-doctor-command.js +4 -2
- package/package.json +55 -25
- package/scripts/doctor.mjs +127 -9
package/README.md
CHANGED
|
@@ -6,62 +6,67 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/dsh-plugin-wsl-env)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Turns a WSL 2 distro into the execution environment of a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) desktop session: commands, files and the terminal all run inside the distro, while the harness stays on Windows. DeepSeek Harness ships in two forms — an npm CLI with a web UI, and a desktop app for macOS and Windows; this plugin serves one combination only, the desktop app on Windows with the project in a WSL 2 distro. No service installed in the distro, no port opened; confined commands run under the `bubblewrap` sandbox.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+

|
|
12
12
|
|
|
13
|
-
Windows
|
|
13
|
+

|
|
14
14
|
|
|
15
|
-
**New here?** Start with [docs/QUICKSTART.md](docs/QUICKSTART.md)
|
|
15
|
+
**New here?** Start with [docs/QUICKSTART.md](docs/QUICKSTART.md).
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Why this plugin
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
plugin: install the CLI there and run it from the distro's shell. No UNC paths,
|
|
21
|
-
no 9p round trips, no Windows-to-distro agent.
|
|
19
|
+
"When the agent keeps failing on a WSL project, make the desktop app work directly in the distro's environment — no moving, no service, no giving up the sandbox."
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
- The model's strength is POSIX, its weakness CMD/PowerShell: a Windows workspace gets only the weakness, and a WSL workspace gets `wsl.exe` wrapping that loses environment and state. This plugin runs the scripts unchanged in a persistent distro session.
|
|
22
|
+
- Commands run in the distro's login shell: `PATH`, `nvm`, `cargo`, `pyenv` and rc files all apply.
|
|
23
|
+
- No service in the distro, no port; the only persisted artifact is the agent cache under `~/.cache/dsh-wsl/agent/`.
|
|
24
|
+
- Confined commands run under `bubblewrap` by default; without bwrap the command fails, never runs unconfined.
|
|
25
|
+
- The environment is per session: a distro folder runs in the distro, a Windows folder stays Windows — both in one process.
|
|
26
|
+
- GUI integrated: the folder picker lists distros, the terminal opens in the distro, the model sees listening ports.
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
The full argument (why Linux rather than PowerShell, value and costs) is in [docs/VALUE.md](docs/VALUE.md).
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|---|---|
|
|
34
|
-
| Work happens inside WSL; a terminal or browser UI is enough | the CLI installed in the distro |
|
|
35
|
-
| You want the Windows desktop app, with commands and files in the distro | this plugin |
|
|
36
|
-
| One session must reach Windows and WSL folders at once | this plugin — per-path routing is the point |
|
|
30
|
+
## Install
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
app, and the npm CLI refuses to manage that profile's plugins — use the app's
|
|
40
|
-
Plugins page for it. [docs/VALUE.zh.md](docs/VALUE.zh.md) has the full
|
|
41
|
-
comparison and the cases this plugin is not for.
|
|
32
|
+
The desktop app has no `dsh` executable; the plugin installs through the in-app Plugins page. Three steps:
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
1. `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap`
|
|
35
|
+
2. Plugins page: **Add plugin** → `dsh-plugin-wsl-env`, enable it.
|
|
36
|
+
3. Restart the app, open a folder inside the distro; type `/wsl-doctor` (host-side) for a `ready`/`blocked` verdict.
|
|
37
|
+
|
|
38
|
+
Remaining prerequisites (no Node.js needed inside the distro):
|
|
39
|
+
|
|
40
|
+
| Prerequisite | Notes |
|
|
41
|
+
|---|---|
|
|
42
|
+
| Windows 10/11 + WSL 2 + ≥1 distro | `wsl.exe -l -v` shows `VERSION 2`; otherwise `wsl.exe --install` |
|
|
43
|
+
| systemd + Linger (default session sandbox) | `[boot] systemd=true` in `/etc/wsl.conf`, `wsl --shutdown`, run `loginctl enable-linger "$USER"` once; without systemd set `sessionSandbox` to `auto` or `false` |
|
|
44
|
+
| Optional: `ripgrep`, `git`, `inotify-tools` | `pnpm run bootstrap <distro>` prints the install commands |
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
The plugin never edits the installed `resources/app.asar`. Upgrade = install again and restart; uninstall on the Plugins page, then `~/.cache/dsh-wsl` can be deleted. Details in [docs/QUICKSTART.md](docs/QUICKSTART.md).
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
- **No service in the distro.** There is no helper server, no daemon and no listening port. The only persisted artifact is a content-addressed copy of the native agent in `~/.cache/dsh-wsl/agent/`.
|
|
49
|
-
- **Sandboxed by default.** Confined commands run under `bubblewrap` inside the distro. If `bubblewrap` is missing, the command fails; it does not run unconfined.
|
|
50
|
-
- **Per-session.** A session opened on a distro folder gets the distro environment. A session opened on a Windows folder keeps the normal Windows tools. Both can run in one harness process.
|
|
51
|
-
- **Integrated with the GUI.** The folder picker lists installed distros, the terminal opens a shell in the distro, and the model can see listening ports. The sidebar's **WSL environment** panel runs a quick doctor check per distro — host-side, no model turn — and the session-start preflight logs the environment verdict on every session, adding a blocked verdict to the session's context.
|
|
48
|
+
## Do I need this plugin?
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
If the harness can run entirely inside the distro, skip this plugin: install the CLI in the distro (commands in [QUICKSTART §0](docs/QUICKSTART.md)). Use this plugin when the harness must stay on Windows:
|
|
54
51
|
|
|
55
|
-
|
|
52
|
+
| Setup | What to use |
|
|
53
|
+
|---|---|
|
|
54
|
+
| a terminal or browser UI is enough | the CLI inside the distro |
|
|
55
|
+
| the Windows desktop app, commands and files in the distro | this plugin |
|
|
56
|
+
| one session reaching both Windows and WSL folders | this plugin |
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
- **Toolchain support.** Node, Python, Rust, Go, C/C++ and most build systems are validated on Linux first. Windows support is often a port with different quoting, paths, line endings and file locking.
|
|
59
|
-
- **Shell semantics.** PowerShell and `cmd` differ from POSIX in quoting, escaping, pipelines, environment variables, exit codes and path separators. Mixing the two produces errors that look like model mistakes.
|
|
60
|
-
- **Environment drift.** Windows setups vary by PowerShell version, execution policy, PATH and installed tools. Linux environments are easier to reproduce and containerize.
|
|
58
|
+
One trap: the `desktop` profile name is owned by the Electron app, and the npm CLI refuses to manage its plugins — use the in-app Plugins page. Full comparison in [docs/VALUE.md](docs/VALUE.md).
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
## Using it
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
Open a distro folder as the workspace, e.g. `\\wsl.localhost\ubuntu\home\you\project`.
|
|
63
|
+
|
|
64
|
+
- A folder opened in any distro runs in that distro.
|
|
65
|
+
- Commands run in the distro's login shell; `/home/you/x` and `\\wsl.localhost\ubuntu\home\you\x` are the same file.
|
|
66
|
+
- **New terminal** opens a shell in the same distro and directory.
|
|
67
|
+
- The model sees listening ports and returns dev-server URLs (WSL 2 forwards localhost).
|
|
68
|
+
- Permissions: `read-only` / `workspace-write` (default) / `danger-full-access`; only the last runs without the sandbox.
|
|
69
|
+
- The sidebar **WSL environment** panel diagnoses per distro; see [docs/DIAGNOSTICS.md](docs/DIAGNOSTICS.md).
|
|
65
70
|
|
|
66
71
|
## How it compares
|
|
67
72
|
|
|
@@ -72,106 +77,16 @@ This plugin keeps the GUI on Windows and moves only the execution environment in
|
|
|
72
77
|
| Command sandbox | none | `bubblewrap` |
|
|
73
78
|
| Removal | delete the server | delete the cache |
|
|
74
79
|
|
|
75
|
-
A desktop remote
|
|
76
|
-
|
|
77
|
-
## Requirements
|
|
78
|
-
|
|
79
|
-
- Windows 10 or 11 with WSL 2 and at least one distro.
|
|
80
|
-
- `bubblewrap` in the distro. It is required.
|
|
81
|
-
- systemd in the distro for the default session sandbox: set `[boot] systemd=true` in `/etc/wsl.conf`, restart WSL, then run `loginctl enable-linger "$USER"` once. Without systemd, set `sessionSandbox` to `auto` (the scope when available, otherwise per-command confinement) or explicit `false` on both `wsl-shell` and `wsl-fs`.
|
|
82
|
-
- Optional: `ripgrep` for search, `git` for change snapshots, `inotify-tools` for file watching.
|
|
83
|
-
|
|
84
|
-
No Node.js is required inside the distro.
|
|
85
|
-
|
|
86
|
-
## Install
|
|
87
|
-
|
|
88
|
-
The Windows desktop app ships **no `dsh` executable**: the installer writes
|
|
89
|
-
`DeepSeek Harness.exe`, and the CLI entry lives inside `resources/app.asar`
|
|
90
|
-
(the probe scripts launch it through `ELECTRON_RUN_AS_NODE`). Use the
|
|
91
|
-
distribution you have.
|
|
92
|
-
|
|
93
|
-
**Desktop app.** Open **Plugins** in the sidebar, choose **Add plugin**, enter
|
|
94
|
-
the exact package name `dsh-plugin-wsl-env`, then enable it. The plugin manager
|
|
95
|
-
writes the active profile's `package.json` — the dependency and the
|
|
96
|
-
`dsh.profile.bundles` entry — which is the same state the CLI command below
|
|
97
|
-
produces. To run from a checkout, add it as a linked package instead of a
|
|
98
|
-
name. Start it the way the installer's shortcut does: `DeepSeek Harness.exe`,
|
|
99
|
-
no arguments. The app opens the profile it is configured with — the one the
|
|
100
|
-
Plugins page writes into — so a different profile is a CLI-distribution thing
|
|
101
|
-
(`dsh --profile <name>`).
|
|
102
|
-
|
|
103
|
-
**CLI distribution** (`dsh` on `PATH`), in a Windows terminal:
|
|
104
|
-
|
|
105
|
-
```powershell
|
|
106
|
-
dsh wsl --from-default-profile web --dump-config # create a profile named wsl
|
|
107
|
-
dsh plugin --profile wsl add dsh-plugin-wsl-env # install the plugin and its settings
|
|
108
|
-
dsh --profile wsl --dump-config # verify: prints "# == dsh-plugin-wsl-env"
|
|
109
|
-
dsh --profile wsl # start
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Install `bubblewrap` before the first command:
|
|
113
|
-
|
|
114
|
-
```powershell
|
|
115
|
-
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
From a checkout, `pnpm run doctor` is the one-command environment check: the Windows/WSL platform, the per-distro WSL mode and identity, `.wslconfig` and `/etc/wsl.conf` cross-checks, the distro and host volumes, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the native agent and its cache, a fresh-agent handshake, the shell smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate) and a native HELLO leg, stale session scopes, and the known profile-patch and deprecated-key traps. The report itemizes every check — grouped by distro, each with an explicit status marker and a copy-paste remedy under every failure — and ends in a verdict, `ready` (every check that run covered passed — not a promise about a later command) or `blocked` (the named checks to fix), computed under the effective configuration. A run can be scoped: `--quick` probes the first-command prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the named sections, and a scoped report lists the checks it did not run as explicit skips. `--json` is the machine contract; `--fix` re-verifies what it fixed — the plugin-owned stale-scope sweep and agent-cache purge are safe and automatic, packages need `--fix --install` and an explicit confirmation, and `--fix-owned` narrows a run to the plugin-owned two — `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). The fixed skeleton renders in the host's language — detected from the Windows locale, overridable with `--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE`; `--json` stays language-independent. The same report answers through three surfaces: this CLI, the `/wsl-doctor` command (typed in the composer — host-side, no model turn), and the `wsl_doctor` model tool (in-process, merging the live resident's state). `DSH_WSL_DOCTOR` additionally carries a ready-to-run command (`sh -c "$DSH_WSL_DOCTOR --json"`) that replays the doctor inside the distro. `pnpm run diagnose` is the CLI's read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
|
|
119
|
-
|
|
120
|
-
The plugin notices its own updates about once a day (first check 2–10 minutes after startup) by asking the app's plugin manager — it never fetches on its own. When a newer stable release exists, the managed `DSH_WSL_PLUGIN_UPDATE` variable in every distro session carries the fact; `wsl-update-check.enabled: false` in the patch config turns the check off. Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
|
|
121
|
-
the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
|
|
122
|
-
where the CLI is installed; the agent cache under `~/.cache/dsh-wsl` can then be
|
|
123
|
-
deleted. If you added a local `workspace-files-wsl` workaround to your profile to
|
|
124
|
-
restore previews, remove it after upgrading: the plugin no longer mounts that
|
|
125
|
-
row.
|
|
126
|
-
|
|
127
|
-
## Using it
|
|
128
|
-
|
|
129
|
-
Open a distro folder as the workspace, for example `\\wsl.localhost\ubuntu\home\you\project`.
|
|
130
|
-
|
|
131
|
-
- Opening a folder in any distro runs there, even when it is not WSL's default.
|
|
132
|
-
- Commands run in the distro's login shell. `/home/you/x` and `\\wsl.localhost\ubuntu\home\you\x` are the same file.
|
|
133
|
-
- **New terminal** opens a shell in the same distro and directory.
|
|
134
|
-
- The model sees listening ports and can return the URL of a dev server. WSL 2 forwards localhost to Windows.
|
|
135
|
-
- The Permissions selector offers `read-only`, `workspace-write` (default) and `danger-full-access`. Only `danger-full-access` runs without the sandbox.
|
|
136
|
-
- The sidebar's **WSL environment** panel is the diagnostic page: the installed distros, an on-demand quick doctor check per distro (bwrap / systemd / Linger and the other prerequisites), and a full-run action (`--fix-owned`, labeled **修复** when a finding is one the plugin can repair and **完整检查** otherwise) that sweeps stale session scopes and purges a broken agent cache, then re-verifies both — without touching packages or Windows-owned configuration; every other warning keeps its manual remedy. Each checked row also states when the check ran, where it came from (**手动** or the page-load **后台** refresh), and how its results landed — the per-status totals and the per-section tallies. Each checked row also expands to the full list of checks that run executed, grouped by section with each status and its evidence (the catalog rows a quick run never touched are counted, not listed), so a green or blocked row can be audited instead of trusted. The next action is visible without opening the doctor. The last result per distro is stored under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` (falling back to `~/.dsh`), so a page reload or an app restart still shows it; on load, stored results for distros that are currently running are re-checked in the background (never a stopped one), and a failed background run replaces the stored result exactly as observed. No result is labeled expired: the timestamp is the timestamp. **Add workspace** on a distro folder asks once between **Remote WSL** (the default, everything runs in the distro) and **Windows access** (the folder as a 9p share, without the Linux toolchain), recorded in the `auto-preset` row's `windowsWorkspaces`.
|
|
80
|
+
A desktop remote is more mature; a CLI inside WSL is simpler. This plugin is for: the harness stays on Windows and commands must be sandboxed.
|
|
137
81
|
|
|
138
82
|
## Configure
|
|
139
83
|
|
|
140
|
-
Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`.
|
|
141
|
-
|
|
142
|
-
| Row | Key | Default | Purpose |
|
|
143
|
-
|---|---|---|---|
|
|
144
|
-
| `wsl-shell` | `distro` | `''` | distro mode; empty/`auto` follows the workspace, `default` forces WSL's default |
|
|
145
|
-
| | `sandbox` | `true` | confine commands with `bubblewrap` |
|
|
146
|
-
| | `sessionSandbox` | `false`; shipped `true` | run the session's commands in one systemd user scope |
|
|
147
|
-
| | `agentBackend` | `auto` | `auto`, `native` or `shell` for the in-distro agent |
|
|
148
|
-
| | `maskWindowsDrive` | `false` | hide `/mnt` from confined commands |
|
|
149
|
-
| | `writableRoots` | `[]` | extra distro directories to grant (toolchain caches; put the same list on `wsl-fs`) |
|
|
150
|
-
| `wsl-fs` | `distro` | `''` | distro mode; empty/`auto` follows each target path |
|
|
151
|
-
| | `restrictToDistro` | `true` | under a fixed distro, refuse paths that belong to another distro |
|
|
152
|
-
| | `sandbox` | `true` | check confined writes against the policy |
|
|
153
|
-
| | `sessionSandbox` | `false`; shipped `true` | run confined writes in the session runtime |
|
|
154
|
-
| | `substrate` | `agent` | in-distro agent; `share` is rejected at startup |
|
|
155
|
-
| | `writableRoots` | `[]` | the same extra-writable list as `wsl-shell` |
|
|
156
|
-
| `directory-picker-wsl` | `includeHostHome` | `true` | also offer the Windows path branch (starting at the drives) |
|
|
157
|
-
| `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
|
|
158
|
-
| `wsl-preflight` | `distro` | `''` | distro the environment checks probe; empty/`auto` follows the session workspace |
|
|
159
|
-
| | `startup` | `true` | run the same checks once at plugin load, so the verdict is in the log before any session opens |
|
|
160
|
-
|
|
161
|
-
`fs-routing` is the top-level router for root-level `ctx.fs` calls: its distro
|
|
162
|
-
settings are independent of `wsl-fs`, and it is a top-level row patched by id
|
|
163
|
-
like the others. `wsl-shell` and `wsl-fs` are inside the shipped `wsl` preset,
|
|
164
|
-
so overriding them by id does not work. Override the whole `preset-wsl` row
|
|
165
|
-
instead; [docs/CONFIGURATION.md](docs/CONFIGURATION.md) has the recipe and the
|
|
166
|
-
remaining keys. [`cordis.patch.yml`](cordis.patch.yml) is the commented
|
|
167
|
-
reference for every shipped value.
|
|
84
|
+
Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. `wsl-shell`/`wsl-fs` are nested inside `preset-wsl`; overriding them by id does not work — override the whole row. Every key and recipe is in [docs/CONFIGURATION.md](docs/CONFIGURATION.md); [`cordis.patch.yml`](cordis.patch.yml) is the commented reference for the shipped values.
|
|
168
85
|
|
|
169
86
|
## Architecture
|
|
170
87
|
|
|
171
|
-
One harness process can serve Windows-folder and distro-folder sessions at the same time. Services attach at two levels:
|
|
172
|
-
|
|
173
88
|
```text
|
|
174
|
-
app level (
|
|
89
|
+
app level (per process)
|
|
175
90
|
├─ directory-picker-wsl, workspace-files, subprocess-wsl
|
|
176
91
|
├─ fs-routing: root filesystem routed by path
|
|
177
92
|
└─ auto-preset: binds the wsl preset when a session opens a distro folder
|
|
@@ -181,24 +96,17 @@ wsl preset (per session)
|
|
|
181
96
|
└─ wsl-fs: file operations
|
|
182
97
|
```
|
|
183
98
|
|
|
184
|
-
|
|
185
|
-
- `wsl-fs` serves reads and writes through the same in-distro agent. Confined writes run in a long-lived agent whose mount profile matches the policy, so the kernel enforces the write boundary. There is no host-side file fallback: if the agent is unavailable, file operations fail.
|
|
186
|
-
- The GUI file tree and previews are the shipped `workspace-files` row, not a plugin replacement: its client half is the browser `file` provider. It reads WSL paths through the routed root filesystem, so it stays distro-side, at the cost of a few extra agent round trips.
|
|
187
|
-
- App-level services route by path. A distro UNC path goes to the distro; a Windows drive path stays on the host. See [docs/root-fs-routing.md](docs/root-fs-routing.md).
|
|
99
|
+
Commands and file operations go through a resident agent in the distro (systemd user scope + `bubblewrap` profile). Distro UNC paths route to the distro; drive-letter paths stay on the host. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
188
100
|
|
|
189
101
|
## Sandbox
|
|
190
102
|
|
|
191
103
|
| Mode | What a command can do |
|
|
192
104
|
|---|---|
|
|
193
|
-
| `read-only` | read the whole distro; a fresh `/dev` is mounted, nothing else
|
|
194
|
-
| `workspace-write` |
|
|
105
|
+
| `read-only` | read the whole distro; only a fresh `/dev` is mounted, nothing else writable |
|
|
106
|
+
| `workspace-write` | plus the session workspace and any configured `writableRoots` |
|
|
195
107
|
| `danger-full-access` | no sandbox |
|
|
196
108
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
`bubblewrap` is required. If it is missing or broken, confined commands report `SANDBOX_UNAVAILABLE` and do not run. Setting `sandbox: false` on the owning row disables confinement; the model is told that the operation is unsandboxed.
|
|
200
|
-
|
|
201
|
-
Enforcement is reported as `partial`. A command inside the distro can still start a Windows executable through `/mnt/c`, and `bubblewrap` cannot control Windows processes. `maskWindowsDrive: true` hides `/mnt` from the confined view unless overridden by `interopVisibility: visible`; this narrows the hole but does not close it. Disabling WSL interop requires a separate distro-level change: set `[interop] enabled=false` in `/etc/wsl.conf`. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#sandbox) and [SECURITY.md](SECURITY.md).
|
|
109
|
+
Without `bubblewrap`, confined commands report `SANDBOX_UNAVAILABLE` and do not run. Enforcement is `partial`: a process inside the distro can still start Windows programs through `/mnt/c`. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#sandbox) and [SECURITY.md](SECURITY.md).
|
|
202
110
|
|
|
203
111
|
## Troubleshooting
|
|
204
112
|
|
|
@@ -208,11 +116,11 @@ Enforcement is reported as `partial`. A command inside the distro can still star
|
|
|
208
116
|
| the session refuses before the first command | run `pnpm run doctor`; enable systemd and linger, or set `sessionSandbox` to `auto` or `false` on `wsl-shell` and `wsl-fs` |
|
|
209
117
|
| `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
|
|
210
118
|
| `npm install` / `pnpm add` fail with `EROFS` | the sandbox grants only the workspace by default; configure `writableRoots` on `wsl-shell` and `wsl-fs` (e.g. `~/.npm`, `~/.cache`, `~/.local/share/pnpm`); see [CONFIGURATION](docs/CONFIGURATION.md#toolchain-caches-and-extra-writable-roots) |
|
|
211
|
-
|
|
|
119
|
+
| the Plugins page finishes without feedback | trust the profile's `package.json` and its `dsh.profile.bundles` entry: the plugin listed there is installed |
|
|
212
120
|
| a profile patch for `wsl-shell`/`wsl-fs` changes nothing | those rows are nested inside `preset-wsl`. Run `pnpm run preset --check <patch>`; it fails with the complete block to paste |
|
|
213
121
|
| changes under `lib/` have no effect | run `pnpm run sync:windows`, then restart the app |
|
|
214
122
|
|
|
215
|
-
More error codes
|
|
123
|
+
More error codes in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#error-codes); what the plugin does not do is in [docs/LIMITATIONS.md](docs/LIMITATIONS.md).
|
|
216
124
|
|
|
217
125
|
## Development
|
|
218
126
|
|
|
@@ -224,9 +132,7 @@ pnpm run test:coverage # unit tests with coverage thresholds
|
|
|
224
132
|
pnpm run sync:windows # update the Windows-side copy the app loads
|
|
225
133
|
```
|
|
226
134
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTING.md) and `test/probe/`.
|
|
135
|
+
Node `^22.19.0 || >=24.0.0`; `src/` is TypeScript, `lib/` is the committed build output. Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTING.md) and `test/probe/`.
|
|
230
136
|
|
|
231
137
|
## Documentation
|
|
232
138
|
|
|
@@ -242,7 +148,7 @@ Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTIN
|
|
|
242
148
|
| [docs/LIMITATIONS.md](docs/LIMITATIONS.md) | what the plugin does not do |
|
|
243
149
|
| [docs/ROADMAP.md](docs/ROADMAP.md) | current plan and deferred work |
|
|
244
150
|
| [docs/ROADMAP-1.0.md](docs/ROADMAP-1.0.md) | the 1.0 and ecosystem plan |
|
|
245
|
-
| [docs/VALUE.
|
|
151
|
+
| [docs/VALUE.md](docs/VALUE.md) | value and trade-offs |
|
|
246
152
|
| [CONTRIBUTING.md](CONTRIBUTING.md) | development loop, gates, probes |
|
|
247
153
|
| [SECURITY.md](SECURITY.md) | private vulnerability reporting |
|
|
248
154
|
| [SUPPORT.md](SUPPORT.md) | supported versions and support channels |
|
package/SECURITY.md
CHANGED
package/SECURITY.zh.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# 安全政策
|
|
2
|
+
|
|
3
|
+
[English](SECURITY.md)
|
|
4
|
+
|
|
5
|
+
## 支持的版本
|
|
6
|
+
|
|
7
|
+
只有最新发布版本会获得安全修复。
|
|
8
|
+
|
|
9
|
+
| 版本 | 是否支持 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| npm 的 `latest` 标签所指向的版本 | 是 |
|
|
12
|
+
| 所有更早版本 | 否 |
|
|
13
|
+
|
|
14
|
+
## 报告漏洞
|
|
15
|
+
|
|
16
|
+
私下报告疑似漏洞。使用本仓库的 GitHub 私有漏洞报告:
|
|
17
|
+
|
|
18
|
+
https://github.com/Big-Dao/dsh-plugin-wsl-env/security/advisories/new
|
|
19
|
+
|
|
20
|
+
如果你无法使用该表单,请开一个普通 issue 索取私有渠道。不要在该 issue 中写入
|
|
21
|
+
利用细节。维护者会回复一个可私下发送细节的渠道。
|
|
22
|
+
|
|
23
|
+
在修复发布之前,不要在公开 issue、discussion 或 pull request 中发布利用细节。
|
|
24
|
+
|
|
25
|
+
## 报告应包含的内容
|
|
26
|
+
|
|
27
|
+
- 你测试的插件版本。`npm ls dsh-plugin-wsl-env` 会打印它,或注明你构建所用的
|
|
28
|
+
tag。
|
|
29
|
+
- 你的 Windows 版本与你使用的发行版。`wsl.exe -l -v` 列出各发行版。
|
|
30
|
+
- DSH 版本与 profile 名称。
|
|
31
|
+
- 你期望发生什么,实际发生了什么。
|
|
32
|
+
- 你能构造的最小复现,附精确命令。
|
|
33
|
+
- 当时是否启用了沙箱。`sandbox: true` 是默认值。
|
|
34
|
+
|
|
35
|
+
## 响应时间
|
|
36
|
+
|
|
37
|
+
这些是目标,不是承诺。
|
|
38
|
+
|
|
39
|
+
| 阶段 | 目标 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| 确认收到报告 | 3 个工作日内 |
|
|
42
|
+
| 初步评估与严重性判定 | 10 个工作日内 |
|
|
43
|
+
| 修复,或已记录的缓解措施 | 30 个工作日内 |
|
|
44
|
+
|
|
45
|
+
如果报告不在范围内,我们会说明并解释原因。
|
|
46
|
+
|
|
47
|
+
## 披露
|
|
48
|
+
|
|
49
|
+
确认的漏洞通过常规发布流程修复与披露,而不是单独的安全流程。
|
|
50
|
+
|
|
51
|
+
- 修复随包的下一个版本发布;上方的“支持的版本”表只覆盖该版本。
|
|
52
|
+
- 该版本在 [`CHANGELOG.md`](CHANGELOG.md) 中记录修复,GitHub
|
|
53
|
+
Release 说明取自该节。
|
|
54
|
+
- 携带修复的版本发布后,公告会发布在本仓库的 Security 标签页,即私有报告
|
|
55
|
+
提交之处。
|
|
56
|
+
|
|
57
|
+
不在范围内、或无法确认为漏洞的报告会被关闭,不发布公告。
|
|
58
|
+
|
|
59
|
+
## 范围
|
|
60
|
+
|
|
61
|
+
在范围内:
|
|
62
|
+
|
|
63
|
+
- 插件自身 `lib/` 下的代码;
|
|
64
|
+
- 已发布的包 `dsh-plugin-wsl-env`。
|
|
65
|
+
|
|
66
|
+
不在范围内:
|
|
67
|
+
|
|
68
|
+
- `@deepseek-ai/` 下的上游 DSH 包。请报告给各自的项目。
|
|
69
|
+
- WSL 本身、Windows 内核,以及 `bubblewrap`。
|
|
70
|
+
- 用户自己发行版的配置。这包括其 `sudoers` 规则、挂载的文件系统,以及其中
|
|
71
|
+
安装的解释器。
|
|
72
|
+
- 任何需要攻击者已经控制用户的 Windows 账户或其发行版账户的情形。
|
|
73
|
+
|
|
74
|
+
## 沙箱隔离按设计为 `partial`
|
|
75
|
+
|
|
76
|
+
插件将沙箱隔离级别报告为 `partial`,而非 `full`。发行版内的进程仍可通过
|
|
77
|
+
WSL interop 启动 Windows 程序,例如 `/mnt/c/.../*.exe`。该程序在 Linux
|
|
78
|
+
沙箱之外运行。
|
|
79
|
+
|
|
80
|
+
这是已记录的设计边界,本身不是漏洞。在发行版内运行
|
|
81
|
+
`npm run probe:sandbox` 会在你的机器上演示这一点;发行版内必须安装
|
|
82
|
+
`bubblewrap` 与 `node`。README 的“沙箱”一节对此有说明。
|
|
83
|
+
|
|
84
|
+
严格 profile(`maskWindowsDrive: true` 配合 `sandbox: true`,且没有覆盖性的
|
|
85
|
+
`interopVisibility: visible`)会收窄这一点:
|
|
86
|
+
受限 profile 用空的 tmpfs 遮蔽 `/mnt`,因此无法从那里启动 `/mnt` 路径下的
|
|
87
|
+
可执行文件。其他挂载点与不受约束的文件读取不在覆盖范围内。它并未堵死这个
|
|
88
|
+
洞——写入工作区的 Windows 可执行文件仍会运行,因为 WSL 的 `binfmt_misc`
|
|
89
|
+
按内容而非位置分派——所以上报的隔离级别仍是 `partial`。彻底关闭需要发行版
|
|
90
|
+
级别(`/etc/wsl.conf` 中的 `[interop] enabled=false`)。三种状态及其证据列在
|
|
91
|
+
[docs/CONFIGURATION.md](docs/CONFIGURATION.zh.md#windows-interop) 的表中。
|
|
92
|
+
|
|
93
|
+
如果你发现不依赖 interop 的逃逸、遮蔽后的 profile 可从 `/mnt` 绕过,或插件
|
|
94
|
+
在 interop 可达时报告 `full`,仍欢迎报告。
|
|
95
|
+
|
|
96
|
+
已知有一类逃逸尚未修复:受限命令可以请求发行版用户自己的服务管理器启动一个
|
|
97
|
+
unit,而该 unit 在挂载 profile 之外运行——对发行版用户主目录的写入会成功,
|
|
98
|
+
而围栏内同样的写入会被拒绝。遮蔽 `/mnt` 不能收窄这条路径,因为它从不涉及
|
|
99
|
+
interop。在修复发布前,socket 路径与复现步骤暂不公开;发现、验证与推迟决定
|
|
100
|
+
记录在
|
|
101
|
+
[docs/superpowers/value-discovery-2026-11-10.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/superpowers/value-discovery-2026-11-10.md)
|
|
102
|
+
(E4)。与其他逃逸一样,请通过上方的私有渠道报告新实例。
|
|
103
|
+
|
|
104
|
+
## 凭据
|
|
105
|
+
|
|
106
|
+
本仓库不应包含任何凭据、token 或私钥,包括 npm token、GitHub token 和发行版
|
|
107
|
+
密码。如果你发现此类内容被提交到这里,请通过上方的私有渠道报告。不要为此
|
|
108
|
+
开公开 issue。
|
package/SUPPORT.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Support
|
|
2
2
|
|
|
3
|
+
[中文](SUPPORT.zh.md)
|
|
4
|
+
|
|
3
5
|
## What is supported
|
|
4
6
|
|
|
5
7
|
| Area | Supported |
|
|
@@ -96,13 +98,13 @@ what it cannot see:
|
|
|
96
98
|
| The diagnose report | `pnpm run diagnose <distro>` (read-only; review and redact before sharing) |
|
|
97
99
|
| Plugin version | `npm ls dsh-plugin-wsl-env`, or the git tag you built from |
|
|
98
100
|
| DSH version | the version of the harness you run |
|
|
99
|
-
| The composed configuration |
|
|
101
|
+
| The composed configuration | the profile's `package.json` and `cordis.patch.yml` (the `dsh-plugin-wsl-env` layer and the rows it patches). The desktop app has no `dsh` command |
|
|
100
102
|
| Sandbox behaviour, in depth | the output of `npm run probe:sandbox`, run from inside the distro (`wsl.exe -d <distro>` first) — the probe calls `bwrap` and reads `lib/bwrap.js` there, so it needs both in the distro |
|
|
101
103
|
| What you expected and what happened | one paragraph each |
|
|
102
104
|
| A reproduction | the exact command, or the exact sequence of clicks |
|
|
103
105
|
|
|
104
106
|
Redact your user name and any path you would rather not publish. The useful part
|
|
105
|
-
of
|
|
107
|
+
of `cordis.patch.yml` is usually the layer heading and the patched rows, not the whole
|
|
106
108
|
file.
|
|
107
109
|
|
|
108
110
|
## Response times
|
package/SUPPORT.zh.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# 支持政策
|
|
2
|
+
|
|
3
|
+
[English](SUPPORT.md)
|
|
4
|
+
|
|
5
|
+
## 支持范围
|
|
6
|
+
|
|
7
|
+
| 领域 | 支持情况 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| 操作系统 | Windows 10 与 Windows 11 |
|
|
10
|
+
| Linux 侧 | WSL2,至少一个发行版;随包的会话 runtime 需要 systemd 作为 PID 1,并启用 lingering 用户管理器(`loginctl enable-linger`)。若要在 preset 中保留逐命令沙箱,请在 `wsl-shell` 和 `wsl-fs` 上都设置 `sessionSandbox: false` |
|
|
11
|
+
| DSH 包 | `peerDependencies` 声明 `0.2.2-rc.1` 下限;更新的版本需要兼容性验证 |
|
|
12
|
+
| 插件版本 | 仅最新发布版本 |
|
|
13
|
+
| Node | 22.19+(`^22.19.0`),或 24 及以后(`>=24.0.0`) |
|
|
14
|
+
|
|
15
|
+
DSH 这一行每周检查:`.github/workflows/peer-canary.yml` 解析每个钉定 peer 的
|
|
16
|
+
`next` dist-tag,将该版本线安装到临时副本,并运行 `pnpm test` 与组合启动测试。
|
|
17
|
+
成功运行会在摘要中打印确切的版本差异;请据此更新上表。运行失败(红色)表示
|
|
18
|
+
插件尚未针对新版本线验证。
|
|
19
|
+
|
|
20
|
+
Node 20 被有意排除在区间外:下限就是 harness 宿主自身的版本,CI 覆盖 22 与 24。
|
|
21
|
+
`package.json` 中的 `engines` 才是权威声明,而不是本表。
|
|
22
|
+
|
|
23
|
+
在 Windows 之外,插件没有可接入的对象。它通过 `wsl.exe` 在发行版内运行
|
|
24
|
+
`ctx.shell`。Linux 宿主、macOS 宿主或 WSL1 都不是受支持的配置。
|
|
25
|
+
|
|
26
|
+
## 获取帮助
|
|
27
|
+
|
|
28
|
+
在仓库中开一个 issue:
|
|
29
|
+
|
|
30
|
+
https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/new/choose
|
|
31
|
+
|
|
32
|
+
选择器提供 **feature request** 与 **setup report**;setup report 要求提供
|
|
33
|
+
`doctor --json` 输出,这正是让首次运行问题无需往返即可诊断的关键。安全 issue
|
|
34
|
+
请改用私有公告链接(见 [SECURITY.md](SECURITY.zh.md))。
|
|
35
|
+
|
|
36
|
+
用 issue 提交 bug 报告与配置问题。先搜索未关闭和已关闭的 issue,并检查答案
|
|
37
|
+
是否已经成文:[docs/LIMITATIONS.md](docs/LIMITATIONS.zh.md) 列出已知的设计边界,
|
|
38
|
+
[README.md](docs/README.zh.md#常见问题) 中的“常见问题”表覆盖常见故障
|
|
39
|
+
(`SANDBOX_UNAVAILABLE`、缺少 `rg` 等)。
|
|
40
|
+
|
|
41
|
+
安全 issue 请遵循 [SECURITY.md](SECURITY.zh.md)。不要为此开公开 issue。
|
|
42
|
+
|
|
43
|
+
## 不支持的范围
|
|
44
|
+
|
|
45
|
+
- macOS,以及非 WSL2 的 Linux 宿主。
|
|
46
|
+
- 没有 WSL2 的 Windows。
|
|
47
|
+
- 修改过的 DSH 构建,或 harness 包的分支。
|
|
48
|
+
- 插件无法识别的发行版,即其探针报告的情况:`wsl.exe -l -q` 中没有发行版,
|
|
49
|
+
`$HOME` 为空或不是绝对路径,或 `getent passwd` / `$SHELL` 探针得不到绝对
|
|
50
|
+
shell。检测逻辑位于 `src/wsl.ts`。
|
|
51
|
+
- 没有 `bwrap` 的发行版。此类环境中的命令失败关闭,而不是无约束运行。
|
|
52
|
+
- 上游 `@deepseek-ai/*` 包。请报告给各自的项目。
|
|
53
|
+
- 第三方 npm 镜像。请从包发布所在的 registry 安装。
|
|
54
|
+
|
|
55
|
+
## 兼容性预期
|
|
56
|
+
|
|
57
|
+
DSH peer 区间从 `0.2.2-rc.1` 开始;开发依赖为测试精确钉定该版本。Cordis 与
|
|
58
|
+
Schemastery 使用 caret peer 区间。接受的区间并不保证与每个更新的版本兼容:
|
|
59
|
+
上游变更可能需要本插件发布新版本。
|
|
60
|
+
|
|
61
|
+
没有长期支持分支。修复只进入最新版本。
|
|
62
|
+
|
|
63
|
+
## 分类处理与发布节奏
|
|
64
|
+
|
|
65
|
+
- **路线图。** 公开计划是 [docs/ROADMAP-1.0.md](docs/ROADMAP-1.0.md);
|
|
66
|
+
未关闭的 issue #5–#22 对应其 WSL-1xx/2xx/3xx 块。
|
|
67
|
+
- **分类目标。** `priority:P1` 报告在三个工作日内获得首次响应,尽力而为。
|
|
68
|
+
安全报告遵循 [SECURITY.md](SECURITY.zh.md) 中的响应目标。
|
|
69
|
+
- **节奏。** 有值得发布的变化时发布,大约每两到四周一次;tag 工作流及其门禁见
|
|
70
|
+
[docs/RELEASING.md](docs/RELEASING.md),配置稳定性与迁移规则见
|
|
71
|
+
[docs/MIGRATION.md](docs/MIGRATION.zh.md)。没有长期支持分支。
|
|
72
|
+
- **Good first issues。** `good first issue` 标签标记无需先前上下文的改动;
|
|
73
|
+
[Good first issue 与贡献者路径](CONTRIBUTING.zh.md#good-first-issue-与贡献者路径)
|
|
74
|
+
列出常见形态与领取方式。
|
|
75
|
+
|
|
76
|
+
## 一份好的 bug 报告包含什么
|
|
77
|
+
|
|
78
|
+
一条命令的路径:`pnpm run diagnose`(在插件的代码检出中运行,或
|
|
79
|
+
`bash scripts/diagnose.sh`)会收集下表的大部分内容——Windows 版本、WSL 状态、
|
|
80
|
+
发行版、内核、包管理族、四个工具及其版本,以及 bwrap 功能探针——形成可直接
|
|
81
|
+
粘贴的报告。先运行它,再补充它看不到的内容:
|
|
82
|
+
|
|
83
|
+
| 项目 | 获取方式 |
|
|
84
|
+
|---|---|
|
|
85
|
+
| 诊断报告 | `pnpm run diagnose <distro>`(只读;分享前审查并脱敏) |
|
|
86
|
+
| 插件版本 | `npm ls dsh-plugin-wsl-env`,或你构建所用的 git tag |
|
|
87
|
+
| DSH 版本 | 你运行的 harness 版本 |
|
|
88
|
+
| 合成配置 | profile 的 `package.json` 与 `cordis.patch.yml`(`dsh-plugin-wsl-env` 层及其修补的行)。桌面应用没有 `dsh` 命令 |
|
|
89
|
+
| 沙箱行为(深入) | 在发行版内运行(先 `wsl.exe -d <distro>`)`npm run probe:sandbox` 的输出——探针会调用 `bwrap` 并读取那里的 `lib/bwrap.js`,因此发行版内两者都需要 |
|
|
90
|
+
| 你期望什么、实际发生了什么 | 各写一段 |
|
|
91
|
+
| 复现 | 精确命令,或精确的点击顺序 |
|
|
92
|
+
|
|
93
|
+
隐去你的用户名以及任何你不愿公开的路径。`cordis.patch.yml` 中有用的部分通常是
|
|
94
|
+
层标题与被修补的行,而不是整个文件。
|
|
95
|
+
|
|
96
|
+
## 响应时间
|
|
97
|
+
|
|
98
|
+
这是一个利用业余时间维护的小项目。没有服务级别协议,也不保证响应时间。
|
|
99
|
+
安全报告有自己的目标,列在 [SECURITY.md](SECURITY.zh.md)。
|