rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:xiamubumu/dsh-patch-library
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
The official DSH core patches, as data — and five ways to apply them.
官方 DSH 内核补丁的数据化版本 —— 10 条补丁,5 种打法。
Ten self-contained patches for @deepseek-ai/dsh-* and @earendil-works/pi-ai, plus a small
applier that finds your DSH installation by itself. No hard-coded paths, no personal information
anywhere in this repository, no network access required.
十条自成体系的补丁,覆盖 @deepseek-ai/dsh-* 与 @earendil-works/pi-ai;配一个小巧的应用器,
它会自己找到你的 DSH 安装位置。零硬编码路径、仓库里没有任何个人信息、全程不需要联网。
🌐 中文完整说明(推荐中文读者从这里开始) → README.zh-CN.md
中文读者还应该看这两份:
教程-安装与官方补丁里的补丁库章节 与 给 agent 的中文提示词。
Built for
@deepseek-ai/dsh0.1.5-rc.2 (the 1.5 line). Every patch records the exact sha256 of both the file it expects and the file it produces, so the applier can tell youexact/applied/conflictbefore it touches anything.
Some fixes cannot be shipped as a plugin: they have to run inside an official file, in the middle
of a function that Cordis does not expose as a seam. Four of those fixes were already published as
plugins (dsh-context-reclaim, dsh-capability-composer, dsh-composer-launcher,
dsh-aux-degrade). The rest — plus the ones that only matter if you want the full set — live here,
as ordinary unified diffs that anyone can read, review, apply, revert, or regenerate.
Nothing here is a binary blob and nothing here is magic: patches/<id>/change.diff is a normal
patch, and manifest.json is the metadata that lets a script apply it safely and reversibly.
| id | package → file | kind | size | restart | already handled by a plugin? |
|---|---|---|---|---|---|
dsh-llm-writable-request |
@deepseek-ai/dsh-llm → lib/index.js |
lines | +18 −1 | yes | yes — dsh-context-reclaim |
agent-loop-snapshot-prompt |
@deepseek-ai/dsh-agent-loop → lib/index.js |
lines | +97 −20 | yes | no |
llm-pi-ai-system-prompt |
@deepseek-ai/dsh-llm-pi-ai → lib/index.js |
lines | +96 −54 | yes | no |
compaction-pruner |
@deepseek-ai/dsh-compaction-tool-result-pruner → lib/index.js |
lines | +354 −14 | yes | no |
ui-renderer-turntail |
@deepseek-ai/dsh-client-ui-renderer → lib/client.js |
lines | +9 −1 | no | no |
ui-sidebar-wrap |
@deepseek-ai/dsh-client-ui-sidebar → lib/lib-client.js |
regex | +1 −1 | no | no |
session-format-v1-to-v2 |
@deepseek-ai/dsh-session-format-v1-to-v2 → lib/index.js |
lines | +2 −1 | yes | no |
session-persistence-jsonl |
@deepseek-ai/dsh-session-persistence-jsonl → lib/worker.cjs |
lines | +2 −1 | yes | no |
mcp-client |
@deepseek-ai/dsh-mcp-client → lib/index.js |
lines | +59 −6 | yes | no |
pi-ai-max-tokens-floor |
@earendil-works/pi-ai → dist/api/simple-options.js |
lines | +11 −1 | yes | no |
Every patch has its own patches/<id>/NOTES.md with what it changes, when you want it, how to
verify it, and what to do if it does not fit your build — in English and Chinese.
ui-sidebar-wrap is a regex patch on purpose: the sidebar's class prefix is a build hash, so a
line diff would be invalidated by any rebuild. patches/<id>/change.json stores the pattern and its
explicit inverse.
Pick whichever matches how you like to work. All five are documented step by step in
docs/methods.md (Chinese: docs/methods.zh-CN.md).
| method | command | |
|---|---|---|
| A | script (recommended) | node apply.mjs --check then node apply.mjs --apply --all |
| B | git apply |
cd <pkg dir> && git apply -p1 <library>/patches/<id>/change.diff |
| C | your own AI agent | paste the block from PROMPT.md and let it do A or B for you |
| D | regenerate for your build | node tools/make-patch.mjs --file <patched> --orig <pristine> --pkg <pkg> --rel <rel> |
| E | revert | node apply.mjs --revert --all, or restore any *.orig by hand |
All ten diffs were verified with git apply -p1 --check inside the package directory, so method B
works on every one of them.
node apply.mjs --list # what is in here
node apply.mjs --roots # which DSH installations were found on this machine
node apply.mjs --check # per-file state: exact / applied / conflict / missing
node apply.mjs --apply --all # apply everything that fits
node apply.mjs --apply --only mcp-client,compaction-pruner
node apply.mjs --revert --all # put every .orig backup back
--check reports one of:
| state | meaning |
|---|---|
exact |
the file is the pristine version this library was built from — applying is safe |
applied |
the file already equals the patched version, nothing to do |
variant |
same version, different build (hash differs) but the hunks still fit — needs --allow-variant, or method D |
conflict |
the hunks do not fit. Nothing is written. Use method D to regenerate for your build |
missing |
that package is not part of the installation that was found |
--root, $DSH_APP_ROOT,
$DSH_INSTALL_ROOT, $DSH_HOME (including profiles/*), the running process's own DSH path,
a node resolution from the current directory, and a bounded scan of the usual install locations
for Windows / macOS / Linux — see lib/discover.mjs. --root means exactly that root, never
that root plus whatever else was found..orig is sacred. A backup is written once, next to the file, and never overwritten. If a
.orig already exists, it is reused.node --check runs after each write; on failure the backup is
restored immediately and the patch is reported as failed.$DSH_HOME is touched except, if you
explicitly point --root at a profile directory, that profile's own node_modules copy of a
package.Exit codes: 0 success, 1 a requested action failed or conflicted, 2 no installation found.
You can skip dsh-llm-writable-request — dsh-context-reclaim takes over that path from inside the
plugin, with the official patch reverted. --check says so explicitly:
= dsh-llm-writable-request already node_modules/@deepseek-ai/dsh-llm/lib/index.js
not needed: the dsh-context-reclaim plugin already handles this
The other nine are independent of the plugins: install neither, one, or both.
node verify.mjs
Offline, no DSH installation required. It checks that every diff parses and its hunk counts agree, that the declared marker really is added by its patch, that the apply/revert engine round-trips on synthetic samples, that a duplicated context is rejected instead of guessed, that the regex patch round-trips through any class prefix — and that no file in this repository contains a drive letter, a personal home directory or a private workspace name (that scan is part of the test suite, not a promise).
verify.mjs finishes with a read-only --check summary of whatever installation it finds.
apply.mjs the applier: --list --roots --check --apply --revert --show
verify.mjs offline self-test + personal-information scan
manifest.json every patch's metadata: hashes, sizes, markers, risk, why, applyWhen
lib/manifest.mjs manifest loading and schema checks
lib/discover.mjs finds DSH installations (fully adaptive, platform-aware)
lib/unified.mjs unified-diff parse / apply / revert engine
lib/backup.mjs .orig backup and restore
lib/hash.mjs sha256 helpers
patches/<id>/change.diff the patch itself (package-relative paths)
patches/<id>/change.json regex patches: pattern + explicit inverse
patches/<id>/NOTES.md what / when / verify, in English and Chinese
tools/make-patch.mjs regenerate a patch for a different build of the same version
docs/methods.md the five methods, step by step
PROMPT.md copy-paste block for your own agent
--check will tell you if your build differs
(variant / conflict) — that is information, not a failure. Method D exists for that case..orig of every file it touches, and --revert puts them back. Uninstalling or
updating DSH replaces the whole tree and therefore removes the patches.restartRequired in the manifest tells you whether the affected code runs in the main process
(restart DSH) or in the renderer (reload the window is enough).patches/<id>/change.diff before you apply it — that option is the whole point of shipping them as
data.MIT. Upstream packages remain the property of their authors; this repository only contains diffs against them.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。