fix: 面板不再盖住官方对话,重打补丁不再回写前端包

浮层收成右侧窄条,底边停在输入框上方;演练台嵌在面板里时不再给官方窗口加右侧内边距。重打补丁时若前端 client.js 内容没变就不写,避免页面按旧 rev 404。桌面启动自检不再杀掉自己,清洗标记同时认新旧两句。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-04 21:24:20 +08:00
1 parent 354f9a1960
commit 813fbe4d54
8 files changed
+458 -188

No files matched your search

+19 -4
View File
@@ -1045,7 +1045,9 @@ function dshHomeForRelaunch() {
return current;
}
export function scheduleRestart(request, ctx, _options = {}) {
export function scheduleRestart(request, ctx, options = {}) {
// 启动自检会带 openBrowser:false。桌面进程不再因此杀掉自己。
if (options.openBrowser === false) return { restarting: false, skipped: true };
const exe =
officialExeFromProcess() ||
findDesktopAppExecutable() ||
@@ -1094,7 +1096,7 @@ function officialRestartScript(exe, asar, dshHome) {
"log('begin');",
"var promptFile = asar.replace(/app\\.asar$/i, 'app') + '\\\\dsh\\\\node_modules\\\\@deepseek-ai\\\\dsh-system-prompt\\\\lib\\\\index.js';",
"var clean = false;",
"if (fso.FileExists(promptFile)) { var tf = fso.OpenTextFile(promptFile, 1); var body = tf.ReadAll(); tf.Close(); clean = body.indexOf('[dsh-purge] identity stripped') >= 0 && body.indexOf('[dsh-purge] complete prompt keeps inject') >= 0; }",
"if (fso.FileExists(promptFile)) { var tf = fso.OpenTextFile(promptFile, 1); var body = tf.ReadAll(); tf.Close(); var ident = body.indexOf('[dsh-purge] identity stripped') >= 0; var kept = body.indexOf('[dsh-purge] complete prompt keeps waterfall inject') >= 0 || body.indexOf('[dsh-purge] complete prompt keeps inject') >= 0; clean = ident && kept; }",
"if (!clean) log('clean markers missing; not starting');",
"if (clean) {",
"log('clean markers ok');",
@@ -1118,11 +1120,14 @@ function officialRestartScript(exe, asar, dshHome) {
"if (!renamed) { log('rename failed; not starting'); }",
"if (renamed) {",
"try { sh.Environment('PROCESS').Remove('ELECTRON_RUN_AS_NODE'); } catch (ignore) {}",
"try { sh.Environment('PROCESS').Remove('DSH_BASE'); } catch (ignoreBase) {}",
"if (home) { try { sh.Environment('PROCESS').Item('DSH_HOME') = home; } catch (ignore2) {} }",
"sh.Run('\"' + exe + '\"', 1, false);",
"log('started');",
"}",
"}",
"WScript.Sleep(180000);",
"try { if (fso.FileExists(" + jsString(path.join(os.tmpdir(), "dsh-purge-official-restarting")) + ")) fso.DeleteFile(" + jsString(path.join(os.tmpdir(), "dsh-purge-official-restarting")) + ", true); } catch (ignoreFlag) {}",
"",
].join("\r\n");
}
@@ -1133,8 +1138,9 @@ function unpackedHostIsClean(exe) {
const fp = path.join(appDir, "dsh", "node_modules", "@deepseek-ai", "dsh-system-prompt", "lib", "index.js");
try {
const text = fs.readFileSync(fp, "utf8");
return text.includes("[dsh-purge] identity stripped")
&& text.includes("[dsh-purge] complete prompt keeps inject");
const kept = text.includes("[dsh-purge] complete prompt keeps waterfall inject")
|| text.includes("[dsh-purge] complete prompt keeps inject");
return text.includes("[dsh-purge] identity stripped") && kept;
} catch {
return false;
}
@@ -1167,6 +1173,15 @@ export function restartOfficialHarness(options = {}) {
if (options.requireClean !== false && !unpackedHostIsClean(exe)) {
return { restarting: false, clean: false };
}
const inflight = path.join(os.tmpdir(), "dsh-purge-official-restarting");
try {
const age = Date.now() - fs.statSync(inflight).mtimeMs;
// 同一次换进程里不再开第二轮,避免杀掉刚拉起来的客户端。
if (age >= 0 && age < 180000) return { restarting: true, already: true };
} catch {
// 没有进行中的重启。
}
try { fs.writeFileSync(inflight, `${Date.now()}\n`, "utf8"); } catch { /* 标记写失败仍继续这一次 */ }
const asar = options.asar || appAsarPath(exe);
const asarPresent = Boolean(asar && asarArchiveIsFile(asar));
const swapLock = asar ? `${asar}.swap-lock` : "";