@deepseek-ai/dsh-tool-fs 0.1.5-rc.2 → 0.1.6-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/lib/index.js +8 -14
- package/lib/types/session-cwd.d.ts +2 -5
- package/package.json +28 -28
package/lib/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
3
3
|
import { FsError } from "@deepseek-ai/dsh-fs";
|
|
4
|
-
import { ESCALATION_TARGETS, approveEscalation, canonicalPath, escalationHintMarker, sandboxDenialMarker, validateEscalationArgs } from "@deepseek-ai/dsh-sandbox";
|
|
5
4
|
import { structuredPatch } from "diff";
|
|
6
5
|
import { basename, extname } from "node:path";
|
|
7
6
|
import { AttachmentError, AttachmentId } from "@deepseek-ai/dsh-attachment";
|
|
7
|
+
import { ESCALATION_TARGETS, approveEscalation, escalationHintMarker, sandboxDenialMarker, validateEscalationArgs } from "@deepseek-ai/dsh-sandbox";
|
|
8
8
|
//#region lib/types/read-render.js
|
|
9
9
|
/**
|
|
10
10
|
* Pure read presentation: turn provider-decoded text into a bounded, line-numbered window and
|
|
@@ -229,28 +229,22 @@ function readMetaFromMeta(meta) {
|
|
|
229
229
|
* `process.cwd()` at the tool boundary.
|
|
230
230
|
* @module @deepseek-ai/dsh-tool-fs/session-cwd
|
|
231
231
|
*/
|
|
232
|
-
const PARENT_PATH_SEGMENT = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
233
232
|
/**
|
|
234
233
|
* The session workspace cwd for this call, or `undefined` when none applies.
|
|
235
234
|
* @param exec - the tool-execution context; only its optional `agent` is read.
|
|
236
|
-
* @param requestedPath - the path the provider will resolve; parent traversal
|
|
237
|
-
* makes a symlinked cwd's filesystem identity observable.
|
|
238
235
|
* @returns the calling agent's session cwd, or undefined for a non-agent caller (the backend then applies its own default).
|
|
239
236
|
*/
|
|
240
|
-
function sessionCwd(exec
|
|
241
|
-
|
|
242
|
-
if (cwd === void 0 || !PARENT_PATH_SEGMENT.test(cwd) && !PARENT_PATH_SEGMENT.test(requestedPath)) return cwd;
|
|
243
|
-
return canonicalPath(cwd);
|
|
237
|
+
function sessionCwd(exec) {
|
|
238
|
+
return exec.agent?.session.header.cwd;
|
|
244
239
|
}
|
|
245
240
|
/**
|
|
246
241
|
* Resolution options shared by all model-facing filesystem tools.
|
|
247
242
|
* @param exec - the tool-execution context supplying session cwd and cancellation.
|
|
248
|
-
* @param requestedPath - the path the provider will resolve.
|
|
249
243
|
* @param policyWorkspaceRoot - resolved per-call root, when a mutation carries sandbox policy.
|
|
250
244
|
* @returns provider resolution options for the current tool call.
|
|
251
245
|
*/
|
|
252
|
-
function sessionResolveOptions(exec,
|
|
253
|
-
const cwd = policyWorkspaceRoot ?? sessionCwd(exec
|
|
246
|
+
function sessionResolveOptions(exec, policyWorkspaceRoot) {
|
|
247
|
+
const cwd = policyWorkspaceRoot ?? sessionCwd(exec);
|
|
254
248
|
return {
|
|
255
249
|
...cwd !== void 0 ? { cwd } : {},
|
|
256
250
|
signal: exec.signal
|
|
@@ -270,7 +264,7 @@ function sessionResolveOptions(exec, requestedPath, policyWorkspaceRoot) {
|
|
|
270
264
|
* @returns the resolved target and its single stat result.
|
|
271
265
|
*/
|
|
272
266
|
async function resolveRegularReadTarget(ctx, exec, requestedPath) {
|
|
273
|
-
const target = await ctx.fs.resolve(requestedPath, sessionResolveOptions(exec
|
|
267
|
+
const target = await ctx.fs.resolve(requestedPath, sessionResolveOptions(exec));
|
|
274
268
|
const info = await ctx.fs.stat(target, exec.signal);
|
|
275
269
|
if (info === void 0) {
|
|
276
270
|
ctx.emit("fs/observed", target, { kind: "absent" }, exec);
|
|
@@ -646,7 +640,7 @@ function applyWriteTool(ctx, sandbox) {
|
|
|
646
640
|
async execute(args, exec) {
|
|
647
641
|
const input = parseWriteArgs(args);
|
|
648
642
|
const sandboxPolicy = await sandbox.resolvePolicy("write", args, exec);
|
|
649
|
-
const target = await ctx.fs.resolve(input.filePath, sessionResolveOptions(exec,
|
|
643
|
+
const target = await ctx.fs.resolve(input.filePath, sessionResolveOptions(exec, sandboxPolicy?.workspaceRoot));
|
|
650
644
|
const intent = await ctx.waterfall("fs/write-intent", target, exec, () => void 0);
|
|
651
645
|
let outcome;
|
|
652
646
|
try {
|
|
@@ -795,7 +789,7 @@ function applyEditTool(ctx, sandbox) {
|
|
|
795
789
|
async execute(args, exec) {
|
|
796
790
|
const input = parseEditArgs(args);
|
|
797
791
|
const sandboxPolicy = await sandbox.resolvePolicy("edit", args, exec);
|
|
798
|
-
const target = await ctx.fs.resolve(input.filePath, sessionResolveOptions(exec,
|
|
792
|
+
const target = await ctx.fs.resolve(input.filePath, sessionResolveOptions(exec, sandboxPolicy?.workspaceRoot));
|
|
799
793
|
let outcome;
|
|
800
794
|
try {
|
|
801
795
|
const intent = await ctx.waterfall("fs/edit-intent", target, exec, () => void 0);
|
|
@@ -10,19 +10,16 @@ import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
|
10
10
|
/**
|
|
11
11
|
* The session workspace cwd for this call, or `undefined` when none applies.
|
|
12
12
|
* @param exec - the tool-execution context; only its optional `agent` is read.
|
|
13
|
-
* @param requestedPath - the path the provider will resolve; parent traversal
|
|
14
|
-
* makes a symlinked cwd's filesystem identity observable.
|
|
15
13
|
* @returns the calling agent's session cwd, or undefined for a non-agent caller (the backend then applies its own default).
|
|
16
14
|
*/
|
|
17
|
-
export declare function sessionCwd(exec: ToolExecution
|
|
15
|
+
export declare function sessionCwd(exec: ToolExecution): string | undefined;
|
|
18
16
|
/**
|
|
19
17
|
* Resolution options shared by all model-facing filesystem tools.
|
|
20
18
|
* @param exec - the tool-execution context supplying session cwd and cancellation.
|
|
21
|
-
* @param requestedPath - the path the provider will resolve.
|
|
22
19
|
* @param policyWorkspaceRoot - resolved per-call root, when a mutation carries sandbox policy.
|
|
23
20
|
* @returns provider resolution options for the current tool call.
|
|
24
21
|
*/
|
|
25
|
-
export declare function sessionResolveOptions(exec: ToolExecution,
|
|
22
|
+
export declare function sessionResolveOptions(exec: ToolExecution, policyWorkspaceRoot?: string): {
|
|
26
23
|
cwd?: string;
|
|
27
24
|
signal?: AbortSignal;
|
|
28
25
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-fs",
|
|
3
3
|
"description": "Model-facing filesystem tools (read, write, edit) over the DeepSeek Harness filesystem seam (ctx.fs)",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,36 +31,36 @@
|
|
|
31
31
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/dsh-
|
|
38
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
39
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.
|
|
40
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-user-approval": "^0.1.
|
|
34
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
|
|
35
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
36
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.1",
|
|
37
|
+
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.1",
|
|
38
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.1",
|
|
39
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.1",
|
|
40
|
+
"@deepseek-ai/dsh-tools": "^0.1.6-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.1",
|
|
42
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.6-alpha.1",
|
|
43
43
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
47
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.
|
|
49
|
-
"@deepseek-ai/dsh-attachment": "^0.1.
|
|
50
|
-
"@deepseek-ai/dsh-fs
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/dsh-fs-observation-policy": "^0.1.
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.6-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-fs-observation-policy": "^0.1.6-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-llm-deepseek": "^0.1.6-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.1",
|
|
59
|
+
"@deepseek-ai/dsh-tools": "^0.1.6-alpha.1",
|
|
60
60
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
61
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.
|
|
62
|
-
"@deepseek-ai/dsh-scope": "^0.1.
|
|
63
|
-
"@deepseek-ai/dsh-
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
61
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.1",
|
|
62
|
+
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.1",
|
|
63
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.6-alpha.1",
|
|
64
|
+
"@deepseek-ai/dsh-ptc-runtime": "^0.1.6-alpha.1"
|
|
65
65
|
}
|
|
66
66
|
}
|