dsh-plugin-wsl-env 0.22.0 → 0.23.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/CONTRIBUTING.md +7 -3
  3. package/README.md +11 -9
  4. package/SUPPORT.md +1 -1
  5. package/cordis.patch.yml +4 -4
  6. package/docs/AGENT-PROTOCOL-V7.md +4 -4
  7. package/docs/API.md +12 -2
  8. package/docs/ARCHITECTURE.md +59 -19
  9. package/docs/CONFIGURATION.md +40 -18
  10. package/docs/CONFIGURATION.zh.md +44 -8
  11. package/docs/DIAGNOSTICS.md +19 -6
  12. package/docs/DIAGNOSTICS.zh.md +15 -6
  13. package/docs/LIMITATIONS.md +42 -17
  14. package/docs/LIMITATIONS.zh.md +47 -12
  15. package/docs/MIGRATION.md +1 -1
  16. package/docs/PEER-PARITY.md +8 -7
  17. package/docs/QUICKSTART.md +16 -8
  18. package/docs/QUICKSTART.zh.md +22 -4
  19. package/docs/README.zh.md +19 -10
  20. package/docs/RELEASING.md +8 -3
  21. package/docs/REQUIREMENTS.zh.md +11 -6
  22. package/docs/ROADMAP-1.0.md +12 -11
  23. package/docs/ROADMAP.md +10 -8
  24. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
  25. package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
  26. package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
  27. package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
  28. package/docs/VALUE.zh.md +5 -5
  29. package/docs/root-fs-routing.md +26 -19
  30. package/lib/agent-confined.d.ts +2 -2
  31. package/lib/agent-confined.js +0 -1
  32. package/lib/agent-exec.d.ts +2 -11
  33. package/lib/agent-protocol.d.ts +6 -5
  34. package/lib/agent.d.ts +5 -5
  35. package/lib/auto-preset.d.ts +4 -3
  36. package/lib/bwrap.d.ts +2 -1
  37. package/lib/client-host.d.ts +1 -1
  38. package/lib/client-host.js +1 -1
  39. package/lib/cwd-prompt-tool.d.ts +4 -20
  40. package/lib/cwd-prompt.d.ts +11 -10
  41. package/lib/distro-route.d.ts +3 -2
  42. package/lib/doctor-live.d.ts +2 -1
  43. package/lib/fs-routing.d.ts +29 -1
  44. package/lib/fs-routing.js +30 -3
  45. package/lib/fs-substrate.d.ts +0 -1
  46. package/lib/fs-substrate.js +0 -1
  47. package/lib/fsio-agent.d.ts +3 -21
  48. package/lib/fsio-agent.js +2 -4
  49. package/lib/git-exec.d.ts +3 -2
  50. package/lib/git-route.d.ts +4 -2
  51. package/lib/git-route.js +4 -2
  52. package/lib/index.d.ts +9 -10
  53. package/lib/index.js +124 -12
  54. package/lib/listing.d.ts +2 -1
  55. package/lib/messages.d.ts +1 -1
  56. package/lib/native-agent.d.ts +3 -2
  57. package/lib/paths.d.ts +2 -1
  58. package/lib/picker.d.ts +1 -14
  59. package/lib/picker.js +1 -2
  60. package/lib/preflight.d.ts +5 -4
  61. package/lib/probe-cache.d.ts +2 -1
  62. package/lib/sandbox-core.d.ts +2 -11
  63. package/lib/sandbox-core.js +1 -1
  64. package/lib/sandbox.d.ts +0 -1
  65. package/lib/sandbox.js +0 -4
  66. package/lib/search-exec.d.ts +2 -1
  67. package/lib/session-runtime.d.ts +3 -2
  68. package/lib/shell-env.d.ts +3 -2
  69. package/lib/shell.d.ts +1 -1
  70. package/lib/shell.js +1 -1
  71. package/lib/subprocess.d.ts +1 -1
  72. package/lib/update-check.d.ts +3 -3
  73. package/lib/wsl-doctor-command.d.ts +38 -10
  74. package/lib/wsl-doctor-command.js +168 -27
  75. package/lib/wsl-doctor-tool.d.ts +9 -16
  76. package/lib/wsl-doctor-tool.js +10 -4
  77. package/lib/wsl.d.ts +3 -2
  78. package/package.json +27 -33
  79. package/scripts/bootstrap-import.sh +189 -0
  80. package/scripts/open-wsl-vscode.ps1 +36 -0
  81. package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- _本文是 [CONFIGURATION](CONFIGURATION.md) 的中文译本,以英文版为准。_
3
+ _本页是权威版本;英文译本见 [CONFIGURATION](CONFIGURATION.md)。_
4
4
 
5
5
  ## Profile patch
6
6
 
@@ -11,9 +11,11 @@ profile 设置存放在 `$DSH_HOME/profiles/<name>/cordis.patch.yml`。可以用
11
11
 
12
12
  profile 层可以按 `id` 指向顶层行。这一层的插件行包括 `fs-routing`、
13
13
  `directory-picker-wsl`、`subprocess-wsl`、`wsl-shell-env`、`wsl-preflight`、
14
- `auto-preset` 和 `preset-wsl`。`wsl-shell` 和 `wsl-fs`
15
- 两行嵌套在 `preset-wsl.config.plugins` 内;直接按这两个 id 配置的
16
- profile 条目会被忽略,并产生 `patch: entry <id> not found` 警告。
14
+ `auto-preset`、`wsl-cwd-prompt`、`wsl-cwd-prompt-tool`、`wsl-update-check`、
15
+ `wsl-doctor-command`、`wsl-env-client-host` 和 `preset-wsl`。
16
+ `wsl-shell`、`wsl-fs` 与 `wsl-doctor-tool` 嵌套在
17
+ `preset-wsl.config.plugins` 内;直接按这些 id 配置的 profile 条目会被忽略,
18
+ 并产生 `patch: entry <id> not found` 警告。
17
19
 
18
20
  一行的 `config` 是整体替换。如果你想保留随包行中的非默认值,
19
21
  必须把它们一并写入。这对 `preset-wsl` 尤其重要:
@@ -136,6 +138,9 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
136
138
  | | `startup` | `true` | 插件加载时(即安装 + 重启后)对 pin 的或 WSL 默认发行版预先运行同一组检查,让判定在任何会话打开之前就出现在日志里。 |
137
139
  | `wsl-shell-env` | `distro` | `''` | 用于填充 `DSH_WSL_*` 环境事实的发行版。 |
138
140
  | | `portsRefreshMs` | `10000` | 监听端口快照的刷新间隔,单位毫秒。 |
141
+ | `wsl-cwd-prompt` | `enabled` | `true`(shipped) | 把 runtime context 的工作目录条目改写为发行版的 POSIX 形式。 |
142
+ | `wsl-update-check` | `enabled` | `true` | 插件是否向应用的插件管理器查询更新的稳定版。结果经 `DSH_WSL_PLUGIN_UPDATE` 送达;该检查从不安装。 |
143
+ | | `intervalMs` | `86400000` | 检查间隔,单位毫秒(启动后 2–10 分钟首查);下限一分钟。 |
139
144
 
140
145
  GUI 文件树和预览通过 `fs-routing` 使用随包的 `workspace-files` 行;
141
146
  它们不使用单独的 WSL 提供者行。要修改其 peer 定义的限额,
@@ -295,14 +300,45 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
295
300
  插件的拒绝与修复消息(`sessionSandbox` 预检判定、`bwrap` 的安装与修复提示、
296
301
  发行版/工作目录命令错误)跟随 harness 应用的语言设置:偏好经宿主 settings
297
302
  服务从 `locale` 条目的 `preference` 字段读取,切换语言无需重启应用。
298
- 内置中文(`zh`,含 `zh-CN`、`zh-Hans` 标签)与英文;其他语言——以及
299
- 没有 settings 服务的 profile 或未设置偏好的情况——渲染英文。消息内的
300
- 命令、配置键与文件路径一律不翻译。三组消息按设计保持英文:
303
+ 内置中文(`zh`,含 `zh-CN`、`zh-Hans` 标签)与英文;其他语言渲染英文。
304
+ 没有 settings 服务的 profile、或用户从未在设置中选过语言的情况,回退到
305
+ 进程的 ICU 默认区域设置——桌面应用中即操作系统 UI 语言——因此临时渲染为
306
+ 中文界面的 zh-CN Windows 仍显示中文;显式的设置选择始终优先于该回退。
307
+ 消息内的命令、配置键与文件路径一律不翻译。两组消息按设计保持英文:
301
308
  `fs-decisions` 中的 `FS_*` 拒绝文本与 fsio 复刻(工具层按字节匹配这些
302
- 字符串),以及独立运行的 `scripts/doctor.mjs`(它在应用之外执行)。
309
+ 字符串)。独立运行的 `scripts/doctor.mjs` 自带 catalog:固定骨架按宿主
310
+ 语言渲染——从 Windows 区域设置检测,可用 `--locale <标签>` 或
311
+ `DSH_WSL_DOCTOR_LOCALE` 覆盖——而逐项检查的标题、详情与修复保持英文
312
+ (修复文本携带可复制的命令),`--json` 保持语言无关。
303
313
 
304
314
  ## 诊断配置问题与拒绝
305
315
 
316
+ 在会话中模型可以自行运行诊断:`wsl_doctor` 工具(挂载在 `preset-wsl` 内)
317
+ 进程内调用 doctor,以逐项清单返回判定——每个检查带显式状态标记、按 distro
318
+ 分组、失败项下附可复制的修复——用户只要请求诊断即可。该工具按设计是交互式
319
+ 的:`depth: "quick"`(默认)只跑前置项(单 distro 约 10 秒:宿主事实、会话
320
+ 沙箱四件套、bubblewrap——无冒烟、无 registry 查询、无端口勘察),是正确的
321
+ 首次调用;`section` 把跟进收窄到一个区域(`host`、`sandbox`、`session`、
322
+ `conf`、`net`、`agent`);`depth: "full"` 是完整扫描,对所有检查负责。
323
+ `/wsl-doctor` 命令(`wsl-doctor-command` 行,部署具有命令注册表时注册)在
324
+ 宿主侧运行同样的诊断——语法 `[quick|full|<分区>] [--distro <名称>]`——并把
325
+ 同样的清单渲染在 UI 上,不进模型历史。CLI 镜像同样的范围控制:`--quick` 与
326
+ `--sections <csv>` 限定一次运行探测什么,范围化的 `--json` 报告携带其
327
+ `scope`,裁决总是指明它回答的范围(`--fix` 仍要求完整运行)。
328
+ `DSH_WSL_DOCTOR` 还携带一条现成命令,可在发行版内执行 doctor 脚本(以应用
329
+ 自身的运行时当 Node、经 interop)——运行方式为 `sh -c "$DSH_WSL_DOCTOR --json"`。
330
+ `pnpm run doctor` 是一键环境体检:Windows/WSL 版本、每个发行版的 WSL 模式、
331
+ `.wslconfig` 与 `/etc/wsl.conf` 交叉核对、磁盘、时钟、DNS、发行版及其 shell、
332
+ bubblewrap、systemd/Linger、peer 下限、新 agent 握手、残留会话 scope、已知的
333
+ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行以生效配置下计算的
334
+ 裁决(`ready` 或 `blocked`)收尾:`--json` 是机器契约(schemaVersion 2),
335
+ `--fix` 复核它修过的项(安装软件包需要 `--fix --install` 并显式确认),
336
+ `--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加的诊断文件
337
+ (`--redact` 脱敏路径),`--locale <标签>`(或 `DSH_WSL_DOCTOR_LOCALE`)
338
+ 无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
339
+ `--read-only` 拒绝与 `--fix` 或 `--install` 同用。按需的 registry 更新
340
+ 查询可用 `DSH_UPDATE_REGISTRIES` 覆盖(逗号分隔;置空即跳过,气隙机器适用)。
341
+ 判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
306
342
  CLI 发行版可用 `dsh --profile <name> --dump-config` 检查合成后的 profile,
307
343
  无需真正启动;输出会显示某行的覆盖是否生效。桌面应用没有 `dsh` 命令,
308
344
  请直接查看 `cordis.patch.yml` 与 Plugins 页面。
@@ -47,23 +47,36 @@ environment variables, and no telemetry.
47
47
 
48
48
  The doctor answers through three surfaces with one report:
49
49
 
50
- - **The standalone CLI** — `node scripts/doctor.mjs [distro] [--json] [--quick] [--sections …] [--locale <tag>]`.
50
+ - **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
51
+ (the same line `--help` prints).
51
52
  The authoritative surface: it loads **no peer dependency and no host
52
53
  service**, so it still starts when the plugin's own runtime is the thing
53
54
  that is broken. Only pure, peer-free `lib/` modules are imported; the two
54
55
  helpers that used to live behind peer-tainted modules (`lib/index.js`,
55
56
  `lib/update-check.js`) are inlined and drift-pinned against the lib exports
56
- by `test/doctor.test.mjs`. Exit 0 = `ready`, 1 = `blocked`.
57
+ by `test/doctor.test.mjs`. Exit 0 = `ready`, 1 = `blocked`, 2 = refused
58
+ (`--read-only` with `--fix`/`--install`, or `--fix` on a scoped run).
57
59
  - **The `/wsl-doctor` UI command** — the composer button drops a
58
60
  `/wsl-doctor [quick|full|<section>] [--distro <name>]` line; the commands
59
61
  registry executes it host-side, the handler spawns the standalone CLI, and
60
62
  the itemized report renders detached from model history (no model turn, no
61
63
  tokens). Without a command adapter (headless, ACP) the row is a no-op and
62
- the CLI is the surface.
64
+ the CLI is the surface. Without `--distro` the handler names the distro from
65
+ the session's live working directory (the agent-scoped `workingDirectory`
66
+ service first, then the Session header's `cwd`); when neither yields a WSL
67
+ UNC path the CLI's effective configuration decides, and the shipped `auto`
68
+ probes **every** installed distro — a sweep that costs minutes on a machine
69
+ with several (a scoped quick run is seconds). The handler therefore bounds
70
+ the subprocess (120 s when it has a distro, 60 s when the configuration has
71
+ to choose, both below the command dispatcher's own deadline) so a stalled or
72
+ unscoped run settles with a message naming the target it examined and how to
73
+ narrow it.
63
74
  - **The `wsl_doctor` model tool** — in-process via `doctorReport()`, so the
64
- live resident's state merges in. This is the only surface that depends on
65
- the model path; use the command or the CLI when the plugin's runtime itself
66
- is under suspicion.
75
+ live resident's state merges in. The collection is asynchronous: the doctor
76
+ subprocess never blocks the Host, the tool call's cancellation kills it, and
77
+ a two-minute deadline plus a bounded drain window settle a run whose child
78
+ never reports. This is the only surface that depends on the model path; use
79
+ the command or the CLI when the plugin's runtime itself is under suspicion.
67
80
 
68
81
  ## The map
69
82
 
@@ -28,7 +28,7 @@
28
28
  `--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
29
29
  受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
30
30
  会改写用户或 distro 所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1
31
- 转换、安装 distro)永不开户自动化;remedy 文本会写明。
31
+ 转换、安装 distro)永不开启自动化;补救文本会写明。
32
32
 
33
33
  `--bundle <path>` 写出本地 JSON 文件(报告 + 版本 + 生效配置)供 setup
34
34
  report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
@@ -38,20 +38,29 @@ bundle 不含文件内容、环境变量,也没有遥测。
38
38
 
39
39
  doctor 通过三个入口给出同一份报告:
40
40
 
41
- - **独立 CLI**——`node scripts/doctor.mjs [distro] [--json] [--quick] [--sections …] [--locale <tag>]`。
41
+ - **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
42
+ (与 `--help` 输出同一行)。
42
43
  这是权威入口:它**不加载任何 peer 依赖、任何宿主服务**,即使插件的运行时
43
44
  本身就是故障源,它也能启动。只 import 纯净、无 peer 的 `lib/` 模块;原先
44
45
  挂在 peer 污染模块(`lib/index.js`、`lib/update-check.js`)后面的两个
45
46
  helper 已内联,并由 `test/doctor.test.mjs` 与 lib 导出对拍防漂移。
46
- 退出码 0 = `ready`,1 = `blocked`。
47
+ 退出码 0 = `ready`,1 = `blocked`,2 = 拒绝(`--read-only` 与
48
+ `--fix`/`--install` 同用,或对范围化运行使用 `--fix`)。
47
49
  - **`/wsl-doctor` UI 命令**——composer 按钮投下
48
50
  `/wsl-doctor [quick|full|<分区>] [--distro <名称>]`;命令面在宿主侧执行,
49
51
  handler 子进程运行独立 CLI,逐项报告直接渲染在 UI 上、不进模型历史
50
52
  (无模型回合、零 token)。没有命令适配器的部署(headless、ACP)中该行是
51
- no-op,CLI 就是入口。
53
+ no-op,CLI 就是入口。未给 `--distro` 时,handler 从会话当前工作目录解析
54
+ 发行版(先读 agent 作用域的 `workingDirectory` 服务,再退回 Session 头部
55
+ 记录的 `cwd`);两者都给不出 WSL UNC 路径时,由 CLI 的生效配置决定,而
56
+ 随包预设的 `auto` 会逐个检查**所有**已安装发行版——多发行版机器上是数分钟
57
+ 的开销(收窄到单个发行版的 quick 运行只需数秒)。因此 handler 给子进程设了
58
+ 时限(解析出发行版时 120 秒、交给配置决定时 60 秒,均低于命令面自身的
59
+ 截止时间),停摆或未收窄的运行会给出消息,说明本次检查的目标与如何收窄。
52
60
  - **`wsl_doctor` 模型工具**——经 `doctorReport()` 进程内采集,会合并常驻
53
- agent 的实时状态。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,
54
- 用命令或 CLI。
61
+ agent 的实时状态。采集是异步的:doctor 子进程不再阻塞宿主,工具调用的取消
62
+ 会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
63
+ 结论。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,用命令或 CLI。
55
64
 
56
65
  ## 地图
57
66
 
@@ -1,6 +1,6 @@
1
1
  # Limitations
2
2
 
3
- *A Chinese translation lives at [LIMITATIONS.zh](LIMITATIONS.zh.md); the English version is authoritative.*
3
+ *The Chinese version ([LIMITATIONS.zh](LIMITATIONS.zh.md)) is authoritative; this page is its English translation.*
4
4
 
5
5
  What the plugin does not do, and why. A limitation that is documented is a design
6
6
  boundary; one that is not is a bug report waiting to happen. Each entry states the
@@ -17,8 +17,8 @@ operations never use the 9p share.
17
17
  bits; `chmod` when a new file must be executable.
18
18
  - **When the agent is out, file operations fail closed** — `FS_IO_ERROR` naming the
19
19
  substrate, with the recovery path. One crash rides a single rebuild; a spent
20
- rebuild enters bounded revival (2/4/8 s); three deaths are permanent until the app
21
- restarts. There is no fallback I/O — deliberately.
20
+ rebuild enters bounded revival (2/4/8 s) for three attempts; the fourth death
21
+ is permanent until the app restarts. There is no fallback I/O — deliberately.
22
22
  - **The mutation guard is not atomic compare-and-swap.** Creates use a no-replace
23
23
  link; overwrites re-verify the version before the rename. A mismatch returns
24
24
  `FS_STALE_VERSION`, but a change between check and rename can still be overwritten.
@@ -82,8 +82,9 @@ operations never use the 9p share.
82
82
  packaged binary; `native` refuses on preparation failure; `shell` forces the shell
83
83
  agent.
84
84
  - **The session runtime needs systemd and a lingering user manager** — refused on the
85
- first command with the remedy otherwise; `sessionSandbox: false` keeps the old
86
- per-command shape. A hard app crash can leave a stale `dsh-wsl-*.scope`; the
85
+ first command with the remedy otherwise; `sessionSandbox` set to `auto`
86
+ (per-command without systemd) or `false` keeps the old per-command shape.
87
+ A hard app crash can leave a stale `dsh-wsl-*.scope`; the
87
88
  preflight sweeps stale scopes on the next WSL session (never another live
88
89
  session's).
89
90
  - **The sandbox does not govern WSL interop** — reported as `enforcement: partial`.
@@ -98,10 +99,12 @@ operations never use the 9p share.
98
99
  remedies and distro/workdir errors follow the app's Language setting
99
100
  ([CONFIGURATION.md](CONFIGURATION.md#message-language)); the `FS_*` refusal texts
100
101
  in `fs-decisions` and the fsio replica stay byte-identical English because the
101
- tool layer matches on those strings, and the standalone `scripts/doctor.mjs`
102
- always prints English because it runs outside the app and cannot read the
103
- host's locale preference. A remedy composed at probe time keeps the language
104
- the probe ran in until that probe runs again.
102
+ tool layer matches on those strings. The standalone `scripts/doctor.mjs`
103
+ localizes only its fixed skeleton — verdict, marks, summary, hints — through
104
+ its own catalogs, detected from the Windows locale (`--locale <tag>` /
105
+ `DSH_WSL_DOCTOR_LOCALE` override); per-check titles, details and remedies
106
+ stay English because remedies carry copy-paste commands, and `--json` stays
107
+ language-independent.
105
108
  - A workspace directory deleted mid-session fails with a runner error; the plugin
106
109
  does not recreate it. A configured `cwd` that does not exist is reported as an
107
110
  error naming the directory.
@@ -147,6 +150,16 @@ about the machine and the configuration, not about a session: the
147
150
  [DIAGNOSTICS.md](DIAGNOSTICS.md#the-map)) are per-call decisions the doctor
148
151
  cannot predict, and `ready` does not promise them away.
149
152
 
153
+ **`/wsl-doctor` without a resolvable distro still sweeps the configuration.**
154
+ The command names the distro from the session's working directory; a session on
155
+ a Windows folder, or one whose cwd cannot resolve, leaves the target to the
156
+ effective configuration, and the shipped `auto` probes every installed distro —
157
+ measured at ~4 minutes for eight on the development machine, against seconds
158
+ for a scoped run. Pass `--distro <name>` when that is not what you want (the
159
+ CLI's `--all` says the same thing explicitly). The handler bounds an unresolved
160
+ run at 60 s (a resolved one at 120 s) so it settles with the narrowing hint
161
+ instead of leaving the card "executing" for the dispatcher's whole budget.
162
+
150
163
  The doctor reads and reports; it never rewrites user- or distro-owned files.
151
164
  `.wslconfig`, `/etc/wsl.conf`, a WSL1 conversion and distro installation are
152
165
  remedy-only — the remedy text carries the exact command — and the fixable set
@@ -189,14 +202,19 @@ the sandbox's security statement: `enforcement: partial` is untouched.
189
202
  app. Two alternatives: the doctor's `git.win-safe` probe reports the state, and a
190
203
  machine **without** Windows git needs nothing — the provider routes discovery into
191
204
  the distro and translates the output into UNC form.
192
- - **Colon-separated multi-directory `GIT_*` values pass through untranslated.**
193
- The git environment translation rewrites single Windows directory values; a
194
- colon-separated list (no current caller sets one) is forwarded as-is.
195
- - **A NEW tab's title reads `WSL`** whatever it runs — the controller titles from the
196
- composition's profile before the provider rewrites the launch, and a plugin cannot
197
- correct the default ([UPSTREAM-TERMINAL-TITLE.md](UPSTREAM-TERMINAL-TITLE.md)).
198
- The menu ships host candidates (`powershell`, `cmd`): a manually selected shell is
199
- titled after itself; double-click rename also works.
205
+ - **A multi-directory `GIT_*` value is translated, not skipped — and a
206
+ Windows-form list comes out wrong.** The translation applies the single-value
207
+ translator to every `GIT_*` value unchecked, so a list folds onto the first
208
+ drive's mount (`C:\a;D:\b` becomes `/mnt/c/a;D:/b`); only a POSIX-form colon
209
+ list (`/a:/b`) passes through verbatim (no current caller sets a list).
210
+ - **A NEW tab's title reads `WSL`** whatever it runs — the controller stamps
211
+ `title: shell.name` from the composition's profile only after `spawnTerminal`
212
+ has returned, after the provider's rewrite has already run, and it never reads
213
+ back the program the launch really started (the spawn spec carries no
214
+ display-name field), so a plugin cannot correct the default
215
+ ([UPSTREAM-TERMINAL-TITLE.md](UPSTREAM-TERMINAL-TITLE.md)). The menu ships
216
+ host candidates (`powershell`, `cmd`): a manually selected shell is titled
217
+ after itself; double-click rename also works.
200
218
  - **Distro terminals ARE reclaimed when idle** — the handle counts the marked
201
219
  processes through the resident agent (exactly one at its prompt = `idle`; a nested
202
220
  shell or an `ssh-agent` from startup files reads `busy` by design). Threshold: the
@@ -225,3 +243,10 @@ the sandbox's security statement: `enforcement: partial` is untouched.
225
243
  Host runs with `ELECTRON_RUN_AS_NODE=1`, which the launcher inherits, so
226
244
  `Code.exe` starts as Node and exits 1. Not owned by this repository:
227
245
  [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md).
246
+ - **WSL files open again, but relative Markdown images no longer render in the
247
+ WSL preview.** The router's `processPath` now answers in UNC host spelling —
248
+ the shape `session.openWorkspacePath` / `workspacePathApplications` verify
249
+ (issue #37) — and the client's `fileMediaUrl` rejects a `\\`-prefixed path, so
250
+ a Markdown preview's relative image does not resolve. Chat images already had
251
+ that gap (the Session cwd is UNC). The same spelling is why the GUI change
252
+ feed, `stat.absolutePath`, and the preview header's path label carry UNC.
@@ -1,6 +1,6 @@
1
1
  # Limitations
2
2
 
3
- _本文是 [LIMITATIONS](LIMITATIONS.md) 的中文译本,以英文版为准。_
3
+ _本页是权威版本;英文译本见 [LIMITATIONS](LIMITATIONS.md)。_
4
4
 
5
5
  插件不做什么,以及为什么。写进文档的限制是设计边界;
6
6
  没写进文档的迟早会变成 bug 报告。每一条都说明限制本身和补救方法;
@@ -16,7 +16,8 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
16
16
  新文件需要可执行时请 `chmod`。
17
17
  - **agent 不在时,文件操作关闭(fail closed)** —— 报 `FS_IO_ERROR`,指明
18
18
  substrate,并附带恢复路径。一次崩溃可用一次重建;重建耗尽后进入有界复活
19
- (2/4/8 s);三次死亡则永久退出,直到应用重启。没有回退 I/O——这是有意为之。
19
+ (2/4/8 s),共三次尝试;第 4 次死亡才永久退出,直到应用重启。没有回退
20
+ I/O——这是有意为之。
20
21
  - **变更守卫不是原子的比较并交换。** 创建使用不可替换的 link;覆盖在 rename 前
21
22
  会重新校验版本。不匹配时返回 `FS_STALE_VERSION`,但检查与 rename 之间发生的
22
23
  变更仍可能被覆盖。
@@ -77,8 +78,9 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
77
78
  [COMPATIBILITY.md](COMPATIBILITY.md#scope-decisions))。`auto` 仍会选择
78
79
  包内二进制;`native` 在准备失败时拒绝;`shell` 强制使用 shell agent。
79
80
  - **会话 runtime 需要 systemd 和带 linger 的 user manager** —— 否则在
80
- 第一条命令时被拒绝并给出补救方法;`sessionSandbox: false` 保留旧的
81
- 按命令形态。应用硬崩溃可能留下过期的 `dsh-wsl-*.scope`;预检会在下一个
81
+ 第一条命令时被拒绝并给出补救方法;把 `sessionSandbox` 设为 `auto`
82
+ (无 systemd 时即按命令形态)或 `false` 保留旧的按命令形态。应用硬崩溃
83
+ 可能留下过期的 `dsh-wsl-*.scope`;预检会在下一个
82
84
  WSL 会话时清扫过期 scope(从不清扫其他活跃会话的)。
83
85
  - **沙箱不管辖 WSL interop** —— 上报为 `enforcement: partial`。
84
86
  `maskWindowsDrive` 和 `interopVisibility` 收窄 `/mnt` 但不是关闭;即使是
@@ -92,9 +94,10 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
92
94
  发行版/工作目录错误跟随应用的语言设置
93
95
  ([CONFIGURATION.zh.md](CONFIGURATION.zh.md#消息语言));`fs-decisions`
94
96
  中的 `FS_*` 拒绝文本与 fsio 复刻保持逐字节英文,因为工具层按这些字符串
95
- 匹配;独立的 `scripts/doctor.mjs` 永远输出英文,因为它在应用之外运行,
96
- 读不到宿主的语言偏好。探测时合成的修复文本保持探测发生时的语言,
97
- 直到该探测再次运行。
97
+ 匹配。独立的 `scripts/doctor.mjs` 只本地化其固定骨架——裁决、状态标记、
98
+ 汇总、提示——经自带 catalog 按检测到的 Windows 区域设置渲染
99
+ (`--locale <标签>` / `DSH_WSL_DOCTOR_LOCALE` 可覆盖);逐项检查的标题、
100
+ 详情与修复保持英文,因为修复文本携带可复制的命令;`--json` 保持语言无关。
98
101
  - 会话中途被删除的工作区目录会以 runner 错误失败;插件不会重建它。
99
102
  配置的 `cwd` 不存在时,报错会指明该目录。
100
103
 
@@ -128,6 +131,28 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
128
131
  的信任状态** —— 装了 Windows git 时,WSL 变更审查需要那份
129
132
  `safe.directory` 白名单(见下文"终端")。
130
133
 
134
+ ## doctor 的裁决与补救边界
135
+
136
+ doctor 的 `verdict` 在生效配置(应用加载的 profile 层叠加在随包 preset
137
+ 之上)下给出——但它是对机器与配置的裁决,不是对某个会话的:**policy** 与
138
+ **data** 类的错误码(见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md#地图))是
139
+ 逐次调用的决策,doctor 无法预知,`ready` 也不为它们背书。
140
+
141
+ **无法解析出发行版时,`/wsl-doctor` 仍会按配置全量扫描。** 命令从会话工作
142
+ 目录取发行版;会话开在 Windows 文件夹上、或 cwd 无法解析时,目标交给生效
143
+ 配置,而随包预设的 `auto` 会逐个检查所有已安装发行版——在开发机上实测八个
144
+ 发行版约 4 分钟,而收窄到单个发行版只需数秒。不想要这个结果就传
145
+ `--distro <名称>`(CLI 的 `--all` 是同一件事的显式写法)。handler 给未收窄
146
+ 的运行设 60 秒时限(已解析出发行版时 120 秒),让它带着收窄提示收尾,而不是
147
+ 一直显示「执行中」直到命令面的整个预算耗尽。
148
+
149
+ doctor 只读取和报告,从不改写用户或发行版所有的文件。`.wslconfig`、
150
+ `/etc/wsl.conf`、WSL1 转换和发行版安装只以补救命令的形式出现——补救文本
151
+ 携带确切的命令;可自动修复的集合仅限安全且可逆的部分(过期 scope、
152
+ `--install` 加确认后的可选软件包、以及同一道确认门后的 Windows git
153
+ `safe.directory` 白名单)。裁决从不升级沙箱的安全声明:
154
+ `enforcement: partial` 不受影响。
155
+
131
156
  ## 会话启动建议
132
157
 
133
158
  - **DSH 0.2.1 没有会话 UI 通知接缝。** `wsl-preflight` 的失败进入宿主日志
@@ -161,11 +186,15 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
161
186
  应用。两个替代方案:doctor 的 `git.win-safe` 探针可报告该状态;而
162
187
  **没有** Windows git 的机器什么都不用做——提供者把发现请求路由进
163
188
  发行版,并把输出转写成 UNC 形式。
164
- - **冒号分隔的多目录 `GIT_*` 值不做转写直接透传。** git 环境转写只改写单个
165
- Windows 目录值;冒号分隔的列表(当前没有调用方设置这种形态)原样转发。
166
- - **NEW 标签页的标题显示 `WSL`**,无论它实际运行什么——控制器在提供者
167
- 改写启动命令之前就按 composition 的 profile 命名了,而插件无法纠正
168
- 这个默认值([UPSTREAM-TERMINAL-TITLE.md](UPSTREAM-TERMINAL-TITLE.md))。
189
+ - **多目录 `GIT_*` 值会被转写而不是跳过——Windows 形态的列表会译坏。**
190
+ git 环境转写对每个 `GIT_*` 值无条件套用单值翻译,列表被折叠进首个盘符的
191
+ 挂载点(`C:\a;D:\b` 变成 `/mnt/c/a;D:/b`);只有 POSIX 形态的冒号列表
192
+ (`/a:/b`)原样透传(当前没有调用方设置列表值)。
193
+ - **NEW 标签页的标题显示 `WSL`**,无论它实际运行什么——控制器是在
194
+ `spawnTerminal` 返回之后(即提供者的改写已经执行完之后)才按 composition
195
+ 的 profile 盖上 `title: shell.name`,且从不回读启动真正运行的程序
196
+ (spawn spec 没有 display-name 字段),插件因此无法纠正这个默认值
197
+ ([UPSTREAM-TERMINAL-TITLE.md](UPSTREAM-TERMINAL-TITLE.md))。
169
198
  菜单附带宿主候选(`powershell`、`cmd`):手动选择的 shell 会以自身命名;
170
199
  双击重命名也可行。
171
200
  - **发行版终端空闲时确实会被回收** —— 通过常驻 agent 对被标记的进程计数
@@ -191,3 +220,9 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
191
220
  宿主带着 `ELECTRON_RUN_AS_NODE=1` 运行,启动器会继承它,于是
192
221
  `Code.exe` 以 Node 身份启动并以退出码 1 结束。不属于本仓库管:
193
222
  [UPSTREAM-OPEN-IN-APP.md](UPSTREAM-OPEN-IN-APP.md)。
223
+ - **WSL 文件可以正常打开,但预览里的相对 Markdown 图片不再渲染** ——
224
+ 路由的 `processPath` 现在返回 UNC 宿主拼写,这是
225
+ `session.openWorkspacePath` / `workspacePathApplications` 校验所要求的形态
226
+ (issue #37);客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径,因此 Markdown
227
+ 预览中的相对图片无法解析。聊天侧因 cwd 本就是 UNC,此前已有同一缺口。
228
+ GUI change feed、`stat.absolutePath` 与预览头部的路径标签的 UNC 形态也源于同一拼写。
package/docs/MIGRATION.md CHANGED
@@ -74,7 +74,7 @@ shows the composed value.
74
74
  | Gate | How | Runs where |
75
75
  |---|---|---|
76
76
  | Config docs and CHANGELOG current | review the diff; `lint:links` covers cross-references | CI |
77
- | `pnpm test` | style, links, syntax, build freshness, tsc, 42 unit files | CI (Node 22/24, Ubuntu + Windows) |
77
+ | `pnpm test` | style, links, requirement citations, doc consistency, syntax, build freshness, tsc, 48 unit files | CI (Node 22/24, Ubuntu + Windows) |
78
78
  | `pnpm run test:coverage` | lines 85 / branches 84 / functions 70 | CI (Node 24, Ubuntu) |
79
79
  | Peer line tested | `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
80
80
  | Packed install/upgrade/uninstall | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker) | manual, this machine (10/10 on 2026-11-06; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
@@ -20,8 +20,9 @@ file records the verification against the real peers.
20
20
  Every replicated string survived verbatim; the fsio **read path** holds end
21
21
  to end and the **edit path** carries the same two declared divergences, listed
22
22
  at the end. The release also added a `FS_ERROR_CODES` const export with two
23
- new codes (`FS_PATCH_MISMATCH`, `FS_SAME_TARGET`) for operations this plugin
24
- does not serve — see the new-peer-operations section at the end.
23
+ new codes (`FS_PATCH_MISMATCH`, `FS_SAME_TARGET`). The plugin serves those
24
+ operations for real over protocol v7 — see the new-peer-operations section
25
+ at the end.
25
26
  `dsh-bash-local@0.2.2-rc.1`'s `lib/index.js` is byte-identical to
26
27
  `0.2.1-rc.3`'s (only manifests and locale files changed), so its references
27
28
  stand. `dsh-fs@0.2.2-rc.1` still has no `./invariant` export subpath; this
@@ -40,10 +41,10 @@ file records the verification against the real peers.
40
41
 
41
42
  ```sh
42
43
  mkdir -p /tmp/peer-audit && cd /tmp/peer-audit
43
- npm pack @deepseek-ai/dsh-fs-local@0.2.1-rc.3 @deepseek-ai/dsh-fs@0.2.1-rc.3 --pack-destination .
44
- openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.1-rc.3.tgz | base64 -w0
45
- tar xzf deepseek-ai-dsh-fs-local-0.2.1-rc.3.tgz # -> package/lib/index.js
46
- wc -l package/lib/index.js # expect 909
44
+ npm pack @deepseek-ai/dsh-fs-local@0.2.2-rc.1 @deepseek-ai/dsh-fs@0.2.2-rc.1 --pack-destination .
45
+ openssl dgst -sha512 -binary deepseek-ai-dsh-fs-local-0.2.2-rc.1.tgz | base64 -w0
46
+ tar xzf deepseek-ai-dsh-fs-local-0.2.2-rc.1.tgz # -> package/lib/index.js
47
+ wc -l package/lib/index.js # expect 1048
47
48
  ```
48
49
 
49
50
  The tarballs this audit compared, by content — the same values
@@ -102,7 +103,7 @@ declared extensions, listed at the end.
102
103
  2. **Per-stream truncation flags.** The EXEC frame carries an output budget;
103
104
  the RES line reports which streams the agent cut, surfaced as honest
104
105
  `truncated` flags. The collect-budget/spill machinery of the shell peer,
105
- `@deepseek-ai/dsh-bash-local@0.2.1-rc.3` (`lib/index.js:30`, `:110`), is the
106
+ `@deepseek-ai/dsh-bash-local@0.2.2-rc.1` (`lib/index.js:30`, `:110`), is the
106
107
  spill-file path we deliberately do not run.
107
108
  3. **The transport around the ops** (ACK, KILL, the confined resident) is
108
109
  protocol this package owns; the peer has no agent.
@@ -1,6 +1,6 @@
1
1
  # Quickstart
2
2
 
3
- *A Chinese translation lives at [QUICKSTART.zh](QUICKSTART.zh.md); the English version is authoritative.*
3
+ *The Chinese version ([QUICKSTART.zh](QUICKSTART.zh.md)) is authoritative; this page is its English translation.*
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.
@@ -23,12 +23,14 @@ supplies the WSL environment.
23
23
  | systemd + Linger (for the session runtime) | `node <plugin>/scripts/doctor.mjs` (installed) or `pnpm run doctor` (checkout) | `[boot] systemd=true` in `/etc/wsl.conf`, `wsl --shutdown`, then `loginctl enable-linger "$USER"`; or set `sessionSandbox: auto`/`false` |
24
24
  | Node `^22.19.0` or `>=24.0.0` | only needed for source/development work | not needed inside the distro to use the published plugin |
25
25
 
26
- No terminal at hand? In a session, ask for a diagnosis: the model runs the
27
- `wsl_doctor` tool (mounted by this plugin) and the verdict — `ready`, or
28
- `blocked` with per-failure copy-paste remedies — lands in the transcript.
29
- The session-start preflight announces the same verdict on every session
30
- start. `DSH_WSL_DOCTOR` additionally carries a ready-to-run command for the
31
- doctor script itself (`sh -c "$DSH_WSL_DOCTOR --json"`).
26
+ No terminal at hand? Three ways without one: the **WSL 诊断** button in the
27
+ composer opens a menu (quick, full, or one section) and drops a `/wsl-doctor`
28
+ command that runs host-side and renders in the UI — no model turn, no tokens;
29
+ in a session, ask for a diagnosis and the model runs the `wsl_doctor` tool
30
+ (mounted by this plugin), the verdict landing in the transcript; and the
31
+ session-start preflight announces the same verdict on every session start.
32
+ `DSH_WSL_DOCTOR` additionally carries a ready-to-run command for the doctor
33
+ script itself (`sh -c "$DSH_WSL_DOCTOR --json"`).
32
34
 
33
35
  The doctor (`scripts/doctor.mjs`, or `pnpm run doctor` from a checkout) checks
34
36
  the environment and ends in a verdict: `ready` means the first command should
@@ -37,7 +39,13 @@ remedy. It reads the distro's WSL mode from `wsl.exe -l -v` itself, so no
37
39
  separate version check is needed. Doctor is read-only unless you pass `--fix`
38
40
  (stale scopes, and the Windows git trust after a confirmation) or
39
41
  `--fix --install` (packages, after a confirmation); `--bundle <path>` writes
40
- the diagnostic file a setup report attaches.
42
+ the diagnostic file a setup report attaches (`--redact` strips the paths
43
+ from it). A run can be scoped — `--quick` probes the first-command
44
+ prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the
45
+ named sections — or widened with `--all` to every installed distro; the
46
+ report itemizes every check with an explicit status marker, grouped by
47
+ distro. The fixed skeleton renders in the host's language
48
+ (`--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE` overrides the detection).
41
49
 
42
50
  ## 2. Install
43
51
 
@@ -1,6 +1,6 @@
1
1
  # Quickstart
2
2
 
3
- _本文是 [QUICKSTART](QUICKSTART.md) 的中文译本,以英文版为准。_
3
+ _本页是权威版本;英文译本见 [QUICKSTART](QUICKSTART.md)。_
4
4
 
5
5
  从一台 Windows + WSL 2 机器到可用的 WSL 会话,只需以下步骤。
6
6
  本页是入口;每条说明都链接到负责该主题的文档。
@@ -22,10 +22,24 @@ _本文是 [QUICKSTART](QUICKSTART.md) 的中文译本,以英文版为准。_
22
22
  | systemd + Linger(会话 runtime 需要) | `node <plugin>/scripts/doctor.mjs`(已安装)或 `pnpm run doctor`(检出目录) | 在 `/etc/wsl.conf` 设置 `[boot] systemd=true`,`wsl --shutdown`,然后 `loginctl enable-linger "$USER"`;或设置 `sessionSandbox: auto`/`false` |
23
23
  | Node `^22.19.0` 或 `>=24.0.0` | 仅源码/开发工作需要 | 使用已发布的插件时,发行版内不需要 Node |
24
24
 
25
+ 手边没有终端?有三条不依赖终端的路:composer 里的 **WSL 诊断** 按钮打开菜单
26
+ (quick、full 或单个分区),投下一条 `/wsl-doctor` 命令——宿主侧执行、直接在
27
+ UI 渲染,不进模型对话、零 token;在会话里请求诊断,模型会运行本插件挂载的
28
+ `wsl_doctor` 工具,判定落在对话里;会话启动预检在每次会话打开时通报同样的
29
+ 判定。`DSH_WSL_DOCTOR` 还携带一条现成命令,可在发行版内执行 doctor 脚本本身
30
+ (`sh -c "$DSH_WSL_DOCTOR --json"`)。
31
+
25
32
  doctor(`scripts/doctor.mjs`,或在检出目录中运行 `pnpm run doctor`)会检查
26
- 环境并针对检测到的失败打印补救方法。发行版的 WSL 版本请单独用
27
- `wsl.exe -l -v` 确认。doctor 默认只读,除非传入 `--fix`(清理过期 scope)或
28
- `--fix --install`(安装软件包,需确认)。
33
+ 环境并以裁决收尾:`ready` 表示首条命令应能成功;`blocked` 会列明待修项,
34
+ 每项附可复制的处理办法。发行版的 WSL 模式由 doctor 自己从 `wsl.exe -l -v`
35
+ 读取,无需单独确认。doctor 默认只读,除非传入 `--fix`(清理过期 scope,以及
36
+ 确认后的 Windows git 信任)或 `--fix --install`(安装软件包,需确认);
37
+ `--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact`
38
+ 将其中的路径脱敏)。运行可以收窄范围——`--quick` 只探首条命令的前置项
39
+ (约 10 秒),`--sections <分区清单>`(逗号分隔)只运行指定分区——
40
+ 或用 `--all` 扩展到每个已装发行版;报告按 distro 分组逐项列出每个检查,
41
+ 带显式状态标记。固定骨架按宿主语言渲染(`--locale <标签>` 或
42
+ `DSH_WSL_DOCTOR_LOCALE` 可覆盖检测)。
29
43
 
30
44
  ## 2. 安装
31
45
 
@@ -92,6 +106,10 @@ Remote-WSL 扩展。
92
106
  [doctor](CONFIGURATION.md) 和[故障排查表](../README.md#troubleshooting)
93
107
  覆盖了常见情况。
94
108
 
109
+ 首次写入说明:沙箱会在会话策略尚未授予的写入前请求许可——提示会写明命令
110
+ 与目标,允许一次是安全的。在发行版内执行 `loginctl enable-linger <用户>`
111
+ 可以避免非 lingering 的 user manager 造成的重复弹窗。
112
+
95
113
  下面的探针会实时运行随包的、由内核强制的 bwrap profile——
96
114
  工作区内的写入生效,测试性的区外写入被以 `EROFS` 拒绝,
97
115
  严格 profile 则把 `/mnt` 完全隐藏