Skip to content

WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。

fix: apply CodeBuddy account-menu dedupe style in the shared workbench panel

wanghcda1805a47015
diff --git a/scripts/daemon.js b/scripts/daemon.js
index 848088e..99ebf62 100644
--- a/scripts/daemon.js
+++ b/scripts/daemon.js
@@ -433,8 +433,10 @@ const primaryAccountStore = createPrimaryAccountStore(DATA_DIR, (uid) => fs.exis
// 1.2.189:毛玻璃底色等待移至 daemon,避免后台页面定时器节流拖延开关和壁纸加载。
// 1.2.191:CodeDaddy 共用完整面板,通过本机 CDP 适配通信、原生登录态和会话缓存。
// 1.2.10:合并会话、用量、启动器及 CodeBuddy IDE 注入重试与积分刷新修复。
-const DAEMON_VERSION = '1.2.10';
-const DAEMON_BUILD_ID = 'release-1.2.10-20260930-markdown-preview';
+// 1.2.11:IDE workbench 共用完整面板后修正浮层确认探针(认 .wbs-root);
+// 原生账号菜单去重样式移入完整面板注入路径,修复"多个头像"回归。
+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({
@@ -2306,10 +2308,11 @@ function onCdpEvent(method, params) {
}
}
-// ===== [CodeBuddy IDE 状态栏] IDE 主窗口轻量浮层管理器 =====
+// ===== [CodeBuddy IDE 状态栏] IDE 主窗口浮层管理器 =====
// 主连接(connectCdp)保持 1.2.9 原行为:只绑定 agentManager.html(完整面板)。
// IDE 主窗口(workbench.html)由本管理器并行维护:每个 IDE 窗口一条独立 ws,
-// 只注入轻量 FAB(inject.js 运行时通过 location.href 自判 IDE 分支)。
+// 注入与主连接同一份完整面板脚本(1.2.10 起 IDE 与 Agents 共用面板;inject.js
+// 按 location.href 为 workbench 追加原生账号菜单去重样式)。
// 主连接单 target 且不重选:若让 workbench 走主连接,先出现的 workbench 会被
// 绑定,后打开的 agents 窗口将永远等不到注入(实测回归),故必须双路。
const idePages = new Map(); // Per-target connection, navigation and injection retry state.
@@ -2353,13 +2356,14 @@ function ideInjectPage(entry, reason) {
log(`[cdp-ide] IDE 浮层注入抛错(${reason}): ${redactDiagnosticText((ex && (ex.description || ex.value)) || result.exceptionDetails.text || '', 300)}`);
return;
}
- // IDE 分支不挂 .wbs-root/__wbsWidget,只认 FAB 根节点
+ // IDE workbench 挂的是完整面板根(.wbs-root);旧轻量浮层根保留兼容探测
let mounted = false;
for (let attempt = 0; attempt < 3 && !mounted && !entry.closed && entry.navigation === navigation; attempt++) {
await new Promise((resolve) => setTimeout(resolve, attempt === 0 ? 200 : 600));
if (entry.closed || entry.navigation !== navigation) return;
+ // IDE 分支挂完整面板(.wbs-root);旧轻量浮层根(wbs-ide-statusbar-root)保留兼容
const check = await ideSend(entry, 'Runtime.evaluate', {
- expression: 'JSON.stringify({ fab: !!document.getElementById("wbs-ide-statusbar-root"), ready: document.readyState })',
+ expression: 'JSON.stringify({ fab: !!(document.querySelector(".wbs-root") || document.getElementById("wbs-ide-statusbar-root")), ready: document.readyState })',
returnByValue: true,
}).catch(() => null);
const state = check && check.result && check.result.value ? JSON.parse(check.result.value) : {};
diff --git a/scripts/inject.js b/scripts/inject.js
index 2e60631..2de50ba 100644
--- a/scripts/inject.js
+++ b/scripts/inject.js
@@ -17889,6 +17889,22 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
'.wbs-body:has(>[data-pane="account"].active){max-height:none;overflow:hidden}',
].join('');
(document.head || document.documentElement).appendChild(css);
+
+ // [CodeBuddy IDE 状态栏] CodeBuddy 官方帐户菜单的账号行按"认证会话"累积渲染:genie 扩展
+ // 替换会话时只发 added 不发 removed(官方 logout 才清理),而菜单把每行都显示成当前
+ // 账号昵称 → WorkDaddy 原生切换后残留的旧账号条目看起来就是多个一模一样的"当前账号"头像行。
+ // 缓解:隐藏第一个之外的所有账号行(被隐藏行点击行为本就为空,无功能损失)。
+ // ⚠️ 1.2.10 起 IDE workbench 与 Agents 共用完整面板,本样式必须挂在完整面板注入路径
+ // (旧版放在不再调用的 injectCodeBuddyIdeMode 里导致 1.2.10 曾回归出"多个头像")。
+ // 脚本顶部的 cleanup IIFE 已负责移除旧 #wbs-ide-menu-dedupe-style,此处重复注入幂等。
+ // ⚠️ 若官方将来支持真正的多账号展示(各行显示各自昵称),删除本规则即可。
+ if ((PROFILE_ID === 'codebuddy-cn' || PROFILE_ID === 'codebuddy-intl')
+ && /\/workbench\.html(?:[?#]|$)/i.test(location.href)) {
+ var ideMenuDedupe = document.createElement('style');
+ ideMenuDedupe.id = 'wbs-ide-menu-dedupe-style';
+ ideMenuDedupe.textContent = 'li.genie-account-menu-item ~ li.genie-account-menu-item{display:none !important;}';
+ (document.head || document.documentElement).appendChild(ideMenuDedupe);
+ }
start();
window.__wbsWidget = {
diff --git a/test/codebuddy-ide-credits.test.js b/test/codebuddy-ide-credits.test.js
index 20fed55..1f1c7a8 100644
--- a/test/codebuddy-ide-credits.test.js
+++ b/test/codebuddy-ide-credits.test.js
@@ -101,3 +101,13 @@ test('IDE shares the WorkDaddy panel without restricting tab navigation', () =>
assert.equal(tabs.find(tab => tab.classList.active).getAttribute(), name);
}
});
+
+test('workbench 完整面板路径注入原生账号菜单去重样式(多个头像行回归)', () => {
+ // 1.2.10 consolidate 曾把去重样式留在不再调用的 injectCodeBuddyIdeMode 里:
+ // workbench 跑完整面板 → 样式从未注入 → genie 菜单按认证会话累积的旧账号行
+ // 全部显示成当前账号(多个一模一样的头像行)。去重样式必须挂在完整面板注入路径。
+ const panelPath = source.slice(source.indexOf('\n // User-facing strings', source.indexOf(' function injectCodeBuddyIdeMode()')));
+ assert.ok(panelPath.includes('wbs-ide-menu-dedupe-style'), '去重样式必须挂在完整面板注入路径');
+ assert.ok(panelPath.includes('li.genie-account-menu-item ~ li.genie-account-menu-item'), '去重规则选择器必须在面板路径中');
+ assert.ok(/workbench\\?\.html/.test(panelPath), '面板路径必须包含 workbench 页面判定');
+});
diff --git a/test/codebuddy-ide-recovery.test.js b/test/codebuddy-ide-recovery.test.js
index 11f7eef..54bb648 100644
--- a/test/codebuddy-ide-recovery.test.js
+++ b/test/codebuddy-ide-recovery.test.js
@@ -69,3 +69,9 @@ test('IDE commands time out and pending commands reject on socket close', async
h.sockets[0].close(); await tick();
assert.equal(h.context.done, true); assert.equal(h.context.saved.pending.size, 0);
});
+
+test('IDE mount probe accepts the full panel root (.wbs-root), not only the legacy FAB', () => {
+ // 1.2.10 起 workbench 与 Agents 共用完整面板:探针若只认旧轻量浮层根
+ // (wbs-ide-statusbar-root)将永远"未确认",日志误报且白白放弃重试预算。
+ assert.match(manager, /document\.querySelector\("\.wbs-root"\)/);
+});