dsh-wsl-bridge 0.0.0-stage → 0.4.7

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 ADDED
@@ -0,0 +1,125 @@
1
+ # Changelog
2
+
3
+ ## 0.4.7 — 2026-10-19
4
+
5
+ - A new conversation that selects WSL lists the current distribution's
6
+ folders, starting at `$HOME`, and asks which folder should become the
7
+ workspace. The folder control opens that directory instead of DSH's
8
+ `default-workspace`. The Windows path is whatever `wslpath -w` prints on
9
+ that computer. Esc closes the visit; choosing WSL again after leaving the
10
+ mode asks once more. Host-wide `wsl_*` tools still use the Windows session
11
+ directory.
12
+ - The picker keeps an opaque surface when a skin makes the app background
13
+ translucent.
14
+ - The WSL preset description is Chinese.
15
+
16
+ ## 0.4.6 — 2026-10-19
17
+
18
+ - A `WSL` session now uses the current distribution's `$HOME` as its default
19
+ workspace. The first bash command, relative paths, and grep/glob without a
20
+ path all start there instead of the Windows session directory. The home path
21
+ is read once; an explicit absolute path does not trigger the lookup. Host-wide
22
+ `wsl_*` tools still default to the session directory.
23
+
24
+ ## 0.4.5 — 2026-10-19 (unreleased)
25
+
26
+ - Fail reads when `head` fails; reject incomplete transport and invalid UTF-8
27
+ edits instead of silently changing file data. Base edit guards on the exact
28
+ bytes read and check just before rename, including deletion detection.
29
+ - Keep replacement dollar sequences literal, preserve existing file modes,
30
+ and refuse directory targets without leaving a temporary file inside them.
31
+ - Stop every command line when the requested working directory cannot be used.
32
+ Background jobs use the session directory even after a persistent shell exists.
33
+ - Search prunes hidden entries and dependency trees before scanning, preserves
34
+ single-file grep paths, anchors its status marker, reports failures, and marks
35
+ the glob scan ceiling as truncated.
36
+ - Make release dry-runs independent of login, check official-registry auth and
37
+ a clean working tree for publication, publish the packed tarball, and fail if
38
+ version verification fails. Include installation/release scripts in the pack.
39
+ - Add regression coverage and opt-in real WSL tests; fix the CI mount test's
40
+ hard-coded local path.
41
+
42
+ ## 0.4.4 — 2026-10-19
43
+
44
+ - **Fix the `WSL` preset failing to load**: the `plan-mode` row was copied
45
+ without its required `config.section`, so
46
+ `@deepseek-ai/dsh-plan-mode` refused activation and the preset showed
47
+ "load failed" in the mode picker while the rest of the plugin worked. The
48
+ shipped standard preset's section text is now carried verbatim; the roster
49
+ probe reports `wsl: broken=null`.
50
+ - Add the preset-roster diagnostic recipe used to find it (see docs/TROUBLESHOOTING.md).
51
+
52
+ ## 0.4.3 — 2026-10-19
53
+
54
+ - Self-check wording: a probe has no live agent, so the job registry's refusal
55
+ now reads as "registry reachable" instead of an error line.
56
+
57
+ ## 0.4.2 — 2026-10-19
58
+
59
+ - **Fix persistent `cd`**: the bash tools passed the session directory as the
60
+ working directory on every call, which reset the persistent shell's cwd. The
61
+ default workdir is now only the shell's initial directory; an explicit
62
+ `workdir` still changes it for this and later calls. Verified in a real
63
+ desktop session (env vars persisted, cwd now does too) and pinned by the
64
+ integration self-check (`tool cd persistence=OK`).
65
+
66
+ ## 0.4.1 — 2026-10-19
67
+
68
+ - Opt-in real background-job self-check (registers a job with the host registry
69
+ and verifies the command actually wrote its file inside the distribution).
70
+
71
+ ## 0.4.0 — 2026-10-19
72
+
73
+ - Add `runInBackground` to `wsl_bash` and the WSL preset's `bash`: the command is
74
+ registered with the host job registry (`job_output` / `job_kill`) and owns its
75
+ own `wsl.exe` process, so the persistent shell's lifecycle cannot kill it.
76
+ Controlled by `backgroundJobs` (default on); refuses clearly when the
77
+ deployment composes no job registry.
78
+ - The destructive guard runs before a background registration.
79
+ - Tests: 87 cases total.
80
+
81
+ ## 0.3.0 — 2026-10-19
82
+
83
+ - Add a deterministic destructive-command guard (`dangerGuard`, default on):
84
+ recursive deletes, block-device writes, power control, `find -delete` and
85
+ `git clean -f/-d/-x` are refused unless the call passes `allowDangerous: true`.
86
+ Applied to both `wsl_bash` and the WSL preset's `bash`.
87
+ - Add `docs/ARCHITECTURE.md`, `docs/SECURITY.md`, `docs/TROUBLESHOOTING.md`.
88
+ - Add `npm test` (78 cases), a CI workflow (Windows, Node 22/24), and
89
+ `scripts/install-desktop.ps1`.
90
+ - Desktop-composition smoke test: an isolated profile replicating the desktop
91
+ bundle set (web-all / market / better-sidebar) boots with both bridge layers
92
+ active.
93
+
94
+ ## 0.2.3 — 2026-10-19
95
+
96
+ - Packaging for publish: MIT LICENSE, bilingual `locale/*.json` display metadata,
97
+ SVG icon, CHANGELOG, and a publish-shaped `files` list; `npm pack` yields 20
98
+ files / ~37 KB with no build step.
99
+ - Fix the integration-test hooks: environment variables (`DSH_WSL_BRIDGE_SELFCHECK`,
100
+ `DSH_WSL_BRIDGE_MARKER`, `DSH_WSL_BRIDGE_WORLD_*`) now override the shipped row
101
+ config instead of being overridden by it.
102
+ - Dispose the shells the self-checks open, so a probe run leaves no `wsl.exe`
103
+ processes behind.
104
+ - Verified a **packed** install (tarball into a fresh isolated profile, not a
105
+ link): host tools mount, the `WSL` preset mounts, and bash/grep/glob execute in
106
+ the distribution.
107
+
108
+ ## 0.2.0 — 2026-10-19
109
+
110
+ - Add the declarative `WSL` agent preset: a session created in this mode mounts
111
+ `dsh-wsl-bridge/wsl-world`, so `bash`, `read`, `write`, `edit`, `grep` and
112
+ `glob` all operate on Linux paths inside the distribution.
113
+ - Add in-distribution `grep` (GNU grep -E) and `glob` (find + glob matching),
114
+ pruning hidden entries and `node_modules`/VCS metadata.
115
+ - Capture the `subprocess` service during `apply()`: a preset mount context is
116
+ inactive after activation, so a late `ctx.subprocess` lookup now never throws.
117
+ - Persona sentence tells the model its working directory is inside WSL and that
118
+ Windows files live under `/mnt/<drive>`.
119
+
120
+ ## 0.1.0 — 2026-10-19
121
+
122
+ - First host-only build: persistent `wsl_bash` (one shell per session, `cd`
123
+ survives between calls), binary-safe `wsl_read`/`wsl_write`, sha256-fenced
124
+ `wsl_edit`, `wsl_path`, `wsl_env`, and a default-on routing prompt section.
125
+ - Zero dependencies, no build step; opt-in self-check for integration testing.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-wsl-bridge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,128 @@
1
+ # dsh-wsl-bridge
2
+
3
+ [中文](README.md)
4
+
5
+ A native WSL (Linux) execution surface for [DSH](https://github.com/deepseek-ai/DeepSeek-Harness) on Windows. It starts no extra web server and installs nothing inside the distribution. Windows sessions and WSL sessions share one desktop app.
6
+
7
+ Version **0.4.7**. Requires **Windows**, a working WSL distribution, and **DSH `>= 0.2.1-rc.2`**. Source: <https://github.com/TGWgulugu/dsh-wsl-bridge>
8
+
9
+ ## Install
10
+
11
+ The plugin is published on npm as [dsh-wsl-bridge](https://www.npmjs.com/package/dsh-wsl-bridge). Run this in a normal terminal, not inside a DSH tool sandbox. DSH installs that npm package. If `dsh` is not on `PATH`, use the full path to the `dsh.cmd` that ships with DSH Desktop.
12
+
13
+ ```powershell
14
+ dsh plugin --profile desktop add dsh-wsl-bridge
15
+ ```
16
+
17
+ To install the source in this repository instead of the npm release:
18
+
19
+ ```powershell
20
+ dsh plugin --profile desktop add .
21
+ ```
22
+
23
+ From the repository root, `pwsh -File scripts/install-desktop.ps1` does the same. Quit DSH Desktop from the tray and open it again. A page refresh does not load the plugin.
24
+
25
+ After the restart:
26
+
27
+ - Every session gains `wsl_bash`, `wsl_read`, `wsl_write`, `wsl_edit`, `wsl_path`, and `wsl_env`.
28
+ - The new-session mode picker has a **WSL** entry.
29
+
30
+ Uninstall:
31
+
32
+ ```powershell
33
+ dsh plugin --profile desktop remove dsh-wsl-bridge
34
+ ```
35
+
36
+ If the app then fails to start, run `pnpm install` in that profile directory.
37
+
38
+ ## Two ways to use it
39
+
40
+ ### WSL tools in any session
41
+
42
+ These tools are added beside the Windows shell and file tools. They do not replace them.
43
+
44
+ | Tool | What it does |
45
+ |---|---|
46
+ | `wsl_bash` | Runs bash in WSL. One persistent shell per session, so `cd` and `export` survive. Output ends with `[exit code: N]` |
47
+ | `wsl_read` | Reads a Linux path, with optional line `offset` / `limit` |
48
+ | `wsl_write` | Atomically writes a Linux path. `expectedSha256` refuses the write when the file changed after you read it |
49
+ | `wsl_edit` | Replaces a string. A sha256 check ties the write to the bytes that were read |
50
+ | `wsl_path` | Converts Windows paths to Linux paths and back. Uses the distribution's `wslpath` when it can |
51
+ | `wsl_env` | Reports the distribution, kernel, user, and whether node / python3 / git are present |
52
+
53
+ A routing note is on by default: for Linux work, prefer `wsl_bash` and Linux paths; Windows files are at `/mnt/<drive>`. It does not hide or disable the host tools.
54
+
55
+ `wsl_bash` accepts `runInBackground: true`. The command is registered as a host job (`job_output` to read it, `job_kill` to stop it) and owns a separate WSL process. It does not inherit the persistent shell's `cd` or `export`, and it is not killed when that shell exits.
56
+
57
+ ### WSL session mode
58
+
59
+ Choose **WSL** when creating a session. In that session, `bash`, `read`, `write`, `edit`, `grep`, and `glob` run inside Linux and take Linux paths. Persona, skills, goals, plan mode, compaction, subagents, todos, web, and present stay the standard DSH set.
60
+
61
+ **You choose the workspace inside the current distribution.** On a new conversation, selecting WSL lists that distribution's folders, starting at `$HOME`. Open a subfolder or go up a level, then confirm with "Use this folder". The chosen directory is whatever `wslpath -w` prints on that computer. No distribution name or username is built into the plugin. The folder control opens that directory instead of DSH's `default-workspace`.
62
+
63
+ Esc or Cancel closes the window for this visit only. Switch the mode away from WSL and back to WSL, and the window asks again. After the first message, DSH no longer allows a mode change, so the window does not return in that conversation.
64
+
65
+ The first `bash`, relative paths, and `grep` / `glob` without a `path` start in the folder you chose. Pass `/mnt/<drive>/...` when the search should cover a Windows directory. The `wsl_*` tools above do not use this window; they keep using the current Windows session directory.
66
+
67
+ | Tool | What it does |
68
+ |---|---|
69
+ | `bash` | Persistent bash in the distribution. The syntax is bash, not PowerShell |
70
+ | `read` / `write` / `edit` | Linux paths. Relative paths are relative to the folder you chose |
71
+ | `grep` | GNU grep in the distribution. Rows look like `path:line: text`. Omitting `path` searches the folder you chose |
72
+ | `glob` | Lists files matching a glob, oldest first. Omitting `path` lists the folder you chose |
73
+ | `wsl_env` | Distribution facts |
74
+
75
+ The folder list starts at `$HOME` and shows one level of directories. Text that a login profile prints is not treated as a path. If the lookup fails, the Windows session directory is not opened instead. The picker uses an opaque surface, so a skin that makes the app background translucent does not show through it.
76
+
77
+ ## Configuration
78
+
79
+ Set these on the plugin row `config` (`cordis.patch.yml`, or a profile patch that overrides it). Every field is optional.
80
+
81
+ | Field | Default | Meaning |
82
+ |---|---|---|
83
+ | `distro` | `''` | Distribution name. An empty string uses the system default |
84
+ | `timeoutMs` | `120000` | Default deadline for `bash` / `wsl_bash`, in milliseconds |
85
+ | `fileTimeoutMs` | `30000` | Deadline for one read, write, or search |
86
+ | `maxFileBytes` | `2097152` | Maximum bytes `read` / `edit` will load |
87
+ | `defaultWorkdir` | `session` | For the host `wsl_*` tools, `session` is the current Windows session directory. In WSL mode, `session` is the folder you chose. `home` uses the distribution's `$HOME`. An absolute Linux path is also accepted |
88
+ | `dangerGuard` | `true` | Refuses obviously destructive commands unless that call passes `allowDangerous: true` |
89
+ | `backgroundJobs` | `true` | Allows `runInBackground`. Refuses clearly when the host has no job registry |
90
+ | `promptSection` | `true` | Adds the routing note to host sessions |
91
+ | `promptOrder` | `3260` | Sort order of that note |
92
+ | `promptText` | `''` | Replaces the built-in routing note. Empty keeps the built-in text |
93
+ | `selfCheck` | `false` | Probes WSL once on mount. `DSH_WSL_BRIDGE_SELFCHECK=1` does the same |
94
+ | `selfCheckMarker` | `''` | Appends the probe result to this file. Or set `DSH_WSL_BRIDGE_MARKER` |
95
+
96
+ The refusal list covers recursive deletes, block-device writes, power control, `find -delete`, and `git clean -fdx`. It is a fixed list, not a kernel boundary. A different spelling can still get through.
97
+
98
+ ## Limits
99
+
100
+ - Windows only. Both rows disable themselves on any other host.
101
+ - The tools run through `wsl.exe` and are **not** inside DSH's Windows file sandbox. Treat them as able to write anything that WSL user can write, including Windows paths reached through `/mnt/<drive>`. See [docs/SECURITY.md](docs/SECURITY.md).
102
+ - `grep` / `glob` use GNU grep and find. They do not read `.gitignore`. Hidden files, `node_modules`, and VCS metadata are skipped.
103
+ - On a new conversation, WSL mode asks which folder inside the distribution should be the workspace. The folder control opens that directory. Skills and file references follow it. Esc closes that visit; leaving WSL mode and choosing it again asks once more. A conversation that has already started cannot change mode.
104
+ - The first call waits for the distribution to start and can take several seconds. `timeoutMs` defaults to 120 seconds.
105
+ - This plugin does not install Node or any other toolchain inside the distribution.
106
+
107
+ ## Docs
108
+
109
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): how the host tools and the WSL mode are split, and why shell / fs services are left alone.
110
+ - [docs/SECURITY.md](docs/SECURITY.md): the sandbox boundary, and what the destructive-command guard does not promise.
111
+ - [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md): nothing showed up, `EPERM`, a missing mode, cold start, uninstall.
112
+
113
+ ## Development
114
+
115
+ ```powershell
116
+ npm test
117
+ npm run test:integration
118
+ pwsh -NoProfile -File test/release.test.ps1
119
+ pwsh -File scripts/release.ps1 -DryRun
120
+ ```
121
+
122
+ `npm test` does not need WSL. `npm run test:integration` runs inside a real distribution and deletes its own temporary directory. The release-script check does not publish. A real publish needs a clean git tree, then `pwsh -File scripts/release.ps1`.
123
+
124
+ The code is plain ESM with no build. `index.js` registers the host tools, `wsl-world.js` registers WSL session mode, and the implementation is in `src/`.
125
+
126
+ ## License
127
+
128
+ [MIT](LICENSE)
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # dsh-wsl-bridge
2
+
3
+ [English](README.en.md)
4
+
5
+ 在 Windows 上给 [DSH](https://github.com/deepseek-ai/DeepSeek-Harness) 一个原生的 WSL(Linux)执行面。不额外启动 web 服务,也不在 WSL 里安装 dsh。Windows 会话和 WSL 会话在同一个桌面端里使用。
6
+
7
+ 当前版本 **0.4.7**。需要 **Windows**、一个可用的 WSL 发行版,以及 **DSH `>= 0.2.1-rc.2`**。源码:<https://github.com/TGWgulugu/dsh-wsl-bridge>
8
+
9
+ ## 安装
10
+
11
+ 插件已发布到 npm:[dsh-wsl-bridge](https://www.npmjs.com/package/dsh-wsl-bridge)。在普通终端里执行下面的命令,DSH 会从 npm 安装这个包。不要在 DSH 会话的工具沙箱里跑。`dsh` 不在 PATH 上时,换成 Desktop 自带的 `dsh.cmd` 完整路径。
12
+
13
+ ```powershell
14
+ dsh plugin --profile desktop add dsh-wsl-bridge
15
+ ```
16
+
17
+ 要装本仓库里的源码,而不是 npm 上的版本时:
18
+
19
+ ```powershell
20
+ dsh plugin --profile desktop add .
21
+ ```
22
+
23
+ 也可以在仓库根目录运行 `pwsh -File scripts/install-desktop.ps1`。装完后从托盘**完全退出** DSH Desktop,再打开。刷新页面不够。
24
+
25
+ 重启后:
26
+
27
+ - 任意会话里出现 `wsl_bash`、`wsl_read`、`wsl_write`、`wsl_edit`、`wsl_path`、`wsl_env`。
28
+ - 新建会话的模式选择器里出现 **WSL**。
29
+
30
+ 卸载:
31
+
32
+ ```powershell
33
+ dsh plugin --profile desktop remove dsh-wsl-bridge
34
+ ```
35
+
36
+ 如果卸载后应用起不来,在该 profile 目录里执行一次 `pnpm install`。
37
+
38
+ ## 两种用法
39
+
40
+ ### 任意会话里的 WSL 工具
41
+
42
+ 这些工具加在现有会话上,不替换 Windows 自己的 shell 和文件工具。
43
+
44
+ | 工具 | 作用 |
45
+ |---|---|
46
+ | `wsl_bash` | 在 WSL 里执行 bash。每个会话一个持久 shell,`cd` 和 `export` 会保留。输出以 `[exit code: N]` 结尾 |
47
+ | `wsl_read` | 读 Linux 路径,支持按行 `offset` / `limit` |
48
+ | `wsl_write` | 原子写入 Linux 路径。可带 `expectedSha256`,文件在你读过之后被改过就拒绝写入 |
49
+ | `wsl_edit` | 按字符串替换。读和写之间用 sha256 核对内容 |
50
+ | `wsl_path` | Windows 路径和 Linux 路径互转。优先用发行版里的 `wslpath` |
51
+ | `wsl_env` | 查看发行版、内核、用户和是否有 node / python3 / git |
52
+
53
+ 默认有一段路由提示:Linux 上的工作优先用 `wsl_bash` 和 Linux 路径,Windows 文件在 `/mnt/<盘符>`。它不隐藏、也不禁用宿主工具。
54
+
55
+ `wsl_bash` 可以传 `runInBackground: true`。命令会登记成宿主后台任务,用 `job_output` 看输出、用 `job_kill` 停止。这个任务独占一个 WSL 进程:不继承持久 shell 的 `cd` / `export`,会话 shell 退出时也不会把它杀掉。
56
+
57
+ ### WSL 会话模式
58
+
59
+ 新建会话时选择 **WSL**。这一会话里的 `bash`、`read`、`write`、`edit`、`grep`、`glob` 都在 Linux 里执行,参数是 Linux 路径。persona、skill、goal、plan、compaction、subagent、todo、web、present 仍用 DSH 标准会话的那一套。
60
+
61
+ **工作区由你在当前发行版里选定。** 新建对话并选中 WSL 后,窗口从 `$HOME` 列出该发行版的文件夹。可以进入子文件夹,也可以回到上一级,然后用「使用此文件夹」确认。选中的目录用这台电脑上的 `wslpath -w` 现查,不写死发行版名或用户名。右上角的文件夹按钮打开这个目录,而不是 DSH 自带的 `default-workspace`。
62
+
63
+ 按 Esc 或「取消」只关掉这一次。把模式从 WSL 换走,再选回 WSL,窗口会再出现。对话一旦发出第一条消息,DSH 就不再允许更换模式,这个窗口也不会在那条对话里再次出现。
64
+
65
+ 第一次 `bash`、相对路径,以及不传 `path` 的 `grep` / `glob`,都从你选的目录开始。要搜 Windows 目录时,显式传入 `/mnt/<盘符>/...`。上面的 `wsl_*` 工具不走这个窗口,仍使用当前 Windows 会话目录。
66
+
67
+ | 工具 | 作用 |
68
+ |---|---|
69
+ | `bash` | 发行版里的持久 bash,语法是 bash,不是 PowerShell |
70
+ | `read` / `write` / `edit` | 读写 Linux 路径。相对路径相对你选的工作区 |
71
+ | `grep` | 发行版内的 GNU grep。结果是 `path:line: text`。不传 `path` 时搜你选的工作区 |
72
+ | `glob` | 按 glob 列出文件,旧文件在前。不传 `path` 时列你选的工作区 |
73
+ | `wsl_env` | 发行版信息 |
74
+
75
+ 目录列表从 `$HOME` 开始,只列出这一层的文件夹。登录脚本如果往标准输出打字,不会被当成路径。查不到目录时,不会改去打开 Windows 会话目录。选择窗口使用不透明底色,不跟随会把背景透出来的皮肤。
76
+
77
+ ## 配置
78
+
79
+ 改插件行的 `config`(`cordis.patch.yml`,或 profile 里覆盖它的补丁)。字段都可以省略。
80
+
81
+ | 字段 | 默认 | 说明 |
82
+ |---|---|---|
83
+ | `distro` | `''` | 发行版名。空字符串表示系统默认发行版 |
84
+ | `timeoutMs` | `120000` | `bash` / `wsl_bash` 的默认时限(毫秒) |
85
+ | `fileTimeoutMs` | `30000` | 读、写、搜索的单次时限(毫秒) |
86
+ | `maxFileBytes` | `2097152` | `read` / `edit` 最多读取的字节数 |
87
+ | `defaultWorkdir` | `session` | 宿主 `wsl_*` 工具的 `session` 是当前 Windows 会话目录。WSL 模式的 `session` 是你选的工作区。`home` 使用当前发行版的 `$HOME`。也可以填绝对 Linux 路径 |
88
+ | `dangerGuard` | `true` | 拒绝明显的破坏性命令,除非该次调用带 `allowDangerous: true` |
89
+ | `backgroundJobs` | `true` | 是否允许 `runInBackground`。宿主没有任务注册表时会明确拒绝 |
90
+ | `promptSection` | `true` | 是否加入宿主会话的路由提示 |
91
+ | `promptOrder` | `3260` | 这段提示的排序 |
92
+ | `promptText` | `''` | 用来替换内置路由提示。空字符串表示用内置文本 |
93
+ | `selfCheck` | `false` | 挂载时探测一次 WSL。也可以设环境变量 `DSH_WSL_BRIDGE_SELFCHECK=1` |
94
+ | `selfCheckMarker` | `''` | 把探测结果追加到这个文件。也可以设 `DSH_WSL_BRIDGE_MARKER` |
95
+
96
+ 破坏性命令清单包括递归删除、写块设备、关机、`find -delete`、`git clean -fdx`。这是固定名单,不是内核隔离;换一种写法仍可能绕过。
97
+
98
+ ## 边界
99
+
100
+ - 只支持 Windows。其他系统上这两行配置会禁用。
101
+ - 工具通过 `wsl.exe` 执行,**不受** DSH 的 Windows 文件沙箱约束。把它看成:发行版里该用户能写的路径,以及通过 `/mnt/<盘符>` 能碰到的 Windows 路径,都可以写。详见 [docs/SECURITY.md](docs/SECURITY.md)。
102
+ - `grep` / `glob` 使用 GNU grep 和 find,不读 `.gitignore`。隐藏文件、`node_modules` 和版本库元数据会跳过。
103
+ - 新建对话选中 WSL 后,从当前发行版里选工作区。右上角的文件夹按钮打开这个目录。技能和文件引用跟着这个工作区走。Esc 只关闭这一次;换走模式再选回 WSL 会再问一次。已开始的对话不能再改模式。
104
+ - 第一次调用要等发行版冷启动,可能要数秒。`timeoutMs` 默认 120 秒。
105
+ - 本插件不在发行版里安装 Node 或其他工具链。
106
+
107
+ ## 文档
108
+
109
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md):宿主工具和 WSL 模式怎么分层,以及为什么不替换 shell / fs 服务。
110
+ - [docs/SECURITY.md](docs/SECURITY.md):沙箱边界和危险命令守卫做不到什么。
111
+ - [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md):装完没出现、`EPERM`、模式缺失、冷启动、卸载。
112
+
113
+ ## 开发
114
+
115
+ ```powershell
116
+ npm test
117
+ npm run test:integration
118
+ pwsh -NoProfile -File test/release.test.ps1
119
+ pwsh -File scripts/release.ps1 -DryRun
120
+ ```
121
+
122
+ `npm test` 不需要 WSL。`npm run test:integration` 会在真实 WSL 里跑,并删掉自己的临时目录。发布脚本的检查不会真的发布。正式发布要先提交干净的工作区,再执行 `pwsh -File scripts/release.ps1`。
123
+
124
+ 代码是纯 ESM,没有构建步骤。`index.js` 注册宿主工具,`wsl-world.js` 注册 WSL 会话模式,实现在 `src/`。
125
+
126
+ ## 许可证
127
+
128
+ [MIT](LICENSE)