dsh-plugin-wsl-env 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -0
- package/CONTRIBUTING.md +7 -3
- package/README.md +11 -9
- package/SUPPORT.md +1 -1
- package/client.js +153 -33
- package/cordis.patch.yml +13 -4
- package/docs/AGENT-PROTOCOL-V7.md +4 -4
- package/docs/API.md +12 -2
- package/docs/ARCHITECTURE.md +59 -19
- package/docs/CONFIGURATION.md +44 -13
- package/docs/CONFIGURATION.zh.md +44 -8
- package/docs/DIAGNOSTICS.md +41 -1
- package/docs/DIAGNOSTICS.zh.md +34 -2
- package/docs/LIMITATIONS.md +42 -17
- package/docs/LIMITATIONS.zh.md +47 -12
- package/docs/MIGRATION.md +1 -1
- package/docs/PEER-PARITY.md +8 -7
- package/docs/QUICKSTART.md +16 -8
- package/docs/QUICKSTART.zh.md +22 -4
- package/docs/README.zh.md +19 -10
- package/docs/RELEASING.md +8 -3
- package/docs/REQUIREMENTS.zh.md +11 -6
- package/docs/ROADMAP-1.0.md +12 -11
- package/docs/ROADMAP.md +10 -8
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
- package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
- package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
- package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
- package/docs/VALUE.zh.md +5 -5
- package/docs/root-fs-routing.md +26 -19
- package/lib/agent-confined.d.ts +2 -2
- package/lib/agent-confined.js +0 -1
- package/lib/agent-exec.d.ts +2 -11
- package/lib/agent-protocol.d.ts +6 -5
- package/lib/agent.d.ts +5 -5
- package/lib/auto-preset.d.ts +4 -3
- package/lib/bwrap.d.ts +2 -1
- package/lib/client-host.d.ts +1 -1
- package/lib/client-host.js +1 -1
- package/lib/cwd-prompt-tool.d.ts +4 -20
- package/lib/cwd-prompt.d.ts +11 -10
- package/lib/distro-route.d.ts +3 -2
- package/lib/doctor-live.d.ts +2 -1
- package/lib/fs-routing.d.ts +29 -1
- package/lib/fs-routing.js +30 -3
- package/lib/fs-substrate.d.ts +0 -1
- package/lib/fs-substrate.js +0 -1
- package/lib/fsio-agent.d.ts +3 -21
- package/lib/fsio-agent.js +2 -4
- package/lib/git-exec.d.ts +3 -2
- package/lib/git-route.d.ts +4 -2
- package/lib/git-route.js +4 -2
- package/lib/index.d.ts +20 -10
- package/lib/index.js +128 -12
- package/lib/listing.d.ts +2 -1
- package/lib/messages.d.ts +82 -1
- package/lib/messages.js +94 -1
- package/lib/native-agent.d.ts +3 -2
- package/lib/paths.d.ts +2 -1
- package/lib/picker.d.ts +1 -14
- package/lib/picker.js +1 -2
- package/lib/preflight.d.ts +5 -4
- package/lib/probe-cache.d.ts +2 -1
- package/lib/sandbox-core.d.ts +2 -11
- package/lib/sandbox-core.js +1 -1
- package/lib/sandbox.d.ts +0 -1
- package/lib/sandbox.js +0 -4
- package/lib/search-exec.d.ts +2 -1
- package/lib/session-runtime.d.ts +3 -2
- package/lib/shell-env.d.ts +3 -2
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/subprocess.d.ts +1 -1
- package/lib/update-check.d.ts +3 -3
- package/lib/wsl-doctor-command.d.ts +133 -0
- package/lib/wsl-doctor-command.js +381 -0
- package/lib/wsl-doctor-tool.d.ts +101 -16
- package/lib/wsl-doctor-tool.js +290 -22
- package/lib/wsl.d.ts +3 -2
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +29 -31
- package/scripts/bootstrap-import.sh +189 -0
- package/scripts/doctor.mjs +569 -141
- package/scripts/open-wsl-vscode.ps1 +36 -0
- package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
|
@@ -115,7 +115,7 @@ The rest of the module stays. `BINARY_SAMPLE_BYTES`, `FsCodedError`,
|
|
|
115
115
|
`notTextError`, `decodeUtf8`, `decodeUtf8Stream` and `throwIfAborted`
|
|
116
116
|
(`src/fsio-text.ts:23`, `:30`, `:53`, `:67`, `:86`, `:179`) have no counterpart
|
|
117
117
|
in the fsio declarations, and the module's other consumers keep importing them
|
|
118
|
-
locally (`src/fsio-agent.ts:27-
|
|
118
|
+
locally (`src/fsio-agent.ts:27-34`, `src/fs-substrate.ts:37`,
|
|
119
119
|
`src/index.ts:57`). `lib/fsio-text.js` is not deleted; four of its ten exports
|
|
120
120
|
are.
|
|
121
121
|
|
|
@@ -164,7 +164,7 @@ Files that move with it:
|
|
|
164
164
|
|
|
165
165
|
- `src/fsio-text.ts` — drop `applyLiteralEdit`, `detectLineEndings`,
|
|
166
166
|
`normalizeLineEndings`, `restoreLineEndings`; keep the rest.
|
|
167
|
-
- `src/fsio-agent.ts` (imports `:27-
|
|
167
|
+
- `src/fsio-agent.ts` (imports `:27-34`, `detectLineEndings` used at `:756`)
|
|
168
168
|
and `src/fs-substrate.ts` (`:37`) — take the four from the peer. Where they
|
|
169
169
|
land decides the module's peer story: importing them directly keeps
|
|
170
170
|
`src/fsio-text.ts` peer-free — and `test/fsio-text.test.mjs`, which imports
|
|
@@ -176,13 +176,12 @@ Files that move with it:
|
|
|
176
176
|
- `test/fsio-text.test.mjs` (the replica's tests, including the
|
|
177
177
|
`detectLineEndings` checks at `:69-72`) and `test/fsio-agent.test.mjs:22`,
|
|
178
178
|
which imports two of the four from `lib/fsio-text.js`. If that test file is
|
|
179
|
-
dropped or renamed,
|
|
180
|
-
`package.json
|
|
181
|
-
- The documents that describe the replica as current: `docs/ARCHITECTURE.md
|
|
182
|
-
|
|
183
|
-
`docs/
|
|
184
|
-
|
|
185
|
-
"landed".
|
|
179
|
+
dropped or renamed, update the `test:coverage` and `test:unit` script lists
|
|
180
|
+
in `package.json` too.
|
|
181
|
+
- The documents that describe the replica as current: `docs/ARCHITECTURE.md`
|
|
182
|
+
(the entries marked "replicated … pending the … export"), `docs/PEER-PARITY.md`
|
|
183
|
+
(plus its Maintenance section), `docs/upstream/promotion-map.md` — and this
|
|
184
|
+
file, whose status then becomes "landed".
|
|
186
185
|
|
|
187
186
|
Done when: the pinned peer resolves the four names from both its runtime entry
|
|
188
187
|
and its declarations, the plugin imports them there, `pnpm test` passes, and no
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Upstream proposal: a same-name service swap that survives live recomposition
|
|
2
2
|
|
|
3
|
-
Status: observed,
|
|
4
|
-
`
|
|
3
|
+
Status: observed, filing payload drafted; **not filed yet** — filing against
|
|
4
|
+
`deepseek-ai/deepseek-harness` is a maintainer action. The failure was first
|
|
5
|
+
seen on the desktop `0.2.2-rc.1` release (app-bundled
|
|
6
|
+
`@deepseek-ai/cordis@4.1.0` +
|
|
5
7
|
`@deepseek-ai/cordis-plugin-loader@1.1.0`; the npm line still ships
|
|
6
|
-
cordis `4.0.5` / loader `1.0.5
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
cordis `4.0.5` / loader `1.0.5`), reproduced in isolation against both
|
|
9
|
+
version pairs on 2026-11-05, and the mechanism is confirmed down to the
|
|
10
|
+
`_unload` diff. The exact filing payload (title, body, command; drafted
|
|
11
|
+
2026-11-09) is
|
|
12
|
+
[proposal-service-swap.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/upstream/proposal-service-swap.md).
|
|
9
13
|
|
|
10
14
|
## The gap
|
|
11
15
|
|
|
@@ -95,18 +95,19 @@ With either, this plugin deletes the limitation paragraph in
|
|
|
95
95
|
[LIMITATIONS.md](LIMITATIONS.md) and the `WSL`-over-PowerShell title, for any
|
|
96
96
|
provider that rewrites launches — not just WSL. The same limitation is stated
|
|
97
97
|
as current fact in four places. Three go stale the day the proposal lands; the
|
|
98
|
-
fourth
|
|
99
|
-
|
|
98
|
+
fourth — the `WSL` tab-title bullet under "Terminals" in
|
|
99
|
+
[LIMITATIONS.md](LIMITATIONS.md) — was already out of step and needed the
|
|
100
|
+
corrections above: it said the controller titles a tab *before* the provider
|
|
101
|
+
rewrites the launch, the reverse of the ordering corrected at the top of this
|
|
102
|
+
file, and it carried the one-line `shellCandidates` workaround that drops the
|
|
103
|
+
row's `shell` block. Corrected on 2026-11-09 (the LIMITATIONS paragraph and
|
|
104
|
+
its Chinese mirror now follow the ordering at the top of this file); the
|
|
105
|
+
remaining three still go stale the day the proposal lands:
|
|
100
106
|
|
|
101
107
|
- the GUI-terminal comment block in [`cordis.patch.yml`](../cordis.patch.yml);
|
|
102
108
|
- the closing paragraph of "Why the terminal provider is app-level" in
|
|
103
109
|
[ARCHITECTURE.md](ARCHITECTURE.md);
|
|
104
|
-
- R4's `残差` (residual) column in [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md)
|
|
105
|
-
- the `WSL` tab-title bullet under "Terminals" in
|
|
106
|
-
[LIMITATIONS.md](LIMITATIONS.md) — the paragraph named just above. It says
|
|
107
|
-
the controller titles a tab *before* the provider rewrites the launch, the
|
|
108
|
-
reverse of the ordering corrected at the top of this file, and it carries the
|
|
109
|
-
one-line `shellCandidates` workaround that drops the row's `shell` block.
|
|
110
|
+
- R4's `残差` (residual) column in [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md).
|
|
110
111
|
|
|
111
112
|
## Workarounds until then
|
|
112
113
|
|
package/docs/VALUE.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
本文只回答一个问题:**在 Windows 上用 DeepSeek Harness 做 WSL 项目,为什么值得装这个插件。**
|
|
4
4
|
功能、安装与逐项行为见 [README](../README.md) 和 [ARCHITECTURE.md](ARCHITECTURE.md),这里谈收益、代价与适用边界。
|
|
5
|
-
文中每条主张都指向仓库内可复核的证据;基线为 v0.
|
|
5
|
+
文中每条主张都指向仓库内可复核的证据;基线为 v0.22.0(2026-11-08)。早期条目在 v0.9.0 基线上引入,2026-11-09 对版本、工具面与门禁链做了复核。
|
|
6
6
|
|
|
7
7
|
> **一句话**:它把 WSL 发行版变成 DSH 会话真正的执行环境——命令、文件、终端、目录选择器都在发行版内完成,
|
|
8
8
|
> 同时保留 DSH 的权限模型和发行版内的 bubblewrap 沙箱;不往发行版里装自己的服务,也不开端口。
|
|
@@ -52,13 +52,13 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
|
|
|
52
52
|
|
|
53
53
|
**机制。** 组合层按路径坐标路由:发行版 UNC 路径交给 agent 实现,盘符路径留给宿主后端;GUI 终端按会话路由,WSL 目录会话得到发行版 shell,Windows 目录会话仍是 PowerShell;`wsl-shell`/`wsl-fs` 挂在 preset 层,所以环境按会话生效。
|
|
54
54
|
|
|
55
|
-
**可感知的差别。** 不需要为 WSL 单开一个应用或 profile,也不需要把整个应用切成「WSL 模式」。同一个窗口里,开 Windows 文件夹的会话不受影响,开 `\\wsl.localhost\...`
|
|
55
|
+
**可感知的差别。** 不需要为 WSL 单开一个应用或 profile,也不需要把整个应用切成「WSL 模式」。同一个窗口里,开 Windows 文件夹的会话不受影响,开 `\\wsl.localhost\...` 的会话自动进入发行版。换项目只是换一个打开的文件夹。模型侧尤其重要:插件只新增 `wsl_doctor` 一个模型工具(另有 `/wsl-doctor` 命令);其余现有工具的名字、参数、返回语义不变,变的只是它们实际作用的世界。
|
|
56
56
|
|
|
57
57
|
**证据。** [README「Architecture」](../README.md#architecture)、[docs/root-fs-routing.md](root-fs-routing.md);`test/composition.test.mjs`、`test/terminal.test.mjs`、`test/fs.boot.test.mjs`。
|
|
58
58
|
|
|
59
59
|
### 价值五:不装服务、不开端口、没有残留
|
|
60
60
|
|
|
61
|
-
**机制。**
|
|
61
|
+
**机制。** 发行版里没有安装任何服务,也没有监听端口;插件替换 DSH 的服务实现,并新增 `wsl_doctor` 工具与 `/wsl-doctor` 命令。文件操作与命令走发行版内按 distro 缓存的常驻 agent——它是传输层,不注册系统服务,agent 脚本在握手时校验 sha256。
|
|
62
62
|
|
|
63
63
|
**可感知的差别。** 不会多出 `~/.vscode-server` 这类目录,不会和本机端口冲突,卸载后发行版里没有需要手动清理的服务端目录。WSL 升级或发行版重启后,下一次调用重建传输;只有 agent 在「有请求在飞」时死亡才可能耗尽它的一次重建额度(见 [LIMITATIONS](LIMITATIONS.md)),这是已声明的边界,不是日常路径。
|
|
64
64
|
|
|
@@ -107,12 +107,12 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
|
|
|
107
107
|
|
|
108
108
|
| 层面 | 证据 |
|
|
109
109
|
|---|---|
|
|
110
|
-
| 每次提交 | `pnpm test
|
|
110
|
+
| 每次提交 | `pnpm test`:风格、相对链接、需求引用、文档一致性、语法、构建逐字节一致、`tsc --noEmit`、单测全过 |
|
|
111
111
|
| 覆盖率 | `pnpm run test:coverage`,门限 85/84/70(行/分支/函数) |
|
|
112
112
|
| 真机 | 探针套件(`test/probe/run-all-when-closed.sh --include-fs`),含沙箱边界演示、agent/one-shot 双路径对拍、文件基座、终端、选择器 |
|
|
113
113
|
| CI | Node 22 / 24 × Linux / Windows 跑 `pnpm test`;覆盖率在 Node 24 |
|
|
114
114
|
| 上游接缝 | peer 钉版逐字节比对,[PEER-PARITY.md](PEER-PARITY.md)、[upstream/promotion-map.md](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/upstream/promotion-map.md) |
|
|
115
|
-
| 行为承诺 | [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md) 的
|
|
115
|
+
| 行为承诺 | [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md) 的 28 条登记(R1–R28)与追溯矩阵 |
|
|
116
116
|
|
|
117
117
|
真机探针是手动步骤(托管 runner 没有 WSL 发行版),这是已记录的验证缺口(REQUIREMENTS 的 OI-2),不是隐性遗漏。
|
|
118
118
|
|
package/docs/root-fs-routing.md
CHANGED
|
@@ -56,19 +56,20 @@ home 缓存,所以同一个根平面可以同时服务多个发行版;`distr
|
|
|
56
56
|
| stat / listDir / readText / streamText / readBytes / readByteRange | targetKey 坐标 | substrate 对应操作 | super |
|
|
57
57
|
| watch | targetKey 坐标 | distro inotify 或轮询(粗粒度失效) | chokidar |
|
|
58
58
|
| writeText / editText | targetKey 坐标 | distro 写(substrate 守卫 + confined agent 内核强制) | super |
|
|
59
|
-
|
|
|
59
|
+
| patchText / deleteFile / moveFile(v7) | targetKey 坐标;move 任一端为 distro 即整体路由 | distro 写(同一守卫 + confined agent;move 两端版本复核) | super |
|
|
60
|
+
| contains / processPath | parent/targetKey 坐标 | `contains` 按两个 UNC 的 POSIX 坐标判定;`processPath` 返回 UNC 宿主拼写 | super |
|
|
60
61
|
|
|
61
|
-
未覆写的出口:本类覆写的是上表这
|
|
62
|
+
未覆写的出口:本类覆写的是上表这 16 个方法,`fileUrl` 与
|
|
62
63
|
`processPathFromHostPath` 沿用宿主实现——「按坐标路由」不等于接口全覆盖。
|
|
63
64
|
|
|
64
65
|
- `fileUrl` 由继承的实现从 `processPath` 派生
|
|
65
66
|
(`pathToFileURL(this.processPath(target)).href`,`dsh-fs-local/lib/index.js:795-796`):
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
`processPath` 现在返回 UNC 宿主拼写,Windows 上得到
|
|
68
|
+
`file://wsl.localhost/<distro>/<path>`。它仍不是客户端媒体 URL 的形态——
|
|
69
|
+
客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径(§2.2)——真有消费者时需要
|
|
70
|
+
按需覆写。
|
|
70
71
|
- `processPathFromHostPath` 也是宿主实现(绝对宿主路径取 `resolve`)。被路由的
|
|
71
|
-
`WslFileSystem` 自己有一份 distro 映射(`src/index.ts:
|
|
72
|
+
`WslFileSystem` 自己有一份 distro 映射(`src/index.ts:2133`),那份映射不经
|
|
72
73
|
本路由。
|
|
73
74
|
|
|
74
75
|
### 2.2 有意的行为差异(对照原根 fs-sandbox)
|
|
@@ -77,15 +78,21 @@ home 缓存,所以同一个根平面可以同时服务多个发行版;`distr
|
|
|
77
78
|
检查)只护写路径,而根平面当前没有写消费者(tool-fs 的写在 preset)。
|
|
78
79
|
distro 侧写入自带更强的围栏(Linux 前缀包含 + confined agent 内核强制)。
|
|
79
80
|
文档明示:若未来出现根平面写消费者,围栏语义需随行。
|
|
80
|
-
- **UNC 目标的 `processPath`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`
|
|
88
|
-
`
|
|
81
|
+
- **UNC 目标的 `processPath` 返回宿主拼写(UNC)**:与随包宿主后端和会话后端
|
|
82
|
+
`WslFileSystem`(继承 `LocalFileSystem`)一致——它们都回答 `String(targetKey)`。
|
|
83
|
+
这是宿主路径消费者的硬契约:`session.openWorkspacePath` 与
|
|
84
|
+
`session.workspacePathApplications` 的 `verifyDesktopPath` 要求
|
|
85
|
+
`processPath(resolve(processPathFromHostPath(hostPath))) === hostPath`,而
|
|
86
|
+
`processPathFromHostPath` 是宿主实现(UNC 输入原样返回)。此前返回 Linux
|
|
87
|
+
形态时该往返永不闭合,WSL 工作区里「在应用中打开 / 在文件管理器中显示」对
|
|
88
|
+
任何 distro 文件都以 `Path has no verified Host path` 拒绝(issue #37);
|
|
89
|
+
`ui-deliverables` 的交付物打开路由(`present-open.ts`)用同一等式,一并失败。
|
|
90
|
+
workspace-files 的 change feed 与 `stat.absolutePath` 因此同为 UNC 形态,两者
|
|
91
|
+
一致;Linux 形态保留在目标的 `displayPath`(模型看到的那一面)。共享根
|
|
92
|
+
(distro 根)的尾分隔符会归一化:substrate 渲染 `\\wsl.localhost\<distro>\`,
|
|
93
|
+
而宿主 `resolve` 去掉尾部分隔符,`processPath` 以宿主形态为准。
|
|
94
|
+
**代价**:客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径,WSL 工作区里 Markdown
|
|
95
|
+
预览的相对图片因此不渲染;聊天侧此前就已如此(其 `cwd` 本就是 UNC)。
|
|
89
96
|
- **watch 的事件粒度**:无限深目录且有 `inotifywait` 时,distro 侧优先使用
|
|
90
97
|
inotify;文件目标、限深目录或缺少工具时回退轮询。回调是粗粒度失效而非
|
|
91
98
|
逐文件事件;轮询的 mtime 盲点见 [LIMITATIONS.md](LIMITATIONS.md)。
|
|
@@ -165,9 +172,9 @@ export `./fs-routing`)。config 承载两侧旋钮:宿主侧 `cwd`/`diffBasi
|
|
|
165
172
|
(`wsl.exe --terminate <distro>`),根级对 UNC 目标的调用应 fail-closed 报
|
|
166
173
|
`FS_IO_ERROR`(§2.3),而不是回落到 9P;同一次验证里宿主盘符路径照常工作。
|
|
167
174
|
|
|
168
|
-
`changes` 与 `stat` 的 `absolutePath`
|
|
169
|
-
Linux
|
|
170
|
-
`
|
|
175
|
+
`changes` 与 `stat` 的 `absolutePath` 都来自 `ctx.fs.processPath`,现在同为
|
|
176
|
+
UNC 宿主形态;两者一致,客户端归一化后可比对。Linux 形态只保留在目标的
|
|
177
|
+
`displayPath`(模型读到的那一面)。
|
|
171
178
|
|
|
172
179
|
回退:`fs-routing` 是顶层行,可以在你自己的 profile 层
|
|
173
180
|
(`$DSH_HOME/profiles/<name>/cordis.patch.yml`,按 id 覆盖插件行)里恢复随发的
|
package/lib/agent-confined.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function runSpawnChecklist({ wslPath, distro, root, runFn }: {
|
|
|
38
38
|
runFn?: (argv: string[]) => Promise<unknown>;
|
|
39
39
|
}): Promise<void>;
|
|
40
40
|
/** One confinement request. */
|
|
41
|
-
|
|
41
|
+
interface ConfinedAgentRequest {
|
|
42
42
|
/** The distro to run in. */
|
|
43
43
|
distro: string;
|
|
44
44
|
/** The `wsl.exe` path. */
|
|
@@ -77,4 +77,4 @@ export interface ConfinedAgentRequest {
|
|
|
77
77
|
export declare function confinedAgent({ distro, wslPath, policy, maskWindowsDrive, realTmp }: ConfinedAgentRequest): WslAgent;
|
|
78
78
|
/** Test hook: forget every confined resident (the plain agent has no factory state). */
|
|
79
79
|
export declare function resetConfinedAgents(): void;
|
|
80
|
-
export
|
|
80
|
+
export {};
|
package/lib/agent-confined.js
CHANGED
package/lib/agent-exec.d.ts
CHANGED
|
@@ -67,18 +67,8 @@ export interface AgentExecRunner {
|
|
|
67
67
|
/** Run one command. */
|
|
68
68
|
exec: (request: AgentExecRequest) => Promise<AgentExecResult>;
|
|
69
69
|
}
|
|
70
|
-
/** How the exec promise settled: the result, or the failure to propagate. */
|
|
71
|
-
export type SettledExec = {
|
|
72
|
-
ok: true;
|
|
73
|
-
result: AgentExecResult;
|
|
74
|
-
error?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
ok: false;
|
|
77
|
-
result?: undefined;
|
|
78
|
-
error: unknown;
|
|
79
|
-
};
|
|
80
70
|
/** The memory-reader slice of one output stream. */
|
|
81
|
-
|
|
71
|
+
interface OutputReader {
|
|
82
72
|
/** Read the stream from a byte offset. */
|
|
83
73
|
readFrom: (fromByte: number) => {
|
|
84
74
|
text: string;
|
|
@@ -168,3 +158,4 @@ export declare function agentExecutionHandle({ agent, cwd, argv, timeoutMs, maxO
|
|
|
168
158
|
*/
|
|
169
159
|
onStarted?: (proc: object) => void;
|
|
170
160
|
}): AgentExecutionHandle;
|
|
161
|
+
export {};
|
package/lib/agent-protocol.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare function encodeB64(value: string | Uint8Array): string;
|
|
|
53
53
|
*/
|
|
54
54
|
export declare function decodeB64(value: string): Buffer;
|
|
55
55
|
/** One EXEC frame's inputs. */
|
|
56
|
-
|
|
56
|
+
interface ExecFrameRequest {
|
|
57
57
|
/** Caller-chosen request id (unique per agent). */
|
|
58
58
|
id: string;
|
|
59
59
|
/** Linux path to cd into before exec. */
|
|
@@ -112,7 +112,7 @@ export declare function encodeSetEnv(key: string, value: string): string;
|
|
|
112
112
|
*/
|
|
113
113
|
export declare function encodeKill(id: string): string;
|
|
114
114
|
/** One FS frame's inputs. */
|
|
115
|
-
|
|
115
|
+
interface FsFrameRequest {
|
|
116
116
|
/** Caller-chosen request id (unique per agent). */
|
|
117
117
|
id: string;
|
|
118
118
|
/** One of the op names `encodeFsFrame` documents. */
|
|
@@ -147,7 +147,7 @@ export interface FsFrameRequest {
|
|
|
147
147
|
*/
|
|
148
148
|
export declare function encodeFsFrame({ id, op, args, timeoutMs }: FsFrameRequest): string[];
|
|
149
149
|
/** One op inside a batch frame — the same shape as an FS frame's op and args. */
|
|
150
|
-
|
|
150
|
+
interface FsBatchOp {
|
|
151
151
|
/** The op name (`stat`, `lstat`, `list`, `read`, … — the FS vocabulary). */
|
|
152
152
|
op: string;
|
|
153
153
|
/** Op arguments, one wire line each. */
|
|
@@ -195,7 +195,7 @@ export interface HelloMessage {
|
|
|
195
195
|
caps?: string[];
|
|
196
196
|
}
|
|
197
197
|
/** `PONG` — the liveness answer to `PING`. */
|
|
198
|
-
|
|
198
|
+
interface PongMessage {
|
|
199
199
|
type: "pong";
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
@@ -246,7 +246,7 @@ export interface FsErrorMessage {
|
|
|
246
246
|
* logged and dropped, because a `RES` for a request the host already gave up
|
|
247
247
|
* on is expected noise.)
|
|
248
248
|
*/
|
|
249
|
-
|
|
249
|
+
interface UnknownMessage {
|
|
250
250
|
type: "unknown";
|
|
251
251
|
line: string;
|
|
252
252
|
}
|
|
@@ -259,3 +259,4 @@ export type AgentMessage = HelloMessage | PongMessage | AckMessage | ResultMessa
|
|
|
259
259
|
* @returns the line's verdict; the message interfaces document each variant.
|
|
260
260
|
*/
|
|
261
261
|
export declare function parseAgentLine(line: string): AgentMessage;
|
|
262
|
+
export {};
|
package/lib/agent.d.ts
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
*/
|
|
42
42
|
import type { ChildProcess } from "node:child_process";
|
|
43
43
|
/** One settled command result, as `exec` resolves it. */
|
|
44
|
-
|
|
44
|
+
interface ExecResult {
|
|
45
45
|
/** The command's exit status. */
|
|
46
46
|
exitCode: number;
|
|
47
47
|
/** Captured stdout. */
|
|
@@ -64,7 +64,7 @@ export interface ExecResult {
|
|
|
64
64
|
* One request in flight on an agent: its frame, its settlement callbacks, and
|
|
65
65
|
* the ACK-armed watchdog.
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
interface PendingRequest {
|
|
68
68
|
/** The request id, as the agent echoes it. */
|
|
69
69
|
id: string;
|
|
70
70
|
/** The request's numeric sequence; newer requests have a larger one. */
|
|
@@ -105,7 +105,7 @@ export interface PendingRequest {
|
|
|
105
105
|
signalTimer: NodeJS.Timeout | null;
|
|
106
106
|
}
|
|
107
107
|
/** Per-kind request metrics. */
|
|
108
|
-
|
|
108
|
+
interface RequestMetrics {
|
|
109
109
|
/** Requests that settled (successful, failed or cancelled). */
|
|
110
110
|
requests: number;
|
|
111
111
|
/** Total queue wait (submission -> ACK), ms. */
|
|
@@ -139,7 +139,7 @@ export interface AgentStatus {
|
|
|
139
139
|
pending: number;
|
|
140
140
|
}
|
|
141
141
|
/** The agent's cumulative request metrics. */
|
|
142
|
-
|
|
142
|
+
interface AgentMetrics {
|
|
143
143
|
/** FS frames. */
|
|
144
144
|
fs: RequestMetrics;
|
|
145
145
|
/** EXEC frames (commands, ping). */
|
|
@@ -148,7 +148,7 @@ export interface AgentMetrics {
|
|
|
148
148
|
inFlightMax: number;
|
|
149
149
|
}
|
|
150
150
|
/** The entry an async preparation may select before the first spawn. */
|
|
151
|
-
|
|
151
|
+
interface WslAgentPrepared {
|
|
152
152
|
/** The agent entrypoint (the shell script or the native cache path). */
|
|
153
153
|
scriptPath: string;
|
|
154
154
|
/** The HELLO digest to verify. */
|
package/lib/auto-preset.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
53
53
|
retryMs: z<number, number, "defined">;
|
|
54
54
|
}>>, "plain">;
|
|
55
55
|
/** The config schema's validated output. */
|
|
56
|
-
|
|
56
|
+
interface AutoPresetConfig {
|
|
57
57
|
/** Preset to bind for a WSL workspace. */
|
|
58
58
|
preset?: string;
|
|
59
59
|
/** Attempts before giving up; each waits `retryMs`. */
|
|
@@ -65,7 +65,7 @@ export interface AutoPresetConfig {
|
|
|
65
65
|
* The slice of a created agent this plugin inspects; the harness's agent
|
|
66
66
|
* object is structural here.
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
interface CreatedAgentView {
|
|
69
69
|
/** The agent's id. */
|
|
70
70
|
id: string;
|
|
71
71
|
/** The session stub, when mounted. */
|
|
@@ -83,7 +83,7 @@ export interface CreatedAgentView {
|
|
|
83
83
|
* packages, whose declarations are not visible to this plugin, so they are
|
|
84
84
|
* spelled structurally on top of the framework's {@link Context}.
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
type AutoPresetContext = Context & {
|
|
87
87
|
agents: {
|
|
88
88
|
list: () => CreatedAgentView[];
|
|
89
89
|
};
|
|
@@ -108,3 +108,4 @@ export type AutoPresetContext = Context & {
|
|
|
108
108
|
* @param config - the schema-validated plugin config.
|
|
109
109
|
*/
|
|
110
110
|
export declare function apply(ctx: AutoPresetContext, config?: AutoPresetConfig): Promise<void>;
|
|
111
|
+
export {};
|
package/lib/bwrap.d.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @module dsh-plugin-wsl-env/bwrap
|
|
25
25
|
*/
|
|
26
26
|
/** Profile options shared by the two confinement sites. */
|
|
27
|
-
|
|
27
|
+
interface BwrapProfileOptions {
|
|
28
28
|
/** Shadow `/mnt` with an empty tmpfs. */
|
|
29
29
|
maskWindowsDrive?: boolean;
|
|
30
30
|
/**
|
|
@@ -96,3 +96,4 @@ export declare function bwrapArgvPrefix(policy: {
|
|
|
96
96
|
mode: string;
|
|
97
97
|
workspaceRoot: string;
|
|
98
98
|
}, options?: BwrapProfileOptions): string[];
|
|
99
|
+
export {};
|
package/lib/client-host.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Compositions that still mount the bare name get the client half (the doctor
|
|
18
18
|
* composer button) and nothing else; the executor keeps its behavior through
|
|
19
|
-
* the explicit subpath. Before 0.
|
|
19
|
+
* the explicit subpath. Before 0.21.0 `.` resolved to the executor itself —
|
|
20
20
|
* a profile that relied on that shape must switch to `dsh-plugin-wsl-env/shell`.
|
|
21
21
|
*
|
|
22
22
|
* This is a TypeScript source built to `lib/client-host.js`; edit THIS file and
|
package/lib/client-host.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Compositions that still mount the bare name get the client half (the doctor
|
|
18
18
|
* composer button) and nothing else; the executor keeps its behavior through
|
|
19
|
-
* the explicit subpath. Before 0.
|
|
19
|
+
* the explicit subpath. Before 0.21.0 `.` resolved to the executor itself —
|
|
20
20
|
* a profile that relied on that shape must switch to `dsh-plugin-wsl-env/shell`.
|
|
21
21
|
*
|
|
22
22
|
* This is a TypeScript source built to `lib/client-host.js`; edit THIS file and
|
package/lib/cwd-prompt-tool.d.ts
CHANGED
|
@@ -39,37 +39,20 @@ export declare const name = "wsl-cwd-prompt-tool";
|
|
|
39
39
|
* the design (a missing service is a composition error, not a degradation).
|
|
40
40
|
*/
|
|
41
41
|
export declare const inject: string[];
|
|
42
|
-
/** The config schema's validated output: the row takes no options. */
|
|
43
|
-
export interface CwdPromptToolConfig {
|
|
44
|
-
/** Reserved; the wrapper has no options today. */
|
|
45
|
-
enabled?: boolean;
|
|
46
|
-
}
|
|
47
42
|
/** The tool registry slice this service consumes. */
|
|
48
|
-
|
|
43
|
+
interface ToolRegistrySlice {
|
|
49
44
|
register: (tool: unknown) => unknown;
|
|
50
45
|
}
|
|
51
46
|
/** The harness's `workingDirectory` service slice the shipped tool uses. */
|
|
52
|
-
|
|
47
|
+
interface WorkingDirectoryToolSlice {
|
|
53
48
|
ensure: (agent: unknown, signal?: unknown) => Promise<string>;
|
|
54
49
|
set: (agent: unknown, path: string, signal?: unknown) => Promise<string>;
|
|
55
50
|
}
|
|
56
51
|
/** The cordis context slice this service consumes. */
|
|
57
|
-
|
|
52
|
+
type CwdPromptToolContext = {
|
|
58
53
|
tools: ToolRegistrySlice;
|
|
59
54
|
workingDirectory: WorkingDirectoryToolSlice;
|
|
60
55
|
};
|
|
61
|
-
/** A resolved tool call: what the shipped tool's `execute` receives. */
|
|
62
|
-
export interface ToolExec {
|
|
63
|
-
/** The live agent, required by the shipped tool too. */
|
|
64
|
-
agent: unknown;
|
|
65
|
-
/** Cancellation for the underlying directory operations. */
|
|
66
|
-
signal?: unknown;
|
|
67
|
-
}
|
|
68
|
-
/** The tool's result: one rewritten absolute path. */
|
|
69
|
-
export interface WorkingDirectoryResult {
|
|
70
|
-
/** The current absolute working directory, distro-native on WSL sessions. */
|
|
71
|
-
cwd: string;
|
|
72
|
-
}
|
|
73
56
|
/**
|
|
74
57
|
* A raw absolute path as the model should see it: the POSIX path a WSL UNC
|
|
75
58
|
* names, and every other path unchanged. This is the single-path sibling of
|
|
@@ -86,3 +69,4 @@ export declare function rewriteUncPath(path: string): string;
|
|
|
86
69
|
* tool row is disabled by the patch layer).
|
|
87
70
|
*/
|
|
88
71
|
export declare function apply(ctx: CwdPromptToolContext): Promise<void>;
|
|
72
|
+
export {};
|
package/lib/cwd-prompt.d.ts
CHANGED
|
@@ -51,12 +51,12 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
51
51
|
enabled: z<boolean, boolean, "defined">;
|
|
52
52
|
}>>, "plain">;
|
|
53
53
|
/** The config schema's validated output. */
|
|
54
|
-
|
|
54
|
+
interface CwdPromptConfig {
|
|
55
55
|
/** Whether the runtime-context rewrite runs at all. */
|
|
56
56
|
enabled?: boolean;
|
|
57
57
|
}
|
|
58
58
|
/** One named contribution to the assembled system prompt. */
|
|
59
|
-
|
|
59
|
+
interface PromptContextEntry {
|
|
60
60
|
/** The registry name; the harness's entry is `working-directory:current`. */
|
|
61
61
|
name?: string;
|
|
62
62
|
/** The literal contribution text, already resolved by its provider. */
|
|
@@ -65,16 +65,16 @@ export interface PromptContextEntry {
|
|
|
65
65
|
interpolate?: boolean;
|
|
66
66
|
}
|
|
67
67
|
/** The slice of the assembly the waterfall hands around. */
|
|
68
|
-
|
|
68
|
+
interface PromptAssembly {
|
|
69
69
|
/** The named contributions, ordered by registry order. */
|
|
70
70
|
contexts?: PromptContextEntry[];
|
|
71
71
|
}
|
|
72
72
|
/** The waterfall's continuation; resolves to the (possibly rewritten) assembly. */
|
|
73
|
-
|
|
73
|
+
type AssembleNext = () => Promise<PromptAssembly>;
|
|
74
74
|
/** The waterfall listener's signature, as the harness's own services use it. */
|
|
75
|
-
|
|
75
|
+
type AssembleListener = (assembly: PromptAssembly, context: unknown, next: AssembleNext) => Promise<PromptAssembly>;
|
|
76
76
|
/** The `systemPrompt` slice an injected agent scope exposes. */
|
|
77
|
-
|
|
77
|
+
interface CwdPromptScope {
|
|
78
78
|
systemPrompt: {
|
|
79
79
|
/** Register one context entry in this scope's layer. */
|
|
80
80
|
context: (entry: {
|
|
@@ -89,7 +89,7 @@ export interface CwdPromptScope {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
/** The assembly request context: what a provider's `text` receives. */
|
|
92
|
-
|
|
92
|
+
interface AssembleRequestContext {
|
|
93
93
|
/** The live agent, when the assembly runs inside one. */
|
|
94
94
|
agent?: {
|
|
95
95
|
session?: {
|
|
@@ -100,7 +100,7 @@ export interface AssembleRequestContext {
|
|
|
100
100
|
} | undefined;
|
|
101
101
|
}
|
|
102
102
|
/** The slice of a created agent this service inspects and injects into. */
|
|
103
|
-
|
|
103
|
+
interface CwdPromptAgent {
|
|
104
104
|
/** The session stub, when mounted. */
|
|
105
105
|
session?: {
|
|
106
106
|
header?: {
|
|
@@ -117,11 +117,11 @@ export interface CwdPromptAgent {
|
|
|
117
117
|
* The harness's `working-directory` service, read structurally: only `get`
|
|
118
118
|
* is consumed, and its absence degrades to the session header's cwd.
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
interface WorkingDirectorySlice {
|
|
121
121
|
get?: (session: unknown) => string | undefined;
|
|
122
122
|
}
|
|
123
123
|
/** The cordis context slice this service consumes. */
|
|
124
|
-
|
|
124
|
+
type CwdPromptContext = {
|
|
125
125
|
logger?: {
|
|
126
126
|
debug?: (message: string) => void;
|
|
127
127
|
};
|
|
@@ -164,3 +164,4 @@ export declare function entryText(agent: AssembleRequestContext["agent"], workin
|
|
|
164
164
|
* @param config - the schema-validated plugin config.
|
|
165
165
|
*/
|
|
166
166
|
export declare function apply(ctx: CwdPromptContext, config?: CwdPromptConfig): void;
|
|
167
|
+
export {};
|
package/lib/distro-route.d.ts
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
* @module dsh-plugin-wsl-env/distro-route
|
|
18
18
|
*/
|
|
19
19
|
/** Why a distro was selected, for diagnostics and for the docs. */
|
|
20
|
-
|
|
20
|
+
type DistroSource = "pinned" | "workspace" | "default";
|
|
21
21
|
/** One distro selection. */
|
|
22
|
-
|
|
22
|
+
interface DistroChoice {
|
|
23
23
|
/** The distro name to use. */
|
|
24
24
|
distro: string;
|
|
25
25
|
/** Whether the name came from the config, the path, or WSL's default. */
|
|
@@ -73,3 +73,4 @@ export declare function selectDistro({ configured, candidates, fallback }: {
|
|
|
73
73
|
/** WSL's default distro, already resolved by the caller. */
|
|
74
74
|
fallback: string;
|
|
75
75
|
}): DistroChoice;
|
|
76
|
+
export {};
|
package/lib/doctor-live.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { AgentStatus } from "./agent.js";
|
|
17
17
|
/** One check line of the doctor's versioned JSON report. */
|
|
18
|
-
|
|
18
|
+
interface DoctorCheck {
|
|
19
19
|
/** The stable check id, e.g. `agent.handshake`. */
|
|
20
20
|
id: string;
|
|
21
21
|
/** `ok` | `warn` | `fail` | `info` | `skipped`. */
|
|
@@ -55,3 +55,4 @@ export interface DoctorReport {
|
|
|
55
55
|
* there is nothing to merge.
|
|
56
56
|
*/
|
|
57
57
|
export declare function mergeLiveResidentStatus(report: DoctorReport, status: AgentStatus | undefined): DoctorReport;
|
|
58
|
+
export {};
|
package/lib/fs-routing.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ type MoveFileOptions = Parameters<FileSystem["moveFile"]>[2];
|
|
|
47
47
|
* routed backend reads. The distro keys are `??`-defaulted, so a host-only
|
|
48
48
|
* config stays valid.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
interface RoutingConfig {
|
|
51
51
|
/** The host backend's base directory. */
|
|
52
52
|
cwd?: string;
|
|
53
53
|
/** The host backend's overwrite-diff byte bound. */
|
|
@@ -265,7 +265,35 @@ export declare class WslRoutingFileSystem extends LocalFileSystem {
|
|
|
265
265
|
*/
|
|
266
266
|
contains(parent: FsTarget, child: FsTarget): boolean;
|
|
267
267
|
/**
|
|
268
|
+
* The host spelling for a distro target: its canonical UNC identity.
|
|
269
|
+
*
|
|
270
|
+
* `processPath` answers "the path in this filesystem's execution world", and
|
|
271
|
+
* the routed backend's target key already IS the coordinate the Host I/O
|
|
272
|
+
* stack uses — the same answer the session backend gives, because it inherits
|
|
273
|
+
* the host implementation (`String(targetKey)`). The root router answered in
|
|
274
|
+
* Linux form before this change; that broke every consumer that treats
|
|
275
|
+
* `processPath` as a HOST path. `session.openWorkspacePath` and
|
|
276
|
+
* `session.workspacePathApplications` verify a path by requiring
|
|
277
|
+
* `fs.processPath(await fs.resolve(fs.processPathFromHostPath(hostPath)))`
|
|
278
|
+
* to equal `hostPath` (`packages/api/session-controller`,
|
|
279
|
+
* `verifyDesktopPath`), and `processPathFromHostPath` is the inherited host
|
|
280
|
+
* implementation — so with a Linux answer the round trip could never close
|
|
281
|
+
* and "Open in app" / "Reveal in file manager" refused every distro file
|
|
282
|
+
* with `Path has no verified Host path`. The same equality drives
|
|
283
|
+
* `ui-deliverables`' presented-file route.
|
|
284
|
+
*
|
|
285
|
+
* The Linux path is still the target's `displayPath` (what the model sees),
|
|
286
|
+
* and `contains` still compares POSIX coordinates; only this accessor — the
|
|
287
|
+
* one the Host's path-taking consumers read — speaks host spelling.
|
|
288
|
+
*
|
|
289
|
+
* The share root is the one spelling the substrate and the Host disagree on:
|
|
290
|
+
* `posixToUnc(distro, "/")` renders `\\wsl.localhost\<distro>\` (a trailing
|
|
291
|
+
* separator), while the Host's `path.resolve` normalizes the same directory
|
|
292
|
+
* to `\\wsl.localhost\<distro>`. Stripping it keeps the round trip closed for
|
|
293
|
+
* a distro root chosen as the workspace.
|
|
294
|
+
*
|
|
268
295
|
* @param target - the resolved target.
|
|
296
|
+
* @returns the canonical UNC for a distro target, the host path otherwise.
|
|
269
297
|
*/
|
|
270
298
|
processPath(target: FsTarget): string;
|
|
271
299
|
}
|