@deepseek-ai/dsh-fs-sandbox 0.2.2-alpha.2 → 0.2.2-rc.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 CHANGED
@@ -9,14 +9,14 @@
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
@@ -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
@@ -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
  ### 最小组合
@@ -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,
@@ -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,
@@ -28,7 +28,7 @@
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/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.2-alpha.2",
4
+ "version": "0.2.2-rc.1",
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.2-alpha.2",
33
- "@deepseek-ai/dsh-fs-local": "0.2.2-alpha.2",
34
- "@deepseek-ai/dsh-sandbox": "0.2.2-alpha.2",
35
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.2",
36
- "@deepseek-ai/cordis": "~4.0.6-alpha.1"
32
+ "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
33
+ "@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
34
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
35
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
36
+ "@deepseek-ai/cordis": "~4.1.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@deepseek-ai/dsh-fs": "0.2.2-alpha.2",
40
- "@deepseek-ai/dsh-fs-local": "0.2.2-alpha.2",
41
- "@deepseek-ai/dsh-sandbox": "0.2.2-alpha.2",
42
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.2",
43
- "@deepseek-ai/cordis": "~4.0.6-alpha.1",
44
- "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2"
39
+ "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
40
+ "@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
41
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
42
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
43
+ "@deepseek-ai/cordis": "~4.1.0",
44
+ "@deepseek-ai/dsh-session-projection": "0.2.2-rc.1"
45
45
  }
46
46
  }