@deepseek-ai/dsh-fs-sandbox 0.2.1-rc.5 → 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 CHANGED
@@ -9,20 +9,20 @@
9
9
  en: 68f0a0a66d33b6ec
10
10
  zh: 62fed2012166c111
11
11
  /deepseek-ai-dsh-fs-sandbox/summary:
12
- en: ae186a7675a9332b
13
- zh: 323e9043c1d90a83
12
+ en: 3fa6d9a13393ed2d
13
+ zh: d91675872102ae2a
14
14
  /deepseek-ai-dsh-fs-sandbox/table-of-contents:
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-fs-sandbox/use-this-package:
18
- en: c6fe0aa054b2a402
19
- zh: 78a779a1b91ac808
18
+ en: c159e3686e5b036d
19
+ zh: 2ff0d0e7ce62cb30
20
20
  /deepseek-ai-dsh-fs-sandbox/use-this-package/minimal-composition:
21
21
  en: a954957753339bbf
22
22
  zh: c6633e86de8b2707
23
23
  /deepseek-ai-dsh-fs-sandbox/use-this-package/how-the-fence-behaves:
24
- en: 1a6f19bb21aff7b1
25
- zh: ace300527edd0c1f
24
+ en: 61625544970c8ed2
25
+ zh: 64907677a518d876
26
26
  /deepseek-ai-dsh-fs-sandbox/use-this-package/observable-success-and-failures:
27
27
  en: 722f744eb7b3b040
28
28
  zh: b95db78f9968f9c5
@@ -33,8 +33,8 @@
33
33
  en: ef26d25e866ae9c0
34
34
  zh: 8206760b2e2c5feb
35
35
  /deepseek-ai-dsh-fs-sandbox/understand-the-implementation/source-map:
36
- en: 5422d25675578549
37
- zh: 9bb87cede194cd99
36
+ en: 6804c986bcfb5a97
37
+ zh: b4309922f08383c3
38
38
  /deepseek-ai-dsh-fs-sandbox/understand-the-implementation/how-a-mutation-is-fenced:
39
39
  en: d30a62f5f7e9aee7
40
40
  zh: 837e33fb5eea2f64
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-fs-sandbox` confines model file writes and edits according to each session's sandbox mode while preserving the local filesystem's read behavior. In `read-only`, it rejects every mutation; in `workspace-write`, it permits targets only inside the session workspace or a platform temporary root; in `danger-full-access`, it does not restrict mutations. Use it instead of `fs-local` with `ctx.sandboxPolicy` when sessions need workspace-confined file changes. Denied operations return `FS_SANDBOX_DENIED`, which filesystem tools present with the active mode and a same-turn escalation hint.
12
+ `dsh-fs-sandbox` confines model file writes, edits, patches, deletions, and moves according to each session's sandbox mode while preserving the local filesystem's read behavior. In `read-only`, it rejects every mutation; in `workspace-write`, it permits targets only inside the session workspace or a platform temporary root; in `danger-full-access`, it does not restrict mutations. Use it instead of `fs-local` with `ctx.sandboxPolicy` when sessions need workspace-confined file changes. Denied operations return `FS_SANDBOX_DENIED`, which filesystem tools present with the active mode and a same-turn escalation hint.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -25,6 +25,8 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
+ The fence covers `writeText`, `editText`, `patchText`, `deleteFile`, and `moveFile`. A move checks both source and destination before either effect, so a denied path leaves both files untouched.
29
+
28
30
  Mount this backend instead of `fs-local` when the model's file writes and edits must be confined by the session's sandbox mode, while reads stay unconfined. The fence applies per call: the tool layer resolves the calling session's mode and workspace root into the same policy the bash runner receives, so the filesystem and shell families never confine to different roots.
29
31
 
30
32
  ### Minimal composition
@@ -43,7 +45,7 @@ The backend's config is unchanged from the local backend's (`cwd` resolution def
43
45
 
44
46
  ### How the fence behaves
45
47
 
46
- The effective mode comes from the calling session's override or escalation grant, falling back to the deployment default when neither is in force. `read-only` denies every mutation with the structured `FS_SANDBOX_DENIED`. `workspace-write` allows a mutation only when the target canonicalizes under the workspace root or a platform temp area (`/tmp`, `os.tmpdir()`) — the same writable set the Seatbelt profile grants. `danger-full-access` delegates unfenced.
48
+ The effective mode comes from the calling session's override or escalation grant, falling back to the deployment default when neither is in force. `read-only` denies every mutation with the structured `FS_SANDBOX_DENIED`. `workspace-write` allows a mutation only when the target canonicalizes under the workspace root, an explicit additional writable root, or a platform temp area (`/tmp`, `os.tmpdir()`) — the same writable set the Seatbelt profile grants. `danger-full-access` delegates unfenced.
47
49
 
48
50
  ### Observable success and failures
49
51
 
@@ -67,7 +69,7 @@ The fence is a policy check in trusted code over a model-controlled path — not
67
69
 
68
70
  | File | Role |
69
71
  |---|---|
70
- | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`: mode fence on `writeText`/`editText`, `sandboxMode` fact |
72
+ | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`: mode fence on `writeText`/`editText`/`patchText`/`deleteFile`/`moveFile`, `sandboxMode` fact |
71
73
  | [`src/containment.ts`](src/containment.ts) | Ancestor containment check with lexical fast path and identity-based fallback |
72
74
 
73
75
  ### How a mutation is fenced
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- `dsh-fs-sandbox` 按各会话的沙箱模式限制模型对文件的写入与编辑,同时保留本地文件系统的读取行为。`read-only` 拒绝所有变更;`workspace-write` 只允许目标位于会话工作区或平台临时根目录内;`danger-full-access` 不限制变更。当会话需要将文件变更限制在工作区内时,使用它代替 `fs-local`,并加载 `ctx.sandboxPolicy`。被拒绝的操作返回 `FS_SANDBOX_DENIED`,文件系统工具会显示当前模式和同轮次升级提示。
12
+ `dsh-fs-sandbox` 按各会话的沙箱模式限制模型对文件的写入、编辑、打补丁、删除与移动,同时保留本地文件系统的读取行为。`read-only` 拒绝所有变更;`workspace-write` 只允许目标位于会话工作区或平台临时根目录内;`danger-full-access` 不限制变更。当会话需要将文件变更限制在工作区内时,使用它代替 `fs-local`,并加载 `ctx.sandboxPolicy`。被拒绝的操作返回 `FS_SANDBOX_DENIED`,文件系统工具会显示当前模式和同轮次升级提示。
13
13
 
14
14
  ## 目录
15
15
 
@@ -25,6 +25,8 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
+ 围栏覆盖 `writeText`、`editText`、`patchText`、`deleteFile` 和 `moveFile`。移动在任何效果发生前检查源与目标,因此任一路径被拒都会使两端文件保持不变。
29
+
28
30
  当模型的文件写入与编辑必须受会话沙箱模式约束、而读取保持不受约束时,挂载此后端以替代 `fs-local`。围栏按调用生效:工具层把调用会话的模式与工作区根目录解析为与 bash runner 收到的相同策略,因此文件系统与 shell 两个能力族绝不会约束到不同根目录。
29
31
 
30
32
  ### 最小组合
@@ -43,7 +45,7 @@ kind: "package-reference"
43
45
 
44
46
  ### 围栏行为
45
47
 
46
- 有效模式来自调用会话的覆盖值或升级授权,两者都未生效时才回退到部署默认值。`read-only` 以结构化 `FS_SANDBOX_DENIED` 拒绝所有变更。`workspace-write` 只允许目标规范化后位于工作区根目录或平台临时区域(`/tmp`、`os.tmpdir()`)之下的变更——与 Seatbelt profile 授权的可写集合相同。`danger-full-access` 不加围栏直接委托。
48
+ 有效模式来自调用会话的覆盖值或升级授权,两者都未生效时才回退到部署默认值。`read-only` 以结构化 `FS_SANDBOX_DENIED` 拒绝所有变更。`workspace-write` 只允许目标规范化后位于工作区根目录、显式额外可写根目录或平台临时区域(`/tmp`、`os.tmpdir()`)之下的变更——与 Seatbelt profile 授权的可写集合相同。`danger-full-access` 不加围栏直接委托。
47
49
 
48
50
  ### 可观察的成功与失败
49
51
 
@@ -67,7 +69,7 @@ kind: "package-reference"
67
69
 
68
70
  | 文件 | 职责 |
69
71
  |---|---|
70
- | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`:`writeText`/`editText` 上的模式围栏、`sandboxMode` 事实 |
72
+ | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`:`writeText`/`editText`/`patchText`/`deleteFile`/`moveFile` 上的模式围栏、`sandboxMode` 事实 |
71
73
  | [`src/containment.ts`](src/containment.ts) | 祖先包含检查,带词法快速路径与基于身份的兜底 |
72
74
 
73
75
  ### 变更如何被围栏
package/lib/index.js CHANGED
@@ -71,7 +71,7 @@ async function isPathUnder(path, root, caseSensitive = process.platform !== "win
71
71
  * text-storage mechanics — resolve, stat, read/stream, list, the atomic
72
72
  * write and the read-match-write edit critical section — are the local
73
73
  * implementation's, verbatim; this package adds only the per-call POLICY fence
74
- * on the two mutations. Reads pass through untouched: every mode permits
74
+ * on all five mutations. Reads pass through untouched: every mode permits
75
75
  * reading.
76
76
  *
77
77
  * The fence is a policy check in TRUSTED code over a MODEL-CONTROLLED path,
@@ -86,9 +86,9 @@ async function isPathUnder(path, root, caseSensitive = process.platform !== "win
86
86
  *
87
87
  * Per-call policy: `read-only` denies every mutation; `workspace-write` allows
88
88
  * a mutation only when the target canonicalizes under the policy's workspace
89
- * root or a platform temp area from the shared `writableRoots` policy;
90
- * `danger-full-access` delegates unfenced. A denial throws the structured
91
- * `FS_SANDBOX_DENIED`.
89
+ * root, an explicit additional writable root, or a platform temp area from the
90
+ * shared `writableRoots` policy; `danger-full-access` delegates unfenced. A
91
+ * denial throws the structured `FS_SANDBOX_DENIED`.
92
92
  *
93
93
  * @module @deepseek-ai/dsh-fs-sandbox
94
94
  */
@@ -140,6 +140,29 @@ var SandboxedFileSystem = class extends LocalFileSystem {
140
140
  return super.editText(await this.checkedTarget(target, sandboxPolicy), edit, expected, signal);
141
141
  }
142
142
  /**
143
+ * Fence the mutation before delegating to the local provider.
144
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
145
+ */
146
+ async patchText(target, hunks, expected, signal, sandboxPolicy) {
147
+ return super.patchText(await this.checkedTarget(target, sandboxPolicy), hunks, expected, signal);
148
+ }
149
+ /**
150
+ * Fence the mutation before delegating to the local provider.
151
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
152
+ */
153
+ async deleteFile(target, expected, signal, sandboxPolicy) {
154
+ return super.deleteFile(await this.checkedTarget(target, sandboxPolicy), expected, signal);
155
+ }
156
+ /**
157
+ * Fence the mutation before delegating to the local provider.
158
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
159
+ */
160
+ async moveFile(source, destination, options, signal, sandboxPolicy) {
161
+ const checkedSource = await this.checkedTarget(source, sandboxPolicy);
162
+ const checkedDestination = await this.checkedTarget(destination, sandboxPolicy);
163
+ return super.moveFile(checkedSource, checkedDestination, options, signal);
164
+ }
165
+ /**
143
166
  * Enforce the per-call policy against `target` and return the EXACT target the
144
167
  * mutation must use, so the checked identity is the mutated one (no
145
168
  * check-here-write-there TOCTOU). `read-only` denies; `workspace-write`
@@ -4,7 +4,7 @@
4
4
  * text-storage mechanics — resolve, stat, read/stream, list, the atomic
5
5
  * write and the read-match-write edit critical section — are the local
6
6
  * implementation's, verbatim; this package adds only the per-call POLICY fence
7
- * on the two mutations. Reads pass through untouched: every mode permits
7
+ * on all five mutations. Reads pass through untouched: every mode permits
8
8
  * reading.
9
9
  *
10
10
  * The fence is a policy check in TRUSTED code over a MODEL-CONTROLLED path,
@@ -19,16 +19,16 @@
19
19
  *
20
20
  * Per-call policy: `read-only` denies every mutation; `workspace-write` allows
21
21
  * a mutation only when the target canonicalizes under the policy's workspace
22
- * root or a platform temp area from the shared `writableRoots` policy;
23
- * `danger-full-access` delegates unfenced. A denial throws the structured
24
- * `FS_SANDBOX_DENIED`.
22
+ * root, an explicit additional writable root, or a platform temp area from the
23
+ * shared `writableRoots` policy; `danger-full-access` delegates unfenced. A
24
+ * denial throws the structured `FS_SANDBOX_DENIED`.
25
25
  *
26
26
  * @module @deepseek-ai/dsh-fs-sandbox
27
27
  */
28
28
  import { Context } from '@deepseek-ai/cordis';
29
29
  import { LocalFileSystem } from '@deepseek-ai/dsh-fs-local';
30
30
  import type { Config as LocalConfig } from '@deepseek-ai/dsh-fs-local';
31
- import type { FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs';
31
+ import type { FsDeleteOutcome, FsMoveOutcome, FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs';
32
32
  import type { SandboxExecutionPolicy, SandboxMode } from '@deepseek-ai/dsh-sandbox';
33
33
  /**
34
34
  * Plugin config: the local backend's knobs verbatim (`cwd` resolution default
@@ -77,6 +77,25 @@ export declare class SandboxedFileSystem extends LocalFileSystem {
77
77
  editText(target: FsTarget, edit: FsEditRequest, expected?: {
78
78
  version: FsVersion;
79
79
  }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
80
+ /**
81
+ * Fence the mutation before delegating to the local provider.
82
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
83
+ */
84
+ patchText(target: FsTarget, hunks: Parameters<LocalFileSystem['patchText']>[1], expected?: {
85
+ version: FsVersion;
86
+ }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
87
+ /**
88
+ * Fence the mutation before delegating to the local provider.
89
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
90
+ */
91
+ deleteFile(target: FsTarget, expected?: {
92
+ version: FsVersion;
93
+ }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsDeleteOutcome>;
94
+ /**
95
+ * Fence the mutation before delegating to the local provider.
96
+ * @param sandboxPolicy - per-call mode and workspace root; omit for the deployment fallback.
97
+ */
98
+ moveFile(source: FsTarget, destination: FsTarget, options: Parameters<LocalFileSystem['moveFile']>[2], signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsMoveOutcome>;
80
99
  /**
81
100
  * Enforce the per-call policy against `target` and return the EXACT target the
82
101
  * mutation must use, so the checked identity is the mutated one (no
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Datei-Sandbox-Zugriff",
4
+ "description": "Beschränken Sie den Umfang des Schreibens und Bearbeitens von Dateien entsprechend dem aktuellen Berechtigungsmodus."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Acceso a la zona de pruebas de archivos",
4
+ "description": "Limite el alcance de escritura y edición de archivos de acuerdo con el modo de permiso actual."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Accès au bac à sable de fichiers",
4
+ "description": "Limitez la portée de l’écriture et de la modification des fichiers en fonction du mode d’autorisation actuel."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "ファイルサンドボックスアクセス",
4
+ "description": "現在の権限モードに従って、ファイルの書き込みと編集を制限します。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Acesso à sandbox de arquivos",
4
+ "description": "Limite o escopo de gravação e edição de arquivos de acordo com o modo de permissão atual."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Доступ к файловой песочнице",
4
+ "description": "Ограничьте область записи и редактирования файлов в соответствии с текущим режимом разрешений."
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-fs-sandbox",
3
3
  "description": "Sandbox-enforcing implementation of the DeepSeek Harness filesystem seam: fences write/edit by the per-call sandbox mode (read-only denies mutation, workspace-write contains it to the workspace + temp roots) while reads pass through",
4
- "version": "0.2.1-rc.5",
4
+ "version": "0.2.2-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,18 +29,18 @@
29
29
  ],
30
30
  "license": "MIT",
31
31
  "peerDependencies": {
32
- "@deepseek-ai/dsh-fs": "0.2.1-rc.5",
33
- "@deepseek-ai/dsh-fs-local": "0.2.1-rc.5",
34
- "@deepseek-ai/dsh-sandbox": "0.2.1-rc.5",
35
- "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.5",
36
- "@deepseek-ai/cordis": "~4.0.5"
32
+ "@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
33
+ "@deepseek-ai/dsh-fs-local": "0.2.2-alpha.3",
34
+ "@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
35
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3",
36
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@deepseek-ai/dsh-fs": "0.2.1-rc.5",
40
- "@deepseek-ai/dsh-fs-local": "0.2.1-rc.5",
41
- "@deepseek-ai/dsh-sandbox": "0.2.1-rc.5",
42
- "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.5",
43
- "@deepseek-ai/cordis": "~4.0.5",
44
- "@deepseek-ai/dsh-session-projection": "0.2.1-rc.5"
39
+ "@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
40
+ "@deepseek-ai/dsh-fs-local": "0.2.2-alpha.3",
41
+ "@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
42
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3",
43
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2",
44
+ "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3"
45
45
  }
46
46
  }