@deepseek-ai/dsh-tool-fs 0.1.3-alpha.2 → 0.1.5-alpha.2

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
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/fs/tool-fs/README.md
5
- README.md: 6da984ff436f3515b4798ddb47e3a15466672f9e
6
- README.zh.md: e4d1ef8483c2e644f2e6308e1965d87773278515
5
+ README.md: 9d338a6227b7f02ef43fcbe97900b166cb722817
6
+ README.zh.md: 0c34f840ad449847a649df8abdadec01f772f37b
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-tool-fs` provides the model-facing filesystem tools — `read`, `read_image`, `write`, and `edit` — and their executor. With them the model reads files with line numbers, creates or replaces them atomically, and applies targeted literal edits; results are capped and failures carry stable codes with recovery instructions, all backed by a mounted `ctx.fs` backend. The read-before-edit policy lives in a separate plugin (`dsh-fs-observation-policy`), so omitting it yields unconditional, still-atomic mutations. `read_image` appears while a durable attachment store is mounted and refuses execution unless the routed model declares image input. Choose this package when the model should read, create, replace, or edit UTF-8 text files; discovery (`glob`/`grep`) is a sibling package.
12
+ Use `dsh-tool-fs` to let a model read UTF-8 files with line numbers, read supported images, create or atomically replace files, and apply targeted literal edits. Results are capped, and failures provide stable error codes and recovery instructions. Add `dsh-fs-observation-policy` when writes and edits must follow a successful read; without it, mutations remain atomic but are unconditional. Image reads require durable attachment storage and an image-capable routed model. Choose the sibling discovery package for glob or grep searches.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -133,7 +133,7 @@ Read these pages when the package-level contract is not enough. They move from t
133
133
 
134
134
  #### What the model sees
135
135
 
136
- Every request in this plugin's registration scope receives the independently registered read, write, and edit guidance below. Scoped tool restrictions can hide schemas without removing these sections.
136
+ At assembly time, each guidance section checks `ctx.tools.get(name, scope)` and renders only while its tool is visible to that agent. The write paragraph recommends edit only while edit is visible. The text below is unchanged when all three tools are available; restrictions, their removal, and tool registration changes take effect on the next assembly. The same check works for direct agent restrictions and subagent `toolFilter`, including PTC capabilities behind `run_code`. The read-before-mutation sentences in write/edit describe the observation policy, not a requirement to invoke the tool named `read`. They remain when `read` is hidden: the policy still guards mutations, and another observing operation, such as `str_replace_editor` with `command: view`, can establish the same file observation. Tool visibility does not disable that precondition.
137
137
 
138
138
  ##### Read guidance
139
139
 
@@ -155,11 +155,11 @@ Use the edit tool for targeted changes to existing UTF-8 text files. It replaces
155
155
 
156
156
  #### Token effect
157
157
 
158
- Fixed guidance cost per request while the plugin is active, even when a restriction hides one or more tools.
158
+ Guidance cost follows the visible tools and their applicable cross-tool recommendations.
159
159
 
160
160
  #### KV Cache effect
161
161
 
162
- Prefix-stable while the plugin scope and guidance text are unchanged. Tool restrictions do not remove this section, but plugin activation or disposal may invalidate reuse from it.
162
+ Prefix-stable while the visible tool set, plugin scope, and guidance text are unchanged. Restrictions or plugin lifecycle changes may invalidate reuse from the first changed section.
163
163
 
164
164
  ### Tool schemas
165
165
 
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- `dsh-tool-fs` 提供面向模型的文件系统工具——`read`、`read_image`、`write` 与 `edit`——及其执行器。借助它们,模型可以带行号读取文件、原子地创建或替换文件,并执行有针对性的字面量编辑;结果都有上限,失败携带稳定错误码与恢复指令,所有文件操作都运行在已挂载的 `ctx.fs` 后端之上。编辑前读取策略位于独立插件(`dsh-fs-observation-policy`)中,因此省略它只会得到无条件、依然原子的变更。`read_image` 在持久附件存储已挂载时出现,并且只在路由模型声明图片输入时允许执行。当模型需要读取、创建、替换或编辑 UTF-8 文本文件时选择本包;发现工具(`glob`/`grep`)在同级包中。
12
+ 使用 `dsh-tool-fs` 可让模型带行号读取 UTF-8 文件、读取受支持的图片、创建或原子地替换文件,以及执行有针对性的字面量编辑。结果都有上限,失败会提供稳定错误码与恢复指令。当写入和编辑必须在成功读取后执行时,请添加 `dsh-fs-observation-policy`;省略它时,变更仍是原子的,但不受此条件约束。图片读取需要持久附件存储和支持图片输入的路由模型。glob 或 grep 搜索请选择同级的发现工具包。
13
13
 
14
14
  ## 目录
15
15
 
@@ -133,7 +133,7 @@ kind: "package-reference"
133
133
 
134
134
  #### 模型看到的内容
135
135
 
136
- 该插件注册作用域内的每个请求都会收到下方独立注册的 read、write 与 edit 指导。作用域工具限制可以隐藏 schema,而不移除这些段。
136
+ 组装时,每个指导段落通过 `ctx.tools.get(name, scope)` 检查对应工具,仅在该 agent 可见时输出。write 段落仅在 edit 可见时推荐 edit。三个工具都可用时,下方原文保持不变;限制的施加、解除和工具注册变化在下次组装时生效。同一检查适用于直接限制 agent 和 subagent 的 `toolFilter`,也适用于通过 `run_code` 暴露的 PTC 能力。 write/edit 中的先读后改句子描述观察策略,并非要求调用名为 `read` 的工具。隐藏 `read` 时仍保留这些句子:策略继续保护修改操作,其他产生观察记录的操作(例如 `str_replace_editor` 的 `command: view`)也能建立同一文件观察记录。工具可见性不会禁用该前置条件。
137
137
 
138
138
  ##### Read 指导
139
139
 
@@ -155,11 +155,11 @@ Use the edit tool for targeted changes to existing UTF-8 text files. It replaces
155
155
 
156
156
  #### Token 影响
157
157
 
158
- 插件启用期间,每个请求支付固定指导成本;即使限制隐藏了一个或多个工具也一样。
158
+ 指导成本取决于可见工具及其适用的跨工具推荐。
159
159
 
160
160
  #### KV Cache 影响
161
161
 
162
- 只要插件作用域和指导文本不变,前缀就保持稳定。工具限制不会移除该段,但插件启用或 dispose(资源释放)可能从该段开始使复用失效。
162
+ 可见工具集合、插件作用域和指导文本不变时,前缀保持稳定。限制或插件生命周期变化可能从首个变化的段落开始使复用失效。
163
163
 
164
164
  ### 工具 schema
165
165
 
package/lib/index.js CHANGED
@@ -318,7 +318,7 @@ function parseReadArgs(args, maxLimit) {
318
318
  };
319
319
  }
320
320
  /**
321
- * Register the `read` tool and its system-prompt guidance.
321
+ * Register the `read` tool and its scope-aware system-prompt guidance.
322
322
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
323
323
  * @param caps - the deployment's resolved read caps (plugin config after defaulting).
324
324
  */
@@ -326,7 +326,7 @@ function applyReadTool(ctx, caps) {
326
326
  ctx.systemPrompt.section({
327
327
  name: "tool:read",
328
328
  order: ctx.systemPrompt.getSectionOrder("TOOL_READ"),
329
- text: "Use the read tool — not shell commands like cat — to inspect text files. Results include line numbers. Use offset and limit to continue reading large files."
329
+ text: ({ scope }) => ctx.tools.get("read", scope) === void 0 ? "" : "Use the read tool — not shell commands like cat — to inspect text files. Results include line numbers. Use offset and limit to continue reading large files."
330
330
  });
331
331
  ctx.tools.register(defineTool({
332
332
  name: "read",
@@ -583,7 +583,7 @@ ${outcome.operation === "create" ? "Created" : "Updated"} file
583
583
  </content>`;
584
584
  }
585
585
  /**
586
- * Register the `write` tool and its system-prompt guidance.
586
+ * Register the `write` tool and its scope-aware system-prompt guidance.
587
587
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
588
588
  * @param sandbox - the shared sandbox-escalation API (advertisement, mode stamping, denial mapping).
589
589
  */
@@ -591,7 +591,7 @@ function applyWriteTool(ctx, sandbox) {
591
591
  ctx.systemPrompt.section({
592
592
  name: "tool:write",
593
593
  order: ctx.systemPrompt.getSectionOrder("TOOL_WRITE"),
594
- text: "Use the write tool to create files or completely replace file contents. Existing files are overwritten, so read an existing file first (the default fs-observation-policy requires it) and prefer edit for targeted changes."
594
+ text: ({ scope }) => ctx.tools.get("write", scope) === void 0 ? "" : "Use the write tool to create files or completely replace file contents. Existing files are overwritten, so read an existing file first (the default fs-observation-policy requires it)" + (ctx.tools.get("edit", scope) === void 0 ? "" : " and prefer edit for targeted changes") + "."
595
595
  });
596
596
  ctx.tools.register(defineTool({
597
597
  name: "write",
@@ -728,7 +728,7 @@ function formatEditOutput(displayPath, replaceAll) {
728
728
  return replaceAll ? `The file ${displayPath} has been updated. All occurrences were successfully replaced.` : `The file ${displayPath} has been updated successfully.`;
729
729
  }
730
730
  /**
731
- * Register the `edit` tool and its system-prompt guidance.
731
+ * Register the `edit` tool and its scope-aware system-prompt guidance.
732
732
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
733
733
  * @param sandbox - the shared sandbox-escalation API (advertisement, mode stamping, denial mapping).
734
734
  */
@@ -736,7 +736,7 @@ function applyEditTool(ctx, sandbox) {
736
736
  ctx.systemPrompt.section({
737
737
  name: "tool:edit",
738
738
  order: ctx.systemPrompt.getSectionOrder("TOOL_EDIT"),
739
- text: "Use the edit tool for targeted changes to existing UTF-8 text files. It replaces literal old_string with new_string; by default old_string must appear exactly once. If old_string appears multiple times, provide a more specific old_string or set replace_all to true. Read the file first (the default fs-observation-policy requires it), unless you just created or edited it in this session."
739
+ text: ({ scope }) => ctx.tools.get("edit", scope) === void 0 ? "" : "Use the edit tool for targeted changes to existing UTF-8 text files. It replaces literal old_string with new_string; by default old_string must appear exactly once. If old_string appears multiple times, provide a more specific old_string or set replace_all to true. Read the file first (the default fs-observation-policy requires it), unless you just created or edited it in this session."
740
740
  });
741
741
  ctx.tools.register(defineTool({
742
742
  name: "edit",
@@ -34,7 +34,7 @@ export declare function parseEditArgs(args: {
34
34
  */
35
35
  export declare function formatEditOutput(displayPath: string, replaceAll: boolean): string;
36
36
  /**
37
- * Register the `edit` tool and its system-prompt guidance.
37
+ * Register the `edit` tool and its scope-aware system-prompt guidance.
38
38
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
39
39
  * @param sandbox - the shared sandbox-escalation API (advertisement, mode stamping, denial mapping).
40
40
  */
@@ -40,7 +40,7 @@ export declare function parseReadArgs(args: {
40
40
  limit?: number;
41
41
  }, maxLimit: number): ReadInput;
42
42
  /**
43
- * Register the `read` tool and its system-prompt guidance.
43
+ * Register the `read` tool and its scope-aware system-prompt guidance.
44
44
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
45
45
  * @param caps - the deployment's resolved read caps (plugin config after defaulting).
46
46
  */
@@ -28,7 +28,7 @@ export declare function parseWriteArgs(args: {
28
28
  */
29
29
  export declare function formatWriteOutput(displayPath: string, outcome: Pick<FsWriteOutcome, 'operation'>): string;
30
30
  /**
31
- * Register the `write` tool and its system-prompt guidance.
31
+ * Register the `write` tool and its scope-aware system-prompt guidance.
32
32
  * @param ctx - the plugin context; registrations are effects scoped to it, and execution uses its `fs` service.
33
33
  * @param sandbox - the shared sandbox-escalation API (advertisement, mode stamping, denial mapping).
34
34
  */
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.3-alpha.2",
4
+ "version": "0.1.5-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,34 +31,36 @@
31
31
  "@deepseek-ai/schemastery": "^3.18.2"
32
32
  },
33
33
  "peerDependencies": {
34
- "@deepseek-ai/dsh-attachment": "^0.1.3-alpha.2",
35
- "@deepseek-ai/dsh-fs": "^0.1.3-alpha.2",
36
- "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
37
- "@deepseek-ai/dsh-sandbox": "^0.1.3-alpha.2",
38
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
39
- "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
40
- "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
41
- "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
42
- "@deepseek-ai/dsh-user-approval": "^0.1.3-alpha.2",
34
+ "@deepseek-ai/dsh-attachment": "^0.1.5-alpha.2",
35
+ "@deepseek-ai/dsh-fs": "^0.1.5-alpha.2",
36
+ "@deepseek-ai/dsh-llm": "^0.1.5-alpha.2",
37
+ "@deepseek-ai/dsh-sandbox": "^0.1.5-alpha.2",
38
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.5-alpha.2",
39
+ "@deepseek-ai/dsh-session": "^0.1.5-alpha.2",
40
+ "@deepseek-ai/dsh-system-prompt": "^0.1.5-alpha.2",
41
+ "@deepseek-ai/dsh-tools": "^0.1.5-alpha.2",
42
+ "@deepseek-ai/dsh-user-approval": "^0.1.5-alpha.2",
43
43
  "@deepseek-ai/cordis": "^4.0.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
47
- "@deepseek-ai/dsh-attachment": "^0.1.3-alpha.2",
48
- "@deepseek-ai/dsh-agent-loop": "^0.1.3-alpha.2",
49
- "@deepseek-ai/dsh-fs": "^0.1.3-alpha.2",
50
- "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.3-alpha.2",
51
- "@deepseek-ai/dsh-fs-observation-policy": "^0.1.3-alpha.2",
52
- "@deepseek-ai/dsh-fs-local": "^0.1.3-alpha.2",
53
- "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
54
- "@deepseek-ai/dsh-llm-deepseek": "^0.1.3-alpha.2",
55
- "@deepseek-ai/dsh-sandbox": "^0.1.3-alpha.2",
56
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
57
- "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
58
- "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
59
- "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
46
+ "@deepseek-ai/dsh-agent": "^0.1.5-alpha.2",
47
+ "@deepseek-ai/dsh-agent-loop": "^0.1.5-alpha.2",
48
+ "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.5-alpha.2",
49
+ "@deepseek-ai/dsh-attachment": "^0.1.5-alpha.2",
50
+ "@deepseek-ai/dsh-fs": "^0.1.5-alpha.2",
51
+ "@deepseek-ai/dsh-fs-observation-policy": "^0.1.5-alpha.2",
52
+ "@deepseek-ai/dsh-sandbox": "^0.1.5-alpha.2",
53
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.5-alpha.2",
54
+ "@deepseek-ai/dsh-system-prompt": "^0.1.5-alpha.2",
55
+ "@deepseek-ai/dsh-tools": "^0.1.5-alpha.2",
56
+ "@deepseek-ai/dsh-user-approval": "^0.1.5-alpha.2",
60
57
  "@deepseek-ai/cordis": "^4.0.2",
61
- "@deepseek-ai/dsh-user-approval": "^0.1.3-alpha.2",
62
- "@deepseek-ai/dsh-session-projection": "^0.1.3-alpha.2"
58
+ "@deepseek-ai/dsh-session-projection": "^0.1.5-alpha.2",
59
+ "@deepseek-ai/dsh-scope": "^0.1.5-alpha.2",
60
+ "@deepseek-ai/dsh-llm": "^0.1.5-alpha.2",
61
+ "@deepseek-ai/dsh-session": "^0.1.5-alpha.2",
62
+ "@deepseek-ai/dsh-llm-deepseek": "^0.1.5-alpha.2",
63
+ "@deepseek-ai/dsh-fs-local": "^0.1.5-alpha.2",
64
+ "@deepseek-ai/dsh-code-runtime": "^0.1.5-alpha.2"
63
65
  }
64
66
  }