@deepseek-ai/dsh-sandbox 0.1.7-rc.1 → 0.1.7-rc.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/README.i18n.yaml +90 -5
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +16 -2
- package/lib/types/escalation.d.ts +13 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +6 -6
package/README.i18n.yaml
CHANGED
|
@@ -1,6 +1,91 @@
|
|
|
1
|
-
# Bilingual-pair consistency record (docs/i18n/README.md):
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/sandbox/sandbox/README.md
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/:
|
|
6
|
+
en: 4308065a46738364
|
|
7
|
+
zh: 2eb6ab7314e74976
|
|
8
|
+
/deepseek-ai-dsh-sandbox:
|
|
9
|
+
en: 3d3312b2261f0a60
|
|
10
|
+
zh: 47741e2a3d90da70
|
|
11
|
+
/deepseek-ai-dsh-sandbox/summary:
|
|
12
|
+
en: be0473ca1d2dbb6c
|
|
13
|
+
zh: 8c6b097438d2c2af
|
|
14
|
+
/deepseek-ai-dsh-sandbox/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-sandbox/use-this-package:
|
|
18
|
+
en: 5fbf0b48effb1143
|
|
19
|
+
zh: 5c570dcc1a17e0ad
|
|
20
|
+
/deepseek-ai-dsh-sandbox/use-this-package/when-to-choose-it:
|
|
21
|
+
en: 4ddc504d2626fe3e
|
|
22
|
+
zh: ceb3dd93fb3835db
|
|
23
|
+
/deepseek-ai-dsh-sandbox/use-this-package/confining-a-command:
|
|
24
|
+
en: c5540889017b6a7f
|
|
25
|
+
zh: 679bfbd5254bf92d
|
|
26
|
+
/deepseek-ai-dsh-sandbox/use-this-package/modes-and-enforcement:
|
|
27
|
+
en: ab093e9042b86b99
|
|
28
|
+
zh: d173df7cb3649446
|
|
29
|
+
/deepseek-ai-dsh-sandbox/use-this-package/denied-calls-and-escalation:
|
|
30
|
+
en: 92cf42bad65d112c
|
|
31
|
+
zh: 60fa2cb7e9c4c556
|
|
32
|
+
/deepseek-ai-dsh-sandbox/use-this-package/fail-closed-behavior:
|
|
33
|
+
en: 6bf240632a7a6bf5
|
|
34
|
+
zh: ebf414f5cf435875
|
|
35
|
+
/deepseek-ai-dsh-sandbox/understand-the-implementation:
|
|
36
|
+
en: 7e13d669ecc96d59
|
|
37
|
+
zh: b5fe7ae65812d926
|
|
38
|
+
/deepseek-ai-dsh-sandbox/understand-the-implementation/design-philosophy:
|
|
39
|
+
en: 0fc96495c192b513
|
|
40
|
+
zh: 38b51b9b3c208012
|
|
41
|
+
/deepseek-ai-dsh-sandbox/understand-the-implementation/source-map:
|
|
42
|
+
en: 54cab3e684afb031
|
|
43
|
+
zh: b49b476d2f965985
|
|
44
|
+
/deepseek-ai-dsh-sandbox/understand-the-implementation/escalation-choreography:
|
|
45
|
+
en: 1b418d41f571ab3d
|
|
46
|
+
zh: 62b289cdd6f4d272
|
|
47
|
+
/deepseek-ai-dsh-sandbox/understand-the-implementation/writable-roots:
|
|
48
|
+
en: 956d3195cf7a35f8
|
|
49
|
+
zh: f83d8342e22bb7cd
|
|
50
|
+
/deepseek-ai-dsh-sandbox/further-exploration:
|
|
51
|
+
en: 9f0d57097c678a25
|
|
52
|
+
zh: 58e765bf1b223215
|
|
53
|
+
/deepseek-ai-dsh-sandbox/model-experience:
|
|
54
|
+
en: 215e7ba838619b7b
|
|
55
|
+
zh: a311da3843709f90
|
|
56
|
+
/deepseek-ai-dsh-sandbox/model-experience/confinement-error-indirectly:
|
|
57
|
+
en: 35e1ea00601f4003
|
|
58
|
+
zh: 08152430b840ea05
|
|
59
|
+
/deepseek-ai-dsh-sandbox/model-experience/confinement-error-indirectly/what-the-model-sees:
|
|
60
|
+
en: 15bcb0abf4a06983
|
|
61
|
+
zh: 801c506e47f8b063
|
|
62
|
+
/deepseek-ai-dsh-sandbox/model-experience/confinement-error-indirectly/what-the-model-sees/exact-error:
|
|
63
|
+
en: e8b03df128b832a6
|
|
64
|
+
zh: dc89500c436a39cf
|
|
65
|
+
/deepseek-ai-dsh-sandbox/model-experience/confinement-error-indirectly/token-effect:
|
|
66
|
+
en: 8f514efe94edfa8a
|
|
67
|
+
zh: a46f9f4cd4527f4e
|
|
68
|
+
/deepseek-ai-dsh-sandbox/model-experience/confinement-error-indirectly/kv-cache-effect:
|
|
69
|
+
en: 2fbf2175168e8244
|
|
70
|
+
zh: f681f89596f500f5
|
|
71
|
+
/deepseek-ai-dsh-sandbox/model-experience/escalation-request-and-outcome:
|
|
72
|
+
en: 67c621ef55ec8320
|
|
73
|
+
zh: ae4bb9162a49e9fb
|
|
74
|
+
/deepseek-ai-dsh-sandbox/model-experience/escalation-request-and-outcome/what-the-model-sees:
|
|
75
|
+
en: c20128fa8f79c491
|
|
76
|
+
zh: 96173408d176b9e6
|
|
77
|
+
/deepseek-ai-dsh-sandbox/model-experience/escalation-request-and-outcome/token-effect:
|
|
78
|
+
en: 1a7b54d68b045beb
|
|
79
|
+
zh: 5dc6e824110c8fd8
|
|
80
|
+
/deepseek-ai-dsh-sandbox/model-experience/escalation-request-and-outcome/kv-cache-effect:
|
|
81
|
+
en: ea21ed3a768ed4b8
|
|
82
|
+
zh: 8e2f396a6875420e
|
|
83
|
+
/deepseek-ai-dsh-sandbox/known-limitations-and-deferred-work:
|
|
84
|
+
en: 63ff67b6fd13b4b0
|
|
85
|
+
zh: 6c8efa9ee99ea9bf
|
|
86
|
+
/deepseek-ai-dsh-sandbox/known-limitations-and-deferred-work/dev-note:
|
|
87
|
+
en: cc273320f6a1beaf
|
|
88
|
+
zh: 5c57a312ddc50651
|
|
89
|
+
/deepseek-ai-dsh-sandbox/known-limitations-and-deferred-work/dev-note/future-consumers-and-environments:
|
|
90
|
+
en: a7bc10cf027a51b8
|
|
91
|
+
zh: 2562dd32d3859205
|
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Enforcement is reported per call: `full` means the backend governs every promise
|
|
|
63
63
|
|
|
64
64
|
### Denied calls and escalation
|
|
65
65
|
|
|
66
|
-
When a confined call is denied, the operation reports a denial marker naming the mode — `[sandbox: file access denied under <mode> mode]` — and, when the composition advertises escalation, an escalation hint. The model may retry the exact call once with `sandbox_permissions` (the narrowest wider mode that suffices) plus a `justification`; the
|
|
66
|
+
When a confined call is denied, the operation reports a denial marker naming the mode — `[sandbox: file access denied under <mode> mode]` — and, when the composition advertises escalation, an escalation hint. The model may retry the exact call once with `sandbox_permissions` (the narrowest wider mode that suffices) plus a `justification`; the approval service obtains consent for the operation. The request retains its audit reason and supplies English and Chinese presentation copy with the model's justification unchanged. Missing translations follow the locale service's fallback chain, ultimately English; requesters own their translated presentation text. A wider mode requires approval and applies to that one call only. Repeating the call's effective mode succeeds without approval; narrower targets remain invalid.
|
|
67
67
|
|
|
68
68
|
### Fail-closed behavior
|
|
69
69
|
|
package/README.zh.md
CHANGED
|
@@ -63,7 +63,7 @@ kind: "package-reference"
|
|
|
63
63
|
|
|
64
64
|
### 被拒绝的调用与升权
|
|
65
65
|
|
|
66
|
-
受限调用被拒绝时,操作会报告指明模式的拒绝标记——`[sandbox: file access denied under <mode> mode]`——组合声明升权能力时还会给出升权提示。模型可以用 `sandbox_permissions`(足以放行的最窄更宽模式)加 `justification`
|
|
66
|
+
受限调用被拒绝时,操作会报告指明模式的拒绝标记——`[sandbox: file access denied under <mode> mode]`——组合声明升权能力时还会给出升权提示。模型可以用 `sandbox_permissions`(足以放行的最窄更宽模式)加 `justification` 重试一次完全相同的调用;审批服务为操作取得同意。请求保留审计原因,同时提供英文和中文展示文案,模型给出的理由保持原样。缺失的译文遵循语言服务的回退链,最终回退到英文;请求方负责自己的展示译文。更宽的模式需要审批,且只作用于该次调用。重复指定调用的生效模式无需审批即可成功;更窄的目标仍然无效。
|
|
67
67
|
|
|
68
68
|
### 故障关闭行为
|
|
69
69
|
|
package/lib/index.js
CHANGED
|
@@ -77,6 +77,16 @@ function escalationHintMarker(subject) {
|
|
|
77
77
|
return `[sandbox: escalation available — retry this exact ${subject} once with sandbox_permissions (the narrowest wider mode that suffices) + justification; the approval prompt asks the user]`;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
+
* The model-facing `sandbox_permissions` parameter description, which carries
|
|
81
|
+
* the escalation rules for every enforcing family.
|
|
82
|
+
* @param subject - the family's noun for the denied action (`command` for
|
|
83
|
+
* bash, `operation` for a filesystem mutation).
|
|
84
|
+
* @returns the parameter description, exactly as the model sees it.
|
|
85
|
+
*/
|
|
86
|
+
function sandboxPermissionsDescription(subject) {
|
|
87
|
+
return `The narrowest wider sandbox mode for a one-shot retry of the exact ${subject} the sandbox just denied; the retry asks the user for approval.`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
80
90
|
* Resolve a sandbox permission request before execution. Repeating the call's
|
|
81
91
|
* effective mode returns it without approval. A strictly wider mode requires
|
|
82
92
|
* approval and applies only to this call. Narrower or unsupported targets,
|
|
@@ -97,11 +107,15 @@ async function approveEscalation(request, approval) {
|
|
|
97
107
|
toolName: approval.toolName,
|
|
98
108
|
callId: approval.callId,
|
|
99
109
|
reason: `escalate sandbox to ${mode}: ${justification}`,
|
|
110
|
+
displayReason: {
|
|
111
|
+
en: `Allow this operation with ${mode} permissions: ${justification}`,
|
|
112
|
+
zh: `允许本次操作使用 ${mode} 权限:${justification}`
|
|
113
|
+
},
|
|
100
114
|
...approval.signal ? { signal: approval.signal } : {}
|
|
101
115
|
});
|
|
102
116
|
switch (outcome) {
|
|
103
117
|
case "allowed-once": return mode;
|
|
104
|
-
case "rejected": throw new Error(`the user rejected escalating this ${subject} to "${mode}"`);
|
|
118
|
+
case "rejected": throw new Error(`the user rejected escalating this ${subject} to "${mode}"; it stays denied, so stop and explain instead of working around it`);
|
|
105
119
|
case "cancelled": throw new Error(`approval for escalating to "${mode}" was cancelled`);
|
|
106
120
|
case "unavailable": throw new Error(`sandbox escalation to "${mode}" requires approval, but no approval channel is available`);
|
|
107
121
|
default: return assertNever(outcome, "EscalationOutcome");
|
|
@@ -272,4 +286,4 @@ var SandboxProvider = class extends Service {
|
|
|
272
286
|
}
|
|
273
287
|
};
|
|
274
288
|
//#endregion
|
|
275
|
-
export { ESCALATION_TARGETS, SANDBOX_UNAVAILABLE, SandboxProvider, SandboxProvider as default, SandboxUnavailableError, WIDER_MODES, approveEscalation, canonicalPath, classifyRunnerFailure, escalationHintMarker, isRunnerSpawnFailure, matchesSignature, sandboxDenialMarker, validateEscalationArgs, writableRoots };
|
|
289
|
+
export { ESCALATION_TARGETS, SANDBOX_UNAVAILABLE, SandboxProvider, SandboxProvider as default, SandboxUnavailableError, WIDER_MODES, approveEscalation, canonicalPath, classifyRunnerFailure, escalationHintMarker, isRunnerSpawnFailure, matchesSignature, sandboxDenialMarker, sandboxPermissionsDescription, validateEscalationArgs, writableRoots };
|
|
@@ -60,6 +60,14 @@ export declare function sandboxDenialMarker(mode: SandboxMode): string;
|
|
|
60
60
|
* @returns the hint line, exactly as the model sees it.
|
|
61
61
|
*/
|
|
62
62
|
export declare function escalationHintMarker(subject: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* The model-facing `sandbox_permissions` parameter description, which carries
|
|
65
|
+
* the escalation rules for every enforcing family.
|
|
66
|
+
* @param subject - the family's noun for the denied action (`command` for
|
|
67
|
+
* bash, `operation` for a filesystem mutation).
|
|
68
|
+
* @returns the parameter description, exactly as the model sees it.
|
|
69
|
+
*/
|
|
70
|
+
export declare function sandboxPermissionsDescription(subject: string): string;
|
|
63
71
|
/**
|
|
64
72
|
* The closed outcome vocabulary of one escalation ask — structurally identical
|
|
65
73
|
* to the approval seam's `ApprovalOutcome` so an `ApprovalService.request`
|
|
@@ -76,7 +84,7 @@ export type EscalationOutcome = 'allowed-once' | 'rejected' | 'cancelled' | 'una
|
|
|
76
84
|
export interface EscalationApprover<A = object, C = string> {
|
|
77
85
|
/**
|
|
78
86
|
* Ask the human to approve one action, resolving to a closed outcome.
|
|
79
|
-
* @param req - the audit
|
|
87
|
+
* @param req - the audit request with optional localized displayReason and presentation lifetime signal.
|
|
80
88
|
* @returns the human's decision as a closed {@link EscalationOutcome}.
|
|
81
89
|
*/
|
|
82
90
|
request(req: {
|
|
@@ -84,6 +92,10 @@ export interface EscalationApprover<A = object, C = string> {
|
|
|
84
92
|
toolName: string;
|
|
85
93
|
callId: C;
|
|
86
94
|
reason: string;
|
|
95
|
+
displayReason?: {
|
|
96
|
+
readonly en: string;
|
|
97
|
+
readonly [locale: string]: string;
|
|
98
|
+
};
|
|
87
99
|
signal?: AbortSignal;
|
|
88
100
|
}): Promise<EscalationOutcome>;
|
|
89
101
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Context, Service } from '@deepseek-ai/cordis';
|
|
8
8
|
import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
9
9
|
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
10
|
-
export { ESCALATION_TARGETS, WIDER_MODES, approveEscalation, escalationHintMarker, sandboxDenialMarker, validateEscalationArgs, } from './escalation.ts';
|
|
10
|
+
export { ESCALATION_TARGETS, WIDER_MODES, approveEscalation, escalationHintMarker, sandboxDenialMarker, sandboxPermissionsDescription, validateEscalationArgs, } from './escalation.ts';
|
|
11
11
|
export type { EscalationApproval, EscalationApprover, EscalationOutcome, EscalationRequest } from './escalation.ts';
|
|
12
12
|
export { canonicalPath, writableRoots } from './roots.ts';
|
|
13
13
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-sandbox",
|
|
3
3
|
"description": "Abstract process-sandbox seam (ctx.sandbox) for the DeepSeek Harness: same-world confinement vocabulary and the SandboxProvider contract",
|
|
4
|
-
"version": "0.1.7-rc.
|
|
4
|
+
"version": "0.1.7-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
31
|
-
"@deepseek-ai/dsh-llm": "0.1.7-rc.
|
|
32
|
-
"@deepseek-ai/dsh-session": "0.1.7-rc.
|
|
31
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
32
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
36
|
-
"@deepseek-ai/dsh-llm": "0.1.7-rc.
|
|
37
|
-
"@deepseek-ai/dsh-session": "0.1.7-rc.
|
|
36
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@deepseek-ai/dsh-util-values": "0.1.7-rc.
|
|
40
|
+
"@deepseek-ai/dsh-util-values": "0.1.7-rc.2"
|
|
41
41
|
}
|
|
42
42
|
}
|