dsh-plugin-wsl-env 0.24.0 → 0.26.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 +136 -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 +18 -6
- package/SECURITY.md +12 -0
- package/SECURITY.zh.md +108 -0
- package/SUPPORT.md +2 -0
- package/SUPPORT.zh.md +99 -0
- package/client.js +409 -8
- package/cordis.patch.yml +17 -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 +30 -9
- package/docs/ARCHITECTURE.zh.md +511 -0
- package/docs/COMPATIBILITY.md +2 -0
- package/docs/COMPATIBILITY.zh.md +117 -0
- package/docs/CONFIGURATION.md +45 -2
- package/docs/CONFIGURATION.zh.md +39 -3
- package/docs/DIAGNOSTICS.md +12 -2
- package/docs/DIAGNOSTICS.zh.md +5 -1
- package/docs/LIMITATIONS.md +60 -9
- package/docs/LIMITATIONS.zh.md +45 -9
- package/docs/MIGRATION.md +6 -3
- package/docs/MIGRATION.zh.md +91 -0
- package/docs/PEER-PARITY.md +63 -51
- package/docs/PERFORMANCE.md +2 -0
- package/docs/PERFORMANCE.zh.md +59 -0
- package/docs/QUICKSTART.md +21 -6
- package/docs/QUICKSTART.zh.md +16 -4
- package/docs/README.zh.md +28 -19
- package/docs/RELEASING.md +19 -14
- package/docs/REQUIREMENTS.zh.md +6 -3
- package/docs/ROADMAP-1.0.md +1 -1
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
- package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
- package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
- package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
- package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
- package/docs/VALUE.md +146 -0
- package/docs/VALUE.zh.md +15 -13
- package/docs/root-fs-routing.md +1 -1
- package/lib/agent-confined.d.ts +7 -1
- package/lib/agent-confined.js +3 -3
- 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/bwrap.d.ts +14 -0
- package/lib/bwrap.js +11 -0
- package/lib/cwd-prompt.d.ts +41 -3
- package/lib/cwd-prompt.js +125 -8
- package/lib/doctor-live.d.ts +30 -0
- package/lib/doctor-live.js +37 -0
- package/lib/doctor-report.d.ts +50 -0
- package/lib/doctor-report.js +172 -0
- package/lib/fs-routing.d.ts +1 -1
- package/lib/fs-routing.js +1 -1
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +1 -1
- package/lib/index.d.ts +6 -1464
- package/lib/index.js +5 -2120
- package/lib/messages.d.ts +20 -1
- package/lib/messages.js +31 -3
- package/lib/open-in-app.d.ts +206 -0
- package/lib/open-in-app.js +300 -0
- package/lib/preflight.d.ts +7 -4
- package/lib/preflight.js +27 -13
- package/lib/preset-choice.d.ts +13 -0
- package/lib/preset-choice.js +18 -1
- package/lib/provider-common.d.ts +58 -0
- package/lib/provider-common.js +123 -0
- package/lib/sandbox-core.d.ts +1 -0
- package/lib/sandbox-core.js +4 -2
- package/lib/session-runtime.d.ts +7 -1
- package/lib/session-runtime.js +9 -2
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/status.js +2 -1
- package/lib/writable-roots.d.ts +109 -0
- package/lib/writable-roots.js +257 -0
- package/lib/wsl-doctor-command.js +2 -1
- package/lib/wsl-doctor-tool.js +2 -2
- package/lib/wsl-filesystem.d.ts +692 -0
- package/lib/wsl-filesystem.js +897 -0
- package/lib/wsl-shell.d.ts +742 -0
- package/lib/wsl-shell.js +965 -0
- package/lib/wsl.d.ts +1 -1
- package/lib/wsl.js +1 -1
- package/package.json +48 -24
- package/scripts/doctor.mjs +1 -1
- package/scripts/profile-preset.mjs +17 -5
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# 配置稳定性与迁移
|
|
2
|
+
|
|
3
|
+
[English](MIGRATION.md)
|
|
4
|
+
|
|
5
|
+
发布可以改变什么、破坏性的配置变更如何公布与承接,以及发布必须通过哪些门禁。
|
|
6
|
+
[RELEASING.md](RELEASING.md#1-decide-the-version) 中的版本表是版本号递增的依据;本页是这些递增所遵循的约定。
|
|
7
|
+
|
|
8
|
+
## 1.0 以下的冻结
|
|
9
|
+
|
|
10
|
+
包版本低于 `1.0.0`,因此磁盘上的 profile 格式与 peer 钉版仍可能在 **minor** 中变动。
|
|
11
|
+
在这一自由度内:
|
|
12
|
+
|
|
13
|
+
- **新增配置键属于 minor。** 该键必须带一个保持既有行为的 schema 默认值;
|
|
14
|
+
仅因存在就改变行为的键属于 major 形态的变更,需要等待。
|
|
15
|
+
- **删除或重命名键属于 major**,*或*属于带启动时拒绝并指明迁移方式的 minor(见下文)。
|
|
16
|
+
绝不允许静默接受已退役的键:`preset-wsl` 陷阱与 `substrate` 拒绝的存在,
|
|
17
|
+
正是为了防止这类失败。
|
|
18
|
+
- **改变键的含义属于带迁移说明的 minor**,因为按旧含义写成的 profile 仍会继续启动。
|
|
19
|
+
说明必须指出改了什么、如何保留旧姿态,以及行为在何处不同。
|
|
20
|
+
- **peer 兼容性按区间声明。** DSH peer 依赖声明下限;开发依赖精确钉版。
|
|
21
|
+
新的上游 peer 版本线由 [peer canary](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/workflows/peer-canary.yml) 测试;
|
|
22
|
+
受测基线或支持区间的变化应写入发布说明。
|
|
23
|
+
- **工具名与错误码是 API。** `FS_OUTSIDE_DISTRO`、`SANDBOX_UNAVAILABLE`、
|
|
24
|
+
`FS_STALE_VERSION` 以及诊断脚本(`doctor`、`diagnose`、`preset`、`bootstrap`)
|
|
25
|
+
保留名称与契约;重命名遵循下文的弃用路径。
|
|
26
|
+
|
|
27
|
+
## 弃用配置值
|
|
28
|
+
|
|
29
|
+
1. **在引入弃用的版本中公布**:一条 CHANGELOG 记录,以及
|
|
30
|
+
[CONFIGURATION.md](CONFIGURATION.zh.md) 中的对应行。旧值在该版本中继续可用。
|
|
31
|
+
2. **含义无歧义时,保留旧写法一个 minor。** 若保留旧写法会静默改变行为,
|
|
32
|
+
则改为在启动时拒绝并打印迁移方式——`substrate: "share"` 即属此例:
|
|
33
|
+
该值被拒绝,消息要求删除该行,因为提供 share 恰恰是插件绝不能做的事。
|
|
34
|
+
3. **在下一个 minor 中移除**,并附另一条 CHANGELOG 记录。发布说明指明拒绝出现的版本。
|
|
35
|
+
|
|
36
|
+
### 案例:`distro: ''`(0.12.0)
|
|
37
|
+
|
|
38
|
+
`distro: ''` 过去表示“WSL 的默认发行版”。0.12.0 让空值表示 **auto**:
|
|
39
|
+
跟随请求工作目录的 UNC 发行版。依赖旧含义的 profile 仍能启动,但行为已经不同。
|
|
40
|
+
迁移方式:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
# 保留旧姿态:所有命令都在 WSL 的默认发行版中执行
|
|
44
|
+
- id: preset-wsl
|
|
45
|
+
config:
|
|
46
|
+
plugins:
|
|
47
|
+
# … 完整块;两行都要设置 …
|
|
48
|
+
- id: wsl-shell
|
|
49
|
+
config:
|
|
50
|
+
distro: default
|
|
51
|
+
- id: wsl-fs
|
|
52
|
+
config:
|
|
53
|
+
distro: default
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`pnpm run preset --distro default` 会打印该块,供手动合并。
|
|
57
|
+
`--out` 会替换整个目标文件,包括无关的覆盖项;
|
|
58
|
+
见 [CONFIGURATION.md](CONFIGURATION.zh.md#配置-wsl-shell-和-wsl-fs)。0.12.0 的 CHANGELOG
|
|
59
|
+
记录说明了该变更;本页是持久副本。`doctor` 在其 host/distro 行中报告生效的
|
|
60
|
+
发行版模式,`--dump-config` 显示合成后的值。
|
|
61
|
+
|
|
62
|
+
## 发布必须通过的门禁
|
|
63
|
+
|
|
64
|
+
| 门禁 | 方式 | 运行位置 |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| 配置文档与 CHANGELOG 为最新 | 审查 diff;`lint:links` 覆盖交叉引用 | CI |
|
|
67
|
+
| `pnpm test` | 风格、链接、需求引用、文档一致性、语法、构建新鲜度、tsc 与单元测试文件 | CI(Node 22/24,Ubuntu + Windows) |
|
|
68
|
+
| `pnpm run test:coverage` | 行 85 / 分支 84 / 函数 70 | CI(Node 24,Ubuntu) |
|
|
69
|
+
| `pnpm run test:browser` | 无头 Chromium 中的插件 web bundle(布局、点击、badge 时序);安装一次 Chromium | CI(`browser` job,Ubuntu)与发布的 `Gates` |
|
|
70
|
+
| peer 版本线受测 | 下限 `>=0.2.2-rc.2`;`peer-canary` 工作流解析 `next` 并运行临时升级 | CI 定时/手动 |
|
|
71
|
+
| 打包安装/升级/卸载 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker) | 手动,本机(2026-11-06 为 10/10;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
|
|
72
|
+
| 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17 |
|
|
73
|
+
| 干净 Win11 + Ubuntu 首次运行 ≤ 5 分钟 | 干净机器、秒表 | **未运行**(项目机器已配置) |
|
|
74
|
+
| aarch64 已执行 | CI 中 qemu 下的 native 18 项检查套件 | **已在 CI 运行**(物理 aarch64 WSL 不在范围内;见 COMPATIBILITY.md) |
|
|
75
|
+
| 30 天内无未关闭的 P0 bug | issue tracker | 基于时间;无法从代码检出中断言 |
|
|
76
|
+
|
|
77
|
+
干净机器首次运行的计时与 30 天 P0 窗口在有人实际测量前保持未运行;
|
|
78
|
+
aarch64 qemu 是 CI 门禁。发布说明不得声称未运行的行,
|
|
79
|
+
[ROADMAP-1.0.md](ROADMAP-1.0.md#wsl-304--10-readiness) 跟踪 1.0 的遗留项。
|
|
80
|
+
跳过其余手动行的发布仍会通过 tag 工作流发布,但其说明会写明执行了哪些门禁。
|
|
81
|
+
|
|
82
|
+
## 在本地验证迁移
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pnpm run preset --distro default --check <profile>/cordis.patch.yml # 无嵌套行陷阱
|
|
86
|
+
pnpm run doctor --json # 生效的环境事实
|
|
87
|
+
dsh --profile <name> --dump-config # 合成后的行(CLI 发行版)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
迁移后启动失败的 profile 应在错误中指明补救方法;若没有,那就是 bug——
|
|
91
|
+
请附上 `doctor --json` 输出报告它。
|
package/docs/PEER-PARITY.md
CHANGED
|
@@ -7,60 +7,61 @@ same refusal dialect on both substrates. The **read path** holds end to end;
|
|
|
7
7
|
the **edit path** carries two declared divergences, listed at the end. This
|
|
8
8
|
file records the verification against the real peers.
|
|
9
9
|
|
|
10
|
-
- Peers: `@deepseek-ai/dsh-fs-local@0.2.2-rc.
|
|
11
|
-
devDependencies pin, and the floor the peer range `>=0.2.2-rc.
|
|
12
|
-
verified against), plus `@deepseek-ai/dsh-fs@0.2.2-rc.
|
|
10
|
+
- Peers: `@deepseek-ai/dsh-fs-local@0.2.2-rc.2` (the exact version the
|
|
11
|
+
devDependencies pin, and the floor the peer range `>=0.2.2-rc.2` was
|
|
12
|
+
verified against), plus `@deepseek-ai/dsh-fs@0.2.2-rc.2` for the
|
|
13
13
|
`FsVersion` brand the local package imports. Divergence 2 is measured
|
|
14
|
-
against a third peer, `@deepseek-ai/dsh-bash-local@0.2.2-rc.
|
|
14
|
+
against a third peer, `@deepseek-ai/dsh-bash-local@0.2.2-rc.2` — the shell
|
|
15
15
|
executor carries the collect-budget/spill machinery; `spill` and
|
|
16
16
|
`maxSpillBytes` do not appear in `dsh-fs-local` at all.
|
|
17
|
-
- The `0.2.2-rc.
|
|
18
|
-
to
|
|
19
|
-
|
|
20
|
-
Every replicated string survived verbatim;
|
|
21
|
-
to end and the **edit path** carries the same
|
|
22
|
-
at the end. The
|
|
23
|
-
|
|
17
|
+
- The `0.2.2-rc.2` move shrinks `dsh-fs-local`'s shipped `lib/index.js` from
|
|
18
|
+
1048 to 1035 lines: the local peer now routes permission/IO faults through
|
|
19
|
+
`fsErrorFromErrno` (imported from `dsh-fs`) instead of its own
|
|
20
|
+
`listingIoError`/pass-through arms. Every replicated string survived verbatim;
|
|
21
|
+
the fsio **read path** holds end to end and the **edit path** carries the same
|
|
22
|
+
two declared divergences, listed at the end. The `FS_ERROR_CODES` export with
|
|
23
|
+
`FS_PATCH_MISMATCH`/`FS_SAME_TARGET` remains. The plugin serves those
|
|
24
24
|
operations for real over protocol v7 — see the new-peer-operations section
|
|
25
|
-
at the end.
|
|
26
|
-
`dsh-bash-local@0.2.2-rc.
|
|
27
|
-
`0.2.1-rc.3`'s
|
|
28
|
-
|
|
25
|
+
at the end. The references below were re-walked on 2026-11-12.
|
|
26
|
+
`dsh-bash-local@0.2.2-rc.2`'s `lib/index.js` is byte-identical to
|
|
27
|
+
`0.2.1-rc.3`'s and to `0.2.2-rc.1`'s, so its references stand.
|
|
28
|
+
`dsh-fs@0.2.2-rc.2` still has no `./invariant` export subpath; this
|
|
29
29
|
plugin imports neither it nor `dsh-invariants`.
|
|
30
30
|
- What "not imported" means: the peer's **fsio module** is not reachable from
|
|
31
31
|
the package's exports, so `lib/fsio-text.js` reimplements it and imports
|
|
32
32
|
nothing from it (the export is proposed in `docs/UPSTREAM-FSIO-EXPORT.md`).
|
|
33
33
|
The peer **packages** are ordinary build-time imports that stay in the
|
|
34
|
-
shipped artifact — `lib/fs-routing.js` and `lib/
|
|
35
|
-
`LocalFileSystem` from `@deepseek-ai/dsh-fs-local`, and
|
|
36
|
-
imports `FsError` from `@deepseek-ai/dsh-fs`.
|
|
37
|
-
removable.
|
|
34
|
+
shipped artifact — `lib/fs-routing.js` and `lib/wsl-filesystem.js` both
|
|
35
|
+
import `LocalFileSystem` from `@deepseek-ai/dsh-fs-local`, and
|
|
36
|
+
`lib/wsl-filesystem.js` also imports `FsError` from `@deepseek-ai/dsh-fs`.
|
|
37
|
+
Neither dependency is removable.
|
|
38
38
|
- Method: `npm pack` both pins, confirm the bytes, extract, and compare the
|
|
39
39
|
shipped `lib/index.js` (unminified ESM) function-by-function and
|
|
40
40
|
string-by-string against this repository.
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
43
|
mkdir -p /tmp/peer-audit && cd /tmp/peer-audit
|
|
44
|
-
npm pack @deepseek-ai/dsh-fs-local@0.2.2-rc.
|
|
45
|
-
openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.2-rc.
|
|
46
|
-
tar xzf deepseek-ai-dsh-fs-local-0.2.2-rc.
|
|
47
|
-
wc -l package/lib/index.js # expect
|
|
44
|
+
npm pack @deepseek-ai/dsh-fs-local@0.2.2-rc.2 @deepseek-ai/dsh-fs@0.2.2-rc.2 --pack-destination .
|
|
45
|
+
openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.2-rc.2.tgz | base64 -w0
|
|
46
|
+
tar xzf deepseek-ai-dsh-fs-local-0.2.2-rc.2.tgz # -> package/lib/index.js
|
|
47
|
+
wc -l package/lib/index.js # expect 1035
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
The tarballs this audit compared, by content — the same values
|
|
51
|
-
`npm view <pkg>@0.2.2-rc.
|
|
52
|
-
the `0.2.
|
|
51
|
+
`npm view <pkg>@0.2.2-rc.2 dist.integrity` reports (re-recorded 2026-11-12;
|
|
52
|
+
the `0.2.2-rc.1` values they supersede are in git history):
|
|
53
53
|
|
|
54
54
|
```
|
|
55
|
-
@deepseek-ai/dsh-fs-local@0.2.2-rc.
|
|
56
|
-
@deepseek-ai/dsh-fs@0.2.2-rc.
|
|
55
|
+
@deepseek-ai/dsh-fs-local@0.2.2-rc.2 sha512-QjzwjFskmTXVg9fUFvs8k/1lHti4JOGnu/ABF6UWUwZjqYFwDQIkbJbi5nTuz0mE50DQup7yyv0D9STgC1eEKA==
|
|
56
|
+
@deepseek-ai/dsh-fs@0.2.2-rc.2 sha512-y3ocU0T1mZgFIAfgqAo+4l61zqvNpdsmRM0Pp2Ek8xDu6XvtIcsur3ST/iUsudtz1m/ope8t27jeEgtTefn/TQ==
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Each row of the table below names the peer's `lib/index.js` line and the
|
|
60
60
|
literal both sides must produce. Verified 2026-10-03; the read/edit split
|
|
61
61
|
re-verified 2026-10-06; the whole table re-checked against `0.2.1-rc.2`,
|
|
62
|
-
2026-10-17, against `0.2.1-rc.3`, 2026-10-26,
|
|
63
|
-
2026-11-05 (line numbers shifted; strings
|
|
62
|
+
2026-10-17, against `0.2.1-rc.3`, 2026-10-26, against `0.2.2-rc.1`,
|
|
63
|
+
2026-11-05, and against `0.2.2-rc.2`, 2026-11-12 (line numbers shifted; strings
|
|
64
|
+
identical).
|
|
64
65
|
|
|
65
66
|
## Verdict
|
|
66
67
|
|
|
@@ -77,22 +78,22 @@ declared extensions, listed at the end.
|
|
|
77
78
|
|
|
78
79
|
| Item | Evidence (peer `lib/index.js`) | Ours |
|
|
79
80
|
|---|---|---|
|
|
80
|
-
| `normalizeLineEndings` | `:
|
|
81
|
-
| `detectLineEndings` | `:
|
|
82
|
-
| `restoreLineEndings` | `:
|
|
83
|
-
| occurrence counting | `:
|
|
84
|
-
| `applyLiteralEdit` | `:
|
|
85
|
-
| edit refusal strings | `:
|
|
86
|
-
| invalid UTF-8, read path | `:
|
|
87
|
-
| binary detection, read path | `:99`/`:
|
|
88
|
-
| size caps | `:
|
|
89
|
-
| `writeText` guards | `:
|
|
90
|
-
| `editText` guards — not-regular and stale version | `:
|
|
91
|
-
| `editText` guards — missing file | `:
|
|
92
|
-
| `listDir` refusal | `:
|
|
93
|
-
| diff-basis gate | `:
|
|
94
|
-
| outcome shapes | `:
|
|
95
|
-
| version join | `:
|
|
81
|
+
| `normalizeLineEndings` | `:614` `content.replaceAll("\r\n", "\n")` | identical |
|
|
82
|
+
| `detectLineEndings` | `:617` 4096-char sample; `crlf > lf - crlf` | identical |
|
|
83
|
+
| `restoreLineEndings` | `:630` LF unchanged; CRLF re-normalizes then `\n` → `\r\n` | identical (`replaceAll` vs `split/join` — equivalent) |
|
|
84
|
+
| occurrence counting | `:633` non-overlapping left-to-right | `split(needle).length - 1` — equivalent |
|
|
85
|
+
| `applyLiteralEdit` | `:728` empty needle, not-found, and ambiguous refusals; single-pass `split/join` without rescanning | identical |
|
|
86
|
+
| edit refusal strings | `:730`, `:733`, `:734` — `old_string must be a non-empty string` (`FS_EDIT_NOT_FOUND`); ``old_string was not found in "${displayPath}"``; ``old_string matched ${n} times in "${displayPath}"; provide a more specific old_string or set replace_all to true`` (`FS_AMBIGUOUS_EDIT`) | identical |
|
|
87
|
+
| invalid UTF-8, read path | `:331` — ``cannot ${verb} "${displayPath}": invalid UTF-8 text`` (`FS_NOT_TEXT`), verb `read` | identical (the edit path's verb differs; see 4) |
|
|
88
|
+
| binary detection, read path | `:99`/`:373` (sample const, guard), stream at `:457-459` — 8192-byte sample, NUL check; ``cannot read "${displayPath}": binary file`` (`FS_NOT_TEXT`) | identical — both accept a NUL at offset 8500, past the sample; the edit path's bound differs, see 4 |
|
|
89
|
+
| size caps | `:389`, `:400` — ``cannot read "${displayPath}": ${size} bytes exceeds the ${maxBytes}-byte limit`` and ``content exceeds the ${maxBytes}-byte limit`` (`FS_TOO_LARGE`) | identical |
|
|
90
|
+
| `writeText` guards | `:493`, `:495` — not-regular (`FS_NOT_REGULAR_FILE`), `file no longer exists` / `file changed since it was read` (`FS_STALE_VERSION`) via `writeTarget` at `:1006-1010`, ``cannot overwrite existing "${displayPath}" without reading it first`` (`FS_NOT_OBSERVED`) | identical |
|
|
91
|
+
| `editText` guards — not-regular and stale version | `:924`, `:925` — ``cannot edit "${displayPath}": not a regular file`` (`FS_NOT_REGULAR_FILE`); `file changed since it was read` (`FS_STALE_VERSION`) when the expected version differs (`requireFile` at `:1015-1019`) | identical |
|
|
92
|
+
| `editText` guards — missing file | `:924` — one refusal for every caller: `file changed since it was read` (`FS_STALE_VERSION`), with or without an expected version | **diverges by design** — we split on the caller's evidence: with an expected version `file no longer exists` (`FS_STALE_VERSION`), without one `file does not exist` (`FS_NOT_FOUND`). See 5 |
|
|
93
|
+
| `listDir` refusal | `:298` — ``cannot list "${displayPath}": not a directory`` (`FS_NOT_DIRECTORY`) | identical |
|
|
94
|
+
| diff-basis gate | `:907` — `existing !== null && Buffer.byteLength(content) < diffBasisMaxBytes` — keyed on the NEW content's size, `null` above the cap (the move path inherits the same keying at `:966`/`:979`) | identical — the gate's new-size keying is inherited by design, not a divergence |
|
|
95
|
+
| outcome shapes | `:914`, `:979` — `operation: "update" \| "create"`, the `missing:${targetKey}` sentinel version (`:1031`), `before`/`after` | identical |
|
|
96
|
+
| version join | `:146` — `` `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}` `` (branded by `dsh-fs`'s `FsVersion`) | `versionOf` — identical shape |
|
|
96
97
|
|
|
97
98
|
## Deliberate divergences (declared, not drift)
|
|
98
99
|
|
|
@@ -103,7 +104,7 @@ declared extensions, listed at the end.
|
|
|
103
104
|
2. **Per-stream truncation flags.** The EXEC frame carries an output budget;
|
|
104
105
|
the RES line reports which streams the agent cut, surfaced as honest
|
|
105
106
|
`truncated` flags. The collect-budget/spill machinery of the shell peer,
|
|
106
|
-
`@deepseek-ai/dsh-bash-local@0.2.2-rc.
|
|
107
|
+
`@deepseek-ai/dsh-bash-local@0.2.2-rc.2` (`lib/index.js:30`, `:110`), is the
|
|
107
108
|
spill-file path we deliberately do not run.
|
|
108
109
|
3. **The transport around the ops** (ACK, KILL, the confined resident) is
|
|
109
110
|
protocol this package owns; the peer has no agent.
|
|
@@ -112,10 +113,10 @@ declared extensions, listed at the end.
|
|
|
112
113
|
dialect, but a divergence all the same, so it is declared: an edit refused
|
|
113
114
|
for its bytes reads ``cannot read "…": binary file`` or
|
|
114
115
|
``cannot read "…": invalid UTF-8 text`` — verb `read`, where the peer's
|
|
115
|
-
`readForEdit` (`lib/index.js:
|
|
116
|
+
`readForEdit` (`lib/index.js:651`) says ``cannot edit "…": …``. The NUL
|
|
116
117
|
check is likewise the read path's 8192-byte sample
|
|
117
118
|
(`src/fsio-agent.ts:377-384`, guard at `:380`), where the peer scans the
|
|
118
|
-
whole buffer (`lib/index.js:
|
|
119
|
+
whole buffer (`lib/index.js:655`): a file whose first 8192 bytes are clean
|
|
119
120
|
but that carries a NUL later is edited by us and refused by the peer.
|
|
120
121
|
Measured on a 9000-byte fixture with a NUL at offset 8500 — ours `EDITED`,
|
|
121
122
|
the peer `FS_NOT_TEXT: cannot edit "…"`.
|
|
@@ -125,7 +126,7 @@ declared extensions, listed at the end.
|
|
|
125
126
|
behind it names a file that never answered the stat, so it takes the read
|
|
126
127
|
path's missing-file dialect (`cannot edit "…": file does not exist`,
|
|
127
128
|
`FS_NOT_FOUND`). The peer throws `file changed since it was read`
|
|
128
|
-
(`FS_STALE_VERSION`, `lib/index.js:
|
|
129
|
+
(`FS_STALE_VERSION`, `lib/index.js:924` via `requireFile` at `:1015`) for
|
|
129
130
|
both. Pinned by `test/fs-substrate.test.mjs`.
|
|
130
131
|
6. **Publication durability (shell agent, 2026-11-06).** After the publish
|
|
131
132
|
rename, the shell agent fsyncs the destination's containing directory
|
|
@@ -146,9 +147,20 @@ declared extensions, listed at the end.
|
|
|
146
147
|
always sends numerics, so this is drift-hardening at the trust boundary,
|
|
147
148
|
not a behavioral change for any caller.
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
8. **Permission classification on the distro path.** The rc.2 local peer routes
|
|
151
|
+
`EACCES`/`EPERM` through `fsErrorFromErrno` to `FS_PERMISSION_DENIED` with
|
|
152
|
+
``cannot <op> "<path>": permission denied``. The WSL agent keeps ordinary
|
|
153
|
+
permission refusals at `FS_IO_ERROR` with the agent's stderr text; only the
|
|
154
|
+
sandbox's read-only-bind denial is classified as `FS_SANDBOX_DENIED`. This is
|
|
155
|
+
pinned by `test/fsio-agent.test.mjs` ("a write refused on ordinary
|
|
156
|
+
permissions keeps its I/O classification"). A consumer that switches between
|
|
157
|
+
the host and distro backends will see both the code and the text differ for a
|
|
158
|
+
plain permission refusal: the distro path carries the agent's stderr text,
|
|
159
|
+
not the peer's `cannot <op> "<path>": …` shape.
|
|
150
160
|
|
|
151
|
-
|
|
161
|
+
## The peer's 0.2.2 operations: implemented over protocol v7
|
|
162
|
+
|
|
163
|
+
The `0.2.2` line added three operations to the peer's `FileSystem` base —
|
|
152
164
|
`patchText` (hunks via `@deepseek-ai/dsh-fs-patch`, refusal
|
|
153
165
|
`FS_PATCH_MISMATCH`), `deleteFile`, and `moveFile` (same-target refusal
|
|
154
166
|
`FS_SAME_TARGET`). 0.18.0 shipped them as an honest refusal (an inherited
|
package/docs/PERFORMANCE.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Performance: ext4 agent vs the 9p share
|
|
2
2
|
|
|
3
|
+
[中文](PERFORMANCE.zh.md)
|
|
4
|
+
|
|
3
5
|
The plugin's reason to exist is not only correctness: a WSL workspace served
|
|
4
6
|
through the Windows 9p share is measurably slower than the same files read on
|
|
5
7
|
the distro's ext4 through the resident agent. This page records the measurements
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# 性能:ext4 agent 对比 9p 共享
|
|
2
|
+
|
|
3
|
+
[English](PERFORMANCE.md)
|
|
4
|
+
|
|
5
|
+
本插件存在的理由不只是正确性:通过 Windows 9p 共享提供的 WSL 工作区,
|
|
6
|
+
明显慢于经常驻 agent 在发行版 ext4 上读取同样的文件。本页记录测量结果及
|
|
7
|
+
复现方法;不对测量范围之外做推断。
|
|
8
|
+
|
|
9
|
+
## 两种 substrate
|
|
10
|
+
|
|
11
|
+
| | 9p 共享(`\\wsl.localhost\...`) | 本插件 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| 文件 I/O | 宿主栈每次操作都跨越 VM 边界 | 常驻 agent 在发行版内、目标的后备文件系统上提供读写 |
|
|
14
|
+
| 变更通知 | 轮询该共享 | 可用时对无界目录使用 inotify,否则轮询 |
|
|
15
|
+
| 命令 | 宿主进程 | 经 `wsl.exe` 的发行版登录 shell |
|
|
16
|
+
|
|
17
|
+
插件的根文件系统将每条 WSL 路径路由到发行版后端(`fs-routing`),因此
|
|
18
|
+
GUI 文件树、预览和模型的文件工具都走 agent 路径。设计与权衡见
|
|
19
|
+
[root-fs-routing.md](root-fs-routing.md);已知限制见
|
|
20
|
+
[LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
|
|
21
|
+
|
|
22
|
+
## 测量数字
|
|
23
|
+
|
|
24
|
+
机器:Windows 11 + WSL 2,Ubuntu,x86_64,即本项目的开发机。绝对数字
|
|
25
|
+
取决于机器;比例和预算才是重点。
|
|
26
|
+
|
|
27
|
+
| 场景 | 9p 共享 | Agent(ext4) | 来源 |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| 16 个并发共享读取,shell agent 对比 native agent | — | shell:342–614 ms(排队最高 583 ms);native:A7 之后 **2.4–4.1 ms**,首次启动约 70 ms(仅一次) | [ADR 0002 fs 队列](adr/0002-native-agent.md#fs-queue-measurement-a6-2026-10-18) |
|
|
30
|
+
| 单次 FS 操作(宿主往返) | — | p95 ≈ 22 ms | [ROADMAP-1.0.md](ROADMAP-1.0.md#7-metrics) |
|
|
31
|
+
| GUI 预览后端:`stat` | — | p95 **2.7 ms** | `pnpm run probe:gui-preview`(20 次迭代,2026-10-19) |
|
|
32
|
+
| GUI 预览后端:目录列举 | — | p95 **5.1 ms** | 同上 |
|
|
33
|
+
| GUI 预览后端:1 MiB 页面 | — | p95 **63.5 ms/MiB** | 同上 |
|
|
34
|
+
|
|
35
|
+
GUI 预览数字覆盖一次预览所支付的、经路由的后端操作。随包的
|
|
36
|
+
`workspace-files` 服务会在其上追加自己的调用;该服务的形态在
|
|
37
|
+
[LIMITATIONS.zh.md](LIMITATIONS.zh.md) 中保持定性描述。1 s/MiB 预算余量
|
|
38
|
+
很大,因此这些测量并不构成进一步优化(被推迟的 v6 FS 并发)的理由。
|
|
39
|
+
|
|
40
|
+
## 复现
|
|
41
|
+
|
|
42
|
+
在发行版内,使用该 checkout:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm run probe:gui-preview # stat / listDir / 1 MiB page read, p50/p95
|
|
46
|
+
node test/probe/fs-queue.mjs # the agent queue, sequential vs concurrent, with per-op latency
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
两者都需要 WSL 互操作、可用的发行版和 Node;都不启动 harness。队列测量还
|
|
50
|
+
需要 systemd 和可用的原生二进制;它打印实际耗时和队列指标,但不强制延迟
|
|
51
|
+
预算。GUI 预览探针报告 p50/p95/max,并在超出预算时失败。
|
|
52
|
+
|
|
53
|
+
## 未测量的内容
|
|
54
|
+
|
|
55
|
+
- 端到端 GUI 绘制时间(浏览器和服务自身的工作不在这些探针范围内)。
|
|
56
|
+
- 大文件或大量小文件的 9p 数字;A6 比较的是 shell 与 native agent,而不是
|
|
57
|
+
Windows 侧的 9p 共享。
|
|
58
|
+
- 物理 aarch64 硬件上的 WSL 延迟(原生 18 项检查套件在 CI 中于 qemu 下
|
|
59
|
+
运行;那是功能正确性,不是宿主往返测量)。
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Quickstart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[中文](QUICKSTART.zh.md)
|
|
4
4
|
|
|
5
5
|
Steps from a Windows + WSL 2 machine to a working WSL session.
|
|
6
6
|
This page is the entry point; every claim links to the document that owns it.
|
|
@@ -30,15 +30,17 @@ finding exists (stale scopes and a broken agent cache), **完整检查** otherwi
|
|
|
30
30
|
in the composer also runs host-side and renders in the UI — no model turn, no
|
|
31
31
|
tokens; in a session, ask for a diagnosis and the model runs the `wsl_doctor`
|
|
32
32
|
tool (mounted by this plugin), the verdict landing in the transcript; and the
|
|
33
|
-
session-start preflight
|
|
33
|
+
session-start preflight logs the same verdict on every session start, and adds
|
|
34
|
+
it to the session's context only when blocked.
|
|
34
35
|
`DSH_WSL_DOCTOR` additionally carries a ready-to-run command for the doctor
|
|
35
36
|
script itself (`sh -c "$DSH_WSL_DOCTOR --json"`).
|
|
36
37
|
|
|
37
38
|
The doctor (`scripts/doctor.mjs`, or `pnpm run doctor` from a checkout) checks
|
|
38
|
-
the environment and ends in a verdict: `ready` means
|
|
39
|
-
|
|
40
|
-
remedy. It reads the distro's WSL mode
|
|
41
|
-
separate version check is needed. Doctor is
|
|
39
|
+
the environment and ends in a verdict: `ready` means every check that run
|
|
40
|
+
covered passed — not a promise about a later command; `blocked` names the exact
|
|
41
|
+
checks to fix, each with a copy-paste remedy. It reads the distro's WSL mode
|
|
42
|
+
from `wsl.exe -l -v` itself, so no separate version check is needed. Doctor is
|
|
43
|
+
read-only unless you pass `--fix`
|
|
42
44
|
(the stale-scope sweep and a broken agent cache, both re-verified; the Windows
|
|
43
45
|
git trust after a confirmation) or `--fix --install` (packages, after a
|
|
44
46
|
confirmation); `--fix-owned` restricts a fix run to the plugin-owned state
|
|
@@ -99,6 +101,9 @@ WSL** (the default — commands, files and the terminal all run in the distro) o
|
|
|
99
101
|
**Windows access** (the folder as an ordinary Windows share over 9p, without the
|
|
100
102
|
Linux toolchain). The choice is recorded in the `auto-preset` row's
|
|
101
103
|
`windowsWorkspaces` and applies to later sessions in that workspace too.
|
|
104
|
+
A Windows-access directory is called out in the session itself: a distro workspace
|
|
105
|
+
running a non-WSL preset keeps a warning above the composer, with a one-click switch
|
|
106
|
+
while the session is still blank and the access-record fix once a turn has started.
|
|
102
107
|
Two distros can be open at once, each with its own environment.
|
|
103
108
|
|
|
104
109
|
### Open the workspace in VS Code (Remote-WSL)
|
|
@@ -118,6 +123,11 @@ code --folder-uri "vscode-remote://wsl+ubuntu/home/me/proj"
|
|
|
118
123
|
Requires the `code` shim on PATH (VS Code installer adds it) and the
|
|
119
124
|
Remote-WSL extension.
|
|
120
125
|
|
|
126
|
+
In the desktop GUI, the Session header menu also carries
|
|
127
|
+
**在 VS Code 中打开(WSL)**: it converts the Session workspace to the same URI
|
|
128
|
+
and launches the editor with a cleaned environment, so it does not depend on a
|
|
129
|
+
patched `app.asar`.
|
|
130
|
+
|
|
121
131
|

|
|
122
132
|
|
|
123
133
|
The terminal panel runs in the same distro — `uname -a` answers with the
|
|
@@ -164,6 +174,11 @@ pnpm test
|
|
|
164
174
|
pnpm dev # a dev server survives the command that started it with sessionSandbox: true
|
|
165
175
|
```
|
|
166
176
|
|
|
177
|
+
On a cold cache or a new dependency, `workspace-write` blocks the
|
|
178
|
+
`~/.npm`/pnpm-store writes (`EROFS`). Configure the same `writableRoots` list on
|
|
179
|
+
`wsl-shell` and `wsl-fs` (e.g. `~/.npm`, `~/.cache`, `~/.local/share/pnpm`);
|
|
180
|
+
see [CONFIGURATION](CONFIGURATION.md#toolchain-caches-and-extra-writable-roots).
|
|
181
|
+
|
|
167
182
|
The server's port can appear in `DSH_WSL_PORTS` after a successful snapshot
|
|
168
183
|
(refreshed every 10 s by default); open a forwarded port from Windows at
|
|
169
184
|
`http://localhost:<port>`.
|
package/docs/QUICKSTART.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 快速开始
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](QUICKSTART.md)
|
|
4
4
|
|
|
5
5
|
从一台 Windows + WSL 2 机器到可用的 WSL 会话,只需以下步骤。
|
|
6
6
|
本页是入口;每条说明都链接到负责该主题的文档。
|
|
@@ -27,11 +27,12 @@ doctor 快速检查,结果以状态徽标、编号的待修项与告警列出
|
|
|
27
27
|
(残留 scope、损坏的 agent 缓存)的完整运行标为 **修复**,否则标为 **完整检查**;在输入框里输入
|
|
28
28
|
`/wsl-doctor [quick|full|<分区>]` 同样在宿主侧执行、直接渲染在 UI,不进模型
|
|
29
29
|
对话、零 token;在会话里请求诊断,模型会运行本插件挂载的 `wsl_doctor` 工具,
|
|
30
|
-
|
|
30
|
+
判定落在对话里;会话启动预检在每次会话打开时把同样的判定写进日志,只有 blocked
|
|
31
|
+
判定同时进入会话上下文。`DSH_WSL_DOCTOR` 还携带一条现成命令,可在发行版内执行 doctor 脚本本身
|
|
31
32
|
(`sh -c "$DSH_WSL_DOCTOR --json"`)。
|
|
32
33
|
|
|
33
34
|
doctor(`scripts/doctor.mjs`,或在检出目录中运行 `pnpm run doctor`)会检查
|
|
34
|
-
环境并以裁决收尾:`ready`
|
|
35
|
+
环境并以裁决收尾:`ready` 表示本次运行覆盖的检查全部通过,不保证每条命令都成功;`blocked` 会列明待修项,
|
|
35
36
|
每项附可复制的处理办法。发行版的 WSL 模式由 doctor 自己从 `wsl.exe -l -v`
|
|
36
37
|
读取,无需单独确认。doctor 默认只读,除非传入 `--fix`(清理过期 scope、清理损坏的
|
|
37
38
|
agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
|
|
@@ -85,6 +86,8 @@ scope 或损坏的 agent 缓存)时标为 **修复**,否则标为 **完整
|
|
|
85
86
|
文件与终端都在发行版内)或 **Windows 访问**(把该文件夹当作普通 Windows 共享,经 9p
|
|
86
87
|
读写,没有 Linux 工具链)。选择记录在 `auto-preset` 行的 `windowsWorkspaces` 里,
|
|
87
88
|
对该工作区之后新建的会话同样生效。
|
|
89
|
+
Windows 访问目录也会在会话内被点明:运行非 WSL preset 的发行版工作区在输入框上方
|
|
90
|
+
常驻一条警示;会话尚未开始时一键切换,已开始后修正访问记录。
|
|
88
91
|
|
|
89
92
|
### 在 VS Code 中打开工作区(Remote-WSL)
|
|
90
93
|
|
|
@@ -103,6 +106,10 @@ code --folder-uri "vscode-remote://wsl+ubuntu/home/me/proj"
|
|
|
103
106
|
要求 PATH 上有 `code` shim(VS Code 安装器会添加),以及
|
|
104
107
|
Remote-WSL 扩展。
|
|
105
108
|
|
|
109
|
+
桌面 GUI 的会话头部菜单还提供 **在 VS Code 中打开(WSL)**:它把会话工作区
|
|
110
|
+
转换成同一个 URI,并在清理过的环境里启动编辑器,因此不依赖打过补丁的
|
|
111
|
+
`app.asar`。
|
|
112
|
+
|
|
106
113
|

|
|
107
114
|
|
|
108
115
|
终端面板运行在同一个发行版中——`uname -a` 返回的是
|
|
@@ -148,6 +155,11 @@ pnpm test
|
|
|
148
155
|
pnpm dev # a dev server survives the command that started it with sessionSandbox: true
|
|
149
156
|
```
|
|
150
157
|
|
|
158
|
+
冷缓存或新增依赖时,`workspace-write` 会拦住 `~/.npm`、pnpm store 等缓存写入
|
|
159
|
+
(`EROFS`)。在 `wsl-shell` 和 `wsl-fs` 上配置同一组 `writableRoots`(例如
|
|
160
|
+
`~/.npm`、`~/.cache`、`~/.local/share/pnpm`),见
|
|
161
|
+
[CONFIGURATION](CONFIGURATION.zh.md#工具链缓存与额外可写目录)。
|
|
162
|
+
|
|
151
163
|
快照成功后(默认每 10 s 刷新一次),server 的端口可能出现在 `DSH_WSL_PORTS`
|
|
152
164
|
中;从 Windows 通过 `http://localhost:<port>` 访问转发的端口。
|
|
153
165
|
|
package/docs/README.zh.md
CHANGED
|
@@ -47,7 +47,7 @@ Windows 上的编程工具要在 WSL 项目中工作,有三条路:把整个
|
|
|
47
47
|
- **发行版内没有服务。** 没有辅助服务、没有守护进程、没有监听端口。唯一持久化的内容是 `~/.cache/dsh-wsl/agent/` 下按内容寻址的原生 agent 副本。
|
|
48
48
|
- **默认有沙箱。** 受限命令在发行版内的 `bubblewrap` 中运行。缺少 `bubblewrap` 时命令直接失败,不会脱箱运行。
|
|
49
49
|
- **按会话生效。** 打开发行版文件夹的会话获得发行版环境;打开 Windows 文件夹的会话保留 Windows 工具。两者可同时运行在一个 harness 进程中。
|
|
50
|
-
- **与 GUI 集成。** 文件夹选择器列出已安装的发行版,终端在发行版内打开 shell,模型能看到监听端口。侧边栏的 **WSL 环境** 面板按发行版运行 doctor
|
|
50
|
+
- **与 GUI 集成。** 文件夹选择器列出已安装的发行版,终端在发行版内打开 shell,模型能看到监听端口。侧边栏的 **WSL 环境** 面板按发行版运行 doctor 快速检查——宿主侧执行,不进模型对话;会话启动预检在每次会话打开时把环境判定写进日志,只有 blocked 判定同时进入会话上下文。
|
|
51
51
|
|
|
52
52
|
### 为什么是 Linux,而不是 PowerShell
|
|
53
53
|
|
|
@@ -96,6 +96,12 @@ CLI 入口在 `resources/app.asar` 内部(探针脚本通过 `ELECTRON_RUN_AS_
|
|
|
96
96
|
Plugins 页面写入的那个;要用别的 profile 属于 CLI 发行版的事
|
|
97
97
|
(`dsh --profile <名字>`)。
|
|
98
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
|
+
|
|
99
105
|
**CLI 发行版**(`dsh` 在 `PATH` 上),在 Windows 终端执行:
|
|
100
106
|
|
|
101
107
|
```powershell
|
|
@@ -111,7 +117,7 @@ dsh --profile wsl # 启动
|
|
|
111
117
|
wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
|
|
112
118
|
```
|
|
113
119
|
|
|
114
|
-
在插件检出目录中,`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
|
|
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 <发行版>` 仍是较窄的工具安装助手。
|
|
115
121
|
|
|
116
122
|
插件大约每天自行检查一次更新(启动后 2–10 分钟内首查),方式是询问应用的插件管理器——它从不自行联网。当存在更新的稳定版时,每个发行版会话中受管的 `DSH_WSL_PLUGIN_UPDATE` 变量会携带该事实;补丁配置里的 `wsl-update-check.enabled: false` 可关闭该检查。升级保持手动,因为 harness 没有热重载:重新安装(Plugins 页面或 `add` 命令),然后重启。
|
|
117
123
|
|
|
@@ -126,7 +132,7 @@ wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
|
|
|
126
132
|
- **New terminal** 在同一发行版、同一目录打开 shell。
|
|
127
133
|
- 模型能看到监听端口,并返回 dev server 的 URL。WSL 2 会把 localhost 转发到 Windows。
|
|
128
134
|
- 权限选择器:`read-only`、`workspace-write`(默认)、`danger-full-access`。只有 `danger-full-access` 不经过沙箱。
|
|
129
|
-
- 侧边栏的 **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`
|
|
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模式打开** 小标记,面板里也列出已记录的目录供审计。
|
|
130
136
|
|
|
131
137
|
## 配置
|
|
132
138
|
|
|
@@ -139,17 +145,19 @@ wsl.exe -d <发行版> -u root -- apt-get install -y bubblewrap
|
|
|
139
145
|
| | `sessionSandbox` | `false`;随包 `true` | 会话命令跑在同一个 systemd user scope 中 |
|
|
140
146
|
| | `agentBackend` | `auto` | 发行版内 agent:`auto`、`native` 或 `shell` |
|
|
141
147
|
| | `maskWindowsDrive` | `false` | 让受限命令看不到 `/mnt` |
|
|
148
|
+
| | `writableRoots` | `[]` | 额外可写的发行版目录(工具链缓存等;`wsl-fs` 上配同一列表) |
|
|
142
149
|
| `wsl-fs` | `distro` | `''` | 发行版模式;空/`auto` 跟随每个目标路径 |
|
|
143
150
|
| | `restrictToDistro` | `true` | 固定发行版(`default` 或名字)时拒绝属于其他发行版的路径 |
|
|
144
151
|
| | `sandbox` | `true` | 按策略检查受限写入 |
|
|
145
152
|
| | `sessionSandbox` | `false`;随包 `true` | 受限写入跑在会话 runtime 中 |
|
|
146
153
|
| | `substrate` | `agent` | 发行版内 agent;`share` 在启动时被拒绝 |
|
|
154
|
+
| | `writableRoots` | `[]` | 与 `wsl-shell` 相同的额外可写目录列表 |
|
|
147
155
|
| `directory-picker-wsl` | `includeHostHome` | `true` | 同时提供 Windows 路径分支(从驱动器开始) |
|
|
148
156
|
| `subprocess-wsl` | `distro` | `''` | 发行版模式;空/`auto` 跟随启动目录 |
|
|
149
157
|
| `wsl-preflight` | `distro` | `''` | 环境检查探测的发行版;空/`auto` 跟随会话工作区 |
|
|
150
158
|
| | `startup` | `true` | 插件加载时预先运行同一组检查,让判定在任何会话打开之前就出现在日志里 |
|
|
151
159
|
|
|
152
|
-
`fs-routing` 是根级 `ctx.fs` 调用的顶层路由:它的发行版设置独立于 `wsl-fs`,也是按 id 在顶层补丁中覆盖的行。`wsl-shell` 和 `wsl-fs` 位于随包的 `wsl` preset 中,按 id 覆盖无效。要改就覆盖整个 `preset-wsl` 行;配方和其余键见 [
|
|
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) 是随包值的注释参考。
|
|
153
161
|
|
|
154
162
|
## 架构
|
|
155
163
|
|
|
@@ -176,14 +184,14 @@ wsl preset(每个会话)
|
|
|
176
184
|
| 模式 | 命令可以做什么 |
|
|
177
185
|
|---|---|
|
|
178
186
|
| `read-only` | 读整个发行版;挂载新的 `/dev`,其余不可写 |
|
|
179
|
-
| `workspace-write` |
|
|
187
|
+
| `workspace-write` | 上面的权限,加上会话工作区与配置的 `writableRoots`;会话 runtime 下 `/tmp` 是发行版真实 `/tmp` |
|
|
180
188
|
| `danger-full-access` | 不经过沙箱 |
|
|
181
189
|
|
|
182
190
|
设置 `sessionSandbox: false` 时,`workspace-write` 命令使用私有的 `/tmp`,而不是发行版的真实 `/tmp`;`read-only` 不挂载可写的 `/tmp`。
|
|
183
191
|
|
|
184
192
|
`bubblewrap` 是必需项。缺失或损坏时,受限命令报 `SANDBOX_UNAVAILABLE`,不会运行。在对应的行设置 `sandbox: false` 可关闭沙箱;模型会收到"该操作无沙箱"的说明。
|
|
185
193
|
|
|
186
|
-
隔离上报为 `partial`。发行版内的命令仍可通过 `/mnt/c` 启动 Windows 程序,`bubblewrap` 无法控制 Windows 进程。`maskWindowsDrive: true` 让受限视图看不到 `/mnt`,但会被 `interopVisibility: visible` 覆盖;遮罩只能收窄这个洞,不能关死。关闭 WSL interop 需要另行在发行版的 `/etc/wsl.conf` 中设置 `[interop] enabled=false`。见 [
|
|
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)。
|
|
187
195
|
|
|
188
196
|
## 常见问题
|
|
189
197
|
|
|
@@ -192,11 +200,12 @@ wsl preset(每个会话)
|
|
|
192
200
|
| 每条命令都报 `SANDBOX_UNAVAILABLE` | 在发行版内安装 `bubblewrap`,或设置 `sandbox: false` |
|
|
193
201
|
| 会话在第一条命令前就被拒绝 | 运行 `pnpm run doctor`;启用 systemd 和 linger,或把 `wsl-shell`、`wsl-fs` 上的 `sessionSandbox` 设为 `auto` 或 `false` |
|
|
194
202
|
| 发行版内 `glob`、`grep` 很慢 | 运行 `pnpm run bootstrap <发行版>`,使用打印的安装命令安装 `ripgrep` |
|
|
203
|
+
| `npm install` / `pnpm add` 报 `EROFS` | 沙箱默认只授予工作区;在 `wsl-shell` 和 `wsl-fs` 上配置 `writableRoots`(如 `~/.npm`、`~/.cache`、`~/.local/share/pnpm`),见 [CONFIGURATION](CONFIGURATION.zh.md#工具链缓存与额外可写目录) |
|
|
195
204
|
| `dsh plugin add` 没有输出,或 Plugins 页面装完没有日志 | 以 profile 的 `package.json` 与 `dsh.profile.bundles` 为准:列出插件即安装成功 |
|
|
196
205
|
| 对 `wsl-shell`/`wsl-fs` 的 profile 补丁不生效 | 这些行嵌套在 `preset-wsl` 里。运行 `pnpm run preset --check <补丁>`;它会失败并输出需要粘贴的完整块 |
|
|
197
206
|
| 改了 `lib/` 但不生效 | 运行 `pnpm run sync:windows`,然后重启应用 |
|
|
198
207
|
|
|
199
|
-
更多错误码和拒绝原因见 [
|
|
208
|
+
更多错误码和拒绝原因见 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md#错误码),插件不做的事见 [LIMITATIONS.zh.md](LIMITATIONS.zh.md)。
|
|
200
209
|
|
|
201
210
|
## 开发
|
|
202
211
|
|
|
@@ -210,26 +219,26 @@ pnpm run sync:windows # 更新应用加载的 Windows 侧副本
|
|
|
210
219
|
|
|
211
220
|
工具链跟随 harness 宿主:Node `^22.19.0 || >=24.0.0`。`src/` 是 TypeScript,`lib/` 是生成并提交的产物,必须保持同步。应用加载的是 Windows 侧的 `lib/` 副本,所以构建后要运行 `sync:windows` 并重启应用。
|
|
212
221
|
|
|
213
|
-
真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.md](../CONTRIBUTING.md) 和 `test/probe/`。
|
|
222
|
+
真机探针仅在 Windows + WSL 下运行。见 [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) 和 `test/probe/`。
|
|
214
223
|
|
|
215
224
|
## 文档
|
|
216
225
|
|
|
217
226
|
| 文档 | 内容 |
|
|
218
227
|
|---|---|
|
|
219
|
-
| [
|
|
220
|
-
| [
|
|
221
|
-
| [
|
|
222
|
-
| [
|
|
223
|
-
| [
|
|
224
|
-
| [
|
|
225
|
-
| [
|
|
226
|
-
| [
|
|
228
|
+
| [QUICKSTART.zh.md](QUICKSTART.zh.md) | 首次运行、常用配方、兼容性 |
|
|
229
|
+
| [PERFORMANCE.zh.md](PERFORMANCE.zh.md) | ext4 agent 对比 9p 的实测延迟与复现方法 |
|
|
230
|
+
| [MIGRATION.zh.md](MIGRATION.zh.md) | 从早期版本升级、发布门槛 |
|
|
231
|
+
| [COMPATIBILITY.zh.md](COMPATIBILITY.zh.md) | 已测的 Windows/WSL/发行版矩阵与范围决定 |
|
|
232
|
+
| [API.zh.md](API.zh.md) | 包的子路径导出一览 |
|
|
233
|
+
| [CONFIGURATION.zh.md](CONFIGURATION.zh.md) | 所有配置键及覆盖方法 |
|
|
234
|
+
| [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md) | 服务、路径路由、沙箱、错误码 |
|
|
235
|
+
| [LIMITATIONS.zh.md](LIMITATIONS.zh.md) | 插件不做的事 |
|
|
227
236
|
| [docs/ROADMAP.md](ROADMAP.md) | 当前计划和推迟项 |
|
|
228
237
|
| [docs/ROADMAP-1.0.md](ROADMAP-1.0.md) | 1.0 与生态优化计划 |
|
|
229
238
|
| [docs/VALUE.zh.md](VALUE.zh.md) | 价值与取舍 |
|
|
230
|
-
| [CONTRIBUTING.md](../CONTRIBUTING.md) | 开发循环、质量门、探针 |
|
|
231
|
-
| [SECURITY.md](../SECURITY.md) | 私下上报漏洞 |
|
|
232
|
-
| [SUPPORT.md](../SUPPORT.md) | 支持范围与提问渠道 |
|
|
239
|
+
| [CONTRIBUTING.zh.md](../CONTRIBUTING.zh.md) | 开发循环、质量门、探针 |
|
|
240
|
+
| [SECURITY.zh.md](../SECURITY.zh.md) | 私下上报漏洞 |
|
|
241
|
+
| [SUPPORT.zh.md](../SUPPORT.zh.md) | 支持范围与提问渠道 |
|
|
233
242
|
| [docs/RELEASING.md](RELEASING.md) | 发布检查单 |
|
|
234
243
|
|
|
235
244
|
## 许可
|