dsh-plugin-wsl-env 0.27.0 → 0.29.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 CHANGED
@@ -16,6 +16,81 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.29.0] - 2026-11-23
20
+
21
+ WSL panel release: diagnosis and repair are separate actions, with clearer
22
+ progress feedback and accessible controls.
23
+
24
+ ### Changed
25
+
26
+ - **Full diagnosis is read-only.** Repairing plugin-owned state now requires a
27
+ separate explicit action, followed by verification; it does not install
28
+ packages or rewrite Windows configuration.
29
+ - **The WSL panel is more concise and accessible.** Detailed guidance starts
30
+ collapsed, and checks/repairs state the current action and possible distro
31
+ startup without inventing progress or elapsed-time estimates. Controls work
32
+ with the keyboard, and status/error updates expose screen-reader semantics.
33
+ - **Release workflow hardening.** The workflow default permission is now
34
+ `contents: read`; only the publish job holds `contents: write` and
35
+ `id-token: write`. The `upload-artifact` and `download-artifact` actions are
36
+ pinned to commit SHAs like the other actions. No plugin runtime behavior
37
+ changed.
38
+
39
+ ### Verification
40
+
41
+ - `pnpm test`, `pnpm run test:coverage`, and `pnpm run test:browser` passed.
42
+ The Windows/WSL real-machine probe suite was not run in this Linux
43
+ environment, which has no WSL or Harness installation.
44
+
45
+ ## [0.28.0] - 2026-11-22
46
+
47
+ Release-evidence release: the official-package smoke gates publication and
48
+ post-release verification end to end on a real runner, the local probe suite
49
+ closes the app itself, and the hosted gate's evidence became falsifiable. No
50
+ plugin runtime behavior changed.
51
+
52
+ ### Added
53
+
54
+ - **`pnpm run probe:all-closed` closes ordinary Harness processes itself.**
55
+ The local full-suite entry ends any running Harness (a leftover probe
56
+ instance counts) with a process-tree kill, waits for the exits, and then
57
+ runs the suite; a probe instance that survives the close is refused
58
+ fail-closed, and a failed taskkill surfaces instead of silently sharing the
59
+ machine with the suite. The hosted gate drives the same runner in wait-only
60
+ mode, so its evidence stays synchronous with the step that reads it.
61
+
62
+ ### Changed
63
+
64
+ - **Release workflows now gate publication and post-release verification
65
+ through official-package smoke evidence.** The existing source compatibility
66
+ gate remains authoritative for full Windows/WSL probe coverage. The
67
+ candidate tarball is packed on Linux so the shipped shell scripts keep their
68
+ executable bits; the official installer resolves from the official CDN's
69
+ exact-version path; the smoke verifies the installed `dsh --version` and
70
+ runs a shell command, a workspace file operation, and a sandbox refusal
71
+ through the tarball-installed plugin on a headless official-CLI boot with
72
+ the plugin's shell executor mounted; `workflow_dispatch` dry-runs the
73
+ candidate path without publishing. Validated end to end by dispatch dry run
74
+ 44926384431; hosted WSL provisioning is watchdog-protected against runner
75
+ hangs.
76
+
77
+ ### Fixed
78
+
79
+ - **The hosted Windows gate's probe evidence is falsifiable.** The suite runs
80
+ against a staged ext4 checkout instead of a silent base64 handoff, requires
81
+ positive probe evidence, derives the suite pass count from the summary, and
82
+ asserts the bwrap marker and dbus prerequisite; documentation claims that
83
+ no real FULL PASS run backed were downgraded. The terminal probe pins
84
+ `/bin/bash` and runs against a prewarmed distro, so first-run provisioning
85
+ output can no longer be mistaken for terminal results.
86
+ - **`pnpm run sync:windows` verifies the Windows mirror's content and tolerates
87
+ the drvfs metadata.** The script excludes the untracked agent artifacts
88
+ (`.v2c`, `.video_agent`), skips the utime/chmod/chown calls the `/mnt/c`
89
+ mirror rejects, tolerates the additive mirror's extra files, and fails only
90
+ when a source file is missing or differs. A confined shell's read-only
91
+ `/mnt/c` now reports the `danger-full-access`/plain-terminal remedy instead
92
+ of a tar error.
93
+
19
94
  ## [0.27.0] - 2026-11-19
20
95
 
21
96
  Minor release: harden the opt-in sandbox's process-authority surface and add the diagnostics and panel upgrades around it.
package/CONTRIBUTING.md CHANGED
@@ -228,36 +228,61 @@ on one Ubuntu runner after installing Chromium. The Windows runners are
228
228
  there because the plugin targets Windows; the coverage thresholds need Node 22.8 or
229
229
  newer, which is why that job runs on one version.
230
230
 
231
- The probes marked "yes" need Windows, WSL2, a mounted harness profile and a linked
232
- checkout, which a hosted runner does not have. Run them on your own machine and
233
- paste the output into the pull request.
231
+ `.github/workflows/cloud-wsl-gate.yml` adds an independent hosted DeepSeek
232
+ Harness Desktop and WSL gate. On pushes and pull requests targeting `main` and
233
+ on manual `workflow_dispatch`, it builds the unsigned Windows Desktop package from the
234
+ upstream tag on `windows-latest`, installs Ubuntu 24.04 and `bubblewrap`, uses
235
+ the desktop app's bundled CLI to create a `wsl` profile, installs the local
236
+ checkout into that profile, verifies the composed dump contains
237
+ `dsh-plugin-wsl-env`, launches the desktop app's configured Web service and waits
238
+ for HTTP readiness, verifies the in-distro bwrap workspace fence, prepares a
239
+ `wslfs` probe profile plus a second Ubuntu instance and Node/systemd prerequisites, stops
240
+ the Desktop process, and runs
241
+ `test/probe/run-all-when-closed.sh --include-fs`. The suite is green only when
242
+ every selected probe reports PASS and there are no SKIP or NOT RUN entries, and
243
+ the complete log/results evidence is present. `test/cloud-wsl-gate.test.mjs`
244
+ checks only workflow/file drift and is not runtime evidence.
245
+ The suite currently has 19 entries: `run.sh`, `terminal.sh`, `mode.sh`,
246
+ `missing-wsl.sh`, `sandbox.sh`, `cache-write.sh`, `sandbox-shell.sh`,
247
+ `interop-shell.sh`, `sandbox-off.sh`, `picker.sh`, `two-distro.sh`,
248
+ `fs-routing.sh`, `agent.sh`, `agent-restart.sh`, `watch.sh`, `substrate.sh`,
249
+ `exec.sh`, `native-session.sh`, and `auto-preset.sh`. It verifies real Desktop
250
+ startup, profile composition, closed-app behavior, Linux and Windows filesystem
251
+ routing, resident/native agent behavior, bwrap boundaries, Terminal, Picker,
252
+ multiple distros, watcher invalidation, session runtime, and automatic preset
253
+ selection. The workflow uploads the composed profile, Desktop logs, full probe
254
+ log and results, and probe reports even on failure.
234
255
 
235
256
  The rows marked "no; inside the distro" (`substrate`, `watch`, `agent`, `exec`)
236
257
  still need Windows and WSL2, but no harness boot and no profile: run them from a
237
258
  distro terminal with Node available, and they reach `wsl.exe` through interop.
238
259
 
239
- Two conveniences for the real-machine set. `test/probe/run-all-when-closed.sh
240
- --include-fs` runs the full closed-app suite once the app has exited. The interop
241
- shell matrix uses the `wslfs` profile, systemd and a lingering user manager; it
242
- fails when Windows interop or its temporary marker cannot be verified.
243
-
244
- The `ci.yml` `probes` job is **manual-only** (`workflow_dispatch`) and requires a
245
- self-hosted Windows+WSL runner with the harness app and a configured profile;
246
- `runs-on` is the GitHub-hosted `windows-latest` label, so dispatching it without
247
- such a runner fails with a named error rather than passing (`skip all` is gone).
248
- No self-hosted runner is registered for this repository today (2026-11-18), so
249
- the documented path is the local closed-app command above. The nightly schedule
250
- and its `probe-heartbeat` were removed on the same date for that reason; there is
251
- no scheduled probe evidence to miss. A manual run still uploads
252
- `probe-evidence-<run>` as the evidence artifact.
253
-
254
- **Self-hosted runners.** None is currently registered for this repository, so
255
- the Windows matrix legs run on GitHub-hosted `windows-latest`. If one is added
256
- later, give it a custom label such as `self-hosted-wsl` rather than the hosted
257
- `windows-latest` label, and update every matrix / `runs-on` / fork-gate
258
- reference together. The release workflow's `npm-publish` environment
260
+ Two conveniences for the real-machine set. `pnpm run probe:all-closed` launches
261
+ the complete closed-app suite, including `run.sh`, in a detached WSL worker.
262
+ The worker closes ordinary DeepSeek Harness processes automatically and refuses
263
+ to run if a stale `--profile wslfs` probe instance is present.
264
+ `test/probe/run-all-when-closed.sh --include-fs --wait-only` preserves the
265
+ explicit manual-close workflow. The package command writes the shared log and
266
+ results files under `test/probe/.scratch`; the detailed result contract remains
267
+ `FULL PASS` only for 19/19 PASS, with no SKIP or NOT RUN entries. The
268
+ interoperability shell matrix uses the `wslfs` profile, systemd and a lingering
269
+ user manager; it fails when Windows interoperability or its temporary marker
270
+ cannot be verified.
271
+
272
+ **Runner labels.** The Windows unit matrix can run on GitHub-hosted
273
+ `windows-latest`; the hosted Cloud WSL Gate provisions WSL itself. If a
274
+ self-hosted Windows+WSL runner is later added, give it a custom label such as
275
+ `self-hosted-wsl` rather than the hosted `windows-latest` label, and update
276
+ every matrix / `runs-on` / fork-gate reference together. The release
277
+ workflow's `npm-publish` environment
259
278
  intentionally has no required reviewers (single-maintainer decision).
260
279
 
280
+ The `probes` job in `.github/workflows/ci.yml` is a separate manual-only
281
+ self-hosted probe entry. It runs only for `workflow_dispatch`, accepts a
282
+ self-hosted Windows+WSL runner label, and reports missing prerequisites as
283
+ explicit probe status rather than as a hosted-suite success. It is not the
284
+ Cloud WSL Gate and does not replace the gate artifact requirements above.
285
+
261
286
  Also note the install steps carry `--config.minimum-release-age=0` (pnpm 11.7's
262
287
  lockfile re-verification ignores `minimumReleaseAgeExclude`; the flag is the
263
288
  documented remedy in `release.yml`). The restore condition and all seven call
@@ -114,13 +114,29 @@ pnpm run sync:windows
114
114
 
115
115
  CI 在 `ubuntu-latest` 和 `windows-latest` 上,用 Node 22 和 24 运行 `pnpm test`;在 Node 24 上运行 `pnpm run test:coverage`,并在安装 Chromium 后于一个 Ubuntu runner 上运行 `pnpm run test:browser`。Windows runner 的存在是因为插件面向 Windows;覆盖率门槛需要 Node 22.8 或更新版本,因此该任务只在一个版本上运行。
116
116
 
117
- 标记为“是”的探针需要 Windows、WSL2、一个已挂载的 harness profile 和一个已链接的检出,托管 runner 不具备这些条件。请在自己的机器上运行,并把输出粘贴到 pull request 中。
118
-
119
- 标记为“否;在发行版内”的行(`substrate`、`watch`、`agent`、`exec`)仍需要 Windows 和 WSL2,但不需要启动 harness,也不需要 profile:在有 Node 的发行版终端中运行它们,它们会通过互操作访问 `wsl.exe`。
120
-
121
- 真机测试集有两个便利工具。`test/probe/run-all-when-closed.sh --include-fs` 在应用退出后运行全部十七项探针。互操作 shell 矩阵使用 `wslfs` profile、systemd 和 lingering 的用户管理器;当 Windows 互操作或其临时标记无法验证时,它会失败。`ci.yml` 有一个定时和手动触发的 `probes` 任务:只要默认发行版实际启动,`sandbox` 就会运行;随后在安装了 harness 应用的环境中运行 `mode`、`terminal`、`picker` 和 `missing-wsl`。该任务以一个自托管 Windows runner 命名,尽管其 `runs-on` 携带的是 GitHub 托管的 `windows-latest` 标签;当托管 runner 没有可用的发行版时,该任务是一次绿色的空操作(`skip all`)。如果默认发行版启动时没有 bubblewrap,`sandbox` 分支会失败,而不是跳过。
122
-
123
- **自托管 runner 标签冲突——已知暴露面。** 开发机的自托管 runner 满足了 GitHub 托管的 `windows-latest` 标签,因此单元矩阵的 Windows 分支在每次 push 和 PR 时都在那里执行。来自 fork 的 PR 代码会在这些分支上被跳过(`ci.yml` 的步骤级 fork 门),但持久的修复是在 runner 设置中把其标签重命名为无歧义的名称(例如 `self-hosted-wsl`),并把 `ci.yml` 中两个 `windows-latest` 使用方重新指向它——在此之前,请把该标签视为共享基础设施,而不是托管容量。还要注意安装步骤带有 `--config.minimum-release-age=0`(pnpm 11.7 的 lockfile 重新验证会忽略 `minimumReleaseAgeExclude`;该标志是 `release.yml` 中记录的补救办法)。
117
+ `.github/workflows/cloud-wsl-gate.yml` 增加了一道托管 DeepSeek Harness 桌面版与 WSL 门禁。它在每次目标为 `main` 的 pull request 和手动 `workflow_dispatch` 时,在 `windows-latest` 上从 upstream tag 构建 unsigned Windows Desktop,安装 Ubuntu 24.04、第二个 Ubuntu probe 实例、Node 24、systemd 与 `bubblewrap`,通过桌面 app 自带 CLI 创建 `wsl` profile、向 profile 安装当前检出的本地插件并核对组合配置,启动桌面应用的配置化 Web 服务并等待 HTTP 可访问,验证发行版内的 bwrap 工作区围栏,准备 `wslfs` probe profile 后在应用退出时运行 `test/probe/run-all-when-closed.sh --include-fs`。只有每项 probe 都报告 PASS 且没有 SKIP 或 NOT RUN 时,托管门禁才算通过。
118
+
119
+ 当前闭合套件共有 19 项:`run.sh`、`terminal.sh`、`mode.sh`、
120
+ `missing-wsl.sh`、`sandbox.sh`、`cache-write.sh`、`sandbox-shell.sh`、
121
+ `interop-shell.sh`、`sandbox-off.sh`、`picker.sh`、`two-distro.sh`、
122
+ `fs-routing.sh`、`agent.sh`、`agent-restart.sh`、`watch.sh`、
123
+ `substrate.sh`、`exec.sh`、`native-session.sh` 和 `auto-preset.sh`。
124
+ 套件真实验证 Desktop 启动、profile 组合、应用退出后的闭合行为、Linux/Windows
125
+ 文件路由、resident/native agent、bwrap 边界、Terminal、Picker、多发行版、
126
+ watcher失效、session runtime 与自动 preset。工作流即使失败也会上传组合
127
+ profile、Desktop 日志、完整 probe 日志和结果,以及 probe report。
128
+
129
+ 真机测试集有两个便利入口。`pnpm run probe:all-closed` 在发行版内启动脱离式 worker,自动关闭普通 DeepSeek Harness 进程并运行完整闭合套件(含 `run.sh`);若发现残留的 `--profile wslfs` probe 实例,worker 会拒绝关闭和继续。维护者可用 `test/probe/run-all-when-closed.sh --include-fs --wait-only` 保留显式手动退出流程。包入口的完整日志和结果写入 `test/probe/.scratch`;只有 19 项全部 PASS 且无 SKIP/NOT RUN 时才是完整通过。托管 Cloud WSL Gate 配置了同一 suite runner,并要求完整日志、结果和 report 文件都进入 artifact,缺失或不完整即失败。静态 contract test 只能发现 workflow 与文件布局漂移,不能证明 runner 实际执行了套件。互操作 shell 矩阵使用 `wslfs` profile、systemd 和 lingering 的用户管理器;当 Windows 互操作或其临时标记无法验证时,它会失败。
130
+
131
+ **Runner 标签。** Windows 单元矩阵可运行在 GitHub 托管的
132
+ `windows-latest`;托管 Cloud WSL Gate 自行准备 WSL。若以后接入自托管
133
+ Windows+WSL runner,请使用 `self-hosted-wsl` 等无歧义标签,不要复用托管
134
+ `windows-latest` 标签,并同时更新所有 matrix / `runs-on` / fork-gate 引用。
135
+
136
+ `.github/workflows/ci.yml` 中的 `probes` 任务是另一条独立的手动真机入口:
137
+ 仅响应 `workflow_dispatch`,可由带 Windows+WSL 能力的自托管 runner 执行,
138
+ 缺少前置项时以明确的 probe 状态报告,不等同于托管套件通过。该任务不替代
139
+ 上述 Cloud WSL Gate 的 artifact 与 FULL PASS 要求。
124
140
 
125
141
  ## 新增测试
126
142
 
package/client.js CHANGED
@@ -19,13 +19,11 @@
19
19
  * `updateBundle` only for that explicit click and the card reports the host's
20
20
  * applied/restart-required/rollback outcome.
21
21
  *
22
- * Every distro row offers two check actions: **快速检查** (the scoped quick
23
- * doctor, `GET` on the status route) and **完整检查** (the full doctor with
24
- * `--fix-owned`, `POST` on the same route). Both run again on every click —
25
- * there is no persistent "recheck" label. The full run also repairs plugin-owned
26
- * state (a stale session scope or a broken agent cache) and answers with its
27
- * `fix.*` before → after rows; it never installs packages or rewrites
28
- * Windows-owned configuration. Every other warning stays manual.
22
+ * Every distro row offers **快速检查** (the quick doctor) and **完整诊断**
23
+ * (the full doctor, read-only). When a full report identifies plugin-owned
24
+ * state it can repair, the row separately offers **修复插件状态**; that action
25
+ * uses `--fix-owned` and answers with its `fix.*` before → after rows. It never
26
+ * installs packages or rewrites Windows-owned configuration.
29
27
  *
30
28
  * The last result is persisted Host-side, so a page reload (or an app restart)
31
29
  * still shows the last guidance and when it ran. On load, a stored result for
@@ -61,7 +59,7 @@ window.__ModuleLoader__.load({
61
59
  const useState = React.useState;
62
60
  const useEffect = React.useEffect;
63
61
 
64
- /** The plugin's status route (checks on GET, the full check on POST, clear on DELETE); the row registers this exact path. */
62
+ /** The plugin's status route (checks on GET, repair on POST, clear on DELETE); the row registers this exact path. */
65
63
  const STATUS_PATH = "/api/wsl-env/status";
66
64
  /** The plugin version/upgrade route: GET reads, POST performs the confirmed upgrade. */
67
65
  const PLUGIN_UPDATE_PATH = "/api/wsl-env/plugin-update";
@@ -107,11 +105,10 @@ window.__ModuleLoader__.load({
107
105
  };
108
106
 
109
107
  /**
110
- * The doctor route: list/quick check on GET, the full check (which also
111
- * repairs plugin-owned state) on POST, and clearing stored results on
112
- * DELETE.
108
+ * The doctor route: list/quick/full read-only checks on GET, the explicit
109
+ * plugin-owned repair on POST, and clearing stored results on DELETE.
113
110
  * @param query - the query string, including `?`, or empty.
114
- * @param method - `GET` for a check, `POST` for the full-check action,
111
+ * @param method - `GET` for a check, `POST` for repair,
115
112
  * `DELETE` to clear one distro's result (named by `distro`) or all.
116
113
  * @returns the decoded body.
117
114
  */
@@ -545,7 +542,7 @@ window.__ModuleLoader__.load({
545
542
  justifyContent: "space-between",
546
543
  },
547
544
  cardTitle: { fontSize: 13, fontWeight: 600 },
548
- hint: { fontSize: 12, opacity: 0.6 },
545
+ hint: { fontSize: 12, opacity: 0.7 },
549
546
  row: {
550
547
  display: "flex",
551
548
  flexDirection: "column",
@@ -599,7 +596,7 @@ window.__ModuleLoader__.load({
599
596
  fixableTag: { fontSize: 11, color: "#5ecf86", marginLeft: 4, marginRight: 4 },
600
597
  summary: { display: "flex", flexDirection: "column", gap: 3, fontSize: 12 },
601
598
  summaryLine: { display: "flex", flexWrap: "wrap", gap: 10, alignItems: "center" },
602
- summaryMuted: { opacity: 0.55 },
599
+ summaryMuted: { opacity: 0.7 },
603
600
  refreshTag: { fontSize: 12, color: "#e0b04a" },
604
601
  countOk: { color: "#5ecf86" },
605
602
  countWarn: { color: "#e0b04a" },
@@ -729,7 +726,7 @@ window.__ModuleLoader__.load({
729
726
  return h(
730
727
  "section",
731
728
  { style: styles.card },
732
- h("div", { style: styles.cardHead }, h("div", { style: styles.cardTitle }, title), actions ?? null),
729
+ h("div", { style: styles.cardHead }, h("h2", { style: { ...styles.cardTitle, margin: 0 } }, title), actions ?? null),
733
730
  children,
734
731
  );
735
732
  }
@@ -744,11 +741,12 @@ window.__ModuleLoader__.load({
744
741
  if (state.phase === "checking") return h(Pill, { label: "快速检查中…", tone: "idle" });
745
742
  if (state.phase === "fullChecking") {
746
743
  return h(Pill, {
747
- label: "完整检查中…",
744
+ label: "完整诊断中…",
748
745
  tone: "idle",
749
- title: "正在运行完整检查并修复插件自有状态",
746
+ title: "正在运行只读的完整诊断",
750
747
  });
751
748
  }
749
+ if (state.phase === "repairing") return h(Pill, { label: "修复中…", tone: "idle", title: "正在修复插件自有状态并复检" });
752
750
  if (state.phase === "refreshing") return h(Pill, { label: "复核中…", tone: "idle", title: "面板正在后台复核上次结果" });
753
751
  if (state.phase === "error") return h(Pill, { label: "无法检查", tone: "error" });
754
752
  if (state.verdict === "ready") return h(Pill, { label: "正常", tone: "ready" });
@@ -763,7 +761,7 @@ window.__ModuleLoader__.load({
763
761
  /**
764
762
  * A numbered list of doctor findings.
765
763
  * @param props - heading, findings, whether they block, and the ids the
766
- * full check can repair.
764
+ * explicit repair can repair.
767
765
  * @returns the list, or null when there is nothing to show.
768
766
  */
769
767
  function IssueList({ heading, items, severity, repairable }) {
@@ -791,8 +789,8 @@ window.__ModuleLoader__.load({
791
789
  }
792
790
 
793
791
  /**
794
- * The full check's repair rows: what the doctor did, with its status mark.
795
- * @param props - the `fix.*` rows the full run answered with.
792
+ * The repair action's rows: what the doctor did, with its status mark.
793
+ * @param props - the `fix.*` rows the repair answered with.
796
794
  * @returns the list, or null when the run has no repair rows.
797
795
  */
798
796
  function RepairList({ items }) {
@@ -869,7 +867,7 @@ window.__ModuleLoader__.load({
869
867
  )),
870
868
  )),
871
869
  typeof state.notRun === "number" && state.notRun > 0
872
- ? h("div", { style: styles.hint }, `本次是快速检查,只覆盖首条命令的前置项;完整检查还会运行 ${String(state.notRun)} 项(agent 链路、工具、网络、配置等)。`)
870
+ ? h("div", { style: styles.hint }, `本次是快速检查,只覆盖首条命令的前置项;完整诊断还会运行 ${String(state.notRun)} 项(agent 链路、工具、网络、配置等)。`)
873
871
  : null,
874
872
  )
875
873
  : null,
@@ -920,8 +918,8 @@ window.__ModuleLoader__.load({
920
918
  { style: styles.summaryLine },
921
919
  h("span", { style: styles.summaryMuted }, state.verdict === "error" ? "尝试检查:" : "上次检查:"),
922
920
  h("span", null, typeof state.checkedAt === "number" ? checkedLabel(state.checkedAt) : "时间未知"),
923
- h("span", { style: styles.summaryMuted }, state.repaired === true
924
- ? (Array.isArray(state.repairs) && state.repairs.length > 0 ? "完整检查 · 已修复" : "完整检查")
921
+ h("span", { style: styles.summaryMuted }, state.full === true
922
+ ? (state.repaired === true ? "完整诊断 · 已修复" : "完整诊断")
925
923
  : "快速检查"),
926
924
  h("span", { style: styles.summaryMuted }, `来源:${state.source === "background" ? "后台" : "手动"}`),
927
925
  state.cached === true ? h("span", { style: styles.summaryMuted }, "缓存结果") : null,
@@ -1136,15 +1134,39 @@ window.__ModuleLoader__.load({
1136
1134
  };
1137
1135
 
1138
1136
  /**
1139
- * Run the full doctor with `--fix-owned`. The button is always
1140
- * **完整检查**: the run may repair plugin-owned state on the way, but the
1141
- * row does not relabel itself as a separate repair action. Only the
1142
- * plugin's own state is touched.
1137
+ * Run a full, read-only doctor report.
1143
1138
  * @param distro - the distro to run against.
1144
1139
  */
1145
1140
  const fullCheck = async (distro) => {
1146
1141
  setNotice(null);
1147
1142
  setChecks((previous) => ({ ...previous, [distro]: { ...previous[distro], phase: "fullChecking" } }));
1143
+ try {
1144
+ const answer = await statusRequest(`?distro=${encodeURIComponent(distro)}&full=1`);
1145
+ setChecks((previous) => ({ ...previous, [distro]: { phase: "done", ...answer } }));
1146
+ const repairable = Array.isArray(answer.repairable) ? answer.repairable.length : 0;
1147
+ const remaining = (Array.isArray(answer.failures) ? answer.failures.length : 0)
1148
+ + (Array.isArray(answer.warnings) ? answer.warnings.length : 0);
1149
+ setNotice({
1150
+ kind: remaining === 0 ? "ok" : "info",
1151
+ text: repairable > 0
1152
+ ? `完整诊断完成:发现 ${String(repairable)} 项插件状态可修复;点击“修复插件状态”可单独执行,其他 ${String(Math.max(0, remaining - repairable))} 项按处理办法手动处理。`
1153
+ : remaining > 0
1154
+ ? `完整诊断完成:发现 ${String(remaining)} 项需按下方处理办法处理;没有可自动修复的插件状态。`
1155
+ : `已在 ${distro} 完成完整诊断,未发现待处理项。`,
1156
+ });
1157
+ } catch (error) {
1158
+ setChecks((previous) => ({ ...previous, [distro]: { ...previous[distro], phase: "error", error: messageOf(error) } }));
1159
+ }
1160
+ };
1161
+
1162
+ /**
1163
+ * Run the explicit plugin-owned repair after a full report identifies
1164
+ * repairable findings.
1165
+ * @param distro - the distro to repair.
1166
+ */
1167
+ const repair = async (distro) => {
1168
+ setNotice(null);
1169
+ setChecks((previous) => ({ ...previous, [distro]: { ...previous[distro], phase: "repairing" } }));
1148
1170
  try {
1149
1171
  const answer = await statusRequest(`?distro=${encodeURIComponent(distro)}`, "POST");
1150
1172
  setChecks((previous) => ({ ...previous, [distro]: { phase: "done", ...answer } }));
@@ -1155,17 +1177,18 @@ window.__ModuleLoader__.load({
1155
1177
  setNotice({
1156
1178
  kind: fixed > 0 || remaining === 0 ? "ok" : "info",
1157
1179
  text: fixed > 0 && remaining > 0
1158
- ? `完整检查完成:已在 ${distro} 修复 ${String(fixed)} 项;仍有 ${String(remaining)} 项需按下方处理办法手动处理。`
1180
+ ? `插件状态修复完成:已在 ${distro} 修复 ${String(fixed)} 项;仍有 ${String(remaining)} 项需按下方处理办法手动处理。`
1159
1181
  : fixed > 0
1160
- ? `完整检查完成:已在 ${distro} 修复 ${String(fixed)} 项;复检通过。`
1182
+ ? `插件状态修复完成:已在 ${distro} 修复 ${String(fixed)} 项;复检通过。`
1161
1183
  : rows.length > 0
1162
- ? `完整检查完成:尝试修复 ${String(rows.length)} 项但未通过复检;请按下方处理办法手动处理。`
1184
+ ? `已尝试修复 ${String(rows.length)} 项,但复检未通过;请按下方处理办法继续处理。`
1163
1185
  : remaining > 0
1164
- ? `完整检查完成;没有可自动修复项,${String(remaining)} 项需按下方处理办法手动处理。`
1165
- : `已在 ${distro} 完成完整检查,未发现待修项。`,
1186
+ ? `未发现可自动修复的插件状态;${String(remaining)} 项需按下方处理办法手动处理。`
1187
+ : `已在 ${distro} 完成插件状态修复与复检。`,
1166
1188
  });
1167
1189
  } catch (error) {
1168
- setChecks((previous) => ({ ...previous, [distro]: { ...previous[distro], phase: "error", error: messageOf(error) } }));
1190
+ setChecks((previous) => ({ ...previous, [distro]: { ...previous[distro], phase: "done" } }));
1191
+ setNotice({ kind: "error", text: `插件状态修复失败:${messageOf(error)}` });
1169
1192
  }
1170
1193
  };
1171
1194
 
@@ -1253,7 +1276,7 @@ window.__ModuleLoader__.load({
1253
1276
  const busyAny = distros.some((distro) => {
1254
1277
  const state = checks[distro];
1255
1278
  return state !== undefined
1256
- && (state.phase === "checking" || state.phase === "fullChecking" || state.phase === "refreshing");
1279
+ && (state.phase === "checking" || state.phase === "fullChecking" || state.phase === "repairing" || state.phase === "refreshing");
1257
1280
  });
1258
1281
  const hasAnyResult = distros.some((distro) => checks[distro] !== undefined);
1259
1282
 
@@ -1273,7 +1296,7 @@ window.__ModuleLoader__.load({
1273
1296
  typeof plugin.installed === "string" ? h(Pill, { label: `v${plugin.installed}`, tone: "idle", title: "已安装的插件版本" }) : null,
1274
1297
  pluginAvailable ? h(Pill, { label: `可升级 ${latest.version}`, tone: "blocked", title: "发现新的插件版本" }) : null,
1275
1298
  ),
1276
- h("div", { style: styles.subtitle }, "诊断、版本与安全修复:已安装的发行版、快速检查、插件升级,以及插件自有状态的修复。"),
1299
+ h("div", { style: styles.subtitle }, "查看 WSL 发行版状态并管理插件版本。"),
1277
1300
  ),
1278
1301
  pluginAvailable ? h(
1279
1302
  "div",
@@ -1293,7 +1316,11 @@ window.__ModuleLoader__.load({
1293
1316
  })
1294
1317
  : null,
1295
1318
  ) : null,
1296
- notice === null ? null : h("div", { style: notice.kind === "ok" ? styles.noticeOk : notice.kind === "info" ? styles.noticeInfo : styles.notice }, notice.text),
1319
+ notice === null ? null : h("div", {
1320
+ role: notice.kind === "error" ? "alert" : "status",
1321
+ "aria-live": notice.kind === "error" ? "assertive" : "polite",
1322
+ style: notice.kind === "ok" ? styles.noticeOk : notice.kind === "info" ? styles.noticeInfo : styles.notice,
1323
+ }, notice.text),
1297
1324
  h(
1298
1325
  Card,
1299
1326
  {
@@ -1325,10 +1352,9 @@ window.__ModuleLoader__.load({
1325
1352
  : pluginAvailable && plugin.updateSupported !== true
1326
1353
  ? h("div", { style: styles.hint }, "当前宿主的插件管理器不支持一键升级;请在 Plugins 页升级。")
1327
1354
  : null,
1328
- h(
1329
- "div",
1330
- { style: styles.hint },
1331
- "版本检查委托给宿主的插件管理器(与 Plugins 页同源):读取 registry、弃用标记与 DSH/peer 兼容性。一键升级只在点击后执行,不会自动安装;完成后按提示刷新页面或重启 DSH。无法自动升级时,请在 Plugins 页手动安装新版本。",
1355
+ h("details", null,
1356
+ h("summary", { style: { ...styles.hint, cursor: "pointer" } }, "版本检查与升级说明"),
1357
+ h("div", { style: styles.hint }, "版本检查委托给宿主的插件管理器(与 Plugins 页同源):读取 registry、弃用标记与 DSH/peer 兼容性。一键升级只在点击后执行,不会自动安装;完成后按提示刷新页面或重启 DSH。无法自动升级时,请在 Plugins 页手动安装新版本。"),
1332
1358
  ),
1333
1359
  ),
1334
1360
  h(
@@ -1351,10 +1377,9 @@ window.__ModuleLoader__.load({
1351
1377
  }),
1352
1378
  ),
1353
1379
  },
1354
- h(
1355
- "div",
1356
- { style: styles.hint },
1357
- "“快速检查”运行一次 doctor 的快速检查(与 /wsl-doctor 同源):验证该发行版的 bwrap、systemd 与 Linger 等前置项。“完整检查”运行完整 doctor,并只修复插件自有状态(残留 session scope、损坏的 agent 缓存)后复检、显示 before→after。两个按钮都可在结果出现后再次点击,每次都重新执行。自动修复不安装软件包、不改写 Windows 配置;其余告警按各自处理办法手动处理。检查会让停止的发行版启动,所以只在点击时执行;页面加载的后台复核只针对正在运行的发行版,失败会按实际观测覆盖并标为“后台”来源。“清除”删除该发行版本机保存的检测结果,“清除全部”清空所有结果;两者都不探测、不修改发行版,但清除后需再次检查。",
1380
+ h("details", null,
1381
+ h("summary", { style: { ...styles.hint, cursor: "pointer" } }, "检查与修复说明"),
1382
+ h("div", { style: styles.hint }, "“快速检查”验证首条命令的前置项;“完整诊断”运行完整 doctor,二者均只读。完整诊断发现可修复的插件自有状态(残留 session scope、损坏的 agent 缓存)后,才显示独立的“修复插件状态”按钮;修复后复检并显示 before→after。修复不安装软件包、不改写 Windows 配置;其余告警按各自处理办法手动处理。检查会启动已停止的发行版,所以只在点击时执行;页面加载的后台复核只针对正在运行的发行版,失败会按实际观测覆盖并标为“后台”来源。“清除”删除该发行版本机保存的检测结果,“清除全部”清空所有结果;两者都不探测、不修改发行版,但清除后需再次检查。"),
1358
1383
  ),
1359
1384
  phase === "loading"
1360
1385
  ? h("div", { style: styles.empty }, "加载中…")
@@ -1368,17 +1393,18 @@ window.__ModuleLoader__.load({
1368
1393
  const checking = state !== undefined && state.phase === "checking";
1369
1394
  const fullChecking = state !== undefined && state.phase === "fullChecking";
1370
1395
  const refreshing = state !== undefined && state.phase === "refreshing";
1371
- const busy = checking || fullChecking || refreshing;
1396
+ const repairing = state !== undefined && state.phase === "repairing";
1397
+ const busy = checking || fullChecking || repairing || refreshing;
1372
1398
  const hasResult = state !== undefined && (state.phase === "done" || state.phase === "error");
1373
1399
  const repairable = Array.isArray(state?.repairable) ? state.repairable : [];
1374
- const canRepair = done && repairable.length > 0;
1400
+ const canRepair = done && state.full === true && repairable.length > 0;
1375
1401
  const findings = done
1376
1402
  ? (Array.isArray(state.failures) ? state.failures.length : 0)
1377
1403
  + (Array.isArray(state.warnings) ? state.warnings.length : 0)
1378
1404
  : 0;
1379
1405
  return h(
1380
1406
  "div",
1381
- { key: distro, style: styles.row },
1407
+ { key: distro, style: styles.row, "aria-busy": busy },
1382
1408
  h(
1383
1409
  "div",
1384
1410
  { style: styles.rowHead },
@@ -1392,11 +1418,19 @@ window.__ModuleLoader__.load({
1392
1418
  onClick: () => { void check(distro); },
1393
1419
  }),
1394
1420
  h(Btn, {
1395
- label: fullChecking ? "完整检查中…" : "完整检查",
1421
+ label: fullChecking ? "完整诊断中…" : "完整诊断",
1396
1422
  small: true,
1397
1423
  disabled: busy,
1398
1424
  onClick: () => { void fullCheck(distro); },
1399
1425
  }),
1426
+ canRepair
1427
+ ? h(Btn, {
1428
+ label: repairing ? "修复中…" : `修复插件状态(${String(repairable.length)})`,
1429
+ small: true,
1430
+ disabled: busy,
1431
+ onClick: () => { void repair(distro); },
1432
+ })
1433
+ : null,
1400
1434
  hasResult
1401
1435
  ? h(Btn, {
1402
1436
  label: "清除",
@@ -1407,13 +1441,15 @@ window.__ModuleLoader__.load({
1407
1441
  : null,
1408
1442
  ),
1409
1443
  state === undefined
1410
- ? h("div", { style: styles.hint }, "尚未检查:点击“快速检查”(约 10 秒)或“完整检查”;两者都会启动停止的发行版。")
1444
+ ? h("div", { style: styles.hint }, "尚未检查:选择快速检查或完整诊断。检查可能启动已停止的发行版。")
1411
1445
  : state.phase === "checking"
1412
- ? h("div", { style: styles.hint }, "正在运行快速检查…(会启动停止的发行版)")
1446
+ ? h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", style: styles.hint }, "正在启动发行版(若已停止)并运行快速检查…")
1413
1447
  : state.phase === "fullChecking"
1414
- ? h("div", { style: styles.hint }, "正在运行完整检查,并修复插件自有状态(残留 session scope、损坏的 agent 缓存)…")
1448
+ ? h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", style: styles.hint }, "正在启动发行版(若已停止)并运行只读的完整诊断…")
1449
+ : state.phase === "repairing"
1450
+ ? h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", style: styles.hint }, "正在启动发行版(若已停止),修复插件自有状态并复检…")
1415
1451
  : state.phase === "error"
1416
- ? h("div", { style: styles.detail }, h("span", { style: styles.failure }, state.error))
1452
+ ? h("div", { role: "alert", "aria-live": "assertive", style: styles.detail }, h("span", { style: styles.failure }, state.error))
1417
1453
  : h(
1418
1454
  "div",
1419
1455
  { style: styles.detail },
@@ -1426,17 +1462,17 @@ window.__ModuleLoader__.load({
1426
1462
  heading: `待修项(${String(Array.isArray(state.failures) ? state.failures.length : 0)})`,
1427
1463
  items: state.failures,
1428
1464
  severity: "fail",
1429
- repairable,
1465
+ repairable: canRepair ? repairable : [],
1430
1466
  }),
1431
1467
  h(IssueList, {
1432
1468
  heading: `告警(${String(Array.isArray(state.warnings) ? state.warnings.length : 0)})`,
1433
1469
  items: state.warnings,
1434
1470
  severity: "warn",
1435
- repairable,
1471
+ repairable: canRepair ? repairable : [],
1436
1472
  }),
1437
1473
  findings > 0
1438
1474
  ? h("div", { style: styles.hint }, canRepair
1439
- ? "标有“可自动修复”的项会由“完整检查”处理;其余项目需按处理办法手动处理。"
1475
+ ? "标有“可自动修复”的项可由“修复插件状态”处理;其余项目需按处理办法手动处理。"
1440
1476
  : "以上项目没有可自动修复项,需按各自处理办法手动处理。自动修复只覆盖残留 session scope 与损坏的 agent 缓存。")
1441
1477
  : null,
1442
1478
  h(CheckDetails, { state }),
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, and the `--fix-owned` full check (which also repairs plugin-owned state); 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 enumerating or probing a distro |
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,以及 `--fix-owned` 完整检查(同时修复插件自有状态);最近结果跨重载保留,运行中发行版的已存结果在后台刷新;`DELETE` 清除单个(`?distro=<名称>`)或全部已存结果,不枚举、不探测发行版 |
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` | 能感知发行版的目录选择器 |
@@ -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 the installed distros and runs one distro's quick doctor; `POST` on the same route runs the full doctor with `--fix-owned` (which also repairs stale scopes or a broken agent cache and re-verifies both). `DELETE` on the same route clears one stored result (`?distro=<name>`) or every stored result, without listing or 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. |
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.
@@ -454,9 +454,12 @@ the loader's real patch algorithm). One `pnpm install` reproduces that tree befo
454
454
  the first run; the runtime package itself still ships zero dependencies. CI runs
455
455
  `pnpm test` on Linux and Windows, on Node 22 and 24, and `pnpm run test:coverage` on
456
456
  Node 24 only — the threshold flags need Node 22.8. Node 20 is absent on purpose:
457
- `engines` requires `^22.19.0 || >=24.0.0`, the harness host's own floor. The harness
458
- probes are a manual step, because a hosted runner has no WSL distro and no profile to
459
- mount.
457
+ `engines` requires `^22.19.0 || >=24.0.0`, the harness host's own floor. Local
458
+ harness probes remain real-machine steps. The hosted
459
+ `.github/workflows/cloud-wsl-gate.yml` provisions Ubuntu and implements the
460
+ 19-entry closed-app suite after the Desktop process exits; it is accepted as
461
+ suite evidence only after a run uploads a complete log/results artifact with
462
+ every entry PASS and no SKIP or NOT RUN.
460
463
 
461
464
  The probe scripts share [`test/probe/env.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/env.sh), which derives
462
465
  the Windows user, the distro name and the UNC spelling of the checkout from the
@@ -597,8 +600,9 @@ standalone CLI (peer-free by design, so it starts when the plugin's own
597
600
  runtime is broken), the `/wsl-doctor` UI command (spawns the CLI host-side,
598
601
  renders detached from model history), and the `wsl_doctor` model tool
599
602
  (in-process, merging the live resident's state through `lib/doctor-live.js`).
600
- The sidebar panel renders the quick digest and posts the full-check action the
601
- same way (`--fix-owned`: plugin-owned state only). A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
603
+ The sidebar panel renders the quick digest and a full read-only diagnosis;
604
+ repairable plugin-owned findings are repaired only after the user separately
605
+ starts `--fix-owned`. A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
602
606
  `section` on the tool), and the report itemizes every check grouped by
603
607
  distro. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the surfaces and the
604
608
  verdict contract.