dsh-wsl-tool 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PUBLISHING.md +11 -2
- package/README.md +66 -3
- package/README.zh-CN.md +53 -4
- package/cordis.patch.yml +40 -2
- package/package.json +2 -2
package/PUBLISHING.md
CHANGED
|
@@ -61,10 +61,11 @@ both that the entry stays relative and that it resolves.
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
`npm run sync` defaults to
|
|
64
|
-
`%USERPROFILE%/.dsh/profiles/
|
|
64
|
+
`%USERPROFILE%/.dsh/profiles/desktop/node_modules/dsh-wsl` — the folder the
|
|
65
65
|
profile's dependency key created, which need not match the npm name. Pass a
|
|
66
66
|
path to target another profile. Restart DSH afterwards: the plugin is imported
|
|
67
|
-
once at load.
|
|
67
|
+
once at load. A patch change (the tool row, or the sidebar terminal override)
|
|
68
|
+
is read at composition time, so it needs that restart too.
|
|
68
69
|
|
|
69
70
|
3. The tag runs the pipeline. The order is deliberate — the release asset goes
|
|
70
71
|
**first** because it is the market's critical path, then npm, so a failing npm
|
|
@@ -100,6 +101,14 @@ both that the entry stays relative and that it resolves.
|
|
|
100
101
|
artifact, not just the metadata. Scripted requests to `npmjs.com`'s HTML hit a
|
|
101
102
|
Cloudflare challenge; the registry API is the source of truth.
|
|
102
103
|
|
|
104
|
+
Expect the registry's caches to lag a publish by minutes, and to lag
|
|
105
|
+
*inconsistently*: the full packument, the abbreviated (install) packument,
|
|
106
|
+
`/-/package/<name>/dist-tags` and the tarball URL each cache separately, so one
|
|
107
|
+
endpoint can already report the new version while `npm install` still answers
|
|
108
|
+
`404` for its tarball. Re-query instead of concluding the publish failed, and
|
|
109
|
+
cache-bust the tarball URL (`?cb=<random>`) to tell a stale negative entry apart
|
|
110
|
+
from an artifact that is genuinely missing.
|
|
111
|
+
|
|
103
112
|
**Market asset** (this is what users install, and it is independent of npm):
|
|
104
113
|
|
|
105
114
|
```sh
|
package/README.md
CHANGED
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
A model-facing **WSL** tool plugin for DeepSeek Harness (DSH). It lets an agent run
|
|
5
|
+
A model-facing **WSL** tool plugin for DeepSeek Harness (DSH). It lets an agent run
|
|
6
|
+
Linux commands through `wsl.exe` directly — no hand-written `.sh` scripts or `pwsh`
|
|
7
|
+
wrappers — and for command execution it essentially matches a native Linux DSH: a
|
|
8
|
+
real Linux kernel and bash, exit codes and signals, timeouts, truncation with spill
|
|
9
|
+
files, background jobs the built-in job tools read back, stdin, and automatic
|
|
10
|
+
Windows/WSL path translation.
|
|
11
|
+
|
|
12
|
+
Two limits are worth knowing before you rely on it. A `wsl` call runs below DSH's
|
|
13
|
+
sandbox, so a file policy does not confine it (see [Sandboxing](#sandboxing)); and a
|
|
14
|
+
project kept on a Windows drive keeps **Windows** filesystem semantics — no POSIX
|
|
15
|
+
permissions, case-insensitive names, no file-change notifications — at a fraction
|
|
16
|
+
of the speed (see [Notes](#notes)).
|
|
6
17
|
|
|
7
18
|
## Tools
|
|
8
19
|
|
|
@@ -123,6 +134,44 @@ A background job is owned by the calling session (`owner: exec.agent.id`), which
|
|
|
123
134
|
is what lets the model read it back with `job_output`/`job_kill` and what keeps
|
|
124
135
|
other sessions out; an execution with no agent starts the job unowned.
|
|
125
136
|
|
|
137
|
+
## A WSL terminal in the sidebar
|
|
138
|
+
|
|
139
|
+
Installing this plugin also gives the desktop app's sidebar terminal a **WSL**
|
|
140
|
+
shell. `cordis.patch.yml` overrides the composed `terminal-controller` row, whose
|
|
141
|
+
configured shell is listed **first** and selected by default; the shells that row
|
|
142
|
+
discovers (`powershell`, `cmd`, `bash`, …) stay selectable, so 新建终端 offers WSL
|
|
143
|
+
next to them.
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
- id: terminal-controller
|
|
147
|
+
config:
|
|
148
|
+
shell:
|
|
149
|
+
path: 'C:\Windows\System32\wsl.exe'
|
|
150
|
+
name: WSL
|
|
151
|
+
args: ['-e', 'bash', '-l']
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- No distribution is pinned, so `wsl.exe` follows the system default — the same
|
|
155
|
+
rule the tools use when `DSH_WSL_DISTRO` is unset.
|
|
156
|
+
- The session workspace is a Windows path that `wsl.exe` translates, so the
|
|
157
|
+
terminal opens in `/mnt/<drive>/…` exactly like the Windows shells do; and it is
|
|
158
|
+
a real PTY (`xterm-256color`), so full-screen programs work.
|
|
159
|
+
- **Pinning a distribution, or choosing a different default, is a later patch
|
|
160
|
+
layer** — a profile's own `cordis.patch.yml` wins over this bundle:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
- id: terminal-controller
|
|
164
|
+
config:
|
|
165
|
+
shell:
|
|
166
|
+
path: 'C:\Windows\System32\wsl.exe'
|
|
167
|
+
name: WSL
|
|
168
|
+
args: ['-d', 'Ubuntu-22.04', '-e', 'bash', '-l']
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
An id-targeted patch replaces that row's whole config, so restate anything else
|
|
172
|
+
you had set on it.
|
|
173
|
+
- Applies at the next app start.
|
|
174
|
+
|
|
126
175
|
## `wsl` parameters
|
|
127
176
|
|
|
128
177
|
| Param | Required | Type | Notes |
|
|
@@ -184,7 +233,21 @@ takes effect on restart.
|
|
|
184
233
|
workspace: /mnt/d/DSHworkarea (Windows drive mount /mnt/d — builds, installs and git are much slower here; prefer a path under /home when it matters)
|
|
185
234
|
```
|
|
186
235
|
|
|
187
|
-
It is worth believing. Measured on the author's machine: a 128 MB sequential write
|
|
236
|
+
It is worth believing. Measured on the author's machine: a 128 MB sequential write
|
|
237
|
+
ran at ~2.1 GB/s on ext4 against ~247 MB/s on `/mnt/d`, and creating 400 small
|
|
238
|
+
files took under 10 ms against 0.72 s (a later re-run: 884 vs 116 MB/s, and 13 ms
|
|
239
|
+
against 745 ms — the ratios hold at roughly 8× and 50×).
|
|
240
|
+
|
|
241
|
+
It is not only slower. `/mnt/<drive>` is a 9p (drvfs) mount, so it keeps **Windows**
|
|
242
|
+
filesystem semantics: `chmod`/`chown` do not stick (a `chmod 600` reads back as
|
|
243
|
+
`777`), names are case-insensitive (so a case-sensitive import only fails on Linux
|
|
244
|
+
CI), symlinks and the executable bit are synthetic, and **inotify does not work at
|
|
245
|
+
all** — a watcher inside the distro receives no events for writes from either side
|
|
246
|
+
(measured with an inotify probe on `/mnt/d`: zero events for a Windows-side write
|
|
247
|
+
and for a Linux-side write, while the same probe on ext4 reported create, modify
|
|
248
|
+
and close-write). Dev servers, `--watch` modes and file-watching tests are
|
|
249
|
+
therefore blind on a Windows drive. Keep a project under `/home` when it matters:
|
|
250
|
+
it recovers real semantics, real watch events, and the speed above.
|
|
188
251
|
- Destructive commands are refused unless the call passes `allowDangerous: true`:
|
|
189
252
|
- **any recursive delete** — `rm -r`, `rm -rf`, `rm -r -f`, `rm -R --force`, `rm --recursive` — because with stdin on `/dev/null` nothing prompts, so `rm -r tree` deletes silently. Each `rm` invocation is judged on its own command segment, so `rm a -f; rm b -r` cannot combine into a pass;
|
|
190
253
|
- `dd` onto a block device, `mkfs`, partitioning/wiping tools (`fdisk`, `parted`, `wipefs`, `mkswap`, …), power control (`shutdown`, `reboot`, `systemctl reboot`, …), redirection onto a block device, and fork bombs;
|
|
@@ -317,7 +380,7 @@ A `file:` dependency is a **copy**, so editing this checkout does not change wha
|
|
|
317
380
|
DSH loads. After any change:
|
|
318
381
|
|
|
319
382
|
```sh
|
|
320
|
-
npm run sync # copies into ~/.dsh/profiles/
|
|
383
|
+
npm run sync # copies into ~/.dsh/profiles/desktop/node_modules/dsh-wsl
|
|
321
384
|
npm run sync -- /path/to/profiles/<profile>/node_modules/<your-key>
|
|
322
385
|
```
|
|
323
386
|
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
面向模型(model-facing)的 **WSL** 工具插件,用于 DeepSeek Harness(DSH)。它让智能体直接通过
|
|
5
|
+
面向模型(model-facing)的 **WSL** 工具插件,用于 DeepSeek Harness(DSH)。它让智能体直接通过
|
|
6
|
+
`wsl.exe` 执行 Linux 命令——无需手写 `.sh` 脚本或 `pwsh` 包装——并且在**命令执行**这一层基本对齐
|
|
7
|
+
Linux 原生 DSH:真实的 Linux 内核与 bash、退出码与信号、超时、截断与落盘、可用内置 job 工具读回的
|
|
8
|
+
后台作业、stdin,以及 Windows/WSL 路径自动转换。
|
|
9
|
+
|
|
10
|
+
有两点限制值得在依赖它之前知道:`wsl` 调用位于 DSH 沙箱层之下,文件策略约束不到它
|
|
11
|
+
(见[沙箱边界](#沙箱边界));项目放在 Windows 盘上时仍是 **Windows** 的文件系统语义——没有 POSIX
|
|
12
|
+
权限位、文件名大小写不敏感、收不到文件变更通知——速度也低一个数量级(见[注意事项](#注意事项))。
|
|
6
13
|
|
|
7
14
|
## 工具
|
|
8
15
|
|
|
@@ -109,6 +116,39 @@ DSH_SUBPROCESS_LOCAL=/path/to/dsh/node_modules npm run test:real
|
|
|
109
116
|
`job_output`/`job_kill` 读回它的依据,也是其他会话读不到它的围栏;exec 里没有 agent 时
|
|
110
117
|
任务则是无主的。
|
|
111
118
|
|
|
119
|
+
## 在侧边栏开一个 WSL 终端
|
|
120
|
+
|
|
121
|
+
装了这个插件,桌面版侧边栏终端就多出一个 **WSL** shell:插件的 `cordis.patch.yml` 覆盖组合里的
|
|
122
|
+
`terminal-controller` 行,而该行配置的 shell 会排在**第一位**并成为默认;它由 `shellCandidates`
|
|
123
|
+
发现的 `powershell`/`cmd`/`bash` 等仍然可选,所以「新建终端」里 WSL 与它们并列。
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
- id: terminal-controller
|
|
127
|
+
config:
|
|
128
|
+
shell:
|
|
129
|
+
path: 'C:\Windows\System32\wsl.exe'
|
|
130
|
+
name: WSL
|
|
131
|
+
args: ['-e', 'bash', '-l']
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- **不锁定发行版**:`wsl.exe` 跟随系统默认,与工具在未设 `DSH_WSL_DISTRO` 时的规则一致。
|
|
135
|
+
- 会话工作区是 Windows 路径,`wsl.exe` 会自动翻译,因此终端像 Windows shell 一样落在
|
|
136
|
+
`/mnt/<盘>/…`;而且是**真 PTY**(`xterm-256color`),全屏程序可用。
|
|
137
|
+
- **要锁定发行版或换默认 shell**,在更靠后的 patch 层里重述该行即可 —— profile 自己的
|
|
138
|
+
`cordis.patch.yml` 优先于本组合包:
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
- id: terminal-controller
|
|
142
|
+
config:
|
|
143
|
+
shell:
|
|
144
|
+
path: 'C:\Windows\System32\wsl.exe'
|
|
145
|
+
name: WSL
|
|
146
|
+
args: ['-d', 'Ubuntu-22.04', '-e', 'bash', '-l']
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
按 id 的 patch 会**整段替换**该行 config,其他设置要一并重述。
|
|
150
|
+
- **下次启动应用时生效。**
|
|
151
|
+
|
|
112
152
|
## `wsl` 参数
|
|
113
153
|
|
|
114
154
|
| 参数 | 必填 | 类型 | 说明 |
|
|
@@ -186,8 +226,17 @@ DSH_SUBPROCESS_LOCAL=/path/to/dsh/node_modules npm run test:real
|
|
|
186
226
|
workspace: /mnt/d/DSHworkarea (Windows drive mount /mnt/d — builds, installs and git are much slower here; prefer a path under /home when it matters)
|
|
187
227
|
```
|
|
188
228
|
|
|
189
|
-
这个提示值得当真。作者机器实测:128 MB 顺序写在 ext4 上约 **2.1 GB/s**,在 `/mnt/d` 上约
|
|
190
|
-
|
|
229
|
+
这个提示值得当真。作者机器实测:128 MB 顺序写在 ext4 上约 **2.1 GB/s**,在 `/mnt/d` 上约
|
|
230
|
+
**247 MB/s**;创建 400 个小文件 ext4 **不到 10 ms**,`/mnt/d` 要 **0.72 s**
|
|
231
|
+
(后来复测:**884 vs 116 MB/s**、**13 ms vs 745 ms**,比值稳定在约 8× 与 50×)。
|
|
232
|
+
|
|
233
|
+
不只是慢。`/mnt/<盘>` 是 9p(drvfs)挂载,保留的是 **Windows** 的文件系统语义:
|
|
234
|
+
`chmod`/`chown` 不生效(`chmod 600` 读回来是 `777`)、文件名**大小写不敏感**(大小写写错只在
|
|
235
|
+
Linux CI 上才炸)、符号链接与可执行位是合成的,而且 **inotify 完全不工作**——发行版里的 watcher
|
|
236
|
+
对两侧写入都收不到任何事件(用 inotify 探针实测:`/mnt/d` 上 Windows 侧写入与 Linux 侧写入均为
|
|
237
|
+
**0 事件**,而同一探针在 ext4 上正常报出创建/修改/关闭写入)。因此 dev server、`--watch` 模式
|
|
238
|
+
与文件监听的测试在 Windows 盘上都是瞎的。需要时把项目放到 `/home` 下:语义、监听事件与上面那档
|
|
239
|
+
速度一次性都回来。
|
|
191
240
|
- 危险命令默认被拒绝,除非调用时传 `allowDangerous: true`:
|
|
192
241
|
- **任何递归删除**——`rm -r`、`rm -rf`、`rm -r -f`、`rm -R --force`、`rm --recursive`——
|
|
193
242
|
因为 stdin 指向 `/dev/null` 时不会产生任何提示,`rm -r tree` 会静默删除整棵树。
|
|
@@ -302,7 +351,7 @@ DSH_SUBPROCESS_LOCAL=/path/to/dsh/node_modules npm run test:real
|
|
|
302
351
|
`file:` 依赖是**副本**,改本仓库不会改变 DSH 实际加载的内容。任何改动之后:
|
|
303
352
|
|
|
304
353
|
```sh
|
|
305
|
-
npm run sync # 复制到 ~/.dsh/profiles/
|
|
354
|
+
npm run sync # 复制到 ~/.dsh/profiles/desktop/node_modules/dsh-wsl
|
|
306
355
|
npm run sync -- /path/to/profiles/<profile>/node_modules/<你的依赖名>
|
|
307
356
|
```
|
|
308
357
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
# This bundle layer
|
|
2
|
-
#
|
|
1
|
+
# This bundle layer inserts the wsl tool plugin process-wide, so every agent
|
|
2
|
+
# preset gets the `wsl`/`wsl-path`/`wsl-env` tools without declaring anything.
|
|
3
|
+
#
|
|
4
|
+
# Do NOT also add a `tool-wsl` row to a preset. DSH registers tools by name and
|
|
5
|
+
# the second registration fails with
|
|
6
|
+
# `tool "wsl" is already registered in this scope`. To keep the tools out of a
|
|
7
|
+
# composition, override this row by id in a later patch layer (`- id: tool-wsl`
|
|
8
|
+
# with `disabled: true`) instead of duplicating it.
|
|
3
9
|
|
|
4
10
|
# The entry name is PATH-RELATIVE on purpose. DSH anchors a relative `name:` to
|
|
5
11
|
# the directory of the patch file that declared it (`anchorInsertedPluginNames`),
|
|
@@ -13,3 +19,35 @@
|
|
|
13
19
|
- insert:
|
|
14
20
|
- id: tool-wsl
|
|
15
21
|
name: './index.js'
|
|
22
|
+
|
|
23
|
+
# ── Sidebar terminal: a WSL shell, listed first and selected by default ────────
|
|
24
|
+
#
|
|
25
|
+
# The desktop app's 新建终端 list is built from the composed `terminal-controller`
|
|
26
|
+
# row: it discovers shells from `shellCandidates` and puts the configured `shell`
|
|
27
|
+
# first. Overriding that row here is what makes installing this plugin also give
|
|
28
|
+
# you a Linux terminal in the sidebar. (A candidate entry cannot do it: a shell
|
|
29
|
+
# discovered by name gets `-i` appended, and `wsl.exe -i` is a hard error.)
|
|
30
|
+
#
|
|
31
|
+
# The path is absolute because the configured shell must resolve, and a shell that
|
|
32
|
+
# cannot resolve makes every new terminal fail rather than just this one: wsl.exe
|
|
33
|
+
# ships with Windows at a fixed location, so this resolves even where no
|
|
34
|
+
# distribution is installed yet.
|
|
35
|
+
#
|
|
36
|
+
# No distro is pinned, so `wsl.exe` follows the system default — the same rule the
|
|
37
|
+
# tools use when DSH_WSL_DISTRO is unset. Add `-d <name>` to `args` to pin one.
|
|
38
|
+
#
|
|
39
|
+
# This changes the default terminal shell, which is deliberate for a WSL plugin
|
|
40
|
+
# and reversible: a later patch layer wins, so restating the row in a profile's own
|
|
41
|
+
# cordis.patch.yml overrides it (and a profile that sets its own `shell` there is
|
|
42
|
+
# unaffected by this row).
|
|
43
|
+
#
|
|
44
|
+
# An id-targeted patch replaces the whole config, so anything the layer below set
|
|
45
|
+
# on this row (limits, scrollback, a custom shellCandidates list) falls back to its
|
|
46
|
+
# schema default. Only `shell` is set here on purpose. Never add `disabled:` here:
|
|
47
|
+
# that would switch off the terminal feature for the user instead of just this row.
|
|
48
|
+
- id: terminal-controller
|
|
49
|
+
config:
|
|
50
|
+
shell:
|
|
51
|
+
path: 'C:\Windows\System32\wsl.exe'
|
|
52
|
+
name: WSL
|
|
53
|
+
args: ['-e', 'bash', '-l']
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-wsl-tool",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.9.0",
|
|
4
|
+
"description": "Run Linux commands from Windows through WSL, essentially matching a native Linux DSH for command execution: background jobs, stdin, path translation, a destructive-command guard and a WSL capability report. WSL calls run below the DSH sandbox, and a project on a Windows drive keeps Windows filesystem semantics.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "MIT",
|