test(snapshot): prepare apply-patch scenes and document tool activation

This commit is contained in:
sjw1231 committed 2026-10-15 03:51:09 +08:00
1 parent d6d6c84803
commit f7dae57fda
17 files changed
+263 -14

No files matched your search

+4 -2
View File
@@ -3315,7 +3315,7 @@ export interface Config {
## `@deepseek-ai/dsh-system-prompt`
- `source`: [`packages/core/system-prompt/src/index.ts:247`](../packages/core/system-prompt/src/index.ts)
- `source`: [`packages/core/system-prompt/src/index.ts:248`](../packages/core/system-prompt/src/index.ts)
```ts config-catalog
/** Plugin config: the deployment-authored fragment of the system prompt (see {@link Config.personaPrefix} for its contract). */
@@ -3513,11 +3513,13 @@ export interface Config {
## `@deepseek-ai/dsh-tool-fs`
- `inject`: `tools` · `fs` · `systemPrompt`
- `source`: [`packages/fs/tool-fs/src/index.ts:25`](../packages/fs/tool-fs/src/index.ts)
- `source`: [`packages/fs/tool-fs/src/index.ts:26`](../packages/fs/tool-fs/src/index.ts)
```ts config-catalog
/** Plugin config (all optional — `Config` supplies the defaults). */
export interface Config {
/** Evaluation switch for apply_patch; default profiles leave it disabled. */
enableApplyPatch?: boolean
/** Default and maximum number of lines returned by one `read` call. */
readLimit?: number
/** Maximum characters returned for a single line before truncation. */
+4 -2
View File
@@ -3317,7 +3317,7 @@ export interface Config {
## `@deepseek-ai/dsh-system-prompt`
- `source`: [`packages/core/system-prompt/src/index.ts:247`](../packages/core/system-prompt/src/index.ts)
- `source`: [`packages/core/system-prompt/src/index.ts:248`](../packages/core/system-prompt/src/index.ts)
```ts config-catalog
/** Plugin config: the deployment-authored fragment of the system prompt (see {@link Config.personaPrefix} for its contract). */
@@ -3515,11 +3515,13 @@ export interface Config {
## `@deepseek-ai/dsh-tool-fs`
- `inject`: `tools` · `fs` · `systemPrompt`
- `source`: [`packages/fs/tool-fs/src/index.ts:25`](../packages/fs/tool-fs/src/index.ts)
- `source`: [`packages/fs/tool-fs/src/index.ts:26`](../packages/fs/tool-fs/src/index.ts)
```ts config-catalog
/** Plugin config (all optional — `Config` supplies the defaults). */
export interface Config {
/** Evaluation switch for apply_patch; default profiles leave it disabled. */
enableApplyPatch?: boolean
/** Default and maximum number of lines returned by one `read` call. */
readLimit?: number
/** Maximum characters returned for a single line before truncation. */
+7 -4
View File
@@ -9,8 +9,8 @@
en: 6cc2cd9ced70bb09
zh: 1c0e6cb4ba2ed637
/tool-schema-catalog/tool-package-map:
en: 72e2a375567f5850
zh: b51b8ea5b52814fd
en: 5ad9e99135760ba5
zh: c551ab8f4c4ee332
/tool-schema-catalog/deepseek-ai-dsh-plugin-manager:
en: e0143916bb634762
zh: e0143916bb634762
@@ -116,6 +116,9 @@
/tool-schema-catalog/deepseek-ai-dsh-tool-fs:
en: 07d595ce1f1a5184
zh: 07d595ce1f1a5184
/tool-schema-catalog/deepseek-ai-dsh-tool-fs/apply-patch:
en: 882f2fa9fac236d6
zh: e8320796a5cb038f
/tool-schema-catalog/deepseek-ai-dsh-tool-fs/edit:
en: 5b6a252adde51af6
zh: 7aa172a5d8b9cbd2
@@ -126,8 +129,8 @@
en: f6f7a1140066ce04
zh: d528e01a0939795a
/tool-schema-catalog/deepseek-ai-dsh-tool-fs/write:
en: f80700c5d57e8d87
zh: fb7cccbba0d8d486
en: 073b88ba5607dedf
zh: 8c97aa5523ecac64
/tool-schema-catalog/deepseek-ai-dsh-tool-fs-search:
en: 703fea005ce84c50
zh: 703fea005ce84c50
+23 -2
View File
@@ -28,7 +28,7 @@ This table connects model-visible tool names to the plugin package and service s
| `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent bash tool; deployment composition supplies the PTY backend and may override the model-facing environment description. |
| `@deepseek-ai/dsh-tool-pwsh-persistent` | `pwsh` | `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent pwsh tool, the Windows counterpart of the persistent bash tool; deployment composition supplies a pwsh-dialect PTY backend and may override the model-facing environment description. |
| `@deepseek-ai/dsh-tool-str-replace-editor` | `str_replace_editor` | `ctx.tools`, `ctx.fs` | `tool/call`, `fs/observed after view presence/absence, edit absence, or successful mutation`, `tool/result` | - | Standalone view/create/unique literal replace/line insert tool over the filesystem seam; it composes with any shell or terminal API. |
| `@deepseek-ai/dsh-tool-fs` | `edit`, `read`, `read_image`, `write` | `ctx.tools`, `ctx.fs`, `ctx.systemPrompt`, `ctx.attachments (image-tool registration)`, `ctx.llm + an image-capable route (image-tool execution)` | `tool/call`, `fs/write-intent or fs/edit-intent for mutations`, `fs/observed after read presence/absence or successful file operation`, `durable attachment (read_image)`, `tool/result` | - | The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input. |
| `@deepseek-ai/dsh-tool-fs` | `apply_patch`, `edit`, `read`, `read_image`, `write` | `ctx.tools`, `ctx.fs`, `ctx.systemPrompt`, `ctx.attachments (image-tool registration)`, `ctx.llm + an image-capable route (image-tool execution)` | `tool/call`, `fs/write-intent or fs/edit-intent for mutations`, `fs/observed after read presence/absence or successful file operation`, `durable attachment (read_image)`, `tool/result` | - | This catalog enables enableApplyPatch to document the evaluation-only apply_patch tool; shipped profiles leave it disabled. The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input. |
| `@deepseek-ai/dsh-tool-fs-search` | `glob`, `grep` | `ctx.tools`, `ctx.subprocess`, `ctx.systemPrompt` | `tool/call`, `tool/result` | - | glob and grep are unconditional discovery tools that spawn the packaged ripgrep binary (`@vscode/ripgrep`) through ctx.subprocess as ordinary foreground calls (never background jobs) — no host `rg` install and no shell layer. The catalog uses `sampleOverCapGlobResults: true`; deployments must choose that behavior explicitly. Capped results save the complete formatted list through the optional ctx.spillStore backend; returned locators are follow-up-readable/searchable when the backend exposes local paths in co-located deployments. |
| `@deepseek-ai/dsh-tool-terminal` | `terminal_close`, `terminal_list`, `terminal_open`, `terminal_read`, `terminal_send`, `terminal_signal` | `ctx.tools`, `ctx.terminals`, `ctx.systemPrompt`, `ctx.jobs at call time for run_in_background` | `tool/call`, `tool/result` | - | The six terminal tools are opt-in and complement one-shot shell/filesystem tools. `terminal_send(run_in_background: true)` registers with `ctx.jobs`; TUI, named key sequences, BEL, resize, auto-start, and cross-agent sharing are absent from the schema. |
| `@deepseek-ai/dsh-tool-goal` | `create_goal`, `get_goal`, `update_goal` | `ctx.tools`, `ctx.agents`, `ctx.goals`, `ctx.systemPrompt`, `a calling Agent in an authorized open turn` | `tool/call`, `goal/change for mutations`, `tool/result` | - | create, edit, pause, and resume require direct-human root authority; complete and blocked also accept the exact current goal round. The default blocked lower bound is three admitted rounds. |
@@ -945,6 +945,27 @@ Standalone view/create/unique literal replace/line insert tool over the filesyst
## `@deepseek-ai/dsh-tool-fs`
### `apply_patch`
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.
```json
{
"type": "object",
"properties": {
"patch": {
"type": "string",
"description": "Codex patch: 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. Read existing files before updating them."
}
},
"required": [
"patch"
]
}
```
Source: [`packages/fs/tool-fs/src/index.ts`](../packages/fs/tool-fs/src/index.ts)
### `edit`
Edit an existing UTF-8 text file by replacing literal text.
@@ -1056,7 +1077,7 @@ Create or fully replace a UTF-8 text file.
Source: [`packages/fs/tool-fs/src/index.ts`](../packages/fs/tool-fs/src/index.ts)
The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input.
This catalog enables enableApplyPatch to document the evaluation-only apply_patch tool; shipped profiles leave it disabled. The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input.
<a id="deepseek-aidsh-tool-fs-search"></a>
+23 -2
View File
@@ -32,7 +32,7 @@
| `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.tools`、`ctx.terminals`、`an owning Agent at execution time` | `tool/call`、`PTY shell state`、`tool/result` | - | 一个按所有者隔离的持久 bash 工具;部署组合提供 PTY 后端,并可覆盖面向模型的环境描述。 |
| `@deepseek-ai/dsh-tool-pwsh-persistent` | `pwsh` | `ctx.tools`、`ctx.terminals`、`an owning Agent at execution time` | `tool/call`、`PTY shell state`、`tool/result` | - | 一个按所有者隔离的持久 pwsh 工具,持久 bash 工具的 Windows 对应物;部署组合提供 pwsh 方言的 PTY 后端,并可覆盖面向模型的环境描述。 |
| `@deepseek-ai/dsh-tool-str-replace-editor` | `str_replace_editor` | `ctx.tools`、`ctx.fs` | `tool/call`、`fs/observed after view presence/absence, edit absence, or successful mutation`、`tool/result` | - | 基于文件系统 seam 的独立查看/创建/唯一字面量替换/按行插入工具;可与任何 shell 或终端接口组合。 |
| `@deepseek-ai/dsh-tool-fs` | `edit`、`read`、`read_image`、`write` | `ctx.tools`、`ctx.fs`、`ctx.systemPrompt`、`ctx.attachments (image-tool registration)`、`ctx.llm + an image-capable route (image-tool execution)` | `tool/call`、`fs/write-intent or fs/edit-intent for mutations`、`fs/observed after read presence/absence or successful file operation`、`durable attachment (read_image)`、`tool/result` | - | 先读后写/编辑策略由 `@deepseek-ai/dsh-fs-observation-policy` 添加;它是一个 `fs/*` 事件门禁插件,不会改变 schema。加载这些工具的部署按预期也应加载该插件。没有 `ctx.attachments` 时图片工具不会注册;其 schema 与路由无关,执行时除非确切路由的模型声明图片输入,否则拒绝。 |
| `@deepseek-ai/dsh-tool-fs` | `edit`、`read`、`read_image`、`write` | `ctx.tools`、`ctx.fs`、`ctx.systemPrompt`、`ctx.attachments (image-tool registration)`、`ctx.llm + an image-capable route (image-tool execution)` | `tool/call`、`fs/write-intent or fs/edit-intent for mutations`、`fs/observed after read presence/absence or successful file operation`、`durable attachment (read_image)`、`tool/result` | - | 本目录启用 enableApplyPatch 以记录评测期的 apply_patch 工具;默认 profile 保持关闭。先读后写/编辑策略由 `@deepseek-ai/dsh-fs-observation-policy` 添加;它是一个 `fs/*` 事件门禁插件,不会改变 schema。加载这些工具的部署按预期也应加载该插件。没有 `ctx.attachments` 时图片工具不会注册;其 schema 与路由无关,执行时除非确切路由的模型声明图片输入,否则拒绝。 |
| `@deepseek-ai/dsh-tool-fs-search` | `glob`、`grep` | `ctx.tools`、`ctx.subprocess`、`ctx.systemPrompt` | `tool/call`、`tool/result` | - | glob 和 grep 是无条件可用的发现工具,通过 ctx.subprocess spawn 随包提供的 ripgrep 二进制文件(`@vscode/ripgrep`),并作为普通前台调用运行,绝不作为后台任务;无需在宿主机安装 `rg`,也不经过 shell 层。本目录使用 `sampleOverCapGlobResults: true`;部署必须显式选择该行为。结果超过上限时,会通过可选的 ctx.spillStore 后端保存完整的格式化列表;在共置部署中,如果后端公开本地路径,返回的定位信息可供后续读取/搜索。 |
| `@deepseek-ai/dsh-tool-terminal` | `terminal_close`、`terminal_list`、`terminal_open`、`terminal_read`、`terminal_send`、`terminal_signal` | `ctx.tools`、`ctx.terminals`、`ctx.systemPrompt`、`ctx.jobs at call time for run_in_background` | `tool/call`、`tool/result` | - | 这 6 个终端工具需要选择启用,用于补充一次性 bash/文件系统工具。`terminal_send(run_in_background: true)` 会注册到 `ctx.jobs`;schema 不包含 TUI、具名按键序列、BEL、调整尺寸、自动启动和跨 agent 共享。 |
| `@deepseek-ai/dsh-tool-goal` | `create_goal`、`get_goal`、`update_goal` | `ctx.tools`、`ctx.agents`、`ctx.goals`、`ctx.systemPrompt`、`a calling Agent in an authorized open turn` | `tool/call`、`goal/change for mutations`、`tool/result` | - | create、edit、pause 和 resume 要求直接来自人类的根权限;complete 和 blocked 也接受确切的当前 Goal Round。blocked 的默认下限是 3 个获准的 Round。 |
@@ -951,6 +951,27 @@ pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费
## `@deepseek-ai/dsh-tool-fs`
### `apply_patch`
用一个 Codex 风格补丁新增、更新、删除或移动 UTF-8 文本文件;变更跨越多个文件或分离区域时,优先于多次 edit 调用。
```json
{
"type": "object",
"properties": {
"patch": {
"type": "string",
"description": "Codex patch: 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. Read existing files before updating them."
}
},
"required": [
"patch"
]
}
```
来源: [`packages/fs/tool-fs/src/index.ts`](../packages/fs/tool-fs/src/index.ts)
### `edit`
通过替换字面量文本来编辑现有 UTF-8 文本文件。
@@ -1062,7 +1083,7 @@ pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费
来源:[`packages/fs/tool-fs/src/index.ts`](../packages/fs/tool-fs/src/index.ts)
先读后写/编辑策略由 `@deepseek-ai/dsh-fs-observation-policy` 添加;它是一个 `fs/*` 事件门禁插件,不会改变 schema。加载这些工具的部署按预期也应加载该插件。没有 `ctx.attachments` 时图片工具不会注册;其 schema 与路由无关,执行时除非确切路由的模型声明图片输入,否则拒绝。
本目录启用 enableApplyPatch 以记录评测期的 apply_patch 工具;默认 profile 保持关闭。先读后写/编辑策略由 `@deepseek-ai/dsh-fs-observation-policy` 添加;它是一个 `fs/*` 事件门禁插件,不会改变 schema。加载这些工具的部署按预期也应加载该插件。没有 `ctx.attachments` 时图片工具不会注册;其 schema 与路由无关,执行时除非确切路由的模型声明图片输入,否则拒绝。
<a id="deepseek-aidsh-tool-fs-search"></a>
+2 -2
View File
@@ -396,10 +396,10 @@ const TOOL_PACKAGES: ToolPackage[] = [
// the attachments-conditional image schema without attachment I/O.
await ctx.plugin(LocalFileSystem)
await ctx.plugin(CatalogAttachmentStore)
await ctx.plugin(ToolFs)
await ctx.plugin(ToolFs, { enableApplyPatch: true })
},
note:
'The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input.',
'This catalog enables enableApplyPatch to document the evaluation-only apply_patch tool; shipped profiles leave it disabled. The read-before-write/edit policy is added by `@deepseek-ai/dsh-fs-observation-policy` (an `fs/*` event-gate plugin, no schema change); a deployment that loads these tools is expected to also load it. The image tool is not registered without `ctx.attachments`; its schema is route-independent, and execution refuses unless the exact routed model declares image input.',
},
{
pkg: '@deepseek-ai/dsh-tool-fs-search',
@@ -0,0 +1,14 @@
# Pending live recording: no DEEPSEEK_API_KEY was available. Do not author Session JSONL.
version: 1
scenario: apply-patch-rejected
profile: headless
composition: apply-patch
recording: live
header:
class: apply-patch
platform: posix
workspace:
final: true
input:
task: >-
First attempt apply_patch to change old to new in src/unread.txt without reading it. After the refusal, read the file and retry the same patch. Use no other mutation tool.
@@ -0,0 +1 @@
old
@@ -0,0 +1,86 @@
# Minimal keyless composition: real app and filesystem tools; replayed model.
- id: llm-deepseek
name: '@deepseek-ai/dsh-llm-deepseek-api-key'
disabled: true
- insert:
- id: llm-replay
name: '@deepseek-ai/dsh-llm-replay'
config:
providers:
- id: deepseek-official
name: DeepSeek
models:
- id: deepseek-v4-pro
- id: subprocess
name: '@deepseek-ai/dsh-subprocess-local'
- id: agent-default-model
name: '@deepseek-ai/dsh-agent-default-model'
config:
provider: deepseek-official
model: deepseek-v4-pro
- id: session-persistence-jsonl
name: '@deepseek-ai/dsh-session-persistence-jsonl'
config:
root: !!js dshHomePath('sessions')
compression: none
- id: agent-instructions
name: '@deepseek-ai/dsh-agent-instructions'
disabled: true
- id: system-prompt
name: '@deepseek-ai/dsh-system-prompt'
config:
personaPrefix: You are a concise snapshot agent working in {{cwd}}.
- id: tool-jobs
name: '@deepseek-ai/dsh-tool-jobs'
disabled: true
- id: goal
name: '@deepseek-ai/dsh-goal'
disabled: true
- id: goal-round-driver
name: '@deepseek-ai/dsh-goal-round-driver'
disabled: true
- id: command-goal
name: '@deepseek-ai/dsh-command-goal'
disabled: true
- id: tool-goal
name: '@deepseek-ai/dsh-tool-goal'
disabled: true
- id: skill
name: '@deepseek-ai/dsh-skill'
disabled: true
- id: skill-filesystem
name: '@deepseek-ai/dsh-skill-filesystem'
disabled: true
- id: tool-skill
name: '@deepseek-ai/dsh-tool-skill'
disabled: true
- id: tool-fs
config:
enableApplyPatch: true
- id: spill-local
name: '@deepseek-ai/dsh-spill-local'
config:
root: !!js process.env.DSH_SNAPSHOT_SPILL_ROOT ?? './.spill'
- insert:
- id: snapshot-spill-locators
name: ../../../scripts/snapshot-spill-locators.ts
config:
root: !!js process.env.DSH_SNAPSHOT_SPILL_ROOT
locatorRoot: !!js process.env.DSH_SNAPSHOT_SPILL_LOCATOR_ROOT
@@ -0,0 +1,78 @@
# Minimal live counterpart for the apply-patch snapshot composition.
- id: llm-deepseek
name: '@deepseek-ai/dsh-llm-deepseek-api-key'
config:
models:
- id: deepseek-v4-pro
- id: subprocess
name: '@deepseek-ai/dsh-subprocess-local'
- id: agent-default-model
name: '@deepseek-ai/dsh-agent-default-model'
config:
provider: deepseek-official
model: deepseek-v4-pro
- id: session-persistence-jsonl
name: '@deepseek-ai/dsh-session-persistence-jsonl'
config:
root: !!js dshHomePath('sessions')
compression: !!js 'process.env.DSH_SNAPSHOT === undefined ? ''zstd'' : ''none'''
- id: agent-instructions
name: '@deepseek-ai/dsh-agent-instructions'
disabled: true
- id: system-prompt
name: '@deepseek-ai/dsh-system-prompt'
config:
personaPrefix: You are a concise snapshot agent working in {{cwd}}.
- id: tool-jobs
name: '@deepseek-ai/dsh-tool-jobs'
disabled: true
- id: goal
name: '@deepseek-ai/dsh-goal'
disabled: true
- id: goal-round-driver
name: '@deepseek-ai/dsh-goal-round-driver'
disabled: true
- id: command-goal
name: '@deepseek-ai/dsh-command-goal'
disabled: true
- id: tool-goal
name: '@deepseek-ai/dsh-tool-goal'
disabled: true
- id: skill
name: '@deepseek-ai/dsh-skill'
disabled: true
- id: skill-filesystem
name: '@deepseek-ai/dsh-skill-filesystem'
disabled: true
- id: tool-skill
name: '@deepseek-ai/dsh-tool-skill'
disabled: true
- id: tool-fs
config:
enableApplyPatch: true
- id: spill-local
name: '@deepseek-ai/dsh-spill-local'
config:
root: !!js process.env.DSH_SNAPSHOT_SPILL_ROOT ?? './.spill'
- insert:
- id: snapshot-spill-locators
name: ../../../scripts/snapshot-spill-locators.ts
config:
root: !!js process.env.DSH_SNAPSHOT_SPILL_ROOT
locatorRoot: !!js process.env.DSH_SNAPSHOT_SPILL_LOCATOR_ROOT
@@ -0,0 +1,15 @@
# Pending live recording: no DEEPSEEK_API_KEY was available. Do not author Session JSONL.
version: 1
scenario: apply-patch-update
profile: headless
composition: apply-patch
recording: live
header:
class: apply-patch
pin: true
platform: posix
workspace:
final: true
input:
task: >-
Read src/a.ts and src/b.ts, then use one apply_patch call to change alpha to ALPHA in src/a.ts, beta to BETA in src/b.ts, and create src/c.ts containing export const c = 3; followed by a newline. Use no other mutation tool.
@@ -0,0 +1 @@
export const ALPHA = 1;
@@ -0,0 +1 @@
export const BETA = 2;
@@ -0,0 +1 @@
export const c = 3;
@@ -0,0 +1 @@
export const alpha = 1;
@@ -0,0 +1 @@
export const beta = 2;