fix: 1.1.48 剔除桌面改读 profiles/web 的本机逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-02 17:31:49 +08:00
1 parent eb09b2e62d
commit ed4e83744d
4 files changed
-159

No files matched your search

-43
View File
@@ -1744,12 +1744,6 @@ export async function openSealedDesktopHost(options = {}) {
restoreUnusableExtract(appDir, prev);
throw new Error(`已解开 ${handoff.asar},但 ${appDir} 下没有 @deepseek-ai`);
}
try {
desktop.useWebProfileInOfficialShell(appDir);
desktop.ensureDesktopRemoteUiOff(findDshHome());
} catch {
/* 壳入口或缺 Web profile 时下次 Apply 再对齐 */
}
resetPathMemo();
return { aiBase, swapAsar: true, exe: handoff.exe, asar: handoff.asar, extracted, prev, appDir, archive: extracted ? archive : null };
}
@@ -1869,10 +1863,6 @@ export function desktopAsarStillSealed(input = {}) {
return Boolean(handoff?.asar && asarArchiveIsFile(handoff.asar));
}
export function alignOfficialShellProfile(input = {}) {
return desktop.alignOfficialDesktopProfile(input);
}
export function officialHostMustStayUp() {
return process.env.ELECTRON_RUN_AS_NODE === "1" && desktop.isOfficialHarnessExecutable(process.execPath);
}
@@ -3342,39 +3332,6 @@ const NEW_TOOL_PATCHES = [
],
markers: ["function dshPurgeHandoffDesktopUpdate", "dshPurgeHandoffDesktopUpdate(this)"],
},
{
id: 70,
name: "OFFICIAL_DESKTOP_USE_WEB_PROFILE",
layer: "代码",
layer_en: "Code",
desc: "官方桌面有 Web profile 时改读 profiles/web,渠道和插件与 Web 端一致",
file: "desktop-shell",
surfaces: ["desktop"],
optional: true,
skipIfMarked: true,
replacements: [
{
pattern:
"function resolveDesktopPaths(dshHome = resolveDshHome()) {\n" +
"\treturn {\n" +
'\t\tprofile: join(dshHome, "profiles", "desktop"),\n' +
'\t\tlock: join(dshHome, "profiles", "desktop", "lock")\n' +
"\t};\n" +
"}",
replace:
"function resolveDesktopPaths(dshHome = resolveDshHome()) {\n" +
'\tconst webProfile = join(dshHome, "profiles", "web");\n' +
'\tconst desktopProfile = join(dshHome, "profiles", "desktop");\n' +
'\tconst profile = existsSync(join(webProfile, "package.json")) ? webProfile : desktopProfile;\n' +
"\treturn {\n" +
"\t\tprofile,\n" +
'\t\tlock: join(profile, "lock")\n' +
"\t};\n" +
"}",
},
],
markers: ['const webProfile = join(dshHome, "profiles", "web")'],
},
{
id: 46, name: "OFFICIAL_DESKTOP_UPDATE_ASCII", layer: "代码", layer_en: "Code",
desc: "已接管的官方桌面更新改为 ASCII 脚本,中文 Windows 不再吞掉换行",
-82
View File
@@ -1026,88 +1026,6 @@ function officialExeFromProcess() {
return fs.existsSync(beside) ? beside : "";
}
const WEB_PROFILE_RESOLVER =
"function resolveDesktopPaths(dshHome = resolveDshHome()) {\n" +
'\tconst webProfile = join(dshHome, "profiles", "web");\n' +
'\tconst desktopProfile = join(dshHome, "profiles", "desktop");\n' +
'\tconst profile = existsSync(join(webProfile, "package.json")) ? webProfile : desktopProfile;\n' +
"\treturn {\n" +
"\t\tprofile,\n" +
'\t\tlock: join(profile, "lock")\n' +
"\t};\n" +
"}";
const WEB_PROFILE_RESOLVER_RE =
/function resolveDesktopPaths\(dshHome = resolveDshHome\(\)\) \{\s*return \{\s*profile: join\(dshHome, "profiles", "desktop"\),\s*lock: join\(dshHome, "profiles", "desktop", "lock"\)\s*\};\s*\}/;
function officialShellMainCandidates(appDir) {
if (!appDir) return [];
return [path.join(appDir, "lib", "main.js"), path.join(appDir, "main.js")];
}
/** 官方壳默认只开 profiles/desktop。同一 DSH_HOME 下已有 Web profile 时改读那一份,渠道和插件才能跟过来。 */
export function useWebProfileInOfficialShell(appDir) {
const mains = officialShellMainCandidates(appDir).filter((fp) => isFile(fp));
if (!mains.length) return { changed: false, missing: true };
let changed = false;
let already = false;
let missing = false;
for (const mainJs of mains) {
const text = fs.readFileSync(mainJs, "utf8");
if (text.includes('const webProfile = join(dshHome, "profiles", "web")')) {
already = true;
continue;
}
if (!WEB_PROFILE_RESOLVER_RE.test(text)) {
missing = true;
continue;
}
fs.writeFileSync(mainJs, text.replace(WEB_PROFILE_RESOLVER_RE, WEB_PROFILE_RESOLVER), "utf8");
changed = true;
}
return { changed, already: already && !changed, missing: missing && !changed && !already };
}
/** Electron 桌面读 Web profile 时关掉远程配对页,避免一启动卡在 pairing。 */
export function ensureDesktopRemoteUiOff(dshHome) {
const home = dshHome || process.env.DSH_HOME || "";
if (!home) return { changed: false };
const patchFile = path.join(home, "profiles", "web", "cordis.patch.yml");
if (!isFile(patchFile)) return { changed: false, missing: true };
const text = fs.readFileSync(patchFile, "utf8");
if (/^\s*-\s*id:\s*web-ui-remote-web-ui\b/m.test(text)) {
if (/-\s*id:\s*web-ui-remote-web-ui[\s\S]*?disabled:\s*true/.test(text)) {
return { changed: false, already: true };
}
}
const block =
"\n# [dsh-purge] official desktop shares this profile; keep remote pairing off in the exe window\n" +
"- id: web-ui-remote-web-ui\n" +
" disabled: true\n";
if (text.includes("web-ui-remote-web-ui")) return { changed: false, already: true };
fs.writeFileSync(patchFile, text.replace(/\s*$/, "\n") + block, "utf8");
return { changed: true };
}
export function alignOfficialDesktopProfile(input = {}) {
const exe =
input.exe ||
officialExeFromProcess() ||
findDesktopAppExecutable() ||
"";
if (!exe || !isOfficialHarnessExecutable(exe)) return { changed: false };
const appDir = input.appDir || appDirForExecutable(exe);
const shell = useWebProfileInOfficialShell(appDir);
const remote = ensureDesktopRemoteUiOff(input.dshHome || process.env.DSH_HOME || "");
return {
changed: Boolean(shell.changed || remote.changed),
shell,
remote,
appDir,
exe,
};
}
function dshHomeForRelaunch() {
const current = String(process.env.DSH_HOME || "").replace(/[\\/]+$/, "");
if (!current) return "";
-32
View File
@@ -375,22 +375,6 @@ function shimNeedsPatch(state) {
async function settleInstalledPatches(config, ctx) {
try { core.rememberUnpackedArchive(); } catch { /* 没有官方安装目录时不必记归档 */ }
try {
const shell = core.alignOfficialShellProfile({ dshHome: process.env.DSH_HOME || "" });
if (shell.changed) {
bootFullQuit = true;
log(config, "official desktop now follows the web profile");
try {
hostctl.scheduleRestart(null, ctx);
} catch (e) {
log(config, "restart after web profile switch failed:", String(e && e.message ? e.message : e));
return "restart-failed";
}
return "full-quit";
}
} catch (e) {
log(config, "align web profile skipped:", String(e && e.message ? e.message : e));
}
if (officialUpdate.upgradeMarkerExists(process.execPath)) {
const upgraded = await reapply.reapplyInstalled({ scheduleSwap: false, upgrade: true });
if (!upgraded.ok) {
@@ -523,11 +507,6 @@ async function handlePurgeCommand(rawInput, config) {
if (blocked) return { kind: "error", text: blocked.error };
await core.backupAll(state.ai_base);
const report = await core.applyPatches(state.ai_base);
const shell = core.alignOfficialShellProfile({
dshHome: state.dsh_home || process.env.DSH_HOME || "",
exe: handoff?.exe,
appDir: handoff?.appDir,
});
const shimResult = await core.patchAllShims();
const flash = core.silenceCmdFlash(state.ai_base);
const lines = report.map((r) => {
@@ -539,14 +518,6 @@ async function handlePurgeCommand(rawInput, config) {
lines.push(` · ${dir} → ${typeof st === "object" ? JSON.stringify(st) : st}`);
}
lines.push(` cmd-flash=${flash.entry} phase-1=${flash.phase1} ok=${flash.ok}`);
if (shell.changed || shell.shell?.already || shell.shell?.changed) {
lines.push(
"",
shell.changed
? "官方桌面已改为读取 profiles/web(与 Web 端同一套渠道/插件配置)。"
: "官方桌面已对齐 profiles/web。",
);
}
if (scrubbed.length) {
lines.push("", "Desktop in-bin .bak scrub:");
for (const row of scrubbed) lines.push(` ✓ ${row.dir} → ${row.cleaned.join(", ")}`);
@@ -558,9 +529,6 @@ async function handlePurgeCommand(rawInput, config) {
if (swapped?.renamed || swapped?.pending) {
lines.push("", "补丁已写入。请在设置页点「重启」,客户端会自己重新打开。");
}
} else if (shell.changed) {
lines.push("", "已切换到 profiles/web。请在设置页点「重启」,客户端会自己重新打开。");
try { hostctl.scheduleRestart(null, null); } catch { /* 设置页再点重启即可 */ }
}
return { kind: "success", text: lines.join("\n") };
}
-2
View File
@@ -3,7 +3,6 @@
## 中文
- 版本升级到 1.1.48。
- 官方桌面有 Web profile 时改读 profiles/web,渠道/插件与 Web 端对齐(仍是 exe,不是 3080)。
- 修复红队指挥「只派活」约束被组装时误删,导致不派 subagent;预设在 Agent Teams 下强制重开 classic subagent。
- 增加按任务选用 skill/MCP 的协议(先读目录,再按任务调用;子代理与红队同样);不改官方注册与工具面。
- 子代理 maxDepth 适配 0.2 无 default 的 schema,补回默认 10。
@@ -11,7 +10,6 @@
## English
- Version 1.1.48.
- Official desktop prefers profiles/web when present so channels/plugins match Web (still the exe, not port 3080).
- Fix redteam lead dispatch-only SOP being stripped during assemble; re-enable classic subagent under Agent Teams in the redteam preset.
- Add task-matched skill/MCP selection protocol (read catalog, then call what the task needs; same for subagents and redteam). Does not change official registration.
- Raise subagent maxDepth default to 10 on 0.2 schemas that dropped .default().