mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 08:50:22 +08:00
fix: 发布 1.1.59,应用后不再误报没写进宿主
重启校验同时认两条安装路径。原文里已经没有官方身份句和丢掉注入的写法时,不再因为旧标记对不上就取消重启。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c032942e5f
commit
7ad39ad832
7 files changed
+75
-42
No files matched your search
+4
-15
@@ -25,6 +25,7 @@ import {
|
||||
restoreExtractedDir,
|
||||
} from "./extract-asar.js";
|
||||
import { adapterFor, detectSurface } from "./surface.js";
|
||||
import { hostPromptKeepsInject } from "./host-clean.js";
|
||||
import { openSlot } from "./table-read.js";
|
||||
|
||||
// 无归档时用 node:fs;app.asar 还在时改写真实的 resources/app,避免新建文件 ENOENT。
|
||||
@@ -1874,13 +1875,7 @@ export function scheduleSealedDesktopRestart(handoff) {
|
||||
return { renamed: false, pending: true, ...pending };
|
||||
}
|
||||
|
||||
/** waterfall 那句中间多了 waterfall,不包含旧句,两句都要认。 */
|
||||
export function hostPromptKeepsInject(text) {
|
||||
const body = String(text || "");
|
||||
if (!body.includes("[dsh-purge] identity stripped")) return false;
|
||||
return body.includes("[dsh-purge] complete prompt keeps waterfall inject")
|
||||
|| body.includes("[dsh-purge] complete prompt keeps inject");
|
||||
}
|
||||
export { hostPromptKeepsInject };
|
||||
|
||||
export function hostCleanMarkersPresent(aiBase) {
|
||||
if (!aiBase) return false;
|
||||
@@ -3308,14 +3303,8 @@ const NEW_TOOL_PATCHES = [
|
||||
file: ["system-prompt", "system-prompt-nested"],
|
||||
replacements: [
|
||||
{
|
||||
pattern:
|
||||
"\t\tconst transformed = await this.ctx.waterfall(scopeTarget(this, scope), \"system-prompt/assemble\", assembly, context, () => Promise.resolve(assembly));\n" +
|
||||
"\t\tif (completeSection === void 0 && !runtimeContextSuppressed) return transformed;\n" +
|
||||
"\t\treturn {\n" +
|
||||
"\t\t\t...transformed,\n" +
|
||||
"\t\t\tsections: completeSection === void 0 ? transformed.sections : [completeSection],\n" +
|
||||
"\t\t\tcontexts: runtimeContextSuppressed ? [] : transformed.contexts\n" +
|
||||
"\t\t};",
|
||||
// 缩进不固定。0.2 有的构建用 tab,有的用空格;只认 tab 时匹配为 0,重启校验会说没写进宿主。
|
||||
pattern: /[ \t]*const transformed = await this\.ctx\.waterfall\(scopeTarget\(this, scope\), "system-prompt\/assemble", assembly, context, \(\) => Promise\.resolve\(assembly\)\);\n[ \t]*if \(completeSection === void 0 && !runtimeContextSuppressed\) return transformed;\n[ \t]*return \{\n[ \t]*\.\.\.transformed,\n[ \t]*sections: completeSection === void 0 \? transformed\.sections : \[completeSection\],\n[ \t]*contexts: runtimeContextSuppressed \? \[\] : transformed\.contexts\n[ \t]*\};/,
|
||||
replace: COMPLETE_PROMPT_WATERFALL_INJECT,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user