release: 1.1.69

发送剥壳、应用即挂默认、红队只排不折;#86/#87;指挥端去掉单位名即授权。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-11 03:38:56 +08:00
1 parent eb9af6b8fa
commit beae190918
9 files changed
+423 -86

No files matched your search

+25 -14
View File
@@ -16,6 +16,7 @@ import {
isRedteamSession,
installAssembleGuard,
modePromptText,
peelChatmlEnvelope,
rewritePromptAssembly,
} from "./identity.js";
import { capabilityProtocolText, CAPABILITY_SECTION } from "./capability-protocol.js";
@@ -207,22 +208,23 @@ function installHungPromptGlobal() {
// 3) readPromptInjectFileSync — 直读磁盘 prompt-inject.md,绕过 sync/resolve
// 4) defaultOverrideText — 加密槽解包,除非插件安装残缺否则非空
const fn = () => {
const norm = (s) => peelChatmlEnvelope(String(s || "").replace(/\r\n/g, "\n").trim());
let home = "";
try { home = core.findDshHome(); } catch { home = ""; }
try {
const text = refreshHungOperator(home).text;
const text = norm(refreshHungOperator(home).text);
if (text) { purgeLog("host.hungFn", { tier: "refresh", bytes: text.length }); return text; }
} catch (e) { purgeLog("host.hungFn", { tier: "refresh", err: String(e?.message || e) }); }
try {
const hung = core.hungOperatorPrompt();
const hung = norm(core.hungOperatorPrompt());
if (hung) { purgeLog("host.hungFn", { tier: "hung", bytes: hung.length }); return hung; }
} catch (e) { purgeLog("host.hungFn", { tier: "hung", err: String(e?.message || e) }); }
try {
const disk = core.readPromptInjectFileSync(home);
const disk = norm(core.readPromptInjectFileSync(home));
if (disk) { purgeLog("host.hungFn", { tier: "disk", bytes: disk.length }); return disk; }
} catch (e) { purgeLog("host.hungFn", { tier: "disk", err: String(e?.message || e) }); }
try {
const sealed = core.defaultOverrideText();
const sealed = norm(core.defaultOverrideText());
if (sealed) { purgeLog("host.hungFn", { tier: "sealed", bytes: sealed.length }); return sealed; }
} catch (e) { purgeLog("host.hungFn", { tier: "sealed", err: String(e?.message || e) }); }
purgeLog("host.hungFn", { tier: "empty", bytes: 0 });
@@ -534,6 +536,7 @@ function rewriteLiveAssembly(config, assembled, context, decision = { mode: "ful
policy,
dropWorkspaceBaseline,
injectHead: Array.isArray(rewritten?.sections) && rewritten.sections[0]?.name === "dsh-purge",
chatml: Array.isArray(rewritten?.sections) && /<project_instructions>|<\|im_start\|>/i.test(String(rewritten.sections[0]?.text || "")),
afterCloser: closerFollow,
cwd,
});
@@ -781,6 +784,10 @@ function installIdentityOverride(ctx, config = {}) {
trackDisposer(installAssembleGuard(prompt, rewriteFn), prompt);
} catch { /* 这一层代理包不上时,下面再包插件自己的 */ }
}
try {
const iso = (loopCtx && loopCtx.ctx) || loopCtx;
if (iso && iso !== ctx) registerPromptSections(iso, config);
} catch { /* 隔离层还没有 systemPrompt */ }
wrapAssemble("prepareAssemble");
return prompt || null;
};
@@ -800,7 +807,12 @@ function installIdentityOverride(ctx, config = {}) {
// (dispose 后重 mount / 热重载),listener 叠加会让 inject 跑 N 遍,也让 wrap 挂 N 层。
if (!ctx.__dshPurgeSessionHook) {
ctx.__dshPurgeSessionHook = true;
try { ctx.on("session/created", () => wrapAssemble("sessionCreated")); } catch { /* ignore */ }
try {
ctx.on("session/created", () => {
try { refreshHungOperator(core.findDshHome()); } catch { /* 主目录还没有提示词 */ }
wrapAssemble("sessionCreated");
});
} catch { /* ignore */ }
}
if (!ctx.__dshPurgePresetHook) {
ctx.__dshPurgePresetHook = true;
@@ -837,13 +849,8 @@ function installIdentityOverride(ctx, config = {}) {
// ctx.on("system-prompt/assemble", ...),cordis event listener 永远不装 → 新对话首轮
// 完全依赖 400ms setInterval wrapAssemble 的 guard,时间窗没赶上就 inject 真空。
delete ctx.__dshPurgeAssembleHook;
if (globalThis.__dshPurgePrepareAssemble === prepareAssemble) {
delete globalThis.__dshPurgePrepareAssemble;
}
// identity 校验再删,免得热重载抢到新实例又被旧 cleanup 挖掉。
if (globalThis.__dshPurgeHungPrompt === hungFn) {
delete globalThis.__dshPurgeHungPrompt;
}
// 新对话 / 热重载会先 dispose 再 apply。这里若删全局 hung,
// 空窗里立刻发送 hang 读到空串,必须等下一次 apply 才恢复。
});
} catch { /* 无 effect 时靠 unref + 下次 apply 自覆盖 */ }
}
@@ -1118,6 +1125,8 @@ async function handlePurgeCommand(rawInput, config, ctx = null) {
promptReady: promptReady && hostWritten,
});
if (shouldRestart) reapply.markSettleRestart();
try { core.seedPromptInjectAtBoot(state.dsh_home); } catch { /* 主目录尚未就绪 */ }
try { refreshHungOperator(state.dsh_home); } catch { /* ignore */ }
const planned = scheduleApplyRestart(shouldRestart, ctx);
if (planned && planned.clean === false) {
lines.push("", "清洗没有写进当前宿主,已取消重启。");
@@ -2004,8 +2013,10 @@ function installWebServer(ctx, cfg) {
});
return;
}
if (typeof incoming === "string" && core.normalizeOverride(incoming)) {
await core.saveOverrideContent(state.dsh_home, incoming);
try {
await core.commitOverrideOnApply(state.dsh_home, incoming);
} catch (e) {
console.warn("[dsh-purge] apply override:", String(e && e.message ? e.message : e));
}
const httpMulti = await core.applyPatchesAllHosts(core.ALL_PATCHES, {
preserveClientBundles: false,