dsh-plugin-wsl-env 0.6.0 → 0.7.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 +176 -0
- package/README.md +6 -6
- package/cordis.patch.yml +48 -0
- package/docs/ARCHITECTURE.md +33 -20
- package/docs/CONFIGURATION.md +2 -2
- package/docs/LIMITATIONS.md +52 -54
- package/docs/PARITY.md +18 -4
- package/docs/README.zh.md +7 -7
- package/lib/fs-decisions.js +22 -25
- package/lib/fs-routing.js +176 -0
- package/lib/git-route.js +142 -0
- package/lib/index.js +77 -307
- package/lib/listing.js +47 -0
- package/lib/picker.js +121 -17
- package/lib/search-exec.js +114 -0
- package/lib/search-route.js +95 -0
- package/lib/subprocess.js +153 -16
- package/lib/terminal-activity.js +121 -0
- package/lib/workspace-files-route.js +205 -0
- package/lib/workspace-files-wsl.js +341 -0
- package/lib/wsl.js +0 -39
- package/package.json +22 -3
- package/lib/fs-publish.js +0 -42
package/lib/wsl.js
CHANGED
|
@@ -158,45 +158,6 @@ export async function linuxHome(distro, options = {}) {
|
|
|
158
158
|
* @returns the canonical absolute Linux path, or undefined when it cannot be
|
|
159
159
|
* determined (missing file, broken link, or a failed query).
|
|
160
160
|
*/
|
|
161
|
-
export async function canonicalLinuxPath(distro, linuxPath, options = {}) {
|
|
162
|
-
try {
|
|
163
|
-
const stdout = await runCapture(
|
|
164
|
-
[options.wslPath ?? DEFAULT_WSL_PATH, "-d", distro, "--exec", "readlink", "-f", linuxPath],
|
|
165
|
-
options.signal,
|
|
166
|
-
);
|
|
167
|
-
const resolved = stdout.trim();
|
|
168
|
-
return resolved.startsWith("/") ? resolved : undefined;
|
|
169
|
-
} catch {
|
|
170
|
-
return undefined;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Give `targetLinux` the same POSIX mode `sourceLinux` has, inside the distro.
|
|
176
|
-
*
|
|
177
|
-
* The UNC share does not carry POSIX modes to the host: a host-side `chmod` on a
|
|
178
|
-
* share path is silently ignored, and a host-side `stat` reports 0666 no matter
|
|
179
|
-
* what the distro sees. The distro itself has the real mode, so the mode has to
|
|
180
|
-
* be applied there — and because a rename preserves the inode's mode, applying
|
|
181
|
-
* it to a staged temp file *before* publication is enough for the published file
|
|
182
|
-
* to come out with the right bits.
|
|
183
|
-
*
|
|
184
|
-
* `stat` + `chmod` rather than `chmod --reference` keeps this working on distros
|
|
185
|
-
* whose chmod is busybox's.
|
|
186
|
-
*
|
|
187
|
-
* @param distro - distro name.
|
|
188
|
-
* @param sourceLinux - absolute Linux path whose mode is copied.
|
|
189
|
-
* @param targetLinux - absolute Linux path that receives the mode.
|
|
190
|
-
* @param options - the `wsl.exe` path and optional cancellation.
|
|
191
|
-
* @throws when the mode cannot be applied.
|
|
192
|
-
*/
|
|
193
|
-
export async function copyModeInDistro(distro, sourceLinux, targetLinux, options = {}) {
|
|
194
|
-
const script = 'if [ -e "$1" ]; then mode=$(stat -c %a "$1") && chmod "$mode" "$2"; fi';
|
|
195
|
-
await runCapture(
|
|
196
|
-
[options.wslPath ?? DEFAULT_WSL_PATH, "-d", distro, "--exec", "sh", "-c", script, "sh", sourceLinux, targetLinux],
|
|
197
|
-
options.signal,
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
161
|
|
|
201
162
|
/**
|
|
202
163
|
* Shells known to accept the combined POSIX `-lc` login-plus-command form.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-wsl-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "让 DeepSeek Harness 以 WSL 子系统作为会话的执行环境:shell、文件读写与命令执行均在子系统内完成,目录选择器与 GUI 终端同样定位到子系统路径,并通过子系统内的 bubblewrap 对命令进行沙箱隔离",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"./fs": "./lib/fs.js",
|
|
19
19
|
"./subprocess": "./lib/subprocess.js",
|
|
20
20
|
"./picker": "./lib/picker.js",
|
|
21
|
+
"./workspace-files-wsl": "./lib/workspace-files-wsl.js",
|
|
22
|
+
"./fs-routing": "./lib/fs-routing.js",
|
|
21
23
|
"./auto-preset": "./lib/auto-preset.js",
|
|
22
24
|
"./shell-env": "./lib/shell-env.js",
|
|
23
25
|
"./wsl": "./lib/wsl.js",
|
|
@@ -63,9 +65,9 @@
|
|
|
63
65
|
],
|
|
64
66
|
"scripts": {
|
|
65
67
|
"test": "npm run lint:style && npm run test:syntax && npm run test:unit",
|
|
66
|
-
"test:coverage": "node --test --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=85 --test-coverage-functions=70 test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-
|
|
68
|
+
"test:coverage": "node --test --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=85 --test-coverage-functions=70 test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/workspace-files-wsl.test.mjs test/composition.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/probe-cache.test.mjs test/sandbox.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/fs.boot.test.mjs test/shell.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs",
|
|
67
69
|
"test:syntax": "node test/syntax.mjs",
|
|
68
|
-
"test:unit": "node --test test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/fs-
|
|
70
|
+
"test:unit": "node --test test/fs.boot.test.mjs test/fsio-text.test.mjs test/workspace-files-wsl.test.mjs test/composition.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-route.test.mjs test/fsio-text.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs",
|
|
69
71
|
"lint:style": "node test/style.mjs",
|
|
70
72
|
"prepublishOnly": "npm test",
|
|
71
73
|
"probe": "bash test/probe/run.sh",
|
|
@@ -103,6 +105,23 @@
|
|
|
103
105
|
"bugs": {
|
|
104
106
|
"url": "https://github.com/Big-Dao/dsh-plugin-wsl-env/issues"
|
|
105
107
|
},
|
|
108
|
+
"devDependencies": {
|
|
109
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
110
|
+
"@deepseek-ai/cordis-plugin-include": "*",
|
|
111
|
+
"@deepseek-ai/cordis-plugin-loader": "*",
|
|
112
|
+
"@deepseek-ai/dsh-api-workspace-files": "0.2.0-rc.2",
|
|
113
|
+
"@deepseek-ai/dsh-bash-local": "0.2.0-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-fs": "0.2.0-rc.2",
|
|
115
|
+
"@deepseek-ai/dsh-fs-local": "0.2.0-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-fs-sandbox": "0.2.0-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-host-directory-picker": "0.2.0-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-sandbox": "0.2.0-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-subprocess-local": "0.2.0-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
123
|
+
"js-yaml": "4.1.0"
|
|
124
|
+
},
|
|
106
125
|
"peerDependencies": {
|
|
107
126
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
108
127
|
"@deepseek-ai/dsh-bash-local": "0.2.0-rc.2",
|
package/lib/fs-publish.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The in-distro publication step for `WslFileSystem.writeText`/`editText`.
|
|
3
|
-
*
|
|
4
|
-
* Today's publication is two round trips: `copyModeInDistro` (one `wsl.exe`
|
|
5
|
-
* chmod) plus the staged file's rename over the 9p share. Under the resident
|
|
6
|
-
* agent it collapses into ONE `exec`: a small POSIX shell step that copies the
|
|
7
|
-
* replaced file's mode onto the staged temp (`chmod --reference`, skipped for
|
|
8
|
-
* a creation, where there is nothing to copy from) and renames it into place
|
|
9
|
-
* atomically — the rename preserving the inode's mode bits, exactly as the
|
|
10
|
-
* old path arranged.
|
|
11
|
-
*
|
|
12
|
-
* Pure by construction: this module only builds the argv; execution and
|
|
13
|
-
* fallback belong to the caller.
|
|
14
|
-
*
|
|
15
|
-
* @module dsh-plugin-wsl/fs-publish
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The publication script. `$1` is the target's Linux path (may not exist —
|
|
20
|
-
* a creation), `$2` the staged temp's Linux path (always exists).
|
|
21
|
-
* @returns {string} the `sh -c` body.
|
|
22
|
-
*/
|
|
23
|
-
export function publicationScript() {
|
|
24
|
-
return [
|
|
25
|
-
// Creation: there is no source mode; the staged file keeps its umask mode,
|
|
26
|
-
// which is exactly what the old two-step path produced for new files.
|
|
27
|
-
'if [ -e "$1" ]; then',
|
|
28
|
-
' chmod --reference="$1" "$2" || exit 3',
|
|
29
|
-
'fi',
|
|
30
|
-
'mv -f "$2" "$1" || exit 4',
|
|
31
|
-
].join("\n");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The argv to execute inside the distro for one publication.
|
|
36
|
-
* @param {string} targetLinuxPath - the file being written.
|
|
37
|
-
* @param {string} stagedLinuxPath - the staged temp holding the new content.
|
|
38
|
-
* @returns {string[]} the argv, ready for the agent (or a one-shot `wsl.exe`).
|
|
39
|
-
*/
|
|
40
|
-
export function publicationArgv(targetLinuxPath, stagedLinuxPath) {
|
|
41
|
-
return ["sh", "-c", publicationScript(), "publish", targetLinuxPath, stagedLinuxPath];
|
|
42
|
-
}
|