dsh-plugin-wsl-env 0.26.0 → 0.26.2
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 +137 -0
- package/README.md +55 -158
- package/SUPPORT.md +2 -2
- package/SUPPORT.zh.md +2 -2
- package/docs/ARCHITECTURE.md +21 -5
- package/docs/ARCHITECTURE.zh.md +17 -4
- package/docs/CONFIGURATION.md +7 -9
- package/docs/CONFIGURATION.zh.md +6 -7
- package/docs/DIAGNOSTICS.md +21 -0
- package/docs/DIAGNOSTICS.zh.md +15 -0
- package/docs/LIMITATIONS.md +13 -1
- package/docs/LIMITATIONS.zh.md +12 -2
- package/docs/MIGRATION.md +4 -1
- package/docs/MIGRATION.zh.md +4 -1
- package/docs/PEER-PARITY.md +16 -0
- package/docs/QUICKSTART.md +22 -15
- package/docs/QUICKSTART.zh.md +19 -16
- package/docs/README.zh.md +59 -146
- package/docs/RELEASING.md +2 -2
- package/docs/REQUIREMENTS.zh.md +2 -2
- package/docs/ROADMAP-1.0.md +1 -1
- package/docs/VALUE.md +27 -0
- package/docs/VALUE.zh.md +27 -0
- 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/doctor-report.js +8 -1
- package/lib/git-exec.d.ts +39 -7
- package/lib/git-exec.js +151 -18
- package/lib/listing.d.ts +17 -0
- package/lib/listing.js +20 -0
- package/lib/messages.d.ts +27 -0
- package/lib/messages.js +26 -2
- package/lib/peer-versions.d.ts +53 -0
- package/lib/peer-versions.js +137 -0
- package/lib/picker.js +33 -19
- package/lib/search-exec.d.ts +45 -9
- package/lib/search-exec.js +152 -20
- package/lib/subprocess.d.ts +4 -1
- package/lib/subprocess.js +16 -3
- package/lib/update-check.d.ts +2 -2
- package/lib/update-check.js +2 -2
- package/lib/wsl-doctor-command.js +2 -1
- package/lib/wsl.d.ts +21 -0
- package/lib/wsl.js +24 -0
- package/package.json +9 -2
- package/scripts/doctor.mjs +148 -22
package/docs/CONFIGURATION.zh.md
CHANGED
|
@@ -48,9 +48,8 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
|
|
|
48
48
|
|
|
49
49
|
要手动编辑 preset,需替换整个 `preset-wsl` 行。它的 config
|
|
50
50
|
不做深度合并:保留 `id`、`order` 以及 `plugins` 中的每一项。
|
|
51
|
-
从 `cordis.patch.yml`
|
|
52
|
-
|
|
53
|
-
复制当前块,再修改嵌套的值。插件升级改变了 preset 后要重新复制。
|
|
51
|
+
从 profile 的 `cordis.patch.yml` 复制当前块,再修改嵌套的值。
|
|
52
|
+
插件升级改变了 preset 后要重新复制。
|
|
54
53
|
|
|
55
54
|
### `wsl-shell`
|
|
56
55
|
|
|
@@ -364,7 +363,8 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
|
|
|
364
363
|
进程内调用 doctor,以逐项清单返回判定——每个检查带显式状态标记、按 distro
|
|
365
364
|
分组、失败项下附可复制的修复——用户只要请求诊断即可。该工具按设计是交互式
|
|
366
365
|
的:`depth: "quick"`(默认)只跑前置项(单 distro 约 10 秒:宿主事实、会话
|
|
367
|
-
沙箱四件套、bubblewrap
|
|
366
|
+
沙箱四件套、bubblewrap,以及一次合并的可选工具探测——rg/git/inotifywait——
|
|
367
|
+
无冒烟、无 registry 查询、无端口勘察),是正确的
|
|
368
368
|
首次调用;`section` 把跟进收窄到一个区域(`host`、`sandbox`、`session`、
|
|
369
369
|
`conf`、`net`、`agent`);`depth: "full"` 是完整扫描,对所有检查负责。
|
|
370
370
|
`/wsl-doctor` 命令(`wsl-doctor-command` 行,部署具有命令注册表时注册)在
|
|
@@ -386,9 +386,8 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
|
|
|
386
386
|
无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
|
|
387
387
|
`--read-only` 拒绝与 `--fix` 或 `--install` 同用。
|
|
388
388
|
判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
请直接查看 `cordis.patch.yml` 与 Plugins 页面。
|
|
389
|
+
某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
|
|
390
|
+
桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
|
|
392
391
|
侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要,
|
|
393
392
|
并把完整运行动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
|
|
394
393
|
session scope、清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
|
package/docs/DIAGNOSTICS.md
CHANGED
|
@@ -107,12 +107,33 @@ posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
|
|
|
107
107
|
never reports. This is the only surface that depends on the model path; use
|
|
108
108
|
the command or the CLI when the plugin's runtime itself is under suspicion.
|
|
109
109
|
|
|
110
|
+
The quick profile carries the optional-tool probe (`tools.rg`, `tools.git`,
|
|
111
|
+
`tools.inotifywait`) in one combined spawn, so a missing `rg` is visible in
|
|
112
|
+
the panel before the model's first `grep`/`glob`; those ids live in the `host`
|
|
113
|
+
section, and the quick scope covers them.
|
|
114
|
+
|
|
110
115
|
One check is surface-dependent by construction: `session.preset-seam` reports
|
|
111
116
|
whether `auto-preset` could wrap the host's `agents.createSession` in this
|
|
112
117
|
process. That is host-process state, so the standalone CLI cannot see it; the
|
|
113
118
|
command, the panel and the model tool merge the row in. A missing row in a CLI
|
|
114
119
|
report means "not observable from a subprocess", not "the seam is fine".
|
|
115
120
|
|
|
121
|
+
`peers.versions` is surface-dependent for the same reason: it asks which peer
|
|
122
|
+
copies this process loads. The host runtime projects a linked plugin's declared
|
|
123
|
+
peers onto the installation's single copies, so the same plugin can load the
|
|
124
|
+
app's versions while a separate Node process resolves something else. Before
|
|
125
|
+
the check learned the plugin's peer position, the standalone CLI's native
|
|
126
|
+
lookup walked past the mirror into an older `node_modules` above it — the tree
|
|
127
|
+
an earlier harness installation left behind — and compared that tree's
|
|
128
|
+
versions. It now stops at the first position that declares the peer (the
|
|
129
|
+
plugin's own), counts the copy there, and reports every other peer as
|
|
130
|
+
unchecked, never as a failure. The in-app surfaces (panel, `/wsl-doctor`,
|
|
131
|
+
`wsl_doctor`) instead hand the versions this process resolved to the doctor
|
|
132
|
+
child in `DSH_WSL_DOCTOR_PEERS`. A present variable is authoritative even when
|
|
133
|
+
the map is partial or empty: the peers it omits could not be resolved by the
|
|
134
|
+
host, so they are unchecked rather than looked up again in the plugin's
|
|
135
|
+
physical tree.
|
|
136
|
+
|
|
116
137
|
## The map
|
|
117
138
|
|
|
118
139
|
Class legend:
|
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -85,6 +85,21 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
|
|
|
85
85
|
会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
|
|
86
86
|
结论。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,用命令或 CLI。
|
|
87
87
|
|
|
88
|
+
quick 档在一次合并探测中带上可选工具(`tools.rg`、`tools.git`、
|
|
89
|
+
`tools.inotifywait`),因此缺少 `rg` 会在模型第一次 `grep`/`glob` 之前就出现在
|
|
90
|
+
面板里;这些 id 属于 `host` 分区,也在 quick 档的覆盖范围内。
|
|
91
|
+
|
|
92
|
+
`peers.versions` 也按入口而异,因为它问的是本进程实际加载的对等包版本。宿主
|
|
93
|
+
运行时会把链接插件声明的 peer 投影到安装处的同一份副本上,所以同一份插件在
|
|
94
|
+
应用内加载的是应用自带的版本,而独立 Node 进程解析到的可能完全不同。修复前,
|
|
95
|
+
独立 CLI 的原生查找会越过镜像、落进其上方的旧 `node_modules`——上一次
|
|
96
|
+
harness 安装留下的树——并比较那棵树的版本。现在查找在第一个声明该 peer 的
|
|
97
|
+
位置(插件自身)停止,只计入那里的副本,其余记作 unchecked,而不是失败。
|
|
98
|
+
应用内入口(面板、`/wsl-doctor`、`wsl_doctor`)则把本进程解析出的版本经
|
|
99
|
+
`DSH_WSL_DOCTOR_PEERS` 交给 doctor 子进程;该变量一旦出现就是权威答案,即使
|
|
100
|
+
映射为空或只有部分项——缺失项说明宿主没有解析到,doctor 记作 unchecked,不再
|
|
101
|
+
回退到插件目录旁的本地副本。
|
|
102
|
+
|
|
88
103
|
## 地图
|
|
89
104
|
|
|
90
105
|
类别图例:
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -43,7 +43,12 @@ operations never use the 9p share.
|
|
|
43
43
|
required; a policy change pays one agent startup; a write granted to `/tmp` lands
|
|
44
44
|
in the distro's real `/tmp`.
|
|
45
45
|
- **`glob`/`grep` run the distro's rg**; a distro without rg fails the search
|
|
46
|
-
|
|
46
|
+
with exit 127, naming the program and the install remedy below — no silent
|
|
47
|
+
fallback, and not an opaque provider error; a missing working directory
|
|
48
|
+
fails explicitly too (rg's error code 2, because `1` means "no matches").
|
|
49
|
+
Commands and the resident agent both inherit `wsl.exe`'s default PATH, so a
|
|
50
|
+
user-local install under `~/.local/bin` is invisible — install it
|
|
51
|
+
system-wide, or somewhere on that PATH. Install: `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
47
52
|
git ripgrep inotify-tools` (or the detected family's spelling). `--install` runs it
|
|
48
53
|
only for a missing `bubblewrap`.
|
|
49
54
|
- **`watch()` is coarse invalidation, not per-file notifications**: inotify events
|
|
@@ -247,6 +252,13 @@ sandbox's security statement: `enforcement: partial` is untouched.
|
|
|
247
252
|
app. Two alternatives: the doctor's `git.win-safe` probe reports the state, and a
|
|
248
253
|
machine **without** Windows git needs nothing — the provider routes discovery into
|
|
249
254
|
the distro and translates the output into UNC form.
|
|
255
|
+
- **A distro without a system git never disguises change review as "no
|
|
256
|
+
changes"**: a snapshot call fails with exit 127, naming git, the agent
|
|
257
|
+
PATH's user-local blind spot (`~/.local/bin` is invisible), and the
|
|
258
|
+
bootstrap remedy; a missing snapshot directory fails in git's own dialect —
|
|
259
|
+
`fatal: cannot change to ...` at exit 128 — instead of returning an empty
|
|
260
|
+
result. The one-shot fallback translates the same relay lines
|
|
261
|
+
(`execvpe(git) failed`, `chdir(...) failed`) the same way.
|
|
250
262
|
- **A multi-directory `GIT_*` value is translated, not skipped — and a
|
|
251
263
|
Windows-form list comes out wrong.** The translation applies the single-value
|
|
252
264
|
translator to every `GIT_*` value unchecked, so a list folds onto the first
|
package/docs/LIMITATIONS.zh.md
CHANGED
|
@@ -39,8 +39,12 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
|
|
|
39
39
|
工作区之外以 `FS_SANDBOX_DENIED` 拒绝。代价:需要 `bubblewrap`;
|
|
40
40
|
策略变更要付出一次 agent 启动;授予 `/tmp` 的写入落在发行版真实的
|
|
41
41
|
`/tmp` 中。
|
|
42
|
-
- **`glob`/`grep` 使用发行版的 rg**;没有 rg
|
|
43
|
-
|
|
42
|
+
- **`glob`/`grep` 使用发行版的 rg**;没有 rg 的发行版搜索失败,
|
|
43
|
+
以退出码 127 报出程序名与下面的安装指引——不会静默回退,也不是不可读的
|
|
44
|
+
provider 错误;工作目录缺失同样显式失败(rg 的错误码 2,`1` 只表示"无
|
|
45
|
+
匹配")。命令与常驻 agent 都继承 `wsl.exe` 的默认 PATH,因此
|
|
46
|
+
`~/.local/bin` 下的用户级安装不可见——请装成系统级,或放在那个 PATH 上。
|
|
47
|
+
安装:`wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
44
48
|
git ripgrep inotify-tools`(或检测到的包管理族对应的写法)。`--install` 只在
|
|
45
49
|
缺少 `bubblewrap` 时才执行安装。
|
|
46
50
|
- **`watch()` 是粗粒度失效,不是逐文件通知**:inotify 事件合并到 0.5 s,
|
|
@@ -218,6 +222,12 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
|
|
|
218
222
|
应用。两个替代方案:doctor 的 `git.win-safe` 探针可报告该状态;而
|
|
219
223
|
**没有** Windows git 的机器什么都不用做——提供者把发现请求路由进
|
|
220
224
|
发行版,并把输出转写成 UNC 形式。
|
|
225
|
+
- **没有系统级 git 的发行版不会把变更审阅伪装成“无变更”**:快照调用以退出码
|
|
226
|
+
127 报出 git 无法启动、agent PATH 的成因(`~/.local/bin` 下的安装不可见)
|
|
227
|
+
与 bootstrap 安装指引;快照目录缺失则用 git 自身的
|
|
228
|
+
`fatal: cannot change to ...`(退出码 128)失败,而不是静默返回空结果。
|
|
229
|
+
一次性回退路径上的同类 relay 文本(`execvpe(git) failed`、`chdir(...) failed`)
|
|
230
|
+
做同样的翻译。
|
|
221
231
|
- **多目录 `GIT_*` 值会被转写而不是跳过——Windows 形态的列表会译坏。**
|
|
222
232
|
git 环境转写对每个 `GIT_*` 值无条件套用单值翻译,列表被折叠进首个盘符的
|
|
223
233
|
挂载点(`C:\a;D:\b` 变成 `/mnt/c/a;D:/b`);只有 POSIX 形态的冒号列表
|
package/docs/MIGRATION.md
CHANGED
|
@@ -97,8 +97,11 @@ ships through the tag workflow, but its notes say which gates were executed.
|
|
|
97
97
|
```bash
|
|
98
98
|
pnpm run preset --distro default --check <profile>/cordis.patch.yml # no nested-row trap
|
|
99
99
|
pnpm run doctor --json # effective environment facts
|
|
100
|
-
|
|
100
|
+
pnpm run e2e:install # packed install/upgrade/uninstall chain
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
The desktop app has no `dsh` command; the composed state is the profile's
|
|
104
|
+
`package.json` and `cordis.patch.yml`, read directly.
|
|
105
|
+
|
|
103
106
|
A profile that fails to boot after a migration should name the remedy in the
|
|
104
107
|
error; if it does not, that is a bug — report it with the `doctor --json` output.
|
package/docs/MIGRATION.zh.md
CHANGED
|
@@ -84,8 +84,11 @@ aarch64 qemu 是 CI 门禁。发布说明不得声称未运行的行,
|
|
|
84
84
|
```bash
|
|
85
85
|
pnpm run preset --distro default --check <profile>/cordis.patch.yml # 无嵌套行陷阱
|
|
86
86
|
pnpm run doctor --json # 生效的环境事实
|
|
87
|
-
|
|
87
|
+
pnpm run e2e:install # 打包安装/升级/卸载全链
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
桌面应用没有 `dsh` 命令;合成后的状态就是 profile 的 `package.json` 与
|
|
91
|
+
`cordis.patch.yml`,直接查看即可。
|
|
92
|
+
|
|
90
93
|
迁移后启动失败的 profile 应在错误中指明补救方法;若没有,那就是 bug——
|
|
91
94
|
请附上 `doctor --json` 输出报告它。
|
package/docs/PEER-PARITY.md
CHANGED
|
@@ -192,6 +192,22 @@ and `test/agent-protocol.test.mjs` (HELLO caps, FSERR, FSB encoding).
|
|
|
192
192
|
Divergence 4's binary/UTF-8 dialect note now also covers the patch path, which
|
|
193
193
|
re-reads through `readForEdit`.
|
|
194
194
|
|
|
195
|
+
## The check that reports this set
|
|
196
|
+
|
|
197
|
+
`peers.versions` names the versions the plugin is loaded against, which is not
|
|
198
|
+
always what a native lookup beside the runtime mirror finds. The host's profile
|
|
199
|
+
resolution projects this package's declared peers onto the installation's single
|
|
200
|
+
copies (a linked plugin's own `node_modules` is the input, not the answer), and
|
|
201
|
+
the in-app doctor spawners pass that resolved map to the CLI in
|
|
202
|
+
`DSH_WSL_DOCTOR_PEERS`; the variable's presence is authoritative even when the
|
|
203
|
+
map is partial or empty, so a peer the host could not resolve is unchecked
|
|
204
|
+
rather than looked up beside the mirror. The standalone CLI has no projection,
|
|
205
|
+
so it counts only a copy at the plugin's own peer position and reports every
|
|
206
|
+
other peer as unchecked instead of failing it — a stale `node_modules` above the
|
|
207
|
+
mirror (the previous harness installation's tree, for example) is not this
|
|
208
|
+
plugin's peer set. The versions above remain the ones the
|
|
209
|
+
standalone `pnpm run doctor` reports from this checkout's pinned dev set.
|
|
210
|
+
|
|
195
211
|
## Maintenance
|
|
196
212
|
|
|
197
213
|
When a peer floor or dev pin moves in `package.json`, re-run the comparison
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -7,9 +7,17 @@ This page is the entry point; every claim links to the document that owns it.
|
|
|
7
7
|
|
|
8
8
|
## 0. Do you need this plugin?
|
|
9
9
|
|
|
10
|
-
If the harness can run inside the distro, installing the CLI there
|
|
11
|
-
|
|
12
|
-
[README's decision table](../README.md#do-i-need-this-plugin) has the cases
|
|
10
|
+
If the harness can run inside the distro, installing the CLI there and
|
|
11
|
+
skipping this plugin is simpler — the
|
|
12
|
+
[README's decision table](../README.md#do-i-need-this-plugin) has the cases:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# inside the distro; the CLI needs Node >= 24.9
|
|
16
|
+
npm install -g @deepseek-ai/dsh
|
|
17
|
+
dsh web # browser UI, reached through WSL's localhost forwarding
|
|
18
|
+
dsh headless "run the tests" # one task, one answer, exit
|
|
19
|
+
```
|
|
20
|
+
|
|
13
21
|
The rest of this page assumes the desktop app stays on Windows and this plugin
|
|
14
22
|
supplies the WSL environment.
|
|
15
23
|
|
|
@@ -47,7 +55,8 @@ confirmation); `--fix-owned` restricts a fix run to the plugin-owned state
|
|
|
47
55
|
(the panel's repair action); `--bundle <path>` writes
|
|
48
56
|
the diagnostic file a setup report attaches (`--redact` strips the paths
|
|
49
57
|
from it). A run can be scoped — `--quick` probes the first-command
|
|
50
|
-
prerequisites
|
|
58
|
+
prerequisites plus one combined optional-tool probe (~10 s), `--sections
|
|
59
|
+
<list>` (comma-separated) runs the
|
|
51
60
|
named sections — or widened with `--all` to every installed distro; the
|
|
52
61
|
report itemizes every check with an explicit status marker, grouped by
|
|
53
62
|
distro. The fixed skeleton renders in the host's language
|
|
@@ -59,25 +68,23 @@ The desktop app has no `dsh` command; open **Plugins** in the sidebar, choose
|
|
|
59
68
|
**Add plugin**, and enter the exact package name `dsh-plugin-wsl-env`. That
|
|
60
69
|
writes the profile's `package.json` and its `dsh.profile.bundles` entry.
|
|
61
70
|
|
|
62
|
-
With the CLI distribution (`dsh` on `PATH`), from Windows PowerShell:
|
|
63
|
-
|
|
64
|
-
```powershell
|
|
65
|
-
dsh plugin --profile <profile> add dsh-plugin-wsl-env
|
|
66
|
-
# if it resolves to a stale version (same-day registry metadata cache), pin it:
|
|
67
|
-
# dsh plugin --profile <profile> add dsh-plugin-wsl-env@<latest>
|
|
68
|
-
dsh --profile <profile> --dump-config # the plugin rows must be there
|
|
69
|
-
```
|
|
70
|
-
|
|
71
71
|
For a profile that already overrides the preset, keep the override as the full
|
|
72
72
|
`preset-wsl` block — `pnpm run preset --check <patch>` fails loudly when a layer
|
|
73
73
|
targets `wsl-shell`/`wsl-fs` by id.
|
|
74
74
|
|
|
75
|
+
The plugin never edits the installed `resources/app.asar`: an app upgrade
|
|
76
|
+
cannot drop the bridge, and a plugin update only needs a reinstall and restart.
|
|
77
|
+
Upgrade = install again on the Plugins page, then restart (the harness has no
|
|
78
|
+
hot reload); uninstall happens on the same page, after which `~/.cache/dsh-wsl`
|
|
79
|
+
can be deleted. If you added a local `workspace-files-wsl` workaround to your
|
|
80
|
+
profile to restore previews, remove it after upgrading: the plugin no longer
|
|
81
|
+
mounts that row.
|
|
82
|
+
|
|
75
83
|
## 3. Open a WSL workspace
|
|
76
84
|
|
|
77
85
|
Start the desktop app the way its Start-menu shortcut does: `DeepSeek Harness.exe`,
|
|
78
86
|
no arguments — it opens the profile the app is configured with (the Plugins page
|
|
79
|
-
writes into that one).
|
|
80
|
-
profile of that name.)
|
|
87
|
+
writes into that one).
|
|
81
88
|
|
|
82
89
|
In the GUI, open a folder through the picker (`\\wsl.localhost\<distro>\home\<you>\proj`)
|
|
83
90
|
or an UNC path directly. The session's commands, file tools, terminal and previews
|
package/docs/QUICKSTART.zh.md
CHANGED
|
@@ -7,10 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
## 0. 需要这个插件吗?
|
|
9
9
|
|
|
10
|
-
如果 harness 可以整个跑在发行版里,把 CLI
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
如果 harness 可以整个跑在发行版里,把 CLI 装进去并跳过本插件会更简单——
|
|
11
|
+
判断表见 [README](README.zh.md#需要这个插件吗):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 在发行版内执行;CLI 要求 Node >= 24.9
|
|
15
|
+
npm install -g @deepseek-ai/dsh
|
|
16
|
+
dsh web # 浏览器界面,经 WSL 的 localhost 转发访问
|
|
17
|
+
dsh headless "run the tests" # 单任务、输出答案后退出
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
本页其余部分假定桌面应用留在 Windows,由本插件提供 WSL 环境。
|
|
14
21
|
|
|
15
22
|
## 1. 前置条件
|
|
16
23
|
|
|
@@ -40,7 +47,8 @@ agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
|
|
|
40
47
|
插件自有状态(面板的“修复”动作);
|
|
41
48
|
`--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact`
|
|
42
49
|
将其中的路径脱敏)。运行可以收窄范围——`--quick` 只探首条命令的前置项
|
|
43
|
-
|
|
50
|
+
与一次合并的可选工具探测(约 10 秒),`--sections <分区清单>`(逗号分隔)
|
|
51
|
+
只运行指定分区——
|
|
44
52
|
或用 `--all` 扩展到每个已装发行版;报告按 distro 分组逐项列出每个检查,
|
|
45
53
|
带显式状态标记。固定骨架按宿主语言渲染(`--locale <标签>` 或
|
|
46
54
|
`DSH_WSL_DOCTOR_LOCALE` 可覆盖检测)。
|
|
@@ -51,24 +59,19 @@ agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
|
|
|
51
59
|
`dsh-plugin-wsl-env` 安装。这一步写入该 profile 的 `package.json` 与
|
|
52
60
|
`dsh.profile.bundles`。
|
|
53
61
|
|
|
54
|
-
使用 CLI 发行版(`dsh` 在 `PATH` 上)时,在 Windows PowerShell 中:
|
|
55
|
-
|
|
56
|
-
```powershell
|
|
57
|
-
dsh plugin --profile <profile> add dsh-plugin-wsl-env
|
|
58
|
-
# 若解析到旧版本(发布当天的元数据缓存),显式指定:
|
|
59
|
-
# dsh plugin --profile <profile> add dsh-plugin-wsl-env@<latest>
|
|
60
|
-
dsh --profile <profile> --dump-config # 输出中必须包含插件的行
|
|
61
|
-
```
|
|
62
|
-
|
|
63
62
|
如果 profile 已覆盖 preset,请保持覆盖为完整的
|
|
64
63
|
`preset-wsl` 块——当某个层直接按 id 指向 `wsl-shell`/`wsl-fs` 时,
|
|
65
64
|
`pnpm run preset --check <patch>` 会明确报错。
|
|
66
65
|
|
|
66
|
+
插件不修改已安装的 `resources/app.asar`:应用升级不受影响,插件升级只需重新
|
|
67
|
+
安装并重启。升级 = 在 Plugins 页重新安装后重启(harness 无热重载);卸载也在
|
|
68
|
+
Plugins 页,之后可删 `~/.cache/dsh-wsl`。曾为恢复预览加过 `workspace-files-wsl`
|
|
69
|
+
临时覆盖的,升级后删除:插件不再挂载该行。
|
|
70
|
+
|
|
67
71
|
## 3. 打开 WSL 工作区
|
|
68
72
|
|
|
69
73
|
启动桌面应用的方式与它安装的快捷方式一致:`DeepSeek Harness.exe`,不带参数——
|
|
70
|
-
它打开的是应用自己配置的 profile(也就是 Plugins
|
|
71
|
-
发行版:`dsh --profile <名字>` 启动指定名字的 profile。)
|
|
74
|
+
它打开的是应用自己配置的 profile(也就是 Plugins 页面写入的那个)。
|
|
72
75
|
|
|
73
76
|
在 GUI 中,通过选择器打开文件夹(`\\wsl.localhost\<distro>\home\<you>\proj`),
|
|
74
77
|
或直接打开 UNC 路径。会话的命令、文件工具、终端和预览
|
package/docs/README.zh.md
CHANGED
|
@@ -6,61 +6,67 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/dsh-plugin-wsl-env)
|
|
7
7
|
[](../LICENSE)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
把 WSL 2 发行版变成 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 桌面会话的执行环境:命令、文件、终端都在发行版内运行,harness 留在 Windows。DeepSeek Harness 有两种形态——带 Web UI 的 npm CLI,与 macOS/Windows 桌面应用;本插件只服务其中一种组合:Windows 桌面应用 + WSL 2 中的项目。发行版内不装服务、不开端口;受限命令经 `bubblewrap` 沙箱。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+

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

|
|
14
14
|
|
|
15
|
-
**刚接触?** 从 [
|
|
15
|
+
**刚接触?** 从 [QUICKSTART.zh.md](QUICKSTART.zh.md) 开始。
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 为什么用这个插件
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
发行版里,直接在发行版终端运行。没有 UNC 路径、没有 9p 往返,也没有
|
|
21
|
-
Windows→发行版的 agent。
|
|
19
|
+
「agent 在 WSL 项目上反复失败时,让桌面应用直接在发行版环境里工作——不搬家、不装服务、不放弃沙箱。」
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
- 模型的强项是 POSIX,弱项是 CMD/PowerShell:Windows 工作区只能用弱项,WSL 工作区经 `wsl.exe` 逐条包装又丢失环境与状态。本插件让脚本在持久的发行版会话里原样运行。
|
|
22
|
+
- 命令跑在发行版登录 shell:`PATH`、`nvm`、`cargo`、`pyenv`、rc 文件全部生效。
|
|
23
|
+
- 发行版内无服务、无端口;唯一持久物是 `~/.cache/dsh-wsl/agent/` 下的 agent 缓存。
|
|
24
|
+
- 受限命令默认经 `bubblewrap`;缺 bwrap 时命令失败,不脱箱。
|
|
25
|
+
- 环境按会话生效:发行版目录会话进发行版,Windows 目录会话不变,可同进程并存。
|
|
26
|
+
- 与 GUI 集成:文件夹选择器列出发行版,终端在发行版内打开,模型可见监听端口。
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
完整论证(为什么是 Linux 而不是 PowerShell、价值与代价)见 [VALUE.zh.md](VALUE.zh.md)。
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|---|---|
|
|
34
|
-
| 工作区在 WSL 内,终端或浏览器界面够用 | 装在发行版里的 CLI |
|
|
35
|
-
| 想要 Windows 桌面应用,命令与文件落在发行版 | 本插件 |
|
|
36
|
-
| 同一会话要同时访问 Windows 与 WSL 工作区 | 本插件(按路径路由正是它的价值) |
|
|
30
|
+
## 安装
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
管理它的插件——桌面场景请用应用内的 Plugins 页面。[VALUE.zh.md](VALUE.zh.md)
|
|
40
|
-
有完整对照和"不适用"清单。
|
|
32
|
+
桌面应用没有 `dsh` 可执行程序;插件经 **Plugins** 页安装。三步:
|
|
41
33
|
|
|
42
|
-
|
|
34
|
+
1. `wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap`
|
|
35
|
+
2. Plugins 页:**Add plugin** → `dsh-plugin-wsl-env`,启用。
|
|
36
|
+
3. 重启应用,打开发行版内的文件夹;输入 `/wsl-doctor`(宿主侧执行)得到 `ready`/`blocked` 裁决。
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
其余前置(发行版内不需要 Node.js):
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
40
|
+
| 前置 | 说明 |
|
|
41
|
+
|---|---|
|
|
42
|
+
| Windows 10/11 + WSL 2 + ≥1 个发行版 | `wsl.exe -l -v` 显示 `VERSION 2`;缺则 `wsl.exe --install` |
|
|
43
|
+
| systemd + Linger(默认会话沙箱需要) | `/etc/wsl.conf` 设 `[boot] systemd=true`,`wsl --shutdown`,执行一次 `loginctl enable-linger "$USER"`;无 systemd 时设 `sessionSandbox` 为 `auto` 或 `false` |
|
|
44
|
+
| 可选:`ripgrep`、`git`、`inotify-tools` | `pnpm run bootstrap <发行版>` 打印安装命令 |
|
|
51
45
|
|
|
52
|
-
|
|
46
|
+
插件不修改已安装的 `resources/app.asar`。升级 = 重新安装后重启;卸载在 Plugins 页面,之后可删 `~/.cache/dsh-wsl`。细节见 [QUICKSTART.zh.md](QUICKSTART.zh.md)。
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
## 需要这个插件吗?
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
- **工具链支持。** Node、Python、Rust、Go、C/C++ 和多数构建系统先在 Linux 上验证。Windows 支持往往是移植,引号、路径、换行和文件锁都不一样。
|
|
58
|
-
- **Shell 语义。** PowerShell 和 `cmd` 在引号、转义、管道、环境变量、退出码和路径分隔符上都与 POSIX 不同。混用两套语法,很容易产生看起来像模型犯的低级错误。
|
|
59
|
-
- **环境漂移。** Windows 侧的 PowerShell 版本、执行策略、PATH 和已装工具因人而异;Linux 环境更容易复现和容器化。
|
|
50
|
+
harness 能整个跑在发行版里时,不用本插件更简单:把 CLI 装进发行版即可(命令见 [QUICKSTART §0](QUICKSTART.zh.md))。harness 必须留在 Windows 时才用本插件:
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
| 场景 | 用什么 |
|
|
53
|
+
|---|---|
|
|
54
|
+
| 终端或浏览器界面够用 | 发行版内的 CLI |
|
|
55
|
+
| 要 Windows 桌面应用,命令与文件在发行版 | 本插件 |
|
|
56
|
+
| 一个会话同时访问 Windows 与 WSL 目录 | 本插件 |
|
|
62
57
|
|
|
63
|
-
|
|
58
|
+
坑:`desktop` profile 名由 Electron 应用独占,npm CLI 拒绝管理它的插件——用应用内 Plugins 页。完整对照见 [VALUE.zh.md](VALUE.zh.md)。
|
|
59
|
+
|
|
60
|
+
## 使用
|
|
61
|
+
|
|
62
|
+
打开发行版文件夹作为工作区,如 `\\wsl.localhost\ubuntu\home\you\project`。
|
|
63
|
+
|
|
64
|
+
- 打开哪个发行版的文件夹,就在哪个发行版执行。
|
|
65
|
+
- 命令在发行版登录 shell 中运行;`/home/you/x` 与 `\\wsl.localhost\ubuntu\home\you\x` 是同一文件。
|
|
66
|
+
- **New terminal** 在同一发行版、同一目录打开 shell。
|
|
67
|
+
- 模型可见监听端口并返回 dev server URL(WSL 2 转发 localhost)。
|
|
68
|
+
- 权限:`read-only` / `workspace-write`(默认)/ `danger-full-access`;只有最后一档不经沙箱。
|
|
69
|
+
- 侧边栏 **WSL 环境** 面板按发行版诊断,见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
|
64
70
|
|
|
65
71
|
## 方案对比
|
|
66
72
|
|
|
@@ -71,127 +77,36 @@ Windows 上的编程工具要在 WSL 项目中工作,有三条路:把整个
|
|
|
71
77
|
| 命令沙箱 | 无 | `bubblewrap` |
|
|
72
78
|
| 卸载 | 删除服务 | 删除缓存 |
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## 要求
|
|
77
|
-
|
|
78
|
-
- Windows 10 或 11,启用 WSL 2,并至少有一个发行版。
|
|
79
|
-
- 发行版内安装 `bubblewrap`,必需。
|
|
80
|
-
- 默认的会话沙箱需要 systemd:在 `/etc/wsl.conf` 设置 `[boot] systemd=true`,重启 WSL,然后执行一次 `loginctl enable-linger "$USER"`。没有 systemd 时,在 `wsl-shell` 和 `wsl-fs` 上把 `sessionSandbox` 设为 `auto`(可用时仍用 scope,否则每条命令单独约束)或显式 `false`。
|
|
81
|
-
- 可选:`ripgrep` 用于搜索,`git` 用于变更快照,`inotify-tools` 用于文件监视。
|
|
82
|
-
|
|
83
|
-
发行版内不需要 Node.js。
|
|
84
|
-
|
|
85
|
-
## 安装
|
|
86
|
-
|
|
87
|
-
Windows 桌面应用**没有 `dsh` 可执行程序**:安装器只写 `DeepSeek Harness.exe`,
|
|
88
|
-
CLI 入口在 `resources/app.asar` 内部(探针脚本通过 `ELECTRON_RUN_AS_NODE` 启动它)。
|
|
89
|
-
按你手上的发行版二选一。
|
|
90
|
-
|
|
91
|
-
**桌面应用**:在侧边栏打开 **插件**,点 **Add plugin**,填精确包名
|
|
92
|
-
`dsh-plugin-wsl-env` 并启用。插件管理器写入当前 profile 的 `package.json`
|
|
93
|
-
(依赖项与 `dsh.profile.bundles`),与下面的 CLI 命令得到的状态一致。从检出
|
|
94
|
-
目录运行时,改为以链接形式添加该目录。启动方式与安装器创建的快捷方式一致:
|
|
95
|
-
`DeepSeek Harness.exe`,不带参数。桌面应用打开的是它自己配置的 profile——也就是
|
|
96
|
-
Plugins 页面写入的那个;要用别的 profile 属于 CLI 发行版的事
|
|
97
|
-
(`dsh --profile <名字>`)。
|
|
98
|
-
|
|
99
|
-
**不对宿主打补丁。** 插件从不修改已安装的 `resources/app.asar`。
|
|
100
|
-
**在 VS Code 中打开(WSL)** 的桥完全在插件行内,因此应用升级不会丢掉它,
|
|
101
|
-
插件升级也只需重新安装并重启——没有重新打 archive 补丁的步骤。应用自带的
|
|
102
|
-
"Open in app" 是独立的上游缺陷,见
|
|
103
|
-
[docs/UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md)。
|
|
104
|
-
|
|
105
|
-
**CLI 发行版**(`dsh` 在 `PATH` 上),在 Windows 终端执行:
|
|
106
|
-
|
|
107
|
-
```powershell
|
|
108
|
-
dsh wsl --from-default-profile web --dump-config # 创建 profile
|
|
109
|
-
dsh plugin --profile wsl add dsh-plugin-wsl-env # 安装插件及其配置
|
|
110
|
-
dsh --profile wsl --dump-config # 检查:输出 "# == dsh-plugin-wsl-env"
|
|
111
|
-
dsh --profile wsl # 启动
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
第一条命令之前安装 `bubblewrap`:
|
|
115
|
-
|
|
116
|
-
```powershell
|
|
117
|
-
wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
在插件检出目录中,`pnpm run doctor` 是一键环境体检:Windows/WSL 平台、每个发行版的 WSL 模式与身份、`.wslconfig` 与 `/etc/wsl.conf` 交叉核对、发行版与宿主卷、时钟与 DNS、bubblewrap 可用性、systemd / user manager / Linger、可选工具、peer 版本、native agent 与其缓存、新 agent 握手、证明链路完好的 shell 冒烟腿(帧 I/O、受限围栏、批量 substrate)与一条 native HELLO 腿、残留会话 scope、已知的 profile 补丁与废弃键陷阱。报告逐项列出每个检查——按 distro 分组,每项带显式状态标记,失败项下附可复制的处理办法——并以裁决收尾:`ready`(本次运行覆盖的检查全部通过,不保证每条命令都成功)或 `blocked`(列明待修项),按生效配置计算。运行可以收窄范围:`--quick` 只探首条命令的前置项(约 10 秒),`--sections <分区清单>`(逗号分隔)只运行指定分区,且范围化报告会把未运行的检查显式列为跳过项。`--json` 供脚本使用;`--fix` 会复核它修过的项——插件自有的残留 scope 清扫与 agent 缓存清理是安全自动的,安装包需要 `--fix --install` 并显式确认,`--fix-owned` 只运行插件自有的这两类(即侧边栏面板的“修复”动作)——`--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact` 将路径脱敏)。固定骨架按宿主语言渲染——从 Windows 区域设置检测,可用 `--locale <标签>` 或 `DSH_WSL_DOCTOR_LOCALE` 覆盖;`--json` 保持语言无关。同一份报告经三个入口给出:本 CLI、`/wsl-doctor` 命令(在输入框输入——宿主侧执行,不进模型对话)、以及 `wsl_doctor` 模型工具(进程内采集,合并常驻 agent 的实时状态)。`DSH_WSL_DOCTOR` 还携带一条现成命令(`sh -c "$DSH_WSL_DOCTOR --json"`),可在发行版内直接重放 doctor。`pnpm run diagnose` 是 CLI 的只读别名。`pnpm run bootstrap <发行版>` 仍是较窄的工具安装助手。
|
|
121
|
-
|
|
122
|
-
插件大约每天自行检查一次更新(启动后 2–10 分钟内首查),方式是询问应用的插件管理器——它从不自行联网。当存在更新的稳定版时,每个发行版会话中受管的 `DSH_WSL_PLUGIN_UPDATE` 变量会携带该事实;补丁配置里的 `wsl-update-check.enabled: false` 可关闭该检查。升级保持手动,因为 harness 没有热重载:重新安装(Plugins 页面或 `add` 命令),然后重启。
|
|
123
|
-
|
|
124
|
-
卸载:在 Plugins 页面移除,或在 CLI 发行版执行 `dsh plugin --profile wsl remove dsh-plugin-wsl-env`;之后可删除 `~/.cache/dsh-wsl`。如果你为了恢复预览在 profile 里加过 `workspace-files-wsl` 的临时覆盖,升级后请删掉:插件不再挂载该行。
|
|
125
|
-
|
|
126
|
-
## 使用
|
|
127
|
-
|
|
128
|
-
打开一个发行版文件夹作为工作区,例如 `\\wsl.localhost\ubuntu\home\you\project`。
|
|
129
|
-
|
|
130
|
-
- 打开哪个发行版的文件夹,就在哪个发行版执行——即使它不是 WSL 的默认发行版。
|
|
131
|
-
- 命令在发行版登录 shell 中运行。`/home/you/x` 与 `\\wsl.localhost\ubuntu\home\you\x` 是同一个文件。
|
|
132
|
-
- **New terminal** 在同一发行版、同一目录打开 shell。
|
|
133
|
-
- 模型能看到监听端口,并返回 dev server 的 URL。WSL 2 会把 localhost 转发到 Windows。
|
|
134
|
-
- 权限选择器:`read-only`、`workspace-write`(默认)、`danger-full-access`。只有 `danger-full-access` 不经过沙箱。
|
|
135
|
-
- 侧边栏的 **WSL 环境** 面板是诊断页:列出已安装的发行版,可对单个发行版运行 doctor 快速检查(bwrap / systemd / Linger 等前置项),并提供一次完整运行(`--fix-owned`,存在插件可修复项时标为 **修复**,否则标为 **完整检查**)——清扫残留 session scope、清理损坏的 agent 缓存并逐一复检,不安装软件包、不改写 Windows 配置;其余告警保留各自的手动处理办法。每个已检查的行还显示上次检查时间、来源(**手动** 或页面加载时的 **后台** 复核)与结果结构——各状态计数与分区分布。每个已检查的行还可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据(快速检查未触及的目录项只计数、不伪装成结果),绿色或异常的行都能被审计而不只是被相信。不必再打开 doctor 就能决定下一步。每个发行版的最后一次结果保存在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`(缺省回退到 `~/.dsh`),页面刷新或应用重启后仍可见;加载时只对正在运行的发行版在后台复核(不会启动已停止的发行版),后台运行失败会按实际观测覆盖已存结果。不标记“已过期”:时间戳就是时间戳。经 **添加工作区** 选中发行版目录时,会问一次 **Remote WSL**(默认,发行版内执行)还是 **Windows 访问**(按 9p 共享打开,没有 Linux 工具链),后者记录在 `auto-preset` 行的 `windowsWorkspaces` 中。这些记录下来的目录也会出现在能感知后果的位置:运行非 WSL preset 的发行版工作区会在输入框上方常驻一条警示(会话尚未开始时可一键切换;已开始后可修正访问记录),会话页头在警示收起后保留 **WSL工作区正以Windows模式打开** 小标记,面板里也列出已记录的目录供审计。
|
|
80
|
+
桌面远程更成熟;CLI 装进 WSL 更简单。本插件用于:harness 留在 Windows,且命令需要沙箱。
|
|
136
81
|
|
|
137
82
|
## 配置
|
|
138
83
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
| 行 | 键 | 默认值 | 作用 |
|
|
142
|
-
|---|---|---|---|
|
|
143
|
-
| `wsl-shell` | `distro` | `''` | 发行版模式;空/`auto` 跟随工作区,`default` 强制 WSL 默认 |
|
|
144
|
-
| | `sandbox` | `true` | 用 `bubblewrap` 约束命令 |
|
|
145
|
-
| | `sessionSandbox` | `false`;随包 `true` | 会话命令跑在同一个 systemd user scope 中 |
|
|
146
|
-
| | `agentBackend` | `auto` | 发行版内 agent:`auto`、`native` 或 `shell` |
|
|
147
|
-
| | `maskWindowsDrive` | `false` | 让受限命令看不到 `/mnt` |
|
|
148
|
-
| | `writableRoots` | `[]` | 额外可写的发行版目录(工具链缓存等;`wsl-fs` 上配同一列表) |
|
|
149
|
-
| `wsl-fs` | `distro` | `''` | 发行版模式;空/`auto` 跟随每个目标路径 |
|
|
150
|
-
| | `restrictToDistro` | `true` | 固定发行版(`default` 或名字)时拒绝属于其他发行版的路径 |
|
|
151
|
-
| | `sandbox` | `true` | 按策略检查受限写入 |
|
|
152
|
-
| | `sessionSandbox` | `false`;随包 `true` | 受限写入跑在会话 runtime 中 |
|
|
153
|
-
| | `substrate` | `agent` | 发行版内 agent;`share` 在启动时被拒绝 |
|
|
154
|
-
| | `writableRoots` | `[]` | 与 `wsl-shell` 相同的额外可写目录列表 |
|
|
155
|
-
| `directory-picker-wsl` | `includeHostHome` | `true` | 同时提供 Windows 路径分支(从驱动器开始) |
|
|
156
|
-
| `subprocess-wsl` | `distro` | `''` | 发行版模式;空/`auto` 跟随启动目录 |
|
|
157
|
-
| `wsl-preflight` | `distro` | `''` | 环境检查探测的发行版;空/`auto` 跟随会话工作区 |
|
|
158
|
-
| | `startup` | `true` | 插件加载时预先运行同一组检查,让判定在任何会话打开之前就出现在日志里 |
|
|
159
|
-
|
|
160
|
-
`fs-routing` 是根级 `ctx.fs` 调用的顶层路由:它的发行版设置独立于 `wsl-fs`,也是按 id 在顶层补丁中覆盖的行。`wsl-shell` 和 `wsl-fs` 位于随包的 `wsl` preset 中,按 id 覆盖无效。要改就覆盖整个 `preset-wsl` 行;配方和其余键见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md)。[`cordis.patch.yml`](../cordis.patch.yml) 是随包值的注释参考。
|
|
84
|
+
配置在 `$DSH_HOME/profiles/<名字>/cordis.patch.yml` 的命名行上。`wsl-shell`/`wsl-fs` 嵌套在 `preset-wsl` 里,按 id 覆盖无效,须整行覆盖。全部键与配方见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md);[`cordis.patch.yml`](../cordis.patch.yml) 是随包值的注释参考。
|
|
161
85
|
|
|
162
86
|
## 架构
|
|
163
87
|
|
|
164
|
-
一个 harness 进程可同时服务 Windows 文件夹会话和发行版文件夹会话。服务分两层挂载:
|
|
165
|
-
|
|
166
88
|
```text
|
|
167
|
-
|
|
89
|
+
应用层(每进程)
|
|
168
90
|
├─ directory-picker-wsl、workspace-files、subprocess-wsl
|
|
169
|
-
├─ fs-routing
|
|
170
|
-
└─ auto-preset
|
|
91
|
+
├─ fs-routing:根级文件系统按路径分流
|
|
92
|
+
└─ auto-preset:会话打开发行版目录时绑定 wsl preset
|
|
171
93
|
|
|
172
|
-
wsl preset
|
|
94
|
+
wsl preset(每会话)
|
|
173
95
|
├─ wsl-shell:命令
|
|
174
96
|
└─ wsl-fs:文件操作
|
|
175
97
|
```
|
|
176
98
|
|
|
177
|
-
|
|
178
|
-
- `wsl-fs` 通过同一个发行版内 agent 提供读写。受限写入运行在 mount profile 与策略一致的常驻 agent 中,由内核执行写入边界。没有宿主机侧的文件回退:agent 不可用时文件操作直接失败。
|
|
179
|
-
- GUI 文件树和预览使用随包的 `workspace-files` 行,而不是插件的替换行:它的客户端半边是浏览器的 `file` 资源提供者。WSL 路径经根级路由读取,仍在发行版内,但会多几次 agent 往返。
|
|
180
|
-
- 应用层服务按路径分流:发行版 UNC 路径走发行版,Windows 盘符路径留在宿主。见 [docs/root-fs-routing.md](root-fs-routing.md)。
|
|
99
|
+
命令与文件走发行版内常驻 agent(systemd user scope + `bubblewrap` profile)。发行版 UNC 路径进发行版,盘符路径留宿主。详见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md)。
|
|
181
100
|
|
|
182
101
|
## 沙箱
|
|
183
102
|
|
|
184
103
|
| 模式 | 命令可以做什么 |
|
|
185
104
|
|---|---|
|
|
186
|
-
| `read-only` |
|
|
187
|
-
| `workspace-write` |
|
|
188
|
-
| `danger-full-access` |
|
|
189
|
-
|
|
190
|
-
设置 `sessionSandbox: false` 时,`workspace-write` 命令使用私有的 `/tmp`,而不是发行版的真实 `/tmp`;`read-only` 不挂载可写的 `/tmp`。
|
|
105
|
+
| `read-only` | 读整个发行版;仅新挂载的 `/dev`,其余不可写 |
|
|
106
|
+
| `workspace-write` | 加上会话工作区与配置的 `writableRoots` |
|
|
107
|
+
| `danger-full-access` | 不经沙箱 |
|
|
191
108
|
|
|
192
|
-
`bubblewrap`
|
|
193
|
-
|
|
194
|
-
隔离上报为 `partial`。发行版内的命令仍可通过 `/mnt/c` 启动 Windows 程序,`bubblewrap` 无法控制 Windows 进程。`maskWindowsDrive: true` 让受限视图看不到 `/mnt`,但会被 `interopVisibility: visible` 覆盖;遮罩只能收窄这个洞,不能关死。关闭 WSL interop 需要另行在发行版的 `/etc/wsl.conf` 中设置 `[interop] enabled=false`。见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#沙箱) 和 [SECURITY.zh.md](../SECURITY.zh.md)。
|
|
109
|
+
缺 `bubblewrap` 时受限命令报 `SANDBOX_UNAVAILABLE`,不运行。隔离为 `partial`:发行版内进程仍可经 `/mnt/c` 启动 Windows 程序。详见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#沙箱) 与 [SECURITY.zh.md](../SECURITY.zh.md)。
|
|
195
110
|
|
|
196
111
|
## 常见问题
|
|
197
112
|
|
|
@@ -199,13 +114,13 @@ wsl preset(每个会话)
|
|
|
199
114
|
|---|---|
|
|
200
115
|
| 每条命令都报 `SANDBOX_UNAVAILABLE` | 在发行版内安装 `bubblewrap`,或设置 `sandbox: false` |
|
|
201
116
|
| 会话在第一条命令前就被拒绝 | 运行 `pnpm run doctor`;启用 systemd 和 linger,或把 `wsl-shell`、`wsl-fs` 上的 `sessionSandbox` 设为 `auto` 或 `false` |
|
|
202
|
-
| 发行版内 `glob`、`grep`
|
|
117
|
+
| 发行版内 `glob`、`grep` 很慢,或以退出码 127 失败(没有 `rg`) | 运行 `pnpm run bootstrap <发行版>`,使用打印的安装命令安装 `ripgrep`;`~/.local/bin` 下的用户级安装不在命令使用的 PATH 上 |
|
|
203
118
|
| `npm install` / `pnpm add` 报 `EROFS` | 沙箱默认只授予工作区;在 `wsl-shell` 和 `wsl-fs` 上配置 `writableRoots`(如 `~/.npm`、`~/.cache`、`~/.local/share/pnpm`),见 [CONFIGURATION](CONFIGURATION.zh.md#工具链缓存与额外可写目录) |
|
|
204
|
-
|
|
|
119
|
+
| Plugins 页面装完没有任何日志 | 以 profile 的 `package.json` 与 `dsh.profile.bundles` 为准:列出插件即安装成功 |
|
|
205
120
|
| 对 `wsl-shell`/`wsl-fs` 的 profile 补丁不生效 | 这些行嵌套在 `preset-wsl` 里。运行 `pnpm run preset --check <补丁>`;它会失败并输出需要粘贴的完整块 |
|
|
206
121
|
| 改了 `lib/` 但不生效 | 运行 `pnpm run sync:windows`,然后重启应用 |
|
|
207
122
|
|
|
208
|
-
|
|
123
|
+
更多错误码见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#错误码),插件不做的事见 [LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
|
|
209
124
|
|
|
210
125
|
## 开发
|
|
211
126
|
|
|
@@ -217,9 +132,7 @@ pnpm run test:coverage # 带覆盖率阈值的单元测试
|
|
|
217
132
|
pnpm run sync:windows # 更新应用加载的 Windows 侧副本
|
|
218
133
|
```
|
|
219
134
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) 和 `test/probe/`。
|
|
135
|
+
Node `^22.19.0 || >=24.0.0`;`src/` 是 TypeScript,`lib/` 是提交进仓的构建产物。真机探针仅 Windows + WSL。见 [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) 与 `test/probe/`。
|
|
223
136
|
|
|
224
137
|
## 文档
|
|
225
138
|
|