dsh-plugin-wsl-env 0.26.2 → 0.26.3-rc.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 +64 -0
- package/CONTRIBUTING.md +2 -1
- package/CONTRIBUTING.zh.md +2 -1
- package/docs/ARCHITECTURE.md +5 -1
- package/docs/ARCHITECTURE.zh.md +4 -1
- package/docs/DIAGNOSTICS.md +15 -0
- package/docs/DIAGNOSTICS.zh.md +13 -0
- package/docs/LIMITATIONS.md +24 -11
- package/docs/LIMITATIONS.zh.md +18 -7
- package/docs/MIGRATION.md +4 -2
- package/docs/MIGRATION.zh.md +4 -2
- package/docs/UPSTREAM-SERVICE-SWAP.md +35 -9
- package/docs/root-fs-routing.md +1 -1
- package/lib/fs-routing.d.ts +16 -1
- package/lib/fs-routing.js +18 -1
- package/lib/picker.d.ts +52 -1
- package/lib/picker.js +31 -4
- package/lib/service-takeover.d.ts +46 -0
- package/lib/service-takeover.js +65 -0
- package/lib/status.d.ts +7 -0
- package/lib/status.js +6 -3
- package/lib/subprocess.d.ts +108 -1
- package/lib/subprocess.js +20 -1
- package/lib/takeover-report.d.ts +80 -0
- package/lib/takeover-report.js +119 -0
- package/lib/wsl-doctor-command.d.ts +4 -1
- package/lib/wsl-doctor-command.js +7 -3
- package/lib/wsl-doctor-tool.js +6 -2
- package/lib/wsl.d.ts +14 -0
- package/lib/wsl.js +30 -1
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,70 @@ were part of the record.
|
|
|
16
16
|
|
|
17
17
|
## [Unreleased]
|
|
18
18
|
|
|
19
|
+
## [0.26.3-rc.0] - 2026-11-17
|
|
20
|
+
|
|
21
|
+
First release candidate for 0.26.3: a live enable or HMR upgrade no longer
|
|
22
|
+
rolls back on the three same-name takeovers, the in-app doctor names the
|
|
23
|
+
provider that is actually serving them, and the directory picker survives a
|
|
24
|
+
WSL that cannot answer.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **The in-app doctor names the provider actually serving the three takeover
|
|
29
|
+
services.** `providers.takeover` (the `wsl_doctor` tool, `/wsl-doctor`, and
|
|
30
|
+
the sidebar panel) reports which class serves `subprocess`, `fs`, and
|
|
31
|
+
`directoryPicker`; a failed live takeover — the HMR upgrade that renders
|
|
32
|
+
`service "subprocess" has been registered at <LocalSubprocessRuntime>` and
|
|
33
|
+
rolls back (#39) — now shows as a warning with the restart/install remedy
|
|
34
|
+
instead of a silently healthy report. The standalone CLI cannot observe live
|
|
35
|
+
services, so the row exists only on the in-app surfaces. See
|
|
36
|
+
[DIAGNOSTICS.md](docs/DIAGNOSTICS.md#effective-providers-in-app-only).
|
|
37
|
+
- **`test/hot-swap.test.mjs` pins the live same-name swap semantics.** It
|
|
38
|
+
mounts the real `LocalSubprocessRuntime` and the rows the loader actually
|
|
39
|
+
uses against the host's cordis and asserts the states the install path
|
|
40
|
+
depends on: the rejected immediate registration while a live consumer holds
|
|
41
|
+
the provision, the takeover after the release, the idle swap, and the
|
|
42
|
+
deferral of all three takeover rows. A host change that alters the race
|
|
43
|
+
fails this file instead of a user's upgrade. The release gates now also name
|
|
44
|
+
the real-machine HMR update path
|
|
45
|
+
([MIGRATION.md](docs/MIGRATION.md#gates-a-release-must-clear)).
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **The directory picker browses Windows directories even when WSL is
|
|
50
|
+
unavailable.** `list()` resolved the preferred distro before the host walk;
|
|
51
|
+
on a machine where `wsl.exe` cannot answer (not installed, broken, or a
|
|
52
|
+
failing probe) a Windows folder could not be listed at all. The preferred
|
|
53
|
+
distro is only the dialog's Home affordance, so its failure now falls back to
|
|
54
|
+
the host home while a cancelled call still cancels; distro levels still
|
|
55
|
+
surface their own error. Caught by the Windows CI leg of
|
|
56
|
+
`test/provider-takeover.test.mjs`, which now pins the fallback.
|
|
57
|
+
- **The directory picker's one-shot fallback listed an empty directory.**
|
|
58
|
+
`runCapture` strips NUL bytes because `wsl.exe` writes its own diagnostics as
|
|
59
|
+
UTF-16LE, but the fallback feeds it `find -print0` output, whose NUL
|
|
60
|
+
separators are data: every name collapsed into one and the level came back
|
|
61
|
+
empty whenever the resident agent was unavailable (a stopped distro's first
|
|
62
|
+
browse, or an exhausted rebuild budget). The picker now uses
|
|
63
|
+
`runCaptureRaw`, which keeps the separators while the generic capture keeps
|
|
64
|
+
its UTF-16 recovery. Found and pinned by
|
|
65
|
+
`test/provider-takeover.test.mjs`; `test/wsl.test.mjs` pins both capture
|
|
66
|
+
contracts.
|
|
67
|
+
- **A live enable or HMR plugin upgrade no longer fails on the three
|
|
68
|
+
same-name takeovers, so the plugin manager no longer rolls the update back
|
|
69
|
+
(#39).** The `subprocess`, `fs`, and `directoryPicker` rows used to register
|
|
70
|
+
their providers immediately; when the outgoing shipped provider was still
|
|
71
|
+
registered — the HMR `updateBundle` window, or a busy-profile enable — cordis
|
|
72
|
+
threw `service "…" has been registered at <…>`, the row entered FAILED, and
|
|
73
|
+
`updateBundle` deleted the target version and reinstalled the old one. The
|
|
74
|
+
rows now mount through `src/service-takeover.ts`:
|
|
75
|
+
they register immediately when the name is free (the cold path, unchanged)
|
|
76
|
+
and otherwise stay active, watch `internal/service` for the slot, and
|
|
77
|
+
register when the outgoing provision releases. The install/update succeeds;
|
|
78
|
+
the takeover lands when the shipped provider drains, or at the next restart
|
|
79
|
+
when a dependent outlives the recomposition. The in-app doctor's
|
|
80
|
+
`providers.takeover` row names whichever provider still serves a name
|
|
81
|
+
([LIMITATIONS.md](docs/LIMITATIONS.md#enabling-the-plugin-on-a-running-profile)).
|
|
82
|
+
|
|
19
83
|
## [0.26.2] - 2026-11-17
|
|
20
84
|
|
|
21
85
|
One theme: a broken distro's failures surface as the program's own —
|
package/CONTRIBUTING.md
CHANGED
|
@@ -195,7 +195,7 @@ terminal if you would rather not see the prompt.
|
|
|
195
195
|
| `pnpm run lint:style` | style and lint rules | no |
|
|
196
196
|
| `pnpm run lint:build` | the build-freshness check: every source has its artifacts and the committed bytes match a real build | no |
|
|
197
197
|
| `pnpm run lint:types` | the TypeScript check over `test/**` and the ambient types (`tsc --noEmit`) | no |
|
|
198
|
-
| `pnpm run e2e:install` | packed-tarball install/upgrade/uninstall into a temporary `DSH_HOME
|
|
198
|
+
| `pnpm run e2e:install` | packed-tarball install/upgrade/uninstall into a temporary `DSH_HOME`; the newest published → current leg boots the profile with an overlay probe and asserts the three takeovers mount | yes; Windows + WSL |
|
|
199
199
|
| `pnpm run doctor` | the environment prerequisites, peers and caches (`--json` for scripts; `diagnose` is the read-only alias) | no; inside the distro |
|
|
200
200
|
| `pnpm run probe` | filesystem behaviour against a real distro | yes |
|
|
201
201
|
| `pnpm run probe:sandbox` | what bubblewrap confines and what it does not | no |
|
|
@@ -213,6 +213,7 @@ terminal if you would rather not see the prompt.
|
|
|
213
213
|
| `pnpm run probe:fs-routing` | the root-plane router: distro coordinate, host plane, cross-distro fence | yes |
|
|
214
214
|
| `pnpm run probe:mode` | which POSIX-mode facts survive the share | no; Windows Node |
|
|
215
215
|
| `pnpm run probe:sandbox-off` | the documented opt-out on both providers | yes |
|
|
216
|
+
| `pnpm run probe:session-sandbox` | the ADR 0001 primitives: user manager, transient scope lifetime, `/tmp` sharing and `--unshare-pid` behavior | no; from a real WSL terminal, not inside DSH |
|
|
216
217
|
|
|
217
218
|
Every script above is wired in `package.json`. `pnpm test` runs `lint:style`,
|
|
218
219
|
`lint:links`, `lint:requirements`, `lint:docs`, `test:syntax`, `lint:build`,
|
package/CONTRIBUTING.zh.md
CHANGED
|
@@ -89,7 +89,7 @@ pnpm run sync:windows
|
|
|
89
89
|
| `pnpm run lint:style` | 风格与 lint 规则 | 否 |
|
|
90
90
|
| `pnpm run lint:build` | 构建新鲜度检查:每个源码都有产物,且提交的字节匹配真实构建 | 否 |
|
|
91
91
|
| `pnpm run lint:types` | 对 `test/**` 和环境类型声明的 TypeScript 检查(`tsc --noEmit`) | 否 |
|
|
92
|
-
| `pnpm run e2e:install` | 在临时 `DSH_HOME` 中安装/升级/卸载打包 tarball | 是;Windows + WSL |
|
|
92
|
+
| `pnpm run e2e:install` | 在临时 `DSH_HOME` 中安装/升级/卸载打包 tarball;“最新已发布版 → 当前版本”leg 会用 overlay 探针启动 profile,断言三个接管实际挂载 | 是;Windows + WSL |
|
|
93
93
|
| `pnpm run doctor` | 环境前置项、peer 和缓存(脚本使用 `--json`;`diagnose` 是只读别名) | 否;在发行版内 |
|
|
94
94
|
| `pnpm run probe` | 针对真实发行版的文件系统行为 | 是 |
|
|
95
95
|
| `pnpm run probe:sandbox` | bubblewrap 隔离了什么、没有隔离什么 | 否 |
|
|
@@ -107,6 +107,7 @@ pnpm run sync:windows
|
|
|
107
107
|
| `pnpm run probe:fs-routing` | 根平面路由器:发行版坐标、宿主平面、跨发行版围栏 | 是 |
|
|
108
108
|
| `pnpm run probe:mode` | 哪些 POSIX 模式事实能在共享中保留 | 否;Windows Node |
|
|
109
109
|
| `pnpm run probe:sandbox-off` | 两个 provider 上文档说明的退出选项 | 是 |
|
|
110
|
+
| `pnpm run probe:session-sandbox` | ADR 0001 的原语:user manager、transient scope 生命周期、`/tmp` 共享与 `--unshare-pid` 行为 | 否;在真实 WSL 终端运行,不在 DSH 内 |
|
|
110
111
|
|
|
111
112
|
上述每个脚本都在 `package.json` 中定义。`pnpm test` 按顺序运行 `lint:style`、`lint:links`、`lint:requirements`、`lint:docs`、`test:syntax`、`lint:build`、`lint:types` 和 `test:unit`。`prepublishOnly` 在发布时再次运行 `pnpm test`,因此损坏的检查会在上传前阻止发布。
|
|
112
113
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -53,7 +53,11 @@ the replacement — because a `disabled` written *inside* an insert list is not
|
|
|
53
53
|
patch but a duplicate-id data row, and a nested `insert:` is never interpreted at
|
|
54
54
|
all. [`cordis.patch.yml`](../cordis.patch.yml) carries the full row list, and
|
|
55
55
|
`test/composition.test.mjs` runs the file through the real patch algorithm to
|
|
56
|
-
keep the shape honest.
|
|
56
|
+
keep the shape honest. The replacement rows mount through
|
|
57
|
+
[`lib/service-takeover.js`](../lib/service-takeover.js): they register their
|
|
58
|
+
providers immediately when the service name is free, and otherwise stay active
|
|
59
|
+
until the outgoing provision releases, so a live enable or HMR upgrade
|
|
60
|
+
completes instead of colliding (see [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)).
|
|
57
61
|
|
|
58
62
|
One further module ships built but deliberately unwired:
|
|
59
63
|
[`lib/file-reference-wsl.js`](../lib/file-reference-wsl.js), the distro-side
|
package/docs/ARCHITECTURE.zh.md
CHANGED
|
@@ -46,7 +46,10 @@ GUI 文件树与预览保留随包的 `workspace-files` 行。它的客户端半
|
|
|
46
46
|
`insert:` 列表——因为写在 insert 列表*内部*的 `disabled` 不是 patch,而是一行
|
|
47
47
|
重复 id 的数据行;而嵌套的 `insert:` 根本不会被解释。
|
|
48
48
|
[`cordis.patch.yml`](../cordis.patch.yml) 承载完整的行列表,`test/composition.test.mjs`
|
|
49
|
-
用真实的 patch
|
|
49
|
+
用真实的 patch 算法跑一遍该文件,以保持结构诚实。替代行通过
|
|
50
|
+
[`lib/service-takeover.js`](../lib/service-takeover.js) 挂载:服务名空闲时立即
|
|
51
|
+
注册 provider,否则保持激活、等旧提供者释放后再注册,因此运行中的启用或 HMR
|
|
52
|
+
升级会完成而不是相撞(见 [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md))。
|
|
50
53
|
|
|
51
54
|
还有一个模块随包构建,但有意不接线:
|
|
52
55
|
[`lib/file-reference-wsl.js`](../lib/file-reference-wsl.js),即 `@` 补全的
|
package/docs/DIAGNOSTICS.md
CHANGED
|
@@ -134,6 +134,21 @@ the map is partial or empty: the peers it omits could not be resolved by the
|
|
|
134
134
|
host, so they are unchecked rather than looked up again in the plugin's
|
|
135
135
|
physical tree.
|
|
136
136
|
|
|
137
|
+
### Effective providers (in-app only)
|
|
138
|
+
|
|
139
|
+
The three root-plane takeovers (`subprocess`, `fs`, `directoryPicker`) can fail
|
|
140
|
+
to activate on a live recomposition — a HMR plugin upgrade is the common case
|
|
141
|
+
([UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)). The standalone CLI runs
|
|
142
|
+
in its own process and cannot see them, so the in-app surfaces (the `wsl_doctor`
|
|
143
|
+
tool, `/wsl-doctor`, and the sidebar panel) append `providers.takeover`: it
|
|
144
|
+
names the class serving each service. `ok` means this plugin's providers serve
|
|
145
|
+
all three; `warn` names the shipped provider still in place and carries the
|
|
146
|
+
restart remedy. A deferred takeover — the plugin's row waiting for an outgoing
|
|
147
|
+
provision to release (`src/service-takeover.ts`) — is exactly this warning, and
|
|
148
|
+
it clears by itself when the old provider drains; if it persists, restarting
|
|
149
|
+
the app applies the takeover. A context that cannot see any of the three (a
|
|
150
|
+
preset realm, the standalone run) adds no row.
|
|
151
|
+
|
|
137
152
|
## The map
|
|
138
153
|
|
|
139
154
|
Class legend:
|
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -100,6 +100,19 @@ harness 安装留下的树——并比较那棵树的版本。现在查找在第
|
|
|
100
100
|
映射为空或只有部分项——缺失项说明宿主没有解析到,doctor 记作 unchecked,不再
|
|
101
101
|
回退到插件目录旁的本地副本。
|
|
102
102
|
|
|
103
|
+
### 生效的 provider(仅 in-app)
|
|
104
|
+
|
|
105
|
+
三个根面接管(`subprocess`、`fs`、`directoryPicker`)可能在运行中的重组里
|
|
106
|
+
激活失败——HMR 插件升级是最常见的情形
|
|
107
|
+
([UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md))。独立 CLI 在自己的
|
|
108
|
+
进程里运行、看不到这些服务,因此 in-app 入口(`wsl_doctor` 工具、
|
|
109
|
+
`/wsl-doctor`、侧栏面板)会追加 `providers.takeover` 行,列出每个服务当前由
|
|
110
|
+
哪个类提供:`ok` 表示三个都由本插件的 provider 提供;`warn` 会点名仍在位上的
|
|
111
|
+
随包 provider,并带上重启的补救。接管处于延迟状态(本插件的行在等旧提供者
|
|
112
|
+
释放,见 `src/service-takeover.ts`)正是这条警告;旧 provider 释放后它会自行
|
|
113
|
+
消失,若一直存在,重启应用即完成接管。看不到任何一个服务的上下文(preset
|
|
114
|
+
realm、独立 CLI 运行)不会加这一行。
|
|
115
|
+
|
|
103
116
|
## 地图
|
|
104
117
|
|
|
105
118
|
类别图例:
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -281,18 +281,31 @@ sandbox's security statement: `enforcement: partial` is untouched.
|
|
|
281
281
|
|
|
282
282
|
## Enabling the plugin on a running profile
|
|
283
283
|
|
|
284
|
-
- **A
|
|
285
|
-
|
|
286
|
-
`directoryPicker`) replace shipped services under the
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
recomposition. Mechanism and repro:
|
|
284
|
+
- **A live enable of this bundle defers the takeover until the outgoing
|
|
285
|
+
provider releases, instead of failing.** The three root-plane takeovers
|
|
286
|
+
(`subprocess`, `fs`, `directoryPicker`) replace shipped services under the
|
|
287
|
+
same names. When the previous provision is still registered during a live
|
|
288
|
+
recomposition, the plugin's rows stay ACTIVE and register after
|
|
289
|
+
`internal/service` reports the slot released (`src/service-takeover.ts`), so
|
|
290
|
+
cordis's duplicate-service error no longer fails the enable. The shipped
|
|
291
|
+
provider keeps serving until then; `/wsl-doctor`'s `providers.takeover` row
|
|
292
|
+
names it. If a dependent never releases, restarting the app completes the
|
|
293
|
+
takeover (the cold composition is correct). Mechanism and repro:
|
|
295
294
|
[UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md).
|
|
295
|
+
- **Upgrading through the plugin manager no longer rolls back; the takeover may
|
|
296
|
+
wait for a restart.** With HMR, `updateBundle` calls `removeBundle` before
|
|
297
|
+
installing the target. The moment the old layer is removed, this patch's
|
|
298
|
+
takeover entries (`- id: subprocess` / `disabled: true`, …) disappear with
|
|
299
|
+
it and the shipped rows re-activate; when the incoming layer arrives, this
|
|
300
|
+
plugin's rows find the slots occupied and wait for the release, so the
|
|
301
|
+
manager sees a success and keeps the target version. If a shipped provider is
|
|
302
|
+
never released (a dependent outlives the recomposition), the takeover
|
|
303
|
+
completes at the next restart, and `providers.takeover` names the shipped
|
|
304
|
+
provider meanwhile. The host-side remove→install window remains an upstream
|
|
305
|
+
issue ([deepseek-harness#12510](https://github.com/deepseek-ai/deepseek-harness/discussions/12510))
|
|
306
|
+
that can still fail other bundles; this plugin no longer triggers a rollback.
|
|
307
|
+
[#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) records the
|
|
308
|
+
actual `0.24.0 → 0.26.2` behavior.
|
|
296
309
|
|
|
297
310
|
## Host "Open in app"
|
|
298
311
|
|
package/docs/LIMITATIONS.zh.md
CHANGED
|
@@ -247,14 +247,25 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
|
|
|
247
247
|
|
|
248
248
|
## 在运行中的 profile 上启用本插件
|
|
249
249
|
|
|
250
|
-
-
|
|
251
|
-
三个根面接管行(`subprocess`、`fs`、`directoryPicker
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
250
|
+
- **在运行中的 profile 上启用本 bundle 时,接管会推迟到旧提供者释放,而不是
|
|
251
|
+
失败。** 三个根面接管行(`subprocess`、`fs`、`directoryPicker`)以同名替换
|
|
252
|
+
随包服务。运行中的重组里旧提供者可能仍持有服务注册;本插件的行保持激活,
|
|
253
|
+
等 `internal/service` 报告槽位释放后再注册(`src/service-takeover.ts`),
|
|
254
|
+
所以 cordis 的重复服务错误不再让启用失败。释放之前随包 provider 继续服务,
|
|
255
|
+
`/wsl-doctor` 的 `providers.takeover` 行会点名它;依赖方始终不释放时,重启
|
|
256
|
+
应用即可完成接管(冷启动组合是正确的)。机制与复现:
|
|
257
257
|
[UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)。
|
|
258
|
+
- **通过插件管理器升级不再自动回滚;接管可能推迟到重启。** 有 HMR 时
|
|
259
|
+
`updateBundle` 先 `removeBundle` 再安装目标版本:移除旧层的那一刻,本 patch
|
|
260
|
+
里的 `- id: subprocess / disabled: true` 等接管条目随之消失,随包行重新激活
|
|
261
|
+
并注册服务;新层到达时,本插件的行检测到槽位占用后等待释放,管理器看到的是
|
|
262
|
+
成功,不会删除目标版本。若随包 provider 因依赖方未释放而一直不释放,接管在
|
|
263
|
+
下次重启完成,期间 `providers.takeover` 报告仍在服务的随包 provider。宿主侧
|
|
264
|
+
的 remove→install 窗口仍是上游问题
|
|
265
|
+
([deepseek-harness#12510](https://github.com/deepseek-ai/deepseek-harness/discussions/12510)),
|
|
266
|
+
其他 bundle 仍可能失败;本插件不再触发回滚。
|
|
267
|
+
[#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) 记录了
|
|
268
|
+
`0.24.0 → 0.26.2` 的实际表现。
|
|
258
269
|
|
|
259
270
|
## 宿主的"在应用中打开"
|
|
260
271
|
|
package/docs/MIGRATION.md
CHANGED
|
@@ -80,8 +80,10 @@ shows the composed value.
|
|
|
80
80
|
| `pnpm run test:coverage` | lines 85 / branches 84 / functions 70 | CI (Node 24, Ubuntu) |
|
|
81
81
|
| `pnpm run test:browser` | the plugin web bundle in headless Chromium (layout, clicks, badge timing); install Chromium once | CI (`browser` job, Ubuntu) and the release `Gates` |
|
|
82
82
|
| Peer line tested | floor `>=0.2.2-rc.2`; the `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
|
|
83
|
-
| Packed install/upgrade/uninstall | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker) | manual, this machine (
|
|
84
|
-
|
|
|
83
|
+
| Packed install/upgrade/uninstall + boot | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker; newest published stable → current, then a boot-time probe asserts all three takeovers are this plugin's classes; **host-stopped path, not the HMR update**) | manual, this machine (13/13 on 2026-11-17 with the boot leg; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
|
|
84
|
+
| HMR update path (running profile) | install the previous published version in a temp `DSH_HOME`, start the desktop app with a live session, upgrade to the candidate through the plugin manager; assert `application: applied` and no rollback, and after a restart that `subprocess`/`fs`/`directoryPicker` are served by this plugin's classes (the update itself may land deferred, with `providers.takeover` a warn) | manual, this machine (**not run yet**; the path #39/#12510 escaped through) |
|
|
85
|
+
| Session-scoped sandbox (ADR 0001) | `pnpm run probe:session-sandbox` from a real WSL terminal (systemd user manager; not inside DSH, not in the closed-app suite) | manual; **11 passed / 0 failed / 0 skipped on 2026-11-17** — run in a fresh WSL session (`wsl.exe -d ubuntu --exec`), which sees systemd as PID 1; the probe asserts manager reachability, linger, transient-scope lifetime, `/tmp` sharing and `--unshare-pid` |
|
|
86
|
+
| Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host; `auto-preset.sh` joined the suite on 2026-11-17 (17 fast probes plus `run.sh`, 18 with `--include-fs`). The first closed-app run was **17/18**: `auto-preset.sh` failed because the `wslfs` probe profile does not compose the plugin bundle, and after that fix it still called `createSession` before auto-preset's `ctx.inject` wrapper had installed. Both causes were probe-side: the probe now layers the package patch, disables the profile's root `wsl-fs`, waits for the auto-preset fiber and the method's identity change, and reports seam/preset diagnostics. The full suite was rerun the same day (2026-11-17 20:16): **18/18, FULL PASS** (docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
|
|
85
87
|
| Clean Win11 + Ubuntu first run ≤ 5 min | a clean machine, a stopwatch | **not run** (the project's machine is already configured) |
|
|
86
88
|
| aarch64 executed | the native 18-check suite under qemu in CI | **run in CI** (physical aarch64 WSL is out of scope; see COMPATIBILITY.md) |
|
|
87
89
|
| No open P0 bug for 30 days | issue tracker | time-based; cannot be asserted from a checkout |
|
package/docs/MIGRATION.zh.md
CHANGED
|
@@ -68,8 +68,10 @@
|
|
|
68
68
|
| `pnpm run test:coverage` | 行 85 / 分支 84 / 函数 70 | CI(Node 24,Ubuntu) |
|
|
69
69
|
| `pnpm run test:browser` | 无头 Chromium 中的插件 web bundle(布局、点击、badge 时序);安装一次 Chromium | CI(`browser` job,Ubuntu)与发布的 `Gates` |
|
|
70
70
|
| peer 版本线受测 | 下限 `>=0.2.2-rc.2`;`peer-canary` 工作流解析 `next` 并运行临时升级 | CI 定时/手动 |
|
|
71
|
-
| 打包安装/升级/卸载 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker
|
|
72
|
-
|
|
|
71
|
+
| 打包安装/升级/卸载 + 启动 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker;最新已发布版 → 当前版本后用探针启动,断言三个接管都是本插件的类;**宿主关闭路径,不含 HMR 更新**) | 手动,本机(2026-11-17 含启动 leg 为 13/13;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
|
|
72
|
+
| HMR 更新路径(运行中 profile) | 临时 `DSH_HOME` 安装上一个已发布版本 → 启动桌面应用并保留活动会话 → 经插件管理升级到候选版本;断言 `application: applied`、无回滚,重启后 `subprocess`/`fs`/`directoryPicker` 由本插件的类提供(升级当时可能处于延迟接管,`providers.takeover` 为 warn) | 手动,本机(**尚未运行**;#39/#12510 漏测的正是这条路径) |
|
|
73
|
+
| 会话级沙箱(ADR 0001) | 在真实 WSL 终端运行 `pnpm run probe:session-sandbox`(systemd user manager;不在 DSH 内,也不在关闭应用套件里) | 手动;**2026-11-17 为 11 passed / 0 failed / 0 skipped**——在全新 WSL 会话(`wsl.exe -d ubuntu --exec`)中运行,systemd 是 PID 1;探针断言 manager 可达性、linger、transient scope 生命周期、`/tmp` 共享与 `--unshare-pid` |
|
|
74
|
+
| 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17;`auto-preset.sh` 于 2026-11-17 加入套件(17 项快速探针,`--include-fs` 时加 `run.sh`,共 18 项)。首次关闭应用的全套结果为 **17/18**:`auto-preset.sh` 失败,原因是 `wslfs` 探针 profile 不组合插件 bundle;修好组合后又发现探针在 auto-preset 的 `ctx.inject` 包装器安装前就调用了 `createSession`。两处都是探针侧问题:探针现在追加包自身的 patch、禁用 profile 的根 `wsl-fs`、等待 auto-preset 行的 fiber 与方法身份变化,并输出 seam/preset 诊断。同日 20:16 重跑整套:**18/18,FULL PASS**(docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
|
|
73
75
|
| 干净 Win11 + Ubuntu 首次运行 ≤ 5 分钟 | 干净机器、秒表 | **未运行**(项目机器已配置) |
|
|
74
76
|
| aarch64 已执行 | CI 中 qemu 下的 native 18 项检查套件 | **已在 CI 运行**(物理 aarch64 WSL 不在范围内;见 COMPATIBILITY.md) |
|
|
75
77
|
| 30 天内无未关闭的 P0 bug | issue tracker | 基于时间;无法从代码检出中断言 |
|
|
@@ -7,10 +7,27 @@ seen on the desktop `0.2.2-rc.1` release (app-bundled
|
|
|
7
7
|
`@deepseek-ai/cordis-plugin-loader@1.1.0`; the npm line still ships
|
|
8
8
|
cordis `4.0.5` / loader `1.0.5`), reproduced in isolation against both
|
|
9
9
|
version pairs on 2026-11-05, and the mechanism is confirmed down to the
|
|
10
|
-
`_unload` diff. The
|
|
10
|
+
`_unload` diff. The installed desktop `0.2.2-rc.3` still bundles those same
|
|
11
|
+
cordis/loader versions, and the failure it reports on a plugin upgrade
|
|
12
|
+
(`0.24.0 → 0.26.2`, [#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39))
|
|
13
|
+
carries the identical `service "subprocess" has been registered at
|
|
14
|
+
<LocalSubprocessRuntime>` diagnostic; the composed tree it rolled back from was
|
|
15
|
+
correct. The exact filing payload (title, body, command; drafted
|
|
11
16
|
2026-11-09) is
|
|
12
17
|
[proposal-service-swap.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/upstream/proposal-service-swap.md).
|
|
13
18
|
|
|
19
|
+
The same class is already filed upstream for the update path:
|
|
20
|
+
[deepseek-ai/deepseek-harness#12510](https://github.com/deepseek-ai/deepseek-harness/discussions/12510)
|
|
21
|
+
(opened 2026-11-07, category Q&A, **open, no accepted answer** as of
|
|
22
|
+
2026-11-17) reports the `directoryPicker` collision from `updateBundle` with
|
|
23
|
+
HMR. Its thread identifies the remove-then-install window — during
|
|
24
|
+
`removeBundle` the bundle's `disabled: true` rows are gone, so the shipped
|
|
25
|
+
provider re-activates and collides with the incoming replacement — and records
|
|
26
|
+
a three-way result: an HMR update fails and rolls back; the same update with
|
|
27
|
+
the `hmr` row disabled succeeds and waits for a restart; a stopped-host
|
|
28
|
+
`dsh plugin add` succeeds. #12510 is the discussion to attach this plugin's
|
|
29
|
+
`subprocess`/`fs` cases to; the payload below remains unfiled.
|
|
30
|
+
|
|
14
31
|
## The gap
|
|
15
32
|
|
|
16
33
|
A plugin row that **replaces** a shipped row providing the same cordis
|
|
@@ -118,11 +135,20 @@ that would:
|
|
|
118
135
|
|
|
119
136
|
## The plugin's posture until then
|
|
120
137
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
The plugin no longer exposes the collision: its three takeover rows mount
|
|
139
|
+
through `src/service-takeover.ts`, which registers the provider immediately
|
|
140
|
+
when the name is free and otherwise stays ACTIVE, watches `internal/service`
|
|
141
|
+
for the slot, and registers when the outgoing provision releases. A live
|
|
142
|
+
enable or HMR upgrade therefore succeeds; the takeover lands as soon as the
|
|
143
|
+
shipped provider drains, or at the next restart when a dependent outlives the
|
|
144
|
+
recomposition. `test/hot-swap.test.mjs` pins the four states this relies on
|
|
145
|
+
(the rejected immediate registration, the takeover after release, the idle
|
|
146
|
+
swap, and the deferral), so a host change that alters the race fails in CI
|
|
147
|
+
rather than in a user's upgrade. The in-app doctor's `providers.takeover` row
|
|
148
|
+
names whichever provider still serves a name.
|
|
149
|
+
|
|
150
|
+
The upstream gap remains for every other bundle that performs a same-name
|
|
151
|
+
takeover, and for the ordering itself: a host that composed the disable to
|
|
152
|
+
completion before starting the replacement would remove the need for the
|
|
153
|
+
deferral entirely. [docs/LIMITATIONS.md](LIMITATIONS.md#enabling-the-plugin-on-a-running-profile)
|
|
154
|
+
keeps the operator-facing summary.
|
package/docs/root-fs-routing.md
CHANGED
|
@@ -165,7 +165,7 @@ export `./fs-routing`)。config 承载两侧旋钮:宿主侧 `cwd`/`diffBasi
|
|
|
165
165
|
服务代理覆盖。该文件自 2026-10-19 起已在 `test:unit` 与 `test:coverage`
|
|
166
166
|
清单里(`docs/REQUIREMENTS.zh.md` 的 OI-7,已解决)。
|
|
167
167
|
- 真机探针全套(`test/probe/run-all-when-closed.sh --include-fs`,16 项常规
|
|
168
|
-
+ `run.sh` 共
|
|
168
|
+
+ `run.sh` 共 18 项,2026-11-06 起;`auto-preset.sh` 2026-11-17 加入)覆盖 agent、watch、substrate 等底座,并包含本路由的
|
|
169
169
|
`test/probe/fs-routing.sh`:临时 profile 以本路由为根 `fs`,经 UNC 坐标读
|
|
170
170
|
distro 内 ext4 文件、经盘符路径读 Windows 文件,并拒绝另一 distro 的 UNC。
|
|
171
171
|
|
package/lib/fs-routing.d.ts
CHANGED
|
@@ -298,4 +298,19 @@ export declare class WslRoutingFileSystem extends LocalFileSystem {
|
|
|
298
298
|
*/
|
|
299
299
|
processPath(target: FsTarget): string;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
/**
|
|
302
|
+
* The row the loader mounts: registers {@link WslRoutingFileSystem} under the
|
|
303
|
+
* `fs` name now, or after an outgoing provision releases (see
|
|
304
|
+
* {@link mountTakeover}). The `sandboxPolicy` inject rides on the row exactly
|
|
305
|
+
* as it did on the provider, so the fiber still waits for its sibling row.
|
|
306
|
+
*/
|
|
307
|
+
export default class WslRoutingRow {
|
|
308
|
+
static Config: z<RoutingConfig>;
|
|
309
|
+
static inject: string[];
|
|
310
|
+
/**
|
|
311
|
+
* @param ctx - the row's context; it owns the provider's provision.
|
|
312
|
+
* @param config - the schema-validated row config.
|
|
313
|
+
*/
|
|
314
|
+
constructor(ctx: Context, config: RoutingConfig);
|
|
315
|
+
}
|
|
316
|
+
export {};
|
package/lib/fs-routing.js
CHANGED
|
@@ -34,6 +34,7 @@ import { isWslUnc, uncToPosix } from "./paths.js";
|
|
|
34
34
|
import z from "@deepseek-ai/schemastery";
|
|
35
35
|
import { LocalFileSystem } from "@deepseek-ai/dsh-fs-local";
|
|
36
36
|
import { WslFileSystem } from "./wsl-filesystem.js";
|
|
37
|
+
import { mountTakeover } from "./service-takeover.js";
|
|
37
38
|
/**
|
|
38
39
|
* Whether a resolved target identity belongs to the distro.
|
|
39
40
|
*
|
|
@@ -393,4 +394,20 @@ export class WslRoutingFileSystem extends LocalFileSystem {
|
|
|
393
394
|
return super.processPath(target);
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
|
-
|
|
397
|
+
/**
|
|
398
|
+
* The row the loader mounts: registers {@link WslRoutingFileSystem} under the
|
|
399
|
+
* `fs` name now, or after an outgoing provision releases (see
|
|
400
|
+
* {@link mountTakeover}). The `sandboxPolicy` inject rides on the row exactly
|
|
401
|
+
* as it did on the provider, so the fiber still waits for its sibling row.
|
|
402
|
+
*/
|
|
403
|
+
export default class WslRoutingRow {
|
|
404
|
+
static Config = WslRoutingFileSystem.Config;
|
|
405
|
+
static inject = WslRoutingFileSystem.inject;
|
|
406
|
+
/**
|
|
407
|
+
* @param ctx - the row's context; it owns the provider's provision.
|
|
408
|
+
* @param config - the schema-validated row config.
|
|
409
|
+
*/
|
|
410
|
+
constructor(ctx, config) {
|
|
411
|
+
mountTakeover(ctx, "fs", () => { new WslRoutingFileSystem(ctx, config); });
|
|
412
|
+
}
|
|
413
|
+
}
|
package/lib/picker.d.ts
CHANGED
|
@@ -284,4 +284,55 @@ export declare class WslDirectoryPicker extends DirectoryPicker {
|
|
|
284
284
|
*/
|
|
285
285
|
createDistroDirectory(parent: string, name: string, target: string): Promise<string>;
|
|
286
286
|
}
|
|
287
|
-
|
|
287
|
+
/**
|
|
288
|
+
* The row the loader mounts: registers {@link WslDirectoryPicker} under the
|
|
289
|
+
* `directoryPicker` name now, or after an outgoing provision releases (see
|
|
290
|
+
* {@link mountTakeover}).
|
|
291
|
+
*/
|
|
292
|
+
export default class WslDirectoryPickerRow {
|
|
293
|
+
static Config: z<Schemastery.ObjectS<NoInfer<{
|
|
294
|
+
/** Path to `wsl.exe`; overridable for a non-standard install. */
|
|
295
|
+
wslPath: z<string, string, "defined">;
|
|
296
|
+
/**
|
|
297
|
+
* Distro listed first and used for the Home affordance. Empty means WSL's
|
|
298
|
+
* own default distro.
|
|
299
|
+
*/
|
|
300
|
+
preferredDistro: z<string, string, "defined">;
|
|
301
|
+
/**
|
|
302
|
+
* Offer the Windows path branch, starting at the drive roots, so every
|
|
303
|
+
* volume and account stays reachable without typing a path. Without it the
|
|
304
|
+
* category level carries the WSL branch alone; the dialog's editable path
|
|
305
|
+
* zone accepts any Windows path either way.
|
|
306
|
+
*/
|
|
307
|
+
includeHostHome: z<boolean, boolean, "defined">;
|
|
308
|
+
/** Bound on the directory rows one `list` call may return; the level is flagged truncated. */
|
|
309
|
+
maxEntries: z<number, number, "defined">;
|
|
310
|
+
/** How long a resolved distro list stays fresh. */
|
|
311
|
+
distroCacheMs: z<number, number, "defined">;
|
|
312
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
313
|
+
/** Path to `wsl.exe`; overridable for a non-standard install. */
|
|
314
|
+
wslPath: z<string, string, "defined">;
|
|
315
|
+
/**
|
|
316
|
+
* Distro listed first and used for the Home affordance. Empty means WSL's
|
|
317
|
+
* own default distro.
|
|
318
|
+
*/
|
|
319
|
+
preferredDistro: z<string, string, "defined">;
|
|
320
|
+
/**
|
|
321
|
+
* Offer the Windows path branch, starting at the drive roots, so every
|
|
322
|
+
* volume and account stays reachable without typing a path. Without it the
|
|
323
|
+
* category level carries the WSL branch alone; the dialog's editable path
|
|
324
|
+
* zone accepts any Windows path either way.
|
|
325
|
+
*/
|
|
326
|
+
includeHostHome: z<boolean, boolean, "defined">;
|
|
327
|
+
/** Bound on the directory rows one `list` call may return; the level is flagged truncated. */
|
|
328
|
+
maxEntries: z<number, number, "defined">;
|
|
329
|
+
/** How long a resolved distro list stays fresh. */
|
|
330
|
+
distroCacheMs: z<number, number, "defined">;
|
|
331
|
+
}>>, "plain">;
|
|
332
|
+
/**
|
|
333
|
+
* @param ctx - the row's context; it owns the provider's provision.
|
|
334
|
+
* @param config - the schema-validated row config.
|
|
335
|
+
*/
|
|
336
|
+
constructor(ctx: Context, config: PickerConfig);
|
|
337
|
+
}
|
|
338
|
+
export {};
|
package/lib/picker.js
CHANGED
|
@@ -54,8 +54,9 @@ import z from "@deepseek-ai/schemastery";
|
|
|
54
54
|
import { DirectoryPicker, DirectoryPickerError } from "@deepseek-ai/dsh-host-directory-picker";
|
|
55
55
|
import { UNC_PROVIDER_ROOT, distroRoot, isProviderRoot, isWslUnc, uncToPosix } from "./paths.js";
|
|
56
56
|
import { breadcrumbs, boundedInsert, dirListingArgv, distroMkdirArgv, fullyQualified, parseDirListing } from "./listing.js";
|
|
57
|
-
import { listDistros, linuxHome, runCapture } from "./wsl.js";
|
|
57
|
+
import { listDistros, linuxHome, runCapture, runCaptureRaw } from "./wsl.js";
|
|
58
58
|
import { sharedAgent } from "./agent-shared.js";
|
|
59
|
+
import { mountTakeover } from "./service-takeover.js";
|
|
59
60
|
import { AgentUnavailableError, CwdError, SpawnError } from "./agent-errors.js";
|
|
60
61
|
/** How long a resolved distro list stays fresh before it is queried again. */
|
|
61
62
|
const DEFAULT_DISTRO_CACHE_MS = 5_000;
|
|
@@ -369,7 +370,17 @@ export class WslDirectoryPicker extends DirectoryPicker {
|
|
|
369
370
|
throw new DirectoryPickerError("directory-unreadable", path, `cannot list "${path}": not a fully qualified path`);
|
|
370
371
|
}
|
|
371
372
|
const target = resolve(path);
|
|
372
|
-
|
|
373
|
+
// A host directory must list even when WSL itself is unusable (not
|
|
374
|
+
// installed, or `wsl.exe` failing): the preferred distro is only the
|
|
375
|
+
// dialog's Home affordance here. A cancelled call still cancels.
|
|
376
|
+
let preferred = "";
|
|
377
|
+
try {
|
|
378
|
+
preferred = await this.preferredDistro(signal);
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
if (signal?.aborted)
|
|
382
|
+
throw error;
|
|
383
|
+
}
|
|
373
384
|
const level = isWslUnc(target) ? await this.listDistroLevel(target, signal) : await this.listHostLevel(target, signal);
|
|
374
385
|
return {
|
|
375
386
|
path: target,
|
|
@@ -414,7 +425,9 @@ export class WslDirectoryPicker extends DirectoryPicker {
|
|
|
414
425
|
catch (error) {
|
|
415
426
|
if (error instanceof AgentUnavailableError) {
|
|
416
427
|
try {
|
|
417
|
-
|
|
428
|
+
// `find -print0` output is NUL-separated; the generic capture strips
|
|
429
|
+
// NULs for UTF-16 diagnostics and would collapse the rows into one.
|
|
430
|
+
stdout = await runCaptureRaw([this.config.wslPath, "-d", parsed.distro, "--cd", linuxDir, "--exec", ...dirListingArgv(linuxDir)], signal);
|
|
418
431
|
}
|
|
419
432
|
catch (fallbackError) {
|
|
420
433
|
throw new DirectoryPickerError("directory-unreadable", target, `cannot list "${target}": ${messageOf(fallbackError)}`);
|
|
@@ -564,4 +577,18 @@ export class WslDirectoryPicker extends DirectoryPicker {
|
|
|
564
577
|
}
|
|
565
578
|
}
|
|
566
579
|
}
|
|
567
|
-
|
|
580
|
+
/**
|
|
581
|
+
* The row the loader mounts: registers {@link WslDirectoryPicker} under the
|
|
582
|
+
* `directoryPicker` name now, or after an outgoing provision releases (see
|
|
583
|
+
* {@link mountTakeover}).
|
|
584
|
+
*/
|
|
585
|
+
export default class WslDirectoryPickerRow {
|
|
586
|
+
static Config = WslDirectoryPicker.Config;
|
|
587
|
+
/**
|
|
588
|
+
* @param ctx - the row's context; it owns the provider's provision.
|
|
589
|
+
* @param config - the schema-validated row config.
|
|
590
|
+
*/
|
|
591
|
+
constructor(ctx, config) {
|
|
592
|
+
mountTakeover(ctx, "directoryPicker", () => { new WslDirectoryPicker(ctx, config); });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deferred registration for the plugin's same-name root-plane takeovers.
|
|
3
|
+
*
|
|
4
|
+
* The bundle patch disables the shipped `subprocess`/`fs`/`directoryPicker`
|
|
5
|
+
* rows and inserts this plugin's providers under the same service names. On a
|
|
6
|
+
* cold boot the shipped rows never start, so the provider registers freely.
|
|
7
|
+
* On a LIVE recomposition the outgoing provision can still be registered while
|
|
8
|
+
* the replacement mounts — the HMR plugin-update path (`updateBundle` removes
|
|
9
|
+
* the old bundle layer, the shipped rows re-activate, then the incoming layer
|
|
10
|
+
* disables them again) or a busy-profile enable while live sessions hold the
|
|
11
|
+
* service. Cordis refuses the duplicate registration, the row enters FAILED,
|
|
12
|
+
* and the plugin manager reports the update as failed and rolls back (issue
|
|
13
|
+
* #39, upstream deepseek-harness#12510).
|
|
14
|
+
*
|
|
15
|
+
* A row that mounts through this helper stays ACTIVE either way: when the name
|
|
16
|
+
* is free it registers immediately (the cold path, unchanged), and when a
|
|
17
|
+
* provision is still registered it waits for `internal/service` to report the
|
|
18
|
+
* slot released, then registers. The recomposition therefore succeeds, the
|
|
19
|
+
* outgoing provider keeps serving until its dependents release, and the
|
|
20
|
+
* takeover lands as soon as it does — or at the next restart, if a dependent
|
|
21
|
+
* never releases (the in-app doctor's `providers.takeover` row names the
|
|
22
|
+
* provider still in place).
|
|
23
|
+
*
|
|
24
|
+
* Guards:
|
|
25
|
+
* - `ctx.reflect.get(name, false)` reads the store including an UNLOADING
|
|
26
|
+
* implementation, so a slot that is about to free still reads as occupied.
|
|
27
|
+
* - The handler never registers from a fiber that is itself unloading: the
|
|
28
|
+
* release it observes can be its own disposal, and a provision registered
|
|
29
|
+
* then would be owned by a dying fiber.
|
|
30
|
+
*
|
|
31
|
+
* This is a TypeScript source built to `lib/service-takeover.js`; edit THIS
|
|
32
|
+
* file and run `pnpm run build`.
|
|
33
|
+
*
|
|
34
|
+
* @module dsh-plugin-wsl-env/service-takeover
|
|
35
|
+
*/
|
|
36
|
+
import { type Context } from "@deepseek-ai/cordis";
|
|
37
|
+
/**
|
|
38
|
+
* Register a same-name takeover provider now, or after the outgoing provision
|
|
39
|
+
* releases.
|
|
40
|
+
*
|
|
41
|
+
* @param ctx - the row's context; the provision is owned by its fiber.
|
|
42
|
+
* @param service - the service name the provider registers.
|
|
43
|
+
* @param mount - constructs the provider on `ctx` (its constructor performs
|
|
44
|
+
* the registration and owns the cleanup).
|
|
45
|
+
*/
|
|
46
|
+
export declare function mountTakeover(ctx: Context, service: string, mount: () => void): void;
|