@deepseek-ai/dsh-fs-ssh 0.2.2-alpha.2 → 0.2.2-alpha.3
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/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +30 -18
- package/lib/types/index.d.ts +8 -1
- package/package.json +12 -12
package/README.i18n.yaml
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 725b47765ee8f30b
|
|
17
17
|
/deepseek-ai-dsh-fs-ssh/use-this-package:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 33fa4c10b96c7ade
|
|
19
|
+
zh: 4fd3db455c3c14cf
|
|
20
20
|
/deepseek-ai-dsh-fs-ssh/understand-the-implementation:
|
|
21
21
|
en: df9be336b11850b2
|
|
22
22
|
zh: 6748e9993fa1e2ac
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Mount this provider with [`dsh-ssh`](../ssh/README.md) and `sandboxPolicy`; use
|
|
|
29
29
|
|
|
30
30
|
`resolve()` canonicalizes paths on the remote host. `processPath()` and `fileUrl()` name files in that same remote namespace; they do not grant host-side access. File URLs encode literal percent signs, backslashes and newlines without changing the filename. `processPathFromHostPath()` returns `undefined`, so consumers requiring an installed executable or bootstrap must supply a remote artifact explicitly.
|
|
31
31
|
|
|
32
|
-
Reads preserve the shared filesystem error codes.
|
|
32
|
+
Reads preserve the shared filesystem error codes. All five mutations send the resolved per-call policy to the helper; `patchText`, `deleteFile`, and `moveFile` use `fs.patch`, `fs.delete`, and `fs.move`, with guards and results matching the local provider. Lost transport reports an I/O failure; a mutation may already have committed and is not retried automatically.
|
|
33
33
|
|
|
34
34
|
-----
|
|
35
35
|
|
package/README.zh.md
CHANGED
|
@@ -29,7 +29,7 @@ kind: "package-reference"
|
|
|
29
29
|
|
|
30
30
|
`resolve()` 在远端主机上规范化路径。`processPath()` 与 `fileUrl()` 在同一个远端命名空间中标识文件,并不授予主机侧访问能力。文件 URL 对字面的百分号、反斜杠和换行进行编码,保留原文件名。`processPathFromHostPath()` 返回 `undefined`,因此需要已安装可执行文件或引导程序的消费方必须显式提供远端产物。
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
读取保留共享文件系统错误码。五个变更操作都会向辅助进程发送已解析的逐次调用策略;`patchText`、`deleteFile` 和 `moveFile` 使用 `fs.patch`、`fs.delete` 和 `fs.move`,防护和结果与本地提供方一致。传输丢失报告为 I/O 失败;变更可能已经提交,且不会自动重试。
|
|
33
33
|
|
|
34
34
|
-----
|
|
35
35
|
|
package/lib/index.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
-
import { FileSystem, FsError } from "@deepseek-ai/dsh-fs";
|
|
3
|
+
import { FS_ERROR_CODES, FileSystem, FsError } from "@deepseek-ai/dsh-fs";
|
|
4
4
|
import { RemoteOperationError } from "@deepseek-ai/dsh-ssh/protocol";
|
|
5
|
-
import { editResultSchema, entriesSchema, infoSchema, pathInfoSchema, targetSchema, textStreamIdSchema, writeResultSchema } from "@deepseek-ai/dsh-ssh/schemas";
|
|
5
|
+
import { deleteResultSchema, editResultSchema, entriesSchema, infoSchema, moveResultSchema, pathInfoSchema, targetSchema, textStreamIdSchema, writeResultSchema } from "@deepseek-ai/dsh-ssh/schemas";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region lib/types/index.js
|
|
8
8
|
/** Filesystem provider preserving remote identities and helper-owned atomic mutations. */
|
|
9
|
-
const errorCodes =
|
|
10
|
-
FS_NOT_FOUND: true,
|
|
11
|
-
FS_NOT_DIRECTORY: true,
|
|
12
|
-
FS_NOT_TEXT: true,
|
|
13
|
-
FS_NOT_REGULAR_FILE: true,
|
|
14
|
-
FS_TOO_LARGE: true,
|
|
15
|
-
FS_PERMISSION_DENIED: true,
|
|
16
|
-
FS_SANDBOX_DENIED: true,
|
|
17
|
-
FS_IO_ERROR: true,
|
|
18
|
-
FS_STALE_VERSION: true,
|
|
19
|
-
FS_NOT_OBSERVED: true,
|
|
20
|
-
FS_AMBIGUOUS_EDIT: true,
|
|
21
|
-
FS_EDIT_NOT_FOUND: true,
|
|
22
|
-
FS_ABORTED: true
|
|
23
|
-
};
|
|
9
|
+
const errorCodes = new Set(FS_ERROR_CODES);
|
|
24
10
|
/** Remote filesystem paired with the SSH subprocess and sandbox providers. */
|
|
25
11
|
var SshFileSystem = class extends FileSystem {
|
|
26
12
|
static inject = ["ssh", "sandboxPolicy"];
|
|
@@ -108,11 +94,37 @@ var SshFileSystem = class extends FileSystem {
|
|
|
108
94
|
policy
|
|
109
95
|
}, editResultSchema, signal);
|
|
110
96
|
}
|
|
97
|
+
async patchText(target, hunks, expected, signal, sandboxPolicy) {
|
|
98
|
+
const policy = sandboxPolicy ?? this.ctx.sandboxPolicy.resolve();
|
|
99
|
+
return await this.call("fs.patch", {
|
|
100
|
+
target,
|
|
101
|
+
hunks,
|
|
102
|
+
expected,
|
|
103
|
+
policy
|
|
104
|
+
}, editResultSchema, signal);
|
|
105
|
+
}
|
|
106
|
+
async deleteFile(target, expected, signal, sandboxPolicy) {
|
|
107
|
+
const policy = sandboxPolicy ?? this.ctx.sandboxPolicy.resolve();
|
|
108
|
+
return this.call("fs.delete", {
|
|
109
|
+
target,
|
|
110
|
+
expected,
|
|
111
|
+
policy
|
|
112
|
+
}, deleteResultSchema, signal);
|
|
113
|
+
}
|
|
114
|
+
async moveFile(source, destination, options, signal, sandboxPolicy) {
|
|
115
|
+
const policy = sandboxPolicy ?? this.ctx.sandboxPolicy.resolve();
|
|
116
|
+
return await this.call("fs.move", {
|
|
117
|
+
source,
|
|
118
|
+
destination,
|
|
119
|
+
options,
|
|
120
|
+
policy
|
|
121
|
+
}, moveResultSchema, signal);
|
|
122
|
+
}
|
|
111
123
|
async call(method, params, schema, signal) {
|
|
112
124
|
try {
|
|
113
125
|
return await this.ctx.ssh.request(method, params, schema, signal);
|
|
114
126
|
} catch (error) {
|
|
115
|
-
if (error instanceof RemoteOperationError && error.code !== void 0 &&
|
|
127
|
+
if (error instanceof RemoteOperationError && error.code !== void 0 && errorCodes.has(error.code)) throw new FsError(error.message, error.code, { cause: error });
|
|
116
128
|
throw new FsError(error instanceof Error ? error.message : String(error), signal?.aborted ? "FS_ABORTED" : "FS_IO_ERROR", { cause: error });
|
|
117
129
|
}
|
|
118
130
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileSystem } from '@deepseek-ai/dsh-fs';
|
|
2
|
-
import type { FsDirEntry, FsEditOutcome, FsEditRequest, FsInfo, FsPathInfo, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs';
|
|
2
|
+
import type { FsDeleteOutcome, FsMoveOutcome, FsDirEntry, FsEditOutcome, FsEditRequest, FsInfo, FsPathInfo, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs';
|
|
3
3
|
import type { SandboxExecutionPolicy, SandboxMode } from '@deepseek-ai/dsh-sandbox';
|
|
4
4
|
/** Remote filesystem paired with the SSH subprocess and sandbox providers. */
|
|
5
5
|
export declare class SshFileSystem extends FileSystem {
|
|
@@ -28,6 +28,13 @@ export declare class SshFileSystem extends FileSystem {
|
|
|
28
28
|
editText(target: FsTarget, edit: FsEditRequest, expected?: {
|
|
29
29
|
version: FsVersion;
|
|
30
30
|
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
|
|
31
|
+
patchText(target: FsTarget, hunks: Parameters<FileSystem['patchText']>[1], expected?: {
|
|
32
|
+
version: FsVersion;
|
|
33
|
+
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
|
|
34
|
+
deleteFile(target: FsTarget, expected?: {
|
|
35
|
+
version: FsVersion;
|
|
36
|
+
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsDeleteOutcome>;
|
|
37
|
+
moveFile(source: FsTarget, destination: FsTarget, options: Parameters<FileSystem['moveFile']>[2], signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsMoveOutcome>;
|
|
31
38
|
private call;
|
|
32
39
|
}
|
|
33
40
|
export default SshFileSystem;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-fs-ssh",
|
|
3
3
|
"description": "Filesystem provider over the shared POSIX SSH helper",
|
|
4
|
-
"version": "0.2.2-alpha.
|
|
4
|
+
"version": "0.2.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,21 +29,21 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@deepseek-ai/cordis": "~4.0.6-alpha.
|
|
33
|
-
"@deepseek-ai/dsh-ssh": "0.2.2-alpha.
|
|
34
|
-
"@deepseek-ai/dsh-fs": "0.2.2-alpha.
|
|
35
|
-
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.
|
|
36
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.
|
|
32
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-ssh": "0.2.2-alpha.3",
|
|
34
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@deepseek-ai/schemastery": "~3.18.6-alpha.
|
|
39
|
+
"@deepseek-ai/schemastery": "~3.18.6-alpha.2",
|
|
40
40
|
"zod": "4.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@deepseek-ai/cordis": "~4.0.6-alpha.
|
|
44
|
-
"@deepseek-ai/dsh-ssh": "0.2.2-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-fs": "0.2.2-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.
|
|
43
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-ssh": "0.2.2-alpha.3",
|
|
45
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3"
|
|
48
48
|
}
|
|
49
49
|
}
|