@deepseek-ai/dsh-tool-fs 0.2.2-alpha.2 → 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 +38 -20
- package/README.md +65 -7
- package/README.zh.md +65 -7
- package/lib/index.js +786 -29
- package/lib/types/apply-patch-output.d.ts +140 -0
- package/lib/types/apply-patch-presentation.d.ts +15 -0
- package/lib/types/apply-patch.d.ts +10 -0
- package/lib/types/diff.d.ts +6 -0
- package/lib/types/error.d.ts +8 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/patch/execute.d.ts +17 -0
- package/lib/types/patch/index.d.ts +17 -0
- package/lib/types/patch/plan.d.ts +52 -0
- package/lib/types/patch/preflight.d.ts +18 -0
- package/lib/types/patch/types.d.ts +106 -0
- package/lib/types/sandbox.d.ts +8 -0
- package/package.json +41 -38
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
2
|
+
import type { InferValue } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import type { PatchExecutionReport } from './patch/types.ts';
|
|
4
|
+
/** Strict canonical output; full file texts feed rendering and are excluded from presentation metadata. */
|
|
5
|
+
export declare const patchOutputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly additionalProperties: false;
|
|
8
|
+
readonly properties: {
|
|
9
|
+
readonly phase: {
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
readonly const: "commit";
|
|
12
|
+
readonly required: true;
|
|
13
|
+
};
|
|
14
|
+
readonly cancelled: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly required: true;
|
|
17
|
+
};
|
|
18
|
+
readonly operations: {
|
|
19
|
+
readonly type: "array";
|
|
20
|
+
readonly required: true;
|
|
21
|
+
readonly items: {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly additionalProperties: false;
|
|
24
|
+
readonly properties: {
|
|
25
|
+
readonly index: {
|
|
26
|
+
readonly type: "integer";
|
|
27
|
+
readonly required: true;
|
|
28
|
+
};
|
|
29
|
+
readonly kind: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly enum: readonly ["add", "update", "delete", "move"];
|
|
32
|
+
readonly required: true;
|
|
33
|
+
};
|
|
34
|
+
readonly path: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly required: true;
|
|
37
|
+
};
|
|
38
|
+
readonly destination: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
readonly patchLine: {
|
|
42
|
+
readonly type: "integer";
|
|
43
|
+
readonly required: true;
|
|
44
|
+
};
|
|
45
|
+
readonly status: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly enum: readonly ["completed", "failed", "unknown", "skipped"];
|
|
48
|
+
readonly required: true;
|
|
49
|
+
};
|
|
50
|
+
readonly code: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly message: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
readonly hunkLine: {
|
|
57
|
+
readonly type: "integer";
|
|
58
|
+
};
|
|
59
|
+
readonly changes: {
|
|
60
|
+
readonly type: "array";
|
|
61
|
+
readonly items: {
|
|
62
|
+
readonly type: "object";
|
|
63
|
+
readonly additionalProperties: false;
|
|
64
|
+
readonly properties: {
|
|
65
|
+
readonly path: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
readonly required: true;
|
|
68
|
+
};
|
|
69
|
+
readonly before: {
|
|
70
|
+
readonly required: true;
|
|
71
|
+
readonly oneOf: readonly [{
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
}, {
|
|
74
|
+
readonly type: "null";
|
|
75
|
+
}];
|
|
76
|
+
};
|
|
77
|
+
readonly after: {
|
|
78
|
+
readonly required: true;
|
|
79
|
+
readonly oneOf: readonly [{
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
}, {
|
|
82
|
+
readonly type: "null";
|
|
83
|
+
}];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly affectedPaths: {
|
|
92
|
+
readonly type: "array";
|
|
93
|
+
readonly items: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
};
|
|
96
|
+
readonly required: true;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/** Validated commit value shared by rendering and presentation. */
|
|
101
|
+
export type PatchToolValue = InferValue<typeof patchOutputSchema>;
|
|
102
|
+
/** Patch syntax and symbolic-link refusals retain their own stable codes. */
|
|
103
|
+
export declare class PatchToolError extends HarnessError {
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Convert a report into a commit value, or reject while no disk change exists.
|
|
107
|
+
* A commit whose first operation failed without any change, such as a provider sandbox
|
|
108
|
+
* denial, rejects like a preflight refusal so the error code reaches the same retry paths.
|
|
109
|
+
* @param report - executor report.
|
|
110
|
+
* @returns a flat, lossless JSON commit value, including partial failures.
|
|
111
|
+
* @throws FsError or PatchToolError for syntax, preflight, or first-operation refusals.
|
|
112
|
+
*/
|
|
113
|
+
export declare function patchToolValue(report: PatchExecutionReport): PatchToolValue;
|
|
114
|
+
/**
|
|
115
|
+
* Identify a stopped commit, including cancellation before the next operation.
|
|
116
|
+
* @param value - canonical patch result.
|
|
117
|
+
* @returns whether the patch did not finish every operation.
|
|
118
|
+
*/
|
|
119
|
+
export declare function patchStopped(value: PatchToolValue): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Render completed paths and actionable stopped-operation diagnostics.
|
|
122
|
+
* @param value - canonical patch result; paths already use the executor's display spelling.
|
|
123
|
+
* @returns concise model-visible text without whole-file contents.
|
|
124
|
+
*/
|
|
125
|
+
export declare function renderPatch(value: PatchToolValue): string;
|
|
126
|
+
/**
|
|
127
|
+
* Derive hunks only from known completed effects, including a partial move destination.
|
|
128
|
+
* Creations store no diff, as for `write`; a removal without a bounded basis stores none either.
|
|
129
|
+
* @param value - canonical commit value containing the provider's bounded baselines.
|
|
130
|
+
* @returns serializable diff hunks and an explicit stopped flag; no whole-file change records.
|
|
131
|
+
*/
|
|
132
|
+
export declare function patchPresentationMeta(value: PatchToolValue): {
|
|
133
|
+
diffs: {
|
|
134
|
+
path: string;
|
|
135
|
+
oldText: string | null;
|
|
136
|
+
newText: string;
|
|
137
|
+
}[];
|
|
138
|
+
stopped: boolean;
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=apply-patch-output.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DiffCallView, DiffResultView, ToolResult } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
/**
|
|
3
|
+
* Preview the requested operations without resolving paths or reading the filesystem.
|
|
4
|
+
* A deletion has no diff text to preview and appears only among the locations.
|
|
5
|
+
* @param patch - raw patch argument.
|
|
6
|
+
* @returns a diff call view, or undefined when syntax is invalid.
|
|
7
|
+
*/
|
|
8
|
+
export declare function presentPatchCall(patch: string): DiffCallView | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Present applied metadata; failed or missing metadata uses generic result rendering.
|
|
11
|
+
* @param result - live or replayed tool result.
|
|
12
|
+
* @returns known applied hunks with a stopped title where appropriate.
|
|
13
|
+
*/
|
|
14
|
+
export declare function presentPatchResult(result: ToolResult): DiffResultView | undefined;
|
|
15
|
+
//# sourceMappingURL=apply-patch-presentation.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Codex-style multi-file patch tool over the guarded patch executor. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { FsSandboxController } from './sandbox.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Register the patch tool and scope-aware guidance using the shared mutation controller.
|
|
6
|
+
* @param ctx - plugin effect scope and filesystem services.
|
|
7
|
+
* @param sandbox - per-call policy resolver and denial mapper.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyApplyPatchTool(ctx: Context, sandbox: FsSandboxController): void;
|
|
10
|
+
//# sourceMappingURL=apply-patch.d.ts.map
|
package/lib/types/diff.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export declare function computeHunkDiffs(path: string, before: string, after: st
|
|
|
38
38
|
* @returns validated hunks, or `undefined` for absent or malformed data.
|
|
39
39
|
*/
|
|
40
40
|
export declare function diffsFromMeta(meta: unknown): FileDiff[] | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Narrow the patch tool's optional stopped flag from persisted metadata.
|
|
43
|
+
* @param meta - opaque live or replayed result metadata.
|
|
44
|
+
* @returns true only for an explicit stopped flag.
|
|
45
|
+
*/
|
|
46
|
+
export declare function stoppedFromMeta(meta: unknown): boolean;
|
|
41
47
|
/**
|
|
42
48
|
* Read the operation's file path even when the applied diff is empty.
|
|
43
49
|
* @param meta - opaque persisted result metadata.
|
package/lib/types/error.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* stable message shown to the model.
|
|
5
5
|
* @module @deepseek-ai/dsh-tool-fs/src/error
|
|
6
6
|
*/
|
|
7
|
+
import { FsError } from '@deepseek-ai/dsh-fs';
|
|
7
8
|
/**
|
|
8
9
|
* Render the stable model-facing diagnostic for a guarded-mutation failure.
|
|
9
10
|
* `FS_STALE_VERSION` keeps the provider's reason and appends its re-read
|
|
@@ -15,5 +16,12 @@
|
|
|
15
16
|
* @param displayPath - the resolved target path shown to the model.
|
|
16
17
|
* @returns a remediated `FsError` for the two guarded-mutation codes, else the original value.
|
|
17
18
|
*/
|
|
19
|
+
export declare function remediateFsError(error: FsError, displayPath: string): FsError;
|
|
20
|
+
/**
|
|
21
|
+
* Remediate a caught value, preserving non-filesystem failures.
|
|
22
|
+
* @param error - value thrown by an execution.
|
|
23
|
+
* @param displayPath - resolved target path shown to the model.
|
|
24
|
+
* @returns a remediated filesystem error, or the unchanged caught value.
|
|
25
|
+
*/
|
|
18
26
|
export declare function remediateFsError(error: unknown, displayPath: string): unknown;
|
|
19
27
|
//# sourceMappingURL=error.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Model-facing read, read_image, write, and
|
|
2
|
+
* Model-facing read, read_image, write, edit, and apply_patch tools over `ctx.fs`. This package owns schemas, validation,
|
|
3
3
|
* read windows, formatting, and observation events, never a concrete provider. An optional
|
|
4
4
|
* event policy supplies mutation guards; without one the tools use unconditional provider calls.
|
|
5
5
|
* @module @deepseek-ai/dsh-tool-fs
|
|
@@ -20,6 +20,8 @@ export interface Config {
|
|
|
20
20
|
write?: boolean;
|
|
21
21
|
/** Register `edit` and its guidance. Defaults to true. */
|
|
22
22
|
edit?: boolean;
|
|
23
|
+
/** Register `apply_patch` and its guidance beside `edit`. Defaults to false; shipped compositions set it on their `tool-fs` rows. */
|
|
24
|
+
applyPatch?: boolean;
|
|
23
25
|
/** Default and maximum number of lines returned by one `read` call. */
|
|
24
26
|
readLimit?: number;
|
|
25
27
|
/** Maximum characters returned for a single line before truncation. */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Sequential provider commits with truthful partial results and uncertainty checks. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
4
|
+
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
5
|
+
import type { FsSandboxController } from '../sandbox.ts';
|
|
6
|
+
import type { PatchExecutionReport, PlannedOperation } from './types.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Commit a fully admitted plan; the first failure stops later operations without rollback.
|
|
9
|
+
* @param ctx - provider and observation dispatcher.
|
|
10
|
+
* @param sandbox - existing model-facing denial mapper.
|
|
11
|
+
* @param exec - session actor and cancellation signal.
|
|
12
|
+
* @param policy - request's resolved confinement policy.
|
|
13
|
+
* @param operations - operations that all passed preflight.
|
|
14
|
+
* @returns known changes, failed or unknown effects, and skipped successors in patch order.
|
|
15
|
+
*/
|
|
16
|
+
export declare function commitPatch(ctx: Context, sandbox: FsSandboxController, exec: ToolExecution, policy: SandboxExecutionPolicy | undefined, operations: readonly PlannedOperation[]): Promise<PatchExecutionReport>;
|
|
17
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Internal patch executor; tool registration and persisted result metadata are owned by its caller. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
4
|
+
import type { FsSandboxController } from '../sandbox.ts';
|
|
5
|
+
import type { PatchExecutionReport, PatchExecutionRequest } from './types.ts';
|
|
6
|
+
export type { PatchExecutionReport, PatchExecutionRequest, PatchFailure, PatchFailureCode, PatchFileChange, PatchOperationOutcome, PatchOperationRecord, PatchRefusal } from './types.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Preflight a whole patch before sequential guarded mutations; business failures become records.
|
|
9
|
+
* @param ctx - mounted filesystem and observation-policy events.
|
|
10
|
+
* @param sandbox - denial mapper shared with existing filesystem tools.
|
|
11
|
+
* @param exec - session cwd, observation actor, and cancellation signal.
|
|
12
|
+
* @param request - raw patch and policy already resolved by the caller.
|
|
13
|
+
* @returns the syntax failure, the preflight refusals, or ordered commit outcomes.
|
|
14
|
+
* @throws unexpected programming defects without starting further operations.
|
|
15
|
+
*/
|
|
16
|
+
export declare function executePatch(ctx: Context, sandbox: FsSandboxController, exec: ToolExecution, request: PatchExecutionRequest): Promise<PatchExecutionReport>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Patch parsing and target identity shared by preflight and sequential commits. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { FsError } from '@deepseek-ai/dsh-fs';
|
|
4
|
+
import type { FsTarget, FsVersion, FsWriteIntent } from '@deepseek-ai/dsh-fs';
|
|
5
|
+
import type { SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
6
|
+
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
7
|
+
import type { FsSandboxController } from '../sandbox.ts';
|
|
8
|
+
import type { PatchExecutionRequest, PatchFailure, PatchPlan, PlannedOperation } from './types.ts';
|
|
9
|
+
/**
|
|
10
|
+
* Resolve every operation without dropping repeated aliases or splitting moves.
|
|
11
|
+
* @param ctx - filesystem service owner.
|
|
12
|
+
* @param sandbox - filesystem diagnostic mapper.
|
|
13
|
+
* @param exec - session cwd and execution signal.
|
|
14
|
+
* @param request - raw patch and resolved per-call policy.
|
|
15
|
+
* @returns resolved operations sharing one target per canonical key, plus resolution refusals.
|
|
16
|
+
*/
|
|
17
|
+
export declare function planPatch(ctx: Context, sandbox: FsSandboxController, exec: ToolExecution, request: PatchExecutionRequest): Promise<PatchPlan>;
|
|
18
|
+
/**
|
|
19
|
+
* Obtain a source guard without recording an observation.
|
|
20
|
+
* @param ctx - intent dispatcher.
|
|
21
|
+
* @param exec - opaque observation actor.
|
|
22
|
+
* @param target - resolved source.
|
|
23
|
+
* @param kind - deletion or edit-family source policy.
|
|
24
|
+
* @returns the observed version, or undefined for a bare provider.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sourceIntent(ctx: Context, exec: ToolExecution, target: FsTarget, kind: 'delete' | 'edit'): Promise<{
|
|
27
|
+
version: FsVersion;
|
|
28
|
+
} | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Obtain a write guard without recording an observation.
|
|
31
|
+
* @param ctx - intent dispatcher.
|
|
32
|
+
* @param exec - opaque observation actor.
|
|
33
|
+
* @param target - resolved write destination.
|
|
34
|
+
* @returns the observed write intent, or undefined for a bare provider.
|
|
35
|
+
*/
|
|
36
|
+
export declare function destinationIntent(ctx: Context, exec: ToolExecution, target: FsTarget): Promise<FsWriteIntent | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Preserve filesystem codes while applying the existing model-facing error policy.
|
|
39
|
+
* @param sandbox - shared denial mapper.
|
|
40
|
+
* @param policy - policy supplied by the request.
|
|
41
|
+
* @param error - expected filesystem failure.
|
|
42
|
+
* @param path - display path whose operation failed.
|
|
43
|
+
* @returns the remediated code and message; unexpected mapper defects reject.
|
|
44
|
+
*/
|
|
45
|
+
export declare function patchFailure(sandbox: FsSandboxController, policy: SandboxExecutionPolicy | undefined, error: FsError, path: string): PatchFailure;
|
|
46
|
+
/**
|
|
47
|
+
* List all targets the operation can mutate, with destination first for a move.
|
|
48
|
+
* @param operation - resolved operation.
|
|
49
|
+
* @returns targets whose versions the uncertainty comparison records.
|
|
50
|
+
*/
|
|
51
|
+
export declare function mutationTargets(operation: PlannedOperation): FsTarget[];
|
|
52
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Read-only simulation of patch effects; no internal read establishes model observation. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
4
|
+
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
5
|
+
import type { FsSandboxController } from '../sandbox.ts';
|
|
6
|
+
import type { PatchRefusal, PlannedOperation } from './types.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Collect every independent preflight refusal while simulating only admitted operations.
|
|
9
|
+
* Sandbox containment is the provider's decision at commit, as for write and edit.
|
|
10
|
+
* @param ctx - filesystem service owner; reads never emit observations.
|
|
11
|
+
* @param sandbox - model-facing denial mapper.
|
|
12
|
+
* @param exec - observation actor and cancellation signal.
|
|
13
|
+
* @param policy - resolved confinement policy used to label refusals.
|
|
14
|
+
* @param operations - complete resolved operation plan.
|
|
15
|
+
* @returns refused operations in patch order; any refusal forbids the commit phase.
|
|
16
|
+
*/
|
|
17
|
+
export declare function preflightPatch(ctx: Context, sandbox: FsSandboxController, exec: ToolExecution, policy: SandboxExecutionPolicy | undefined, operations: readonly PlannedOperation[]): Promise<PatchRefusal[]>;
|
|
18
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Internal patch outcomes, failure diagnostics, and operation-local plans. */
|
|
2
|
+
import type { FsErrorCode, FsTarget } from '@deepseek-ai/dsh-fs';
|
|
3
|
+
import type { PatchHunk } from '@deepseek-ai/dsh-fs-patch';
|
|
4
|
+
import type { SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
5
|
+
/** One request after the caller resolves its per-call sandbox policy. */
|
|
6
|
+
export interface PatchExecutionRequest {
|
|
7
|
+
/** Raw patch text from the model. */
|
|
8
|
+
patch: string;
|
|
9
|
+
/** Resolved per-call policy; undefined under an unconfined backend. */
|
|
10
|
+
sandboxPolicy: SandboxExecutionPolicy | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** One file operation; unresolved paths retain their original patch spelling on resolution failure. */
|
|
13
|
+
export interface PatchOperationRecord {
|
|
14
|
+
/** Zero-based position in the patch. */
|
|
15
|
+
index: number;
|
|
16
|
+
/** File effect represented by this operation. */
|
|
17
|
+
kind: 'add' | 'update' | 'delete' | 'move';
|
|
18
|
+
/** Source display path (created path for add), or raw patch path if resolution failed. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Move destination display path, or raw patch path if it could not be resolved. */
|
|
21
|
+
destination?: string;
|
|
22
|
+
/** One-based patch line of the operation header. */
|
|
23
|
+
patchLine: number;
|
|
24
|
+
}
|
|
25
|
+
/** LF text before and after one effect; null means absence or an unavailable provider basis. */
|
|
26
|
+
export interface PatchFileChange {
|
|
27
|
+
/** Canonical absolute process path that changed. */
|
|
28
|
+
path: string;
|
|
29
|
+
/** Previous text, or null for absence or an unavailable basis. */
|
|
30
|
+
before: string | null;
|
|
31
|
+
/** Published text, or null after deletion. */
|
|
32
|
+
after: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** Filesystem failures plus syntax and disallowed symlink-source diagnostics. */
|
|
35
|
+
export type PatchFailureCode = FsErrorCode | 'PATCH_SYNTAX' | 'PATCH_SYMLINK_SOURCE';
|
|
36
|
+
/** Actionable diagnostic ready for model output. */
|
|
37
|
+
export interface PatchFailure {
|
|
38
|
+
/** Stable machine-readable reason. */
|
|
39
|
+
code: PatchFailureCode;
|
|
40
|
+
/** Message after sandbox denial mapping and filesystem remediation. */
|
|
41
|
+
message: string;
|
|
42
|
+
/** Patch line of an unmatched hunk. */
|
|
43
|
+
hunkLine?: number;
|
|
44
|
+
}
|
|
45
|
+
/** One operation refused before any write. */
|
|
46
|
+
export interface PatchRefusal {
|
|
47
|
+
operation: PatchOperationRecord;
|
|
48
|
+
failure: PatchFailure;
|
|
49
|
+
}
|
|
50
|
+
/** Each operation retains completed effects even when a move fails halfway. */
|
|
51
|
+
export type PatchOperationOutcome = {
|
|
52
|
+
status: 'completed';
|
|
53
|
+
operation: PatchOperationRecord;
|
|
54
|
+
changes: PatchFileChange[];
|
|
55
|
+
} | {
|
|
56
|
+
status: 'failed';
|
|
57
|
+
operation: PatchOperationRecord;
|
|
58
|
+
failure: PatchFailure;
|
|
59
|
+
changes: PatchFileChange[];
|
|
60
|
+
} | {
|
|
61
|
+
status: 'unknown';
|
|
62
|
+
operation: PatchOperationRecord;
|
|
63
|
+
failure: PatchFailure;
|
|
64
|
+
} | {
|
|
65
|
+
status: 'skipped';
|
|
66
|
+
operation: PatchOperationRecord;
|
|
67
|
+
};
|
|
68
|
+
/** Syntax and preflight refusals prevent all writes; a commit failure stops later operations. */
|
|
69
|
+
export type PatchExecutionReport = {
|
|
70
|
+
phase: 'syntax';
|
|
71
|
+
failure: PatchFailure;
|
|
72
|
+
} | {
|
|
73
|
+
phase: 'preflight';
|
|
74
|
+
refusals: [PatchRefusal, ...PatchRefusal[]];
|
|
75
|
+
} | {
|
|
76
|
+
phase: 'commit';
|
|
77
|
+
outcomes: PatchOperationOutcome[];
|
|
78
|
+
affectedPaths: string[];
|
|
79
|
+
cancelled: boolean;
|
|
80
|
+
};
|
|
81
|
+
/** Resolved operation with raw source spelling retained for no-follow inspection. */
|
|
82
|
+
export type PlannedOperation = {
|
|
83
|
+
record: PatchOperationRecord;
|
|
84
|
+
target: FsTarget;
|
|
85
|
+
rawPath: string;
|
|
86
|
+
} & ({
|
|
87
|
+
kind: 'add';
|
|
88
|
+
content: string;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'update';
|
|
91
|
+
hunks: readonly PatchHunk[];
|
|
92
|
+
} | {
|
|
93
|
+
kind: 'delete';
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'move';
|
|
96
|
+
destination: FsTarget;
|
|
97
|
+
hunks: readonly PatchHunk[];
|
|
98
|
+
});
|
|
99
|
+
/** Resolved operations and path-resolution refusals in one parsed patch. */
|
|
100
|
+
export interface PatchPlan {
|
|
101
|
+
/** Resolved operations in patch order. */
|
|
102
|
+
operations: PlannedOperation[];
|
|
103
|
+
/** Resolution refusals; unresolvable paths retain their raw patch spelling. */
|
|
104
|
+
refusals: PatchRefusal[];
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=types.d.ts.map
|
package/lib/types/sandbox.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { Context } from '@deepseek-ai/cordis';
|
|
13
13
|
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
14
14
|
import type { SandboxExecutionPolicy, SandboxMode } from '@deepseek-ai/dsh-sandbox';
|
|
15
|
+
import { FsError } from '@deepseek-ai/dsh-fs';
|
|
15
16
|
/** The two escalation arguments a mutating tool may carry (advertised only under a confining backend). */
|
|
16
17
|
export interface FsEscalationArgs {
|
|
17
18
|
sandbox_permissions?: string;
|
|
@@ -78,6 +79,13 @@ export declare class FsSandboxController {
|
|
|
78
79
|
* @param policy - the policy stamped onto the call (names the mode in the marker).
|
|
79
80
|
* @returns the error to throw — the marker `FsError` for a sandbox denial, else the original.
|
|
80
81
|
*/
|
|
82
|
+
mapError(error: FsError, policy: SandboxExecutionPolicy | undefined): FsError;
|
|
83
|
+
/**
|
|
84
|
+
* Map a caught value, preserving failures other than sandbox denials.
|
|
85
|
+
* @param error - value thrown by a mutation.
|
|
86
|
+
* @param policy - policy stamped onto the call, when applicable.
|
|
87
|
+
* @returns the denial marker error, or the unchanged caught value.
|
|
88
|
+
*/
|
|
81
89
|
mapError(error: unknown, policy: SandboxExecutionPolicy | undefined): unknown;
|
|
82
90
|
}
|
|
83
91
|
//# sourceMappingURL=sandbox.d.ts.map
|
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.2.2-alpha.
|
|
4
|
+
"version": "0.2.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,46 +30,49 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"diff": "^9.0.0",
|
|
33
|
-
"@deepseek-ai/schemastery": "~3.18.6-alpha.
|
|
34
|
-
"@deepseek-ai/dsh-util-code-language": "0.2.2-alpha.
|
|
33
|
+
"@deepseek-ai/schemastery": "~3.18.6-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-util-code-language": "0.2.2-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-fs-patch": "0.2.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-util-values": "0.2.2-alpha.3"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
|
-
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.
|
|
38
|
-
"@deepseek-ai/dsh-fs": "0.2.2-alpha.
|
|
39
|
-
"@deepseek-ai/dsh-llm": "0.2.2-alpha.
|
|
40
|
-
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.
|
|
41
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.
|
|
42
|
-
"@deepseek-ai/dsh-session": "0.2.2-alpha.
|
|
43
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.
|
|
44
|
-
"@deepseek-ai/dsh-tools": "0.2.2-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.
|
|
46
|
-
"@deepseek-ai/cordis": "~4.0.6-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.
|
|
39
|
+
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.3",
|
|
40
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
|
|
41
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
42
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
|
|
43
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3",
|
|
44
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
45
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.3",
|
|
48
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.3"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"@deepseek-ai/dsh-agent": "0.2.2-alpha.
|
|
51
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.
|
|
52
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.
|
|
53
|
-
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.
|
|
54
|
-
"@deepseek-ai/dsh-fs": "0.2.2-alpha.
|
|
55
|
-
"@deepseek-ai/dsh-fs-local": "0.2.2-alpha.
|
|
56
|
-
"@deepseek-ai/dsh-fs-observation-policy": "0.2.2-alpha.
|
|
57
|
-
"@deepseek-ai/dsh-llm": "0.2.2-alpha.
|
|
58
|
-
"@deepseek-ai/dsh-llm-deepseek": "0.2.2-alpha.
|
|
59
|
-
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.2-alpha.
|
|
60
|
-
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.
|
|
61
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.
|
|
62
|
-
"@deepseek-ai/dsh-session": "0.2.2-alpha.
|
|
63
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.
|
|
64
|
-
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-alpha.
|
|
65
|
-
"@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-alpha.
|
|
66
|
-
"@deepseek-ai/dsh-tool-testkit": "0.2.2-alpha.
|
|
67
|
-
"@deepseek-ai/dsh-tools": "0.2.2-alpha.
|
|
68
|
-
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.
|
|
69
|
-
"@deepseek-ai/cordis": "~4.0.6-alpha.
|
|
70
|
-
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.
|
|
71
|
-
"@deepseek-ai/dsh-scope": "0.2.2-alpha.
|
|
72
|
-
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-alpha.
|
|
73
|
-
"@deepseek-ai/dsh-
|
|
52
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
|
|
53
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.3",
|
|
55
|
+
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.3",
|
|
56
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
|
|
57
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-alpha.3",
|
|
58
|
+
"@deepseek-ai/dsh-fs-observation-policy": "0.2.2-alpha.3",
|
|
59
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
60
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.2.2-alpha.3",
|
|
61
|
+
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.2-alpha.3",
|
|
62
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
|
|
63
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3",
|
|
64
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
65
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
66
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-alpha.3",
|
|
67
|
+
"@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-alpha.3",
|
|
68
|
+
"@deepseek-ai/dsh-tool-testkit": "0.2.2-alpha.3",
|
|
69
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
70
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.3",
|
|
71
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
72
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
|
|
73
|
+
"@deepseek-ai/dsh-scope": "0.2.2-alpha.3",
|
|
74
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-alpha.3",
|
|
75
|
+
"@deepseek-ai/dsh-fs-sandbox": "0.2.2-alpha.3",
|
|
76
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.3"
|
|
74
77
|
}
|
|
75
78
|
}
|