@deepseek-ai/dsh-sandbox-policy 0.2.0-rc.2 → 0.2.1-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/README.i18n.yaml +8 -8
- package/README.md +4 -3
- package/README.zh.md +4 -3
- package/package.json +14 -21
- package/lib/invariant.js +0 -55
- package/lib/types/invariant.d.ts +0 -13
package/README.i18n.yaml
CHANGED
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
en: d13dabff02f2acfd
|
|
40
40
|
zh: f593888b4ffddf36
|
|
41
41
|
/deepseek-ai-dsh-sandbox-policy/understand-the-implementation/model-visible-text:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 999ecd77b3857811
|
|
43
|
+
zh: 2cc0a0b2aee08c17
|
|
44
44
|
/deepseek-ai-dsh-sandbox-policy/understand-the-implementation/source-map:
|
|
45
|
-
en:
|
|
46
|
-
zh:
|
|
45
|
+
en: cc7dd675c9915f7d
|
|
46
|
+
zh: d719c4f9de39873a
|
|
47
47
|
/deepseek-ai-dsh-sandbox-policy/further-exploration:
|
|
48
|
-
en:
|
|
49
|
-
zh:
|
|
48
|
+
en: 7b110e18967f2754
|
|
49
|
+
zh: 823c261edeae750a
|
|
50
50
|
/deepseek-ai-dsh-sandbox-policy/model-experience:
|
|
51
51
|
en: 215e7ba838619b7b
|
|
52
52
|
zh: a311da3843709f90
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
en: a16a657e0e5145fb
|
|
73
73
|
zh: 4b19263a728990dc
|
|
74
74
|
/deepseek-ai-dsh-sandbox-policy/known-limitations-and-deferred-work:
|
|
75
|
-
en:
|
|
76
|
-
zh:
|
|
75
|
+
en: ef2f4f9df4b4f52d
|
|
76
|
+
zh: 3cdd659505f16751
|
|
77
77
|
/deepseek-ai-dsh-sandbox-policy/known-limitations-and-deferred-work/dev-note:
|
|
78
78
|
en: e67f633dc6fe7773
|
|
79
79
|
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ A runtime switch is one log-only `sandbox/mode` event on the session it applies
|
|
|
77
77
|
|
|
78
78
|
### Model-visible text
|
|
79
79
|
|
|
80
|
-
The `sandbox:policy` contribution states the mode's capability-neutral file-effect contract and the recorded session workspace under `workspace-write`. It does not enumerate mounted capabilities; tool plugins retain operation-specific denial and escalation guidance, approval policy contributes separately to the same snapshot, and plan guidance remains `dsh-plan-mode`'s system section.
|
|
80
|
+
The `sandbox:policy` contribution states the mode's capability-neutral file-effect contract and the recorded session workspace under `workspace-write`. It does not enumerate mounted capabilities; tool plugins retain operation-specific denial and escalation guidance, approval policy contributes separately to the same snapshot, and plan guidance remains `dsh-plan-mode`'s system section.
|
|
81
81
|
|
|
82
82
|
### Source map
|
|
83
83
|
|
|
@@ -85,7 +85,6 @@ The `sandbox:policy` contribution states the mode's capability-neutral file-effe
|
|
|
85
85
|
|---|---|
|
|
86
86
|
| [`src/index.ts`](src/index.ts) | Plugin entry: `SandboxPolicyService`, `Config` schema, policy resolution and context contribution |
|
|
87
87
|
| [`src/session-mode.ts`](src/session-mode.ts) | The `sandbox/mode` event, its fold, and the write path |
|
|
88
|
-
| [`src/invariant.ts`](src/invariant.ts) | Invariant companion: rejects `sandbox/mode` values outside the closed vocabulary |
|
|
89
88
|
|
|
90
89
|
</details>
|
|
91
90
|
|
|
@@ -98,7 +97,7 @@ Start with the subsystem reference for the shared vocabulary, then the seam cont
|
|
|
98
97
|
|
|
99
98
|
- [Process sandbox subsystem](../../../docs/subsystems/sandbox.md) — modes, per-call policy, and enforcement semantics.
|
|
100
99
|
- [Sandbox seam package](../sandbox/README.md) — the confinement contract every enforcing capability implements.
|
|
101
|
-
- [Cross-family file sandbox decision](../../../.agents/notes/
|
|
100
|
+
- [historical Cross-family file sandbox decision](../../../.agents/notes/archived/feature/2026-07-14-cross-family-fs-sandbox.md) — why one shared policy home exists.
|
|
102
101
|
|
|
103
102
|
-----
|
|
104
103
|
|
|
@@ -148,6 +147,8 @@ These limits define the policy surface this package provides. They are current p
|
|
|
148
147
|
- **File-effect modes only** — `SandboxMode` governs file effects; network and process policy are outside its vocabulary, so no knob here restricts them.
|
|
149
148
|
- **Temporary areas are deliberately summarized** — enforcing backends grant different platform temporary areas, which are selected after policy resolution and therefore cannot be enumerated truthfully in the current context.
|
|
150
149
|
|
|
150
|
+
Policy-context replacements must be counter-tested on denied-then-escalatable tasks to verify that the model still attempts the initial tool call. The [historical five-of-twelve zero-tool-call measurement](../../../.agents/notes/archived/feature/2026-07-06-sandbox.md) records the failure this check prevents.
|
|
151
|
+
|
|
151
152
|
<a id="dev-note"></a>
|
|
152
153
|
### Dev Note
|
|
153
154
|
|
package/README.zh.md
CHANGED
|
@@ -77,7 +77,7 @@ kind: "package-reference"
|
|
|
77
77
|
|
|
78
78
|
### 模型可见文本
|
|
79
79
|
|
|
80
|
-
`sandbox:policy` 贡献说明该模式与具体能力无关的文件操作约定,以及 `workspace-write` 下已记录的会话工作区。它不枚举已挂载能力;工具插件保留特定于操作的拒绝与升权引导,批准策略单独贡献给同一份快照,计划引导仍由 `dsh-plan-mode`
|
|
80
|
+
`sandbox:policy` 贡献说明该模式与具体能力无关的文件操作约定,以及 `workspace-write` 下已记录的会话工作区。它不枚举已挂载能力;工具插件保留特定于操作的拒绝与升权引导,批准策略单独贡献给同一份快照,计划引导仍由 `dsh-plan-mode` 的系统段落管理。
|
|
81
81
|
|
|
82
82
|
### 源码地图
|
|
83
83
|
|
|
@@ -85,7 +85,6 @@ kind: "package-reference"
|
|
|
85
85
|
|---|---|
|
|
86
86
|
| [`src/index.ts`](src/index.ts) | 插件入口:`SandboxPolicyService`、`Config` schema、策略解析与上下文贡献 |
|
|
87
87
|
| [`src/session-mode.ts`](src/session-mode.ts) | `sandbox/mode` 事件、其 fold 与写入路径 |
|
|
88
|
-
| [`src/invariant.ts`](src/invariant.ts) | 不变式配套组件:拒绝超出封闭词汇的 `sandbox/mode` 值 |
|
|
89
88
|
|
|
90
89
|
</details>
|
|
91
90
|
|
|
@@ -98,7 +97,7 @@ kind: "package-reference"
|
|
|
98
97
|
|
|
99
98
|
- [进程沙箱子系统](../../../docs/subsystems/sandbox.zh.md)——模式、逐调用策略与强制执行语义。
|
|
100
99
|
- [沙箱 seam 包](../sandbox/README.zh.md)——每个强制执行能力实现的隔离约定。
|
|
101
|
-
- [
|
|
100
|
+
- [历史跨家族文件沙箱决策](../../../.agents/notes/archived/feature/2026-07-14-cross-family-fs-sandbox.md)——为何存在统一的共享策略归属位置。
|
|
102
101
|
|
|
103
102
|
-----
|
|
104
103
|
|
|
@@ -148,6 +147,8 @@ Current DSH file policy: danger-full-access. The DSH file sandbox does not restr
|
|
|
148
147
|
- **仅限文件操作模式**——`SandboxMode` 管控文件操作;网络和进程策略不在其词汇中,因此这里没有限制它们的旋钮。
|
|
149
148
|
- **有意概述临时区域**——强制执行后端会授予不同的平台临时区域,这些区域在策略解析后才会选定,因此无法在当前上下文中如实枚举。
|
|
150
149
|
|
|
150
|
+
替换策略上下文时,必须使用先遭拒绝、再可申请升权的任务做反向验证,确认模型仍会尝试初次工具调用。[历史上十二轮中五轮没有工具调用的测量](../../../.agents/notes/archived/feature/2026-07-06-sandbox.md)记录了这项检查要防止的失败。
|
|
151
|
+
|
|
151
152
|
<a id="dev-note"></a>
|
|
152
153
|
### 开发备注
|
|
153
154
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-sandbox-policy",
|
|
3
3
|
"description": "Per-call sandbox policy resolver and current model context: deployment fallbacks plus each session's mode and workspace root, shared by every enforcing capability family",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,39 +18,32 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./src/*": "./src/*",
|
|
26
22
|
"./package.json": "./package.json"
|
|
27
23
|
},
|
|
28
24
|
"files": [
|
|
29
25
|
"lib/index.js",
|
|
30
|
-
"lib/invariant.js",
|
|
31
26
|
"lib/types/**/*.d.ts"
|
|
32
27
|
],
|
|
33
28
|
"license": "MIT",
|
|
34
29
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/
|
|
38
|
-
"@deepseek-ai/dsh-
|
|
39
|
-
"@deepseek-ai/
|
|
40
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
41
|
-
"@deepseek-ai/dsh-invariants": "0.2.0-rc.2"
|
|
30
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
|
|
31
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-alpha.1",
|
|
32
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
33
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.1",
|
|
34
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
35
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1"
|
|
42
36
|
},
|
|
43
37
|
"dependencies": {
|
|
44
38
|
"zod": "^4.4.3",
|
|
45
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
39
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1"
|
|
46
40
|
},
|
|
47
41
|
"devDependencies": {
|
|
48
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/
|
|
53
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
54
|
-
"@deepseek-ai/cordis": "~4.0.4"
|
|
42
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
|
|
43
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-alpha.1",
|
|
44
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
45
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.1",
|
|
46
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1"
|
|
55
48
|
}
|
|
56
49
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region lib/types/session-mode.js
|
|
2
|
-
/**
|
|
3
|
-
* Per-session sandbox-mode override: the session log as the store. A runtime
|
|
4
|
-
* switch (a UI policy control or test scenario) is recorded as one
|
|
5
|
-
* `sandbox/mode` event on the session it applies to;
|
|
6
|
-
* `effective = projection state ?? the deployment default`, so an override
|
|
7
|
-
* survives restart by replay, two sessions can never see each other's state,
|
|
8
|
-
* and there is no external config store. The event is log-only (the
|
|
9
|
-
* `approval/*` precedent): the policy owner projects the fold into each model
|
|
10
|
-
* request, while enforcing tools report operation-specific boundary markers.
|
|
11
|
-
* EXECUTION honors the same fold through `ctx.sandboxPolicy.resolve()` — it
|
|
12
|
-
* stamps the mode together with the calling session's workspace root onto each
|
|
13
|
-
* capability call, weakest-precedence beneath an escalation grant.
|
|
14
|
-
*
|
|
15
|
-
* The override is policy state shared by every enforcing family (bash and
|
|
16
|
-
* filesystem alike), so it lives here in the policy package rather than in any
|
|
17
|
-
* one capability's seam.
|
|
18
|
-
*
|
|
19
|
-
* @module dsh-sandbox-policy/session-mode
|
|
20
|
-
*/
|
|
21
|
-
/** Every {@link SandboxMode}, for option advertisement and runtime validation of untrusted mode strings. */
|
|
22
|
-
const SANDBOX_MODES = [
|
|
23
|
-
"read-only",
|
|
24
|
-
"workspace-write",
|
|
25
|
-
"danger-full-access"
|
|
26
|
-
];
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region lib/types/invariant.js
|
|
29
|
-
/** Package-owned session-event invariants for sandbox policy. @module @deepseek-ai/dsh-sandbox-policy/invariant */
|
|
30
|
-
const PACKAGE_NAME = "@deepseek-ai/dsh-sandbox-policy";
|
|
31
|
-
/** Cordis companion plugin name. */
|
|
32
|
-
const name = "sandbox-policy-invariant";
|
|
33
|
-
/** Service required before the companion can reserve package ownership. */
|
|
34
|
-
const inject = ["invariants"];
|
|
35
|
-
/** Validate the package-owned event fields and ignore unrelated events. */
|
|
36
|
-
function validateEvent(event, fail) {
|
|
37
|
-
if (event.type === "sandbox/mode" && !SANDBOX_MODES.includes(event.data.mode)) fail(`sandbox/mode carries unknown mode ${JSON.stringify(event.data.mode)}`);
|
|
38
|
-
}
|
|
39
|
-
/** Install validation for loaded and newly appended sandbox modes. */
|
|
40
|
-
const install = Object.assign((ctx, fail) => {
|
|
41
|
-
for (const session of ctx.sessions.list()) for (const event of session.snapshotEvents()) validateEvent(event, fail);
|
|
42
|
-
ctx.on("internal/dispatch", (_mode, eventName, args) => {
|
|
43
|
-
if (eventName !== "session/event") return;
|
|
44
|
-
const event = args[1];
|
|
45
|
-
validateEvent(event, fail);
|
|
46
|
-
}, { global: true });
|
|
47
|
-
}, { inject: ["sessions"] });
|
|
48
|
-
/**
|
|
49
|
-
* Register this package's invariant companion.
|
|
50
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
51
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
52
|
-
*/
|
|
53
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
54
|
-
//#endregion
|
|
55
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Package-owned session-event invariants for sandbox policy. @module @deepseek-ai/dsh-sandbox-policy/invariant */
|
|
2
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
/** Cordis companion plugin name. */
|
|
4
|
-
export declare const name = "sandbox-policy-invariant";
|
|
5
|
-
/** Service required before the companion can reserve package ownership. */
|
|
6
|
-
export declare const inject: string[];
|
|
7
|
-
/**
|
|
8
|
-
* Register this package's invariant companion.
|
|
9
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
10
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
11
|
-
*/
|
|
12
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
13
|
-
//# sourceMappingURL=invariant.d.ts.map
|