fix: 正式版追上后隐藏旧测试版,phase-1 不再清上下文

版本列表按正式版上限藏掉已追上的测试版;提交号对不上时按本机版本号标当前。phase-1 不再清空 contexts,也不改消息白名单。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-23 13:05:28 +08:00
1 parent 278eabbc07
commit 6a3f89da8d
5 files changed
+196 -34

No files matched your search

+23 -2
View File
@@ -620,7 +620,7 @@ function listLiangshenCustomBashFiles(dshHome) {
return out;
}
// phase-1 只留 persona + dsh-purge*,不全量放行以免官方身份段漏回去。
// phase-1 只留 persona + dsh-purge*。不改 contexts、不改消息白名单,梁神和官方插件照旧。
export function silenceLiangshenPhase1Strip(dshHome = findDshHome()) {
const marker = "[dsh-purge] phase-1 keep persona+inject sections";
const keepAllMarker = "[dsh-purge] phase-1 keep full system-prompt sections";
@@ -689,11 +689,32 @@ export function silenceLiangshenPhase1Strip(dshHome = findDshHome()) {
" // " + marker + "\n",
);
const contextMarker = "[dsh-purge] phase-1 keep runtime context";
const keptContexts = " // " + contextMarker + "\n";
if (next.includes(keptContexts)) {
next = next.replace(keptContexts, " contexts: [],\n");
}
const allowNew =
"function isAllowedMessage(message, allowedSources) {\n" +
" const kind = message.source?.kind\n" +
" // " + contextMarker + "\n" +
' if (message?.source?.plugin === "@deepseek-ai/dsh-system-prompt") return true\n' +
" return kind !== undefined && allowedSources.has(kind)\n" +
"}";
const allowOld =
"function isAllowedMessage(message, allowedSources) {\n" +
" const kind = message.source?.kind\n" +
" return kind !== undefined && allowedSources.has(kind)\n" +
"}";
if (next.includes(allowNew)) next = next.replace(allowNew, allowOld);
const already =
next.includes(marker) &&
!next.includes(keepAllMarker) &&
next.includes('startsWith("dsh-purge")') &&
!next.includes(unfiltered);
!next.includes(unfiltered) &&
!next.includes(contextMarker) &&
!next.includes('plugin === "@deepseek-ai/dsh-system-prompt"');
if (already && next === text.replace(/\r\n/g, "\n")) {
hit = "already";
continue;