Compare commits

...
1 Commits
Author SHA1 Message Date
叫我小杨同学andCursor e139407af8 fix: 发布 1.1.54,官方桌面启动不再 INACTIVE_EFFECT(#58–#61)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-03 14:19:25 +08:00
7 changed files with 197 additions and 24 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.53</strong></p>
<p align="center"><strong>Version 1.1.54</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>
@@ -118,7 +118,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.53**. 1.1.45 is skipped; it has bugs.
The plugin version is **1.1.54**. 1.1.45 is skipped; it has bugs.
---
@@ -220,13 +220,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
<p align="center">
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 Open Hub page</strong></a>
&nbsp;·&nbsp;
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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"><strong>🚀 Install in desktop client</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.54&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"><strong>🚀 Install in desktop client</strong></a>
</p>
🔗 **Raw protocol URL:**
```
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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.54&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
```
<details>
@@ -242,7 +242,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
version: '1.1.53',
version: '1.1.54',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
@@ -261,7 +261,7 @@ export function installDshPurgeToDesktop() {
**HTML link:**
```html
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.54&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">
🚀 Install in desktop client
</a>
```
@@ -272,7 +272,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | Plugin id |
| name | `dsh-purge` | Display name |
| version | `1.1.53` | Semver |
| version | `1.1.54` | 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 |
+7 -7
View File
@@ -4,7 +4,7 @@
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
<p align="center"><strong>Version 1.1.53</strong></p>
<p align="center"><strong>Version 1.1.54</strong></p>
<p align="center">
<em>本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
@@ -118,7 +118,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
| 官方 Harness 0.1.x | 不支持 |
| 其它未列出版本 | 对不上的补丁会显示待应用或跳过,不要指望能用 |
插件版本是 **1.1.53**。1.1.45 有问题,略过。
插件版本是 **1.1.54**。1.1.45 有问题,略过。
---
@@ -220,13 +220,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
<p align="center">
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 打开插件市场页</strong></a>
&nbsp;·&nbsp;
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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"><strong>🚀 唤起客户端一键安装</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.54&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"><strong>🚀 唤起客户端一键安装</strong></a>
</p>
🔗 **原生协议链接:**
```
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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.54&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
```
<details>
@@ -242,7 +242,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
version: '1.1.53',
version: '1.1.54',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
@@ -261,7 +261,7 @@ export function installDshPurgeToDesktop() {
**HTML 静态链接方式:**
```html
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.53&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">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.54&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">
🚀 唤起客户端一键安装
</a>
```
@@ -272,7 +272,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | 插件唯一标识符 |
| name | `dsh-purge` | 插件展示名称 |
| version | `1.1.53` | 语义化版本号 |
| version | `1.1.54` | 语义化版本号 |
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
+73 -9
View File
@@ -19,6 +19,13 @@ import * as continueRetry from "./continue-retry.js";
import * as uninstaller from "./uninstall.js";
import { installRegionGate, readAllowText, writeAllowText } from "./net-scope.js";
import * as refusalRecover from "./refusal-recover.js";
import {
isInactiveContextError,
settleDelayMs,
settleMayReapply,
settleMayRestart,
watchContextLife,
} from "./settle-policy.js";
export const name = "dsh-purge";
@@ -391,7 +398,14 @@ function shimNeedsPatch(state) {
);
}
async function settleInstalledPatches(config, ctx) {
function currentSettleScope() {
let sealed = false;
try { sealed = core.desktopAsarStillSealed(); } catch { /* 非桌面或还没定位安装目录 */ }
return { surface: hostctl.currentSurface(), sealed };
}
async function settleInstalledPatches(config, ctx, life) {
if (life && !life.alive) return "skip:inactive";
try { core.rememberUnpackedArchive(); } catch { /* 没有官方安装目录时不必记归档 */ }
try {
reapply.ensureInstalledRevSeed();
@@ -404,17 +418,24 @@ async function settleInstalledPatches(config, ctx) {
log(config, "heal applied stamp failed:", String(e && e.message ? e.message : e));
}
const scope = currentSettleScope();
if (!reapply.patchesMatchInstall()) {
if (!settleMayReapply(scope)) {
log(config, "sealed desktop: skip startup reapply (wait for Apply)");
return "skip:sealed-wait-apply";
}
if (officialUpdate.upgradeMarkerExists(process.execPath)) {
const upgraded = await reapply.reapplyInstalled({ scheduleSwap: false, upgrade: true });
if (life && !life.alive) return "skip:inactive";
if (!upgraded.ok) {
log(config, "official upgrade reapply failed:", upgraded.error || "");
return "reapply-failed";
}
officialUpdate.clearUpgradeMarker(process.execPath);
officialUpdate.clearStaleExtractedApps(process.execPath);
if (reapply.shouldSkipSettleRestart()) {
log(config, "official upgrade reapplied; skip settle restart (cooldown)");
if (!settleMayRestart(currentSettleScope()) || reapply.shouldSkipSettleRestart()) {
if (upgraded.needsFullQuit) bootFullQuit = true;
log(config, "official upgrade reapplied; skip settle restart");
return "reapplied-no-restart";
}
reapply.markSettleRestart();
@@ -428,7 +449,9 @@ async function settleInstalledPatches(config, ctx) {
return "restarting";
}
const result = await reapply.reapplyInstalled();
// 启动自愈只写盘,不 swap asar / 不杀进程,避免官方 Host Fiber._reload 撞 INACTIVE_EFFECT。
const result = await reapply.reapplyInstalled({ scheduleSwap: false });
if (life && !life.alive) return "skip:inactive";
if (!result.ok) {
log(config, "reapply failed:", result.error || "");
return "reapply-failed";
@@ -440,6 +463,10 @@ async function settleInstalledPatches(config, ctx) {
log(config, "reapply wrote patches; official host needs a full quit");
return "full-quit";
}
if (!settleMayRestart(currentSettleScope())) {
log(config, "reapply wrote patches; desktop settle does not restart");
return "reapplied-no-restart";
}
if (reapply.shouldSkipSettleRestart()) {
log(config, "reapply wrote patches; skip settle restart (cooldown)");
return "reapplied-no-restart";
@@ -467,7 +494,7 @@ async function settleInstalledPatches(config, ctx) {
.then((r) => {
log(config, "auto-update:", JSON.stringify(r));
if (r && r.needsFullQuit) bootFullQuit = true;
if (r && r.restartAfter) {
if (r && r.restartAfter && settleMayRestart(currentSettleScope())) {
try { hostctl.scheduleRestart(null, ctx, { openBrowser: false }); } catch (e) {
console.warn("[dsh-purge] auto-update restart failed:", e);
}
@@ -867,6 +894,11 @@ async function handleSkillsCommand(rawInput) {
export function apply(ctx, config) {
const cfg = { ...DEFAULTS, ...(config || {}) };
if (!cfg.enabled) return;
const life = watchContextLife(ctx);
if (!life.alive) {
console.warn("[dsh-purge] skip apply: inactive context");
return;
}
log(cfg, "plugin enabled");
try {
@@ -883,14 +915,34 @@ export function apply(ctx, config) {
console.warn("[dsh-purge] desktop runtime scrub error:", String(e));
}
setImmediate(() => {
settleInstalledPatches(cfg, ctx)
const settleTimer = setTimeout(() => {
if (!life.alive) {
log(cfg, "settle skipped: inactive context");
return;
}
settleInstalledPatches(cfg, ctx, life)
.then((r) => log(cfg, "settle:", r))
.catch((e) => console.warn("[dsh-purge] settle error:", String(e)));
.catch((e) => {
if (isInactiveContextError(e)) {
log(cfg, "settle skipped: inactive context");
return;
}
console.warn("[dsh-purge] settle error:", String(e));
});
rules.ensureInitialState(core.findDshHome())
.then((r) => log(cfg, "rules init:", JSON.stringify(r)))
.catch((e) => console.warn("[dsh-purge] rules init error:", String(e)));
});
}, settleDelayMs(hostctl.currentSurface()));
try {
ctx.effect(() => () => clearTimeout(settleTimer));
} catch (e) {
if (isInactiveContextError(e)) {
clearTimeout(settleTimer);
console.warn("[dsh-purge] skip apply: inactive context");
return;
}
throw e;
}
try {
core.seedOverrideSync(core.findDshHome());
@@ -901,6 +953,18 @@ export function apply(ctx, config) {
core.installOverride(core.findDshHome(), false).catch((e) => {
console.warn("[dsh-purge] install override error:", String(e));
});
try {
applyHostHooks(ctx, cfg);
} catch (e) {
if (isInactiveContextError(e)) {
console.warn("[dsh-purge] skip apply: inactive context");
return;
}
throw e;
}
}
function applyHostHooks(ctx, cfg) {
installIdentityOverride(ctx, cfg);
installRegionGate(ctx);
try {
+43
View File
@@ -0,0 +1,43 @@
/** 官方桌面启动时 Fiber._reload 还在挂 desktop-office,settle 不得解包/杀进程。 */
export const DESKTOP_SETTLE_DELAY_MS = 4000;
export function isInactiveContextError(error) {
if (!error) return false;
if (error.code === "INACTIVE_EFFECT") return true;
return /inactive context/i.test(String(error.message || error));
}
export function watchContextLife(ctx) {
const life = { alive: true };
if (!ctx || typeof ctx.effect !== "function") return life;
try {
ctx.effect(() => () => {
life.alive = false;
});
} catch (error) {
if (isInactiveContextError(error)) {
life.alive = false;
return life;
}
throw error;
}
return life;
}
export function settleDelayMs(surface) {
return surface === "desktop" ? DESKTOP_SETTLE_DELAY_MS : 0;
}
/** 桌面启动自愈不得 requestRestart / taskkill,否则 Cordis 会 INACTIVE_EFFECT。 */
export function settleMayRestart({ surface, sealed = false } = {}) {
if (surface === "desktop") return false;
if (sealed) return false;
return true;
}
/** 密封 asar 上就地 extract/swap 会和官方 Host 的 Fiber._reload 抢锁。 */
export function settleMayReapply({ surface, sealed = false } = {}) {
if (surface === "desktop" && sealed) return false;
return true;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dsh-purge",
"version": "1.1.53",
"version": "1.1.54",
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
"type": "module",
"main": "lib/index.js",
+16
View File
@@ -1,3 +1,19 @@
# 1.1.54
## 中文
- 版本升级到 1.1.54。
- 官方桌面密封 asar 启动不再中途解包/杀进程:避开 Host Fiber._reload 的 INACTIVE_EFFECT / DesktopHostFatalError;补丁留给设置页「应用」。
- 桌面 settle 延后并在 context 停用时退出;启动自愈只写盘、不 scheduleRestart(#59 / #60 / #61)。
- 市场 tar 安装与空 sha / 缺 installed-rev 的无限重启修复仍在(#58–#61,1.1.53)。
## English
- Version 1.1.54.
- Official desktop no longer unpacks or kills the host mid-boot on a sealed asar; that raced Fiber._reload and threw INACTIVE_EFFECT / DesktopHostFatalError. Patches wait for Settings Apply.
- Desktop settle is delayed and aborts on an inactive context; startup self-heal writes files only and does not scheduleRestart (#59 / #60 / #61).
- Marketplace tarball install and empty-sha / missing installed-rev restart loops remain fixed (#58–#61, 1.1.53).
# 1.1.53
## 中文
+50
View File
@@ -0,0 +1,50 @@
import assert from "node:assert/strict";
import {
DESKTOP_SETTLE_DELAY_MS,
isInactiveContextError,
settleDelayMs,
settleMayReapply,
settleMayRestart,
watchContextLife,
} from "../lib/settle-policy.js";
assert.equal(settleMayRestart({ surface: "desktop", sealed: false }), false);
assert.equal(settleMayRestart({ surface: "desktop", sealed: true }), false);
assert.equal(settleMayRestart({ surface: "web", sealed: true }), false);
assert.equal(settleMayRestart({ surface: "web", sealed: false }), true);
assert.equal(settleMayReapply({ surface: "desktop", sealed: true }), false);
assert.equal(settleMayReapply({ surface: "desktop", sealed: false }), true);
assert.equal(settleMayReapply({ surface: "web", sealed: false }), true);
assert.equal(settleDelayMs("desktop"), DESKTOP_SETTLE_DELAY_MS);
assert.equal(settleDelayMs("web"), 0);
assert.ok(DESKTOP_SETTLE_DELAY_MS >= 3000);
assert.equal(isInactiveContextError({ code: "INACTIVE_EFFECT" }), true);
assert.equal(isInactiveContextError(new Error("cannot create effect on inactive context")), true);
assert.equal(isInactiveContextError(new Error("ENOENT")), false);
const missing = watchContextLife(null);
assert.equal(missing.alive, true);
let disposed = null;
const active = watchContextLife({
effect(factory) {
disposed = factory();
},
});
assert.equal(active.alive, true);
disposed();
assert.equal(active.alive, false);
const inactive = watchContextLife({
effect() {
const err = new Error("cannot create effect on inactive context");
err.code = "INACTIVE_EFFECT";
throw err;
},
});
assert.equal(inactive.alive, false);
console.log("ok: settle policy / inactive-context guards");