feat(inject): 加 .hung-disabled 开关省 ~50% token

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 f184ae2。
This commit is contained in:
叫我小杨同学 committed 2026-10-09 20:50:57 +08:00
1 parent f184ae222d
commit d35d8152cb
1 file changed
+11 -1
+11 -1
View File
@@ -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() || "";
}