diff --git a/README.md b/README.md
index 7af4e97..e4e7479 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)
-Version 1.1.58
+Version 1.1.59
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 ⭐
@@ -126,7 +126,7 @@ This release supports **DeepSeek Harness 0.2** only (official desktop **0.2.0-rc
| Official Harness 0.1.x | Not supported |
| Any other version | Unmatched patches stay pending or skipped; do not expect them to work |
-The plugin version is **1.1.58**. 1.1.45 is skipped; it has bugs.
+The plugin version is **1.1.59**. 1.1.45 is skipped; it has bugs.
---
@@ -190,13 +190,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
🌐 Open Hub page
·
- 🚀 Install in desktop client
+ 🚀 Install in desktop client
🔗 **Raw protocol URL:**
```
-dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.58&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
+dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.59&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
```
@@ -212,7 +212,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
- version: '1.1.58',
+ version: '1.1.59',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
@@ -231,7 +231,7 @@ export function installDshPurgeToDesktop() {
**HTML link:**
```html
-
+
🚀 Install in desktop client
```
@@ -242,7 +242,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | Plugin id |
| name | `dsh-purge` | Display name |
-| version | `1.1.58` | Semver |
+| version | `1.1.59` | Semver |
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive |
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 8d54746..c51d474 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -4,7 +4,7 @@
⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)
-Version 1.1.58
+Version 1.1.59
本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐
@@ -126,7 +126,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
| 官方 Harness 0.1.x | 不支持 |
| 其它未列出版本 | 对不上的补丁会显示待应用或跳过,不要指望能用 |
-插件版本是 **1.1.58**。1.1.45 有问题,略过。
+插件版本是 **1.1.59**。1.1.45 有问题,略过。
---
@@ -190,13 +190,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
🌐 打开插件市场页
·
- 🚀 唤起客户端一键安装
+ 🚀 唤起客户端一键安装
🔗 **原生协议链接:**
```
-dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.58&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
+dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.59&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
```
@@ -212,7 +212,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
- version: '1.1.58',
+ version: '1.1.59',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
@@ -231,7 +231,7 @@ export function installDshPurgeToDesktop() {
**HTML 静态链接方式:**
```html
-
+
🚀 唤起客户端一键安装
```
@@ -242,7 +242,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | 插件唯一标识符 |
| name | `dsh-purge` | 插件展示名称 |
-| version | `1.1.58` | 语义化版本号 |
+| version | `1.1.59` | 语义化版本号 |
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
diff --git a/lib/core.js b/lib/core.js
index 17f5320..152a597 100644
--- a/lib/core.js
+++ b/lib/core.js
@@ -25,6 +25,7 @@ import {
restoreExtractedDir,
} from "./extract-asar.js";
import { adapterFor, detectSurface } from "./surface.js";
+import { hostPromptKeepsInject } from "./host-clean.js";
import { openSlot } from "./table-read.js";
// 无归档时用 node:fs;app.asar 还在时改写真实的 resources/app,避免新建文件 ENOENT。
@@ -1874,13 +1875,7 @@ export function scheduleSealedDesktopRestart(handoff) {
return { renamed: false, pending: true, ...pending };
}
-/** waterfall 那句中间多了 waterfall,不包含旧句,两句都要认。 */
-export function hostPromptKeepsInject(text) {
- const body = String(text || "");
- if (!body.includes("[dsh-purge] identity stripped")) return false;
- return body.includes("[dsh-purge] complete prompt keeps waterfall inject")
- || body.includes("[dsh-purge] complete prompt keeps inject");
-}
+export { hostPromptKeepsInject };
export function hostCleanMarkersPresent(aiBase) {
if (!aiBase) return false;
@@ -3308,14 +3303,8 @@ const NEW_TOOL_PATCHES = [
file: ["system-prompt", "system-prompt-nested"],
replacements: [
{
- pattern:
- "\t\tconst transformed = await this.ctx.waterfall(scopeTarget(this, scope), \"system-prompt/assemble\", assembly, context, () => Promise.resolve(assembly));\n" +
- "\t\tif (completeSection === void 0 && !runtimeContextSuppressed) return transformed;\n" +
- "\t\treturn {\n" +
- "\t\t\t...transformed,\n" +
- "\t\t\tsections: completeSection === void 0 ? transformed.sections : [completeSection],\n" +
- "\t\t\tcontexts: runtimeContextSuppressed ? [] : transformed.contexts\n" +
- "\t\t};",
+ // 缩进不固定。0.2 有的构建用 tab,有的用空格;只认 tab 时匹配为 0,重启校验会说没写进宿主。
+ pattern: /[ \t]*const transformed = await this\.ctx\.waterfall\(scopeTarget\(this, scope\), "system-prompt\/assemble", assembly, context, \(\) => Promise\.resolve\(assembly\)\);\n[ \t]*if \(completeSection === void 0 && !runtimeContextSuppressed\) return transformed;\n[ \t]*return \{\n[ \t]*\.\.\.transformed,\n[ \t]*sections: completeSection === void 0 \? transformed\.sections : \[completeSection\],\n[ \t]*contexts: runtimeContextSuppressed \? \[\] : transformed\.contexts\n[ \t]*\};/,
replace: COMPLETE_PROMPT_WATERFALL_INJECT,
},
{
diff --git a/lib/desktop.js b/lib/desktop.js
index 719ee7c..a0dc70e 100644
--- a/lib/desktop.js
+++ b/lib/desktop.js
@@ -4,6 +4,7 @@ import { execFileSync, spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import { isWshAscii, wshLiteral } from "./official-update.js";
import { asarArchiveIsFile, hostFs } from "./extract-asar.js";
+import { hostPromptKeepsInject } from "./host-clean.js";
// 无归档时用 node:fs。app.asar 还在时不能把映射出来的 resources/app 当成已经解开。
const fs = hostFs;
@@ -1147,8 +1148,13 @@ function officialRestartScript(exe, asar, dshHome) {
"function pids() { var out = []; var root = String(installRoot() || '').replace(/\\//g, '\\\\').toLowerCase(); var e = new Enumerator(wmi.ExecQuery(\"SELECT ProcessId, ExecutablePath FROM Win32_Process WHERE Name = 'DeepSeek Harness.exe'\")); for (; !e.atEnd(); e.moveNext()) { var p = e.item(); var ep = String(p.ExecutablePath || '').replace(/\\//g, '\\\\').toLowerCase(); if (samePath(p.ExecutablePath, exe) || (root && ep.indexOf(root) === 0)) out.push(p.ProcessId); } return out; }",
"log('begin');",
"var promptFile = asar.replace(/app\\.asar$/i, 'app') + '\\\\dsh\\\\node_modules\\\\@deepseek-ai\\\\dsh-system-prompt\\\\lib\\\\index.js';",
+ "var altFile = asar.replace(/app\\.asar$/i, 'app') + '\\\\node_modules\\\\@deepseek-ai\\\\dsh-system-prompt\\\\lib\\\\index.js';",
+ "function readBody(file) { if (!fso.FileExists(file)) return ''; var tf = fso.OpenTextFile(file, 1); var body = tf.ReadAll(); tf.Close(); return body; }",
+ "function hostClean(body) { if (!body) return null; var ident = body.indexOf('[dsh-purge] identity stripped') >= 0; var kept = body.indexOf('[dsh-purge] complete prompt keeps waterfall inject') >= 0 || body.indexOf('[dsh-purge] complete prompt keeps inject') >= 0; if (ident && kept) return true; if (body.indexOf('system-prompt/assemble') < 0) return false; var identityLeft = body.indexOf('You are an AI agent powered by DeepSeek Harness.') >= 0; var drops = body.indexOf('transformed.sections : [completeSection]') >= 0; return !identityLeft && !drops; }",
"var clean = false;",
- "if (fso.FileExists(promptFile)) { var tf = fso.OpenTextFile(promptFile, 1); var body = tf.ReadAll(); tf.Close(); var ident = body.indexOf('[dsh-purge] identity stripped') >= 0; var kept = body.indexOf('[dsh-purge] complete prompt keeps waterfall inject') >= 0 || body.indexOf('[dsh-purge] complete prompt keeps inject') >= 0; clean = ident && kept; }",
+ "var primary = hostClean(readBody(promptFile));",
+ "var alt = hostClean(readBody(altFile));",
+ "clean = (primary == true || alt == true) && primary != false && alt != false;",
"if (!clean) log('clean markers missing; not starting');",
"if (clean) {",
"log('clean markers ok');",
@@ -1184,18 +1190,27 @@ function officialRestartScript(exe, asar, dshHome) {
].join("\r\n");
}
-function unpackedHostIsClean(exe) {
+function systemPromptFiles(exe) {
const appDir = appDirForExecutable(exe);
- if (!appDir) return false;
- const fp = path.join(appDir, "dsh", "node_modules", "@deepseek-ai", "dsh-system-prompt", "lib", "index.js");
- try {
- const text = fs.readFileSync(fp, "utf8");
- const kept = text.includes("[dsh-purge] complete prompt keeps waterfall inject")
- || text.includes("[dsh-purge] complete prompt keeps inject");
- return text.includes("[dsh-purge] identity stripped") && kept;
- } catch {
- return false;
- }
+ if (!appDir) return [];
+ return [
+ path.join(appDir, "dsh", "node_modules", "@deepseek-ai", "dsh-system-prompt", "lib", "index.js"),
+ path.join(appDir, "node_modules", "@deepseek-ai", "dsh-system-prompt", "lib", "index.js"),
+ ].filter((fp) => {
+ try { return fs.existsSync(fp); } catch { return false; }
+ });
+}
+
+function unpackedHostIsClean(exe) {
+ const files = systemPromptFiles(exe);
+ if (files.length === 0) return false;
+ return files.every((fp) => {
+ try {
+ return hostPromptKeepsInject(fs.readFileSync(fp, "utf8"));
+ } catch {
+ return false;
+ }
+ });
}
/** 点「重启」后结束当前官方客户端,挪开被占用的 app.asar,再自己打开。 */
diff --git a/lib/host-clean.js b/lib/host-clean.js
new file mode 100644
index 0000000..7c70801
--- /dev/null
+++ b/lib/host-clean.js
@@ -0,0 +1,13 @@
+/** 重启前看系统提示词文件:标记写上了,或者当前原文里已经没有那两处旧拦截。 */
+export function hostPromptKeepsInject(text) {
+ const body = String(text || "");
+ const identityMarked = body.includes("[dsh-purge] identity stripped");
+ const injectMarked = body.includes("[dsh-purge] complete prompt keeps waterfall inject")
+ || body.includes("[dsh-purge] complete prompt keeps inject");
+ if (identityMarked && injectMarked) return true;
+ // 空文件或不是这份模块,不能当成已经洗过。
+ if (!body.includes("system-prompt/assemble")) return false;
+ const identityLeft = body.includes("You are an AI agent powered by DeepSeek Harness.");
+ const dropsInject = body.includes("transformed.sections : [completeSection]");
+ return !identityLeft && !dropsInject;
+}
diff --git a/package.json b/package.json
index 6aeadee..9a2990c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "dsh-purge",
- "version": "1.1.58",
+ "version": "1.1.59",
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
"type": "module",
"main": "lib/index.js",
diff --git a/release-notes.md b/release-notes.md
index 6fdf32b..3dc13fe 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -1,3 +1,19 @@
+# 1.1.59
+
+## 中文
+
+- 版本升级到 1.1.59。
+- 点应用后不再因为宿主路径或旧标记对不上,就报「清洗没有写进当前宿主」(#65)。
+- `resources\app\node_modules` 和 `resources\app\dsh\node_modules` 都认。原文里已经没有官方身份句、也没有丢掉注入的写法时,不再要求那两条标记。
+- complete 段补丁同时认 tab 和空格。
+
+## English
+
+- Version 1.1.59.
+- Apply no longer reports that the clean missed the current host just because the package path or the old markers do not match (#65).
+- Both `resources/app/node_modules` and `resources/app/dsh/node_modules` count. If the official identity sentence and the inject-dropping return are already gone, those two markers are not required.
+- The complete-prompt patch matches both tab and space indentation.
+
# 1.1.58
## 中文