@deepseek-ai/dsh-sandbox-ssh 0.1.6-alpha.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.
- package/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +78 -0
- package/README.zh.md +78 -0
- package/lib/index.js +41 -0
- package/lib/types/index.d.ts +10 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/ssh/sandbox-ssh/README.md
|
|
5
|
+
README.md: e8f6cb8d47288e92fe8082ae23d550dff344324d
|
|
6
|
+
README.zh.md: 694ff99cb0a5df0c45392de0211df2dfa223070d
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Remote file-effect confinement for compositions using SSH filesystem and subprocess providers."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-sandbox-ssh
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-sandbox-ssh` supplies `ctx.sandbox` for processes launched by the SSH subprocess provider. The remote host selects its installed local sandbox backend and applies each call’s policy there. Bash and Node receive the same backend’s enforcement level, denial signatures and runner-failure classification.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Mount this provider with the shared [`SSH connection`](../ssh/README.md), SSH filesystem and SSH subprocess providers. It has no package-specific configuration. Await `confine(argv, policy, signal)` to resolve each policy and command through the running remote helper.
|
|
29
|
+
|
|
30
|
+
Pass a complete `read-only` or `workspace-write` policy. The workspace is interpreted and canonicalized on the remote host. Consumers bypass `confine()` for `danger-full-access`; the connection does not invent an additional local/remote policy flag.
|
|
31
|
+
|
|
32
|
+
-----
|
|
33
|
+
|
|
34
|
+
<a id="understand-the-implementation"></a>
|
|
35
|
+
## Understand the implementation
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary>Implementation internals — click to expand</summary>
|
|
39
|
+
|
|
40
|
+
The running helper canonicalizes the policy root and asks its loaded sandbox provider for the enforcing argv, enforcement level and runner-failure evidence. The SSH subprocess provider executes that returned argv directly and owns fd 7 transport and managed process lifetime. Cancellation or an unavailable backend rejects before the caller receives a command to launch.
|
|
41
|
+
|
|
42
|
+
</details>
|
|
43
|
+
|
|
44
|
+
-----
|
|
45
|
+
|
|
46
|
+
<a id="further-exploration"></a>
|
|
47
|
+
## Further Exploration
|
|
48
|
+
|
|
49
|
+
- [Process sandbox subsystem](../../../docs/subsystems/sandbox.md) — policy meanings and enforcement disclosure.
|
|
50
|
+
- [Local sandbox provider](../../sandbox/sandbox-local/README.md) — backends and platform limitations inherited on the remote host.
|
|
51
|
+
|
|
52
|
+
-----
|
|
53
|
+
|
|
54
|
+
<a id="model-experience"></a>
|
|
55
|
+
## Model Experience
|
|
56
|
+
|
|
57
|
+
Indirectly, through existing sandbox consumers, which report mode, denial and enforcement and own approval presentation and model arguments.
|
|
58
|
+
|
|
59
|
+
#### KV Cache effect
|
|
60
|
+
|
|
61
|
+
This provider contributes no request-prefix content. Its consumers own model-visible tools and results.
|
|
62
|
+
|
|
63
|
+
## Known Limitations and Deferred Work
|
|
64
|
+
|
|
65
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
66
|
+
|
|
67
|
+
- File-effect modes do not restrict network access or process visibility. A remote `partial` backend remains partial.
|
|
68
|
+
- The SSH host and installed helper are trusted infrastructure. Digest checks and file-effect confinement do not establish a hostile-host security boundary.
|
|
69
|
+
|
|
70
|
+
<a id="dev-note"></a>
|
|
71
|
+
### Dev Note
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
75
|
+
|
|
76
|
+
No invariant companion is published. Wire validation and the owning filesystem, subprocess and sandbox providers enforce the observable obligations; this adapter adds no independently observed state relation.
|
|
77
|
+
|
|
78
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "面向使用 SSH 文件系统和子进程提供方的组合,说明远端文件效果限制。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-sandbox-ssh
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-sandbox-ssh` 为 SSH 子进程提供方启动的进程提供 `ctx.sandbox`。远端主机选择其已安装的本地沙箱后端,并在远端执行每次调用的策略。Bash 与 Node 获得同一后端的执行完整性等级、拒绝特征及运行器失败分类。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延后工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
将本提供方与共享 [SSH 连接](../ssh/README.zh.md)、SSH 文件系统及 SSH 子进程提供方一同挂载。本包没有专用配置。等待 `confine(argv, policy, signal)`,由正在运行的远端辅助程序解析每次调用的策略与命令。
|
|
29
|
+
|
|
30
|
+
传入完整的 `read-only` 或 `workspace-write` 策略。工作区路径在远端主机解释并规范化。消费方在 `danger-full-access` 模式下绕过 `confine()`;连接不额外引入本地/远端策略标记。
|
|
31
|
+
|
|
32
|
+
-----
|
|
33
|
+
|
|
34
|
+
<a id="understand-the-implementation"></a>
|
|
35
|
+
## 理解实现
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary>实现细节 — 点击展开</summary>
|
|
39
|
+
|
|
40
|
+
正在运行的辅助程序规范化策略根路径,再向已加载的沙箱提供方获取强制执行限制的 argv、执行完整性等级与运行器失败证据。SSH 子进程提供方直接执行返回的 argv,并负责 fd 7 传输及托管进程生命周期。取消请求或后端不可用时,会在调用方取得可启动命令之前拒绝请求。
|
|
41
|
+
|
|
42
|
+
</details>
|
|
43
|
+
|
|
44
|
+
-----
|
|
45
|
+
|
|
46
|
+
<a id="further-exploration"></a>
|
|
47
|
+
## 进一步探索
|
|
48
|
+
|
|
49
|
+
- [进程沙箱子系统](../../../docs/subsystems/sandbox.zh.md) — 策略含义及执行完整性披露。
|
|
50
|
+
- [本地沙箱提供方](../../sandbox/sandbox-local/README.zh.md) — 远端主机继承的后端及平台限制。
|
|
51
|
+
|
|
52
|
+
-----
|
|
53
|
+
|
|
54
|
+
<a id="model-experience"></a>
|
|
55
|
+
## 模型体验
|
|
56
|
+
|
|
57
|
+
间接通过现有沙箱消费方产生影响,由它们报告模式、拒绝及执行完整性,并负责审批展示及模型参数。
|
|
58
|
+
|
|
59
|
+
#### KV Cache 影响
|
|
60
|
+
|
|
61
|
+
本提供方不贡献请求前缀内容。面向模型的工具与结果由消费方负责。
|
|
62
|
+
|
|
63
|
+
## 已知限制与延后工作
|
|
64
|
+
|
|
65
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
66
|
+
|
|
67
|
+
- 文件效果模式不限制网络访问或进程可见性。远端 `partial` 后端仍属于部分执行。
|
|
68
|
+
- SSH 主机与已安装辅助程序属于可信基础设施。摘要检查与文件效果限制不构成对抗恶意主机的安全边界。
|
|
69
|
+
|
|
70
|
+
<a id="dev-note"></a>
|
|
71
|
+
### 开发备注
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>维护者工作上下文 — 点击展开</summary>
|
|
75
|
+
|
|
76
|
+
本包不发布不变式伴随入口。消息校验及所属文件系统、子进程和沙箱提供方执行可观察的约束;此适配器没有增加可独立观察的状态关系。
|
|
77
|
+
|
|
78
|
+
</details>
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SandboxProvider, SandboxUnavailableError } from "@deepseek-ai/dsh-sandbox";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region lib/types/index.js
|
|
4
|
+
/** Remote argv wrapper that selects and applies the sandbox on the SSH host. */
|
|
5
|
+
const factsSchema = z.object({
|
|
6
|
+
argv: z.array(z.string()).min(1),
|
|
7
|
+
enforcement: z.enum(["full", "partial"]),
|
|
8
|
+
denialSignatures: z.array(z.string()),
|
|
9
|
+
runnerFailureRules: z.array(z.object({
|
|
10
|
+
allowedExitCodes: z.array(z.number().int()).optional(),
|
|
11
|
+
fatalSignatures: z.array(z.string()),
|
|
12
|
+
informationalLines: z.array(z.string()).optional()
|
|
13
|
+
}).strict())
|
|
14
|
+
}).strict();
|
|
15
|
+
/** Resolve each confinement request on the same host as its filesystem and subprocess providers. */
|
|
16
|
+
var SshSandboxProvider = class extends SandboxProvider {
|
|
17
|
+
static inject = ["ssh"];
|
|
18
|
+
async confine(argv, policy, signal) {
|
|
19
|
+
signal?.throwIfAborted();
|
|
20
|
+
try {
|
|
21
|
+
const confined = await this.ctx.ssh.request("sandbox", {
|
|
22
|
+
argv,
|
|
23
|
+
policy
|
|
24
|
+
}, factsSchema, signal);
|
|
25
|
+
signal?.throwIfAborted();
|
|
26
|
+
return {
|
|
27
|
+
...confined,
|
|
28
|
+
runnerFailureRules: confined.runnerFailureRules.map((rule) => ({
|
|
29
|
+
fatalSignatures: rule.fatalSignatures,
|
|
30
|
+
...rule.allowedExitCodes === void 0 ? {} : { allowedExitCodes: rule.allowedExitCodes },
|
|
31
|
+
...rule.informationalLines === void 0 ? {} : { informationalLines: rule.informationalLines }
|
|
32
|
+
}))
|
|
33
|
+
};
|
|
34
|
+
} catch (error) {
|
|
35
|
+
signal?.throwIfAborted();
|
|
36
|
+
throw new SandboxUnavailableError(policy.mode, error instanceof Error ? error.message : String(error));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { SshSandboxProvider, SshSandboxProvider as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Remote argv wrapper that selects and applies the sandbox on the SSH host. */
|
|
2
|
+
import { SandboxProvider } from '@deepseek-ai/dsh-sandbox';
|
|
3
|
+
import type { ConfinedArgv, SandboxPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
4
|
+
/** Resolve each confinement request on the same host as its filesystem and subprocess providers. */
|
|
5
|
+
export declare class SshSandboxProvider extends SandboxProvider {
|
|
6
|
+
static inject: string[];
|
|
7
|
+
confine(argv: readonly string[], policy: SandboxPolicy, signal?: AbortSignal): Promise<ConfinedArgv>;
|
|
8
|
+
}
|
|
9
|
+
export default SshSandboxProvider;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-sandbox-ssh",
|
|
3
|
+
"description": "Remote POSIX sandbox argv provider over the shared SSH helper",
|
|
4
|
+
"version": "0.1.6-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/ssh/sandbox-ssh"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/index.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
31
|
+
"@deepseek-ai/dsh-ssh": "^0.1.6-alpha.1",
|
|
32
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"zod": "^4.4.3",
|
|
36
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
40
|
+
"@deepseek-ai/dsh-ssh": "^0.1.6-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1"
|
|
42
|
+
}
|
|
43
|
+
}
|