release: 1.1.84,尾部锚点与子代理审批接管,红队模式中文化,#194/#188

- 接线 lib/anchor.js:锚点物理追加到 system prompt sections 末尾,
  identity.js 支持 anchorText(对象/字符串两种入参),已有同名段先滤再追加;
  锚点改为跟随操作者语言,删除写死的英文开头句(红队回答变英文的根因)
- 接线 lib/subagent-control.js:子会话 approval/policy=never 改回 ask,
  并在 approval/request 瀑布放行;anchorMode/subagentControl 提供回滚开关
- index.js:真实 anchorApplied / injectTail 判定、审批策略探针、iso 分支
  注册锚点、applyHostHooks 注册锚点与子代理接管并统一释放
- office 技能自愈:core/desktop 增加 healOfficeSkillsRuntimeOnDisk,桌面端触发
- 红队模式中文化:preset 文案、角色名、五阶段、25 项计分规则与 POC 分类、
  技能修复说明、环境适配提示、面板报错、成果报告与复现报告
- #194:hung-operator 改按内容变更缓存,加风暴/慢调用熔断;WeakMap 去重
  同次 assemble 的重复改写;新增 #91 记录宿主信号退出的持久化日志
- #188(rc.4 专属部分):新增 #89 沙箱策略去品牌、#90 skill-badge 中文描述,
  扩展 #32/#53 的 rc.3 变体与 marker,均 optional
- 新增锚点接线与红队文案测试,81/81 通过
This commit is contained in:
叫我小杨同学 committed 2026-10-31 01:51:15 +08:00
1 parent 97c5de75fa
commit 624976ed1d
19 files changed
+1521 -847

No files matched your search

+164 -3
View File
@@ -2434,12 +2434,23 @@ export function findOverrideFile(dshHome) {
}
let committedOverride = null;
// 提示词框提交/挂载的版本号:refreshHungOperator 用它把“内存里换了正文但 mtime 没变”
// 也算成缓存失效,不必每次全量重读磁盘 + 解密。
let committedOverrideRev = 0;
export function committedOverrideRevision() {
return committedOverrideRev;
}
/** 本次进程里提示词框刚提交的正文;与磁盘上用户自改正文合并使用。 */
export function rememberCommittedOverride(dshHome, text) {
const home = path.normalize(String(dshHome || ""));
if (!home) return;
committedOverride = { home, text: typeof text === "string" ? text : "" };
const next = typeof text === "string" ? text : "";
if (!committedOverride || committedOverride.home !== home || committedOverride.text !== next) {
committedOverrideRev += 1;
}
committedOverride = { home, text: next };
}
/** $DSH_HOME/prompt-inject.md 正文(应用/解包后由加密槽落下;注入与设置框以它为准)。 */
@@ -3518,7 +3529,8 @@ const NEW_TOOL_PATCHES = [
// Web GUI 文案里的产品名会进「你是谁」回答。
id: 32, name: "WEB_SURFACE_IDENTITY_NEUTRAL", layer: "提示词", layer_en: "Prompt",
desc: "Web 面:去掉 DeepSeek Harness 自称 / neutralize web GUI identity branding",
file: ["web-app-lib"],
// rc.3 把这两句搬到了 dsh-harness-dev-context,两个文件都要扫。
file: ["web-app-lib", "harness-dev-context"],
optional: true,
replacements: [
{
@@ -3533,12 +3545,30 @@ const NEW_TOOL_PATCHES = [
replace:
'description: "Canonical local URL of the web GUI serving this session." /* [dsh-purge] web surface identity neutralized */',
},
// ↓ 0.2.1-rc.3 的 dsh-harness-dev-context 布局
{
pattern:
"You are interacting with the user through the DeepSeek Harness Web GUI whose URL the runtime context names.",
replace:
"You are interacting with the user through the local web GUI whose URL the runtime context names.",
},
{
pattern: '"You are interacting with the user through the DeepSeek Harness Web GUI at "',
replace: '"You are interacting with the user through the local web GUI at "',
},
{
pattern: "Current DeepSeek Harness Web GUI URL: ",
replace: "Current local Web GUI URL: ",
},
],
// #53 会把前一句再收成 Local web GUI,不能再要求两句标记同时在。
markersAny: true,
markers: [
"[dsh-purge] web surface identity neutralized",
"through the local web GUI at ${webUrl}.",
'through the local web GUI whose URL the runtime context names.',
'"You are interacting with the user through the local web GUI at "',
"Current local Web GUI URL: ",
],
},
{
@@ -4544,7 +4574,9 @@ const NEW_TOOL_PATCHES = [
layer: "提示词",
layer_en: "Prompt",
desc: "网页端提示词去掉身份句和禁止另开服务器 / drop web identity and do-not-start",
file: ["web-app-lib"],
// rc.3 的 checkout 限制句("Use this checkout only to inspect or extend DSH itself")
// 与 "不要另开服务器" 一并落在这个新插件里。
file: ["web-app-lib", "harness-dev-context"],
optional: true,
replacements: [
{
@@ -4556,11 +4588,31 @@ const NEW_TOOL_PATCHES = [
"Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL.",
replace: "",
},
// ↓ 0.2.1-rc.3 的 dsh-harness-dev-context 布局:去掉 checkout 用途限制
{
pattern: "Use this checkout only to inspect or extend DSH itself.",
replace: "",
},
{
pattern: "The runtime context names the DeepSeek Harness implementation checkout.",
replace: "The runtime context names the local implementation checkout.",
},
{
pattern: '"The DeepSeek Harness implementation checkout is at "',
replace: '"The local implementation checkout is at "',
},
{
pattern: "Current DeepSeek Harness implementation checkout: ",
replace: "Current implementation checkout: ",
},
],
markersAny: true,
markers: [
"[dsh-purge] web surface identity neutralized",
"Local web GUI: ${webUrl}.",
"The runtime context names the local implementation checkout.",
'"The local implementation checkout is at "',
"Current implementation checkout: ",
],
},
{
@@ -4714,6 +4766,38 @@ const NEW_TOOL_PATCHES = [
],
markers: ["[dsh-purge] close no-fail v2"],
},
{
// #194:host 被信号杀时 #83 直接静默 resolve,UI 端永远不知道 host 已经没了,
// 窗口自然不出现。这里保持“不弹对话框”,但把退出事实写进持久化日志,
// 下次排查至少能看到 signal / code / stderr 尾巴。
id: 91,
name: "DESKTOP_HOST_SIGNAL_EXIT_LOG",
layer: "代码",
layer_en: "Code",
desc: "host 被信号杀时写持久化退出日志(仍不弹对话框) / persist a trace when the host dies by signal",
file: ["desktop-shell"],
surfaces: ["desktop"],
optional: true,
skipIfMarked: true,
replacements: [
{
pattern: "if (code === null || signal) { resolve(); return; }",
replace:
"if (code === null || signal) {\n" +
"\t\t\t\t\t/* [dsh-purge] host signal exit logged */\n" +
"\t\t\t\t\ttry {\n" +
"\t\t\t\t\t\tconst _req = typeof require === \"function\" ? require : null;\n" +
"\t\t\t\t\t\tconst _fs = typeof process.getBuiltinModule === \"function\" ? process.getBuiltinModule(\"node:fs\") : (_req ? _req(\"node:fs\") : null);\n" +
"\t\t\t\t\t\tconst _os = typeof process.getBuiltinModule === \"function\" ? process.getBuiltinModule(\"node:os\") : (_req ? _req(\"node:os\") : null);\n" +
"\t\t\t\t\t\tconst _log = _fs && _os ? _os.tmpdir() + \"/dsh-purge-desktop.log\" : \"\";\n" +
"\t\t\t\t\t\tif (_log) _fs.appendFileSync(_log, new Date().toISOString() + \" [desktop.hostExit] signal=\" + String(signal) + \" code=\" + String(code) + suffix + \"\\n\", \"utf8\");\n" +
"\t\t\t\t\t} catch {}\n" +
"\t\t\t\t\tresolve(); return;\n" +
"\t\t\t\t}",
},
],
markers: ["[dsh-purge] host signal exit logged"],
},
{
id: 67,
name: "AGENT_LOOP_MESSAGES_GUARD",
@@ -5837,6 +5921,45 @@ const NEW_TOOL_PATCHES = [
],
markers: ["[dsh-purge-88]"],
},
{
id: 89,
name: "SANDBOX_POLICY_BRAND_NEUTRAL",
layer: "提示词",
layer_en: "Prompt",
desc: "三条沙箱策略文案去掉 DSH 品牌词 / drop DSH branding from every file-policy line",
file: ["sandbox-policy"],
optional: true,
// 这里不能加 skipIfMarked:#61 的 read-only 分支早就带上了它自己的 marker,
// 一旦 skip 就把另外两个分支(workspace-write / danger-full-access)的品牌词一起吞掉。
replacements: [
{ pattern: "Current DSH file policy: ", replace: "Current file policy: " },
{ pattern: "enforced by the DSH file sandbox", replace: "enforced by the file sandbox" },
{ pattern: "The DSH file sandbox does not restrict", replace: "The file sandbox does not restrict" },
],
markers: ["Current file policy: "],
},
{
id: 90,
name: "SKILL_BADGE_DESCRIPTION_NEUTRAL",
layer: "提示词",
layer_en: "Prompt",
desc: "技能描述去掉官方徽章品牌 / neutralize skill-badge description branding",
file: ["skill-badge"],
optional: true,
replacements: [
{
pattern:
"Add the official “powered by dsh” badge to documents, pull requests, merge requests, and other content produced with DeepSeek Harness.",
replace: "Add a small attribution badge to documents, pull requests, merge requests, and other content.",
},
{
pattern:
"Also use when the user asks for a dsh badge, powered-by-dsh attribution, or a reusable dsh badge asset or snippet.",
replace: "Also use when the user asks for a badge, attribution line, or a reusable badge asset or snippet.",
},
],
markers: ["Add a small attribution badge to documents"],
},
];
export const ALL_PATCHES = [...PATCHES, ...CODE_PATCHES, ...ENGINE_PATCHES, ...NEW_TOOL_PATCHES];
@@ -6429,6 +6552,18 @@ export function targetFiles(aiBase, dshHome = findDshHome()) {
path.join(aiBase, "dsh", "node_modules", "@deepseek-ai", "dsh-web-app", "lib", "index.js"),
...(root ? [path.join(root, "packages", "bundle", "web-app", "lib", "index.js")] : []),
]),
// 0.2.1-rc.3 起,web 面身份句 / checkout 限制句整体搬到这个独立插件。
// 没有这个文件键,#32/#53 在 rc.3+ 上就是必然失配。
"harness-dev-context": firstExisting([
path.join(aiBase, "dsh-harness-dev-context", "lib", "index.js"),
path.join(aiBase, "dsh", "node_modules", "@deepseek-ai", "dsh-harness-dev-context", "lib", "index.js"),
...(root ? [path.join(root, "packages", "context", "harness-dev-context", "lib", "index.js")] : []),
]),
"skill-badge": firstExisting([
path.join(aiBase, "dsh-skill-badge", "lib", "index.js"),
path.join(aiBase, "dsh", "node_modules", "@deepseek-ai", "dsh-skill-badge", "lib", "index.js"),
...(root ? [path.join(root, "packages", "skills", "skill-badge", "lib", "index.js")] : []),
]),
"headless": firstExisting([
path.join(aiBase, "dsh-headless", "cordis.patch.yml"),
...(root ? [path.join(root, "packages", "bundle", "headless", "cordis.patch.yml")] : []),
@@ -8406,3 +8541,29 @@ export async function gatherState() {
hooks_deny_bypass: getHooksDenySettings().hooksDenyBypass,
};
}
/* ---------------------------------------------------------------- office-skills 自愈 */
/**
* 本机可能藏着 office 技能资产的位置:npm 安装树、桌面安装根、便携布局。
* 全部交给 desktop.healOfficeSkillsRuntimeOnDisk 做存在性判断。
*/
export function officeSkillAssetSources() {
const out = [];
let base = "";
try { base = findAiBase() || ""; } catch { base = ""; }
if (!base) return out;
out.push(path.join(base, "dsh-skill-office", "assets"));
out.push(path.join(base, "dsh", "node_modules", "@deepseek-ai", "dsh-skill-office", "assets"));
out.push(path.join(base, "..", "..", "dsh-skill-office", "assets"));
return out;
}
export function healOfficeSkillsRuntimeOnDisk(extraSources) {
try {
return desktop.healOfficeSkillsRuntimeOnDisk(
Array.isArray(extraSources) && extraSources.length > 0 ? extraSources : officeSkillAssetSources(),
);
} catch {
return { ok: false, reason: "heal-failed" };
}
}