Compare commits

..
1 Commits
Author SHA1 Message Date
叫我小杨同学 925f7d3f0f fix: 发布 1.1.40,适配 DSH 0.2.0 并应用后自动重启
Anthropic OAuth 去掉 Claude Code 首段;移除 0.2 无效的 patch 41;应用成功后自动重启宿主。
2026-09-30 01:07:24 +08:00
7 changed files with 97 additions and 67 deletions

No files matched your search

+7 -7
View File
@@ -4,7 +4,7 @@
<h1 align="center">⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)</h1>
<p align="center"><strong>Version 1.1.39</strong></p>
<p align="center"><strong>Version 1.1.40</strong></p>
<p align="center">
<em>Local official DeepSeek Harness cybersecurity red-team plugin. Clean host policy, and ship a built-in drill console. Swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
@@ -15,7 +15,7 @@
<a href="https://github.com/YuJunZhiXue/dsh-purge/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
<a href="https://awesome-dsh-plugin.com"><img src="https://awesome-dsh-plugin.com/badge.svg" alt="awesome · DSH plugin"></a>
<a href="https://deepseek.stream/plugins/dsh-purge"><img src="https://img.shields.io/badge/Hub-dsh--purge-1a73e8" alt="DeepSeek Harness Hub"></a>
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.7--rc.2-blue" alt="DSH"></a>
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.2.0--rc.2-blue" alt="DSH"></a>
<br>
<img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=fff" alt="Node.js">
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000" alt="JavaScript">
@@ -25,9 +25,9 @@
<a href="README.md">English</a> | <a href="README.zh-CN.md">中文</a>
</p>
> **After Apply, you must click Restart or the inject does not take effect.** Apply only writes the prompt and patches to disk. This process is still the old one. When the host has restarted, start a new chat — that is when the inject enters the session. Apply alone looks like nothing was injected.
> **Apply writes the prompt and patches, then restarts the host automatically.** After the host comes back, start a new chat — that is when the inject enters the session. If Apply fails (for example patches did not all apply), it does not restart.
> Current target is **dsh 0.1.7-rc.2**. The previous target, **0.1.7-rc.1** (including `0.1.7-rc.1.20260924.1`), still matches (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). Patterns from older host builds that no longer exist are not applied. On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**.
> Current target is **dsh 0.2.0-rc.2**; **0.1.7-rc.2** / **0.1.7-rc.1** still match (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). Patterns from older host builds that no longer exist are not applied. On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install, click **Apply** once (a successful Apply restarts for you).
>
> Hub page is for reading only: [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge). Do not install via `deepseek.stream/api/plugins/download?...`.
@@ -190,7 +190,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop"
### Official desktop EXE
If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community DSH Desktop does **not** handle that protocol — use the previous section. Current patches target **0.1.7-rc.2**. The **0.1.7-rc.1** anchors are still there.
If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community DSH Desktop does **not** handle that protocol — use the previous section. Current patches target **0.2.0-rc.2**. The **0.1.7-rc.2** / **0.1.7-rc.1** anchors are still there.
```sh
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
@@ -260,7 +260,7 @@ export function installDshPurgeToDesktop() {
Then fully quit the official client, including the tray, and open it again.
On the official desktop, click **Apply**, then restart.
On the official desktop, click **Apply** (a successful Apply restarts automatically).
### How to tell it installed
@@ -677,7 +677,7 @@ dsh-purge --edit
purge_status purge_apply purge_revert
```
Patched packages load only after a restart. Apply does not restart by itself. Under the patch title is the stable release: you can see versions and switch. A rollback is pinned; click **Update** to return to the latest. The beta channel is gone.
After a successful Apply, the host restarts so patched packages load; you can also click **Restart** manually. Under the patch title is the stable release: you can see versions and switch. A rollback is pinned; click **Update** to return to the latest. The beta channel is gone.
The composer **Undo** button drops the last turn and puts the last user sentence back in the input. On the main agent you can rewind once or the whole last round (including subagents). After rewind, send only what is in the box now. `/rewind` does the same. The host cannot truncate a session in place, so rewind opens another session for the shortened transcript and removes the old one from the sidebar. Repeating undo does not leave a stack of branches in the list.
+8 -8
View File
@@ -4,7 +4,7 @@
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
<p align="center"><strong>Version 1.1.39</strong></p>
<p align="center"><strong>Version 1.1.40</strong></p>
<p align="center">
<em>本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
@@ -15,7 +15,7 @@
<a href="https://github.com/YuJunZhiXue/dsh-purge/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
<a href="https://awesome-dsh-plugin.com"><img src="https://awesome-dsh-plugin.com/badge.svg" alt="awesome · DSH plugin"></a>
<a href="https://deepseek.stream/plugins/dsh-purge"><img src="https://img.shields.io/badge/Hub-dsh--purge-1a73e8" alt="DeepSeek Harness Hub"></a>
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.7--rc.2-blue" alt="DSH"></a>
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.2.0--rc.2-blue" alt="DSH"></a>
<br>
<img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=fff" alt="Node.js">
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000" alt="JavaScript">
@@ -25,9 +25,9 @@
<a href="README.md">English</a> | <a href="README.zh-CN.md">中文</a>
</p>
> **点「应用」之后,必须再点「重启」,注入才会生效。** 「应用」只把提示词和补丁写进文件,当前这个进程还是旧的。重启完成、宿主重新打开后,新开一轮对话,注入才进当前会话。只点应用、不重启,看起来就像没注入。
> **点「应用」会写入提示词和补丁,并自动重启宿主。** 重启完成后新开一轮对话,注入才进当前会话。若应用失败(例如补丁未全部打上),不会自动重启。
> 当前对准 **dsh 0.1.7-rc.2**。上一档 **0.1.7-rc.1**(含 `0.1.7-rc.1.20260924.1`)仍认(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。旧宿主里已经不存在的条文不再打。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完必须 **应用 + 重启**。
> 当前对准 **dsh 0.2.0-rc.2**;**0.1.7-rc.2** / **0.1.7-rc.1** 仍可用(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。旧宿主里已经不存在的条文不再打。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完要点一次 **应用**(成功后会自动重启)。
>
> 插件市场只看介绍:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)。不要用 `deepseek.stream/api/plugins/download?...` 安装。
@@ -190,7 +190,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop"
### 官方桌面 EXE
已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区 DSH Desktop **不认** 这个协议,请回到上一节。当前补丁对准 **0.1.7-rc.2**,**0.1.7-rc.1** 的旧锚点还留着。
已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区 DSH Desktop **不认** 这个协议,请回到上一节。当前补丁对准 **0.2.0-rc.2**,**0.1.7-rc.2** / **0.1.7-rc.1** 的旧锚点还留着。
```sh
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
@@ -260,7 +260,7 @@ export function installDshPurgeToDesktop() {
然后完全退出官方客户端(含托盘),再打开,点会话标题旁的 **dsh-purge**,在「清洗」里点「应用」。
**官方桌面点「应用」,然后重启即可。**
**官方桌面点「应用」即可(成功后会自动重启)。**
### 怎样算装上了
@@ -680,7 +680,7 @@ dsh-purge --edit
purge_status purge_apply purge_revert
```
设置页「应用」完成后需要重启才会加载已改的包文件。点「重启」才会重启,不会自动重启。补丁标题下是正式版:可以看版本和切换。回退后会固定在该版本,要回到最新再点「更新」。测试版通道已去掉。
设置页「应用」成功后会自动重启,以加载已改的包文件;也可手动点「重启」。补丁标题下是正式版:可以看版本和切换。回退后会固定在该版本,要回到最新再点「更新」。测试版通道已去掉。
输入框旁的「回退」会丢掉最近一轮对话,并把上一句填回输入框;聊天里 `/rewind` 同样可用。宿主不能在原会话里截断,所以回退会另开一条承载截断后的内容,并把原来那条从侧边栏移出。多退几次不会在列表里堆出一串分支。
@@ -756,7 +756,7 @@ flowchart LR
4. 嵌套 `@deepseek-ai/dsh/node_modules/@deepseek-ai`
5. 系统默认 `~/.dsh`
**桌面端:** 只改当前正在运行的桌面安装。官方客户端点「应用」,然后重启即可。社区端点「应用」,然后重启即可。
**桌面端:** 只改当前正在运行的桌面安装。官方客户端点「应用」即可(成功后会自动重启)。社区端点「应用」,然后重启即可。
找不到目标时提示设置 `DSH_BASE`,不改文件。
+7 -7
View File
@@ -1293,12 +1293,6 @@ body[data-ds-dark-theme] .dshp-dock-body .dshp-switch button.is-on{background:#3
setNotice({ kind: "error", text: tr("err.action", { action: label, error: d.error || "" }) });
return;
}
if (action === "apply" && (d.unpacked_asar || d.needs_full_quit)) {
setAskOfficialRestart(true);
setNotice({ kind: "ok", text: tr("restart.official.body") });
loadAll();
return;
}
if (action === "apply") {
if (typeof d.defaultContent === "string") setDefaultOverride(d.defaultContent);
if (typeof d.override_content === "string") {
@@ -1335,9 +1329,15 @@ body[data-ds-dark-theme] .dshp-dock-body .dshp-switch button.is-on{background:#3
loadAll();
return;
}
if (action === "apply" && (d.restart_after_apply || d.restarting || d.unpacked_asar || d.needs_full_quit)) {
setNotice({ kind: "ok", text: tr("update.restarting") });
loadAll();
const surf = hostSurfaceOf(state) || clientGuessSurface() || "web";
restartDsh(setNotice, setPatchBusy, tr, surf);
return;
}
setNotice({ kind: "ok", text: tr("ok.done") });
loadAll();
if (action === "apply") setAskRestart(true);
})
.catch((e) => {
if (ticket !== actionTicket.current) return;
+55 -43
View File
@@ -2889,49 +2889,6 @@ const NEW_TOOL_PATCHES = [
forbid: ["dsh-purge:committed"],
markers: ["dshPurgeInject"],
},
{
// 自定义 OpenAI 兼容接口不认 developer;推理模型默认会把 system 收成这个角色,直接 400。
id: 41, name: "DEVELOPER_ROLE_TO_SYSTEM", layer: "0.1.5 兼容", layer_en: "0.1.5",
desc: "developer 角色改回 system,兼容接口不再 400 / remap developer role to system",
file: ["pi-ai-completions", "pi-ai-responses-shared"],
optional: true,
skipIfMarked: true,
replacements: [
{
pattern:
" const useDeveloperRole = model.reasoning && compat.supportsDeveloperRole;\n" +
" const role = useDeveloperRole ? \"developer\" : \"system\";",
replace:
" const useDeveloperRole = false; // [dsh-purge] compatible APIs reject developer\n" +
" const role = useDeveloperRole ? \"developer\" : \"system\";",
},
{
pattern:
" lastRole = msg.role;\n" +
" }\n" +
" return params;\n" +
"}\n" +
"function convertTools(",
replace:
" lastRole = msg.role;\n" +
" }\n" +
" for (const message of params) {\n" +
" if (message && message.role === \"developer\") message.role = \"system\";\n" +
" } // [dsh-purge] compatible APIs reject developer\n" +
" return params;\n" +
"}\n" +
"function convertTools(",
},
{
pattern:
" const role = model.reasoning && compat?.supportsDeveloperRole !== false ? \"developer\" : \"system\";",
replace:
" const role = \"system\"; // [dsh-purge] compatible APIs reject developer",
},
],
markersAny: true,
markers: ["[dsh-purge] compatible APIs reject developer"],
},
{
id: 42, name: "SETTINGS_LEGACY_API", layer: "代码", layer_en: "Code",
desc: "设置服务补回 register/get,旧插件可继续用 / legacy settings API",
@@ -3223,6 +3180,60 @@ const NEW_TOOL_PATCHES = [
],
markers: ["function dshPurgeWshLiteral"],
},
{
id: 47,
name: "ANTHROPIC_OAUTH_NO_CLAUDE_IDENTITY",
layer: "0.2.0 兼容",
layer_en: "0.2.0",
desc: "Anthropic OAuth 不再强插 Claude Code 首段系统提示 / drop Claude Code OAuth system prefix",
file: ["pi-ai-anthropic-messages"],
optional: true,
skipIfMarked: true,
replacements: [
{
pattern:
" // For OAuth tokens, we MUST include Claude Code identity\n" +
" if (isOAuthToken) {\n" +
" params.system = [\n" +
" {\n" +
" type: \"text\",\n" +
" text: \"You are Claude Code, Anthropic's official CLI for Claude.\",\n" +
" ...(cacheControl ? { cache_control: cacheControl } : {}),\n" +
" },\n" +
" ];\n" +
" if (initialSystemText) {\n" +
" params.system.push({\n" +
" type: \"text\",\n" +
" text: sanitizeSurrogates(initialSystemText),\n" +
" ...(cacheControl ? { cache_control: cacheControl } : {}),\n" +
" });\n" +
" }\n" +
" }\n" +
" else if (initialSystemText) {\n" +
" // Add cache control to system prompt for non-OAuth tokens\n" +
" params.system = [\n" +
" {\n" +
" type: \"text\",\n" +
" text: sanitizeSurrogates(initialSystemText),\n" +
" ...(cacheControl ? { cache_control: cacheControl } : {}),\n" +
" },\n" +
" ];\n" +
" }",
replace:
" // [dsh-purge] OAuth no longer prepends Claude Code identity\n" +
" if (initialSystemText) {\n" +
" params.system = [\n" +
" {\n" +
" type: \"text\",\n" +
" text: sanitizeSurrogates(initialSystemText),\n" +
" ...(cacheControl ? { cache_control: cacheControl } : {}),\n" +
" },\n" +
" ];\n" +
" }",
},
],
markers: ["[dsh-purge] OAuth no longer prepends Claude Code identity"],
},
];
export const ALL_PATCHES = [...PATCHES, ...CODE_PATCHES, ...ENGINE_PATCHES, ...NEW_TOOL_PATCHES];
@@ -3598,6 +3609,7 @@ export function targetFiles(aiBase, dshHome = findDshHome()) {
]),
"pi-ai-completions": allExisting(listPiAiApiFiles(dshHome, aiBase, "openai-completions.js")),
"pi-ai-responses-shared": allExisting(listPiAiApiFiles(dshHome, aiBase, "openai-responses-shared.js")),
"pi-ai-anthropic-messages": allExisting(listPiAiApiFiles(dshHome, aiBase, "anthropic-messages.js")),
};
return filterTargetFiles(files);
}
+3 -1
View File
@@ -1248,10 +1248,12 @@ function installWebServer(ctx, cfg) {
const leaveTray = renamed || pendingQuit;
if (complete) reapply.markPatchesApplied();
if (leaveTray) bootFullQuit = true;
const shouldRestart = complete;
sendJson(response, 200, {
ok: true,
complete,
restarting: false,
restarting: shouldRestart,
restart_after_apply: shouldRestart,
unpacked_asar: leaveTray,
needs_full_quit: leaveTray,
applied: summary.applied,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dsh-purge",
"version": "1.1.39",
"version": "1.1.40",
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
"type": "module",
"main": "lib/index.js",
+16
View File
@@ -1,3 +1,19 @@
# 1.1.40
## 中文
- 版本升级到 1.1.40。
- 适配 **DSH 0.2.0-rc.2**:Anthropic OAuth 不再在系统提示最前面强插「You are Claude Code…」,自定义 `prompt-inject` 不会被压到后面。
- 去掉在 0.2 里已不存在的 **patch 41**(developer 角色改写),避免无效补丁占位。
- 设置页点 **应用** 成功后 **自动重启** 宿主,不必再打开插件点第二次重启。
## English
- Version 1.1.40.
- For **DSH 0.2.0-rc.2**, Anthropic OAuth no longer prepends “You are Claude Code…” ahead of your system prompt, so custom `prompt-inject` is not pushed behind a Claude identity block.
- Removed **patch 41** (developer-role remap) because those needles are gone in 0.2.
- After **Apply** in settings, the host **restarts automatically**; you no longer need to open the plugin again to confirm restart.
# 1.1.39
## 中文