dsh-plugin-wsl-env 0.28.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +368 -0
- package/CONTRIBUTING.md +68 -12
- package/CONTRIBUTING.zh.md +34 -4
- package/README.md +1 -1
- package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
- package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
- package/agent/wsl-agent.sh +15 -4
- package/client.js +540 -160
- package/cordis.patch.yml +28 -7
- package/docs/AGENT-PROTOCOL-V7.md +4 -2
- package/docs/API.md +1 -1
- package/docs/API.zh.md +1 -1
- package/docs/ARCHITECTURE.md +7 -4
- package/docs/ARCHITECTURE.zh.md +6 -4
- package/docs/COMPATIBILITY.md +1 -1
- package/docs/COMPATIBILITY.zh.md +1 -1
- package/docs/CONFIGURATION.md +28 -15
- package/docs/CONFIGURATION.zh.md +20 -11
- package/docs/DIAGNOSTICS.md +45 -19
- package/docs/DIAGNOSTICS.zh.md +33 -15
- package/docs/LIMITATIONS.md +70 -10
- package/docs/LIMITATIONS.zh.md +53 -8
- package/docs/PERFORMANCE.md +29 -1
- package/docs/PERFORMANCE.zh.md +23 -1
- package/docs/QUICKSTART.md +21 -15
- package/docs/QUICKSTART.zh.md +13 -11
- package/docs/README.zh.md +1 -1
- package/docs/RELEASING.md +29 -6
- package/docs/RELEASING.zh.md +9 -0
- package/docs/adr/0002-native-agent.md +50 -2
- package/lib/agent-confined.js +15 -4
- package/lib/agent-errors.d.ts +16 -0
- package/lib/agent-errors.js +19 -0
- package/lib/agent-exec.d.ts +8 -1
- package/lib/agent-exec.js +2 -1
- package/lib/agent-shared.d.ts +85 -2
- package/lib/agent-shared.js +167 -38
- package/lib/agent.d.ts +60 -6
- package/lib/agent.js +177 -28
- package/lib/auto-preset.js +7 -2
- package/lib/doctor-live.d.ts +36 -7
- package/lib/doctor-live.js +61 -12
- package/lib/doctor-process.d.ts +68 -0
- package/lib/doctor-process.js +139 -0
- package/lib/doctor-report.js +11 -109
- package/lib/fs-substrate.js +3 -3
- package/lib/fsio-agent.d.ts +57 -6
- package/lib/fsio-agent.js +168 -75
- package/lib/git-exec.d.ts +7 -1
- package/lib/git-exec.js +14 -2
- package/lib/native-agent.d.ts +25 -4
- package/lib/native-agent.js +52 -9
- package/lib/picker.d.ts +2 -1
- package/lib/picker.js +30 -13
- package/lib/plugin-update.js +18 -14
- package/lib/provider-common.d.ts +112 -0
- package/lib/provider-common.js +171 -0
- package/lib/sandbox-core.js +52 -13
- package/lib/search-exec.d.ts +6 -0
- package/lib/search-exec.js +10 -2
- package/lib/session-runtime.d.ts +46 -1
- package/lib/session-runtime.js +57 -7
- package/lib/session-scope.d.ts +22 -1
- package/lib/session-scope.js +33 -7
- package/lib/shell-env.js +125 -12
- package/lib/socket-isolation.d.ts +12 -4
- package/lib/socket-isolation.js +27 -10
- package/lib/status.d.ts +7 -4
- package/lib/status.js +72 -16
- package/lib/subprocess.js +3 -3
- package/lib/terminal-activity.js +6 -9
- package/lib/wsl-doctor-command.js +36 -80
- package/lib/wsl-filesystem.d.ts +9 -4
- package/lib/wsl-filesystem.js +26 -10
- package/lib/wsl-shell.d.ts +27 -17
- package/lib/wsl-shell.js +83 -24
- package/lib/wsl.d.ts +3 -1
- package/lib/wsl.js +82 -7
- package/package.json +5 -4
- package/scripts/bootstrap.sh +36 -12
- package/scripts/doctor.mjs +514 -201
package/cordis.patch.yml
CHANGED
|
@@ -302,18 +302,24 @@
|
|
|
302
302
|
# Generated from the shipped standard preset so the embedded plan-mode
|
|
303
303
|
# section and every nested group survive byte-for-byte: this copy is
|
|
304
304
|
# `packages/bundle/web-app/presets/standard.patch.yml` of the
|
|
305
|
-
# `dsh-v0.2.2-rc.
|
|
306
|
-
# in exactly
|
|
305
|
+
# `dsh-v0.2.2-rc.2` source tree — the line the dev pins name — changed
|
|
306
|
+
# in exactly four ways:
|
|
307
307
|
# 1. every shipped row mounts inside `wsl-env`, so the preset's tools see
|
|
308
308
|
# the distro's shell and fs (the realm is declared on the group);
|
|
309
309
|
# 2. `tool-bash` is enabled and `tool-pwsh` disabled outright, where the
|
|
310
310
|
# shipped copy derives the choice from `process.platform`;
|
|
311
311
|
# 3. the identity and display metadata: row `preset-wsl`, preset `wsl`,
|
|
312
|
-
# `name`/`description` for the mode selector, `order: 1
|
|
313
|
-
#
|
|
314
|
-
#
|
|
315
|
-
#
|
|
316
|
-
#
|
|
312
|
+
# `name`/`description` for the mode selector, `order: 1`;
|
|
313
|
+
# 4. this plugin's own rows: `wsl-shell` and `wsl-fs` first, and
|
|
314
|
+
# `wsl-doctor-tool` after `tool-jobs`.
|
|
315
|
+
# Everything else — the row set, its order, every config and `!!js`
|
|
316
|
+
# expression — is the shipped preset's, and scripts/preset-sync.mjs
|
|
317
|
+
# (`pnpm run preset:sync`) holds the copy to it against a snapshot of that
|
|
318
|
+
# file (test/fixtures/standard.patch.dsh-<version>.yml).
|
|
319
|
+
# Regenerate it when an app update changes the preset: replace the
|
|
320
|
+
# snapshot with the new tag's file, run the check to see what moved,
|
|
321
|
+
# replace this row to the end of the file with the upstream content, then
|
|
322
|
+
# re-apply changes 1–4 by hand.
|
|
317
323
|
# ═════════════════════════════════════════════════════════════════════════════
|
|
318
324
|
- id: preset-wsl
|
|
319
325
|
name: '@deepseek-ai/dsh-agent-preset'
|
|
@@ -432,6 +438,17 @@
|
|
|
432
438
|
name: '@deepseek-ai/dsh-tool-schedule'
|
|
433
439
|
- id: skill-filesystem
|
|
434
440
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
441
|
+
config:
|
|
442
|
+
# The preset package's own skills directory, as the shipped
|
|
443
|
+
# preset names it. The expression is upstream's, unchanged:
|
|
444
|
+
# `baseUrl` is the root Include's base for every row of the
|
|
445
|
+
# composition — this bundle's rows included — so it resolves
|
|
446
|
+
# to the installation's copy wherever this package is
|
|
447
|
+
# installed. The directory is then read through THIS preset's
|
|
448
|
+
# filesystem, i.e. inside the distro; docs/LIMITATIONS.md
|
|
449
|
+
# names the one installation shape where it is not readable.
|
|
450
|
+
customSkillDirs:
|
|
451
|
+
- !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
|
|
435
452
|
- id: tool-skill
|
|
436
453
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
437
454
|
- id: command-goal
|
|
@@ -484,6 +501,8 @@
|
|
|
484
501
|
config:
|
|
485
502
|
- id: tool-subagent-control
|
|
486
503
|
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
504
|
+
config:
|
|
505
|
+
interrupt: false
|
|
487
506
|
- id: tool-subagent
|
|
488
507
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
489
508
|
config:
|
|
@@ -515,6 +534,8 @@
|
|
|
515
534
|
searchTimeoutMs: 60000
|
|
516
535
|
- id: present
|
|
517
536
|
name: '@deepseek-ai/dsh-tool-present'
|
|
537
|
+
- id: tool-office
|
|
538
|
+
name: '@deepseek-ai/dsh-tool-office'
|
|
518
539
|
- id: tool-plugin-manager
|
|
519
540
|
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
|
520
541
|
disabled: !!js "!ctx.get('profileContext')"
|
|
@@ -16,7 +16,7 @@ negotiation rule, four capabilities.
|
|
|
16
16
|
|---|---|---|---|---|
|
|
17
17
|
| Capability advertisement | HELLO gains a 6th field | `conc,batch` | `batch` | capability-aware FS scheduling |
|
|
18
18
|
| Structured FS errors | new `FSERR\|id\|reason\|b64 message` line | yes | yes | direct FsError mapping (the `dsh-fs\|…` stderr-line sniffing stays as a fallback for older agents) |
|
|
19
|
-
| Batched FS reads | new `FSB\|id\|timeout\|nops` frame, `OP\|op\|nargs` op specs follow | sequential
|
|
19
|
+
| Batched FS reads | new `FSB\|id\|timeout\|nops` frame, `OP\|op\|nargs` op specs follow | sequential in one worker, one RES (`fs_lock` only when the batch holds a mutation) | sequential in one worker, one RES | GUI-preview-shaped page reads in one round trip |
|
|
20
20
|
| `delete` / `move` FS ops | new op names in the FS frame vocabulary | yes | yes | guarded, mapped to `FsDeleteOutcome` / `FsMoveOutcome` |
|
|
21
21
|
| `patchText` | **no wire change** — host-side hunk application + a guarded `replace` write | n/a | n/a | hunks applied in-process via `@deepseek-ai/dsh-fs-patch` (a new peer dependency, the peer's own `applyHunks` — perfect error parity, `FS_PATCH_MISMATCH` free) |
|
|
22
22
|
|
|
@@ -42,7 +42,9 @@ Concurrency capability is negotiated separately, because the two backends
|
|
|
42
42
|
honestly differ:
|
|
43
43
|
|
|
44
44
|
- `conc` — the agent runs FS ops concurrently and may answer out of order
|
|
45
|
-
(the native agent already does: worker threads
|
|
45
|
+
(the native agent already does: worker threads, with `fs_lock` for mutations
|
|
46
|
+
only — a read never waits behind a write, and the `ACK` reports the dequeue
|
|
47
|
+
before any lock is taken, so the host's watchdog measures execution).
|
|
46
48
|
- `batch` — the agent accepts `FSB` (any backend; a batch is sequential
|
|
47
49
|
inside one worker, which is exactly why it is safe everywhere).
|
|
48
50
|
- The SHELL agent does **not** advertise `conc`: its read loop is serial and
|
package/docs/API.md
CHANGED
|
@@ -24,7 +24,7 @@ this page is the quick tour.
|
|
|
24
24
|
| `./file-reference-wsl` | `traversalArgv`, `parseTraversalListing`, `FileReferenceTraversal`, … | the distro-side traversal strategy for `@` completion (pure library — built and tested, not yet wired to a row; see ARCHITECTURE) |
|
|
25
25
|
| `./wsl-doctor-tool` | the `wsl-doctor-tool` row | the `wsl_doctor` model tool: in-process diagnosis with scoping (`depth`, `section`) |
|
|
26
26
|
| `./wsl-doctor-command` | the `wsl-doctor-command` row | the `/wsl-doctor` UI command: spawns the standalone doctor CLI, renders detached from model history |
|
|
27
|
-
| `./status` | the `wsl-status` row | the sidebar panel's route over `/api`: installed distros, one distro's quick doctor,
|
|
27
|
+
| `./status` | the `wsl-status` row | the sidebar panel's route over `/api`: installed distros, one distro's quick doctor, `?distro=<name>&full=1` for full read-only diagnosis, and an explicit `POST` for `--fix-owned` plugin-state repair; the last result persists across reloads and running distros' stored results refresh in the background; `DELETE` clears one stored result (`?distro=<name>`) or every result without probing a distro |
|
|
28
28
|
| `./plugin-update` | the `wsl-plugin-update` row | the panel's version and upgrade route over `/api`: installed/running plugin versions, the newest installable stable release and its compatibility, and the confirmed one-click `updateBundle` action |
|
|
29
29
|
| `./paths` | `uncToPosix`, `toLinuxPath`, `toWorldPath`, … | the coordinate mappers |
|
|
30
30
|
| `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
|
package/docs/API.zh.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
| `./file-reference-wsl` | `traversalArgv`、`parseTraversalListing`、`FileReferenceTraversal`、… | 用于 `@` 补全的发行版侧遍历策略(纯库——已构建并测试,尚未接入行;见 ARCHITECTURE) |
|
|
24
24
|
| `./wsl-doctor-tool` | `wsl-doctor-tool` 行 | `wsl_doctor` 模型工具:带作用域(`depth`、`section`)的进程内诊断 |
|
|
25
25
|
| `./wsl-doctor-command` | `wsl-doctor-command` 行 | `/wsl-doctor` UI 命令:启动独立 doctor CLI,渲染结果不进入模型历史 |
|
|
26
|
-
| `./status` | `wsl-status` 行 | 侧栏面板经 `/api` 的路由:已安装发行版、单个发行版的快速 doctor
|
|
26
|
+
| `./status` | `wsl-status` 行 | 侧栏面板经 `/api` 的路由:已安装发行版、单个发行版的快速 doctor、`?distro=<名称>&full=1` 完整只读诊断,以及显式 `POST` 的 `--fix-owned` 插件状态修复;最近结果跨重载保留,运行中发行版的已存结果在后台刷新;`DELETE` 清除单个(`?distro=<名称>`)或全部已存结果,不探测发行版 |
|
|
27
27
|
| `./plugin-update` | `wsl-plugin-update` 行 | 面板经 `/api` 的版本与升级路由:已安装/运行中的插件版本、最新的可安装稳定版及其兼容性,以及点击确认后的一键 `updateBundle` |
|
|
28
28
|
| `./paths` | `uncToPosix`、`toLinuxPath`、`toWorldPath`、… | 坐标映射器 |
|
|
29
29
|
| `./picker` | `WslDirectoryPicker` | 能感知发行版的目录选择器 |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -21,7 +21,7 @@ smaller integrations listed below.
|
|
|
21
21
|
|
|
22
22
|
| Service | Class | File | What it does |
|
|
23
23
|
|---|---|---|---|
|
|
24
|
-
| `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | Runs each command in the distro's login shell over the resident in-distro agent (the default), wrapped in a distro-side `bwrap` sandbox; while the agent is out, or with `agent: false`, the same command falls back to one `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` process. |
|
|
24
|
+
| `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | Runs each command in the distro's login shell over the resident in-distro agent (the default), wrapped in a distro-side `bwrap` sandbox; while the agent is out, or with `agent: false`, the same command falls back to one `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` process; a command that was already running when the resident died is the exception — it fails as "state is unknown" and is not run again. |
|
|
25
25
|
| `ctx.fs` | `WslFileSystem` | [`lib/wsl-filesystem.js`](../lib/wsl-filesystem.js) | Serves WSL-routed file operations through the resident in-distro agent; the former Windows-side share substrate is retired (see below). |
|
|
26
26
|
| `ctx.subprocess` | `WslSubprocessRuntime` | [`lib/subprocess.js`](../lib/subprocess.js) | Opens the GUI terminal inside the distro, in the session workspace, and rewrites the file-search and git-snapshot spawns into the distro (see below). |
|
|
27
27
|
|
|
@@ -81,7 +81,7 @@ functions.
|
|
|
81
81
|
| `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | Serves the model's read/`cd` tool with the same semantics the harness ships, rewriting the returned `cwd` to the distro's POSIX form. |
|
|
82
82
|
| `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | The `wsl_doctor` model tool: the doctor in-process (merging the live resident's state), scoped by `depth`/`section`, rendered as the itemized digest. |
|
|
83
83
|
| `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | The `/wsl-doctor` UI command: spawns the standalone doctor CLI as a host subprocess and renders the same digest detached from model history. |
|
|
84
|
-
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | The sidebar panel's route (`GET /api/wsl-env/status`): lists
|
|
84
|
+
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | The sidebar panel's route (`GET /api/wsl-env/status`): lists installed distros and runs one distro's quick doctor; `GET ?distro=<name>&full=1` runs a full read-only diagnosis; an explicit `POST` runs `--fix-owned` to repair plugin-owned state and re-verify it. `DELETE` clears one stored result (`?distro=<name>`) or every result, without probing a distro. Answered over the Host connection's authenticated exact-Fetch channel; the last result per distro is persisted under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` and stored results for running distros are refreshed in the background. |
|
|
85
85
|
| `dsh-plugin-wsl-env` (bare name) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | The deliberate no-op host half whose bare-name mount lets the web client roster serve `./client`: the sidebar's WSL environment panel and the post-add access-mode prompt. |
|
|
86
86
|
|
|
87
87
|
Three path and interop helpers import no DSH package.
|
|
@@ -528,6 +528,8 @@ src/index.ts public provider exports
|
|
|
528
528
|
src/wsl-shell.ts WslShellExecutor (ctx.shell)
|
|
529
529
|
src/wsl-filesystem.ts WslFileSystem (ctx.fs)
|
|
530
530
|
src/doctor-report.ts in-process doctor collector used by the tool
|
|
531
|
+
src/doctor-process.ts the bounded doctor subprocess collector shared by the
|
|
532
|
+
report and command runners
|
|
531
533
|
src/provider-common.ts distro, home, runtime and writable-root helpers
|
|
532
534
|
src/listing.ts pure directory listing and breadcrumb helpers
|
|
533
535
|
src/messages.ts the en/zh message catalogs and the host-locale wiring
|
|
@@ -600,8 +602,9 @@ standalone CLI (peer-free by design, so it starts when the plugin's own
|
|
|
600
602
|
runtime is broken), the `/wsl-doctor` UI command (spawns the CLI host-side,
|
|
601
603
|
renders detached from model history), and the `wsl_doctor` model tool
|
|
602
604
|
(in-process, merging the live resident's state through `lib/doctor-live.js`).
|
|
603
|
-
The sidebar panel renders the quick digest and
|
|
604
|
-
|
|
605
|
+
The sidebar panel renders the quick digest and a full read-only diagnosis;
|
|
606
|
+
repairable plugin-owned findings are repaired only after the user separately
|
|
607
|
+
starts `--fix-owned`. A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
|
|
605
608
|
`section` on the tool), and the report itemizes every check grouped by
|
|
606
609
|
distro. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the surfaces and the
|
|
607
610
|
verdict contract.
|
package/docs/ARCHITECTURE.zh.md
CHANGED
|
@@ -20,7 +20,7 @@ DSH 以服务的形式暴露自身能力。面向模型的工具(`bash`、`rea
|
|
|
20
20
|
|
|
21
21
|
| 服务 | 类 | 文件 | 作用 |
|
|
22
22
|
|---|---|---|---|
|
|
23
|
-
| `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | 在发行版的登录 shell 中运行每条命令,默认经由常驻的发行版内 agent,并包在发行版侧的 `bwrap` 沙箱里;agent 不在时,或设置 `agent: false` 时,同一条命令退回到一个 `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>`
|
|
23
|
+
| `ctx.shell` | `WslShellExecutor` | [`lib/wsl-shell.js`](../lib/wsl-shell.js) | 在发行版的登录 shell 中运行每条命令,默认经由常驻的发行版内 agent,并包在发行版侧的 `bwrap` 沙箱里;agent 不在时,或设置 `agent: false` 时,同一条命令退回到一个 `wsl.exe -d <distro> --cd <linux dir> --exec <login shell> -lc <cmd>` 进程;常驻 agent 在命令执行途中死亡的情况除外——该命令以「状态未知」失败,不会重跑。 |
|
|
24
24
|
| `ctx.fs` | `WslFileSystem` | [`lib/wsl-filesystem.js`](../lib/wsl-filesystem.js) | 通过常驻的发行版内 agent 服务 WSL 路由的文件操作;此前的 Windows 侧 share 底座已退役(见下文)。 |
|
|
25
25
|
| `ctx.subprocess` | `WslSubprocessRuntime` | [`lib/subprocess.js`](../lib/subprocess.js) | 在发行版内、会话工作区中打开 GUI 终端,并把文件搜索与 git 快照的 spawn 改写到发行版内(见下文)。 |
|
|
26
26
|
|
|
@@ -72,7 +72,7 @@ GUI 文件树与预览保留随包的 `workspace-files` 行。它的客户端半
|
|
|
72
72
|
| `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | 以 harness 随包提供的相同语义提供模型的 read/`cd` 工具,把返回的 `cwd` 改写为发行版的 POSIX 形式。 |
|
|
73
73
|
| `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | `wsl_doctor` 模型工具:进程内的 doctor(合并活跃常驻 agent 的状态),按 `depth`/`section` 限定范围,渲染为逐项摘要。 |
|
|
74
74
|
| `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | `/wsl-doctor` UI 命令:把独立的 doctor CLI 作为宿主子进程启动,并在与模型历史分离的界面中渲染同一份摘要。 |
|
|
75
|
-
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | 侧边栏面板的路由(`GET /api/wsl-env/status
|
|
75
|
+
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | 侧边栏面板的路由(`GET /api/wsl-env/status`):列出已安装的发行版,对单个发行版运行 quick doctor;`GET ?distro=<名称>&full=1` 运行完整只读诊断;显式 `POST` 以 `--fix-owned` 修复插件自有状态并重新验证;`DELETE` 清除单个(`?distro=<名称>`)或全部已存结果,不探测发行版。响应经 Host 连接已认证的 exact-Fetch 通道返回;每个发行版的最近结果持久化在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,运行中发行版的已存结果会在后台刷新。 |
|
|
76
76
|
| `dsh-plugin-wsl-env`(裸名) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | 有意为之的空操作宿主半边;它的裸名挂载让 web 客户端名册能够提供 `./client`:侧边栏的 WSL 环境面板,以及添加后的访问模式提示。 |
|
|
77
77
|
|
|
78
78
|
三个路径与 interop 助手不导入任何 DSH 包。
|
|
@@ -471,6 +471,8 @@ src/index.ts public provider exports
|
|
|
471
471
|
src/wsl-shell.ts WslShellExecutor (ctx.shell)
|
|
472
472
|
src/wsl-filesystem.ts WslFileSystem (ctx.fs)
|
|
473
473
|
src/doctor-report.ts in-process doctor collector used by the tool
|
|
474
|
+
src/doctor-process.ts the bounded doctor subprocess collector shared by the
|
|
475
|
+
report and command runners
|
|
474
476
|
src/provider-common.ts distro, home, runtime and writable-root helpers
|
|
475
477
|
src/listing.ts pure directory listing and breadcrumb helpers
|
|
476
478
|
src/messages.ts the en/zh message catalogs and the host-locale wiring
|
|
@@ -537,7 +539,7 @@ peer 下限、新 agent 握手和陈旧的会话 scope,并报告带版本的 `
|
|
|
537
539
|
同一份报告通过三个界面应答:这个独立 CLI(设计上无 peer 依赖,因此插件自身
|
|
538
540
|
运行时损坏时它仍能启动)、`/wsl-doctor` UI 命令(在宿主侧启动 CLI,渲染与
|
|
539
541
|
模型历史分离),以及 `wsl_doctor` 模型工具(进程内,通过 `lib/doctor-live.js`
|
|
540
|
-
合并活跃常驻 agent
|
|
541
|
-
|
|
542
|
+
合并活跃常驻 agent 的状态)。侧边栏面板渲染快速摘要与完整只读诊断;发现可修复项后
|
|
543
|
+
由用户单独提交插件状态修复(`--fix-owned`)。运行可以限定范围(CLI 上的 `--quick`、
|
|
542
544
|
`--sections <csv>`;工具上的 `depth` / `section`),报告按发行版分组逐项列出
|
|
543
545
|
每项检查。各界面与判定契约见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -76,7 +76,7 @@ Alpine (musl).
|
|
|
76
76
|
|---|---|
|
|
77
77
|
| Debian | First launch can wedge before OOBE completes (`wsl.exe` exec and `--terminate` both hang). `wsl --terminate <distro>` once it is Stopped, then start as root to bypass OOBE. systemd is PID 1 out of the box. |
|
|
78
78
|
| Alpine | Import the **minirootfs** tarball (`wsl --import`), not the standard/cloud images. Create a normal user and set `[user] default=…` in `/etc/wsl.conf` — the imported default is root, and a root agent writes 0600 files the probe user cannot read. Install `coreutils util-linux` (busybox `mktemp`/`ps` lack the used options) and `shadow` for `useradd`. |
|
|
79
|
-
| Fedora / openSUSE / Arch | systemd PID 1 out of the box. openSUSE: `zypper --non-interactive` (the plain `-y` still prompts); Arch: `pacman -
|
|
79
|
+
| Fedora / openSUSE / Arch | systemd PID 1 out of the box. openSUSE: `zypper --non-interactive` (the plain `-y` still prompts); Arch: `pacman -S --needed`; refresh first with `pacman -Syu` when the index is missing or stale (Arch advises against an index-only `-Sy`). |
|
|
80
80
|
|
|
81
81
|
On a minimal Alpine image the **shell** agent's FSB enumeration needs GNU
|
|
82
82
|
`findutils` (BusyBox `find` lacks `-printf`); the packaged native agent does
|
package/docs/COMPATIBILITY.zh.md
CHANGED
|
@@ -70,7 +70,7 @@ Debian 的 harness 级运行暴露出一个真实发现:**当工作区根目
|
|
|
70
70
|
|---|---|
|
|
71
71
|
| Debian | 首次启动可能在 OOBE 完成前卡死(`wsl.exe` exec 和 `--terminate` 都会挂起)。等状态变为 Stopped 后执行一次 `wsl --terminate <distro>`,再以 root 启动以跳过 OOBE。systemd 开箱即 PID 1。 |
|
|
72
72
|
| Alpine | 导入 **minirootfs** tarball(`wsl --import`),不要用 standard/cloud 镜像。创建普通用户并在 `/etc/wsl.conf` 中设置 `[user] default=…`——导入后的默认用户是 root,而 root agent 写出的 0600 文件探针用户无法读取。安装 `coreutils util-linux`(busybox 的 `mktemp`/`ps` 缺少所用选项)以及用于 `useradd` 的 `shadow`。 |
|
|
73
|
-
| Fedora / openSUSE / Arch | systemd 开箱即 PID 1。openSUSE:用 `zypper --non-interactive`(裸 `-y` 仍会提示);Arch:`pacman -
|
|
73
|
+
| Fedora / openSUSE / Arch | systemd 开箱即 PID 1。openSUSE:用 `zypper --non-interactive`(裸 `-y` 仍会提示);Arch:`pacman -S --needed`;索引缺失或过期时先 `pacman -Syu`(Arch 不建议只刷新索引的 `-Sy`)。 |
|
|
74
74
|
|
|
75
75
|
在最小 Alpine 镜像上,**shell** agent 的 FSB 枚举需要 GNU `findutils`
|
|
76
76
|
(BusyBox 的 `find` 缺少 `-printf`);随包的原生 agent 不需要,`auto` 会
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -200,7 +200,7 @@ takes no configuration.
|
|
|
200
200
|
| | `retryMs` | `150` | Delay between attempts, in milliseconds. |
|
|
201
201
|
| | `windowsWorkspaces` | `[]` | Distro directories opened for Windows access (UNC paths). Sessions under them keep the host preset; the add-workspace prompt writes here, and Settings can change it back. A session in one of them is called out above the composer and in the **WSL environment** panel, with the way back to the distro environment. |
|
|
202
202
|
| `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
|
|
203
|
-
| | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
|
|
203
|
+
| | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. The doctor's `--probe-timeout` is derived from it (`2T + 2s` below the budget), so a stuck probe settles into its own verdict instead of vanishing under the outer kill. |
|
|
204
204
|
| | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
|
|
205
205
|
| `wsl-open-in-app` | `executable` | `''` | Editor executable for the session-header "open in app" action. Empty resolves VS Code from its usual Windows install locations, then `Code.exe` on `PATH`. |
|
|
206
206
|
| | `watchMs` | `1500` | Early-failure watch window per launch, in milliseconds; an editor that exits inside it is reported as a launch failure. |
|
|
@@ -426,10 +426,13 @@ scripts/bootstrap.sh <distro> --install
|
|
|
426
426
|
```
|
|
427
427
|
|
|
428
428
|
Without `--install`, the helper performs a read-only check. On apt-based
|
|
429
|
-
distros, the direct install command is
|
|
429
|
+
distros, the direct install command is (the package index is refreshed first —
|
|
430
|
+
a freshly installed Debian or Ubuntu has none; the `sh -c "…"` quotes keep the
|
|
431
|
+
`&&` inside the distro when the line is pasted into cmd, PowerShell 5.1 or
|
|
432
|
+
PowerShell 7 alike):
|
|
430
433
|
|
|
431
434
|
```bash
|
|
432
|
-
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
435
|
+
wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap"
|
|
433
436
|
```
|
|
434
437
|
|
|
435
438
|
The `wsl-preflight` row runs these checks when a session opens, and — with
|
|
@@ -466,7 +469,10 @@ other language renders English. A profile without the settings service, or
|
|
|
466
469
|
one whose user never picked a language, falls back to the process's ICU
|
|
467
470
|
default locale — the OS UI language in the desktop app — so a zh-CN Windows
|
|
468
471
|
with a provisional-Chinese UI still renders Chinese; an explicit Settings
|
|
469
|
-
choice always wins over that fallback.
|
|
472
|
+
choice always wins over that fallback. One surface is the exception: the web
|
|
473
|
+
client's status panel and the add-workspace access prompt carry Chinese-only
|
|
474
|
+
static text for now (not routed through the message catalogs); the route data
|
|
475
|
+
they render follows the rules above. Commands, config keys and file paths
|
|
470
476
|
inside a message are never translated. Two message groups stay English by
|
|
471
477
|
design: the `FS_*` refusal texts in `fs-decisions` and the fsio replica (the
|
|
472
478
|
tool layer matches on those strings byte-for-byte). The standalone
|
|
@@ -514,30 +520,37 @@ checks every installed distro, `--bundle
|
|
|
514
520
|
and `--locale <tag>` (or `DSH_WSL_DOCTOR_LOCALE`) selects the skeleton
|
|
515
521
|
language without re-probing. `--yes` skips the confirmation prompt (not the
|
|
516
522
|
confirmation gate itself), and `--read-only` refuses to run together with
|
|
517
|
-
`--fix` or `--install`.
|
|
523
|
+
`--fix` or `--install`. `--wsl <path>` replaces the `wsl.exe` the whole run
|
|
524
|
+
probes with, and `--cmd <path>` the `cmd.exe` the Windows-side reads use; a
|
|
525
|
+
path ending in `.mjs` runs as a Node script under the current runtime — the
|
|
526
|
+
seam the tests drive their fakes through, since Windows resolves the real
|
|
527
|
+
`System32` binaries before `PATH`.
|
|
518
528
|
See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
|
|
519
529
|
error-code map. Whether a row override applied, read from the profile's
|
|
520
530
|
`cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
|
|
521
531
|
so the composed profile has no command-line view.
|
|
522
532
|
The sidebar's **WSL environment** panel renders the same quick digest over
|
|
523
|
-
`GET /api/wsl-env/status`
|
|
524
|
-
|
|
533
|
+
`GET /api/wsl-env/status`; `?distro=<name>&full=1` runs a full read-only
|
|
534
|
+
diagnosis. When it finds repairable plugin-owned state, a separate `POST` to
|
|
535
|
+
the same route runs `--fix-owned`, sweeping stale session scopes or purging a
|
|
525
536
|
broken agent cache, then re-verifies both. Each row states when the check ran, its source (manual or background) and its
|
|
526
537
|
result structure (per-status totals and per-section tallies). The last result
|
|
527
538
|
per distro is stored at `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
|
|
528
539
|
(`~/.dsh/...` when the host names no home), so a page reload or app restart
|
|
529
540
|
still shows it. On load, a stored result for a distro that is currently
|
|
530
|
-
running is re-checked in the background
|
|
531
|
-
the stored result
|
|
541
|
+
running is re-checked in the background with a quick check; a failed
|
|
542
|
+
background run overwrites the stored result, while a **full diagnosis** or a
|
|
543
|
+
**repair** result is never replaced by the background re-check. Nothing is
|
|
544
|
+
labeled expired — each checked row offers
|
|
532
545
|
**清除** and the card offers **清除全部**; both `DELETE` the same route
|
|
533
546
|
(optionally with `?distro=`) to drop the stored verdict without enumerating,
|
|
534
547
|
probing or modifying a distro. Deleting the file still resets the panel's
|
|
535
|
-
history equivalently. Every row offers **快速检查** and
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
keeps its manual remedy.
|
|
540
|
-
or user configuration.
|
|
548
|
+
history equivalently. Every row offers **快速检查** and **完整诊断**: both are
|
|
549
|
+
read-only. When the full report finds repairable plugin-owned state (stale
|
|
550
|
+
session scopes or a broken agent cache), a separate **修复插件状态** action
|
|
551
|
+
runs `--fix-owned` and re-verifies it. Check actions remain available after a
|
|
552
|
+
result; every other warning keeps its manual remedy. Repair never installs
|
|
553
|
+
packages or rewrites Windows-owned or user configuration.
|
|
541
554
|
Above the distro rows, the **Plugin version** card reads the installed and
|
|
542
555
|
running plugin versions and the newest installable stable release; its
|
|
543
556
|
**一键升级** button posts to `/api/wsl-env/plugin-update`, and only that click
|
package/docs/CONFIGURATION.zh.md
CHANGED
|
@@ -187,7 +187,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
|
|
|
187
187
|
| | `retryMs` | `150` | 两次尝试之间的延迟,单位毫秒。 |
|
|
188
188
|
| | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。落在这些目录的会话会在输入框上方与 **WSL 环境** 面板中被点明,并提供回到发行版环境的办法。 |
|
|
189
189
|
| `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
|
|
190
|
-
| | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
|
|
190
|
+
| | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。doctor 的 `--probe-timeout` 由它推导(`2T + 2s` 低于该预算),一次卡住的探针在自己的截止时间内落地,而不是被外层整体杀掉。 |
|
|
191
191
|
| | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
|
|
192
192
|
| `wsl-open-in-app` | `executable` | `''` | 会话页头“在应用中打开”动作使用的编辑器可执行文件。空则从常见的 Windows 安装位置解析 VS Code,再回退到 `PATH` 上的 `Code.exe`。 |
|
|
193
193
|
| | `watchMs` | `1500` | 每次启动的早期失败观察窗口,单位毫秒;编辑器在该窗口内退出会报告为启动失败。 |
|
|
@@ -398,10 +398,12 @@ scripts/bootstrap.sh <distro> --install
|
|
|
398
398
|
```
|
|
399
399
|
|
|
400
400
|
不带 `--install` 时,辅助脚本只做只读检查。在基于 apt 的
|
|
401
|
-
|
|
401
|
+
发行版上,直接安装命令是(先刷新软件包索引——新装的 Debian/Ubuntu 还没有
|
|
402
|
+
索引;`sh -c "…"` 的引号让 `&&` 留在发行版内,cmd、PowerShell 5.1 与
|
|
403
|
+
PowerShell 7 粘贴执行都一样):
|
|
402
404
|
|
|
403
405
|
```bash
|
|
404
|
-
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
406
|
+
wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap"
|
|
405
407
|
```
|
|
406
408
|
|
|
407
409
|
会话打开时,`wsl-preflight` 行会运行这些检查;`startup: true`(默认)时,
|
|
@@ -430,6 +432,8 @@ open-in-app 路由的拒绝、目录选择器的标签、`/wsl-doctor` 命令文
|
|
|
430
432
|
没有 settings 服务的 profile、或用户从未在设置中选过语言的情况,回退到
|
|
431
433
|
进程的 ICU 默认区域设置——桌面应用中即操作系统 UI 语言——因此临时渲染为
|
|
432
434
|
中文界面的 zh-CN Windows 仍显示中文;显式的设置选择始终优先于该回退。
|
|
435
|
+
一个例外:web 客户端的状态面板与添加工作区的访问方式弹窗目前使用纯中文
|
|
436
|
+
静态文案(未接入消息 catalog);它们渲染的路由数据仍遵循上述规则。
|
|
433
437
|
消息内的命令、配置键与文件路径一律不翻译。两组消息按设计保持英文:
|
|
434
438
|
`fs-decisions` 中的 `FS_*` 拒绝文本与 fsio 复刻(工具层按字节匹配这些
|
|
435
439
|
字符串)。独立运行的 `scripts/doctor.mjs` 自带 catalog:固定骨架按宿主
|
|
@@ -464,21 +468,26 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
|
|
|
464
468
|
限定在插件自有的这两类),`--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加的诊断文件
|
|
465
469
|
(`--redact` 脱敏路径),`--locale <标签>`(或 `DSH_WSL_DOCTOR_LOCALE`)
|
|
466
470
|
无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
|
|
467
|
-
`--read-only` 拒绝与 `--fix` 或 `--install`
|
|
471
|
+
`--read-only` 拒绝与 `--fix` 或 `--install` 同用。`--wsl <路径>` 替换整次
|
|
472
|
+
运行探测所用的 `wsl.exe`,`--cmd <路径>` 替换 Windows 侧读取用的 `cmd.exe`;
|
|
473
|
+
以 `.mjs` 结尾的路径会作为 Node 脚本在当前运行时下执行——这是测试驱动假件
|
|
474
|
+
的接缝,因为 Windows 解析真实的 `System32` 二进制先于 `PATH`。
|
|
468
475
|
判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
|
469
476
|
某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
|
|
470
477
|
桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
|
|
471
|
-
侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status`
|
|
472
|
-
|
|
473
|
-
session scope
|
|
478
|
+
侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要;
|
|
479
|
+
`?distro=<名称>&full=1` 运行完整只读诊断,发现插件自有状态可修复时,才显示独立的
|
|
480
|
+
修复动作。该动作以 `POST` 提交同一路由,使用 `--fix-owned` 清扫残留 session scope、
|
|
481
|
+
清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
|
|
474
482
|
每个发行版的最后一次结果存放在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
|
|
475
483
|
(宿主未指定 home 时为 `~/.dsh/...`),页面刷新或应用重启后仍可见。加载时会对
|
|
476
|
-
|
|
484
|
+
正在运行的发行版在后台做一次快速复核;后台失败会覆盖已存结果,但“完整诊断”和
|
|
485
|
+
“修复”的结果不会被后台复核替换。不标记“已过期”——每个
|
|
477
486
|
已检查行提供“清除”、卡片头部提供“清除全部”,经同一路由的 `DELETE`(可带
|
|
478
487
|
`?distro=`)删除本地保存的结果,不枚举、不探测也不修改发行版;直接删除该文件
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
488
|
+
仍可等效重置面板历史。每行提供“快速检查”和“完整诊断”两个只读检查动作;完整
|
|
489
|
+
诊断发现可修复项后,单独显示“修复插件状态”,并在修复后复检。检查按钮在结果出现
|
|
490
|
+
后仍可再次点击。修复只处理插件自有状态(残留 session scope、损坏的 agent 缓存);
|
|
482
491
|
其余告警保留各自的手动处理办法。它不会安装软件包,也不会改写 Windows 或用户所有的配置。
|
|
483
492
|
在发行版行上方,「插件版本」卡片读取已安装与运行中的插件版本及最新的可安装稳定版;
|
|
484
493
|
它的「一键升级」提交到 `/api/wsl-env/plugin-update`,只有这次点击会调用宿主插件
|
package/docs/DIAGNOSTICS.md
CHANGED
|
@@ -43,35 +43,56 @@ that the file is broken. Rerun the doctor for a clean answer.
|
|
|
43
43
|
`--fix` ends in a re-verified report: every fix is followed by a fresh probe
|
|
44
44
|
of what it claims to have fixed, the affected checks carry the after state,
|
|
45
45
|
and the verdict is recomputed — `ready`, or the remaining blockers. The
|
|
46
|
+
recheck takes the same flake retry as every other read, and a recheck that
|
|
47
|
+
still does not answer makes the `fix.*` row `unknown` (an empty read is no
|
|
48
|
+
longer counted as "0 stale scopes" or "0 invalid cache entries");
|
|
49
|
+
`runtime.scopes` is `unknown` too, while `agent.cache` keeps its
|
|
50
|
+
before-the-fix verdict until a read answers. A failed fix quotes the tail of
|
|
51
|
+
the command's output in its `fix.*` row (the doctor prints none of it
|
|
52
|
+
elsewhere). The handshake probe waits 15 s for a HELLO and retries a
|
|
53
|
+
transport flake once (a timeout or wsl.exe's own error); a deterministic
|
|
54
|
+
failure is answered at once. The
|
|
46
55
|
plugin-owned state is repaired automatically: the stale-scope sweep and a
|
|
47
56
|
purge of the agent cache when an entry is not executable (the handshake is
|
|
48
|
-
re-probed after the purge). `--fix-owned` narrows a
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
re-probed after the purge). `--fix-owned` narrows a repair to exactly those two
|
|
58
|
+
and cannot be combined with `--install`. Remedies that rewrite user- or
|
|
59
|
+
distro-owned files (`.wslconfig`,
|
|
51
60
|
`/etc/wsl.conf`, a WSL1 conversion, installing a distro) are never automated;
|
|
52
61
|
the remedy text says so.
|
|
53
62
|
|
|
54
63
|
`--bundle <path>` writes a local JSON file (report + versions + effective
|
|
55
64
|
configuration) for a setup report; `--redact` replaces home and DSH paths
|
|
56
65
|
with `<redacted-*>` placeholders. The bundle contains no file contents, no
|
|
57
|
-
environment variables, and no telemetry.
|
|
66
|
+
environment variables, and no telemetry. The note that it was written and the
|
|
67
|
+
confirmation prompts go to stderr; with `--json`, stdout is the report alone.
|
|
58
68
|
|
|
59
69
|
## The surfaces
|
|
60
70
|
|
|
61
71
|
The doctor answers through three surfaces with one report; the sidebar's
|
|
62
|
-
**WSL environment** panel renders the
|
|
63
|
-
|
|
64
|
-
state
|
|
72
|
+
**WSL environment** panel renders the quick digest and a full read-only report
|
|
73
|
+
over its own route. Only after a full report identifies repairable plugin-owned
|
|
74
|
+
state can the user separately trigger `--fix-owned`. The same panel's **Plugin
|
|
75
|
+
version** card is separate from the doctor: it reads the
|
|
65
76
|
installed/running plugin versions and offers the one-click upgrade through the
|
|
66
77
|
host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
|
|
67
78
|
|
|
68
|
-
- **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
|
|
79
|
+
- **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--probe-timeout <ms>] [--wsl <path>] [--cmd <path>] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
|
|
69
80
|
(the same line `--help` prints).
|
|
70
81
|
The authoritative surface: it loads **no peer dependency and no host
|
|
71
82
|
service**, so it still starts when the plugin's own runtime is the thing
|
|
72
83
|
that is broken. Only pure, peer-free `lib/` modules are imported; the one
|
|
73
84
|
helper that used to live behind a peer-tainted module (`lib/index.js`) is
|
|
74
|
-
inlined and drift-pinned against the lib export by `test/doctor.test.mjs`.
|
|
85
|
+
inlined and drift-pinned against the lib export by `test/doctor.test.mjs`.
|
|
86
|
+
The in-distro reads go out as composed batches: the pure reads in one
|
|
87
|
+
`wsl.exe`, the systemd-class commands in a small batch of their own, each
|
|
88
|
+
under its own `timeout` — a distro's probes drop from a dozen-plus spawns
|
|
89
|
+
to about 2 in the quick profile and 8 in a full run. The fix rechecks (the
|
|
90
|
+
scope sweep, the cache purge, the bwrap install) keep their standalone
|
|
91
|
+
probes, so a hung command costs its own slice. `--probe-timeout <ms>`
|
|
92
|
+
bounds one batch probe's deadline (the shared 60 s default stands without
|
|
93
|
+
it); a deadline hit is a transport flake, retried once after the 2 s settle,
|
|
94
|
+
so the worst path is `2T + 2s`.
|
|
95
|
+
Exit 0 = `ready`, 1 = `blocked`, 2 = refused
|
|
75
96
|
(`--read-only` with `--fix`/`--install`, `--fix-owned` with `--install`, or
|
|
76
97
|
`--fix` on a scoped run).
|
|
77
98
|
- **The `/wsl-doctor` UI command** — typing
|
|
@@ -80,12 +101,12 @@ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
|
|
|
80
101
|
the itemized report renders detached from model history (no model turn, no
|
|
81
102
|
tokens). The sidebar's **WSL environment** panel runs the same quick
|
|
82
103
|
check per distro through the authenticated status route, showing a badge with
|
|
83
|
-
numbered failing items and warnings. Every row offers
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
104
|
+
numbered failing items and warnings. Every row offers **快速检查** (the quick
|
|
105
|
+
doctor scope) and **完整诊断** (the full doctor, read-only). When that report
|
|
106
|
+
finds repairable plugin-owned state — stale scopes or a broken agent cache —
|
|
107
|
+
the row separately offers **修复插件状态**. It uses `--fix-owned` and
|
|
108
|
+
answers with before → after repair rows; it never installs packages or
|
|
109
|
+
rewrites user configuration. Actions can be run again after a result. The row also states when the check ran, its source
|
|
89
110
|
(manual or the page-load background refresh), and how its results landed —
|
|
90
111
|
per-status totals and per-section tallies. Each checked row expands to the
|
|
91
112
|
full list of checks that run executed, grouped by section with each status
|
|
@@ -93,11 +114,13 @@ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
|
|
|
93
114
|
(`N more in the full run`), not listed as results. The last result is stored locally
|
|
94
115
|
(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`, falling back to `~/.dsh`)
|
|
95
116
|
so a reload still shows it; a background refresh runs only for distros that
|
|
96
|
-
are already up
|
|
117
|
+
are already up and is always a quick check — it never replaces a full
|
|
118
|
+
diagnosis or a repair result — and a failed one replaces the stored quick
|
|
119
|
+
result as observed. Requests for the same distro and mode while one is
|
|
120
|
+
running share that run, and **刷新** is disabled while any check is in flight.
|
|
97
121
|
Each checked row offers **清除** and the card offers **清除全部**; both
|
|
98
122
|
`DELETE` the same route, dropping the local store without starting a doctor
|
|
99
|
-
run or enumerating a distro. Manual warnings keep their remedies
|
|
100
|
-
diagnosis still uses the entry above and `/wsl-doctor`. Without a command adapter (headless, ACP) the row is a no-op and
|
|
123
|
+
run or enumerating a distro. Manual warnings keep their remedies. Without a command adapter (headless, ACP) the row is a no-op and
|
|
101
124
|
the CLI is the surface. Without `--distro` the handler names the distro from
|
|
102
125
|
the session's live working directory (the agent-scoped `workingDirectory`
|
|
103
126
|
service first, then the Session header's `cwd`); when neither yields a WSL
|
|
@@ -105,7 +128,10 @@ host plugin manager ([CONFIGURATION](CONFIGURATION.md), `wsl-plugin-update`).
|
|
|
105
128
|
probes **every** installed distro — a sweep that costs minutes on a machine
|
|
106
129
|
with several (a scoped quick run is seconds). The handler therefore bounds
|
|
107
130
|
the subprocess (120 s when it has a distro, 60 s when the configuration has
|
|
108
|
-
to choose, both below the command dispatcher's own deadline)
|
|
131
|
+
to choose, both below the command dispatcher's own deadline) and passes
|
|
132
|
+
`--probe-timeout` so that `2T + 2s` stays below the budget — a stuck probe
|
|
133
|
+
settles into its own `unknown` verdict instead of vanishing under the outer
|
|
134
|
+
kill — so a stalled or
|
|
109
135
|
unscoped run settles with a message naming the target it examined and how to
|
|
110
136
|
narrow it.
|
|
111
137
|
- **The `wsl_doctor` model tool** — in-process via `doctorReport()`, so the
|
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -37,29 +37,42 @@
|
|
|
37
37
|
|
|
38
38
|
`--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
|
|
39
39
|
受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
复验走与其他读数相同的抖动重试;复验仍未应答时,`fix.*` 行记 `unknown`
|
|
41
|
+
(空读数不再算作「0 个残留 scope / 0 个无效缓存」),`runtime.scopes` 同样记
|
|
42
|
+
`unknown`,`agent.cache` 则保留修复前的裁决,直到读数给出答案。失败的修复在
|
|
43
|
+
`fix.*` 行里引用命令输出的末尾(doctor 不另行打印这些输出)。握手探测等
|
|
44
|
+
15 秒 HELLO,传输抖动(超时或 wsl.exe 自身报错)重试一次,确定性失败立即
|
|
45
|
+
应答。
|
|
46
|
+
插件自有状态可自动修复:残留 scope 清扫,以及缓存条目不可执行时清理
|
|
47
|
+
agent 缓存(清理后重新握手)。`--fix-owned` 把修复收窄到这两类,且不能与 `--install` 同用。会改写用户或 distro
|
|
43
48
|
所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1 转换、安装 distro)
|
|
44
49
|
永不开启自动化;补救文本会写明。
|
|
45
50
|
|
|
46
51
|
`--bundle <path>` 写出本地 JSON 文件(报告 + 版本 + 生效配置)供 setup
|
|
47
52
|
report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
|
|
48
|
-
bundle
|
|
53
|
+
bundle 不含文件内容、环境变量,也没有遥测。写入提示与确认提问走 stderr,
|
|
54
|
+
`--json` 的 stdout 只有报告本身。
|
|
49
55
|
|
|
50
56
|
## 三个入口
|
|
51
57
|
|
|
52
58
|
doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面板经自己的
|
|
53
|
-
|
|
59
|
+
路由渲染快速摘要与完整只读诊断;只有完整诊断列出可修复项后,用户才可单独
|
|
60
|
+
触发 `--fix-owned` 插件状态修复。
|
|
54
61
|
同一面板的「插件版本」卡片独立于 doctor:它读取已安装/运行中的插件版本,并提供
|
|
55
62
|
经宿主插件管理器执行的一键升级(见 [CONFIGURATION.zh.md](CONFIGURATION.zh.md) 的 `wsl-plugin-update`)。
|
|
56
63
|
|
|
57
|
-
- **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
|
|
64
|
+
- **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--probe-timeout <毫秒>] [--wsl <路径>] [--cmd <路径>] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
|
|
58
65
|
(与 `--help` 输出同一行)。
|
|
59
66
|
这是权威入口:它**不加载任何 peer 依赖、任何宿主服务**,即使插件的运行时
|
|
60
67
|
本身就是故障源,它也能启动。只 import 纯净、无 peer 的 `lib/` 模块;原先
|
|
61
68
|
挂在 peer 污染模块(`lib/index.js`)后面的唯一 helper 已内联,并由
|
|
62
69
|
`test/doctor.test.mjs` 与 lib 导出对拍防漂移。
|
|
70
|
+
发行版内的读取以合成批次发出:纯读事实一次 `wsl.exe`,systemd 类命令
|
|
71
|
+
另一小批且各自包 `timeout`——每个发行版的探针从十几次启动降到 quick 约 2 次、
|
|
72
|
+
full 约 8 次;修复复查(scope 清扫、缓存清理、bwrap 安装)仍用独立探针,
|
|
73
|
+
卡住的命令只损失自己的时间片。`--probe-timeout <毫秒>` 限定一次批次探针的
|
|
74
|
+
截止时间(缺省仍是共享的 60 秒):一次截止触发的传输抖动按重试间隔(2 秒)
|
|
75
|
+
再试一次,所以最坏路径是 `2T + 2s`。
|
|
63
76
|
退出码 0 = `ready`,1 = `blocked`,2 = 拒绝(`--read-only` 与
|
|
64
77
|
`--fix`/`--install` 同用、`--fix-owned` 与 `--install` 同用,或对范围化
|
|
65
78
|
运行使用 `--fix`)。
|
|
@@ -67,17 +80,20 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
|
|
|
67
80
|
`/wsl-doctor [quick|full|<分区>] [--distro <名称>]`;命令面在宿主侧执行,
|
|
68
81
|
handler 子进程运行独立 CLI,逐项报告直接渲染在 UI 上、不进模型历史
|
|
69
82
|
(无模型回合、零 token)。侧边栏的 **WSL 环境** 面板按发行版运行同源的快速检查,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
结果以状态徽标、编号的待修项与告警列出。每行提供 **快速检查**(doctor 的 quick 范围)
|
|
84
|
+
与 **完整诊断**(完整 doctor,只读)两个检查动作;完整诊断发现可修复的插件自有状态
|
|
85
|
+
(残留 scope 或损坏的 agent 缓存)后,才显示独立的 **修复插件状态** 动作。
|
|
86
|
+
修复以 `--fix-owned` 执行并返回 before → after 结果;不会安装软件包或改写用户配置。
|
|
87
|
+
各动作在结果出现后仍可再次点击。
|
|
74
88
|
行内同时给出上次检查时间、来源(手动或页面加载时的后台复核)与结果结构(各状态
|
|
75
89
|
计数与分区分布)。每个已检查的行可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据;
|
|
76
|
-
|
|
77
|
-
缺省回退到 `~/.dsh
|
|
78
|
-
|
|
90
|
+
快速检查未触及的目录项只以“完整诊断还会运行 N 项”计数,不伪装成结果。最后一次结果存放在本地(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,
|
|
91
|
+
缺省回退到 `~/.dsh`),刷新后仍可见;后台复核只针对正在运行的发行版,并且只
|
|
92
|
+
是快速检查,不会替换“完整诊断”和“修复”的结果,失败时按实际观测覆盖已存的
|
|
93
|
+
快速结果。同一发行版同一种检查在途时,重复请求共用同一次运行;有检查在途时
|
|
94
|
+
“刷新”按钮禁用。每个已检查行可“清除”该发行版的结果,卡片头部可“清除全部”;
|
|
79
95
|
两者经同一路由的 `DELETE` 完成,只删本地存档,不启动 doctor、不枚举发行版。
|
|
80
|
-
|
|
96
|
+
手动告警保留各自处理办法;完整诊断与修复是两个独立动作。
|
|
81
97
|
完整诊断仍走上面的入口与 `/wsl-doctor`。没有命令适配器的部署(headless、ACP)中该行是
|
|
82
98
|
no-op,CLI 就是入口。未给 `--distro` 时,handler 从会话当前工作目录解析
|
|
83
99
|
发行版(先读 agent 作用域的 `workingDirectory` 服务,再退回 Session 头部
|
|
@@ -85,7 +101,9 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
|
|
|
85
101
|
随包预设的 `auto` 会逐个检查**所有**已安装发行版——多发行版机器上是数分钟
|
|
86
102
|
的开销(收窄到单个发行版的 quick 运行只需数秒)。因此 handler 给子进程设了
|
|
87
103
|
时限(解析出发行版时 120 秒、交给配置决定时 60 秒,均低于命令面自身的
|
|
88
|
-
|
|
104
|
+
截止时间),并按 `2T + 2s < 预算` 传入 `--probe-timeout`,让一次卡住的探针
|
|
105
|
+
在自己的截止时间内落地为 `unknown`,而不是被外层整体超时掩盖;停摆或未收窄
|
|
106
|
+
的运行会给出消息,说明本次检查的目标与如何收窄。
|
|
89
107
|
- **`wsl_doctor` 模型工具**——经 `doctorReport()` 进程内采集,会合并常驻
|
|
90
108
|
agent 的实时状态。采集是异步的:doctor 子进程不再阻塞宿主,工具调用的取消
|
|
91
109
|
会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
|