@deepseek-ai/dsh-tool-fs 0.2.2-rc.1 → 0.2.2-rc.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.
Files changed (71) hide show
  1. package/README.i18n.yaml +10 -10
  2. package/README.md +8 -5
  3. package/README.zh.md +8 -5
  4. package/lib/index.js +85 -28
  5. package/lib/types/apply-patch-output.d.ts.map +1 -0
  6. package/lib/types/apply-patch-output.js.map +1 -0
  7. package/lib/types/apply-patch-presentation.d.ts.map +1 -0
  8. package/lib/types/apply-patch-presentation.js.map +1 -0
  9. package/lib/types/apply-patch.d.ts +1 -1
  10. package/lib/types/apply-patch.d.ts.map +1 -0
  11. package/lib/types/apply-patch.js.map +1 -0
  12. package/lib/types/diff.d.ts.map +1 -0
  13. package/lib/types/diff.js.map +1 -0
  14. package/lib/types/edit.d.ts.map +1 -0
  15. package/lib/types/edit.js.map +1 -0
  16. package/lib/types/error.d.ts.map +1 -0
  17. package/lib/types/error.js.map +1 -0
  18. package/lib/types/image-error.d.ts +25 -0
  19. package/lib/types/image-error.d.ts.map +1 -0
  20. package/lib/types/image-error.js.map +1 -0
  21. package/lib/types/index.d.ts.map +1 -0
  22. package/lib/types/index.js.map +1 -0
  23. package/lib/types/mutation-result.d.ts.map +1 -0
  24. package/lib/types/mutation-result.js.map +1 -0
  25. package/lib/types/patch/execute.d.ts.map +1 -0
  26. package/lib/types/patch/execute.js.map +1 -0
  27. package/lib/types/patch/index.d.ts.map +1 -0
  28. package/lib/types/patch/index.js.map +1 -0
  29. package/lib/types/patch/plan.d.ts.map +1 -0
  30. package/lib/types/patch/plan.js.map +1 -0
  31. package/lib/types/patch/preflight.d.ts.map +1 -0
  32. package/lib/types/patch/preflight.js.map +1 -0
  33. package/lib/types/patch/types.d.ts.map +1 -0
  34. package/lib/types/patch/types.js.map +1 -0
  35. package/lib/types/read-image.d.ts +2 -0
  36. package/lib/types/read-image.d.ts.map +1 -0
  37. package/lib/types/read-image.js.map +1 -0
  38. package/lib/types/read-render.d.ts.map +1 -0
  39. package/lib/types/read-render.js.map +1 -0
  40. package/lib/types/read-target.d.ts.map +1 -0
  41. package/lib/types/read-target.js.map +1 -0
  42. package/lib/types/read.d.ts.map +1 -0
  43. package/lib/types/read.js.map +1 -0
  44. package/lib/types/sandbox.d.ts.map +1 -0
  45. package/lib/types/sandbox.js.map +1 -0
  46. package/lib/types/session-cwd.d.ts.map +1 -0
  47. package/lib/types/session-cwd.js.map +1 -0
  48. package/lib/types/write.d.ts.map +1 -0
  49. package/lib/types/write.js.map +1 -0
  50. package/package.json +44 -39
  51. package/src/apply-patch-output.ts +149 -0
  52. package/src/apply-patch-presentation.ts +47 -0
  53. package/src/apply-patch.ts +52 -0
  54. package/src/diff.ts +102 -0
  55. package/src/edit.ts +169 -0
  56. package/src/error.ts +42 -0
  57. package/src/image-error.ts +36 -0
  58. package/src/index.ts +103 -0
  59. package/src/mutation-result.ts +21 -0
  60. package/src/patch/execute.ts +121 -0
  61. package/src/patch/index.ts +36 -0
  62. package/src/patch/plan.ts +117 -0
  63. package/src/patch/preflight.ts +157 -0
  64. package/src/patch/types.ts +88 -0
  65. package/src/read-image.ts +391 -0
  66. package/src/read-render.ts +244 -0
  67. package/src/read-target.ts +34 -0
  68. package/src/read.ts +210 -0
  69. package/src/sandbox.ts +145 -0
  70. package/src/session-cwd.ts +25 -0
  71. package/src/write.ts +153 -0
package/README.i18n.yaml CHANGED
@@ -9,8 +9,8 @@
9
9
  en: fc8f28deebe5fa6b
10
10
  zh: 738c6ad45034da88
11
11
  /deepseek-ai-dsh-tool-fs/summary:
12
- en: c324e1f6369b38b9
13
- zh: 5e4fd0d5f64b0746
12
+ en: 173acfd5398446eb
13
+ zh: 7dc971cd218fc2e3
14
14
  /deepseek-ai-dsh-tool-fs/table-of-contents:
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
@@ -30,8 +30,8 @@
30
30
  en: 9bddebaf4aff0a8d
31
31
  zh: fea0196162e3fcd1
32
32
  /deepseek-ai-dsh-tool-fs/use-this-package/failures-and-recovery:
33
- en: f7c7834de37e1ece
34
- zh: ff08efcf7c08379a
33
+ en: 4e33f0736e64c72b
34
+ zh: b7a0f2386760e08e
35
35
  /deepseek-ai-dsh-tool-fs/understand-the-implementation:
36
36
  en: e30f7038c28e93f8
37
37
  zh: a3868dbd90367b13
@@ -39,8 +39,8 @@
39
39
  en: 1f4d7213aa3d0d60
40
40
  zh: aa6573f96c8b5220
41
41
  /deepseek-ai-dsh-tool-fs/understand-the-implementation/source-map:
42
- en: 459b773aafc6c163
43
- zh: ccd729aded7d98ba
42
+ en: 8be089bfe40bb7ab
43
+ zh: 7753de2feca62205
44
44
  /deepseek-ai-dsh-tool-fs/understand-the-implementation/per-tool-flow:
45
45
  en: 35fbee1ef9811806
46
46
  zh: 17c725e2b742c073
@@ -126,8 +126,8 @@
126
126
  en: 2d4f2c8605eccab3
127
127
  zh: 67f1f0218f73c6bf
128
128
  /deepseek-ai-dsh-tool-fs/model-experience/tool-errors/what-the-model-sees:
129
- en: 4e8fac7bac8ced61
130
- zh: 7ba921dbcddc9f97
129
+ en: 816a5ac724377eeb
130
+ zh: 6833892230a1264c
131
131
  /deepseek-ai-dsh-tool-fs/model-experience/tool-errors/token-effect:
132
132
  en: 681cadd5be7b8ac1
133
133
  zh: 65e483f62fb819d9
@@ -138,8 +138,8 @@
138
138
  en: e24083366d909456
139
139
  zh: 003e7533d417bfe5
140
140
  /deepseek-ai-dsh-tool-fs/model-experience/apply-patch/what-the-model-sees:
141
- en: f42d71271fa0e757
142
- zh: 3a203266d3406414
141
+ en: 880d555f2d766845
142
+ zh: 3fbdea165a5708ff
143
143
  /deepseek-ai-dsh-tool-fs/model-experience/apply-patch/what-the-model-sees/system-guidance:
144
144
  en: 3e353846d8e13cdf
145
145
  zh: 3d93eaadc65898b3
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- Use `dsh-tool-fs` to let a model read UTF-8 files with line numbers, read supported images, create or atomically replace files, apply targeted literal edits, and apply Codex-style multi-file patches. 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.
12
+ Use `dsh-tool-fs` to let a model read UTF-8 files with line numbers, read supported images, create or atomically replace files, apply targeted literal edits, and apply multi-file patches. 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
 
@@ -83,7 +83,9 @@ With the policy plugin mounted, `write` and `edit` obtain their guard from the `
83
83
 
84
84
  For `apply_patch`, syntax and preflight refusals throw with `isError: true` before any disk change. `FsError` preserves filesystem codes; `PatchToolError extends HarnessError` carries `PATCH_SYNTAX` and `PATCH_SYMLINK_SOURCE`. Once commit starts, the tool returns a value with `isError: false` even on failure or uncertainty, so known partial effects retain their diff metadata; a call cancelled during commit receives the tool registry's abort result like every other tool, and its completed changes remain visible through Review. `phase`, `cancelled`, ordered `operations` and `affectedPaths` describe the commit; each operation retains its index, kind, display paths, patch line, status, diagnostic and known changes. Full `before`/`after` text serves rendering and PTC; the Session stores the rendered result plus `meta.diffs` and `meta.stopped`. Creations store no diff, as for `write`; deletions and move sources store a removal diff only when the provider returned a bounded basis, using `newText: ''` because `FileDiff.newText` cannot be null.
85
85
 
86
- Failures are normalized as `Error: <message>` with a structured code preserved for callers. Stable messages include `file_path must be a non-empty string`, `limit must be less than or equal to <max>`, `cannot read "<path>": not found`, `cannot read "<path>": not a regular file`, and the image-route refusal `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`. `FS_NOT_OBSERVED` is normalized to `cannot modify "<path>": file has not been read — read the file, then retry`, independent of whether the policy or provider rejected the operation; `FS_STALE_VERSION` retains the provider's reason and appends `— re-read the file, then retry`. After the reread confirms absence, `edit` reports `FS_NOT_FOUND` instead of repeating a stale remedy, while `write` uses guarded creation.
86
+ `read_image` refusals it makes before storing the image throw `ImageInputError extends HarnessError` with an `ImageInputErrorCode`: `IMAGE_UNSUPPORTED_MODEL` (switch to an image-capable model) or `IMAGE_UNSUPPORTED_FORMAT` (the extension, file signature, or deployment media types exclude the format; convert the file). Refusals from the attachment store keep their `AttachmentError` `name` and `code`, such as `INVALID_IMAGE`, `IMAGE_TYPE_MISMATCH`, or `IMAGE_DIMENSION_TOO_LARGE`; for codes with a known remedy, the message names the file and the next step, and the store error is the `cause`. An empty `file_path` throws `ToolArgsError` (`INVALID_ARGS`); a missing attachment service or an unresolvable model route throws `ToolContextUnavailableError` (`TOOL_CONTEXT_UNAVAILABLE`); filesystem failures keep their `FsError` codes; any other store failure, such as an `AbortError`, another `HarnessError`, or a defect, passes through unchanged.
87
+
88
+ Failures are normalized as `Error: <message>` with a structured code preserved for callers. Stable messages include the `ToolArgsError` (`INVALID_ARGS`) messages `invalid arguments: file_path must be a non-empty string` and `invalid arguments: limit must be less than or equal to <max>`, `cannot read "<path>": not found`, `cannot read "<path>": not a regular file`, and the image-route refusal `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`. `FS_NOT_OBSERVED` is normalized to `cannot modify "<path>": file has not been read — read the file, then retry`, independent of whether the policy or provider rejected the operation; `FS_STALE_VERSION` retains the provider's reason and appends `— re-read the file, then retry`. After the reread confirms absence, `edit` reports `FS_NOT_FOUND` instead of repeating a stale remedy, while `write` uses guarded creation.
87
89
 
88
90
  -----
89
91
 
@@ -106,6 +108,7 @@ The tools are the executor; policy is an event gate. The tools inject no policy
106
108
  | [`src/index.ts`](src/index.ts) | Plugin entry: `Config`, tool composition, `read_image` attachments gate |
107
109
  | [`src/read.ts`](src/read.ts) | `read` executor: one stat, streaming decision, window build, observation |
108
110
  | [`src/read-image.ts`](src/read-image.ts) | `read_image` executor: route and media-type gates, bounded bytes, attachment save |
111
+ | [`src/image-error.ts`](src/image-error.ts) | `ImageInputError` and the closed codes for refusals `read_image` makes itself |
109
112
  | [`src/write.ts`](src/write.ts) | `write` executor: intent waterfall, atomic write, observation |
110
113
  | [`src/apply-patch.ts`](src/apply-patch.ts), [`apply-patch-output.ts`](src/apply-patch-output.ts) | `apply_patch` registration, strict commit values and compact diagnostics |
111
114
  | [`src/apply-patch-presentation.ts`](src/apply-patch-presentation.ts) | Pure call previews and known result diffs |
@@ -163,7 +166,7 @@ At assembly time, each guidance section checks `ctx.tools.get(name, scope)` and
163
166
  ##### Read guidance
164
167
 
165
168
  ```markdown
166
- Use the read tool — not shell commands like cat — to inspect text files. Use offset and limit to continue reading large files.
169
+ Use the read tool — not shell commands like cat, sed, head, or tail — to inspect text files. Use offset and limit to read a line range or continue a large file.
167
170
  ```
168
171
 
169
172
  ##### Write guidance
@@ -246,7 +249,7 @@ Append-only; newly visible content follows the reusable request prefix and does
246
249
 
247
250
  #### What the model sees
248
251
 
249
- Failures are normalized as `Error: <message>`. This package's stable validation and read messages are `file_path must be a non-empty string`, `limit must be less than or equal to <max>`, `old_string must be a non-empty string`, `old_string and new_string must differ`, `cannot read "<path>": not found`, `cannot read "<path>": not a regular file`, `offset <offset> is out of range for "<path>" (<total> lines)`, `cannot read "<path>": the <ext> extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`, `cannot read "<path>": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`, `cannot read "<path>": the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt`, `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`, and the mismatch repair `cannot read "<path>": the <ext> extension declares <type>, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats` (an extension-less mismatch reports `cannot read "<path>": the file signature claims <type>, but the bytes decode as a different image format; the file may be corrupt`). A failed 16-bit conversion reports `cannot read "<path>": the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry`. Provider and policy templates are quoted in their package READMEs. The model-facing error wrapper normalizes every `FS_NOT_OBSERVED` source to `cannot modify "<path>": file has not been read — read the file, then retry`; `FS_STALE_VERSION` keeps the provider's reason and adds `— re-read the file, then retry`. Both retain the structured error code and original cause. After that reread confirms absence, `edit` reports `FS_NOT_FOUND` instead of repeating a stale remedy, while `write` uses guarded creation.
252
+ Failures are normalized as `Error: <message>`. This package's stable validation messages are `ToolArgsError` (`INVALID_ARGS`) messages prefixed with `invalid arguments: `: `file_path must be a non-empty string`, `limit must be less than or equal to <max>`, `old_string must be a non-empty string`, and `old_string and new_string must differ`. Its stable read messages are `cannot read "<path>": not found`, `cannot read "<path>": not a regular file`, `offset <offset> is out of range for "<path>" (<total> lines)`, `cannot read "<path>": the <ext> extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`, `cannot read "<path>": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`, `cannot read "<path>": the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt`, `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`, and the mismatch repair `cannot read "<path>": the <ext> extension declares <type>, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats` (an extension-less mismatch reports `cannot read "<path>": the file signature claims <type>, but the bytes decode as a different image format; the file may be corrupt`). A failed 16-bit conversion reports `cannot read "<path>": the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry`. Provider and policy templates are quoted in their package READMEs. The model-facing error wrapper normalizes every `FS_NOT_OBSERVED` source to `cannot modify "<path>": file has not been read — read the file, then retry`; `FS_STALE_VERSION` keeps the provider's reason and adds `— re-read the file, then retry`. Both retain the structured error code and original cause. After that reread confirms absence, `edit` reports `FS_NOT_FOUND` instead of repeating a stale remedy, while `write` uses guarded creation.
250
253
 
251
254
  #### Token effect
252
255
 
@@ -260,7 +263,7 @@ Append-only; newly visible content follows the reusable request prefix and does
260
263
 
261
264
  #### What the model sees
262
265
 
263
- The `apply_patch` schema requires one `input` string (the Codex parameter name, which models trained on that tool send unprompted) containing `*** Begin Patch` / `*** End Patch`, Add/Update/Delete headers, optional Move to, and context/add/remove hunk lines. Paths are Session-relative. A confining backend adds the same escalation fields as write/edit. Success lines group A/M/D and a completed move reports `M <destination>`, matching Codex rust-v0.158.0. An empty patch renders `Success. No operations in patch.`. A stopped patch includes only the applicable Completed, Failed, Outcome unknown and Not executed sections; unknown outcomes end with the re-read remedy. Syntax errors keep the parser message.
266
+ The `apply_patch` schema requires one `input` string containing `*** Begin Patch` / `*** End Patch`, Add/Update/Delete headers, optional Move to, and context/add/remove hunk lines. Paths are Session-relative. A confining backend adds the same escalation fields as write/edit. Success lines group A/M/D and a completed move reports `M <destination>`, matching Codex rust-v0.158.0. An empty patch renders `Success. No operations in patch.`. A stopped patch includes only the applicable Completed, Failed, Outcome unknown and Not executed sections; unknown outcomes end with the re-read remedy. Syntax errors keep the parser message.
264
267
 
265
268
  ##### System guidance
266
269
 
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- 使用 `dsh-tool-fs` 可让模型带行号读取 UTF-8 文件、读取受支持的图片、创建或原子地替换文件,执行有针对性的字面量编辑,以及应用 Codex 风格的多文件补丁。结果都有上限,失败会提供稳定错误码与恢复指令。当写入和编辑必须在成功读取后执行时,请添加 `dsh-fs-observation-policy`;省略它时,变更仍是原子的,但不受此条件约束。图片读取需要持久附件存储和支持图片输入的路由模型。glob 或 grep 搜索请选择同级的发现工具包。
12
+ 使用 `dsh-tool-fs` 可让模型带行号读取 UTF-8 文件、读取受支持的图片、创建或原子地替换文件,执行有针对性的字面量编辑,以及应用多文件补丁。结果都有上限,失败会提供稳定错误码与恢复指令。当写入和编辑必须在成功读取后执行时,请添加 `dsh-fs-observation-policy`;省略它时,变更仍是原子的,但不受此条件约束。图片读取需要持久附件存储和支持图片输入的路由模型。glob 或 grep 搜索请选择同级的发现工具包。
13
13
 
14
14
  ## 目录
15
15
 
@@ -83,7 +83,9 @@ kind: "package-reference"
83
83
 
84
84
  `apply_patch` 的语法与预检拒绝在磁盘变更前抛错,结果为 `isError: true`。`FsError` 保留文件系统错误码;`PatchToolError extends HarnessError` 携带 `PATCH_SYNTAX` 和 `PATCH_SYMLINK_SOURCE`。进入提交后,即使失败或结果不确定也返回 `isError: false` 的值,确保已知部分效果的 diff 元数据得以保留;提交期间被取消的调用与其他工具一样收到工具注册表的中止结果,已完成的变更仍可通过 Review 查看。`phase`、`cancelled`、有序 `operations` 与 `affectedPaths` 描述提交;每条操作保留索引、种类、展示路径、补丁行号、状态、诊断与已知变更。完整 `before`/`after` 文本供渲染和 PTC 使用;Session 保存渲染文本以及 `meta.diffs` 与 `meta.stopped`。新建与 `write` 一样不保存 diff;删除与移动源仅在提供方返回有界基线时保存删除 diff,并使用 `newText: ''`,因为 `FileDiff.newText` 不可为 null。
85
85
 
86
- 失败被规范化为 `Error: <message>`,并为调用方保留结构化错误码。稳定消息包括 `file_path must be a non-empty string`、`limit must be less than or equal to <max>`、`cannot read "<path>": not found`、`cannot read "<path>": not a regular file`,以及图像路由拒绝 `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`。无论拒绝来自策略还是提供方,`FS_NOT_OBSERVED` 都规范化为 `cannot modify "<path>": file has not been read — read the file, then retry`;`FS_STALE_VERSION` 保留提供方原因并追加 `— re-read the file, then retry`。该次重新读取确认缺失后,`edit` 报告 `FS_NOT_FOUND` 而不会重复陈旧恢复指令,`write` 则使用防护创建。
86
+ `read_image` 在存储图像前自行作出的拒绝抛出 `ImageInputError extends HarnessError`,错误码为 `ImageInputErrorCode`:`IMAGE_UNSUPPORTED_MODEL`(切换到支持图像的模型)或 `IMAGE_UNSUPPORTED_FORMAT`(扩展名、文件签名或部署接受的媒体类型排除了该格式;转换文件)。附件存储作出的拒绝保留其 `AttachmentError` 的 `name` 与 `code`,例如 `INVALID_IMAGE`、`IMAGE_TYPE_MISMATCH` 或 `IMAGE_DIMENSION_TOO_LARGE`;对有明确补救办法的错误码,消息会写明文件与下一步,存储错误作为 `cause`。空 `file_path` 抛出 `ToolArgsError`(`INVALID_ARGS`);缺少附件服务或无法解析模型路由时抛出 `ToolContextUnavailableError`(`TOOL_CONTEXT_UNAVAILABLE`);文件系统失败保留其 `FsError` 错误码;存储抛出的其他失败(例如 `AbortError`、其他 `HarnessError` 或缺陷)原样传递。
87
+
88
+ 失败被规范化为 `Error: <message>`,并为调用方保留结构化错误码。稳定消息包括 `ToolArgsError`(`INVALID_ARGS`)消息 `invalid arguments: file_path must be a non-empty string` 与 `invalid arguments: limit must be less than or equal to <max>`、`cannot read "<path>": not found`、`cannot read "<path>": not a regular file`,以及图像路由拒绝 `cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`。无论拒绝来自策略还是提供方,`FS_NOT_OBSERVED` 都规范化为 `cannot modify "<path>": file has not been read — read the file, then retry`;`FS_STALE_VERSION` 保留提供方原因并追加 `— re-read the file, then retry`。该次重新读取确认缺失后,`edit` 报告 `FS_NOT_FOUND` 而不会重复陈旧恢复指令,`write` 则使用防护创建。
87
89
 
88
90
  -----
89
91
 
@@ -106,6 +108,7 @@ kind: "package-reference"
106
108
  | [`src/index.ts`](src/index.ts) | 插件入口:`Config`、工具组合、`read_image` 附件门禁 |
107
109
  | [`src/read.ts`](src/read.ts) | `read` 执行器:一次 stat、流式决策、窗口构建、观察 |
108
110
  | [`src/read-image.ts`](src/read-image.ts) | `read_image` 执行器:路由与媒体类型门禁、有界字节、附件保存 |
111
+ | [`src/image-error.ts`](src/image-error.ts) | `ImageInputError` 及 `read_image` 自行拒绝时使用的封闭错误码 |
109
112
  | [`src/write.ts`](src/write.ts) | `write` 执行器:意图 waterfall、原子写入、观察 |
110
113
  | [`src/apply-patch.ts`](src/apply-patch.ts)、[`apply-patch-output.ts`](src/apply-patch-output.ts) | `apply_patch` 注册、严格提交值与精简诊断 |
111
114
  | [`src/apply-patch-presentation.ts`](src/apply-patch-presentation.ts) | 纯调用预览与已知结果 diff |
@@ -163,7 +166,7 @@ kind: "package-reference"
163
166
  ##### Read 指导
164
167
 
165
168
  ```markdown
166
- Use the read tool — not shell commands like cat — to inspect text files. Use offset and limit to continue reading large files.
169
+ Use the read tool — not shell commands like cat, sed, head, or tail — to inspect text files. Use offset and limit to read a line range or continue a large file.
167
170
  ```
168
171
 
169
172
  ##### Write 指导
@@ -246,7 +249,7 @@ Read a file before editing it unless you just created or edited it in this sessi
246
249
 
247
250
  #### 模型看到的内容
248
251
 
249
- 失败会规范化为 `Error: <message>`。本包稳定的校验和读取消息是 `file_path must be a non-empty string`、`limit must be less than or equal to <max>`、`old_string must be a non-empty string`、`old_string and new_string must differ`、`cannot read "<path>": not found`、`cannot read "<path>": not a regular file`、`offset <offset> is out of range for "<path>" (<total> lines)`、`cannot read "<path>": the <ext> extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`、`cannot read "<path>": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`、`cannot read "<path>": the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt`、`cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`,以及类型不匹配的修复消息 `cannot read "<path>": the <ext> extension declares <type>, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`(无扩展名路径的不匹配报告 `cannot read "<path>": the file signature claims <type>, but the bytes decode as a different image format; the file may be corrupt`)。16-bit 转换失败会报告 `cannot read "<path>": the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry`。提供方和策略模板在各自包的 README 中逐字列出。模型侧错误包装把所有 `FS_NOT_OBSERVED` 来源规范化为 `cannot modify "<path>": file has not been read — read the file, then retry`;`FS_STALE_VERSION` 保留提供方原因并追加 `— re-read the file, then retry`。两者都保留结构化错误码和原始原因。该次重新读取确认缺失后,`edit` 会报告 `FS_NOT_FOUND`,而不会重复陈旧恢复指令;`write` 则使用带防护的创建。
252
+ 失败会规范化为 `Error: <message>`。本包稳定的校验消息是带 `invalid arguments: ` 前缀的 `ToolArgsError`(`INVALID_ARGS`)消息:`file_path must be a non-empty string`、`limit must be less than or equal to <max>`、`old_string must be a non-empty string` 与 `old_string and new_string must differ`。稳定的读取消息是 `cannot read "<path>": not found`、`cannot read "<path>": not a regular file`、`offset <offset> is out of range for "<path>" (<total> lines)`、`cannot read "<path>": the <ext> extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`、`cannot read "<path>": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`、`cannot read "<path>": the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt`、`cannot read "<path>" as an image: model "<model>" does not declare image input; switch to an image-capable model to read images`,以及类型不匹配的修复消息 `cannot read "<path>": the <ext> extension declares <type>, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`(无扩展名路径的不匹配报告 `cannot read "<path>": the file signature claims <type>, but the bytes decode as a different image format; the file may be corrupt`)。16-bit 转换失败会报告 `cannot read "<path>": the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry`。提供方和策略模板在各自包的 README 中逐字列出。模型侧错误包装把所有 `FS_NOT_OBSERVED` 来源规范化为 `cannot modify "<path>": file has not been read — read the file, then retry`;`FS_STALE_VERSION` 保留提供方原因并追加 `— re-read the file, then retry`。两者都保留结构化错误码和原始原因。该次重新读取确认缺失后,`edit` 会报告 `FS_NOT_FOUND`,而不会重复陈旧恢复指令;`write` 则使用带防护的创建。
250
253
 
251
254
  #### Token 影响
252
255
 
@@ -260,7 +263,7 @@ Read a file before editing it unless you just created or edited it in this sessi
260
263
 
261
264
  #### 模型看到的内容
262
265
 
263
- `apply_patch` schema 要求一个 `input` 字符串(沿用 Codex 的参数名,在该工具上训练过的模型会不经提示地发送这个键),包含 `*** Begin Patch` / `*** End Patch`、Add/Update/Delete 文件头、可选 Move to,以及上下文/新增/删除 hunk 行。路径相对于 Session 工作目录。有围栏后端追加与 write/edit 相同的提权字段。成功行按 A/M/D 分组,完成的移动显示 `M <destination>`,与 Codex rust-v0.158.0 一致。空补丁显示 `Success. No operations in patch.`。停止的补丁只包含适用的 Completed、Failed、Outcome unknown 与 Not executed 小节;结果不确定时以重读建议结束。语法错误保留解析器消息。
266
+ `apply_patch` schema 要求一个 `input` 字符串,包含 `*** Begin Patch` / `*** End Patch`、Add/Update/Delete 文件头、可选 Move to,以及上下文/新增/删除 hunk 行。路径相对于 Session 工作目录。有围栏后端追加与 write/edit 相同的提权字段。成功行按 A/M/D 分组,完成的移动显示 `M <destination>`,与 Codex rust-v0.158.0 一致。空补丁显示 `Success. No operations in patch.`。停止的补丁只包含适用的 Completed、Failed、Outcome unknown 与 Not executed 小节;结果不确定时以重读建议结束。语法错误保留解析器消息。
264
267
 
265
268
  ##### 系统提示
266
269
 
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
- import { defineTool } from "@deepseek-ai/dsh-tools";
2
+ import { ToolArgsError, ToolContextUnavailableError, defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { FsError } from "@deepseek-ai/dsh-fs";
4
4
  import { readLangHintForPath as langFromPath } from "@deepseek-ai/dsh-util-code-language";
5
5
  import { structuredPatch } from "diff";
@@ -8,6 +8,7 @@ import { assertNever } from "@deepseek-ai/dsh-util-values";
8
8
  import { HarnessError } from "@deepseek-ai/dsh-llm";
9
9
  import { basename, extname } from "node:path";
10
10
  import { AttachmentError, AttachmentId } from "@deepseek-ai/dsh-attachment";
11
+ import { HarnessError as HarnessError$1 } from "@deepseek-ai/dsh-error";
11
12
  import { ESCALATION_TARGETS, approveEscalation, escalationHintMarker, sandboxDenialMarker, sandboxPermissionsDescription, validateEscalationArgs } from "@deepseek-ai/dsh-sandbox";
12
13
  //#region lib/types/read-render.js
13
14
  /**
@@ -219,7 +220,7 @@ const READ_LIMIT = 2e3;
219
220
  */
220
221
  const STREAM_MIN_SIZE = 10 * 1024 * 1024;
221
222
  function parsePositiveInteger(value, name) {
222
- if (!Number.isFinite(value) || !Number.isInteger(value) || value < 1) throw new Error(`${name} must be a positive integer`);
223
+ if (!Number.isFinite(value) || !Number.isInteger(value) || value < 1) throw new ToolArgsError([`${name} must be a positive integer`]);
223
224
  return value;
224
225
  }
225
226
  /**
@@ -229,10 +230,10 @@ function parsePositiveInteger(value, name) {
229
230
  * @returns the validated input with `offset` defaulted to 1 and `limit` to `maxLimit`.
230
231
  */
231
232
  function parseReadArgs(args, maxLimit) {
232
- if (args.file_path.trim().length === 0) throw new Error("file_path must be a non-empty string");
233
+ if (args.file_path.trim().length === 0) throw new ToolArgsError(["file_path must be a non-empty string"]);
233
234
  const offset = args.offset === void 0 ? 1 : parsePositiveInteger(args.offset, "offset");
234
235
  const limit = args.limit === void 0 ? maxLimit : parsePositiveInteger(args.limit, "limit");
235
- if (limit > maxLimit) throw new Error(`limit must be less than or equal to ${maxLimit}`);
236
+ if (limit > maxLimit) throw new ToolArgsError([`limit must be less than or equal to ${maxLimit}`]);
236
237
  return {
237
238
  filePath: args.file_path,
238
239
  offset,
@@ -248,7 +249,7 @@ function applyReadTool(ctx, caps) {
248
249
  ctx.systemPrompt.section({
249
250
  name: "tool:read",
250
251
  order: ctx.systemPrompt.getSectionOrder("TOOL_READ"),
251
- text: ({ scope }) => ctx.tools.get("read", scope) === void 0 ? "" : "Use the read tool — not shell commands like cat — to inspect text files. Use offset and limit to continue reading large files."
252
+ text: ({ scope }) => ctx.tools.get("read", scope) === void 0 ? "" : "Use the read tool — not shell commands like cat, sed, head, or tail — to inspect text files. Use offset and limit to read a line range or continue a large file."
252
253
  });
253
254
  ctx.tools.register(defineTool({
254
255
  name: "read",
@@ -515,7 +516,7 @@ function mutationResult(ctx, target, outcome, exec) {
515
516
  * @returns the camelCased input; `content` passes through untouched.
516
517
  */
517
518
  function parseWriteArgs(args) {
518
- if (args.file_path.trim().length === 0) throw new Error("file_path must be a non-empty string");
519
+ if (args.file_path.trim().length === 0) throw new ToolArgsError(["file_path must be a non-empty string"]);
519
520
  return {
520
521
  filePath: args.file_path,
521
522
  content: args.content
@@ -1381,12 +1382,12 @@ function applyApplyPatchTool(ctx, sandbox) {
1381
1382
  });
1382
1383
  ctx.tools.register(defineTool({
1383
1384
  name: "apply_patch",
1384
- description: "Create, update, delete, or move UTF-8 text files with one Codex-style patch; prefer it over multiple edit calls when a change spans several files or separated regions.",
1385
+ description: "Create, update, delete, or move UTF-8 text files with one patch; prefer it over multiple edit calls when a change spans several files or separated regions.",
1385
1386
  parameters: {
1386
1387
  input: {
1387
1388
  type: "string",
1388
1389
  required: true,
1389
- description: "Codex patch text: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory."
1390
+ description: "Patch text: start with *** Begin Patch and end with *** End Patch. Use *** Add File: path with + lines; *** Update File: path, optionally followed by *** Move to: path, with @@ or @@ context and space-prefixed context, + added, or - removed lines; *** End of File anchors the last hunk to the file end. Use *** Delete File: path to delete. Paths are relative to the Session working directory."
1390
1391
  },
1391
1392
  ...sandbox.escalationModes.length > 0 ? sandbox.schemaFields() : {}
1392
1393
  },
@@ -1425,9 +1426,9 @@ function applyApplyPatchTool(ctx, sandbox) {
1425
1426
  * @returns the camelCased input with `replace_all` defaulted to false.
1426
1427
  */
1427
1428
  function parseEditArgs(args) {
1428
- if (args.file_path.trim().length === 0) throw new Error("file_path must be a non-empty string");
1429
- if (args.old_string.length === 0) throw new Error("old_string must be a non-empty string");
1430
- if (args.old_string === args.new_string) throw new Error("old_string and new_string must differ");
1429
+ if (args.file_path.trim().length === 0) throw new ToolArgsError(["file_path must be a non-empty string"]);
1430
+ if (args.old_string.length === 0) throw new ToolArgsError(["old_string must be a non-empty string"]);
1431
+ if (args.old_string === args.new_string) throw new ToolArgsError(["old_string and new_string must differ"]);
1431
1432
  return {
1432
1433
  filePath: args.file_path,
1433
1434
  oldString: args.old_string,
@@ -1555,6 +1556,23 @@ function applyEditTool(ctx, sandbox) {
1555
1556
  }));
1556
1557
  }
1557
1558
  //#endregion
1559
+ //#region lib/types/image-error.js
1560
+ /** Typed `read_image` failures. @module @deepseek-ai/dsh-tool-fs/src/image-error */
1561
+ /** Typed `read_image` failure; `code` is one of {@link IMAGE_INPUT_ERROR_CODES}. */
1562
+ var ImageInputError = class extends HarnessError$1 {
1563
+ code;
1564
+ /**
1565
+ * @param message - model-facing refusal naming the path and the safe next step.
1566
+ * @param code - stable failure code.
1567
+ * @param options - standard `cause` chaining.
1568
+ */
1569
+ constructor(message, code, options) {
1570
+ super(message, code, options);
1571
+ this.name = "ImageInputError";
1572
+ this.code = code;
1573
+ }
1574
+ };
1575
+ //#endregion
1558
1576
  //#region lib/types/read-image.js
1559
1577
  /**
1560
1578
  * The model-facing `read_image` tool commits a PNG/JPEG/WebP/GIF file. A path
@@ -1674,19 +1692,21 @@ function imageMediaTypeForPath(filePath) {
1674
1692
  * @param ctx - the plugin context used to resolve the optional `llm` service.
1675
1693
  * @param exec - the tool-execution context supplying the calling agent.
1676
1694
  * @param requestedPath - the raw, not-yet-resolved path rendered in refusal messages.
1695
+ * @throws ToolContextUnavailableError when no Agent route or `llm` service is available.
1696
+ * @throws ImageInputError `IMAGE_UNSUPPORTED_MODEL` when the route does not declare image input.
1677
1697
  */
1678
1698
  async function assertImageCapableRoute(ctx, exec, requestedPath) {
1679
1699
  const routed = exec.agent?.session.requestHeader()?.config;
1680
1700
  const provider = routed?.provider ?? exec.agent?.options.provider;
1681
1701
  const model = routed?.model ?? exec.agent?.options.model;
1682
1702
  const llm = ctx.get("llm");
1683
- if (provider === void 0 || model === void 0 || llm === void 0) throw new Error(`cannot read "${requestedPath}" as an image: the current model route could not be resolved`);
1703
+ if (provider === void 0 || model === void 0 || llm === void 0) throw new ToolContextUnavailableError(`cannot read "${requestedPath}" as an image: the current model route could not be resolved`);
1684
1704
  const active = await llm.resolveModelInfo(provider, model, exec.signal);
1685
- if (active.inputModalities === void 0 || !active.inputModalities.includes("image")) throw new Error(`cannot read "${requestedPath}" as an image: model "${model}" does not declare image input; switch to an image-capable model to read images`);
1705
+ if (active.inputModalities === void 0 || !active.inputModalities.includes("image")) throw new ImageInputError(`cannot read "${requestedPath}" as an image: model "${model}" does not declare image input; switch to an image-capable model to read images`, "IMAGE_UNSUPPORTED_MODEL");
1686
1706
  }
1687
1707
  /** Refuse a media type outside the deployment's accepted set, naming the offending path. */
1688
1708
  function assertDeploymentAccepts(attachments, mediaType, displayPath) {
1689
- if (!attachments.imageLimits.mediaTypes.includes(mediaType)) throw new Error(`cannot read "${displayPath}": ${mediaType} images are not accepted by this deployment`);
1709
+ if (!attachments.imageLimits.mediaTypes.includes(mediaType)) throw new ImageInputError(`cannot read "${displayPath}": ${mediaType} images are not accepted by this deployment`, "IMAGE_UNSUPPORTED_FORMAT");
1690
1710
  }
1691
1711
  /**
1692
1712
  * Re-brand a structured image outcome into the durable attachment reference an
@@ -1742,6 +1762,46 @@ function imageReadContent(value) {
1742
1762
  }];
1743
1763
  }
1744
1764
  /**
1765
+ * Add the read path and the next step to one `saveImage` rejection. The attachment store
1766
+ * classifies its own failures, so an `AttachmentError` keeps its `name` and `code` and only
1767
+ * gains a message naming the file and remedy, with the original as `cause`; a code without
1768
+ * a remedy, and any value that is not an `AttachmentError`, passes through unchanged.
1769
+ * @param error - the value `saveImage` rejected with.
1770
+ * @param attachments - the store whose limits the message names.
1771
+ * @param facts - the path and media-type facts the message names.
1772
+ * @returns the error to throw from the tool body.
1773
+ */
1774
+ function saveFailure(error, attachments, facts) {
1775
+ if (!(error instanceof AttachmentError)) return error;
1776
+ const detail = saveFailureDetail(error, attachments, facts);
1777
+ return detail === void 0 ? error : new AttachmentError(`cannot read "${facts.displayPath}": ${detail}`, error.code, { cause: error });
1778
+ }
1779
+ /** The model-facing remedy for one attachment rejection, or undefined when the store message stands. */
1780
+ function saveFailureDetail(error, attachments, facts) {
1781
+ const { extension, mediaType, sniffed } = facts;
1782
+ switch (error.code) {
1783
+ case "IMAGE_DIMENSION_TOO_LARGE": return `at least one image side exceeds the ${attachments.imageLimits.maxImageDimension}px limit; downscale the image and read the smaller copy`;
1784
+ case "IMAGE_TOO_MANY_PIXELS": return `the image exceeds the ${attachments.imageLimits.maxImagePixels}-pixel decoded-size limit; downscale the image and read the smaller copy`;
1785
+ case "IMAGE_TOO_LARGE":
1786
+ case "IMAGES_TOO_LARGE": return "the image cannot be stored within the deployment's byte limits; downscale the image and read the smaller copy";
1787
+ case "UNSUPPORTED_IMAGE_TYPE": return `${mediaType} images are not accepted by this deployment`;
1788
+ case "INVALID_IMAGE": return "the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt";
1789
+ case "IMAGE_TYPE_MISMATCH": return sniffed ? `the file signature claims ${mediaType}, but the bytes decode as a different image format; the file may be corrupt` : `the ${extension} extension declares ${mediaType}, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`;
1790
+ case "ATTACHMENT_WRITE_FAILED": return /16-bit PNG/iu.test(error.message) ? "the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry" : void 0;
1791
+ case "TOO_MANY_IMAGES":
1792
+ case "INVALID_IMAGE_BASE64":
1793
+ case "INVALID_FILE_BASE64":
1794
+ case "INVALID_ATTACHMENT_REF":
1795
+ case "ATTACHMENT_CORRUPT":
1796
+ case "ATTACHMENT_NOT_FOUND":
1797
+ case "ATTACHMENT_READ_FAILED":
1798
+ case "ATTACHMENT_PROJECTION_UNSUPPORTED":
1799
+ case "ATTACHMENT_FILES_UNSUPPORTED": return;
1800
+ /* v8 ignore next -- Closed AttachmentErrorCode union; assertNever checks exhaustiveness at compile time. */
1801
+ default: return assertNever(error.code);
1802
+ }
1803
+ }
1804
+ /**
1745
1805
  * Register the `read_image` tool into the given context. The composing plugin
1746
1806
  * owns the attachments gate: `src/index.ts` calls this inside
1747
1807
  * `ctx.inject(['attachments'], …)` so the tool exists only while a durable
@@ -1777,19 +1837,19 @@ function applyReadImageTool(ctx) {
1777
1837
  },
1778
1838
  isConcurrencySafe: () => true,
1779
1839
  async execute(args, exec) {
1780
- if (args.file_path.trim().length === 0) throw new Error("file_path must be a non-empty string");
1840
+ if (args.file_path.trim().length === 0) throw new ToolArgsError(["file_path must be a non-empty string"]);
1781
1841
  const extension = extname(args.file_path).toLowerCase();
1782
1842
  const declared = imageMediaTypeForPath(args.file_path);
1783
- if (declared === void 0 && extension !== "") throw new Error(`cannot read "${args.file_path}": the ${extension} extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`);
1843
+ if (declared === void 0 && extension !== "") throw new ImageInputError(`cannot read "${args.file_path}": the ${extension} extension does not declare a supported image format; read_image accepts PNG/JPEG/WebP/GIF files, including extension-less files in those formats`, "IMAGE_UNSUPPORTED_FORMAT");
1784
1844
  const attachments = ctx.get("attachments");
1785
- if (attachments === void 0) throw new Error(`cannot read "${args.file_path}" as an image: no attachment service is mounted`);
1845
+ if (attachments === void 0) throw new ToolContextUnavailableError(`cannot read "${args.file_path}" as an image: no attachment service is mounted`);
1786
1846
  if (declared !== void 0) assertDeploymentAccepts(attachments, declared, args.file_path);
1787
1847
  await assertImageCapableRoute(ctx, exec, args.file_path);
1788
1848
  const { target, info } = await resolveRegularReadTarget(ctx, exec, args.file_path);
1789
1849
  const byteCap = Math.min(attachments.imageLimits.maxImageBytes, attachments.imageLimits.maxMessageImageBytes);
1790
1850
  const data = await ctx.fs.readBytes(target, exec.signal, byteCap);
1791
1851
  const mediaType = declared ?? sniffImageMediaType(data);
1792
- if (mediaType === void 0) throw new Error(`cannot read "${target.displayPath}": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`);
1852
+ if (mediaType === void 0) throw new ImageInputError(`cannot read "${target.displayPath}": the file content is not a supported image format; read_image accepts PNG/JPEG/WebP/GIF`, "IMAGE_UNSUPPORTED_FORMAT");
1793
1853
  if (declared === void 0) assertDeploymentAccepts(attachments, mediaType, target.displayPath);
1794
1854
  let ref;
1795
1855
  try {
@@ -1799,15 +1859,12 @@ function applyReadImageTool(ctx) {
1799
1859
  name: basename(target.displayPath)
1800
1860
  });
1801
1861
  } catch (error) {
1802
- if (!(error instanceof AttachmentError)) throw error;
1803
- if (error.code === "IMAGE_DIMENSION_TOO_LARGE") throw new Error(`cannot read "${target.displayPath}": at least one image side exceeds the ${attachments.imageLimits.maxImageDimension}px limit; downscale the image and read the smaller copy`, { cause: error });
1804
- if (error.code === "IMAGE_TOO_MANY_PIXELS") throw new Error(`cannot read "${target.displayPath}": the image exceeds the ${attachments.imageLimits.maxImagePixels}-pixel decoded-size limit; downscale the image and read the smaller copy`, { cause: error });
1805
- if (error.code === "IMAGE_TOO_LARGE") throw new Error(`cannot read "${target.displayPath}": the image cannot be stored within the deployment's byte limits; downscale the image and read the smaller copy`, { cause: error });
1806
- if (error.code === "ATTACHMENT_WRITE_FAILED" && /16-bit PNG/iu.test(error.message)) throw new Error(`cannot read "${target.displayPath}": the 16-bit PNG could not be converted to the normalized 8-bit sRGB form; convert it to an 8-bit PNG/JPEG/WebP and retry`, { cause: error });
1807
- if (error.code === "INVALID_IMAGE" && declared === void 0) throw new Error(`cannot read "${target.displayPath}": the bytes do not decode as a supported PNG/JPEG/WebP/GIF image; the file may be truncated or corrupt`, { cause: error });
1808
- if (error.code !== "IMAGE_TYPE_MISMATCH") throw error;
1809
- if (declared === void 0) throw new Error(`cannot read "${target.displayPath}": the file signature claims ${mediaType}, but the bytes decode as a different image format; the file may be corrupt`, { cause: error });
1810
- throw new Error(`cannot read "${target.displayPath}": the ${extension} extension declares ${mediaType}, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`, { cause: error });
1862
+ throw saveFailure(error, attachments, {
1863
+ displayPath: target.displayPath,
1864
+ extension,
1865
+ mediaType,
1866
+ sniffed: declared === void 0
1867
+ });
1811
1868
  }
1812
1869
  ctx.emit("fs/observed", target, {
1813
1870
  kind: "present",
@@ -1907,7 +1964,7 @@ var FsSandboxController = class {
1907
1964
  const justification = args.sandbox_permissions === void 0 && args.justification?.trim() === "" ? void 0 : args.justification;
1908
1965
  validateEscalationArgs(args.sandbox_permissions, justification);
1909
1966
  if (args.sandbox_permissions === void 0 || args.justification === void 0) return standingPolicy;
1910
- if (this.escalationModes.length === 0) throw new Error("sandbox_permissions is not available in this composition (no sandboxing filesystem to escalate)");
1967
+ if (this.escalationModes.length === 0) throw new ToolArgsError(["sandbox_permissions is not available in this composition (no sandboxing filesystem to escalate)"]);
1911
1968
  const policy = standingPolicy;
1912
1969
  const approvedMode = await approveEscalation({
1913
1970
  requestedMode: args.sandbox_permissions,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-patch-output.d.ts","sourceRoot":"","sources":["../../src/apply-patch-output.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAkC,MAAM,kBAAkB,CAAA;AAE5F,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,EAAE,CAAA;AAC/G,CAAC"}
@@ -1,4 +1,4 @@
1
- /** Codex-style multi-file patch tool over the guarded patch executor. */
1
+ /** Multi-file patch tool over the guarded patch executor. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import type { FsSandboxController } from './sandbox.ts';
4
4
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-patch.d.ts","sourceRoot":"","sources":["../../src/apply-patch.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAKzE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAmCpF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-patch.js","sourceRoot":"","sources":["../../src/apply-patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/G,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAMpF;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY,EAAE,OAA4B;IAC5E,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC;QACvB,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,G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AAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC,CAAA;QACrG,CAAC;QACD,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;KAC7D,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEtD,2DAA2D;AAC3D,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAAA;AAE/E;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CAwBxF;AAWD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,EAAE,GAAG,SAAS,CAKnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAGtC,2DAA2D;AA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,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAA;IACtF,MAAM,IAAI,GAAI,IAAgC,CAAC,IAAI,CAAA;IACnD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACvE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/edit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEvD,mDAAmD;AACnD,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB;AAgBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAUnI;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,CAIjF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CA6F9E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/edit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAA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AAE,KAAK,EAAE,QAAQ,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAA;QACjE,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAA;AAC9E;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAqB7C,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,WAAmB;IAClE,IAAI,CAAC,CAAC,KAAK,YAAY,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IAC7C,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACrC,OAAO,IAAI,OAAO,CAChB,kBAAkB,WAAW,uDAAuD,EACpF,KAAK,CAAC,IAAI,EACV,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;IACH,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACtC,OAAO,IAAI,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,iCAAiC,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACrG,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,25 @@
1
+ /** Typed `read_image` failures. @module @deepseek-ai/dsh-tool-fs/src/image-error */
2
+ import { HarnessError } from '@deepseek-ai/dsh-error';
3
+ /**
4
+ * Every `read_image` failure the tool classifies itself, before the attachment store sees the bytes:
5
+ *
6
+ * - `IMAGE_UNSUPPORTED_MODEL`: the calling route does not declare image input; switch to an image-capable model.
7
+ * - `IMAGE_UNSUPPORTED_FORMAT`: the extension, the file signature, or the deployment's accepted media types
8
+ * exclude the format; convert the file to an accepted format or read another file.
9
+ *
10
+ * Failures the attachment store classifies keep their `AttachmentError` codes.
11
+ */
12
+ export declare const IMAGE_INPUT_ERROR_CODES: readonly ["IMAGE_UNSUPPORTED_MODEL", "IMAGE_UNSUPPORTED_FORMAT"];
13
+ /** One `read_image` failure code. */
14
+ export type ImageInputErrorCode = typeof IMAGE_INPUT_ERROR_CODES[number];
15
+ /** Typed `read_image` failure; `code` is one of {@link IMAGE_INPUT_ERROR_CODES}. */
16
+ export declare class ImageInputError extends HarnessError {
17
+ readonly code: ImageInputErrorCode;
18
+ /**
19
+ * @param message - model-facing refusal naming the path and the safe next step.
20
+ * @param code - stable failure code.
21
+ * @param options - standard `cause` chaining.
22
+ */
23
+ constructor(message: string, code: ImageInputErrorCode, options?: ErrorOptions);
24
+ }
25
+ //# sourceMappingURL=image-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-error.d.ts","sourceRoot":"","sources":["../../src/image-error.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,kEAG1B,CAAA;AAEV,qCAAqC;AACrC,MAAM,MAAM,mBAAmB,GAAG,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAA;AAExE,oFAAoF;AACpF,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAkB,IAAI,EAAE,mBAAmB,CAAA;IAE3C;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,YAAY;CAK/E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-error.js","sourceRoot":"","sources":["../../src/image-error.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,yBAAyB;IACzB,0BAA0B;CAClB,CAAA;AAKV,oFAAoF;AACpF,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC7B,IAAI,CAAqB;IAE3C;;;;OAIG;IACH,YAAY,OAAe,EAAE,IAAyB,EAAE,OAAsB;QAC5E,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAUxC,qDAAqD;AACrD,eAAO,MAAM,IAAI,YAAY,CAAA;AAE7B,sDAAsD;AACtD,eAAO,MAAM,MAAM,UAAsD,CAAA;AAEzE,qEAAqE;AACrE,MAAM,WAAW,MAAM;IACrB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qIAAqI;IACrI,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,uEAAuE;IACvE,SAAS,CA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;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,EAC7D,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,GAC9D,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAIvC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-result.js","sourceRoot":"","sources":["../../src/mutation-result.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAM1E;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAY,EAAE,MAAgB,EAAE,OAAU,EAAE,IAAmB;IAE/D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAA;IACtC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAA;IACnE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,CAAA;AACxD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/patch/execute.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAyB,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAqB/F;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,GAAG,SAAS,EAC3G,UAAU,EAAE,SAAS,gBAAgB,EAAE,GACtC,OAAO,CAAC,oBAAoB,CAAC,CA8E/B"}