dsh-plugin-wsl-env 0.26.0 → 0.26.2
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 +137 -0
- package/README.md +55 -158
- package/SUPPORT.md +2 -2
- package/SUPPORT.zh.md +2 -2
- package/docs/ARCHITECTURE.md +21 -5
- package/docs/ARCHITECTURE.zh.md +17 -4
- package/docs/CONFIGURATION.md +7 -9
- package/docs/CONFIGURATION.zh.md +6 -7
- package/docs/DIAGNOSTICS.md +21 -0
- package/docs/DIAGNOSTICS.zh.md +15 -0
- package/docs/LIMITATIONS.md +13 -1
- package/docs/LIMITATIONS.zh.md +12 -2
- package/docs/MIGRATION.md +4 -1
- package/docs/MIGRATION.zh.md +4 -1
- package/docs/PEER-PARITY.md +16 -0
- package/docs/QUICKSTART.md +22 -15
- package/docs/QUICKSTART.zh.md +19 -16
- package/docs/README.zh.md +59 -146
- package/docs/RELEASING.md +2 -2
- package/docs/REQUIREMENTS.zh.md +2 -2
- package/docs/ROADMAP-1.0.md +1 -1
- package/docs/VALUE.md +27 -0
- package/docs/VALUE.zh.md +27 -0
- package/docs/screenshots/with-plugin.png +0 -0
- package/docs/screenshots/with-plugin.svg +59 -0
- package/docs/screenshots/with-plugin.zh.png +0 -0
- package/docs/screenshots/with-plugin.zh.svg +56 -0
- package/docs/screenshots/without-plugin.png +0 -0
- package/docs/screenshots/without-plugin.svg +50 -0
- package/docs/screenshots/without-plugin.zh.png +0 -0
- package/docs/screenshots/without-plugin.zh.svg +45 -0
- package/lib/doctor-report.js +8 -1
- package/lib/git-exec.d.ts +39 -7
- package/lib/git-exec.js +151 -18
- package/lib/listing.d.ts +17 -0
- package/lib/listing.js +20 -0
- package/lib/messages.d.ts +27 -0
- package/lib/messages.js +26 -2
- package/lib/peer-versions.d.ts +53 -0
- package/lib/peer-versions.js +137 -0
- package/lib/picker.js +33 -19
- package/lib/search-exec.d.ts +45 -9
- package/lib/search-exec.js +152 -20
- package/lib/subprocess.d.ts +4 -1
- package/lib/subprocess.js +16 -3
- package/lib/update-check.d.ts +2 -2
- package/lib/update-check.js +2 -2
- package/lib/wsl-doctor-command.js +2 -1
- package/lib/wsl.d.ts +21 -0
- package/lib/wsl.js +24 -0
- package/package.json +9 -2
- package/scripts/doctor.mjs +148 -22
package/docs/RELEASING.md
CHANGED
|
@@ -146,7 +146,7 @@ A manual publish does not create the GitHub Release, so do step 7 by hand.
|
|
|
146
146
|
|
|
147
147
|
`npm publish` prints `+ dsh-plugin-wsl-env@x.y.z` when the upload is accepted. That
|
|
148
148
|
is not the same as the version being visible. The version and the `dist-tags`
|
|
149
|
-
appear in the registry
|
|
149
|
+
appear in the registry several minutes later (0.26.0 took about six), so poll instead of checking once — the release workflow waits up to ten minutes:
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
# expect 200, not 404
|
|
@@ -261,7 +261,7 @@ npm does not let a published version be replaced, so the fix goes forward:
|
|
|
261
261
|
|
|
262
262
|
| Fact | What it means in practice |
|
|
263
263
|
|---|---|
|
|
264
|
-
| `npm publish` prints success at upload time | The version may still return 404 for
|
|
264
|
+
| `npm publish` prints success at upload time | The version may still return 404 for several minutes (0.26.0 took about six). Poll the registry for up to ten minutes, and do not conclude that the publish failed. |
|
|
265
265
|
| A repeated publish of the same version is refused | npm checks the registry first and stops with `You cannot publish over the previously published versions: x.y.z.`; a registry-side conflict surfaces as `EPUBLISHCONFLICT` ("Cannot publish over existing version."). Either one means the first publish landed. Verify it instead of publishing again — the release workflow's already-published check exists for the same reason. |
|
|
266
266
|
| The npm readme is chosen from the candidate files at the package root, and the rule is not fully explained. With `README.md` and `README.zh.md` side by side, version 0.1.1 published as `readmeFilename: README.zh.md`, so its npm page rendered Chinese — even though the tarball listed `README.md` first. Both names match the npm CLI's own selection code (`@npmcli/package-json/lib/normalize.js` globs `{README,README.*}` and accepts `/\.m?a?r?k?d?o?w?n?$/i`, which does match `.md`), so neither name is screened out. | Do not rely on the rule. Keep exactly one readme candidate at the package root, which `pnpm run lint:style` checks. The Chinese README lives in `docs/` for this reason. |
|
|
267
267
|
| A local `~/.npmrc` may point at a mirror | Pass `--registry=https://registry.npmjs.org/` on every publish and every verification. |
|
package/docs/REQUIREMENTS.zh.md
CHANGED
|
@@ -43,7 +43,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
|
|
|
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
|
-
| R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap
|
|
46
|
+
| R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap 指引(常驻 agent 的 spawn 失败与一次性回退的 `execvpe` 失败都翻译为该形状);工作目录缺失用 rg 的错误码 2,不复用「无匹配」的 1;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
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 |
|
|
@@ -58,7 +58,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
|
|
|
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 与实机);由组合测试与真机探针覆盖 |
|
|
60
60
|
| R24 | GUI 文件树与预览在发行版内服务:沿用随包 `workspace-files` 行(server/client 成对),经根级 `fs-routing` 读写 distro UNC;盘符 scope 交宿主 | README「Architecture」;ARCHITECTURE「The root-plane filesystem takeover」;CONFIGURATION `workspace-files` 行 | ①②③⑤:沿用官方 server/client,浏览器 `file` provider 不丢,预览可用;路由与宿主/发行版 scope 成文;容量键由官方行承载、可覆盖;较直连多 4–6 次往返及其取舍在 LIMITATIONS 成文 | `fs-routing.test.mjs`、组合测试(`workspace-files` 保持启用、接管行不存在) | — |
|
|
61
|
-
| R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实
|
|
61
|
+
| R25 | 安装/卸载/升级流:四步安装、幂等陷阱及补救、ES 模块重启须知 | README「Install」「Troubleshooting」 | ①③:每步预期输出、`add` 幂等性陷阱的补救(先 remove 再 add)、pnpm UNC 链接极限成文 | 人工步骤,无自动化(依赖真实 Windows 桌面应用 + WSL;打包链路由 `e2e:install` 覆盖) | 无自动化守护 |
|
|
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
64
|
| R28 | 每日更新检查经宿主插件管理器委托,不自取;事实进 `DSH_WSL_PLUGIN_UPDATE`;`wsl-update-check.enabled: false` 可关闭 | README「Install」;CONFIGURATION `wsl-update-check` 行 | ①②⑤:委托路径、TTL、关闭开关成文 | `update-check.test.mjs` | doctor 不再自行查询 registry:更新提示只走这条委托路径 |
|
package/docs/ROADMAP-1.0.md
CHANGED
|
@@ -131,7 +131,7 @@ correct once configured" and "the plugin is correct on first contact".
|
|
|
131
131
|
|---|---|---|---|
|
|
132
132
|
| [P1.1](#wsl-201--sessionsandbox-auto) | `sessionSandbox: auto` for distros without systemd | Non-systemd distro runs the first command under per-command bwrap and reports the narrower scope; explicit `true` still refuses | M |
|
|
133
133
|
| [P1.2](#wsl-202--compatibility-matrix-and-aarch64) | Compatibility matrix and real validation | Tier 1 (Ubuntu/Debian, systemd, x86_64) green; aarch64 spike runs under qemu; Tier 2 status documented | L |
|
|
134
|
-
| [P1.3](#wsl-203--installupgradeuninstall-e2e) | Install/upgrade/uninstall E2E | Temporary `DSH_HOME`, packed tarball, profile install (Plugins page
|
|
134
|
+
| [P1.3](#wsl-203--installupgradeuninstall-e2e) | Install/upgrade/uninstall E2E | Temporary `DSH_HOME`, packed tarball, profile install (the Plugins page), composed state via the profile's `cordis.patch.yml`, remove; upgrade from the previous minor | M |
|
|
135
135
|
| [P1.4](#wsl-204---references-seam) | `@` references seam | Measure the 9p cost; land the upstream `FileReferenceTraversal` seam or a declared, tested fallback | L |
|
|
136
136
|
| [P1.5](#wsl-205--lsp-provider-spike) | LSP provider spike | A documented plan and prototype for `ctx.lsp` over fs + subprocess, conditional on the desktop composition mounting LSP | M |
|
|
137
137
|
| [P1.6](#wsl-206--gui-preview-performance) | GUI preview performance | Baseline measured; p95 <= 1s/MiB for a representative page; v6 only if the measurement justifies it | M |
|
package/docs/VALUE.md
CHANGED
|
@@ -76,6 +76,19 @@ This plugin fills the combination beyond those three: **the app stays on Windows
|
|
|
76
76
|
|
|
77
77
|
**Evidence.** [ARCHITECTURE "Error codes"](ARCHITECTURE.md#error-codes), [README "Troubleshooting"](../README.md#troubleshooting); `test/ports.test.mjs`, `test/preflight.test.mjs`, `test/terminal.test.mjs`.
|
|
78
78
|
|
|
79
|
+
### Why Linux, not PowerShell
|
|
80
|
+
|
|
81
|
+
The underlying argument for Value 1: most coding agents learn from Linux-first material, and most open-source toolchains are built and tested on Linux first. Asking an agent to work through a Windows shell adds a translation layer on every call:
|
|
82
|
+
|
|
83
|
+
- **Training prior.** Examples, CI scripts, Dockerfiles and most public answers use POSIX shells and GNU tools. A model's first instinct is `bash`, not PowerShell.
|
|
84
|
+
- **Toolchain support.** Node, Python, Rust, Go, C/C++ and most build systems are validated on Linux first. Windows support is often a port with different quoting, paths, line endings and file locking.
|
|
85
|
+
- **Shell semantics.** PowerShell and `cmd` differ from POSIX in quoting, escaping, pipelines, environment variables, exit codes and path separators. Mixing the two produces errors that look like model mistakes.
|
|
86
|
+
- **Environment drift.** Windows setups vary by PowerShell version, execution policy, PATH and installed tools. Linux environments are easier to reproduce and containerize.
|
|
87
|
+
|
|
88
|
+
The result is more failed commands, more retries and more time spent on syntax instead of the task. Generated code is affected too: shell snippets, build commands and CI-style one-liners are usually written for POSIX, and the distro is where they run unchanged. A real Linux login shell removes that translation layer. Modern PowerShell and Windows-native toolchains narrow the gap, but the default prior and most project scripts still assume POSIX.
|
|
89
|
+
|
|
90
|
+
This plugin keeps the GUI on Windows and moves only the execution environment into the distro, so the agent gets the shell that its training and the toolchain both assume.
|
|
91
|
+
|
|
79
92
|
## 3. Value comparison with alternatives
|
|
80
93
|
|
|
81
94
|
| | No integration (open UNC on the Windows side) | Desktop remote (VS Code Remote-WSL, etc.) | Install the CLI inside WSL | This plugin |
|
|
@@ -90,6 +103,20 @@ This plugin fills the combination beyond those three: **the app stays on Windows
|
|
|
90
103
|
|
|
91
104
|
**Say plainly where others are stronger.** Reopening a workspace in desktop remote is instantaneous, and the service is always resident; VS Code's remote has years of production hardening. A CLI installed inside WSL needs no bridge at all. This plugin does not try to win on those dimensions; it solves one combination: **DSH on Windows, the project in WSL, and commands that must be sandboxed.**
|
|
92
105
|
|
|
106
|
+
### Against Remote-SSH (Windows host)
|
|
107
|
+
|
|
108
|
+
Remote-SSH can also reach a WSL distro from Windows (VS Code normally uses its Remote-WSL extension for the local case, not SSH; this is about Remote-SSH). It requires sshd inside the distro, and the differences from this plugin concentrate in a few rows:
|
|
109
|
+
|
|
110
|
+
| | Remote-SSH to WSL | This plugin |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| Reach | any SSH host (cloud VMs, remote servers) | local WSL 2 distros only |
|
|
113
|
+
| Setup | openssh-server in the distro, keys; a WSL NAT IP changes on every restart — port proxy or mirrored networking needed | none — install from the Plugins page |
|
|
114
|
+
| Network | sshd listening on a port | stdio over wsl.exe, no port, nothing listening |
|
|
115
|
+
| In-distro footprint | `~/.vscode-server` (accumulates per version, needs maintenance) | one content-addressed agent cache |
|
|
116
|
+
| Command sandbox | none | bubblewrap + the DSH permission tiers |
|
|
117
|
+
|
|
118
|
+
**Where Remote-SSH is stronger, plainly**: when the target machine is not the local WSL (cloud VMs, office servers) it is the right tool, and the host does not have to be Windows. This plugin covers only the local-distro arrival — the trade is zero network configuration, no server-side in the distro, and a command sandbox.
|
|
119
|
+
|
|
93
120
|
## 4. Costs, boundaries, and non-applicability
|
|
94
121
|
|
|
95
122
|
Value is benefit minus cost. The following should be known before installation:
|
package/docs/VALUE.zh.md
CHANGED
|
@@ -76,6 +76,19 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
|
|
|
76
76
|
|
|
77
77
|
**证据。** [ARCHITECTURE「错误码」](ARCHITECTURE.zh.md#错误码)、[README「常见问题」](README.zh.md#常见问题);`test/ports.test.mjs`、`test/preflight.test.mjs`、`test/terminal.test.mjs`。
|
|
78
78
|
|
|
79
|
+
### 为什么是 Linux,而不是 PowerShell
|
|
80
|
+
|
|
81
|
+
价值一的底层论据:多数编程 agent 的训练材料以 Linux 为主,开源工具链也大多先在 Linux 上构建和测试。让 agent 在 Windows shell 里工作,等于要求它在每次调用时做一层翻译:
|
|
82
|
+
|
|
83
|
+
- **训练先验。** 示例、CI 脚本、Dockerfile 和大多数公开答案用的是 POSIX shell 和 GNU 工具;模型的第一反应是 `bash`,不是 PowerShell。
|
|
84
|
+
- **工具链支持。** Node、Python、Rust、Go、C/C++ 和多数构建系统先在 Linux 上验证。Windows 支持往往是移植,引号、路径、换行和文件锁都不一样。
|
|
85
|
+
- **Shell 语义。** PowerShell 和 `cmd` 在引号、转义、管道、环境变量、退出码和路径分隔符上都与 POSIX 不同。混用两套语法,很容易产生看起来像模型犯的低级错误。
|
|
86
|
+
- **环境漂移。** Windows 侧的 PowerShell 版本、执行策略、PATH 和已装工具因人而异;Linux 环境更容易复现和容器化。
|
|
87
|
+
|
|
88
|
+
结果是更多失败的命令、更多重试,以及更多时间花在语法而不是任务上。生成的代码也一样:shell 片段、构建命令和 CI 风格的一行命令通常按 POSIX 编写,发行版才是它们原样运行的地方。真实的 Linux 登录 shell 去掉了这层翻译。现代 PowerShell 和 Windows 原生工具在缩小差距,但默认先验和多数项目脚本仍然假设 POSIX。
|
|
89
|
+
|
|
90
|
+
本插件把 GUI 留在 Windows,只把执行环境移进发行版,让 agent 得到它的训练和工具链都假设的那个 shell。
|
|
91
|
+
|
|
79
92
|
## 3. 和替代方案的价值对照
|
|
80
93
|
|
|
81
94
|
| | 不做集成(Windows 侧开 UNC) | 桌面远程(VS Code Remote-WSL 等) | 把 CLI 装进 WSL | 本插件 |
|
|
@@ -90,6 +103,20 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
|
|
|
90
103
|
|
|
91
104
|
**别人更强的地方要直说。** 桌面远程重开工作区是即时的,服务常驻;VS Code 的远程有多年生产打磨。CLI 装进 WSL 则完全不需要桥接。本插件不试图在这些维度取胜,它只解决一个组合:**DSH 在 Windows 上,项目在 WSL 里,命令要有沙箱。**
|
|
92
105
|
|
|
106
|
+
### 与 Remote-SSH 的对照(Windows 宿主)
|
|
107
|
+
|
|
108
|
+
Remote-SSH 也能在 Windows 上连 WSL 发行版(VS Code 连本机 WSL 更常用 Remote-WSL 扩展,不经 SSH;这里单说 Remote-SSH)。它要求发行版内运行 sshd,与本插件的差别集中在几行:
|
|
109
|
+
|
|
110
|
+
| | Remote-SSH 到 WSL | 本插件 |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| 到达范围 | 任意 SSH 主机(云主机、远程服务器) | 仅本机 WSL 2 发行版 |
|
|
113
|
+
| 前置配置 | 发行版内装 openssh-server、配密钥;WSL NAT 下 IP 随重启变化,需端口转发或镜像网络 | 无——插件页安装即用 |
|
|
114
|
+
| 网络 | sshd 监听端口 | 经 wsl.exe 的 stdio,无端口、无监听 |
|
|
115
|
+
| 发行版内足迹 | `~/.vscode-server`(按版本累积,需维护) | 一个内容寻址 agent 缓存 |
|
|
116
|
+
| 命令沙箱 | 无 | bubblewrap + DSH 权限档位 |
|
|
117
|
+
|
|
118
|
+
**Remote-SSH 更强的地方照直说**:目标机器不是本机 WSL(云主机、公司服务器)时它是正确工具,且宿主不限 Windows。本插件只覆盖本机发行版这一种到达——代价是换来零网络配置、发行版内无服务端、命令有沙箱。
|
|
119
|
+
|
|
93
120
|
## 4. 代价、边界与不适用
|
|
94
121
|
|
|
95
122
|
价值是收益减代价。下面这些是安装前就该知道的:
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="940" height="640" viewBox="0 0 940 640" font-family="-apple-system, 'Segoe UI', Helvetica, Arial, sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="arrow2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
4
|
+
<path d="M0,0 L10,5 L0,10 z" fill="#64748B"/>
|
|
5
|
+
</marker>
|
|
6
|
+
</defs>
|
|
7
|
+
<rect width="940" height="640" fill="#FFFFFF"/>
|
|
8
|
+
|
|
9
|
+
<text x="470" y="34" text-anchor="middle" font-size="17" font-weight="600" fill="#111827">With the plugin — one session, two halves</text>
|
|
10
|
+
<text x="470" y="56" text-anchor="middle" font-size="12.5" fill="#6B7280">the GUI and model calls stay on Windows; commands and files run inside the distro</text>
|
|
11
|
+
|
|
12
|
+
<!-- Windows host -->
|
|
13
|
+
<rect x="40" y="78" width="860" height="280" rx="10" fill="#EFF6FF" stroke="#93C5FD" stroke-width="1.5"/>
|
|
14
|
+
<text x="56" y="102" font-size="12" font-weight="700" fill="#1D4ED8" letter-spacing="0.5">WINDOWS HOST</text>
|
|
15
|
+
|
|
16
|
+
<rect x="60" y="114" width="820" height="100" rx="8" fill="#FFFFFF" stroke="#60A5FA"/>
|
|
17
|
+
<text x="76" y="138" font-size="13" font-weight="700" fill="#1E3A8A">DeepSeek Harness Desktop</text>
|
|
18
|
+
<text x="76" y="160" font-size="12.5" fill="#374151">GUI — chat · file tree · previews · terminal panel</text>
|
|
19
|
+
<text x="76" y="180" font-size="12.5" fill="#374151">model calls (LLM API traffic)</text>
|
|
20
|
+
<text x="76" y="200" font-size="12.5" fill="#374151">profiles & session state — <tspan font-family="ui-monospace, Consolas, monospace" font-size="12">%USERPROFILE%\.dsh</tspan></text>
|
|
21
|
+
|
|
22
|
+
<rect x="60" y="230" width="820" height="108" rx="8" fill="#DBEAFE" stroke="#60A5FA"/>
|
|
23
|
+
<text x="76" y="254" font-size="13" font-weight="700" fill="#1E40AF">dsh-plugin-wsl-env — host half</text>
|
|
24
|
+
<text x="76" y="278" font-size="12" fill="#1E3A8A" font-family="ui-monospace, Consolas, monospace">fs-routing: \wsl.localhost\… → distro · C:\… → host</text>
|
|
25
|
+
<text x="76" y="298" font-size="12.5" fill="#1E3A8A">auto-preset binds the wsl preset when a session opens a distro folder</text>
|
|
26
|
+
<text x="76" y="318" font-size="12.5" fill="#1E3A8A">distro picker · doctor host-side probes · a Windows-folder session stays unchanged</text>
|
|
27
|
+
|
|
28
|
+
<!-- the stdio channel -->
|
|
29
|
+
<line x1="470" y1="366" x2="470" y2="414" stroke="#64748B" stroke-width="2" marker-start="url(#arrow2)" marker-end="url(#arrow2)"/>
|
|
30
|
+
<text x="486" y="390" font-size="12.5" font-weight="700" fill="#374151">stdio over wsl.exe — once, for the whole session</text>
|
|
31
|
+
<rect x="150" y="376" width="250" height="22" rx="11" fill="#DCFCE7"/>
|
|
32
|
+
<text x="275" y="391" text-anchor="middle" font-size="11.5" font-weight="700" fill="#15803D">no port · no service · nothing listening</text>
|
|
33
|
+
|
|
34
|
+
<!-- distro -->
|
|
35
|
+
<rect x="40" y="422" width="860" height="188" rx="10" fill="#F0FDF4" stroke="#86EFAC" stroke-width="1.5"/>
|
|
36
|
+
<text x="56" y="446" font-size="12" font-weight="700" fill="#15803D" letter-spacing="0.5">WSL 2 DISTRO (LINUX VM)</text>
|
|
37
|
+
<text x="76" y="470" font-size="13" font-weight="700" fill="#166534">resident agent</text>
|
|
38
|
+
<text x="196" y="470" font-size="12" fill="#374151" font-family="ui-monospace, Consolas, monospace">~/.cache/dsh-wsl/agent/ (content-addressed, nothing else persisted)</text>
|
|
39
|
+
|
|
40
|
+
<rect x="60" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
41
|
+
<text x="76" y="508" font-size="12.5" font-weight="700" fill="#166534">commands</text>
|
|
42
|
+
<text x="76" y="530" font-size="11.5" fill="#374151">plain POSIX — no wsl.exe prefix;</text>
|
|
43
|
+
<text x="76" y="548" font-size="11.5" fill="#374151">login shell: PATH, nvm, cargo, rc</text>
|
|
44
|
+
<text x="76" y="566" font-size="11.5" fill="#374151">bubblewrap fence per command</text>
|
|
45
|
+
|
|
46
|
+
<rect x="337" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
47
|
+
<text x="353" y="508" font-size="12.5" font-weight="700" fill="#166534">files</text>
|
|
48
|
+
<text x="353" y="530" font-size="11.5" fill="#374151">ext4 native semantics</text>
|
|
49
|
+
<text x="353" y="548" font-size="11.5" fill="#374151">the distro’s own rg · watch</text>
|
|
50
|
+
<text x="353" y="566" font-size="11.5" fill="#374151">git change snapshots</text>
|
|
51
|
+
|
|
52
|
+
<rect x="614" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
53
|
+
<text x="630" y="508" font-size="12.5" font-weight="700" fill="#166534">session runtime</text>
|
|
54
|
+
<text x="630" y="530" font-size="11.5" fill="#374151">one systemd user scope — env and</text>
|
|
55
|
+
<text x="630" y="548" font-size="11.5" fill="#374151">background state persist; dev servers</text>
|
|
56
|
+
<text x="630" y="566" font-size="11.5" fill="#374151">survive · ports → DSH_WSL_PORTS</text>
|
|
57
|
+
|
|
58
|
+
<text x="470" y="628" text-anchor="middle" font-size="12" fill="#6B7280">path decides: a distro-folder session runs here, a drive-letter session stays on Windows — both in one process</text>
|
|
59
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="940" height="640" viewBox="0 0 940 640" font-family="-apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="arrow2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
4
|
+
<path d="M0,0 L10,5 L0,10 z" fill="#64748B"/>
|
|
5
|
+
</marker>
|
|
6
|
+
</defs>
|
|
7
|
+
<rect width="940" height="640" fill="#FFFFFF"/>
|
|
8
|
+
|
|
9
|
+
<text x="470" y="34" text-anchor="middle" font-size="17" font-weight="600" fill="#111827">有本插件——一个会话,两半执行</text>
|
|
10
|
+
<text x="470" y="56" text-anchor="middle" font-size="12.5" fill="#6B7280">界面与模型调用留在 Windows;命令与文件在发行版内运行</text>
|
|
11
|
+
|
|
12
|
+
<rect x="40" y="78" width="860" height="280" rx="10" fill="#EFF6FF" stroke="#93C5FD" stroke-width="1.5"/>
|
|
13
|
+
<text x="56" y="102" font-size="12" font-weight="700" fill="#1D4ED8" letter-spacing="0.5">WINDOWS 宿主</text>
|
|
14
|
+
|
|
15
|
+
<rect x="60" y="114" width="820" height="100" rx="8" fill="#FFFFFF" stroke="#60A5FA"/>
|
|
16
|
+
<text x="76" y="138" font-size="13" font-weight="700" fill="#1E3A8A">DeepSeek Harness Desktop</text>
|
|
17
|
+
<text x="76" y="160" font-size="12.5" fill="#374151">GUI——对话 · 文件树 · 预览 · 终端面板</text>
|
|
18
|
+
<text x="76" y="180" font-size="12.5" fill="#374151">模型调用(LLM API 流量)</text>
|
|
19
|
+
<text x="76" y="200" font-size="12.5" fill="#374151">配置与会话状态——<tspan font-family="ui-monospace, Consolas, monospace" font-size="12">%USERPROFILE%\.dsh</tspan></text>
|
|
20
|
+
|
|
21
|
+
<rect x="60" y="230" width="820" height="108" rx="8" fill="#DBEAFE" stroke="#60A5FA"/>
|
|
22
|
+
<text x="76" y="254" font-size="13" font-weight="700" fill="#1E40AF">dsh-plugin-wsl-env——宿主半边</text>
|
|
23
|
+
<text x="76" y="278" font-size="12" fill="#1E3A8A" font-family="ui-monospace, Consolas, monospace">fs-routing: \wsl.localhost\… → 发行版 · C:\… → 宿主</text>
|
|
24
|
+
<text x="76" y="298" font-size="12.5" fill="#1E3A8A">auto-preset:会话打开发行版目录时自动绑定 wsl preset</text>
|
|
25
|
+
<text x="76" y="318" font-size="12.5" fill="#1E3A8A">发行版选择器 · doctor 宿主侧探针 · Windows 目录会话保持不变</text>
|
|
26
|
+
|
|
27
|
+
<line x1="470" y1="366" x2="470" y2="414" stroke="#64748B" stroke-width="2" marker-start="url(#arrow2)" marker-end="url(#arrow2)"/>
|
|
28
|
+
<text x="486" y="390" font-size="12.5" font-weight="700" fill="#374151">经 wsl.exe 的 stdio 管道——整个会话一次</text>
|
|
29
|
+
<rect x="150" y="376" width="250" height="22" rx="11" fill="#DCFCE7"/>
|
|
30
|
+
<text x="275" y="391" text-anchor="middle" font-size="11.5" font-weight="700" fill="#15803D">无端口 · 无服务 · 零监听</text>
|
|
31
|
+
|
|
32
|
+
<rect x="40" y="422" width="860" height="188" rx="10" fill="#F0FDF4" stroke="#86EFAC" stroke-width="1.5"/>
|
|
33
|
+
<text x="56" y="446" font-size="12" font-weight="700" fill="#15803D" letter-spacing="0.5">WSL 2 发行版(LINUX 虚机)</text>
|
|
34
|
+
<text x="76" y="470" font-size="13" font-weight="700" fill="#166534">常驻 agent</text>
|
|
35
|
+
<text x="180" y="470" font-size="12" fill="#374151" font-family="ui-monospace, Consolas, monospace">~/.cache/dsh-wsl/agent/(内容寻址,此外无任何持久物)</text>
|
|
36
|
+
|
|
37
|
+
<rect x="60" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
38
|
+
<text x="76" y="508" font-size="12.5" font-weight="700" fill="#166534">命令</text>
|
|
39
|
+
<text x="76" y="530" font-size="11.5" fill="#374151">纯 POSIX——不带 wsl.exe 前缀;</text>
|
|
40
|
+
<text x="76" y="548" font-size="11.5" fill="#374151">登录 shell:PATH、nvm、cargo、rc</text>
|
|
41
|
+
<text x="76" y="566" font-size="11.5" fill="#374151">每条命令一道 bubblewrap 围栏</text>
|
|
42
|
+
|
|
43
|
+
<rect x="337" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
44
|
+
<text x="353" y="508" font-size="12.5" font-weight="700" fill="#166534">文件</text>
|
|
45
|
+
<text x="353" y="530" font-size="11.5" fill="#374151">ext4 原生语义</text>
|
|
46
|
+
<text x="353" y="548" font-size="11.5" fill="#374151">发行版自己的 rg · watch</text>
|
|
47
|
+
<text x="353" y="566" font-size="11.5" fill="#374151">git 变更快照</text>
|
|
48
|
+
|
|
49
|
+
<rect x="614" y="484" width="266" height="104" rx="8" fill="#FFFFFF" stroke="#BBF7D0"/>
|
|
50
|
+
<text x="630" y="508" font-size="12.5" font-weight="700" fill="#166534">会话 runtime</text>
|
|
51
|
+
<text x="630" y="530" font-size="11.5" fill="#374151">一个 systemd user scope——环境与</text>
|
|
52
|
+
<text x="630" y="548" font-size="11.5" fill="#374151">后台状态跨命令保持;dev server</text>
|
|
53
|
+
<text x="630" y="566" font-size="11.5" fill="#374151">存活 · 端口 → DSH_WSL_PORTS</text>
|
|
54
|
+
|
|
55
|
+
<text x="470" y="628" text-anchor="middle" font-size="12" fill="#6B7280">路径决定归属:发行版目录的会话在这里运行,盘符目录的会话留在 Windows——同一进程</text>
|
|
56
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="940" height="580" viewBox="0 0 940 580" font-family="-apple-system, 'Segoe UI', Helvetica, Arial, sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
4
|
+
<path d="M0,0 L10,5 L0,10 z" fill="#64748B"/>
|
|
5
|
+
</marker>
|
|
6
|
+
</defs>
|
|
7
|
+
<rect width="940" height="580" fill="#FFFFFF"/>
|
|
8
|
+
|
|
9
|
+
<text x="470" y="34" text-anchor="middle" font-size="17" font-weight="600" fill="#111827">DSH Desktop for Windows — without the plugin</text>
|
|
10
|
+
<text x="470" y="56" text-anchor="middle" font-size="12.5" fill="#6B7280">both modes lack a POSIX execution environment — Windows workspaces get CMD / PowerShell, WSL workspaces get wsl.exe wrappers</text>
|
|
11
|
+
|
|
12
|
+
<!-- Windows host -->
|
|
13
|
+
<rect x="40" y="78" width="860" height="322" rx="10" fill="#EFF6FF" stroke="#93C5FD" stroke-width="1.5"/>
|
|
14
|
+
<text x="56" y="102" font-size="12" font-weight="700" fill="#1D4ED8" letter-spacing="0.5">WINDOWS HOST</text>
|
|
15
|
+
|
|
16
|
+
<rect x="60" y="114" width="820" height="104" rx="8" fill="#FFFFFF" stroke="#60A5FA"/>
|
|
17
|
+
<text x="76" y="138" font-size="13" font-weight="700" fill="#1E3A8A">DeepSeek Harness Desktop</text>
|
|
18
|
+
<text x="76" y="160" font-size="12.5" fill="#374151">GUI — chat · file tree · previews · terminal panel</text>
|
|
19
|
+
<text x="76" y="180" font-size="12.5" fill="#374151">model calls (LLM API traffic)</text>
|
|
20
|
+
<text x="76" y="200" font-size="12.5" fill="#374151">profiles & session state — <tspan font-family="ui-monospace, Consolas, monospace" font-size="12">%USERPROFILE%\.dsh</tspan></text>
|
|
21
|
+
|
|
22
|
+
<!-- pain A: native Windows execution -->
|
|
23
|
+
<rect x="60" y="234" width="402" height="152" rx="8" fill="#FEF2F2" stroke="#FCA5A5"/>
|
|
24
|
+
<text x="76" y="258" font-size="13" font-weight="700" fill="#B91C1C">Windows workspace: commands run in CMD / PowerShell</text>
|
|
25
|
+
<text x="76" y="284" font-size="11.5" fill="#7F1D1D">✗ the model’s training corpus is POSIX-first —</text>
|
|
26
|
+
<text x="76" y="306" font-size="11.5" fill="#7F1D1D">✗ its CMD / PowerShell output is error-prone</text>
|
|
27
|
+
<text x="76" y="328" font-size="11.5" fill="#7F1D1D">✗ nvm, cargo, pyenv, rc files never apply</text>
|
|
28
|
+
<text x="76" y="352" font-size="11.5" fill="#B91C1C" font-weight="700">the model’s best language is not spoken here</text>
|
|
29
|
+
|
|
30
|
+
<!-- pain B: the wsl.exe workaround -->
|
|
31
|
+
<rect x="478" y="234" width="402" height="152" rx="8" fill="#FFFBEB" stroke="#FCD34D"/>
|
|
32
|
+
<text x="494" y="258" font-size="13" font-weight="700" fill="#B45309">WSL workspace: wrap each call in wsl.exe</text>
|
|
33
|
+
<text x="494" y="284" font-size="11.5" fill="#92400E">✗ the wsl.exe prefix on every command line</text>
|
|
34
|
+
<text x="494" y="306" font-size="11.5" fill="#92400E">✗ each call is an isolated space — environment,</text>
|
|
35
|
+
<text x="508" y="324" font-size="11.5" fill="#92400E">cwd and process state don’t carry across</text>
|
|
36
|
+
<text x="494" y="348" font-size="11.5" fill="#92400E">✗ multi-step scripts break at the seams</text>
|
|
37
|
+
<text x="494" y="372" font-size="11.5" fill="#B45309" font-weight="700">stateful work does not survive the wrapping</text>
|
|
38
|
+
|
|
39
|
+
<!-- the 9p bridge -->
|
|
40
|
+
<line x1="470" y1="404" x2="470" y2="460" stroke="#64748B" stroke-width="2" marker-end="url(#arrow)"/>
|
|
41
|
+
<text x="486" y="422" font-size="12" fill="#374151" font-family="ui-monospace, Consolas, monospace">file tools read \wsl.localhost\ubuntu\…</text>
|
|
42
|
+
<text x="486" y="442" font-size="12" fill="#6B7280">9p share — a slow round trip per read / write / search,</text>
|
|
43
|
+
<text x="486" y="460" font-size="12" fill="#6B7280">no native Linux file semantics</text>
|
|
44
|
+
|
|
45
|
+
<!-- distro -->
|
|
46
|
+
<rect x="40" y="468" width="860" height="88" rx="10" fill="#F0FDF4" stroke="#86EFAC" stroke-width="1.5"/>
|
|
47
|
+
<text x="56" y="492" font-size="12" font-weight="700" fill="#15803D" letter-spacing="0.5">WSL 2 DISTRO (LINUX VM)</text>
|
|
48
|
+
<text x="76" y="516" font-size="12.5" fill="#374151">the project lives here: ext4 · the distro’s rg · git hooks · dev servers</text>
|
|
49
|
+
<text x="76" y="538" font-size="12" fill="#9CA3AF">the one place the model’s scripts run well — and execution never gets there</text>
|
|
50
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="940" height="580" viewBox="0 0 940 580" font-family="-apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
4
|
+
<path d="M0,0 L10,5 L0,10 z" fill="#64748B"/>
|
|
5
|
+
</marker>
|
|
6
|
+
</defs>
|
|
7
|
+
<rect width="940" height="580" fill="#FFFFFF"/>
|
|
8
|
+
|
|
9
|
+
<text x="470" y="34" text-anchor="middle" font-size="17" font-weight="600" fill="#111827">DSH Desktop for Windows —— 没有本插件时</text>
|
|
10
|
+
<text x="470" y="56" text-anchor="middle" font-size="12.5" fill="#6B7280">两种模式都没有 POSIX 执行环境:Windows 工作区落在 CMD / PowerShell,WSL 工作区靠 wsl.exe 逐条包装</text>
|
|
11
|
+
|
|
12
|
+
<rect x="40" y="78" width="860" height="322" rx="10" fill="#EFF6FF" stroke="#93C5FD" stroke-width="1.5"/>
|
|
13
|
+
<text x="56" y="102" font-size="12" font-weight="700" fill="#1D4ED8" letter-spacing="0.5">WINDOWS 宿主</text>
|
|
14
|
+
|
|
15
|
+
<rect x="60" y="114" width="820" height="104" rx="8" fill="#FFFFFF" stroke="#60A5FA"/>
|
|
16
|
+
<text x="76" y="138" font-size="13" font-weight="700" fill="#1E3A8A">DeepSeek Harness Desktop</text>
|
|
17
|
+
<text x="76" y="160" font-size="12.5" fill="#374151">GUI——对话 · 文件树 · 预览 · 终端面板</text>
|
|
18
|
+
<text x="76" y="180" font-size="12.5" fill="#374151">模型调用(LLM API 流量)</text>
|
|
19
|
+
<text x="76" y="200" font-size="12.5" fill="#374151">配置与会话状态——<tspan font-family="ui-monospace, Consolas, monospace" font-size="12">%USERPROFILE%\.dsh</tspan></text>
|
|
20
|
+
|
|
21
|
+
<rect x="60" y="234" width="402" height="152" rx="8" fill="#FEF2F2" stroke="#FCA5A5"/>
|
|
22
|
+
<text x="76" y="258" font-size="13" font-weight="700" fill="#B91C1C">Windows 工作区:命令运行在 CMD / PowerShell</text>
|
|
23
|
+
<text x="76" y="284" font-size="11.5" fill="#7F1D1D">✗ 模型训练语料以 POSIX 为主——</text>
|
|
24
|
+
<text x="76" y="306" font-size="11.5" fill="#7F1D1D">✗ 生成的 CMD / PowerShell 脚本容易出错</text>
|
|
25
|
+
<text x="76" y="328" font-size="11.5" fill="#7F1D1D">✗ nvm、cargo、pyenv 与 rc 文件全部不生效</text>
|
|
26
|
+
<text x="76" y="352" font-size="11.5" fill="#B91C1C" font-weight="700">模型最擅长的语言,在这里行不通</text>
|
|
27
|
+
|
|
28
|
+
<rect x="478" y="234" width="402" height="152" rx="8" fill="#FFFBEB" stroke="#FCD34D"/>
|
|
29
|
+
<text x="494" y="258" font-size="13" font-weight="700" fill="#B45309">WSL 工作区:每条命令套一层 wsl.exe</text>
|
|
30
|
+
<text x="494" y="284" font-size="11.5" fill="#92400E">✗ 每行命令都要带 wsl.exe 前缀</text>
|
|
31
|
+
<text x="494" y="306" font-size="11.5" fill="#92400E">✗ 每次调用都是孤立空间——环境、cwd 与</text>
|
|
32
|
+
<text x="508" y="324" font-size="11.5" fill="#92400E">进程状态无法跨调用保持</text>
|
|
33
|
+
<text x="494" y="348" font-size="11.5" fill="#92400E">✗ 多步脚本在接缝处断掉</text>
|
|
34
|
+
<text x="494" y="372" font-size="11.5" fill="#B45309" font-weight="700">有状态的工作撑不过这层包装</text>
|
|
35
|
+
|
|
36
|
+
<line x1="470" y1="404" x2="470" y2="460" stroke="#64748B" stroke-width="2" marker-end="url(#arrow)"/>
|
|
37
|
+
<text x="486" y="422" font-size="12" fill="#374151" font-family="ui-monospace, Consolas, monospace">文件工具读取 \wsl.localhost\ubuntu\…</text>
|
|
38
|
+
<text x="486" y="442" font-size="12" fill="#6B7280">9p 共享——每次读 / 写 / 搜索一个慢往返,</text>
|
|
39
|
+
<text x="486" y="460" font-size="12" fill="#6B7280">没有原生的 Linux 文件语义</text>
|
|
40
|
+
|
|
41
|
+
<rect x="40" y="468" width="860" height="88" rx="10" fill="#F0FDF4" stroke="#86EFAC" stroke-width="1.5"/>
|
|
42
|
+
<text x="56" y="492" font-size="12" font-weight="700" fill="#15803D" letter-spacing="0.5">WSL 2 发行版(LINUX 虚机)</text>
|
|
43
|
+
<text x="76" y="516" font-size="12.5" fill="#374151">项目在这里:ext4 · 发行版自己的 rg · git hooks · dev server</text>
|
|
44
|
+
<text x="76" y="538" font-size="12" fill="#9CA3AF">模型脚本唯一跑得好的地方——执行却从未到达</text>
|
|
45
|
+
</svg>
|
package/lib/doctor-report.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sharedAgent } from "./agent-shared.js";
|
|
2
2
|
import { mergeAutoPresetSeam, mergeLiveResidentStatus } from "./doctor-live.js";
|
|
3
|
+
import { withHostPeerVersions } from "./peer-versions.js";
|
|
3
4
|
import { spawn } from "node:child_process";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import { dirname, join } from "node:path";
|
|
@@ -147,9 +148,15 @@ export async function doctorReport(distro, options) {
|
|
|
147
148
|
// The stdout is parsed regardless; only a run that produced no versioned
|
|
148
149
|
// report rejects.
|
|
149
150
|
const timeoutMs = options?.timeoutMs ?? DOCTOR_TIMEOUT_MS;
|
|
151
|
+
// The child inherits this process's environment either way; the overlay adds
|
|
152
|
+
// the peer set this host actually resolved, which the child cannot look up
|
|
153
|
+
// itself (a separate Node process has no profile interception).
|
|
154
|
+
const env = withHostPeerVersions(options?.envPath === undefined
|
|
155
|
+
? process.env
|
|
156
|
+
: { ...process.env, PATH: `${options.envPath}:${process.env.PATH ?? ""}` });
|
|
150
157
|
const run = await runDoctorProcess(argv, {
|
|
151
158
|
timeoutMs,
|
|
152
|
-
|
|
159
|
+
env,
|
|
153
160
|
...(options?.signal === undefined ? {} : { signal: options.signal }),
|
|
154
161
|
});
|
|
155
162
|
let report;
|
package/lib/git-exec.d.ts
CHANGED
|
@@ -25,14 +25,46 @@
|
|
|
25
25
|
* The agent being out is the fallback cue, exactly as `search-exec.ts`:
|
|
26
26
|
* `spawnFallback` (the caller's one-shot `wsl.exe` handle) is consulted
|
|
27
27
|
* lazily inside `done`, and from that point the facade proxies the delegate
|
|
28
|
-
* verbatim
|
|
29
|
-
* `kill()` abort the agent
|
|
28
|
+
* verbatim unless its relay named a broken program or directory. Cancellation
|
|
29
|
+
* shares one channel: the caller's `signal` and `kill()` abort the agent
|
|
30
|
+
* exec, settling `done` as killed.
|
|
31
|
+
*
|
|
32
|
+
* ## Failure surfacing: a broken distro must not look like "no changes"
|
|
33
|
+
*
|
|
34
|
+
* `GitRunner` reads git's own exit codes and stderr; a rejection from
|
|
35
|
+
* `handle.done` is an opaque snapshot failure the model cannot act on. The
|
|
36
|
+
* agent's two local failures therefore become git's own dialect instead:
|
|
37
|
+
*
|
|
38
|
+
* - A `SpawnError` means the agent could not start the program. The native
|
|
39
|
+
* agent reports both a missing executable and a missing working directory
|
|
40
|
+
* that way, without naming either — so the synthesized message names both
|
|
41
|
+
* and the install remedy, at exit 127 (a shell's command-not-found; never
|
|
42
|
+
* `1`, which several git subcommands use for a normal negative answer, nor
|
|
43
|
+
* `128`, which `GitRunner` reads as "not a repository").
|
|
44
|
+
* - A `CwdError` names the directory that could not be entered. It becomes
|
|
45
|
+
* git's fatal class — `fatal: cannot change to '<path>': No such file or
|
|
46
|
+
* directory` at exit 128 — which is exactly what `git -C <missing>` itself
|
|
47
|
+
* prints.
|
|
48
|
+
*
|
|
49
|
+
* Neither failure falls back to the one-shot path. A missing program would
|
|
50
|
+
* only produce the relay's `execvpe(git) failed` at exit `1`, and a missing
|
|
51
|
+
* directory is worse: `wsl.exe --cd` does not fail on it — it warns, runs in
|
|
52
|
+
* `/`, and exits 0 — where `git` then answers "not a git repository", which
|
|
53
|
+
* the snapshot reads as a clean, empty result. The one-shot delegate is
|
|
54
|
+
* post-processed for both relay markers, so the agent being out cannot turn a
|
|
55
|
+
* broken environment into a silent "no changes" either. Other failures still
|
|
56
|
+
* propagate through `done` as rejections.
|
|
57
|
+
*
|
|
58
|
+
* A discovery call's absolute-path answer is translated on BOTH transports:
|
|
59
|
+
* the one-shot delegate's stdout is taken over and passed through
|
|
60
|
+
* `translateDiscoveryOutput` exactly as the agent's result is, so change
|
|
61
|
+
* review sees the same UNC paths whether or not the resident is up.
|
|
30
62
|
*
|
|
31
63
|
* Pure shaping over injected collaborators, unit-testable without a distro.
|
|
32
64
|
*
|
|
33
65
|
* This is a TypeScript source built to `lib/git-exec.js`; edit THIS file and
|
|
34
|
-
* run `pnpm run build` — the artifact under `lib/` is generated, and
|
|
35
|
-
*
|
|
66
|
+
* run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
|
|
67
|
+
* fails when it drifts.
|
|
36
68
|
*
|
|
37
69
|
* @module dsh-plugin-wsl-env/git-exec
|
|
38
70
|
*/
|
|
@@ -86,10 +118,10 @@ export declare function gitExecutionHandle({ agent, cwd, argv, env, stdin, caps,
|
|
|
86
118
|
/** The distro-side argv (`git` and its arguments). */
|
|
87
119
|
argv: string[];
|
|
88
120
|
/**
|
|
89
|
-
* The distro name;
|
|
90
|
-
* become `\\wsl.localhost\<distro><path>`).
|
|
121
|
+
* The distro name; used by the discovery translation (absolute path lines
|
|
122
|
+
* become `\\wsl.localhost\<distro><path>`) and by every failure's remedy.
|
|
91
123
|
*/
|
|
92
|
-
distro
|
|
124
|
+
distro: string;
|
|
93
125
|
/**
|
|
94
126
|
* True for a SENTINEL discovery call (`--show-toplevel` /
|
|
95
127
|
* `--absolute-git-dir` / `--git-path` answered by the distro git): the
|