@deepseek-ai/dsh-fs-sandbox 0.2.3-alpha.2 → 0.2.3-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
@@ -15,8 +15,8 @@
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-fs-sandbox/use-this-package:
18
- en: c159e3686e5b036d
19
- zh: 2ff0d0e7ce62cb30
18
+ en: 697ceeb4ea06248b
19
+ zh: 3f8d687491508baa
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: 6804c986bcfb5a97
37
- zh: b4309922f08383c3
36
+ en: 31f8b0aa6fcce03b
37
+ zh: 3775e98e0d8a36a7
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
@@ -25,7 +25,7 @@ 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.
28
+ The fence covers `writeText`, `writeBytes`, `editText`, `patchText`, `deleteFile`, and `moveFile`. A move checks both source and destination before either effect, so a denied path leaves both files untouched.
29
29
 
30
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.
31
31
 
@@ -69,7 +69,7 @@ The fence is a policy check in trusted code over a model-controlled path — not
69
69
 
70
70
  | File | Role |
71
71
  |---|---|
72
- | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`: mode fence on `writeText`/`editText`/`patchText`/`deleteFile`/`moveFile`, `sandboxMode` fact |
72
+ | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`: mode fence on `writeText`/`writeBytes`/`editText`/`patchText`/`deleteFile`/`moveFile`, `sandboxMode` fact |
73
73
  | [`src/containment.ts`](src/containment.ts) | Ancestor containment check with lexical fast path and identity-based fallback |
74
74
 
75
75
  ### How a mutation is fenced
package/README.zh.md CHANGED
@@ -25,7 +25,7 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
- 围栏覆盖 `writeText`、`editText`、`patchText`、`deleteFile` 和 `moveFile`。移动在任何效果发生前检查源与目标,因此任一路径被拒都会使两端文件保持不变。
28
+ 围栏覆盖 `writeText`、`writeBytes`、`editText`、`patchText`、`deleteFile` 和 `moveFile`。移动在任何效果发生前检查源与目标,因此任一路径被拒都会使两端文件保持不变。
29
29
 
30
30
  当模型的文件写入与编辑必须受会话沙箱模式约束、而读取保持不受约束时,挂载此后端以替代 `fs-local`。围栏按调用生效:工具层把调用会话的模式与工作区根目录解析为与 bash runner 收到的相同策略,因此文件系统与 shell 两个能力族绝不会约束到不同根目录。
31
31
 
@@ -69,7 +69,7 @@ kind: "package-reference"
69
69
 
70
70
  | 文件 | 职责 |
71
71
  |---|---|
72
- | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`:`writeText`/`editText`/`patchText`/`deleteFile`/`moveFile` 上的模式围栏、`sandboxMode` 事实 |
72
+ | [`src/index.ts`](src/index.ts) | `SandboxedFileSystem`:`writeText`/`writeBytes`/`editText`/`patchText`/`deleteFile`/`moveFile` 上的模式围栏、`sandboxMode` 事实 |
73
73
  | [`src/containment.ts`](src/containment.ts) | 祖先包含检查,带词法快速路径与基于身份的兜底 |
74
74
 
75
75
  ### 变更如何被围栏
package/lib/index.js CHANGED
@@ -70,7 +70,7 @@ async function isPathUnder(path, root, caseSensitive = process.platform !== "win
70
70
  * text-storage mechanics — resolve, stat, read/stream, list, the atomic
71
71
  * write and the read-match-write edit critical section — are the local
72
72
  * implementation's, verbatim; this package adds only the per-call POLICY fence
73
- * on all five mutations. Reads pass through untouched: every mode permits
73
+ * on all six mutations. Reads pass through untouched: every mode permits
74
74
  * reading.
75
75
  *
76
76
  * The fence is a policy check in TRUSTED code over a MODEL-CONTROLLED path,
@@ -125,6 +125,20 @@ var SandboxedFileSystem = class extends LocalFileSystem {
125
125
  return super.writeText(await this.checkedTarget(target, sandboxPolicy), content, expected, signal);
126
126
  }
127
127
  /**
128
+ * Fence the byte write by the per-call policy, then delegate to the inherited
129
+ * atomic write. See {@link checkedTarget}.
130
+ * @param target - the resolved target to write.
131
+ * @param data - the exact bytes to store.
132
+ * @param expected - the write intent guarding the write; omit for unconditional.
133
+ * @param signal - aborts before atomic publication takes effect.
134
+ * @param sandboxPolicy - the per-call mode and workspace root; omit to use
135
+ * the deployment fallback.
136
+ * @returns the write outcome from the inherited backend.
137
+ */
138
+ async writeBytes(target, data, expected, signal, sandboxPolicy) {
139
+ return super.writeBytes(await this.checkedTarget(target, sandboxPolicy), data, expected, signal);
140
+ }
141
+ /**
128
142
  * Fence the edit by the per-call policy, then delegate to the inherited
129
143
  * atomic edit. See {@link checkedTarget}.
130
144
  * @param target - the resolved target to edit.
@@ -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 all five mutations. Reads pass through untouched: every mode permits
7
+ * on all six 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 { FsDeleteOutcome, FsMoveOutcome, FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs';
31
+ import type { FsDeleteOutcome, FsMoveOutcome, FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteBytesOutcome, 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
@@ -63,6 +63,18 @@ export declare class SandboxedFileSystem extends LocalFileSystem {
63
63
  * @returns the write outcome from the inherited backend.
64
64
  */
65
65
  writeText(target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsWriteOutcome>;
66
+ /**
67
+ * Fence the byte write by the per-call policy, then delegate to the inherited
68
+ * atomic write. See {@link checkedTarget}.
69
+ * @param target - the resolved target to write.
70
+ * @param data - the exact bytes to store.
71
+ * @param expected - the write intent guarding the write; omit for unconditional.
72
+ * @param signal - aborts before atomic publication takes effect.
73
+ * @param sandboxPolicy - the per-call mode and workspace root; omit to use
74
+ * the deployment fallback.
75
+ * @returns the write outcome from the inherited backend.
76
+ */
77
+ writeBytes(target: FsTarget, data: Uint8Array, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsWriteBytesOutcome>;
66
78
  /**
67
79
  * Fence the edit by the per-call policy, then delegate to the inherited
68
80
  * atomic edit. See {@link checkedTarget}.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OA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WAAW,EAAE,CAAC;YACzB,MAAM,IAAI,OAAO,CAAC,iBAAiB,MAAM,CAAC,WAAW,4CAA4C,EAAE,mBAAmB,CAAC,CAAA;QACzH,CAAC;QACD,sEAAsE;QACtE,yEAAyE;QACzE,mEAAmE;QACnE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,SAAS,GAAG,KAAK,CAAA;QACrB,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,IAAI,MAAM,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC7C,SAAS,GAAG,IAAI,CAAA;gBAChB,MAAK;YACP,CAAC;QACH,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,OAAO,CAAC,iBAAiB,MAAM,CAAC,WAAW,kDAAkD,EAAE,mBAAmB,CAAC,CAAA;QAC/H,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AAGH,eAAe,mBAAmB,CAAA"}
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.3-alpha.2",
4
+ "version": "0.2.3-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -32,20 +32,20 @@
32
32
  ],
33
33
  "license": "MIT",
34
34
  "peerDependencies": {
35
- "@deepseek-ai/dsh-fs": "0.2.3-alpha.2",
36
- "@deepseek-ai/dsh-fs-local": "0.2.3-alpha.2",
37
- "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.2",
38
- "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.2",
39
- "@deepseek-ai/cordis": "~4.2.0-alpha.1"
35
+ "@deepseek-ai/dsh-fs": "0.2.3-alpha.3",
36
+ "@deepseek-ai/dsh-fs-local": "0.2.3-alpha.3",
37
+ "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.3",
38
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.3",
39
+ "@deepseek-ai/cordis": "~4.2.0-alpha.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@deepseek-ai/dsh-brand": "0.2.3-alpha.2",
43
- "@deepseek-ai/dsh-session": "0.2.3-alpha.2",
44
- "@deepseek-ai/dsh-fs": "0.2.3-alpha.2",
45
- "@deepseek-ai/dsh-fs-local": "0.2.3-alpha.2",
46
- "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.2",
47
- "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.2",
48
- "@deepseek-ai/cordis": "~4.2.0-alpha.1",
49
- "@deepseek-ai/dsh-session-projection": "0.2.3-alpha.2"
42
+ "@deepseek-ai/dsh-brand": "0.2.3-alpha.3",
43
+ "@deepseek-ai/dsh-session": "0.2.3-alpha.3",
44
+ "@deepseek-ai/dsh-fs": "0.2.3-alpha.3",
45
+ "@deepseek-ai/dsh-fs-local": "0.2.3-alpha.3",
46
+ "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.3",
47
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.3",
48
+ "@deepseek-ai/cordis": "~4.2.0-alpha.2",
49
+ "@deepseek-ai/dsh-session-projection": "0.2.3-alpha.3"
50
50
  }
51
51
  }
package/src/index.ts CHANGED
@@ -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 all five mutations. Reads pass through untouched: every mode permits
7
+ * on all six 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,
@@ -30,7 +30,7 @@ import { Context } from '@deepseek-ai/cordis'
30
30
  import { LocalFileSystem } from '@deepseek-ai/dsh-fs-local'
31
31
  import type { Config as LocalConfig } from '@deepseek-ai/dsh-fs-local'
32
32
  import { FsError } from '@deepseek-ai/dsh-fs'
33
- import type { FsDeleteOutcome, FsMoveOutcome, FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from '@deepseek-ai/dsh-fs'
33
+ import type { FsDeleteOutcome, FsMoveOutcome, FsEditOutcome, FsEditRequest, FsTarget, FsVersion, FsWriteIntent, FsWriteBytesOutcome, FsWriteOutcome } from '@deepseek-ai/dsh-fs'
34
34
  import { writableRoots } from '@deepseek-ai/dsh-sandbox'
35
35
  import type { SandboxExecutionPolicy, SandboxMode } from '@deepseek-ai/dsh-sandbox'
36
36
  import type {} from '@deepseek-ai/dsh-sandbox-policy'
@@ -87,6 +87,27 @@ export class SandboxedFileSystem extends LocalFileSystem {
87
87
  return super.writeText(await this.checkedTarget(target, sandboxPolicy), content, expected, signal)
88
88
  }
89
89
 
90
+ /**
91
+ * Fence the byte write by the per-call policy, then delegate to the inherited
92
+ * atomic write. See {@link checkedTarget}.
93
+ * @param target - the resolved target to write.
94
+ * @param data - the exact bytes to store.
95
+ * @param expected - the write intent guarding the write; omit for unconditional.
96
+ * @param signal - aborts before atomic publication takes effect.
97
+ * @param sandboxPolicy - the per-call mode and workspace root; omit to use
98
+ * the deployment fallback.
99
+ * @returns the write outcome from the inherited backend.
100
+ */
101
+ override async writeBytes(
102
+ target: FsTarget,
103
+ data: Uint8Array,
104
+ expected?: FsWriteIntent,
105
+ signal?: AbortSignal,
106
+ sandboxPolicy?: SandboxExecutionPolicy,
107
+ ): Promise<FsWriteBytesOutcome> {
108
+ return super.writeBytes(await this.checkedTarget(target, sandboxPolicy), data, expected, signal)
109
+ }
110
+
90
111
  /**
91
112
  * Fence the edit by the per-call policy, then delegate to the inherited
92
113
  * atomic edit. See {@link checkedTarget}.