dsh-patch-edit-plus
精选清单收录维护状态: 活跃drscrewdriver/dsh-patch-edit-plus
为 DeepSeek Harness 提供补丁式文件编辑工具,默认使用 Git/统一 diff 的 `apply_patch`,也可选择 Codex 语法,并支持全有或全无地应用补丁。兼容 0.1.2-rc.1 至 0.1.5-rc.2。
$ dsh plugin add dsh-patch-edit-plus4
星标
4
Fork
TypeScript
语言
MIT
许可证
2026-09-13
创建于
2026-11-20
最近推送
README
dsh-patch-edit-plus
English | 简体中文 | 日本語 | 한국어 | Français | Deutsch | Italiano | Русский | Español
Patch-style file editing for DeepSeek Harness (DSH): one model-facing apply_patch tool that accepts git/unified diff (default) and Codex apply_patch syntax (opt-in), applies every change all-or-nothing, and stays completely out of DSH's way.
DSH version compatibility
| DSH version | Status | Notes |
|---|---|---|
0.2.0-rc.1+ |
✅ supported (this line, v0.3.0+) | Declarative settings: allowCodexPatch is marked .volatile() — the settings form renders automatically and loader/volatile-update re-registers the tool without a remount. No registration call. Delete/Move migrated to the ShellExecutor.execute() + result() foreground API. |
0.1.7-rc.1+ |
↗ maintenance line | Served by the compat/0.1.7 branch / dsh-0.1.7 dist-tag (v0.2.1 there). 0.2.0's shell executor renamed run → execute (introduced between 0.1.2 and 0.1.7), so one codebase cannot serve both lines type-safely. |
0.1.2-rc.1 ~ 0.1.5-rc.2 |
↗ maintenance line | Served by the pre-0.1.7 branch / dsh-0.1.5 dist-tag. 0.1.7 removed the imperative settings APIs the dual-API fallback relied on. |
Settings are declarative on this line: fields marked .volatile() in Config become the settings form; the plugin subscribes to loader/volatile-update instead of receiving registration hooks.
Why patch at all? (tool routing guide)
The tool description explicitly routes the model:
- Single small change in one already-read file → prefer the native
edittool (a patch costs more tokens than a literal edit). - Small change inside a LARGE file →
apply_patch(no need to echo the whole file). - Batched changes across MANY files →
apply_patch(one call, verified atomically). - New file with substantial content / delete / rename →
apply_patch.
Installation
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
dsh web --dump-config # verify the plugin row appears
# restart DSH
Usage
Unified diff (default, enabled)
--- a/src/app.ts
+++ b/src/app.ts
@@ -10,4 +10,4 @@ export function main() {
init()
- start(oldPort)
+ start(newPort)
await shutdown()
}
Codex apply_patch syntax (opt-in)
*** Begin Patch
*** Update File: src/app.ts
@@
init()
- start(oldPort)
+ start(newPort)
*** Add File: docs/notes.md
+# Notes
*** Delete File: tmp/junk.txt
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
*** End Patch
Enable with allowCodexPatch: true. When a Codex patch arrives while disabled, the tool returns an actionable hint (how to enable or how to retry in unified diff) instead of a generic parse error — Codex syntax is a strong prior for GPT-family models and a silent failure traps them in retry loops.
Operations
| Operation | Unified diff | Codex | Execution path |
|---|---|---|---|
| Add | new file mode + /dev/null |
*** Add File: |
ctx.fs.writeText (official intent dance) |
| Update (multi-hunk) | @@ hunks |
@@ hunks |
ctx.fs.writeText |
| Delete | deleted file mode + /dev/null |
*** Delete File: |
ctx.shell (sandbox-aware, env-passed path) |
| Move / rename | rename from/to |
*** Move to: |
ctx.shell |
Guarantees
- All-or-nothing: the whole patch is verified against current file content first (context location, workspace containment, symlink policy, duplicate paths); any failure aborts with zero bytes written.
- Read-before-write gate respected: every write replicates the official
writetool's intent dance —fs/write-intentwaterfall → guardedwriteText→fs/observedemit. A barewriteTextwould silently bypass the gate because DSH providers never dispatchfs/*events themselves. - Precise failure diagnostics: on hunk mismatch the error carries file + hunk index, search origin line, expected-line preview (whitespace made visible), the file's actual excerpt, and a targeted hint.
- Newline fidelity: CRLF files are written back as CRLF; no-trailing-newline tails are preserved unless the patch changes the tail.
- Pure addition: the plugin registers exactly one tool, never calls
tools.restrict(), never overrides a native tool, registers no global services, and removes everything on unload. Name conflicts with otherapply_patchproviders (bainianlaoyao/dsh-codex-mode,shuind/dsh-codex-harness, …) are resolved by rename avoidance (apply_patch_1,…_2, …) so DSH never fails to start.
Configuration
更多「插件工具」插件
dsh-context
作者 bowenliang123
A context insight plugin officially recommended by DeepSeek Harness, for context composition, evolution and Multi-Agent details. DeepSeek Harness官方推荐的上下文洞察插件,透视上下文组成与演进,以及多Agent 协作与通讯。
deepseek-harness-control-center
作者 feibi-mochi
DeepSeek Harness control center for balance, usage, peak/off-peak pricing, encrypted multi-account switching, health checks, reminders, recharge, and session controls. / 余额、用量、峰谷计费、加密多账户、健康检查、提醒、充值与会话控制
dsh-context-doctor
作者 zhenyu98
DSH 上下文注入审计插件:统计 AGENTS.md 指令链/技能目录/工具 schema 的 token 成本,检测重复与冲突;Web UI 圆环面板 + context_audit 工具。Context Doctor for DeepSeek Harness: audit instruction-chain / skill catalog / tool schemas token cost.
dsh-balance-plugin
作者 yxxbc
deepSeek 余额监控与用量统计(DSH 动态 Cordis 插件):余额监控 · 官方充值入口 · 用量统计 · 三方插件管理
