WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。
Revert "feat: reload the IDE workbench after manual session sync"
wanghcb49d89161cab
diff --git a/scripts/daemon.js b/scripts/daemon.jsindex 514d0d1..99ebf62 100644--- a/scripts/daemon.js+++ b/scripts/daemon.js@@ -435,11 +435,8 @@ const primaryAccountStore = createPrimaryAccountStore(DATA_DIR, (uid) => fs.exis// 1.2.10:合并会话、用量、启动器及 CodeBuddy IDE 注入重试与积分刷新修复。// 1.2.11:IDE workbench 共用完整面板后修正浮层确认探针(认 .wbs-root);// 原生账号菜单去重样式移入完整面板注入路径,修复"多个头像"回归。-// 1.2.12:手动同步(copy/migrate)当前账号后 Page.reload IDE workbench——-// 扩展宿主 indexCache(TTL 5min)不因外部写 index.json 失效,侧边栏-// 此前要等缓存过期或重启才显示同步的会话。-const DAEMON_VERSION = '1.2.12';-const DAEMON_BUILD_ID = 'release-1.2.12-20261001-ide-sync-reload';+const DAEMON_VERSION = '1.2.11';+const DAEMON_BUILD_ID = 'release-1.2.11-20261001-ide-panel-probe';const usageReporter = createUsageReporter({ profile: PROFILE.id, version: DAEMON_VERSION });configureAutomationRuntime({version: DAEMON_VERSION, profileId: PROFILE.id, platform: process.platform});const automationDiscovery = createAutomationDiscovery({@@ -2472,27 +2469,6 @@ async function ideSyncScan() {}}-// [CodeBuddy 会话同步] 手动同步(copy/migrate)后刷新 IDE workbench 窗口。-// 根因:genie 扩展宿主的会话列表 indexCache(LRU,TTL 5 分钟)不会因外部写入-// history index.json 而失效(无文件监听),v2 广播对新会话只做 rename/delete——-// applyUpsert 对缓存外会话直接跳过("upsert skip, not in this EH")。侧边栏因此-// 只能等缓存过期或重启。手动同步是显式用户动作,直接 Page.reload(与账号切换-// 同级别)。自动复制(切号触发)不刷新:账号切换的 session-change 事件本身-// 会触发 clearHistoryIndexCache。reload 后 loadEventFired 处理器会自动补注入。-function reloadIdeWorkbenchWindows(reason) {- if (PROFILE.kind !== 'codebuddy') return false;- let scheduled = 0;- for (const entry of idePages.values()) {- if (!entry.ws || entry.ws.readyState !== 1) continue;- scheduled++;- ideSend(entry, 'Page.reload', { ignoreCache: false })- .then(() => log(`[sessions-sync] 已刷新 IDE 窗口(${reason}) target=${String(entry.url || '').slice(-48)}`))- .catch((e) => log(`[sessions-sync] IDE 窗口刷新失败(${reason}): ${e.message}`));- }- if (!scheduled) log(`[sessions-sync] 无已连接的 IDE 窗口可刷新(${reason})`);- return scheduled > 0;-}-async function cdpLoop() {for (;;) {if (!cdp.connected) {@@ -10844,13 +10820,6 @@ function handleApi(req, res) {else if (result.status === 'skipped') skipped++;else copied++;}- // [CodeBuddy 会话同步] 同步到当前账号时刷新 IDE workbench:扩展宿主的- // indexCache 不因外部写 index.json 失效,侧边栏要等 TTL/重启才显示(详见- // reloadIdeWorkbenchWindows 注释)。同步到其他账号无需刷新——切号时- // session-change 会清缓存。- if (copied > 0 && targetUid === String((currentAccount() || {}).uid || '')) {- reloadIdeWorkbenchWindows('sessions-copy');- }return json(res, 200, { ok: true, copied, skipped, conflicts, targetUid, warning });} catch (e) {return json(res, 500, { ok: false, error: e.message });@@ -10890,14 +10859,6 @@ function handleApi(req, res) {// WorkBuddy's collection store. Refresh the visible account's list so// a migrated history row is hydrated by the official controller.await refreshWorkBuddySessionList(String((currentAccount() || {}).uid || '').trim(), 'sessions-migrate');- // [CodeBuddy 会话同步] 迁入或迁出当前账号都刷新 IDE workbench:扩展宿主的- // indexCache 不因外部写 index.json 失效(详见 reloadIdeWorkbenchWindows 注释),- // 迁入需让新会话出现,迁出需让旧条目消失。- const migrateCurrentUid = String((currentAccount() || {}).uid || '');- if (before.length && (targetUid === migrateCurrentUid- || before.some((row) => String(row.user_id || '') === migrateCurrentUid))) {- reloadIdeWorkbenchWindows('sessions-migrate');- }return json(res, 200, { ok: true, moved: before.length, requested: ids.length, targetUid, rulesMoved });} catch (e) {return json(res, 500, { ok: false, error: e.message });diff --git a/test/codebuddy-ide-recovery.test.js b/test/codebuddy-ide-recovery.test.jsindex 7ed50be..54bb648 100644--- a/test/codebuddy-ide-recovery.test.js+++ b/test/codebuddy-ide-recovery.test.js@@ -10,7 +10,7 @@ function harness() {let now = 1000, serial = 0;const timers = new Map(), sockets = [];const target = { id: 'ide', url: 'vscode-file://vscode-app/CodeBuddy/workbench.html', webSocketDebuggerUrl: 'ws://127.0.0.1/fixture' };- const state = { fail: true, mounted: true, hold: false, injections: 0, reloads: 0, targets: [target] };+ const state = { fail: true, mounted: true, hold: false, injections: 0, targets: [target] };class Socket {constructor() { this.readyState = 1; sockets.push(this); }send(payload) {@@ -23,7 +23,6 @@ function harness() {if (state.fail) result = { exceptionDetails: { text: 'fixture failure' } };} else result = { result: { value: JSON.stringify({ fab: state.mounted, ready: 'complete' }) } };}- if (msg.method === 'Page.reload') state.reloads++;queueMicrotask(() => this.onmessage({ data: JSON.stringify({ id: msg.id, result }) }));}close() { this.readyState = 3; this.onclose(); }@@ -76,27 +75,3 @@ test('IDE mount probe accepts the full panel root (.wbs-root), not only the lega// (wbs-ide-statusbar-root)将永远"未确认",日志误报且白白放弃重试预算。assert.match(manager, /document\.querySelector\("\.wbs-root"\)/);});--test('reloadIdeWorkbenchWindows sends Page.reload to every connected IDE window', async () => {- // 手动同步当前账号后必须刷新 workbench:扩展宿主 indexCache(TTL 5min)- // 不因外部写 index.json 失效,不 reload 侧边栏就要等缓存过期或重启。- const h = harness(); h.state.fail = false; await h.start();- const reloaded = vm.runInContext("reloadIdeWorkbenchWindows('fixture-sync')", h.context);- await tick();- assert.equal(reloaded, true); assert.equal(h.state.reloads, 1);- // reload 后 loadEventFired 流程会复位注入状态并自动补注入(既有行为,不在此重复断言)-});--test('manual copy/migrate handlers reload the IDE workbench for the current account', () => {- // 静态断言:copy 只在 targetUid=当前账号且 copied>0 时刷新;migrate 迁入/迁出- // 当前账号都刷新;自动复制路径不得触发 reload(切号 session-change 已清缓存)。- const copyBlock = source.slice(source.indexOf("p === '/api/sessions/copy'"), source.indexOf("p === '/api/sessions/migrate'"));- const migrateBlock = source.slice(source.indexOf("p === '/api/sessions/migrate'"), source.indexOf("删除会话(真实删除)"));- assert.match(copyBlock, /copied > 0 && targetUid === String\(\(currentAccount\(\) \|\| \{\}\)\.uid \|\| ''\)\) \{\s*\n\s*reloadIdeWorkbenchWindows\('sessions-copy'\)/);- assert.match(migrateBlock, /reloadIdeWorkbenchWindows\('sessions-migrate'\)/);- // 自动复制(startAutoCopyJob 路径)不得调用 reload- const autoCopyStart = source.indexOf('function startAutoCopyJob');- assert.ok(autoCopyStart > 0);- const autoCopyBlock = source.slice(autoCopyStart, source.indexOf('function publicAutoCopyJob'));- assert.doesNotMatch(autoCopyBlock, /reloadIdeWorkbenchWindows/);-});