Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 统一关注总数并补齐 Windows 数字角标 (#4361)

Dashc76008b33711
diff --git a/apps/desktop/src/main/__tests__/appBadgeService.test.ts b/apps/desktop/src/main/__tests__/appBadgeService.test.ts
index cd0ec7de0c..e1a1de0c46 100644
--- a/apps/desktop/src/main/__tests__/appBadgeService.test.ts
+++ b/apps/desktop/src/main/__tests__/appBadgeService.test.ts
@@ -12,6 +12,33 @@ const onSessionAttentionMarked = vi.fn();
const onSessionAttentionCleared = vi.fn();
const webContentsSend = vi.fn();
const originalPlatform = process.platform;
+const mainWebContents = {};
+let windowReady = true;
+const assertTrustedAppRendererEvent = vi.fn();
+const overlayIcon = {};
+const createWindowsBadgeIcon = vi.fn((count: number) => (count > 0 ? overlayIcon : null));
+let badgeDescription = 'Tasks needing attention: {{count}}';
+let owner = { dataOwnerId: 'owner-a' as string | null, generation: 1 };
+vi.mock('../appSessionState', () => ({ getActiveAppSession: () => owner }));
+
+function publish(
+ event: unknown,
+ count: unknown,
+ sessionIds = ['late-notification'],
+ stamp = owner,
+) {
+ return registeredHandlers.get('notification:set-app-attention-count')!(event, {
+ count,
+ sessionIds,
+ dataOwnerId: stamp.dataOwnerId,
+ ownerGeneration: stamp.generation,
+ });
+}
+
+vi.mock('../windowsBadgeIcon', () => ({ createWindowsBadgeIcon }));
+vi.mock('../i18n', () => ({ t: () => badgeDescription }));
+
+vi.mock('../security/trustedAppRenderer', () => ({ assertTrustedAppRendererEvent }));
vi.mock('electron', () => ({
app: {
@@ -47,11 +74,15 @@ async function freshService(platform: NodeJS.Platform = 'darwin') {
setPlatform(platform);
const service = await import('../appBadgeService');
service.initAppBadgeService({
- getWindow: () => ({
- isDestroyed: () => false,
- flashFrame,
- setOverlayIcon,
- } as never),
+ getWindow: () =>
+ windowReady
+ ? ({
+ isDestroyed: () => false,
+ webContents: mainWebContents,
+ flashFrame,
+ setOverlayIcon,
+ } as never)
+ : null,
onSessionAttentionMarked,
onSessionAttentionCleared,
});
@@ -65,6 +96,11 @@ async function freshService(platform: NodeJS.Platform = 'darwin') {
}
beforeEach(() => {
+ windowReady = true;
+ badgeDescription = 'Tasks needing attention: {{count}}';
+ owner = { dataOwnerId: 'owner-a', generation: 1 };
+ createWindowsBadgeIcon.mockClear();
+ assertTrustedAppRendererEvent.mockReset();
setBadgeCount.mockClear();
dockSetBadge.mockClear();
flashFrame.mockClear();
@@ -80,6 +116,166 @@ afterEach(() => {
});
describe('appBadgeService', () => {
+ it.each([
+ [false, 0],
+ [false, 1],
+ [true, 0],
+ [true, 1],
+ ] as const)(
+ 'replays Windows attention on window readiness without a projection after reset=%s count=%s',
+ async (reset, count) => {
+ windowReady = false;
+ const service = await freshService('win32');
+ if (reset) service.clearAllSessionAttention();
+ if (count) service.markSessionNeedsAttention('early-task');
+ expect(service.getAttentionCount()).toBe(count);
+ expect(setOverlayIcon).not.toHaveBeenCalled();
+ windowReady = true;
+ service.refreshWindowsAppBadge();
+ expect(setOverlayIcon).toHaveBeenCalledTimes(1);
+ expect(setOverlayIcon).toHaveBeenLastCalledWith(
+ count ? overlayIcon : null,
+ count ? 'Tasks needing attention: 1' : '',
+ );
+ await publish({ sender: mainWebContents }, count, ['early-task']);
+ expect(setOverlayIcon).toHaveBeenCalledTimes(1);
+ },
+ );
+
+ it('uses the current total without treating a snapshot as an acknowledgement', async () => {
+ const service = await freshService();
+ const event = { sender: mainWebContents };
+ await publish(event, 3);
+ expect(service.getAttentionCount()).toBe(3);
+ expect(dockSetBadge).toHaveBeenLastCalledWith('3');
+ expect(onSessionAttentionMarked).not.toHaveBeenCalled();
+ expect(onSessionAttentionCleared).not.toHaveBeenCalled();
+ expect(webContentsSend).not.toHaveBeenCalled();
+
+ // 单次通知/回执不能覆盖总数;等待实际任务状态的新投影。
+ service.markSessionNeedsAttention('late-notification');
+ service.clearSessionAttention('late-notification');
+ expect(service.getAttentionCount()).toBe(3);
+ await publish(event, 2);
+ expect(dockSetBadge).toHaveBeenLastCalledWith('2');
+ await publish(event, 0);
+ expect(dockSetBadge).toHaveBeenLastCalledWith('');
+ });
+
+ it('preserves Bot attention outside the catalog and deduplicates IDs entering it', async () => {
+ const service = await freshService();
+ const event = { sender: mainWebContents };
+ await publish(event, 3, ['a', 'b', 'c']);
+ service.markSessionNeedsAttention('bot-task');
+ service.markSessionNeedsAttention('bot-task');
+ expect(service.getAttentionCount()).toBe(4);
+ await publish(event, 2, ['a', 'b', 'c']);
+ expect(service.getAttentionCount()).toBe(3);
+ service.clearSessionAttention('bot-task');
+ expect(service.getAttentionCount()).toBe(2);
+ service.markSessionNeedsAttention('bot-task');
+ await publish(event, 3, ['a', 'b', 'c', 'bot-task']);
+ expect(service.getAttentionCount()).toBe(3);
+ await publish(event, 0, []);
+ expect(service.getAttentionCount()).toBe(0);
+ service.clearAllSessionAttention();
+ expect(service.getAttentionCount()).toBe(0);
+ });
+
+ it('rejects secondary windows, untrusted frames and invalid totals', async () => {
+ await freshService();
+ await expect(publish({ sender: {} }, 4)).rejects.toMatchObject({ code: 'PERMISSION_DENIED' });
+ for (const count of [-1, 1.5, NaN, Infinity, '3', Number.MAX_SAFE_INTEGER + 1]) {
+ await expect(publish({ sender: mainWebContents }, count)).rejects.toMatchObject({
+ code: 'INVALID_PARAMS',
+ });
+ }
+ const handler = registeredHandlers.get('notification:set-app-attention-count')!;
+ for (const snapshot of [
+ 3,
+ { count: 3 },
+ { count: 3, sessionIds: [null], dataOwnerId: 'owner-a', ownerGeneration: 1 },
+ ]) {
+ await expect(handler({ sender: mainWebContents }, snapshot)).rejects.toMatchObject({
+ code: 'INVALID_PARAMS',
+ });
+ }
+ assertTrustedAppRendererEvent.mockImplementationOnce(() => {
+ throw new Error('untrusted frame');
+ });
+ await expect(publish({ sender: mainWebContents }, 4)).rejects.toThrow('untrusted frame');
+ expect(setBadgeCount).not.toHaveBeenCalled();
+ });
+
+ it('rejects oversized snapshots atomically and bounds repeated batches', async () => {
+ const service = await freshService();
+ const event = { sender: mainWebContents };
+ await publish(event, 3, []);
+ for (const ids of [Array(10_001).fill('id'), ['x'.repeat(513)]]) {
+ await expect(publish(event, 99, ids)).rejects.toMatchObject({ code: 'INVALID_PARAMS' });
+ expect(service.getAttentionCount()).toBe(3);
+ }
+ const ids = Array.from({ length: 10_000 }, (_, index) => `id-${index}`);
+ for (let batch = 0; batch < 10; batch++) {
+ await publish(
+ event,
+ 3,
+ ids.map((id) => `${batch}-${id}`),
+ );
+ }
+ // 重复 ID 不占额外累计预算;满额后仍可刷新已有目录和总数。
+ await publish(event, 4, ['0-id-0', '0-id-0']);
+ await expect(publish(event, 99, ['new-id'])).rejects.toMatchObject({ code: 'INVALID_PARAMS' });
+ expect(service.getAttentionCount()).toBe(4);
+ service.markSessionNeedsAttention('new-id');
+ expect(service.getAttentionCount()).toBe(5); // 被拒投影没有部分写入目录。
+ service.clearAllSessionAttention();
+ await publish(event, 1, ['x'.repeat(512)]);
+ expect(service.getAttentionCount()).toBe(1);
+ });
+
+ it.each(['darwin', 'win32'] as const)(
+ 'bounds projected totals before mutation on %s',
+ async (platform) => {
+ const service = await freshService(platform);
+ const event = { sender: mainWebContents };
+ await publish(event, 10_000);
+ setBadgeCount.mockClear();
+ setOverlayIcon.mockClear();
+ for (const count of [10_001, Number.MAX_SAFE_INTEGER]) {
+ await expect(publish(event, count, ['rejected-id'])).rejects.toMatchObject({
+ code: 'INVALID_PARAMS',
+ });
+ expect(service.getAttentionCount()).toBe(10_000);
+ }
+ expect(setBadgeCount).not.toHaveBeenCalled();
+ expect(setOverlayIcon).not.toHaveBeenCalled();
+ service.markSessionNeedsAttention('rejected-id');
+ expect(service.getAttentionCount()).toBe(10_001); // Rejected snapshots cannot retain catalog IDs.
+ await publish(event, 0, []);
+ expect(service.getAttentionCount()).toBe(1); // Directory-external attention remains independent.
+ },
+ );
+
+ it('clears the previous owner total until the new owner publishes its inventory', async () => {
+ const service = await freshService();
+ await publish({ sender: mainWebContents }, 3);
+ service.clearAllSessionAttention();
+ expect(service.getAttentionCount()).toBe(0);
+ expect(dockSetBadge).toHaveBeenLastCalledWith('');
+ expect(onSessionAttentionCleared).not.toHaveBeenCalled();
+ const previousOwner = owner;
+ owner = { dataOwnerId: null, generation: 2 };
+ service.markSessionNeedsAttention('late-signed-out-event');
+ await publish({ sender: mainWebContents }, 3, [], previousOwner);
+ expect(service.getAttentionCount()).toBe(0);
+ owner = { dataOwnerId: 'owner-b', generation: 3 };
+ await publish({ sender: mainWebContents }, 3, [], previousOwner);
+ expect(service.getAttentionCount()).toBe(0);
+ await publish({ sender: mainWebContents }, 1);
+ expect(service.getAttentionCount()).toBe(1);
+ });
+
it('macOS uses numeric Dock badge count and deduplicates sessions', async () => {
const service = await freshService('darwin');
@@ -108,7 +304,7 @@ describe('appBadgeService', () => {
expect(dockSetBadge).toHaveBeenLastCalledWith('');
});
- it('clears only app-level badges when focus resets all attention', async () => {
+ it('clears app-level badges on shutdown without acknowledging tasks', async () => {
const service = await freshService('darwin');
service.markSessionNeedsAttention('s1');
service.markSessionNeedsAttention('s2');
@@ -142,10 +338,36 @@ describe('appBadgeService', () => {
service.clearSessionAttention('s1');
expect(flashFrame).toHaveBeenNthCalledWith(1, true);
+ expect(setOverlayIcon).toHaveBeenNthCalledWith(1, overlayIcon, 'Tasks needing attention: 1');
expect(flashFrame).toHaveBeenLastCalledWith(false);
expect(setOverlayIcon).toHaveBeenLastCalledWith(null, '');
});
+ it('refreshes Windows descriptions without changing attention or flashing again', async () => {
+ const service = await freshService('win32');
+ await publish({ sender: mainWebContents }, 3);
+ flashFrame.mockClear();
+ badgeDescription = '需要关注的任务:{{count}}';
+ service.refreshWindowsAppBadge();
+ expect(setOverlayIcon).toHaveBeenLastCalledWith(overlayIcon, '需要关注的任务:3');
+ expect(service.getAttentionCount()).toBe(3);
+ expect(flashFrame).not.toHaveBeenCalled();
+ await publish({ sender: mainWebContents }, 0);
+ flashFrame.mockClear();
+ service.refreshWindowsAppBadge();
+ expect(setOverlayIcon).toHaveBeenLastCalledWith(null, '');
+ expect(flashFrame).not.toHaveBeenCalled();
+ });
+
+ it('Windows uses the projected total and keeps exact counts in the description', async () => {
+ await freshService('win32');
+ await publish({ sender: mainWebContents }, 123);
+ expect(createWindowsBadgeIcon).toHaveBeenLastCalledWith(123);
+ expect(setOverlayIcon).toHaveBeenLastCalledWith(overlayIcon, 'Tasks needing attention: 123');
+ await publish({ sender: mainWebContents }, 0);
+ expect(setOverlayIcon).toHaveBeenLastCalledWith(null, '');
+ });
+
it('clear IPC removes a session attention badge', async () => {
const service = await freshService('darwin');
service.markSessionNeedsAttention('s1');
@@ -186,10 +408,10 @@ describe('appBadgeService', () => {
// sessionAttentionStore 靠这条广播同步清侧栏红绿点。
await registeredHandlers.get('notification:clear-session-attention')?.({}, 's1', 'explicit');
- expect(webContentsSend).toHaveBeenCalledWith(
- service.SESSION_ATTENTION_CLEARED_CHANNEL,
- { sessionId: 's1', intent: 'explicit' },
- );
+ expect(webContentsSend).toHaveBeenCalledWith(service.SESSION_ATTENTION_CLEARED_CHANNEL, {
+ sessionId: 's1',
+ intent: 'explicit',
+ });
});
it('broadcasts even when the badge set has no entry (island may still hold unread)', async () => {
@@ -198,10 +420,10 @@ describe('appBadgeService', () => {
service.clearSessionAttention('s1');
- expect(webContentsSend).toHaveBeenCalledWith(
- service.SESSION_ATTENTION_CLEARED_CHANNEL,
- { sessionId: 's1', intent: 'passive' },
- );
+ expect(webContentsSend).toHaveBeenCalledWith(service.SESSION_ATTENTION_CLEARED_CHANNEL, {
+ sessionId: 's1',
+ intent: 'passive',
+ });
});
it('mark IPC adds a session attention badge', async () => {
diff --git a/apps/desktop/src/main/__tests__/sessionRuntimeControlWiring.test.ts b/apps/desktop/src/main/__tests__/sessionRuntimeControlWiring.test.ts
index 49d47c4ff1..26a8938196 100644
--- a/apps/desktop/src/main/__tests__/sessionRuntimeControlWiring.test.ts
+++ b/apps/desktop/src/main/__tests__/sessionRuntimeControlWiring.test.ts
@@ -29,6 +29,10 @@ function handlerBody(source: string, channel: string, nextChannel: string): stri
}
describe('session runtime control wiring', () => {
+ it('replays Windows attention after the main window is shown independently of inventory loading', () => {
+ const body = handlerBody(bootstrapSource, "mainWindow.once('ready-to-show'", 'if (!app.isPackaged) markDesktopDevWindowReady();');
+ expect(body.indexOf('refreshWindowsAppBadge();')).toBeGreaterThan(body.indexOf('showMainWindowAndRestoreFullscreen('));
+ });
it('advertises host-side model-window protection to remote controllers', () => {
const capabilities = handlerBody(
registerSource,
@@ -171,6 +175,10 @@ describe('session runtime control wiring', () => {
'// ── Custom protocol registration',
);
expect(body).toContain('ghostPanelWindowsController.closeForOwnerChange();');
+ expect(body.indexOf('clearAllSessionAttention();')).toBeGreaterThan(-1);
+ expect(body.indexOf('clearAllSessionAttention();')).toBeLessThan(
+ body.indexOf('authManager.setStableOwnerPostCommitTask('),
+ );
expect(body).toContain('clearAllSessionProviders();');
expect(body).toContain('clearAllSessionRuntimeAxes();');
expect(body.indexOf('clearAllSessionProviders();')).toBeLessThan(
diff --git a/apps/desktop/src/main/__tests__/setSessionsStatusInDb.test.ts b/apps/desktop/src/main/__tests__/setSessionsStatusInDb.test.ts
index acb3d897ce..fe063d08eb 100644
--- a/apps/desktop/src/main/__tests__/setSessionsStatusInDb.test.ts
+++ b/apps/desktop/src/main/__tests__/setSessionsStatusInDb.test.ts
@@ -122,7 +122,9 @@ beforeEach(() => {
setSessionRouteLockImplementation(h.withSendToSessionLock);
});
-afterEach(() => {
+afterEach(async () => {
+ // Finish queued cleanup before removing its hooks or resetting the next test's mocks.
+ await queueSessionWorktreeRecycle(async () => {});
setSessionRemovalCancelOperations(null);
setSessionRemovalCleanup(null);
setSessionWorktreeRecycle(null);
diff --git a/apps/desktop/src/main/__tests__/windowsBadgeIcon.test.ts b/apps/desktop/src/main/__tests__/windowsBadgeIcon.test.ts
new file mode 100644
index 0000000000..643d468479
--- /dev/null
+++ b/apps/desktop/src/main/__tests__/windowsBadgeIcon.test.ts
@@ -0,0 +1,52 @@
+import { createCanvas, loadImage } from '@napi-rs/canvas';
+import { describe, expect, it, vi } from 'vitest';
+
+const { addRepresentation, icon } = vi.hoisted(() => {
+ const addRepresentation = vi.fn();
+ return { addRepresentation, icon: { addRepresentation } };
+});
+vi.mock('electron', () => ({ nativeImage: { createEmpty: () => icon } }));
+
+import { createWindowsBadgeIcon, renderWindowsBadgePng } from '../windowsBadgeIcon';
+
+describe('Windows numeric taskbar badge', () => {
+ it('provides PNGs at common Windows display scales and clears at zero', () => {
+ expect(createWindowsBadgeIcon(3)).toBe(icon);
+ expect(addRepresentation.mock.calls.map(([rep]) => rep.scaleFactor)).toEqual([
+ 1, 1.25, 1.5, 2, 3,
+ ]);
+ for (const [rep] of addRepresentation.mock.calls) {
+ const png = Buffer.from(rep.dataURL.split(',')[1], 'base64');
+ expect(png.subarray(1, 4).toString()).toBe('PNG');
+ expect(png.readUInt32BE(16)).toBe(16 * rep.scaleFactor);
+ expect(png.readUInt32BE(20)).toBe(16 * rep.scaleFactor);
+ }
+ addRepresentation.mockClear();
+ expect(createWindowsBadgeIcon(0)).toBeNull();
+ expect(addRepresentation).not.toHaveBeenCalled();
+ });
+
+ it('renders different numbers and caps only the visible label at 99+', () => {
+ expect(renderWindowsBadgePng(1, 2).equals(renderWindowsBadgePng(2, 2))).toBe(false);
+ expect(renderWindowsBadgePng(99, 2).equals(renderWindowsBadgePng(100, 2))).toBe(false);
+ expect(renderWindowsBadgePng(100, 2).equals(renderWindowsBadgePng(12345, 2))).toBe(true);
+ });
+
+ it('contains red fill, white digits and transparent corners in the actual PNG', async () => {
+ const canvas = createCanvas(32, 32);
+ const ctx = canvas.getContext('2d');
+ ctx.drawImage(await loadImage(renderWindowsBadgePng(3, 2)), 0, 0);
+ const { data } = ctx.getImageData(0, 0, 32, 32);
+ expect(data[3]).toBe(0);
+ let redPixels = 0;
+ let whitePixels = 0;
+ for (let i = 0; i < data.length; i += 4) {
+ if (data[i] === 217 && data[i + 1] === 31 && data[i + 2] === 55 && data[i + 3] === 255)
+ redPixels++;
+ if (data[i] === 255 && data[i + 1] === 255 && data[i + 2] === 255 && data[i + 3] === 255)
+ whitePixels++;
+ }
+ expect(redPixels).toBeGreaterThan(100);
+ expect(whitePixels).toBeGreaterThan(10);
+ });
+});
diff --git a/apps/desktop/src/main/agent-island/__tests__/service.test.ts b/apps/desktop/src/main/agent-island/__tests__/service.test.ts
index 2152bbff2d..9681190ccc 100644
--- a/apps/desktop/src/main/agent-island/__tests__/service.test.ts
+++ b/apps/desktop/src/main/agent-island/__tests__/service.test.ts
@@ -29,6 +29,10 @@ import { setDeepLinkMainWindow, takePendingDeepLink } from '../../deepLink.js';
const REMOTE_DAEMON_CLOSED_REASON = 'remote_daemon_closed';
+vi.mock('../../appSessionState', () => ({
+ getActiveAppSession: () => ({ dataOwnerId: 'test-owner', generation: 1, mode: 'local' }),
+}));
+
// 受保护目录检测按 path.join(homedir(), ...) 的字面量匹配;测试消息必须用同一
// 拼法,否则在 Windows 开发机上分隔符对不上,darwin mock 下的用例会失真。
const protectedFolderFile = (kind: 'Desktop' | 'Documents', file: string): string =>
diff --git a/apps/desktop/src/main/appBadgeService.ts b/apps/desktop/src/main/appBadgeService.ts
index ef72bff54d..6720be44e5 100644
--- a/apps/desktop/src/main/appBadgeService.ts
+++ b/apps/desktop/src/main/appBadgeService.ts
@@ -1,10 +1,28 @@
import { app, BrowserWindow, ipcMain } from 'electron';
-import { SESSION_ATTENTION_CLEARED_CHANNEL, type SessionAttentionClearIntent } from '../shared/sessionAttention';
+import {
+ APP_ATTENTION_COUNT_CHANNEL,
+ SESSION_ATTENTION_CLEARED_CHANNEL,
+ type SessionAttentionClearIntent,
+} from '../shared/sessionAttention';
import { createLogger } from './logger';
+import { assertTrustedAppRendererEvent } from './security/trustedAppRenderer';
+import { createWindowsBadgeIcon } from './windowsBadgeIcon';
+import { t } from './i18n';
+import { throwIpcError } from './utils/ipcValidate';
+import { getActiveAppSession } from './appSessionState';
+import { isDataOwnerPushStamp } from '../shared/dataOwnerPush';
const log = createLogger('appBadgeService');
+// 普通本地桶各限 1,000;给多设备目录留余量,同时约束单包与跨包累计内存。
+const MAX_SNAPSHOT_SESSION_IDS = 10_000;
+const MAX_SESSION_ID_LENGTH = 512;
+const MAX_RETAINED_SESSION_IDS = 100_000;
const attentionSessionIds = new Set<string>();
+// 侧栏就绪后目录内任务按当前状态计数;事件集合补齐伙伴等目录外任务,并服务灵动岛。
+// 首份投影前保留事件计数,避免 renderer 尚未挂载时漏掉后台提醒。
+let projectedAttentionCount: number | null = null;
+const projectedSessionIds = new Set<string>();
// channel 常量与 intent 类型的正本在 shared/sessionAttention.ts(preload fan-out /
// renderer store 同源引用);这里 re-export 维持 main 侧既有引用面。
@@ -12,7 +30,8 @@ export { SESSION_ATTENTION_CLEARED_CHANNEL, type SessionAttentionClearIntent };
let getWindow: (() => BrowserWindow | null) | null = null;
let onSessionAttentionMarked: ((sessionId: string) => void) | null = null;
-let onSessionAttentionCleared: ((sessionId: string, intent: SessionAttentionClearIntent) => void) | null = null;
+let onSessionAttentionCleared:
+ ((sessionId: string, intent: SessionAttentionClearIntent) => void) | null = null;
export interface AppBadgeServiceDeps {
getWindow: () => BrowserWindow | null;
@@ -24,37 +43,102 @@ export function initAppBadgeService(deps: AppBadgeServiceDeps): void {
getWindow = deps.getWindow;
onSessionAttentionMarked = deps.onSessionAttentionMarked ?? null;
onSessionAttentionCleared = deps.onSessionAttentionCleared ?? null;
- ipcMain.handle('notification:mark-session-attention', async (_event, sessionId: unknown): Promise<void> => {
- if (typeof sessionId !== 'string' || sessionId.length === 0) return;
- markSessionNeedsAttention(sessionId);
- });
- ipcMain.handle('notification:clear-session-attention', async (_event, sessionId: unknown, intent: unknown): Promise<void> => {
- if (typeof sessionId !== 'string' || sessionId.length === 0) return;
- clearSessionAttention(sessionId, intent === 'explicit' ? 'explicit' : 'passive');
+ ipcMain.handle(APP_ATTENTION_COUNT_CHANNEL, async (event, snapshot: unknown): Promise<void> => {
+ assertTrustedAppRendererEvent(event);
+ if (event.sender !== getWindow?.()?.webContents) {
+ throwIpcError('PERMISSION_DENIED', 'App attention count must come from the main window');
+ }
+ if (!isDataOwnerPushStamp(snapshot)) {
+ throwIpcError('INVALID_PARAMS', 'App attention snapshot requires an owner stamp');
+ }
+ const { count, sessionIds } = snapshot as typeof snapshot & {
+ count?: unknown;
+ sessionIds?: unknown;
+ };
+ if (
+ typeof count !== 'number' ||
+ !Number.isSafeInteger(count) ||
+ count < 0 ||
+ count > MAX_SNAPSHOT_SESSION_IDS
+ ) {
+ throwIpcError('INVALID_PARAMS', 'App attention count exceeds the supported inventory range');
+ }
+ if (!Array.isArray(sessionIds) || sessionIds.length > MAX_SNAPSHOT_SESSION_IDS) {
+ throwIpcError('INVALID_PARAMS', 'App attention snapshot requires session IDs');
+ }
+ for (const id of sessionIds) {
+ if (typeof id !== 'string' || id.length === 0 || id.length > MAX_SESSION_ID_LENGTH) {
+ throwIpcError('INVALID_PARAMS', 'App attention snapshot contains an invalid session ID');
+ }
+ }
+ const owner = getActiveAppSession();
+ if (
+ owner.dataOwnerId !== snapshot.dataOwnerId ||
+ owner.generation !== snapshot.ownerGeneration ||
+ owner.dataOwnerId === null
+ )
+ return;
+ const uniqueSessionIds = new Set<string>(sessionIds);
+ let retainedSize = projectedSessionIds.size;
+ for (const id of uniqueSessionIds) {
+ if (!projectedSessionIds.has(id)) retainedSize += 1;
+ }
+ if (retainedSize > MAX_RETAINED_SESSION_IDS) {
+ throwIpcError('INVALID_PARAMS', 'App attention snapshot exceeds retained session ID limit');
+ }
+ const previousCount = getAttentionCount();
+ projectedAttentionCount = count;
+ // 曾进入普通目录的任务始终归投影管理,删除/断连后不能被旧通知重新计入。
+ for (const sessionId of uniqueSessionIds) projectedSessionIds.add(sessionId);
+ if (getAttentionCount() !== previousCount) applyBadge();
});
+ ipcMain.handle(
+ 'notification:mark-session-attention',
+ async (_event, sessionId: unknown): Promise<void> => {
+ if (typeof sessionId !== 'string' || sessionId.length === 0) return;
+ markSessionNeedsAttention(sessionId);
+ },
+ );
+ ipcMain.handle(
+ 'notification:clear-session-attention',
+ async (_event, sessionId: unknown, intent: unknown): Promise<void> => {
+ if (typeof sessionId !== 'string' || sessionId.length === 0) return;
+ clearSessionAttention(sessionId, intent === 'explicit' ? 'explicit' : 'passive');
+ },
+ );
applyBadge();
}
export function markSessionNeedsAttention(sessionId: string): void {
- if (!sessionId) return;
+ if (!sessionId || getActiveAppSession().dataOwnerId === null) return;
const before = attentionSessionIds.size;
attentionSessionIds.add(sessionId);
if (attentionSessionIds.size !== before) {
- applyBadge();
+ if (projectedAttentionCount === null || !projectedSessionIds.has(sessionId)) applyBadge();
onSessionAttentionMarked?.(sessionId);
}
}
-export function clearSessionAttention(sessionId: string, intent: SessionAttentionClearIntent = 'passive'): void {
+export function clearSessionAttention(
+ sessionId: string,
+ intent: SessionAttentionClearIntent = 'passive',
+): void {
if (!sessionId) return;
const hadAppBadgeAttention = attentionSessionIds.delete(sessionId);
- if (hadAppBadgeAttention) applyBadge();
+ if (
+ hadAppBadgeAttention &&
+ (projectedAttentionCount === null || !projectedSessionIds.has(sessionId))
+ )
+ applyBadge();
onSessionAttentionCleared?.(sessionId, intent);
broadcastSessionAttentionCleared(sessionId, intent);
}
/** 把「会话已读」同步给本机所有窗口(远程控制端清除时,本机侧栏红绿点靠这条收敛)。 */
-function broadcastSessionAttentionCleared(sessionId: string, intent: SessionAttentionClearIntent): void {
+function broadcastSessionAttentionCleared(
+ sessionId: string,
+ intent: SessionAttentionClearIntent,
+): void {
for (const win of BrowserWindow.getAllWindows()) {
if (win.isDestroyed()) continue;
try {
@@ -66,13 +150,20 @@ function broadcastSessionAttentionCleared(sessionId: string, intent: SessionAtte
}
export function clearAllSessionAttention(): void {
- if (attentionSessionIds.size === 0) return;
attentionSessionIds.clear();
+ projectedAttentionCount = 0;
+ projectedSessionIds.clear();
applyBadge();
}
export function getAttentionCount(): number {
- return attentionSessionIds.size;
+ if (projectedAttentionCount === null) return attentionSessionIds.size;
+ let count = projectedAttentionCount;
+ // 伙伴等不在普通目录中的任务沿用逐任务通知;目录内的任务只按投影计数。
+ for (const sessionId of attentionSessionIds) {
+ if (!projectedSessionIds.has(sessionId)) count += 1;
+ }
+ return count;
}
export function hasSessionAttention(sessionId: string): boolean {
@@ -80,7 +171,7 @@ export function hasSessionAttention(sessionId: string): boolean {
}
function applyBadge(): void {
- const count = attentionSessionIds.size;
+ const count = getAttentionCount();
if (process.platform === 'win32') {
applyWindowsBadge(count);
return;
@@ -103,12 +194,20 @@ function applyCountBadge(count: number): void {
}
}
-function applyWindowsBadge(count: number): void {
+/** 窗口就绪或语言变化时重绘当前角标,不依赖目录投影,也不重新触发闪烁。 */
+export function refreshWindowsAppBadge(): void {
+ if (process.platform === 'win32') applyWindowsBadge(getAttentionCount(), false);
+}
+
+function applyWindowsBadge(count: number, updateFlash = true): void {
const win = getWindow?.();
if (!win || win.isDestroyed()) return;
try {
- win.flashFrame(count > 0);
- win.setOverlayIcon(null, count > 0 ? `${count} session${count === 1 ? '' : 's'} need attention` : '');
+ if (updateFlash) win.flashFrame(count > 0);
+ win.setOverlayIcon(
+ createWindowsBadgeIcon(count),
+ count > 0 ? t('appBadge.attentionCount').replace('{{count}}', String(count)) : '',
+ );
} catch (err) {
log.warn('[app-badge] windows badge failed:', err);
}
diff --git a/apps/desktop/src/main/bootstrap-electron.ts b/apps/desktop/src/main/bootstrap-electron.ts
index fc53b1b273..b6b5ced3b8 100644
--- a/apps/desktop/src/main/bootstrap-electron.ts
+++ b/apps/desktop/src/main/bootstrap-electron.ts
@@ -467,7 +467,11 @@ import { reapClaudeOrphansSync } from './claude-orphan-reaper';
import { startAgentProcessPriorityWatcher } from './agent-process-priority';
import { registerProcessMonitorIpc } from './process-monitor/ipc.js';
import { disposeWindowsProcessScanWorkers } from './process-monitor/windowsProcessScanWorkerClient.js';
-import { initAppBadgeService, clearAllSessionAttention } from './appBadgeService';
+import {
+ initAppBadgeService,
+ clearAllSessionAttention,
+ refreshWindowsAppBadge,
+} from './appBadgeService';
import { initNotificationService } from './notificationService';
import { initWecomGroupNotificationIpc } from './wecomGroupNotification';
import { getAgentIslandService, initAgentIslandService } from './agent-island/service.js';
@@ -2446,6 +2450,7 @@ registerGhostIpc();
registerPluginMarketIpc();
registerPluginPublisherIpc();
setAppSessionCommitBoundaryHook(() => {
+ clearAllSessionAttention();
remoteDesktopViewerWindows.reset();
ghostPanelWindowsController.closeForOwnerChange();
clearAllSessionProviders();
@@ -2973,6 +2978,7 @@ ipcMain.handle('app-menu:set-locale', (_event, locale: unknown): { ok: true } =>
);
setSelectionContextMenuLocale(currentApplicationMenuLocale);
setMainLocale(currentApplicationMenuLocale);
+ refreshWindowsAppBadge();
resourceUsageWindowController.setLocale(currentApplicationMenuLocale);
remoteDesktopViewerWindows.setLocale(currentApplicationMenuLocale);
rsbWindowController.setLocale(currentApplicationMenuLocale);
@@ -3373,10 +3379,9 @@ function hasFocusedAppWindow(): boolean {
return BrowserWindow.getAllWindows().some((win) => isFocusedAppContentWindow(win));
}
-function syncAppFocusState(clearAttentionWhenFocused = false): void {
+function syncAppFocusState(): void {
const appFocused = hasFocusedAppWindow();
providerModelFocusRefreshTracker.sync(appFocused);
- if (appFocused && clearAttentionWhenFocused) clearAllSessionAttention();
getAgentIslandService()?.setAppFocused(appFocused);
}
@@ -3396,7 +3401,7 @@ app.on('browser-window-focus', (_event, win) => {
appFocusSyncTimer = null;
}
const focusedAppContent = isAppContentWindow(win);
- syncAppFocusState(focusedAppContent);
+ syncAppFocusState();
if (focusedAppContent) {
syncPluginMarketForActiveOwner(30_000);
// OAuth and system settings may complete outside Cindy. Focus is a
@@ -3891,6 +3896,7 @@ const createWindow = () => {
showMainWindowAndRestoreFullscreen(mainWindow, {
restoreFullscreen: shouldRestoreMacFullscreen,
});
+ refreshWindowsAppBadge();
if (!app.isPackaged) markDesktopDevWindowReady();
void runComputerUseSmokeIfRequested();
// 资源用量窗口不应与主窗口首帧争 CPU。主窗口可见后再后台完成 BrowserWindow、
@@ -3955,12 +3961,7 @@ const createWindow = () => {
// Keyboard hello when the window comes back from hide / minimize / Dock.
attachWorkLouderCodexWindowReveal(mainWindow);
- // App badge: 用户把任意 Cindy 窗口点回前台(Dock 点击 / taskbar / alt-tab / 点窗口)即视为
- // 「已查看」,直接清空整个 dock 红点。badge 是 app 级状态,不该依赖当前停在哪个
- // 路由 / 开没开会话 —— 之前清除逻辑寄生在 cc-agent sidebar 且只清 activeSessionId,
- // 离开会话页(设置 / skillhub)或红点属于后台会话时就清不掉。clearAllSessionAttention
- // 只清 app 级 badge,不向 Agent Island 转发逐 session 已读;in-app 的会话小圆点仍由
- // renderer 自行管理(点进会话才消),随后通过 clearSessionAttention 显式同步。
+ // App badge 投影当前任务关注总数;窗口聚焦不等于读完所有任务,不清总数。
// Agent Island smart suppression 同样按 app 级焦点判断:主窗 blur 到「在新窗口打开」
// 的会话副窗时,用户仍在 Cindy 内,不能把 appFocused 置 false。
diff --git a/apps/desktop/src/main/windowsBadgeIcon.ts b/apps/desktop/src/main/windowsBadgeIcon.ts
new file mode 100644
index 0000000000..2eb27eb20d
--- /dev/null
+++ b/apps/desktop/src/main/windowsBadgeIcon.ts
@@ -0,0 +1,47 @@
+import { createRequire } from 'node:module';
+import { nativeImage, type NativeImage } from 'electron';
+
+const requireFromMain = createRequire(__filename);
+
+// Windows 系统图标专属语义色对;Light/Dark 相同,不属于应用内 error 状态。
+// 视觉合同见 DESIGN.md §2 的 Windows taskbar attention badge。
+const BADGE_COLORS = { background: '#D91F37', foreground: '#FFFFFF' } as const;
+const SCALE_FACTORS = [1, 1.25, 1.5, 2, 3] as const;
+
+export function renderWindowsBadgePng(count: number, scaleFactor: number): Buffer {
+ // 已随正式包附带的 N-API canvas;只在绘制时加载,macOS 启动不加载原生绘图库。
+ const { createCanvas } = requireFromMain('@napi-rs/canvas') as typeof import('@napi-rs/canvas');
+ const size = Math.round(16 * scaleFactor);
+ const canvas = createCanvas(size, size);
+ const ctx = canvas.getContext('2d');
+ ctx.scale(scaleFactor, scaleFactor);
+ const label = count > 99 ? '99+' : String(count);
+ ctx.fillStyle = BADGE_COLORS.background;
+ ctx.beginPath();
+ ctx.roundRect(0.5, 0.5, 15, 15, label.length === 1 ? 7.5 : 5);
+ ctx.fill();
+ // 细白边让角标在深浅任务栏和不同应用图标底色上都有清晰轮廓。
+ ctx.strokeStyle = BADGE_COLORS.foreground;
+ ctx.lineWidth = 0.75;
+ ctx.stroke();
+ const fontSize = label.length === 1 ? 12 : label.length === 2 ? 10 : 8;
+ ctx.font = `bold ${fontSize}px "Segoe UI", sans-serif`;
+ ctx.fillStyle = BADGE_COLORS.foreground;
+ ctx.textAlign = 'center';
+ const metrics = ctx.measureText(label);
+ const baseline = 8 + (metrics.actualBoundingBoxAscent - metrics.actualBoundingBoxDescent) / 2;
+ ctx.fillText(label, 8, baseline, 13);
+ return canvas.toBuffer('image/png');
+}
+
+export function createWindowsBadgeIcon(count: number): NativeImage | null {
+ if (count <= 0) return null;
+ const icon = nativeImage.createEmpty();
+ for (const scaleFactor of SCALE_FACTORS) {
+ icon.addRepresentation({
+ scaleFactor,
+ dataURL: `data:image/png;base64,${renderWindowsBadgePng(count, scaleFactor).toString('base64')}`,
+ });
+ }
+ return icon;
+}
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index 187890f553..e0f4f28a70 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -114,7 +114,7 @@ import {
type TerminateAgentProcessResult,
} from '../shared/processMonitor';
import { RESOURCE_USAGE_WINDOW_OPEN_CHANNEL } from '../shared/resourceUsageWindow';
-import { SESSION_ATTENTION_CLEARED_CHANNEL } from '../shared/sessionAttention';
+import { APP_ATTENTION_COUNT_CHANNEL, SESSION_ATTENTION_CLEARED_CHANNEL } from '../shared/sessionAttention';
import { VOICE_INPUT_POWER_STATE_CHANNEL } from '../shared/voiceInputPowerIpc';
import {
VOICE_INPUT_TEST_CONNECTION_CHANNEL,
@@ -3568,6 +3568,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
clear: (): Promise<{ configured: boolean; enabled: boolean }> =>
ipcRenderer.invoke('wecomGroupNotification:clear'),
},
+ notificationSetAppAttentionCount: (snapshot: import('../shared/sessionAttention').AppAttentionSnapshot): Promise<void> =>
+ ipcRenderer.invoke(APP_ATTENTION_COUNT_CHANNEL, snapshot),
notificationMarkSessionAttention: (sessionId: string): Promise<void> =>
ipcRenderer.invoke('notification:mark-session-attention', sessionId),
// intent:'explicit' = 用户真实看到了内容(报错 banner 聚焦驻留 / 全部标为已读等);
diff --git a/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx b/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx
new file mode 100644
index 0000000000..bc8e856e34
--- /dev/null
+++ b/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx
@@ -0,0 +1,187 @@
+// @vitest-environment jsdom
+import { cleanup, render, renderHook } from '@testing-library/react';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+const state = vi.hoisted(() => ({
+ sessions: ['a', 'b', 'c'].map((id) => ({ id, status: 'active' })),
+ history: null as { id: string; status: string }[] | null,
+ remoteSessions: [] as { id: string; status: string }[],
+ attention: new Map<string, string>([
+ ['a', 'done'],
+ ['b', 'done'],
+ ['c', 'done'],
+ ]),
+ empty: new Map(),
+ running: new Map<string, { isRunning: boolean }>(),
+ starting: new Set<string>(),
+ background: new Set<string>(),
+ workers: new Map<string, ReadonlySet<string>>(),
+ owner: { dataOwnerId: 'owner-a', generation: 1 },
+ isLoading: false,
+ publish: vi.fn().mockResolvedValue(undefined),
+}));
+vi.mock('@/contexts/AuthContext', () => ({ useAuth: () => ({}) }));
+vi.mock('@/contexts/dataOwnerGeneration', () => ({ getDataOwnerGeneration: () => state.owner }));
+vi.mock('@/lib/sessionStartingStore', () => ({ useStartingSessionIds: () => state.starting }));
+vi.mock('@/lib/sessionBackgroundActivityStore', () => ({
+ useBackgroundActivitySessionIds: () => state.background,
+}));
+vi.mock('@/features/cc-agent/hooks/useOrcaLeadWorkerMap', () => ({
+ useOrcaLeadWorkerMap: (sessions: { id: string }[]) =>
+ new Map([...state.workers].filter(([lead]) => sessions.some((session) => session.id === lead))),
+}));
+
+vi.mock('@/hooks/useCCSessions', () => ({
+ useCCSessions: (options: { includeArchived: string }) => ({
+ sessions:
+ options.includeArchived === 'all' ? (state.history ?? state.sessions) : state.sessions,
+ isLoading: state.isLoading,
+ error: null,
+ }),
+}));
+vi.mock('@/features/device-link/remoteProjectsStore', () => ({
+ useRemoteProjectSessions: () => state.remoteSessions,
+ useRemoteScheduleIndex: () => state.empty,
+}));
+vi.mock('@/features/cc-agent/hooks/useAutomationScheduleSessionIndex', () => ({
+ usePublishedAutomationScheduleSessionIndex: () => state.empty,
+}));
+vi.mock('@/features/device-link/remoteSessionActivityStore', () => ({
+ getRemoteSessionActivity: () => undefined,
+ useRemoteSessionActivityRevision: () => 0,
+}));
+vi.mock('@/lib/makerChatStore', () => ({
+ makerChatStore: { subscribeAll: () => () => {}, getRunningSnapshot: () => state.running },
+}));
+vi.mock('@/lib/sessionAttentionStore', () => ({ useSessionAttentionKinds: () => state.attention }));
+vi.mock('@/state/agentIslandActivity', () => ({ useAgentIslandActivityMap: () => state.empty }));
+vi.mock('@/lib/orcaSessionIdentity', () => ({ isOrcaWorkerSession: () => false }));
+
+import { AppBadgeAttentionSync } from '../components/layout/AppBadgeAttentionSync';
+import { useSessionDisplayRunningState } from '../features/cc-agent/hooks/useSessionDisplayRunningState';
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ state.publish.mockClear();
+ state.isLoading = false;
+ state.history = null;
+ state.remoteSessions = [];
+ state.running = new Map();
+ state.starting = new Set();
+ state.background = new Set();
+ state.workers = new Map();
+ state.attention = new Map([
+ ['a', 'done'],
+ ['b', 'done'],
+ ['c', 'done'],
+ ]);
+});
+
+describe('app badge projection lifecycle', () => {
+ it('retains active attention when archived history fills the all bucket', () => {
+ vi.stubGlobal('electronAPI', { notificationSetAppAttentionCount: state.publish });
+ state.history = Array.from({ length: 1000 }, (_, index) => ({
+ id: `archived-${index}`,
+ status: 'archived',
+ }));
+ state.attention.set('archived-0', 'done');
+ render(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 3 }));
+ const projection = state.publish.mock.calls.at(-1)?.[0];
+ expect(projection.sessionIds).toHaveLength(1003);
+ expect(projection.sessionIds).toEqual(expect.arrayContaining(['a', 'b', 'c', 'archived-0']));
+ });
+
+ it('includes remote leads when projecting active workers', () => {
+ vi.stubGlobal('electronAPI', { notificationSetAppAttentionCount: state.publish });
+ state.remoteSessions = [{ id: 'remote-lead', status: 'active' }];
+ state.attention.set('remote-lead', 'done');
+ state.workers = new Map([['remote-lead', new Set(['remote-worker'])]]);
+ state.starting = new Set(['remote-worker']);
+ const view = render(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(
+ expect.objectContaining({ count: 3, sessionIds: ['a', 'b', 'c', 'remote-lead'] }),
+ );
+ state.starting = new Set();
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 4 }));
+ });
+
+ it('tracks starting, background and worker activity through their transitions', () => {
+ vi.stubGlobal('electronAPI', { notificationSetAppAttentionCount: state.publish });
+ const view = render(<AppBadgeAttentionSync />);
+ state.starting = new Set(['a']);
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 2 }));
+ state.background = new Set(['b']);
+ state.workers = new Map([['c', new Set(['worker'])]]);
+ state.running = new Map([['worker', { isRunning: true }]]);
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 0 }));
+ state.starting = new Set();
+ state.running = new Map([['a', { isRunning: true }]]);
+ state.background = new Set(['b', 'worker']);
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 0 }));
+ state.running = new Map();
+ state.background = new Set();
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 3 }));
+ });
+
+ it.each(['running', 'starting', 'background'] as const)(
+ 'promotes %s workers without broadening operation guards',
+ (source) => {
+ const running = new Set(source === 'running' ? ['worker'] : []);
+ state.starting = new Set(source === 'starting' ? ['worker'] : []);
+ state.background = new Set(source === 'background' ? ['worker'] : []);
+ state.workers = new Map([['lead', new Set(['worker'])]]);
+ const { result } = renderHook(() =>
+ useSessionDisplayRunningState(
+ [{ id: 'lead' } as Parameters<typeof useSessionDisplayRunningState>[0][number]],
+ running,
+ ),
+ );
+ expect(result.current.displayRunningSessionIds.has('lead')).toBe(true);
+ expect(result.current.effectiveRunningSessionIds.has('lead')).toBe(source === 'running');
+ expect(running.has('lead')).toBe(false);
+ expect(state.starting.has('lead')).toBe(false);
+ expect(state.background.has('lead')).toBe(false);
+ },
+ );
+
+ it('publishes current totals, retains them on focus and unmount, and resyncs on mount', () => {
+ vi.stubGlobal('electronAPI', { notificationSetAppAttentionCount: state.publish });
+ const view = render(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith({
+ count: 3,
+ sessionIds: ['a', 'b', 'c'],
+ dataOwnerId: 'owner-a',
+ ownerGeneration: 1,
+ });
+ window.dispatchEvent(new Event('focus'));
+ expect(state.publish).toHaveBeenCalledTimes(1);
+ state.attention = new Map([
+ ['b', 'done'],
+ ['c', 'done'],
+ ]);
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 2 }));
+ view.unmount();
+ expect(state.publish).toHaveBeenCalledTimes(2);
+ render(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 2 }));
+ expect(state.publish).toHaveBeenCalledTimes(3);
+ });
+
+ it('waits for the initial task inventory instead of overwriting the badge while loading', () => {
+ vi.stubGlobal('electronAPI', { notificationSetAppAttentionCount: state.publish });
+ state.isLoading = true;
+ const view = render(<AppBadgeAttentionSync />);
+ expect(state.publish).not.toHaveBeenCalled();
+ state.isLoading = false;
+ view.rerender(<AppBadgeAttentionSync />);
+ expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 3 }));
+ });
+});
diff --git a/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts b/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts
new file mode 100644
index 0000000000..25e032fef0
--- /dev/null
+++ b/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts
@@ -0,0 +1,116 @@
+import { describe, expect, it } from 'vitest';
+
+import type { Session } from '@/lib/ccAgent.types';
+import {
+ countAppAttention,
+ type AppAttentionCountInput,
+} from '../features/cc-agent/lib/appAttentionCount';
+
+function session(id: string, extra: Partial<Session> = {}): Session {
+ return { id, status: 'active', ...extra } as Session;
+}
+
+function input(overrides: Partial<AppAttentionCountInput> = {}): AppAttentionCountInput {
+ return {
+ sessions: [session('a'), session('b'), session('c')],
+ attentionKinds: new Map(),
+ runningSessionIds: new Set(),
+ localActivities: new Map(),
+ getRemoteActivity: () => undefined,
+ localSchedules: new Map(),
+ remoteSchedules: new Map(),
+ ...overrides,
+ };
+}
+
+describe('app attention total', () => {
+ it('counts three unread tasks and drops only the task read', () => {
+ const attentionKinds = new Map<'a' | 'b' | 'c', 'done'>([
+ ['a', 'done'],
+ ['b', 'done'],
+ ['c', 'done'],
+ ]);
+ expect(countAppAttention(input({ attentionKinds }))).toBe(3);
+ attentionKinds.delete('a');
+ expect(countAppAttention(input({ attentionKinds }))).toBe(2);
+ });
+
+ it('restores scheduled unread results without in-memory notification events', () => {
+ const unread = { hasUnreadRun: true, hasUnreadFailedRun: false };
+ expect(
+ countAppAttention(
+ input({
+ localSchedules: new Map([
+ ['a', unread],
+ ['b', unread],
+ ]),
+ remoteSchedules: new Map([['c', unread]]),
+ }),
+ ),
+ ).toBe(3);
+ });
+
+ it('deduplicates the same task across activity, notifications and schedule history', () => {
+ expect(
+ countAppAttention(
+ input({
+ sessions: [session('a'), session('a')],
+ attentionKinds: new Map([['a', 'error']]),
+ localActivities: new Map([['a', { phase: 'error', attention: true }]]),
+ localSchedules: new Map([['a', { hasUnreadRun: true, hasUnreadFailedRun: true }]]),
+ }),
+ ),
+ ).toBe(1);
+ });
+
+ it('counts waiting and errors but excludes a running task with an old unread result', () => {
+ expect(
+ countAppAttention(
+ input({
+ attentionKinds: new Map([
+ ['a', 'done'],
+ ['b', 'awaiting'],
+ ['c', 'error'],
+ ]),
+ runningSessionIds: new Set(['a', 'b', 'c']),
+ }),
+ ),
+ ).toBe(2);
+ });
+
+ it('includes remote live attention with the same precedence as task rows', () => {
+ expect(
+ countAppAttention(
+ input({
+ localActivities: new Map([['a', { phase: 'running' }]]),
+ getRemoteActivity: (id) =>
+ id === 'a'
+ ? { phase: 'completed', attention: true }
+ : id === 'b'
+ ? { phase: 'needs-interaction' }
+ : undefined,
+ }),
+ ),
+ ).toBe(2);
+ });
+
+ it('excludes archived, deleted, worker and missing task records', () => {
+ expect(
+ countAppAttention(
+ input({
+ sessions: [
+ session('a', { status: 'archived' }),
+ session('b', { status: 'deleted' }),
+ session('c', { orcaRole: 'worker' }),
+ ],
+ attentionKinds: new Map([
+ ['a', 'done'],
+ ['b', 'error'],
+ ['c', 'awaiting'],
+ ['missing', 'done'],
+ ]),
+ }),
+ ),
+ ).toBe(0);
+ });
+});
diff --git a/apps/desktop/src/renderer/__tests__/sessionsStoreAccountBoundary.test.tsx b/apps/desktop/src/renderer/__tests__/sessionsStoreAccountBoundary.test.tsx
index 5601175894..acfec048aa 100644
--- a/apps/desktop/src/renderer/__tests__/sessionsStoreAccountBoundary.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/sessionsStoreAccountBoundary.test.tsx
@@ -12,9 +12,7 @@ type SpendPayload = {
type OwnerStamp = { dataOwnerId: string | null; ownerGeneration: number };
const mocks = vi.hoisted(() => {
- let spendListener:
- | ((payload: SpendPayload, ownerStamp?: OwnerStamp) => void)
- | undefined;
+ let spendListener: ((payload: SpendPayload, ownerStamp?: OwnerStamp) => void) | undefined;
const onUsageSessionSpendChanged = vi.fn(
(listener: (payload: SpendPayload, ownerStamp?: OwnerStamp) => void) => {
spendListener = listener;
@@ -88,9 +86,7 @@ describe('sessionsStore account boundaries', () => {
oldRequest.resolve([session('old-account')]);
await oldLoad;
- expect(sessionsStore.getByFilter('active')?.map(({ id }) => id)).toEqual([
- 'new-account',
- ]);
+ expect(sessionsStore.getByFilter('active')?.map(({ id }) => id)).toEqual(['new-account']);
expect(mocks.list).toHaveBeenCalledTimes(2);
});
@@ -114,6 +110,33 @@ describe('sessionsStore account boundaries', () => {
expect(view.result.current.isLoading).toBe(false);
});
+ it.each(['active', 'all'] as const)(
+ 'clears a failed %s load after another caller recovers the bucket',
+ async (filter) => {
+ mocks.list.mockRejectedValueOnce(new Error('temporary load failure'));
+ const view = renderHook(() => useCCSessions({ includeArchived: filter }));
+ await waitFor(() =>
+ expect(view.result.current.error?.message).toBe('temporary load failure'),
+ );
+ expect(view.result.current.isLoading).toBe(false);
+ expect(view.result.current.sessions).toEqual([]);
+
+ mocks.list.mockResolvedValueOnce([session('recovered')]);
+ await act(async () => {
+ await sessionsStore.forceRefresh(filter);
+ });
+ expect(view.result.current.sessions.map(({ id }) => id)).toEqual(['recovered']);
+ expect(view.result.current.error).toBeNull();
+
+ mocks.list.mockResolvedValueOnce([]);
+ await act(async () => {
+ await sessionsStore.forceRefresh(filter);
+ });
+ expect(view.result.current.sessions).toEqual([]);
+ expect(view.result.current.error).toBeNull();
+ },
+ );
+
it('removes a deleted session from every loaded filter without refetching', async () => {
mocks.list
.mockResolvedValueOnce([session('deleted'), session('keep-active')])
@@ -195,9 +218,7 @@ describe('sessionsStore account boundaries', () => {
});
it('patches structured CNY spend without fabricating a USD projection', async () => {
- mocks.list.mockResolvedValueOnce([
- session('target', { totalCostUsd: 1 }),
- ]);
+ mocks.list.mockResolvedValueOnce([session('target', { totalCostUsd: 1 })]);
await sessionsStore.ensureByFilter('active');
act(() => {
diff --git a/apps/desktop/src/renderer/__tests__/typographyDiscipline.test.ts b/apps/desktop/src/renderer/__tests__/typographyDiscipline.test.ts
index 4479f3a8f7..4b6b8f2230 100644
--- a/apps/desktop/src/renderer/__tests__/typographyDiscipline.test.ts
+++ b/apps/desktop/src/renderer/__tests__/typographyDiscipline.test.ts
@@ -144,6 +144,16 @@ interface Exemption {
}
const EXEMPTIONS: Exemption[] = [
+ {
+ file: 'src/main/windowsBadgeIcon.ts',
+ rule: 'inline-size',
+ reason: 'DESIGN.md §2 Windows taskbar attention badge: 16px 系统图标内的 8–12px 拟合数字',
+ signatures: [
+ { match: 'fontSize …1', expected: 1 },
+ { match: 'fontSize …2', expected: 1 },
+ { match: 'fontSize …8', expected: 1 },
+ ],
+ },
// 登录/Splash 品牌画布域:Tailwind font-bold ×7 + 内联 700 五处形态
// (238 直接字面量、290 filled/error 三元、300/310 focus/blur style 赋值、748 内联 style)。
{
diff --git a/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx b/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx
new file mode 100644
index 0000000000..2089939c03
--- /dev/null
+++ b/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx
@@ -0,0 +1,79 @@
+import { useEffect, useMemo, useSyncExternalStore } from 'react';
+
+import {
+ getRemoteSessionActivity,
+ useRemoteSessionActivityRevision,
+} from '@/features/device-link/remoteSessionActivityStore';
+import { makerChatStore } from '@/lib/makerChatStore';
+import { useCCSessions } from '@/hooks/useCCSessions';
+import {
+ useRemoteProjectSessions,
+ useRemoteScheduleIndex,
+} from '@/features/device-link/remoteProjectsStore';
+import { usePublishedAutomationScheduleSessionIndex } from '@/features/cc-agent/hooks/useAutomationScheduleSessionIndex';
+import { useSessionAttentionKinds } from '@/lib/sessionAttentionStore';
+import { useAgentIslandActivityMap } from '@/state/agentIslandActivity';
+import { createLogger } from '@/lib/logger';
+import { countAppAttention } from '@/features/cc-agent/lib/appAttentionCount';
+import { getDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import { useAuth } from '@/contexts/AuthContext';
+import { useSessionDisplayRunningState } from '@/features/cc-agent/hooks/useSessionDisplayRunningState';
+
+const log = createLogger('AppBadgeAttentionSync');
+
+/** 主窗口常驻:设置/伙伴页也持续更新,独立订阅避免带动布局重渲染。 */
+export function AppBadgeAttentionSync() {
+ useAuth();
+ const owner = getDataOwnerGeneration();
+ const { sessions, isLoading, error } = useCCSessions({ includeArchived: 'active' });
+ // all 桶保留已归档目录 ID 用于通知去重;不能让它的历史上限挤掉 active 桶。
+ const history = useCCSessions({ includeArchived: 'all' });
+ const remoteSessions = useRemoteProjectSessions();
+ const allSessions = useMemo(() => [...sessions, ...remoteSessions], [sessions, remoteSessions]);
+ const catalogSessionIds = useMemo(
+ () => [...new Set([...allSessions, ...history.sessions].map((session) => session.id))],
+ [allSessions, history.sessions],
+ );
+ const localSchedules = usePublishedAutomationScheduleSessionIndex();
+ const remoteSchedules = useRemoteScheduleIndex();
+ const attentionKinds = useSessionAttentionKinds();
+ const localActivities = useAgentIslandActivityMap();
+ useRemoteSessionActivityRevision();
+ const running = useSyncExternalStore(
+ makerChatStore.subscribeAll,
+ makerChatStore.getRunningSnapshot,
+ makerChatStore.getRunningSnapshot,
+ );
+ const runningSessionIds = useMemo(
+ () => new Set([...running].filter(([, info]) => info.isRunning).map(([id]) => id)),
+ [running],
+ );
+ const { displayRunningSessionIds } = useSessionDisplayRunningState(
+ allSessions,
+ runningSessionIds,
+ );
+ const count = countAppAttention({
+ sessions: allSessions,
+ localSchedules,
+ remoteSchedules,
+ attentionKinds,
+ localActivities,
+ getRemoteActivity: getRemoteSessionActivity,
+ runningSessionIds: displayRunningSessionIds,
+ });
+ useEffect(() => {
+ if (isLoading || error || history.isLoading || history.error) return;
+ void window.electronAPI
+ .notificationSetAppAttentionCount({
+ count,
+ sessionIds: catalogSessionIds,
+ dataOwnerId: owner.dataOwnerId,
+ ownerGeneration: owner.generation,
+ })
+ .catch((err: unknown) => {
+ log.warn('failed to update app attention count', err);
+ });
+ // 卸载/切路由不是已读,不清图标;下次挂载会重新提交完整投影。
+ }, [count, isLoading, error, history.isLoading, history.error, catalogSessionIds, owner]);
+ return null;
+}
diff --git a/apps/desktop/src/renderer/components/layout/MainLayout.tsx b/apps/desktop/src/renderer/components/layout/MainLayout.tsx
index b0335ca157..04a90dab99 100644
--- a/apps/desktop/src/renderer/components/layout/MainLayout.tsx
+++ b/apps/desktop/src/renderer/components/layout/MainLayout.tsx
@@ -32,6 +32,8 @@ import { CredentialStoreBanner } from '@/components/layout/CredentialStoreBanner
import { useDeviceLinkRemoteProjects } from '@/features/device-link/useDeviceLinkRemoteProjects';
import { pluginScheduleNavigationState } from '@/features/scheduler/lib/pluginScheduleCreateIntent';
import { ScheduleSessionIndexOwner } from '@/features/scheduler/components/ScheduleSessionIndexOwner';
+import { AppBadgeAttentionSync } from '@/components/layout/AppBadgeAttentionSync';
+import { usePendingAlertAttention } from '@/hooks/usePendingAlertAttention';
import { FeatureSidebarSlotProvider } from '@/features/feature-context';
import { useAppShortcut } from '@/hooks/useAppShortcut';
import { isAppInteractionLocked } from '@/lib/appInteractionLock';
@@ -218,6 +220,8 @@ function SidebarPinSpacer({ width }: { width: number }) {
}
export function MainLayout() {
+ // 未处理报错的恢复与已处置收敛不依赖当前路由或侧栏是否挂载。
+ usePendingAlertAttention();
const splitGroup = useSplitGroup();
const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(getInitialCollapsed);
const [shareImportRequest, setShareImportRequest] = useState<{
@@ -1370,6 +1374,7 @@ export function MainLayout() {
isCollapsed={sidebarPeek.isPeekVisible ? false : isSidebarCollapsed || isRailMode}
>
<ScheduleSessionIndexOwner />
+ {!isSecondaryWindow() && <AppBadgeAttentionSync />}
<div
ref={rowRef}
className={cn(
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 44147b315b..cfc4e4abe5 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -50,7 +50,7 @@ import { toast } from '@/lib/toast';
import { isDataOwnerPushCurrent } from '@/contexts/dataOwnerGeneration';
import { useCCSessions } from '@/hooks/useCCSessions';
import { useRecentWorkdirs } from '@/hooks/useRecentWorkdirs';
-import { refreshPendingAlerts, usePendingAlertAttention } from '@/hooks/usePendingAlertAttention';
+import { refreshPendingAlerts } from '@/hooks/usePendingAlertAttention';
import { useAppShortcut } from '@/hooks/useAppShortcut';
import { useModifierHold } from '@/hooks/useModifierHold';
import { isSecondaryWindow } from '@/lib/secondaryWindow';
@@ -90,8 +90,6 @@ import {
resolveWorktreeRemovalPreflight,
} from '@/lib/worktreeRemovalWarning';
import { useSessionRunningStatus } from '@/hooks/useSessionRunningStatus';
-import { useBackgroundActivitySessionIds } from '@/lib/sessionBackgroundActivityStore';
-import { useStartingSessionIds } from '@/lib/sessionStartingStore';
import { useAttachedSessionIds } from '@/hooks/useAttachedSessionIds';
import { useActiveMainView } from '@/hooks/useActiveMainView';
import { useAnyGhostUnread } from '@/cindy-brain/ghostUnreadStore';
@@ -121,7 +119,7 @@ import { emitRefresh, onPatch } from '@/lib/sessionsBus';
import { useProjectGroups } from './hooks/useProjectGroups';
import { useProjectAliases } from './hooks/useProjectAliases';
import { useCollapsedProjects } from './hooks/useCollapsedProjects';
-import { useOrcaLeadWorkerMap } from './hooks/useOrcaLeadWorkerMap';
+import { useSessionDisplayRunningState } from './hooks/useSessionDisplayRunningState';
import { useOrcaWorkerAttentionWatcher } from './hooks/useOrcaWorkerAttentionWatcher';
import { usePublishedAutomationScheduleSessionIndex } from './hooks/useAutomationScheduleSessionIndex';
import { markScheduleRunsReadAndSync } from '../scheduler/lib/scheduleRunReadSync';
@@ -405,9 +403,6 @@ export function CCAgentSidebarUpper() {
// 插件 / 搜索 / 远程机器),shell 顶部只留固定的「新建」——列表上滚时这些行一起
// 滚走(2026-08-12 用户裁决,对齐 Codex)。rail 态没有该滚动区,交回 shell 整块渲染。
useOwnTopNavScrollableRows(!isCollapsed);
- // 错误红点的派生真源:拉取存在未处理告警(中断 ∪ 未 dismissed 错误尾行)的会话
- // 并在收敛触发点重算 —— 横幅不被处置,红点就不消失。
- usePendingAlertAttention();
// F-PJ-10:filter.status 决定后端 fetch 时是否带 ?status=archived|all
const hiddenProjects = useHiddenProjects();
const { hiddenProjectKeys, initialSnapshot: sidebarSettingsSnapshot } = hiddenProjects;
@@ -1131,53 +1126,8 @@ function ExpandedView({
},
[scheduleSessionIndex, remoteScheduleIndex],
);
- const orcaLeadWorkerMap = useOrcaLeadWorkerMap(sessions);
- const effectiveRunningSessionIds = useMemo(() => {
- const next = new Set(runningSessionIds);
- for (const [leadSessionId, workerSessionIds] of orcaLeadWorkerMap) {
- for (const workerSessionId of workerSessionIds) {
- if (runningSessionIds.has(workerSessionId)) {
- next.add(leadSessionId);
- break;
- }
- }
- }
- return next;
- }, [orcaLeadWorkerMap, runningSessionIds]);
- // 后台子任务活跃会话(turn 已结束但 CC 子进程仍在调模型)也点亮同一个呼吸指示。
- // 单独一个**纯视觉**集合:effectiveRunningSessionIds 除了喂列表显示还是
- // handleMoveSession 的运行中拦截闸门,后台活动不得静默扩大行为闸门的口径
- // (move / 归档 / 通知语义都保持只认真 running)。
- const backgroundActivitySessionIds = useBackgroundActivitySessionIds();
- // 刚发送尚未 isRunning 的任务并进 display running:排序与呼吸点马上进运行中档,
- // 但不扩大 effectiveRunningSessionIds 的归档 / 移动闸门。
- const startingSessionIds = useStartingSessionIds(runningSessionIds);
- const displayRunningSessionIds = useMemo(() => {
- if (backgroundActivitySessionIds.size === 0 && startingSessionIds.size === 0) {
- return effectiveRunningSessionIds;
- }
- const next = new Set(effectiveRunningSessionIds);
- for (const id of backgroundActivitySessionIds) next.add(id);
- for (const id of startingSessionIds) next.add(id);
- for (const [leadSessionId, workerSessionIds] of orcaLeadWorkerMap) {
- if (next.has(leadSessionId)) continue;
- for (const workerSessionId of workerSessionIds) {
- if (
- backgroundActivitySessionIds.has(workerSessionId) ||
- startingSessionIds.has(workerSessionId)
- ) {
- next.add(leadSessionId);
- break;
- }
- }
- }
- return next;
- }, [
- effectiveRunningSessionIds,
- backgroundActivitySessionIds,
- startingSessionIds,
- orcaLeadWorkerMap,
- ]);
+ const { effectiveRunningSessionIds, displayRunningSessionIds } =
+ useSessionDisplayRunningState(sessions, runningSessionIds);
const collapsedAttentionToneFor = useCallback(
(sessions: readonly Session[]) =>
resolveCollapsedProjectAttentionTone({
@@ -3857,9 +3807,6 @@ function CollapsedView({
// 只读 running 快照——**不传 options**:通知副作用(onSessionDone 等)由
// ExpandedView 的实例独家持有,两个视图常驻挂载,双回调会重复发桌面通知。
const { runningSessionIds } = useSessionRunningStatus(activeSessionId);
- // 后台子任务活跃会话同样点亮呼吸(与 ExpandedView 同口径,纯视觉合并)。
- const backgroundActivitySessionIds = useBackgroundActivitySessionIds();
- const startingSessionIds = useStartingSessionIds(runningSessionIds);
// 瓷砖未读点颜色按 attention kind(done 绿 / awaiting TapTap 蓝 / error 红);组件层
// 取一次,renderItem 里查表(renderItem 非组件,不能 per-item 用 hook)。
@@ -3892,24 +3839,8 @@ function CollapsedView({
// → lead 点亮)——与展开态 displayRunningSessionIds 同口径。RailNav 会滤掉
// worker 行、只聚合 lead,不晋升会出现「面板里 lead 在跑、段灯与置顶瓷砖
// 却不亮」(codex review)。
- const orcaLeadWorkerMap = useOrcaLeadWorkerMap(sessions);
- const railRunningIds = useMemo(() => {
- const next = new Set([
- ...runningSessionIds,
- ...backgroundActivitySessionIds,
- ...startingSessionIds,
- ]);
- for (const [leadSessionId, workerSessionIds] of orcaLeadWorkerMap) {
- if (next.has(leadSessionId)) continue;
- for (const workerSessionId of workerSessionIds) {
- if (next.has(workerSessionId)) {
- next.add(leadSessionId);
- break;
- }
- }
- }
- return next;
- }, [runningSessionIds, backgroundActivitySessionIds, startingSessionIds, orcaLeadWorkerMap]);
+ const { displayRunningSessionIds: railRunningIds } =
+ useSessionDisplayRunningState(sessions, runningSessionIds);
return (
<div
diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/useSessionDisplayRunningState.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/useSessionDisplayRunningState.ts
new file mode 100644
index 0000000000..8dbcf15f6f
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/useSessionDisplayRunningState.ts
@@ -0,0 +1,46 @@
+import { useMemo } from 'react';
+import type { Session } from '@/lib/ccAgent.types';
+import { useBackgroundActivitySessionIds } from '@/lib/sessionBackgroundActivityStore';
+import { useStartingSessionIds } from '@/lib/sessionStartingStore';
+import { useOrcaLeadWorkerMap } from './useOrcaLeadWorkerMap';
+
+/** 列表、折叠栏和系统角标共享显示口径;后台/启动中不扩大操作拦截范围。 */
+export function useSessionDisplayRunningState(
+ sessions: readonly Session[],
+ runningSessionIds: ReadonlySet<string>,
+) {
+ const orcaLeadWorkerMap = useOrcaLeadWorkerMap(sessions);
+ const backgroundActivitySessionIds = useBackgroundActivitySessionIds();
+ const startingSessionIds = useStartingSessionIds(runningSessionIds);
+ const effectiveRunningSessionIds = useMemo(() => {
+ const next = new Set(runningSessionIds);
+ for (const [leadSessionId, workerSessionIds] of orcaLeadWorkerMap) {
+ if ([...workerSessionIds].some((id) => runningSessionIds.has(id))) next.add(leadSessionId);
+ }
+ return next;
+ }, [orcaLeadWorkerMap, runningSessionIds]);
+ const displayRunningSessionIds = useMemo(() => {
+ if (backgroundActivitySessionIds.size === 0 && startingSessionIds.size === 0) {
+ return effectiveRunningSessionIds;
+ }
+ const next = new Set(effectiveRunningSessionIds);
+ for (const id of backgroundActivitySessionIds) next.add(id);
+ for (const id of startingSessionIds) next.add(id);
+ for (const [leadSessionId, workerSessionIds] of orcaLeadWorkerMap) {
+ if (
+ [...workerSessionIds].some(
+ (id) => backgroundActivitySessionIds.has(id) || startingSessionIds.has(id),
+ )
+ ) {
+ next.add(leadSessionId);
+ }
+ }
+ return next;
+ }, [
+ effectiveRunningSessionIds,
+ backgroundActivitySessionIds,
+ startingSessionIds,
+ orcaLeadWorkerMap,
+ ]);
+ return { effectiveRunningSessionIds, displayRunningSessionIds };
+}
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
new file mode 100644
index 0000000000..a054e29173
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
@@ -0,0 +1,50 @@
+import type { Session } from '@/lib/ccAgent.types';
+import { isOrcaWorkerSession } from '@/lib/orcaSessionIdentity';
+import type { AttentionKind } from '@/lib/sessionAttentionStore';
+import {
+ projectSidebarSessionActivity,
+ resolveSidebarRightStatus,
+ type SidebarRightStatusInput,
+} from '../sidebar/sidebarRightStatus';
+
+type ScheduleAttention = { hasUnreadRun: boolean; hasUnreadFailedRun: boolean };
+
+export interface AppAttentionCountInput {
+ sessions: readonly Session[];
+ attentionKinds: ReadonlyMap<string, AttentionKind>;
+ runningSessionIds: ReadonlySet<string>;
+ localActivities: ReadonlyMap<string, SidebarRightStatusInput['liveActivity']>;
+ getRemoteActivity: (sessionId: string) => SidebarRightStatusInput['liveActivity'];
+ localSchedules: ReadonlyMap<string, ScheduleAttention>;
+ remoteSchedules: ReadonlyMap<string, ScheduleAttention>;
+}
+
+/** 与任务行的红/蓝/绿点同源,不随搜索、折叠或当前机器筛选改变。 */
+export function countAppAttention(input: AppAttentionCountInput): number {
+ const attentionIds = new Set<string>();
+ for (const session of input.sessions) {
+ if (session.status !== 'active' || isOrcaWorkerSession(session)) continue;
+ const localSchedule = input.localSchedules.get(session.id);
+ const remoteSchedule = input.remoteSchedules.get(session.id);
+ const activity = projectSidebarSessionActivity({
+ interruption: session,
+ sessionId: session.id,
+ title: session.title,
+ recordStatus: session.status,
+ liveActivity: input.getRemoteActivity(session.id) ?? input.localActivities.get(session.id),
+ attentionKind: input.attentionKinds.get(session.id),
+ isUrgentFromContext:
+ localSchedule?.hasUnreadFailedRun === true || remoteSchedule?.hasUnreadFailedRun === true,
+ isRunning: input.runningSessionIds.has(session.id),
+ hasAttentionNotification:
+ input.attentionKinds.has(session.id) ||
+ localSchedule?.hasUnreadRun === true ||
+ remoteSchedule?.hasUnreadRun === true,
+ });
+ const status = resolveSidebarRightStatus(activity);
+ if (status === 'done' || status === 'awaiting' || status === 'error') {
+ attentionIds.add(session.id);
+ }
+ }
+ return attentionIds.size;
+}
diff --git a/apps/desktop/src/renderer/hooks/useCCSessions.ts b/apps/desktop/src/renderer/hooks/useCCSessions.ts
index adcbd16ed3..5870b7f6c5 100644
--- a/apps/desktop/src/renderer/hooks/useCCSessions.ts
+++ b/apps/desktop/src/renderer/hooks/useCCSessions.ts
@@ -127,6 +127,7 @@ export function useCCSessions(options?: UseCCSessionsOptions): UseCCSessionsRetu
if (next !== null) {
setSnapshotState({ data: next, filter });
setIsLoading(false);
+ setError(null);
}
});
@@ -182,10 +183,7 @@ export function useCCSessions(options?: UseCCSessionsOptions): UseCCSessionsRetu
[],
);
- const refreshSessions = useCallback(
- () => sessionsStore.forceRefresh(filter),
- [filter],
- );
+ const refreshSessions = useCallback(() => sessionsStore.forceRefresh(filter), [filter]);
/** Update a session's fields without re-fetching. Preserves list order — useful
* for renames that shouldn't re-sort. 实际转发给 store 让所有 subscriber 同步。 */
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 0ac21c5243..6d52020769 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -1,4 +1,7 @@
{
+ "appBadge": {
+ "attentionCount": "Tasks needing attention: {{count}}"
+ },
"remoteDesktop": {
"windowsTitle": "Lock screen control",
"windowsready": "Enabled for this Cindy process. Restarting Cindy requires administrator authorization again.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 2171938615..07a6794913 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -1,4 +1,7 @@
{
+ "appBadge": {
+ "attentionCount": "対応が必要なセッション:{{count}}"
+ },
"remoteDesktop": {
"windowsTitle": "ロック画面の操作",
"windowsready": "現在の Cindy で有効です。Cindy を再起動すると管理者の再承認が必要です。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 73981544c7..90f9a0ad03 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -1,4 +1,7 @@
{
+ "appBadge": {
+ "attentionCount": "확인이 필요한 세션: {{count}}"
+ },
"remoteDesktop": {
"windowsTitle": "잠금 화면 제어",
"windowsready": "현재 Cindy 실행에 허용되었습니다. Cindy를 다시 시작하면 관리자 승인이 다시 필요합니다.",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 2445194051..a69b060609 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -1,4 +1,7 @@
{
+ "appBadge": {
+ "attentionCount": "需要关注的任务:{{count}}"
+ },
"remoteDesktop": {
"windowsTitle": "锁屏控制",
"windowsready": "已为本次运行的 Cindy 开启。重新启动 Cindy 后需要再次由管理员授权。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 0bade65c98..778c8e2a5d 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -1,4 +1,7 @@
{
+ "appBadge": {
+ "attentionCount": "需要關注的任務:{{count}}"
+ },
"remoteDesktop": {
"windowsTitle": "鎖定畫面控制",
"windowsready": "已為本次執行的 Cindy 啟用。重新啟動 Cindy 後需要再次由管理員授權。",
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index d870575dac..2c15d613c5 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -2804,9 +2804,11 @@ interface ElectronAPI {
) => Promise<{ configured: boolean; enabled: boolean; maskedKey?: string }>;
clear: () => Promise<{ configured: boolean; enabled: boolean }>;
};
- /** 将对应 session 标记为需要关注,显示 Dock/taskbar app badge。 */
+ /** 主窗口投影全部任务的关注总数;独立于通知事件及逐任务已读回执。 */
+ notificationSetAppAttentionCount: (snapshot: import('../shared/sessionAttention').AppAttentionSnapshot) => Promise<void>;
+ /** 将对应 session 标记为需要关注,同步灵动岛状态。 */
notificationMarkSessionAttention: (sessionId: string) => Promise<void>;
- /** 用户查看对应 session 后,清除系统级 Dock/taskbar attention badge。 */
+ /** 用户查看或处置对应 session 后,同步逐任务已读回执。 */
notificationClearSessionAttention: (
sessionId: string,
intent?: 'explicit' | 'passive',
diff --git a/apps/desktop/src/shared/sessionAttention.ts b/apps/desktop/src/shared/sessionAttention.ts
index 1f47875e74..6f72f2d7c5 100644
--- a/apps/desktop/src/shared/sessionAttention.ts
+++ b/apps/desktop/src/shared/sessionAttention.ts
@@ -11,6 +11,16 @@
*/
export const SESSION_ATTENTION_CLEARED_CHANNEL = 'notification:session-attention-cleared';
+/** 主窗口把当前任务关注总数投影到本机图标;不是已读回执,不经 device-link 转发。 */
+export const APP_ATTENTION_COUNT_CHANNEL = 'notification:set-app-attention-count';
+
+export interface AppAttentionSnapshot {
+ count: number;
+ sessionIds: string[];
+ dataOwnerId: string | null;
+ ownerGeneration: number;
+}
+
/**
* 清除会话 attention 的意图,随 IPC / 广播全链路透传:
* 'explicit' = 用户真实看到了内容(可清未读 error);
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 4678327bf4..c859a7dc6a 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -89,6 +89,7 @@ The grayscale rule is near-absolute. The following are the **only** sanctioned n
> **Additional narrowly-scoped exceptions** (documented in their respective component specs, do NOT generalize as system semantic colors):
>
+> - **Windows taskbar attention badge** — the native OS overlay uses a fixed red background (`#D91F37`) and white digits/border (`#FFFFFF`) in both Light and Dark taskbars. This is the app-wide count of active tasks needing attention, not an error-only status. The image-specific semantic pair lives in `apps/desktop/src/main/windowsBadgeIcon.ts`; it is not an in-app theme token. Render at 16 logical pixels with 100/125/150/200/300% representations; use a circle for one digit, a rounded square for multiple digits, and `99+` above 99. The accessibility description keeps the exact total. Only the OS image may use its fitted 8–12px system-font digits; web typography and status-dot color rules are unchanged.
> - **Toast Info / Success / Warning / Error** — `#417CDD` / `#2AAE5B` / `#F3A115` / `#D91F37`(finalized 2026-07-17; Toast exemption lifted) — used ONLY on the 16×16 lucide icon inside Toast pill notifications. The pill body (background, text, border, close icon) remains strictly grayscale. Info blue #417CDD equals the focus-ring / Auto Approval value (originally #3B82F6, added 2026-07-14, now finalized); success/warning/error equal the global status colors (done green / status error / warning foreground).
> - **Usage History category color (owner-approved 2026-09-08, extended 2026-09-09).** The registered usage heatmap uses a blue intensity scale. Daily token bars and their corresponding model-table swatches/share marks use `--usage-model-1` … `--usage-model-5` as the seed palette; additional models receive theme-derived hues without a top-five cutoff. All model identities in the full history are included, even when absent from the last 30 days. Agent/harness swatches, share marks and the stacked share strip reuse the existing engine identity tokens: `--engine-badge-cc` (terracotta orange), `--engine-badge-codex` (blue), and `--usage-model-1` (owner-chosen teal for pi, to distinguish it from Codex blue). Claude/Codex retain their cross-mode fixed-value contract; pi follows the existing Light/Dark teal values. `--usage-heatmap-high` supplies the high end of the heatmap. The heatmap retains its process-blue alias; category colors do not inherit process/status semantics. Task marks, text and control frames stay neutral. See [the component specification](./usage-history-charts.md); colors.ts remains the seed-value source, with runtime derivation under governance §3.4.
> - **Resource Usage Process Categories** — the Resource Usage table may color only its 14px process-type glyphs so dense rows can be scanned by category (user-requested 2026-08-06). The six category pairs are task Agent blue `#2563EB / #60A5FA`, Agent service purple `#7C3AED / #A78BFA`, main-process pink `#DB2777 / #F472B6`, renderer cyan `#0891B2 / #22D3EE`, GPU amber `#D97706 / #F59E0B`, and utility green `#059669 / #34D399` (Light / Dark). These colors encode process category, **not health or status**; row backgrounds, labels, metrics, selection and actions remain on the neutral system. Direct use is confined to `resource-usage` process glyphs; the explicitly registered Usage History heatmap alias above may also reference the task-blue value. No other table or process UI inherits this permission. Tokens: `--process-agent-task-icon`, `--process-agent-service-icon`, `--process-main-icon`, `--process-renderer-icon`, `--process-gpu-icon`, `--process-utility-icon`.
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index 4997cf7221..2f60534e9a 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -39,7 +39,7 @@
| `desktop.plugins.app-main` | desktop | 插件主视图 | hash `/apps/:ghostId`(GhostMainViewFeatureLayout) | GhostMainViewFeatureLayout, GhostMainViewHost | apps/desktop/src/renderer/features/plugin/GhostMainViewFeatureLayout.tsx, apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 0 | 0 | 0 |
| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 49 | 0 | 82 |
| `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionRow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderDialog.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderImportDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopPermissions.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopSetting.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSegmentedControl.tsx, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/cindyMakeVisibility.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/modelManagementPresentation.ts, apps/desktop/src/renderer/components/settings/modelManagementState.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageCharts.css, apps/desktop/src/renderer/components/settings/usage/usageHistoryColors.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/useProviderSubscriptionCard.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 155 | 109 | 736 |
-| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, DeviceSectionHeader, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, ProjectsSection, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/DatabaseSizeWarningBanner.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/DeviceSectionHeader.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openRoutinesTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/CindyMakeTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/routines/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 148 | 58 | 296 |
+| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, DeviceSectionHeader, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, ProjectsSection, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/DatabaseSizeWarningBanner.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/DeviceSectionHeader.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openRoutinesTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/CindyMakeTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/routines/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 148 | 58 | 296 |
| `desktop.skillhub.local` | desktop | SkillHub 本地技能 | hash `/skillhub/local` 及详情 `/skillhub/local/:kind/global/:name`、`/skillhub/local/:kind/project/:projectHash/:name` | InstallTargetPicker, PluginManagementLayout, SkillhubDetailView, SkillhubFeatureLayout, SkillhubHomeView, SkillhubMarketPreviewPanel | apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubFeatureLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketPreviewPanel.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx | 41 | 0 | 66 |
| `desktop.skillhub.market` | desktop | SkillHub 市场 | hash `/skillhub/market`(SkillhubMarketListView) | InstallTargetPicker, MarketCard, MarketInfoEditDialog, SkillhubMarketListView, SkillhubMarketPreviewPanel, VisibilityEditorDialog | apps/desktop/src/renderer/features/skillhub/SkillhubMarketListView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketPreviewPanel.tsx, apps/desktop/src/renderer/features/skillhub/components/HomeMarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/LocalSkillControls.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInfoEditDialog.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketLocalSkills.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketPreviewTree.tsx, apps/desktop/src/renderer/features/skillhub/components/PlatformTagSelector.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillCategoryFilterBar.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillIcon.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillTagList.tsx, apps/desktop/src/renderer/features/skillhub/components/TeamScopePicker.tsx, apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx | 47 | 0 | 63 |
| `desktop.window.computer-permission-guide` | desktop | 电脑使用权限引导 | `?view=computer-permission-guide` → ComputerPermissionGuideWindow;backdrop 同文件 | ComputerPermissionBackdrop, ComputerPermissionGuideWindow | apps/desktop/src/main/computer-permission-guide/MacComputerPermissionGuideNativeHost.ts, apps/desktop/src/main/computer-permission-guide/placement.ts, apps/desktop/src/main/computer-permission-guide/request.ts, apps/desktop/src/main/computer-permission-guide/switch-target.ts, apps/desktop/src/main/computer-permission-guide/window.ts, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx | 7 | 2 | 9 |