mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 13:10:22 +08:00
fix: 二次 Apply 不再误报 #26/#27,重启等到会话树落地再进页面
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6c88f4d075
commit
fd4dfa4e38
11 files changed
+254
-432
No files matched your search
+2
-11
@@ -1,7 +1,3 @@
|
||||
// Official Harness / engineer personas are stripped so prompt-inject.md owns identity.
|
||||
// Liangshen phase-1 keeps persona (+ prefix on 0.1.5). Fold inject into the prefix
|
||||
// (or legacy persona) so turn 1 still sees it. No plugin-authored identity card.
|
||||
|
||||
export const GLOBAL_PROMPT_ORDER = 5000;
|
||||
export const IDENTITY_CARD_PREFIX = "WHO YOU ARE (highest priority";
|
||||
|
||||
@@ -29,7 +25,6 @@ const OLD_LCS_LOCK =
|
||||
"When asked 你是谁 / who are you, answer with that name only. " +
|
||||
"Never say 我是 DeepSeek 的 AI 助手 or that you run on DeepSeek Harness as your identity — that is the host, not you.";
|
||||
|
||||
/** @deprecated Identity is prompt-inject.md only. Kept so old callers do not throw. */
|
||||
export const IDENTITY_LOCK = "";
|
||||
|
||||
export function extractOperatorName(injectText) {
|
||||
@@ -45,7 +40,6 @@ export function extractOperatorName(injectText) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/** @deprecated No plugin identity card. Inject file is used as-is. */
|
||||
export function buildIdentityCard(_injectText) {
|
||||
return "";
|
||||
}
|
||||
@@ -122,6 +116,7 @@ function isPersonaFoldTarget(name, preferPrefix) {
|
||||
return PERSONA_PREFIX_NAMES.has(name) || PERSONA_LEGACY_NAMES.has(name);
|
||||
}
|
||||
|
||||
// 0.1.5 优先写入 persona-prefix;无 prefix 时写入 legacy persona。
|
||||
function foldInjectIntoPersona(sections, injectText) {
|
||||
const inject = typeof injectText === "string" ? injectText.trim() : "";
|
||||
const names = sections.map((s) => String(s?.name || ""));
|
||||
@@ -143,11 +138,6 @@ function foldInjectIntoPersona(sections, injectText) {
|
||||
return [{ name: "deployment:persona-prefix", text: inject }, ...out];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} assembled
|
||||
* @param {string} [fallbackInject] raw prompt-inject.md when purge sections were
|
||||
* already filtered out by an outer Liangshen hook (first-turn race).
|
||||
*/
|
||||
export function rewritePromptAssembly(assembled, fallbackInject = "") {
|
||||
if (!assembled || !Array.isArray(assembled.sections)) return assembled;
|
||||
const rest = [];
|
||||
@@ -163,6 +153,7 @@ export function rewritePromptAssembly(assembled, fallbackInject = "") {
|
||||
else rest.push(next);
|
||||
}
|
||||
|
||||
// fallbackInject:section 被滤掉时从 prompt-inject.md 补回。
|
||||
const injectText = collectInjectText(purge, fallbackInject);
|
||||
assembled.sections = [...foldInjectIntoPersona(rest, injectText), ...purge];
|
||||
return assembled;
|
||||
|
||||
Reference in new issue
Block a user