From ed4e83744d821cfa63d0916691a396f18b2331c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Fri, 2 Oct 2026 17:31:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.1.48=20=E5=89=94=E9=99=A4=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2=E6=94=B9=E8=AF=BB=20profiles/web=20=E7=9A=84=E6=9C=AC?= =?UTF-8?q?=E6=9C=BA=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- lib/core.js | 43 ------------------------- lib/desktop.js | 82 ------------------------------------------------ lib/index.js | 32 ------------------- release-notes.md | 2 -- 4 files changed, 159 deletions(-) diff --git a/lib/core.js b/lib/core.js index 0b42b4b..0b5a0fe 100644 --- a/lib/core.js +++ b/lib/core.js @@ -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 不再吞掉换行", diff --git a/lib/desktop.js b/lib/desktop.js index 2e5e296..1a88f36 100644 --- a/lib/desktop.js +++ b/lib/desktop.js @@ -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 ""; diff --git a/lib/index.js b/lib/index.js index 2158819..3992246 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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") }; } diff --git a/release-notes.md b/release-notes.md index a6225b5..d69cee7 100644 --- a/release-notes.md +++ b/release-notes.md @@ -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().