dsh-plugin-wsl-env 0.23.1 → 0.25.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 +212 -0
- package/README.md +9 -5
- package/SECURITY.md +10 -0
- package/client.js +974 -165
- package/cordis.patch.yml +28 -3
- package/docs/API.md +2 -1
- package/docs/ARCHITECTURE.md +36 -13
- package/docs/COMPATIBILITY.md +5 -0
- package/docs/CONFIGURATION.md +80 -9
- package/docs/CONFIGURATION.zh.md +64 -8
- package/docs/DIAGNOSTICS.md +48 -20
- package/docs/DIAGNOSTICS.zh.md +36 -14
- package/docs/LIMITATIONS.md +36 -9
- package/docs/LIMITATIONS.zh.md +26 -7
- package/docs/MIGRATION.md +1 -1
- package/docs/PEER-PARITY.md +4 -4
- package/docs/QUICKSTART.md +42 -12
- package/docs/QUICKSTART.zh.md +29 -8
- package/docs/README.zh.md +9 -5
- package/docs/RELEASING.md +17 -13
- package/docs/REQUIREMENTS.zh.md +5 -4
- package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
- package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
- package/docs/root-fs-routing.md +1 -1
- package/lib/agent-confined.d.ts +7 -1
- package/lib/agent-confined.js +3 -3
- package/lib/auto-preset.d.ts +27 -0
- package/lib/auto-preset.js +40 -3
- package/lib/bwrap.d.ts +14 -0
- package/lib/bwrap.js +11 -0
- package/lib/client-host.d.ts +2 -2
- package/lib/client-host.js +2 -2
- package/lib/cwd-prompt.d.ts +41 -3
- package/lib/cwd-prompt.js +125 -8
- package/lib/doctor-report.d.ts +50 -0
- package/lib/doctor-report.js +172 -0
- package/lib/fs-routing.d.ts +1 -1
- package/lib/fs-routing.js +1 -1
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +1 -1
- package/lib/index.d.ts +6 -1464
- package/lib/index.js +5 -2120
- package/lib/listing.d.ts +21 -9
- package/lib/listing.js +25 -21
- package/lib/messages.d.ts +1 -1
- package/lib/messages.js +3 -3
- package/lib/picker.d.ts +50 -16
- package/lib/picker.js +103 -23
- package/lib/preflight.d.ts +7 -4
- package/lib/preflight.js +27 -13
- package/lib/preset-choice.d.ts +22 -3
- package/lib/preset-choice.js +36 -3
- package/lib/provider-common.d.ts +58 -0
- package/lib/provider-common.js +123 -0
- package/lib/sandbox-core.d.ts +1 -0
- package/lib/sandbox-core.js +4 -2
- package/lib/session-runtime.d.ts +7 -1
- package/lib/session-runtime.js +9 -2
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/status.d.ts +261 -0
- package/lib/status.js +425 -0
- package/lib/writable-roots.d.ts +109 -0
- package/lib/writable-roots.js +257 -0
- package/lib/wsl-doctor-tool.d.ts +8 -0
- package/lib/wsl-doctor-tool.js +18 -20
- package/lib/wsl-filesystem.d.ts +692 -0
- package/lib/wsl-filesystem.js +897 -0
- package/lib/wsl-shell.d.ts +742 -0
- package/lib/wsl-shell.js +965 -0
- package/lib/wsl.d.ts +13 -1
- package/lib/wsl.js +16 -1
- package/locale/doctor/en.json +3 -2
- package/locale/doctor/zh.json +3 -2
- package/package.json +12 -4
- package/scripts/doctor.mjs +436 -226
- package/scripts/profile-preset.mjs +17 -5
package/docs/RELEASING.md
CHANGED
|
@@ -43,14 +43,14 @@ build step at pack time.
|
|
|
43
43
|
The coverage thresholds are 85 lines / 84 branches / 70 functions. The
|
|
44
44
|
branch threshold is one point under the others deliberately: the
|
|
45
45
|
integration layer is now measured, and part of what it leaves uncovered
|
|
46
|
-
needs a live `wsl.exe` — the distro-bound paths in `lib/
|
|
47
|
-
resolved home, the distro home, arming the watcher), the `wsl.exe` calls
|
|
46
|
+
needs a live `wsl.exe` — the distro-bound paths in `lib/wsl-filesystem.js` and
|
|
47
|
+
`lib/wsl-shell.js` (the resolved home, the distro home, arming the watcher), the `wsl.exe` calls
|
|
48
48
|
in `lib/wsl.js` (`defaultDistro`'s no-distro throw, `linuxHomePath`,
|
|
49
49
|
and the other distro calls), and the real spawn internals
|
|
50
50
|
in `lib/watcher.js`. The real-machine probes cover that tail, not CI.
|
|
51
51
|
The rest of the uncovered branches — the host-path arm of
|
|
52
|
-
`wslWritableRoots`, the sandbox-error and rethrow
|
|
53
|
-
unrestricted-path result
|
|
52
|
+
`wslWritableRoots` in `lib/provider-common.js`, the sandbox-error and rethrow
|
|
53
|
+
arms, and the unrestricted-path result in `lib/wsl-filesystem.js` — are ordinary
|
|
54
54
|
CI-coverable code. Do not raise the branch number without either covering
|
|
55
55
|
the `wsl.exe` tail on the Windows CI legs or moving the coverage job
|
|
56
56
|
(currently `runs-on: ubuntu-latest` in `.github/workflows/ci.yml`) to
|
|
@@ -213,25 +213,29 @@ the mirror does not, or one that differs.
|
|
|
213
213
|
That destination is outside a session workspace, so a confined agent session is
|
|
214
214
|
refused there and has to approve a wider permission for the one command.
|
|
215
215
|
|
|
216
|
-
## 8.5. Announce on the upstream
|
|
216
|
+
## 8.5. Announce on the upstream discussions
|
|
217
217
|
|
|
218
|
-
Every release appends an update comment to
|
|
219
|
-
[deepseek-ai/deepseek-harness
|
|
220
|
-
(
|
|
218
|
+
Every release appends an update comment to both plugin threads in
|
|
219
|
+
[deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness):
|
|
220
|
+
[discussion #8644](https://github.com/deepseek-ai/deepseek-harness/discussions/8644)
|
|
221
|
+
(node id `D_kwDOT3T1g84AptnQ`) and
|
|
222
|
+
[discussion #11251](https://github.com/deepseek-ai/deepseek-harness/discussions/11251)
|
|
223
|
+
(node id `D_kwDOT3T1g84AqhvH`), so followers of either thread see each version
|
|
221
224
|
without watching this repository:
|
|
222
225
|
|
|
223
|
-
- One comment per release, in Chinese (the
|
|
224
|
-
updates; the English original stays as the top post, refreshed
|
|
225
|
-
releases).
|
|
226
|
+
- One comment per release in **each** thread, in Chinese (the established
|
|
227
|
+
language for updates; the English original stays as the top post, refreshed
|
|
228
|
+
on notable releases).
|
|
226
229
|
- Content: the version, the two or three headline changes, the current
|
|
227
230
|
verification snapshot in one line (unit tests, matrix, container and qemu
|
|
228
231
|
legs, nightly probes), and the release link.
|
|
229
232
|
- Post it with the same GraphQL mutation the 2026-10-27 update used
|
|
230
233
|
(`addDiscussionComment` on the discussion's node id) from a session that
|
|
231
234
|
holds the maintainer's GitHub credentials — the release workflow's
|
|
232
|
-
`GITHUB_TOKEN` is scoped to this repository and cannot write there.
|
|
235
|
+
`GITHUB_TOKEN` is scoped to this repository and cannot write there. Post the
|
|
236
|
+
same body to both, then read each back and compare it to the local source.
|
|
233
237
|
|
|
234
|
-
This is a hard checklist item, not a nicety: the
|
|
238
|
+
This is a hard checklist item, not a nicety: the threads are where the DSH
|
|
235
239
|
community found the plugin, and a stale thread reads as an abandoned one.
|
|
236
240
|
|
|
237
241
|
## 9. If a version turns out to be bad
|
package/docs/REQUIREMENTS.zh.md
CHANGED
|
@@ -38,14 +38,14 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
|
|
|
38
38
|
| R2 | 文件工具读写真实发行版文件:单一 agent 基座(ext4),share 基座不复存在 | ARCHITECTURE「The filesystem substrate」;LIMITATIONS 首节 | ①②③⑤:读/写/身份在 ext4、原生符号链接与 mode 位;`createIfAbsent` no-replace 关闭 TOCTOU、版本随写 op 下发并在 rename 前复核(`FS_STALE_VERSION`);新文件 0600、agent 失联 fail-closed 均为明文;0600 与反斜杠文件名为已声明极限 | `fs-substrate.test.mjs`、`fsio-agent.test.mjs`、`agent-fs-script.test.mjs`、`provider.test.mjs`(守卫链)、`fs.boot.test.mjs`;probe:substrate 8/8 | rename 后无目录 fsync(OI-5,已入 LIMITATIONS) |
|
|
39
39
|
| R3 | 会话级环境绑定:distro 目录自动绑 `wsl` preset,Windows 目录保持原生 | ARCHITECTURE「How the pieces are mounted」;README「Architecture」 | ①②④:触发条件与 isolate realms 机制成文;registry/agent-loop 两棵树不相交的设计约束可复核 | `preset-choice.test.mjs` | 猴补上游 `ensureSession` 的接缝风险已转 promotion-map 跟踪(非本仓可独立修) |
|
|
40
40
|
| R4 | GUI 终端按会话路由:WSL 目录会话得发行版 shell,Windows 目录会话得 PowerShell(`hostSessions`) | ARCHITECTURE「Why the terminal provider is app-level」;LIMITATIONS 终端诸条 | ①②③⑤:路由判定、无目录启动落发行版、idle/busy/unknown 三态回收(`unknown` 必须暂停回收)逐项规定;tab 标题极限给出根因、上游提案与用户缓解 | `terminal.test.mjs`(terminalRoute 判定)、`terminal-activity.test.mjs`;probe:terminal | tab 标题读 `WSL`(UPSTREAM-TERMINAL-TITLE);host 终端 unknown 不回收——均为已声明边界 |
|
|
41
|
-
| R5 |
|
|
41
|
+
| R5 | 目录选择器分层为 Windows 路径与 WSL 发行版两支,并列出已装发行版及其层级 | README「Install」;CONFIGURATION `directory-picker-wsl` 行 | ①②③⑤:根级列表、`includeHostHome`/`maxEntries`/`preferredDistro`、常驻 out 时 one-shot 回退;换行符文件名极限的边界论证闭合(`/` 不可能出现在名字里) | `listing.test.mjs`(`maxEntries` 封顶、行解析);probe:picker | `preferredDistro` 决定的根级 `path`/`home` 领位、`includeHostHome` 的排序姿态:单测与探针都没有断言(探针只查成员构成与截断旗标) |
|
|
42
42
|
| R6 | 端口可见性:`DSH_WSL_PORTS` 按节奏经常驻 agent 刷新 | README「Using it」;CONFIGURATION「`wsl-shell-env`」表 | ①⑤:机制(`/proc/net/tcp{,6}` 扫描)、`portsRefreshMs` 默认 10s、与 WSL2 localhost 转发的关系(平台行为)成文 | `ports.test.mjs`(解析层) | 轮询使常驻 agent 永不闲置回收(OI-4,已入 LIMITATIONS) |
|
|
43
43
|
| R7 | 模型可见的发行版事实与 WSLENV 政策:受管 `DSH_*` 前缀准入,`PATH` 刻意不转发 | README「Using it」「Recipes」 | ①②③:两个 Windows 路径变量带 `/p` 翻译、`PATH` 不转发的理由成文;传输环境钉死 essentials+`DSH_*`+过滤后 WSLENV;shell 解析失败则省略事实而非报假值(宁可缺报不误报) | `terminal.test.mjs`(`/p` 翻译)、`agent.test.mjs`(传输环境 WSLENV 钉死为受管项)、`provider.test.mjs`(探针失败重试、不钉占位符)、`shell-env.test.mjs`(假 `wsl.exe` 下挂载/清扫/resolve 双路径与 doctorFact/windowsToPosix) | 已闭合(原残差:`lib/shell-env.js` 无单测、覆盖率报告不含该模块):`test:coverage` 实测该模块 行 97.7%/分支 83.6%/函数 92.9%,逐模块地板(85/70/60)达标,`coverage-allowlist` 豁免已撤;未覆盖项仅为需在驻 agent 的端口扫描成功臂(探针层) |
|
|
44
44
|
| R8 | 权限三档(read-only / workspace-write / danger-full-access)与提权提议流 | README「Sandbox」表;ARCHITECTURE「Error codes」 | ①②:三档行为逐档成表;模型可见两行前缀逐字给出;`FS_SANDBOX_DENIED` 可提权而 `FS_OUTSIDE_DISTRO` 不可,且区分理由明文(宽权限开不出另一个发行版) | `fs-decisions.test.mjs`、`provider.test.mjs`、`fsio-agent.test.mjs`(分类) | — |
|
|
45
45
|
| R9 | bubblewrap 沙箱:与 Linux runner 同参数、fail-closed、`enforcement: partial` 诚实上报 | ARCHITECTURE「Sandbox」全节;SECURITY「Sandbox enforcement is `partial` by design」 | ①②③⑤⑥:选型依据(ACL 令牌触不到 WSL)、探针失败不缓存、interop 洞 + `maskWindowsDrive` 收窄及其自身极限(binfmt 按内容分发)、完全关闭唯一路径(`wsl.conf`)、`sandbox: false` 退出——行为到边界到逃生门完整成链 | `sandbox.test.mjs`、`probe-cache.test.mjs`;probe:sandbox、probe:sandbox-off | interop 使 enforcement 恒为 partial——已声明的设计边界 |
|
|
46
46
|
| R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap 指引;grep 回退被拒绝且理由明文(不读 `.gitignore`,非 rg 替身) | `search-route.test.mjs`、`search-exec.test.mjs` | — |
|
|
47
47
|
| R11 | watch():inotify 优先(无界目录),轮询回退;粗粒度失效 | PARITY「Contract audit」第 1 条;LIMITATIONS watch 两条 | ①②③:契约向上追溯到宿主接缝(`changed()` 无载荷 → 粗粒度失效即可);inotify 递归且 0.5s 合并、文件/限深/无 inotify-tools 回退轮询;更旧 mtime 盲区只属轮询路径、`watchMaxDepth` 旋钮、目标消失响亮报错成文 | `watcher.test.mjs`;probe:watch(无 inotify 时 7/7;装 inotify-tools 后盲区检查改为期望事件) | 轮询回退的 mtime 盲区已声明;inotify 路径依赖发行版的 inotify-tools |
|
|
48
|
-
| R12 | share 基座退役:携带 `substrate: "share"` 的 profile 在 boot 被拒并附迁移 | README/CONFIGURATION/LIMITATIONS 三处一致 | ①②⑤:旧值处置与用户所见成文,迁移指引内嵌 | `fs-decisions.test.mjs`(拒绝消息与迁移指引文案) | boot 期拒绝分支无测试(构造器调 `shareSubstrateRefusal`,`src/
|
|
48
|
+
| R12 | share 基座退役:携带 `substrate: "share"` 的 profile 在 boot 被拒并附迁移 | README/CONFIGURATION/LIMITATIONS 三处一致 | ①②⑤:旧值处置与用户所见成文,迁移指引内嵌 | `fs-decisions.test.mjs`(拒绝消息与迁移指引文案) | boot 期拒绝分支无测试(构造器调 `shareSubstrateRefusal`,`src/wsl-filesystem.ts:225`):`fs.boot.test.mjs` 只以 `sandbox: true` 启动该行,仓内没有构造 `substrate: "share"` profile 的测试 |
|
|
49
49
|
| R13 | 会话级 systemd scope:命令共享后台进程/真实 `/tmp`/`ps`,scope 随会话结束停止;systemd + linger 缺失时预检带修复拒绝 | ADR 0001;README/CONFIGURATION/LIMITATIONS 的 `sessionSandbox` 条 | ①②③⑤:scope 生命周期(agent 为主进程、refcount、dispose stop)、`sessionSandbox: false` 退出与 `auto` 回退、systemd/linger/systemd-run 四项预检与缓存策略成文;`/tmp` 与后台进程的保真边界限定在 runtime 开时 | `session-scope.test.mjs`、`session-runtime.test.mjs`、`provider.test.mjs`;真机会话验证(active scope、跨命令后台/`/tmp`、会话结束 0 units) | 硬崩溃可能留下 stale scope(启动清扫未随发,入 LIMITATIONS);受限写入已共享 runtime,读仍走无约束共享 agent,根级 fs-routing 不持有 session runtime |
|
|
50
50
|
| R14 | bootstrap:bwrap/ripgrep 等的就地体检与安装 | README「Install」「Troubleshooting」;CONFIGURATION | ①②⑤:`--install` 与只读体检两式、体检对象、错误消息补救指引成文 | 0.7.4 起脚本随包(`files` 收录,补救指引在 npm 安装下可用) | 脚本本身无 CI 腿(真机排错路径覆盖) |
|
|
51
51
|
| R15 | 错误码方言:每个 `FS_*` 码给出抛出者、含义、解除条件;`wsl.exe` 自身失败显式收编 | ARCHITECTURE「Error codes」表 | ①②:逐码三列成表;两类历史隐形失败(UTF-16 stdout、cwd 回退 exit 0)收编;`FS_OUTSIDE_DISTRO` 独立成码的理由明文 | `fs-decisions.test.mjs`、`fsio-agent.test.mjs`、`fs-substrate.test.mjs`、`provider.test.mjs`(断言码与消息) | — |
|
|
@@ -53,7 +53,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
|
|
|
53
53
|
| R17 | 常驻 agent 协议:ACK 计时看门狗、只读帧才重放、逐流输出上限、sha256 部署校验、租约存活、进程组两段杀 | CHANGELOG 0.3.0/0.6.0/0.7.3;PARITY Phase 1/Phase 3 | ①②④:每条健壮性属性有规格出处与实证记录;「EXEC/变异 FS 帧禁止盲重发」是写明的不变量 | `agent-protocol.test.mjs`(HELLO 版本+摘要)、`agent.test.mjs`、`agent-exec.test.mjs`(truncated 旗标)、`agent-fs-script.test.mjs`;probe:agent、probe:exec | — |
|
|
54
54
|
| R18 | 配置面:每键默认值成文;层组合语义(整行替换、不深合并、后层胜) | CONFIGURATION;`cordis.patch.yml` 头注 | ⑤:随发键成表、未列表键点名;覆盖方式的正确心智模型(整行替换)成文 | `composition.test.mjs`(层组合);`style.mjs`(`files` 契约) | — |
|
|
55
55
|
| R19 | 非目标集:不做什么与为什么 | LIMITATIONS 开篇原则;PARITY「Not applicable」 | ③:已知极限入册;不适用项「记下来免得像遗漏」 | —(文档性) | — |
|
|
56
|
-
| R20 | 验证策略:三层(fake → 真脚本过真线 → 真机探针)+ CI 矩阵 + 覆盖率阈值 | ARCHITECTURE「Test layers」;README「Development」 | ④:CI 在 Node 22/24 × Linux/Windows 上跑 `pnpm test`,`pnpm run test:coverage` 只在 Node 24 上跑(门槛旗标需 Node 22.8);Node 20 有意排除(`engines` 下限);覆盖率阈值 85/84/70(行/分支/函数),测量集合覆盖 `test/` 下
|
|
56
|
+
| R20 | 验证策略:三层(fake → 真脚本过真线 → 真机探针)+ CI 矩阵 + 覆盖率阈值 | ARCHITECTURE「Test layers」;README「Development」 | ④:CI 在 Node 22/24 × Linux/Windows 上跑 `pnpm test`,`pnpm run test:coverage` 只在 Node 24 上跑(门槛旗标需 Node 22.8);Node 20 有意排除(`engines` 下限);覆盖率阈值 85/84/70(行/分支/函数),测量集合覆盖 `test/` 下 50 个测试文件,且 `lib/*.js` 必须逐个实测或带理由豁免 | `pnpm test`、`pnpm run test:coverage`;CI(ci.yml) | 真机验证依赖 Windows 和可用的 WSL 发行版;非功能无量化目标(OI-1) |
|
|
57
57
|
| R21 | 安全过程:范围内外、响应时限、partial 属设计边界、凭据政策 | SECURITY 全文 | ②③⑥:范围、3/10/30 个工作日时限(标注「目标非合同」)、partial 定性、凭据零容忍成文 | —(过程性) | — |
|
|
58
58
|
| R22 | 支持矩阵:Windows 10/11 + WSL2 + Node `^22.19.0 \|\| >=24.0.0` + peer 版本范围 | SUPPORT 全文 | ⑥:支持与不受支持清单、peer 范围及精确开发依赖成文;Node 20 在范围外(理由见 SUPPORT,`engines` 为准) | `peerDependencies`、`devDependencies` 与 `engines`(`package.json`);CI 矩阵(ci.yml) | 新 peer 版本仍需验证 |
|
|
59
59
|
| R23 | 根平面 `ctx.fs` 按坐标路由:发行版 UNC 由发行版内 agent 服务(inotify 或轮询 watch),盘符路径留在宿主;接替随发的 `fs-sandbox` 行 | README「Architecture」;ARCHITECTURE「The root-plane filesystem takeover」;CONFIGURATION `fs-routing` 行;root-fs-routing.md(设计) | ①②③⑤:路由判定与接替理由(写围栏在根平面无消费者)成文;`distro` 的 `auto`/`default`/pin 三态、每个 UNC 目标由自身 distro 服务、pin 下拒外来路径,以及 `distroCwd`/`restrictToDistro`/`sandbox`/`maskWindowsDrive`/`watchMaxDepth` 逐键成表,且自成一行、不与会话级行联动;`sandbox` 失败关闭成文 | `fs-routing.test.mjs`(纯谓词与路径助手)、`provider.test.mjs`(per-distro substrate/worldPath) | 类本体无单测(需 DSH peers 与实机);由组合测试与真机探针覆盖 |
|
|
@@ -61,7 +61,8 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
|
|
|
61
61
|
| R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实 dsh CLI + Windows) | 无自动化守护 |
|
|
62
62
|
| R26 | 诊断三入口同一份逐项报告:独立 CLI、`/wsl-doctor` UI 命令(宿主侧、不进模型历史)、`wsl_doctor` 模型工具(进程内合并常驻状态);报告按 distro 分组逐项带显式状态标记与失败修复;`--quick`/`--sections`(工具侧 `depth`/`section`)收窄范围且未运行项显式列为跳过 | DIAGNOSTICS「The surfaces」;README「Install」;CONFIGURATION「Diagnose configuration and refusals」 | ①②④:三入口的分工与边界成文;范围化报告携带 `scope`、`--fix` 要求完整运行成文;逐项化与跳过行的形态由 parity 测试钉住 | `wsl-doctor-tool.test.mjs`(digest/渲染/CHECK_CATALOG parity)、`wsl-doctor-command.test.mjs`(语法/handler/子进程面)、`doctor.test.mjs`(CLI 采集) | 真机多 distro 报告依赖实机;报告形态的宿主渲染(命令面 UI)无单测 |
|
|
63
63
|
| R27 | doctor CLI 独立性:不加载 peer 依赖与宿主服务,插件运行时本身损坏时仍可诊断;固定骨架本地化(Windows 区域设置检测,`--locale`/`DSH_WSL_DOCTOR_LOCALE` 覆盖),逐项事实保持英文,`--json` 语言无关 | DIAGNOSTICS「The surfaces」;CONFIGURATION「Message language」;LIMITATIONS「消息本地化」条 | ①②④:peer-free 内联与防漂移对拍成文;catalog 键 parity 与占位符行为有测试 | `doctor.test.mjs`(inlining parity、locale catalog、检测与覆盖) | 语言检测需 Windows registry(非 Windows 上回退英文,`run` 不抛错) |
|
|
64
|
-
| R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false` 可关闭 | README「Install」;CONFIGURATION `wsl-update-check` 行 | ①②⑤:委托路径、TTL、关闭开关成文 | `update-check.test.mjs` | doctor
|
|
64
|
+
| R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false` 可关闭 | README「Install」;CONFIGURATION `wsl-update-check` 行 | ①②⑤:委托路径、TTL、关闭开关成文 | `update-check.test.mjs` | doctor 不再自行查询 registry:更新提示只走这条委托路径 |
|
|
65
|
+
| R29 | `workspace-write` 的额外可写目录:`writableRoots`(两行同列表)与共享 `additionalWritableRoots` 解析为同一组 Linux 根,经一次物理目录检查后绑定进命令、受限写入 resident 与 session runtime;已被工作区/临时区覆盖或嵌套的条目不绑定 | CONFIGURATION「工具链缓存与额外可写目录」;ARCHITECTURE「Sandbox」;LIMITATIONS「workspace-write 默认不授予…」 | ①②③⑤⑥:`~` 展开、UNC/Linux 拼写、跨发行版/盘符拒绝、together-grant、cached key、安全代价与 `partial` 成文 | `writable-roots.test.mjs`、`agent.test.mjs`(bwrap argv)、`provider.test.mjs`(围栏与命令两条路径)、`session-runtime.test.mjs`(key 与前缀);probe:sandbox 的授权根腿 | 真机端到端 `pnpm install` 尚未纳入探针套件;`additionalWritableRoots` 的宿主会话语义仍由上游策略决定 |
|
|
65
66
|
|
|
66
67
|
登记覆盖面:上表登记 README 与 docs/ 中对外成文的行为承诺(含随发的服务面)。
|
|
67
68
|
**有意未接线**的模块不设条目——`lib/file-reference-wsl.js`(`@` 补全的发行版侧
|
|
@@ -116,12 +116,13 @@ The rest of the module stays. `BINARY_SAMPLE_BYTES`, `FsCodedError`,
|
|
|
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
118
|
locally (`src/fsio-agent.ts:27-34`, `src/fs-substrate.ts:37`,
|
|
119
|
-
`src/
|
|
119
|
+
`src/wsl-filesystem.ts:15`). `lib/fsio-text.js` is not deleted; four of its ten exports
|
|
120
120
|
are.
|
|
121
121
|
|
|
122
|
-
Importing from the entry costs this consumer nothing new:
|
|
123
|
-
`LocalFileSystem` from the same entry
|
|
124
|
-
`src/fs-routing.ts:36`) and `@deepseek-ai/dsh-fs`
|
|
122
|
+
Importing from the entry costs this consumer nothing new: the filesystem
|
|
123
|
+
provider imports `LocalFileSystem` from the same entry
|
|
124
|
+
(`src/wsl-filesystem.ts:3`, `src/fs-routing.ts:36`) and the `@deepseek-ai/dsh-fs`
|
|
125
|
+
types (`src/wsl-filesystem.ts:24`). The
|
|
125
126
|
entry's non-builtin static imports are `chokidar` (`lib/index.js:3`),
|
|
126
127
|
`@deepseek-ai/schemastery` (`:6`) and the `@deepseek-ai/dsh-fs` peer (`:7`) —
|
|
127
128
|
all three already in this consumer's graph; `koffi` loads lazily (`await
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Upstream prompt adapters
|
|
2
|
+
|
|
3
|
+
*Status: temporary plugin-side adapters, 2026-11-11. Host line: DeepSeek Harness
|
|
4
|
+
0.2.2-rc.1. Remove each adapter once its upstream issue ships, then re-run the
|
|
5
|
+
prompt checks and the WSL probe suite.*
|
|
6
|
+
|
|
7
|
+
The plugin can present the WSL session correctly without waiting for the host,
|
|
8
|
+
because the host's generic prompt facts are written for a Windows workspace. The
|
|
9
|
+
adapters are deliberately narrow: each either replaces a host contribution or
|
|
10
|
+
adds one sentence, and each names the upstream change that retires it. See `src/cwd-prompt.ts` for the implementation and `test/cwd-prompt.test.mjs`
|
|
11
|
+
for the pinned behavior.
|
|
12
|
+
|
|
13
|
+
## 1. Shell note (`wsl:shell`)
|
|
14
|
+
|
|
15
|
+
**Adapter.** One system-prompt section after `tool:bash` says commands run in the
|
|
16
|
+
distro's login shell with `-lc`, not necessarily bash, and that `~/.bashrc` is
|
|
17
|
+
not read. It names `$DSH_WSL_SHELL` as the exact-shell source.
|
|
18
|
+
|
|
19
|
+
**Why.** The host's `dsh-tool-bash` hardcodes the tool name `bash` and the
|
|
20
|
+
description `bash -c`; a WSL preset actually runs the distro user's login shell
|
|
21
|
+
(e.g. `zsh -lc`). See [LIMITATIONS](LIMITATIONS.md#shell-startup-semantics-wsl-shell).
|
|
22
|
+
|
|
23
|
+
**Upstream issue.** `dsh-tool-bash` should consume `ShellExecutor.shellName()` and
|
|
24
|
+
derive the model-facing tool name and description from the mounted executor. The
|
|
25
|
+
longer-term rename is `dsh-tool-shell`: a POSIX-shell package named `shell`
|
|
26
|
+
(model tool `shell`, actual shell in the description), with
|
|
27
|
+
`dsh-tool-bash` kept as a compatibility alias. The package name and the
|
|
28
|
+
model-facing tool name are separate decisions: the latter is what the model
|
|
29
|
+
reads, so both must move together. The plugin deletes this section after the
|
|
30
|
+
short-term change ships.
|
|
31
|
+
|
|
32
|
+
## 2. POSIX policy (`sandbox:policy`)
|
|
33
|
+
|
|
34
|
+
**Adapter.** A session-scoped `sandbox:policy` context replaces the host line. It
|
|
35
|
+
reads `ctx.sandboxPolicy.resolve({ session })`, converts the workspace and any
|
|
36
|
+
additional writable roots to POSIX, omits anything without a POSIX spelling, and
|
|
37
|
+
adds the conditional partial-enforcement note. No UNC or Windows path is printed.
|
|
38
|
+
|
|
39
|
+
**Why.** The host renders `workspaceRoot` verbatim; a WSL workspace is a
|
|
40
|
+
`\\wsl.localhost\...` UNC. Its policy line also omits the plugin's `partial`
|
|
41
|
+
enforcement (WSL interop is outside bwrap). The model should not need to translate
|
|
42
|
+
a coordinate system or infer isolation the plugin does not provide.
|
|
43
|
+
|
|
44
|
+
**Upstream issue.** `dsh-sandbox-policy` should accept/render an execution-world
|
|
45
|
+
display path from the provider (POSIX for the WSL preset) and carry the
|
|
46
|
+
provider's `enforcement` fact. The adapter lists the host policy's
|
|
47
|
+
`additionalWritableRoots` and omits every non-POSIX spelling; the plugin rows'
|
|
48
|
+
own `writableRoots` are not part of that host policy, so the upstream contract
|
|
49
|
+
also needs the provider's effective writable roots. The plugin deletes this
|
|
50
|
+
replacement after that ships.
|
|
51
|
+
|
|
52
|
+
## 3. Host source (`harness:source`)
|
|
53
|
+
|
|
54
|
+
**Adapter.** A session-scoped empty `harness:source` section and context shadow
|
|
55
|
+
the host values in a WSL session. Nothing is printed.
|
|
56
|
+
|
|
57
|
+
**Why.** The host names the installed `app.asar` path (`C:\...`) as an
|
|
58
|
+
"implementation checkout" and tells the model it may inspect or extend it. In a
|
|
59
|
+
WSL session that path is a Windows path, not a readable source checkout; the
|
|
60
|
+
model gains nothing from it and may spend calls proving it.
|
|
61
|
+
|
|
62
|
+
**Upstream issue.** `dsh-harness-dev-context` should detect a packaged
|
|
63
|
+
installation and either omit the value or label it as a packaged installation.
|
|
64
|
+
The plugin deletes the shadow after that ships.
|
|
65
|
+
|
|
66
|
+
## 4. Preflight notice (`wsl-preflight`)
|
|
67
|
+
|
|
68
|
+
**Adapter.** Only a blocked preflight verdict is published as a runtime-context
|
|
69
|
+
entry, with its remedy marked as operator action. A ready verdict is log-only.
|
|
70
|
+
|
|
71
|
+
**Why.** DSH 0.2.1 has no session-notice seam; the runtime context is the only
|
|
72
|
+
visible channel. A ready verdict is not an action, so it is noise.
|
|
73
|
+
|
|
74
|
+
**Upstream issue.** A session notice seam would let the blocked advisory leave
|
|
75
|
+
the model's durable context. See
|
|
76
|
+
[UPSTREAM-SESSION-NOTICE.md](UPSTREAM-SESSION-NOTICE.md). The plugin then drops
|
|
77
|
+
the runtime-context entry.
|
|
78
|
+
|
|
79
|
+
## Explicit diagnostic exception
|
|
80
|
+
|
|
81
|
+
`wsl_doctor` is not injected proactively. When the user explicitly asks for a
|
|
82
|
+
host diagnosis, its report may name Windows paths for the host-owned checks
|
|
83
|
+
(`.wslconfig`, the Windows git trust, and similar). That output is the
|
|
84
|
+
diagnostic subject, not prompt context; the adapter set above keeps the
|
|
85
|
+
proactive prompt POSIX-only.
|
package/docs/root-fs-routing.md
CHANGED
|
@@ -69,7 +69,7 @@ home 缓存,所以同一个根平面可以同时服务多个发行版;`distr
|
|
|
69
69
|
客户端 `fileMediaUrl` 拒绝 `\\` 开头的路径(§2.2)——真有消费者时需要
|
|
70
70
|
按需覆写。
|
|
71
71
|
- `processPathFromHostPath` 也是宿主实现(绝对宿主路径取 `resolve`)。被路由的
|
|
72
|
-
`WslFileSystem` 自己有一份 distro 映射(`src/
|
|
72
|
+
`WslFileSystem` 自己有一份 distro 映射(`src/wsl-filesystem.ts:530`),那份映射不经
|
|
73
73
|
本路由。
|
|
74
74
|
|
|
75
75
|
### 2.2 有意的行为差异(对照原根 fs-sandbox)
|
package/lib/agent-confined.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ interface ConfinedAgentRequest {
|
|
|
65
65
|
* exists to prevent.
|
|
66
66
|
*/
|
|
67
67
|
realTmp?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Extra Linux roots to bind read-write in the resident's profile. The
|
|
70
|
+
* provider resolved, filtered and checked them; they are part of the cache
|
|
71
|
+
* key because the mount table is fixed for the resident's lifetime.
|
|
72
|
+
*/
|
|
73
|
+
writableRoots?: readonly string[];
|
|
68
74
|
}
|
|
69
75
|
/**
|
|
70
76
|
* The confined agent for one distro and one resolved policy, created on first
|
|
@@ -74,7 +80,7 @@ interface ConfinedAgentRequest {
|
|
|
74
80
|
* @param request - the confinement request.
|
|
75
81
|
* @returns the confined resident for this key.
|
|
76
82
|
*/
|
|
77
|
-
export declare function confinedAgent({ distro, wslPath, policy, maskWindowsDrive, realTmp }: ConfinedAgentRequest): WslAgent;
|
|
83
|
+
export declare function confinedAgent({ distro, wslPath, policy, maskWindowsDrive, realTmp, writableRoots }: ConfinedAgentRequest): WslAgent;
|
|
78
84
|
/** Test hook: forget every confined resident (the plain agent has no factory state). */
|
|
79
85
|
export declare function resetConfinedAgents(): void;
|
|
80
86
|
export {};
|
package/lib/agent-confined.js
CHANGED
|
@@ -105,8 +105,8 @@ export async function runSpawnChecklist({ wslPath, distro, root, runFn }) {
|
|
|
105
105
|
* @param request - the confinement request.
|
|
106
106
|
* @returns the confined resident for this key.
|
|
107
107
|
*/
|
|
108
|
-
export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindowsDrive = false, realTmp = true }) {
|
|
109
|
-
const key = `${wslPath}\0${distro}\0${policy.mode}\0${policy.workspaceRoot}\0${maskWindowsDrive ? "masked" : "visible"}\0${realTmp ? "real" : "ephemeral"}`;
|
|
108
|
+
export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindowsDrive = false, realTmp = true, writableRoots = [] }) {
|
|
109
|
+
const key = `${wslPath}\0${distro}\0${policy.mode}\0${policy.workspaceRoot}\0${maskWindowsDrive ? "masked" : "visible"}\0${realTmp ? "real" : "ephemeral"}\0${writableRoots.join("\0")}`;
|
|
110
110
|
let agent = confinedAgents.get(key);
|
|
111
111
|
if (agent === undefined) {
|
|
112
112
|
const linuxRoot = toLinuxPath(policy.workspaceRoot);
|
|
@@ -120,7 +120,7 @@ export function confinedAgent({ distro, wslPath = "wsl.exe", policy, maskWindows
|
|
|
120
120
|
// `wsl.exe --exec` and the `sh <script>` pair (`lib/agent.js`'s
|
|
121
121
|
// `spawnDefault`). Both confinement sites share that assembly in
|
|
122
122
|
// `lib/bwrap.js`, whose module doc records what happened when they did not.
|
|
123
|
-
argvPrefix: bwrapArgvPrefix({ mode: policy.mode, workspaceRoot: linuxRoot }, { maskWindowsDrive, realTmp }),
|
|
123
|
+
argvPrefix: bwrapArgvPrefix({ mode: policy.mode, workspaceRoot: linuxRoot }, { maskWindowsDrive, realTmp, writableRoots }),
|
|
124
124
|
// workspace-write is the only mode that binds the workspace root, and
|
|
125
125
|
// bwrap refuses a missing bind source (WSL-305): on a freshly imported
|
|
126
126
|
// distro the first write's workspace may not exist yet, and the resident
|
package/lib/auto-preset.d.ts
CHANGED
|
@@ -44,6 +44,15 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
44
44
|
attempts: z<number, number, "defined">;
|
|
45
45
|
/** Gap between attempts, in milliseconds. */
|
|
46
46
|
retryMs: z<number, number, "defined">;
|
|
47
|
+
/**
|
|
48
|
+
* Workspace directories the operator opened for Windows access (9p) instead
|
|
49
|
+
* of the distro environment. A session inside one of them keeps the host
|
|
50
|
+
* preset, so the choice made in the sidebar survives later sessions.
|
|
51
|
+
*
|
|
52
|
+
* Volatile: the sidebar's access-mode dialog records the choice through the
|
|
53
|
+
* Settings service, and this row must observe it without a remount.
|
|
54
|
+
*/
|
|
55
|
+
windowsWorkspaces: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
47
56
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
48
57
|
/** Preset to bind for a WSL workspace. */
|
|
49
58
|
preset: z<string, string, "defined">;
|
|
@@ -51,6 +60,15 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
51
60
|
attempts: z<number, number, "defined">;
|
|
52
61
|
/** Gap between attempts, in milliseconds. */
|
|
53
62
|
retryMs: z<number, number, "defined">;
|
|
63
|
+
/**
|
|
64
|
+
* Workspace directories the operator opened for Windows access (9p) instead
|
|
65
|
+
* of the distro environment. A session inside one of them keeps the host
|
|
66
|
+
* preset, so the choice made in the sidebar survives later sessions.
|
|
67
|
+
*
|
|
68
|
+
* Volatile: the sidebar's access-mode dialog records the choice through the
|
|
69
|
+
* Settings service, and this row must observe it without a remount.
|
|
70
|
+
*/
|
|
71
|
+
windowsWorkspaces: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
54
72
|
}>>, "plain">;
|
|
55
73
|
/** The config schema's validated output. */
|
|
56
74
|
interface AutoPresetConfig {
|
|
@@ -60,6 +78,15 @@ interface AutoPresetConfig {
|
|
|
60
78
|
attempts?: number;
|
|
61
79
|
/** Gap between attempts, in milliseconds. */
|
|
62
80
|
retryMs?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Paths reserved for Windows access. The Loader hands a volatile field to
|
|
83
|
+
* `apply` as a live reference, so both spellings are accepted: a reference
|
|
84
|
+
* when the row was composed by the Loader, a plain array in hand-built test
|
|
85
|
+
* contexts.
|
|
86
|
+
*/
|
|
87
|
+
windowsWorkspaces?: readonly string[] | {
|
|
88
|
+
get: () => readonly string[];
|
|
89
|
+
};
|
|
63
90
|
}
|
|
64
91
|
/**
|
|
65
92
|
* The slice of a created agent this plugin inspects; the harness's agent
|
package/lib/auto-preset.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
import { appendFileSync } from "node:fs";
|
|
37
37
|
import z from "@deepseek-ai/schemastery";
|
|
38
38
|
import { isWslUnc } from "./paths.js";
|
|
39
|
-
import { shouldAdoptWslPreset } from "./preset-choice.js";
|
|
39
|
+
import { isWindowsAccessWorkspace, shouldAdoptWslPreset } from "./preset-choice.js";
|
|
40
40
|
/**
|
|
41
41
|
* Set `DSH_WSL_TRACE` to a file path to record every decision this plugin makes.
|
|
42
42
|
*
|
|
@@ -69,7 +69,35 @@ export const Config = z.object({
|
|
|
69
69
|
attempts: z.natural().min(1).default(6),
|
|
70
70
|
/** Gap between attempts, in milliseconds. */
|
|
71
71
|
retryMs: z.natural().default(150),
|
|
72
|
+
/**
|
|
73
|
+
* Workspace directories the operator opened for Windows access (9p) instead
|
|
74
|
+
* of the distro environment. A session inside one of them keeps the host
|
|
75
|
+
* preset, so the choice made in the sidebar survives later sessions.
|
|
76
|
+
*
|
|
77
|
+
* Volatile: the sidebar's access-mode dialog records the choice through the
|
|
78
|
+
* Settings service, and this row must observe it without a remount.
|
|
79
|
+
*/
|
|
80
|
+
windowsWorkspaces: z.array(z.string()).default([]).volatile(),
|
|
72
81
|
});
|
|
82
|
+
/**
|
|
83
|
+
* Read the Windows-access list at consideration time.
|
|
84
|
+
*
|
|
85
|
+
* A volatile field arrives as a reference whose `get()` returns the value the
|
|
86
|
+
* current configuration resolves to; reading it per decision is what makes an
|
|
87
|
+
* edit in the sidebar apply to the next session instead of the next boot.
|
|
88
|
+
*
|
|
89
|
+
* @param value - the configured field, plain or volatile.
|
|
90
|
+
* @returns the current list, or an empty list when the field is unset.
|
|
91
|
+
*/
|
|
92
|
+
function windowsAccessList(value) {
|
|
93
|
+
if (value === undefined)
|
|
94
|
+
return [];
|
|
95
|
+
if (typeof value.get === "function") {
|
|
96
|
+
const current = value.get();
|
|
97
|
+
return Array.isArray(current) ? current : [];
|
|
98
|
+
}
|
|
99
|
+
return Array.isArray(value) ? value : [];
|
|
100
|
+
}
|
|
73
101
|
/**
|
|
74
102
|
* Mount the auto-preset plugin.
|
|
75
103
|
*
|
|
@@ -126,8 +154,13 @@ export async function apply(ctx, config = {}) {
|
|
|
126
154
|
catch {
|
|
127
155
|
fallback = void 0;
|
|
128
156
|
}
|
|
129
|
-
|
|
157
|
+
const windowsAccess = windowsAccessList(config.windowsWorkspaces);
|
|
158
|
+
if (!shouldAdoptWslPreset({ cwd, current, fallback, windowsAccess })) {
|
|
159
|
+
if (cwd !== undefined && windowsAccess.length > 0) {
|
|
160
|
+
trace(` -> skipped: Windows-access workspace ${JSON.stringify(cwd)}`);
|
|
161
|
+
}
|
|
130
162
|
return;
|
|
163
|
+
}
|
|
131
164
|
trace(` -> acting: fallback=${String(fallback)} isWsl=${isWslUnc(cwd)}`);
|
|
132
165
|
// Deferred on purpose — see the module comment.
|
|
133
166
|
void (async () => {
|
|
@@ -180,7 +213,11 @@ export async function apply(ctx, config = {}) {
|
|
|
180
213
|
const original = facade.ensureSession;
|
|
181
214
|
facade.ensureSession = async function (sessionId, cwd, checkPersistedIdentity, presetId) {
|
|
182
215
|
// An explicit choice always wins, and only a distro workspace is affected.
|
|
183
|
-
|
|
216
|
+
// A workspace the operator opened for Windows access keeps the host
|
|
217
|
+
// preset even here: this is the frame that makes the first mount correct,
|
|
218
|
+
// so skipping it is what the choice means.
|
|
219
|
+
if (presetId !== void 0 || cwd === undefined || !isWslUnc(cwd)
|
|
220
|
+
|| isWindowsAccessWorkspace(cwd, windowsAccessList(config.windowsWorkspaces))) {
|
|
184
221
|
return original.call(this, sessionId, cwd, checkPersistedIdentity, presetId);
|
|
185
222
|
}
|
|
186
223
|
try {
|
package/lib/bwrap.d.ts
CHANGED
|
@@ -40,6 +40,14 @@ interface BwrapProfileOptions {
|
|
|
40
40
|
* is then the cleanup boundary (ADR 0001).
|
|
41
41
|
*/
|
|
42
42
|
pidNamespace?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Extra Linux directories to bind read-write under `workspace-write` — the
|
|
45
|
+
* toolchain caches and linked-worktree grants the operator configured. The
|
|
46
|
+
* caller has already resolved, filtered and physically checked them
|
|
47
|
+
* (`lib/writable-roots.js`); this module only turns them into mounts.
|
|
48
|
+
* Inert under `read-only`: the mode grants no write outside `/`.
|
|
49
|
+
*/
|
|
50
|
+
writableRoots?: readonly string[];
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
45
53
|
* Build the bwrap profile arguments for one file-effect policy, exactly as
|
|
@@ -72,6 +80,12 @@ interface BwrapProfileOptions {
|
|
|
72
80
|
* resident. Read-only mode mounts no `/tmp` at all, so the option is inert
|
|
73
81
|
* there.
|
|
74
82
|
*
|
|
83
|
+
* `options.writableRoots` adds the operator's toolchain grants after the
|
|
84
|
+
* workspace bind. The caller owns their resolution, filtering and physical
|
|
85
|
+
* check (`lib/writable-roots.js`); binding a raw configured string here would
|
|
86
|
+
* let a model-written symlink redirect the grant, so this module never does
|
|
87
|
+
* that itself.
|
|
88
|
+
*
|
|
75
89
|
* @param policy - the policy to express as bwrap mounts.
|
|
76
90
|
* @param options - profile options.
|
|
77
91
|
* @returns profile arguments, before the `--` separator and the command argv.
|
package/lib/bwrap.js
CHANGED
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
* resident. Read-only mode mounts no `/tmp` at all, so the option is inert
|
|
55
55
|
* there.
|
|
56
56
|
*
|
|
57
|
+
* `options.writableRoots` adds the operator's toolchain grants after the
|
|
58
|
+
* workspace bind. The caller owns their resolution, filtering and physical
|
|
59
|
+
* check (`lib/writable-roots.js`); binding a raw configured string here would
|
|
60
|
+
* let a model-written symlink redirect the grant, so this module never does
|
|
61
|
+
* that itself.
|
|
62
|
+
*
|
|
57
63
|
* @param policy - the policy to express as bwrap mounts.
|
|
58
64
|
* @param options - profile options.
|
|
59
65
|
* @returns profile arguments, before the `--` separator and the command argv.
|
|
@@ -71,6 +77,11 @@ export function bwrapProfileArgs(policy, options = {}) {
|
|
|
71
77
|
args.push("--tmpfs", "/tmp");
|
|
72
78
|
}
|
|
73
79
|
args.push("--bind", policy.workspaceRoot, policy.workspaceRoot);
|
|
80
|
+
// The operator's toolchain grants come after the workspace bind, in the
|
|
81
|
+
// deterministic order the resolver returned. They are already filtered to
|
|
82
|
+
// roots with a read-only parent and checked to be physical directories.
|
|
83
|
+
for (const root of options.writableRoots ?? [])
|
|
84
|
+
args.push("--bind", root, root);
|
|
74
85
|
}
|
|
75
86
|
if (options.maskWindowsDrive) {
|
|
76
87
|
args.push("--tmpfs", "/mnt");
|
package/lib/client-host.d.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* - `./shell` (`lib/shell.js`): the session shell executor, mounted inside
|
|
15
15
|
* the WSL agent preset's isolate realm.
|
|
16
16
|
*
|
|
17
|
-
* Compositions that still mount the bare name get the client half (the
|
|
18
|
-
*
|
|
17
|
+
* Compositions that still mount the bare name get the client half (the sidebar
|
|
18
|
+
* status panel and the access-mode prompt) and nothing else; the executor keeps its behavior through
|
|
19
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
|
*
|
package/lib/client-host.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* - `./shell` (`lib/shell.js`): the session shell executor, mounted inside
|
|
15
15
|
* the WSL agent preset's isolate realm.
|
|
16
16
|
*
|
|
17
|
-
* Compositions that still mount the bare name get the client half (the
|
|
18
|
-
*
|
|
17
|
+
* Compositions that still mount the bare name get the client half (the sidebar
|
|
18
|
+
* status panel and the access-mode prompt) and nothing else; the executor keeps its behavior through
|
|
19
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
|
*
|
package/lib/cwd-prompt.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Distro-native
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Distro-native model context: rewrite the `working-directory:current` entry so
|
|
3
|
+
* a distro session reads its directory as the POSIX path its own commands use,
|
|
4
|
+
* and adapt the host prompt facts that are wrong or unnecessarily Windows-shaped
|
|
5
|
+
* in a WSL session. The adaptations are deliberately narrow and replaceable:
|
|
6
|
+
* a one-sentence shell note, a POSIX-only replacement for `sandbox:policy`, and
|
|
7
|
+
* suppression of the host's `harness:source` value (its `app.asar`/Windows path
|
|
8
|
+
* is not a readable source checkout from the distro). See
|
|
9
|
+
* docs/UPSTREAM-PROMPT-ADAPTERS.md for the upstream issues that remove them.
|
|
5
10
|
*
|
|
6
11
|
* The harness's `working-directory` service prints the session cwd verbatim,
|
|
7
12
|
* which on this deployment is `\\wsl.localhost\<distro>\...` — the coordinate
|
|
@@ -84,8 +89,17 @@ interface CwdPromptScope {
|
|
|
84
89
|
interpolate: boolean;
|
|
85
90
|
text: (context: AssembleRequestContext) => string;
|
|
86
91
|
}) => unknown;
|
|
92
|
+
/** Register one system-prompt section in this scope's layer, when the harness has the seam. */
|
|
93
|
+
section?: (entry: {
|
|
94
|
+
name: string;
|
|
95
|
+
order: number;
|
|
96
|
+
interpolate: boolean;
|
|
97
|
+
text: string;
|
|
98
|
+
}) => unknown;
|
|
87
99
|
/** The order constant the harness assigned to a named context family. */
|
|
88
100
|
getContextOrder?: (family: string) => number | undefined;
|
|
101
|
+
/** The order constant the harness assigned to a named system-prompt section family. */
|
|
102
|
+
getSectionOrder?: (family: string) => number | undefined;
|
|
89
103
|
};
|
|
90
104
|
}
|
|
91
105
|
/** The assembly request context: what a provider's `text` receives. */
|
|
@@ -156,6 +170,30 @@ export declare function rewriteQuotedUnc(text: string): string;
|
|
|
156
170
|
* @returns the entry text.
|
|
157
171
|
*/
|
|
158
172
|
export declare function entryText(agent: AssembleRequestContext["agent"], workingDirectory: WorkingDirectorySlice | undefined): string;
|
|
173
|
+
/**
|
|
174
|
+
* One path in the only spelling a WSL model should see. A WSL UNC becomes its
|
|
175
|
+
* POSIX path; an already-POSIX path passes; every Windows spelling returns
|
|
176
|
+
* undefined, so a caller can omit it rather than leak it.
|
|
177
|
+
*
|
|
178
|
+
* @param value - a path from the host policy service or a session header.
|
|
179
|
+
* @returns the POSIX path, or undefined when no POSIX spelling is available.
|
|
180
|
+
*/
|
|
181
|
+
export declare function posixPath(value: string | undefined): string | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* The POSIX-only replacement for the host's `sandbox:policy` context. It keeps
|
|
184
|
+
* the host's mode and root (resolved through `ctx.sandboxPolicy`) but never
|
|
185
|
+
* prints a UNC or Windows path. The partial qualifier is conditional because
|
|
186
|
+
* the plugin can be configured with the sandbox off or in danger-full-access.
|
|
187
|
+
*
|
|
188
|
+
* @param policy - the host policy resolution, when the service is available.
|
|
189
|
+
* @param cwd - the session's workspace, used when the policy root is not POSIX.
|
|
190
|
+
* @returns the model-facing policy text.
|
|
191
|
+
*/
|
|
192
|
+
export declare function policyText(policy: {
|
|
193
|
+
mode?: string;
|
|
194
|
+
workspaceRoot?: string;
|
|
195
|
+
additionalWritableRoots?: readonly string[];
|
|
196
|
+
} | undefined, cwd: string): string;
|
|
159
197
|
/**
|
|
160
198
|
* Mount the rewrite.
|
|
161
199
|
*
|