@swoop111/dsh-tool-fs 0.2.0-rc.2 → 0.2.0-rc.2.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.
@@ -1,26 +1,26 @@
1
- /**
2
- * Derive the working directory a filesystem tool resolves relative paths against: the calling
3
- * agent's per-session workspace (`exec.agent.session.header.cwd`), so each session's
4
- * `read`/`write`/`edit` act on its workspace, not the server's launch directory.
5
- * Non-agent calls return `undefined`, leaving the fallback in the provider rather than reading
6
- * `process.cwd()` at the tool boundary.
7
- * @module @deepseek-ai/dsh-tool-fs/session-cwd
8
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
9
  import type { ToolExecution } from '@deepseek-ai/dsh-tools';
10
- /**
11
- * The session workspace cwd for this call, or `undefined` when none applies.
12
- * @param exec - the tool-execution context; only its optional `agent` is read.
13
- * @returns the calling agent's session cwd, or undefined for a non-agent caller (the backend then applies its own default).
14
- */
10
+
11
+
12
+
13
+
14
+
15
15
  export declare function sessionCwd(exec: ToolExecution): string | undefined;
16
- /**
17
- * Resolution options shared by all model-facing filesystem tools.
18
- * @param exec - the tool-execution context supplying session cwd and cancellation.
19
- * @param policyWorkspaceRoot - resolved per-call root, when a mutation carries sandbox policy.
20
- * @returns provider resolution options for the current tool call.
21
- */
16
+
17
+
18
+
19
+
20
+
21
+
22
22
  export declare function sessionResolveOptions(exec: ToolExecution, policyWorkspaceRoot?: string): {
23
23
  cwd?: string;
24
24
  signal?: AbortSignal;
25
25
  };
26
- //# sourceMappingURL=session-cwd.d.ts.map
26
+
@@ -1,67 +1,67 @@
1
- /**
2
- * Structural analysis of file text for read-window completion: markdown
3
- * fences, bracket nesting, and indentation blocks. The analyzers are pure
4
- * functions over already-delivered text; they decide which construct a window
5
- * boundary falls inside, and how many neighbouring lines close an open one.
6
- *
7
- * Precision is traded for never touching delivered content: a wrong verdict
8
- * only costs a few appended real lines, or a silent non-completion. String
9
- * literals are scanned per line (an unterminated quote never carries into the
10
- * next line), line comments and C-style block comments are skipped, and
11
- * brackets inside an open fence are content, so prose and code samples do not
12
- * fabricate unbalanced constructs.
13
- * @module @deepseek-ai/dsh-tool-fs/structure
14
- */
15
- /** Which structural rule produced a completion. */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
16
  export type CompletionRule = 'fence' | 'brace' | 'indent';
17
- /** An unbalanced construct at a window boundary. */
17
+
18
18
  export type OpenConstruct = {
19
19
  kind: 'fence';
20
- /** The opening fence marker, e.g. ` ``` ` or `~~~~`. */
20
+
21
21
  marker: string;
22
- /** Index of the line that opened the construct, within the scanned lines. */
22
+
23
23
  lineIndex: number;
24
24
  } | {
25
25
  kind: 'brace';
26
- /** Bracket levels still open at the boundary. */
26
+
27
27
  depth: number;
28
- /** Index of the innermost opening line, within the scanned lines. */
28
+
29
29
  lineIndex: number;
30
30
  } | {
31
31
  kind: 'indent';
32
- /** Indent width of the open block's body. */
32
+
33
33
  width: number;
34
- /** Index of the block header line, within the scanned lines. */
34
+
35
35
  lineIndex: number;
36
36
  };
37
- /** The construct a window starts inside, and the line that opened it. */
37
+
38
38
  export interface HeadContext {
39
- /** Which rule found the construct. */
39
+
40
40
  kind: CompletionRule;
41
- /** Index into the preceding lines of the line that opened the construct. */
41
+
42
42
  startIndex: number;
43
43
  }
44
- /**
45
- * The construct a window ends inside.
46
- * @param lines - the delivered window lines, in file order.
47
- * @returns the construct to close, or `undefined` when the tail is balanced.
48
- */
44
+
45
+
46
+
47
+
48
+
49
49
  export declare function detectOpenTail(lines: readonly string[]): OpenConstruct | undefined;
50
- /**
51
- * The construct a window starts inside, resolved from the lines that precede it.
52
- * A fence outranks a bracket block, which outranks an indented block. A
53
- * construct opened before the supplied preceding lines is not provable and
54
- * reports nothing, so the completion stays silent rather than guessing.
55
- * @param window - the delivered window lines, in file order.
56
- * @param preceding - the lines immediately before the window, in file order; the last entry is the line that precedes the window.
57
- * @returns the leading context, or `undefined` when the window starts at a construct boundary.
58
- */
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
59
  export declare function detectOpenHead(window: readonly string[], preceding: readonly string[]): HeadContext | undefined;
60
- /**
61
- * How many of the following lines close an open construct.
62
- * @param construct - the construct {@link detectOpenTail} found.
63
- * @param appended - the lines following the window, in file order.
64
- * @returns the count of lines to append, or `0` when the sequence closes nothing.
65
- */
60
+
61
+
62
+
63
+
64
+
65
+
66
66
  export declare function closureLength(construct: OpenConstruct, appended: readonly string[]): number;
67
- //# sourceMappingURL=structure.d.ts.map
67
+
@@ -1,37 +1,37 @@
1
- /**
2
- * Model-facing full-file write. It obtains an optional intent from the single policy slot, calls
3
- * `ctx.fs.writeText` without a stat, then records the resulting version; no policy means an
4
- * unconditional atomic create-or-overwrite.
5
- * @module @deepseek-ai/dsh-tool-fs/src/write
6
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
7
  import type { Context } from '@deepseek-ai/cordis';
8
8
  import type { FsWriteOutcome } from '@deepseek-ai/dsh-fs';
9
9
  import type { Session } from '@deepseek-ai/dsh-session';
10
10
  import type { FsSandboxController } from './sandbox.ts';
11
- /**
12
- * Tuning for the drifted-path hint: on a create, a verified high-similarity
13
- * existing path is disclosed as a note — never rewritten.
14
- */
11
+
12
+
13
+
14
+
15
15
  export interface WriteHintTuning {
16
- /** Master switch for the drifted-path hint. */
16
+
17
17
  pathHint: boolean;
18
- /**
19
- * Absolute path arguments of the session's prior successful tool calls, most
20
- * recent first — the similarity matcher's history source.
21
- */
18
+
19
+
20
+
21
+
22
22
  priorPaths(session: Session | undefined, limit?: number): string[];
23
23
  }
24
- /** Plugin-config shape for the write hint tuning. */
24
+
25
25
  export interface WriteRepairConfig {
26
- /** Disable the drifted-path hint so creates stay silent (default enabled). */
26
+
27
27
  pathHint?: boolean;
28
28
  }
29
- /**
30
- * Validate value constraints the schema DSL can't express: only a non-blank
31
- * `file_path` — an empty `content` is legitimate (it writes an empty file).
32
- * @param args - the schema-validated raw tool arguments.
33
- * @returns the camelCased input; `content` passes through untouched.
34
- */
29
+
30
+
31
+
32
+
33
+
34
+
35
35
  export declare function parseWriteArgs(args: {
36
36
  file_path: string;
37
37
  content: string;
@@ -39,19 +39,19 @@ export declare function parseWriteArgs(args: {
39
39
  filePath: string;
40
40
  content: string;
41
41
  };
42
- /**
43
- * Format a write outcome as one model-facing text block body.
44
- * @param displayPath - the backend-resolved path rendered in the envelope's `<path>` element.
45
- * @param outcome - the write outcome; its `operation` selects the Created/Updated wording.
46
- * @param hint - the drifted-path disclosure appended inside the content block, or undefined.
47
- * @returns the model-facing confirmation envelope (no file content is echoed back).
48
- */
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
49
  export declare function formatWriteOutput(displayPath: string, outcome: Pick<FsWriteOutcome, 'operation'>, hint?: string): string;
50
- /**
51
- * Register the `write` tool and its scope-aware system-prompt guidance.
52
- * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
53
- * @param sandbox - the shared sandbox-escalation API (advertisement, mode stamping, denial mapping).
54
- * @param hints - the drifted-path hint tuning; disabled keeps creates silent.
55
- */
50
+
51
+
52
+
53
+
54
+
55
+
56
56
  export declare function applyWriteTool(ctx: Context, sandbox: FsSandboxController, hints: WriteHintTuning): void;
57
- //# sourceMappingURL=write.d.ts.map
57
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swoop111/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.0-rc.2",
4
+ "version": "0.2.0-rc.2.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },