dsh-plugin-wsl-env 0.25.0 → 0.26.1

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CODE_OF_CONDUCT.zh.md +85 -0
  4. package/CONTRIBUTING.md +19 -3
  5. package/CONTRIBUTING.zh.md +200 -0
  6. package/README.md +55 -149
  7. package/SECURITY.md +2 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +4 -2
  10. package/SUPPORT.zh.md +99 -0
  11. package/client.js +409 -8
  12. package/cordis.patch.yml +13 -0
  13. package/docs/AGENT-PROTOCOL-V7.md +2 -2
  14. package/docs/API.md +2 -0
  15. package/docs/API.zh.md +38 -0
  16. package/docs/ARCHITECTURE.md +15 -4
  17. package/docs/ARCHITECTURE.zh.md +518 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +7 -10
  21. package/docs/CONFIGURATION.zh.md +7 -9
  22. package/docs/DIAGNOSTICS.md +24 -0
  23. package/docs/DIAGNOSTICS.zh.md +13 -0
  24. package/docs/LIMITATIONS.md +43 -5
  25. package/docs/LIMITATIONS.zh.md +34 -6
  26. package/docs/MIGRATION.md +10 -4
  27. package/docs/MIGRATION.zh.md +94 -0
  28. package/docs/PEER-PARITY.md +75 -47
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +29 -15
  32. package/docs/QUICKSTART.zh.md +25 -17
  33. package/docs/README.zh.md +69 -150
  34. package/docs/RELEASING.md +4 -3
  35. package/docs/REQUIREMENTS.zh.md +4 -2
  36. package/docs/ROADMAP-1.0.md +2 -2
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  39. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  40. package/docs/VALUE.md +173 -0
  41. package/docs/VALUE.zh.md +42 -13
  42. package/docs/screenshots/with-plugin.png +0 -0
  43. package/docs/screenshots/with-plugin.svg +59 -0
  44. package/docs/screenshots/with-plugin.zh.png +0 -0
  45. package/docs/screenshots/with-plugin.zh.svg +56 -0
  46. package/docs/screenshots/without-plugin.png +0 -0
  47. package/docs/screenshots/without-plugin.svg +50 -0
  48. package/docs/screenshots/without-plugin.zh.png +0 -0
  49. package/docs/screenshots/without-plugin.zh.svg +45 -0
  50. package/lib/auto-preset-seam.d.ts +45 -0
  51. package/lib/auto-preset-seam.js +47 -0
  52. package/lib/auto-preset.d.ts +33 -10
  53. package/lib/auto-preset.js +148 -44
  54. package/lib/doctor-live.d.ts +30 -0
  55. package/lib/doctor-live.js +37 -0
  56. package/lib/doctor-report.js +10 -3
  57. package/lib/messages.d.ts +19 -0
  58. package/lib/messages.js +28 -0
  59. package/lib/open-in-app.d.ts +206 -0
  60. package/lib/open-in-app.js +300 -0
  61. package/lib/peer-versions.d.ts +53 -0
  62. package/lib/peer-versions.js +137 -0
  63. package/lib/preset-choice.d.ts +13 -0
  64. package/lib/preset-choice.js +18 -1
  65. package/lib/status.js +2 -1
  66. package/lib/update-check.d.ts +2 -2
  67. package/lib/update-check.js +2 -2
  68. package/lib/wsl-doctor-command.js +4 -2
  69. package/package.json +55 -25
  70. package/scripts/doctor.mjs +127 -9
package/docs/VALUE.md ADDED
@@ -0,0 +1,173 @@
1
+ # dsh-plugin-wsl-env value proposition
2
+
3
+ [中文](VALUE.zh.md)
4
+
5
+ This page answers one question only: **why it is worth installing this plugin to work on WSL projects with DeepSeek Harness on Windows.**
6
+ Features, installation, and per-item behavior are covered in [README](../README.md) and [ARCHITECTURE.md](ARCHITECTURE.md); this page discusses benefits, costs, and applicable boundaries.
7
+ Every claim here points to evidence that can be reviewed in the repository; the baseline is v0.22.0 (2026-11-08). Earlier entries were introduced on the v0.9.0 baseline, and versions, tool surface, and the gate chain were reviewed on 2026-11-09.
8
+
9
+ > **In one sentence**: it turns a WSL distribution into the real execution environment of a DSH session — commands, files, terminals, and the directory picker all complete inside the distribution,
10
+ > while DSH's permission model and the distribution's bubblewrap sandbox are preserved; it installs no service of its own into the distribution and opens no port.
11
+
12
+ ## 1. Without it, three mismatches
13
+
14
+ DSH is a Windows desktop app, and the project lives on WSL's ext4. Without integration, three things are misaligned at once:
15
+
16
+ | Mismatch | Concrete symptom | Consequence |
17
+ |---|---|---|
18
+ | Location | The app only understands `\\wsl.localhost\<distro>\...`, while tools expect `/home/...` | Paths must be translated back and forth; the 9p share is noticeably slow with many small files; symlinks and permission bits are no longer faithful across the share layer |
19
+ | Environment | Commands execute on the Windows side | The distribution's `PATH`, `nvm`, `cargo`, `pyenv`, rc configuration, and native `rg` are all unusable; scripts either cannot find an interpreter or silently use a different binary |
20
+ | Security | The Windows sandbox's restricted token cannot reach WSL (`wsl.exe` returns `Wsl/E_ACCESSDENIED`) | Usually you can only choose one of "can operate on WSL" and "commands have boundaries" |
21
+
22
+ Available options each have a cost: installing the whole CLI inside WSL is cleanest, but DSH is a desktop app and cannot be moved there; desktop remote (VS Code Remote-WSL, ZCode and similar) is mature, but requires placing a service directory in the distribution, opening a port, and commands have no sandbox; doing nothing leaves the three mismatches above.
23
+ This plugin fills the combination beyond those three: **the app stays on Windows, the execution world moves into the distribution, and the boundary stays outside the command.**
24
+
25
+ ## 2. Six sources of value
26
+
27
+ ### Value 1: the first command is already in the right environment
28
+
29
+ **Mechanism.** When a session opens a distribution directory, `auto-preset` automatically attaches the `wsl` preset; `wsl-shell` executes `wsl.exe --exec <shell> -lc <cmd>` using the login shell configured for the distribution (it does not hard-code bash). `PATH`, version managers, and rc files therefore all take effect.
30
+
31
+ **Perceivable difference.** There is nothing to `source` first, and no need to tell the model the paths of `nvm`/`pyenv` by hand. When the model says "run the tests", it uses the same `node`, `pnpm`, and `cargo` you would use in that terminal. The first command is already correct; there is no "warm up the environment with one command first" step.
32
+
33
+ **Evidence.** [README "Using it"](../README.md#using-it); `test/shell.test.mjs`, `test/preset-choice.test.mjs`; `pnpm run probe:sandbox-shell`.
34
+
35
+ ### Value 2: files are the distribution's real files
36
+
37
+ **Mechanism.** Reads, writes, and searches land on ext4 through a resident agent: native symlinks, native mode bits, and the distribution's own `rg`. The GUI file tree and preview are likewise served from inside the distribution. Search arguments are forwarded verbatim to the distribution's `rg`; results, output format, and exit code are rg's own, and the directory's `.gitignore` is honored.
38
+
39
+ **Perceivable difference.** `chmod +x`, `ln -s`, git hooks, and tools dispatched by content behave as they do on a Linux host; `glob`/`grep` no longer cross the slow 9p bridge, nor use the Windows-side copy of rg to read Linux directories. `/home/you/x` in the folder and `\\wsl.localhost\ubuntu\home\you\x` in the GUI are the same file, not copies.
40
+
41
+ **Evidence.** [ARCHITECTURE "The filesystem substrate"](ARCHITECTURE.md#the-filesystem-substrate), [LIMITATIONS](LIMITATIONS.md); `test/search-route.test.mjs`, `test/search-exec.test.mjs`, `test/fs-substrate.test.mjs`; `pnpm run probe:substrate` (8/8). Known limits are in section 4: new files 0600, filenames containing backslashes, watch using polling.
42
+
43
+ ### Value 3: the sandbox is the default, and failure is loud
44
+
45
+ **Mechanism.** A session's restricted commands run through a `bubblewrap` mount profile inside the same systemd user scope (background processes, a real `/tmp`, visible to `ps`), and the scope stops when the session ends; the three permission tiers (`read-only` / `workspace-write` / `danger-full-access`) take effect tier by tier; file writes are checked against the same policy, and writes under restricted policies are additionally rejected by the kernel inside the bwrap configuration. When no usable bwrap exists, the command reports `SANDBOX_UNAVAILABLE` instead of running outside the sandbox.
46
+
47
+ **Perceivable difference.** Restricted commands and writes are bound by the workspace policy, but this is not complete isolation: Windows interop and other routes can still cross the Linux-side write boundary. When denied, the model receives an offer to "retry with just enough permission", not a direct request for `danger-full-access`. Auditing yields the mode actually enforced at the time and the denial reason; in configurations that explicitly pin a distribution, file tools reject cross-distribution paths with `FS_OUTSIDE_DISTRO`, and widening permissions does not lift it.
48
+
49
+ **Honest boundary.** Reporting is `enforcement: partial`, because processes inside the distribution can still launch Windows programs through interop; `maskWindowsDrive` narrows this hole (`/mnt` disappears from the restricted view), but binfmt dispatches by content, so it is still not closed; fully disabling it requires `[interop] enabled=false` at the distribution level. The plugin does not describe partial enforcement as full.
50
+
51
+ **Evidence.** [ARCHITECTURE "Sandbox"](ARCHITECTURE.md#sandbox), [SECURITY](../SECURITY.md); `test/sandbox.test.mjs`, `test/fs-decisions.test.mjs`; `pnpm run probe:sandbox`, `pnpm run probe:sandbox-off`.
52
+
53
+ ### Value 4: one process, two kinds of session, the same toolbox
54
+
55
+ **Mechanism.** The composition layer routes by path coordinate: distribution UNC paths go to the agent implementation, and drive-letter paths stay with the host backend; the GUI terminal routes by session — WSL directory sessions get the distribution shell, Windows directory sessions still get PowerShell; `wsl-shell`/`wsl-fs` are mounted at the preset layer, so the environment takes effect per session.
56
+
57
+ **Perceivable difference.** There is no separate app or profile for WSL, and no need to switch the whole app into "WSL mode". In the same window, a session that opens a Windows folder is unaffected, while a session that opens `\\wsl.localhost\...` automatically enters the distribution. Changing projects is just changing the open folder. This matters especially on the model side: the plugin adds exactly one model tool, `wsl_doctor` (plus the `/wsl-doctor` command); every other existing tool keeps its name, parameters, and return semantics — only the world it actually acts on changes.
58
+
59
+ **Evidence.** [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`.
60
+
61
+ ### Value 5: no service installed, no port opened, no residue
62
+
63
+ **Mechanism.** No service is installed in the distribution, and no port is listening; the plugin replaces DSH's service implementations and adds the `wsl_doctor` tool and the `/wsl-doctor` command. File operations and commands go through a resident agent cached per distribution — it is a transport layer, not a registered system service, and the agent script verifies sha256 during the handshake.
64
+
65
+ **Perceivable difference.** No extra directories such as `~/.vscode-server` appear, no conflict with local ports arises, and after uninstalling there is no server-side directory in the distribution left to clean up by hand. After a WSL upgrade or a distribution restart, the next call rebuilds the transport; only if the agent dies while "a request is in flight" can it exhaust its one rebuild allowance (see [LIMITATIONS](LIMITATIONS.md)) — a declared boundary, not the everyday path.
66
+
67
+ **Note the distinction.** "No service installed" is not "zero dependencies": bubblewrap is a hard dependency of the default path; the session runtime also requires systemd as PID 1 and the user manager to have `enable-linger` applied (a transient scope, not an installed resident service). ripgrep, git, and inotify-tools are checked by `pnpm run bootstrap`. The plugin does not bundle these tools, nor does it install a resident service in the distribution.
68
+
69
+ **Evidence.** [README "How it compares"](../README.md#how-it-compares); `agent/wsl-agent.sh`, `test/agent.test.mjs`; `scripts/bootstrap.sh`.
70
+
71
+ ### Value 6: the model gets facts, not guesses
72
+
73
+ **Mechanism.** The session environment exposes `DSH_WSL_DISTRO`, `DSH_WSL_SHELL`, `DSH_WSL_HOME`, and `DSH_WSL_PORTS` to the model; ports refresh on a cadence of about 10 seconds. Error codes are classified by their thrower (`FS_OUTSIDE_DISTRO`, `SANDBOX_UNAVAILABLE`, `FS_STALE_VERSION`, and so on), each stating who denied and how to resolve it. If tools are missing when a session opens, it gives the installation command for that distribution directly.
74
+
75
+ **Perceivable difference.** The model can name the exact address of the dev server it started (WSL2 forwards localhost to Windows, so a browser can open it directly); path denials, missing sandboxes, and stale files each have their own code, so troubleshooting does not begin by guessing from "the command failed". What this reduces is round trips, not merely how nice the error message looks.
76
+
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
+
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
+
92
+ ## 3. Value comparison with alternatives
93
+
94
+ | | No integration (open UNC on the Windows side) | Desktop remote (VS Code Remote-WSL, etc.) | Install the CLI inside WSL | This plugin |
95
+ |---|---|---|---|---|
96
+ | Command environment | Windows | Distribution | Distribution | Distribution |
97
+ | File semantics | 9p share, slow and loses POSIX details | Native inside the distribution | Native inside the distribution | Native inside the distribution (ext4) |
98
+ | Command sandbox | Windows sandbox cannot reach WSL | None | Depends on the CLI | In-distribution bubblewrap + systemd session scope |
99
+ | In-distribution install | None | One service directory | The whole tool | No own service (depends on system tools) |
100
+ | Port | None | Listens on one port | None | None |
101
+ | Uninstall residue | None | Manually delete the service directory | Delete the tool | None |
102
+ | Applicability | Can accept slowness and loss of semantics | Use VS Code / the corresponding desktop client | The tool can be moved entirely into WSL | Windows + DSH GUI + WSL2 |
103
+
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.**
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
+
120
+ ## 4. Costs, boundaries, and non-applicability
121
+
122
+ Value is benefit minus cost. The following should be known before installation:
123
+
124
+ - **bubblewrap is a hard dependency.** Without it the default path fails every restricted command (deliberate fail-closed); restricted file writes need it too. The session runtime also requires systemd as PID 1 and the user manager to have `enable-linger` applied; a failed preflight is refused with a repair command. `pnpm run bootstrap <distro>` checks and prints install commands.
125
+ - **enforcement is partial.** Interop lets processes inside the distribution launch Windows programs. `maskWindowsDrive` only narrows it; completely closing it requires `[interop] enabled=false` in `wsl.conf`. For scenarios that require "absolute isolation from the Windows side as well", this plugin cannot deliver.
126
+ - **Two `/tmp`s.** Under `workspace-write`, commands in the session runtime and file tools use the distribution's real `/tmp`; with the session runtime off, commands use a private tmpfs while file tools still use the real `/tmp`, and the two cannot see each other. Files crossing the boundary must go through the session workspace.
127
+ - **watch prefers inotify and falls back to polling.** For unbounded directories with `inotify-tools` installed, it uses recursive inotify, coalescing at 0.5s into coarse invalidation; for file targets, depth-limited directories, or missing tools it falls back to polling, and extreme cases such as in-place `cp -p` or unpacking that restores directory mtimes can still be missed.
128
+ - **Filenames containing backslashes cannot be addressed**, because the UNC display form is the identity. Renaming is the only workaround.
129
+ - **New files publish as 0600** (the host backend's publishing semantics); `chmod` yourself when they must be executable. Published writes survive process death, but the parent directory is not fsynced, so a machine crash may lose the rename.
130
+ - **Platform and versions.** Windows + WSL2 only; Node `^22.19.0 || >=24.0.0`; DSH peer versions declare a floor, development dependencies are pinned exactly, and upgrades must be re-validated.
131
+ - **Not suitable for.** Workflows whose CLI can be installed entirely inside WSL; editor remote capabilities (IntelliSense, debugger, extensions); enterprise-grade strong isolation or multi-tenancy; projects mainly on a Windows drive (the plugin works, but the value is not there).
132
+
133
+ These are not a "will be fixed later" list but design boundaries: each one states its reason in [LIMITATIONS.md](LIMITATIONS.md). **Writing the boundaries clearly is itself a value** — it keeps "not done" from being misread as "already done".
134
+
135
+ ## 5. How the value is proven
136
+
137
+ | Level | Evidence |
138
+ |---|---|
139
+ | Every commit | `pnpm test`: style, relative links, requirement references, documentation consistency, syntax, byte-for-byte build consistency, `tsc --noEmit`, all unit tests pass |
140
+ | Coverage | `pnpm run test:coverage`, thresholds 85/84/70 (lines/branches/functions) |
141
+ | Real machine | Probe suite (`test/probe/run-all-when-closed.sh --include-fs`), including sandbox boundary demonstrations, agent/one-shot dual-path cross-checks, the filesystem substrate, terminal, and picker |
142
+ | CI | Node 22 / 24 × Linux / Windows run `pnpm test`; coverage on Node 24 |
143
+ | Upstream seams | peer pins compared byte for byte, [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) |
144
+ | Behavior commitments | 28 registered requirements (R1–R28) and the traceability matrix in [REQUIREMENTS.zh.md](REQUIREMENTS.zh.md) |
145
+
146
+ The real-machine probe is a manual step (hosted runners have no WSL distribution); this is a recorded verification gap (OI-2 in REQUIREMENTS), not a hidden omission.
147
+
148
+ ## 6. Decision rules
149
+
150
+ **Install it if all of the following hold:**
151
+
152
+ 1. You use the DeepSeek Harness GUI on Windows;
153
+ 2. The project is on the ext4 of a WSL2 distribution, and you want the model to work with Linux paths;
154
+ 3. You want commands to have boundaries, and you accept installing bubblewrap for that.
155
+
156
+ **Do not install it if any of the following holds:**
157
+
158
+ - Your workflow is a CLI that can be installed entirely inside WSL — installing it there directly is simpler;
159
+ - You need editor-level remote capabilities (debugging, IntelliSense, extensions);
160
+ - You need absolute isolation from Windows interop as well;
161
+ - Your project is mainly on a Windows drive, and you do not need a Linux toolchain.
162
+
163
+ ## 7. Evidence index
164
+
165
+ | What you want to know | Where to look |
166
+ |---|---|
167
+ | Features, installation, configuration | [README](../README.md) / [Chinese README](README.zh.md) |
168
+ | How the pieces are mounted, path coordinates, sandbox design | [ARCHITECTURE.md](ARCHITECTURE.md) |
169
+ | What it does not do, and why | [LIMITATIONS.md](LIMITATIONS.md) |
170
+ | Every configuration key | [CONFIGURATION.md](CONFIGURATION.md) |
171
+ | Parity audit against VS Code Remote-WSL | [PARITY.md](PARITY.md) |
172
+ | Byte-for-byte contract with upstream fsio | [PEER-PARITY.md](PEER-PARITY.md) |
173
+ | Security boundaries and reporting channel | [SECURITY.md](../SECURITY.md) |
package/docs/VALUE.zh.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # dsh-plugin-wsl-env 价值说明
2
2
 
3
+ [English](VALUE.md)
4
+
3
5
  本文只回答一个问题:**在 Windows 上用 DeepSeek Harness 做 WSL 项目,为什么值得装这个插件。**
4
- 功能、安装与逐项行为见 [README](../README.md) 和 [ARCHITECTURE.md](ARCHITECTURE.md),这里谈收益、代价与适用边界。
6
+ 功能、安装与逐项行为见 [README](README.zh.md) 和 [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md),这里谈收益、代价与适用边界。
5
7
  文中每条主张都指向仓库内可复核的证据;基线为 v0.22.0(2026-11-08)。早期条目在 v0.9.0 基线上引入,2026-11-09 对版本、工具面与门禁链做了复核。
6
8
 
7
9
  > **一句话**:它把 WSL 发行版变成 DSH 会话真正的执行环境——命令、文件、终端、目录选择器都在发行版内完成,
@@ -28,7 +30,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
28
30
 
29
31
  **可感知的差别。** 不需要先 `source` 什么,也不需要把 `nvm`/`pyenv` 的路径手工告诉模型。模型说「跑一下测试」,用的就是你在那个终端里会用的 `node`、`pnpm`、`cargo`。第一条命令已经是对的,不存在「先热身一条命令把环境带起来」。
30
32
 
31
- **证据。** [README「Using it」](../README.md#using-it);`test/shell.test.mjs`、`test/preset-choice.test.mjs`;`pnpm run probe:sandbox-shell`。
33
+ **证据。** [README「使用」](README.zh.md#使用);`test/shell.test.mjs`、`test/preset-choice.test.mjs`;`pnpm run probe:sandbox-shell`。
32
34
 
33
35
  ### 价值二:文件是发行版的真实文件
34
36
 
@@ -36,7 +38,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
36
38
 
37
39
  **可感知的差别。** `chmod +x`、`ln -s`、git hook、按内容分发的工具,行为与 Linux 主机一致;`glob`/`grep` 不再跨 9p 慢桥,也不再用 Windows 侧那份 rg 去读 Linux 目录。文件夹里的 `/home/you/x` 与 GUI 里的 `\\wsl.localhost\ubuntu\home\you\x` 是同一个文件,不是副本。
38
40
 
39
- **证据。** [ARCHITECTURE「The filesystem substrate」](ARCHITECTURE.md#the-filesystem-substrate)、[LIMITATIONS](LIMITATIONS.md);`test/search-route.test.mjs`、`test/search-exec.test.mjs`、`test/fs-substrate.test.mjs`;`pnpm run probe:substrate`(8/8)。已知极限见第 4 节:新文件 0600、含反斜杠的文件名、watch 为轮询。
41
+ **证据。** [ARCHITECTURE「文件系统 substrate」](ARCHITECTURE.zh.md#文件系统-substrate)、[LIMITATIONS](LIMITATIONS.zh.md);`test/search-route.test.mjs`、`test/search-exec.test.mjs`、`test/fs-substrate.test.mjs`;`pnpm run probe:substrate`(8/8)。已知极限见第 4 节:新文件 0600、含反斜杠的文件名、watch 为轮询。
40
42
 
41
43
  ### 价值三:沙箱是默认,失败是响亮的
42
44
 
@@ -46,7 +48,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
46
48
 
47
49
  **诚实边界。** 上报是 `enforcement: partial`,因为发行版内的进程仍可通过 interop 启动 Windows 程序;`maskWindowsDrive` 收窄这个洞(`/mnt` 在受限视图里消失),但 binfmt 按内容分发,所以它仍不是闭合;完全关闭要在发行版层面设 `[interop] enabled=false`。插件不把 partial 说成 full。
48
50
 
49
- **证据。** [ARCHITECTURE「Sandbox」](ARCHITECTURE.md#sandbox)、[SECURITY](../SECURITY.md);`test/sandbox.test.mjs`、`test/fs-decisions.test.mjs`;`pnpm run probe:sandbox`、`pnpm run probe:sandbox-off`。
51
+ **证据。** [ARCHITECTURE「沙箱」](ARCHITECTURE.zh.md#沙箱)、[SECURITY](../SECURITY.zh.md);`test/sandbox.test.mjs`、`test/fs-decisions.test.mjs`;`pnpm run probe:sandbox`、`pnpm run probe:sandbox-off`。
50
52
 
51
53
  ### 价值四:一个进程,两种会话,工具箱不变
52
54
 
@@ -54,17 +56,17 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
54
56
 
55
57
  **可感知的差别。** 不需要为 WSL 单开一个应用或 profile,也不需要把整个应用切成「WSL 模式」。同一个窗口里,开 Windows 文件夹的会话不受影响,开 `\\wsl.localhost\...` 的会话自动进入发行版。换项目只是换一个打开的文件夹。模型侧尤其重要:插件只新增 `wsl_doctor` 一个模型工具(另有 `/wsl-doctor` 命令);其余现有工具的名字、参数、返回语义不变,变的只是它们实际作用的世界。
56
58
 
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`。
59
+ **证据。** [README「架构」](README.zh.md#架构)、[docs/root-fs-routing.md](root-fs-routing.md);`test/composition.test.mjs`、`test/terminal.test.mjs`、`test/fs.boot.test.mjs`。
58
60
 
59
61
  ### 价值五:不装服务、不开端口、没有残留
60
62
 
61
63
  **机制。** 发行版里没有安装任何服务,也没有监听端口;插件替换 DSH 的服务实现,并新增 `wsl_doctor` 工具与 `/wsl-doctor` 命令。文件操作与命令走发行版内按 distro 缓存的常驻 agent——它是传输层,不注册系统服务,agent 脚本在握手时校验 sha256。
62
64
 
63
- **可感知的差别。** 不会多出 `~/.vscode-server` 这类目录,不会和本机端口冲突,卸载后发行版里没有需要手动清理的服务端目录。WSL 升级或发行版重启后,下一次调用重建传输;只有 agent 在「有请求在飞」时死亡才可能耗尽它的一次重建额度(见 [LIMITATIONS](LIMITATIONS.md)),这是已声明的边界,不是日常路径。
65
+ **可感知的差别。** 不会多出 `~/.vscode-server` 这类目录,不会和本机端口冲突,卸载后发行版里没有需要手动清理的服务端目录。WSL 升级或发行版重启后,下一次调用重建传输;只有 agent 在「有请求在飞」时死亡才可能耗尽它的一次重建额度(见 [LIMITATIONS](LIMITATIONS.zh.md)),这是已声明的边界,不是日常路径。
64
66
 
65
67
  **注意区分。** 「不装服务」不等于「零依赖」:bubblewrap 是默认路径的硬依赖;会话 runtime 还需要 systemd 为 PID 1 且 user manager 已 `enable-linger`(临时 scope,不是安装的常驻服务)。ripgrep、git、inotify-tools 由 `pnpm run bootstrap` 体检。插件不把这些工具打包进来,也不在发行版里安装常驻服务。
66
68
 
67
- **证据。** [README「How it compares」](../README.md#how-it-compares);`agent/wsl-agent.sh`、`test/agent.test.mjs`;`scripts/bootstrap.sh`。
69
+ **证据。** [README「方案对比」](README.zh.md#方案对比);`agent/wsl-agent.sh`、`test/agent.test.mjs`;`scripts/bootstrap.sh`。
68
70
 
69
71
  ### 价值六:模型拿到事实,不用猜
70
72
 
@@ -72,7 +74,20 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
72
74
 
73
75
  **可感知的差别。** 模型能说出它启动的 dev server 的确切地址(WSL2 把 localhost 转发给 Windows,浏览器可直接打开);路径拒绝、沙箱缺失、文件过期各有各的码,排错不用从「命令失败了」开始猜。这减少的是往返次数,不只是错误信息的好看程度。
74
76
 
75
- **证据。** [ARCHITECTURE「Error codes」](ARCHITECTURE.md#error-codes)、[README「Troubleshooting」](../README.md#troubleshooting);`test/ports.test.mjs`、`test/preflight.test.mjs`、`test/terminal.test.mjs`。
77
+ **证据。** [ARCHITECTURE「错误码」](ARCHITECTURE.zh.md#错误码)、[README「常见问题」](README.zh.md#常见问题);`test/ports.test.mjs`、`test/preflight.test.mjs`、`test/terminal.test.mjs`。
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。
76
91
 
77
92
  ## 3. 和替代方案的价值对照
78
93
 
@@ -88,6 +103,20 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
88
103
 
89
104
  **别人更强的地方要直说。** 桌面远程重开工作区是即时的,服务常驻;VS Code 的远程有多年生产打磨。CLI 装进 WSL 则完全不需要桥接。本插件不试图在这些维度取胜,它只解决一个组合:**DSH 在 Windows 上,项目在 WSL 里,命令要有沙箱。**
90
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
+
91
120
  ## 4. 代价、边界与不适用
92
121
 
93
122
  价值是收益减代价。下面这些是安装前就该知道的:
@@ -101,7 +130,7 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
101
130
  - **平台与版本。** 仅 Windows + WSL2;Node `^22.19.0 || >=24.0.0`;DSH peer 声明版本下限,开发依赖精确钉版,升级须重新验证。
102
131
  - **不适合的情况。** 工作流本来就能整个装进 WSL 的 CLI;需要 VS Code 远程的编辑器能力(IntelliSense、调试器、扩展);需要企业级强隔离或多租户;项目主要在 Windows 盘上(插件能用,但价值不在这里)。
103
132
 
104
- 这些不是「以后会修」的清单,而是设计边界:每一条都在 [LIMITATIONS.md](LIMITATIONS.md) 里写明原因。**把边界写清楚本身也是价值**——它让「没做到」不被误读成「已经做到」。
133
+ 这些不是「以后会修」的清单,而是设计边界:每一条都在 [LIMITATIONS.zh.md](LIMITATIONS.zh.md) 里写明原因。**把边界写清楚本身也是价值**——它让「没做到」不被误读成「已经做到」。
105
134
 
106
135
  ## 5. 价值如何被证明
107
136
 
@@ -135,10 +164,10 @@ DSH 是 Windows 桌面应用,项目在 WSL 的 ext4 里。不做集成,三
135
164
 
136
165
  | 想知道 | 看 |
137
166
  |---|---|
138
- | 功能、安装、配置 | [README](../README.md) / [中文 README](README.zh.md) |
139
- | 部件如何挂载、路径坐标、沙箱设计 | [ARCHITECTURE.md](ARCHITECTURE.md) |
140
- | 不做什么、为什么 | [LIMITATIONS.md](LIMITATIONS.md) |
167
+ | 功能、安装、配置 | [中文 README](README.zh.md) / [English](../README.md) |
168
+ | 部件如何挂载、路径坐标、沙箱设计 | [ARCHITECTURE.zh.md](ARCHITECTURE.zh.md) |
169
+ | 不做什么、为什么 | [LIMITATIONS.zh.md](LIMITATIONS.zh.md) |
141
170
  | 每个配置键 | [CONFIGURATION.md](CONFIGURATION.md) |
142
171
  | 与 VS Code Remote-WSL 的 parity 审计 | [PARITY.md](PARITY.md) |
143
172
  | 与上游 fsio 的逐字节合同 | [PEER-PARITY.md](PEER-PARITY.md) |
144
- | 安全边界与上报渠道 | [SECURITY.md](../SECURITY.md) |
173
+ | 安全边界与上报渠道 | [SECURITY.zh.md](../SECURITY.zh.md) |
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 &amp; 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>
@@ -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>
@@ -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 &amp; 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>
@@ -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>
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The live state of auto-preset's creation-time preset seam.
3
+ *
4
+ * The seam is host-process state: `auto-preset` wraps
5
+ * `sessionController.agents.createSession(request)` so a distro workspace's
6
+ * very first mount is the WSL preset. Whether that method exists is a property
7
+ * of the running host, not of any file on disk — the standalone doctor CLI
8
+ * cannot see it, exactly as it cannot see a live resident's `deaths` or
9
+ * `lastError` (see doctor-live). The in-app doctor surfaces therefore read this
10
+ * module singleton and merge the state into their reports.
11
+ *
12
+ * `unknown` means the row has not mounted in this process yet (or this is a
13
+ * composition without it); `inactive` means the row mounted but the host's
14
+ * controller exposed no `agents.createSession` — the case that must not stay
15
+ * silent.
16
+ *
17
+ * @module dsh-plugin-wsl-env/auto-preset-seam
18
+ */
19
+ /** Whether the creation-time seam is available in this process. */
20
+ export type AutoPresetSeamState = "active" | "inactive" | "unknown";
21
+ /** One publication of the seam state. */
22
+ export interface AutoPresetSeam {
23
+ /** The seam's availability. */
24
+ readonly state: AutoPresetSeamState;
25
+ /** The wrapped method, when the seam is active. */
26
+ readonly method?: string;
27
+ /** Why the state is what it is, in one line. */
28
+ readonly reason: string;
29
+ /** When the state was published, in epoch milliseconds. */
30
+ readonly at: number;
31
+ }
32
+ /**
33
+ * Publish the seam state for the in-app doctor surfaces.
34
+ *
35
+ * @param state - the availability to record.
36
+ * @param reason - one line explaining the state.
37
+ * @param method - the wrapped method, when active.
38
+ */
39
+ export declare function publishAutoPresetSeam(state: AutoPresetSeamState, reason: string, method?: string): void;
40
+ /**
41
+ * Read the current seam state.
42
+ *
43
+ * @returns the last published state.
44
+ */
45
+ export declare function autoPresetSeam(): AutoPresetSeam;