From 661eebac15280e99668129cc44266512a66ad34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Fri, 9 Oct 2026 20:50:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(inject):=20=E5=8A=A0=20.hung-disabled=20?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=9C=81=20~50%=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/index.js installHungPromptGlobal:DSH_HOME/.hung-disabled 存在 → __dshPurgeHungPrompt() 返空串,每步 model.step 不再追加 prompt-inject.md 全文(省 ~9000 token/步)。system 层由 patch #67/#68/#74 保证不被 rewind/compaction 洗掉,够兜底。 关闭开关恢复全量 inject:删 .hung-disabled + 重启 DSH。 代码回滚:git reset --hard 0661755。 --- lib/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 819acaa..77c3b31 100644 --- a/lib/index.js +++ b/lib/index.js @@ -200,7 +200,17 @@ function refreshHungOperator(dshHome = core.findDshHome()) { function installHungPromptGlobal() { const fn = () => { try { - return refreshHungOperator(core.findDshHome()).text || ""; + const home = core.findDshHome(); + // [dsh-purge-fix 2026-10-09 方案A] 开关文件 DSH_HOME/.hung-disabled 存在时, + // hung 返空串 → 每步 model.step 不再追加 prompt-inject.md 全文 (省 ~9000 token/步)。 + // system 层由 patch #67/#68/#74 保证不被 rewind/compaction 洗掉,够兜底。 + // 想关掉开关恢复全量 inject: 删掉 .hung-disabled 文件 + 重启 DSH。 + if (home) { + try { + if (fs.existsSync(`${home}/.hung-disabled`)) return ""; + } catch { /* 开关文件判断失败 → 走原逻辑,不改行为 */ } + } + return refreshHungOperator(home).text || ""; } catch { return core.hungOperatorPrompt() || ""; }