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): 分离窗不再把只显示占位的 Worker 上报为可见会话

fmfsaisaia9e0e07197a6
diff --git a/apps/desktop/src/renderer/__tests__/agentIslandVisibleSessionRoute.test.ts b/apps/desktop/src/renderer/__tests__/agentIslandVisibleSessionRoute.test.ts
index da4d20566b..8ab1d66971 100644
--- a/apps/desktop/src/renderer/__tests__/agentIslandVisibleSessionRoute.test.ts
+++ b/apps/desktop/src/renderer/__tests__/agentIslandVisibleSessionRoute.test.ts
@@ -150,7 +150,9 @@ describe('resolveAgentIslandVisibleSessionIdFromPath', () => {
expect(workdirBrowseRouteSource).toContain('if (!isAgentIslandSupported()) return;');
expect(workdirBrowseRouteSource).toContain('window.electronAPI.agentIsland?.setVisibleSession?.(agentIslandVisibleSessionId)');
expect(orcaWorkerPanelSource).toContain('window.electronAPI.agentIsland?.setVisibleSession?.(visibleSessionIds)');
- expect(orcaWorkerPanelSource).toContain('viewVisible && workerSessionId && workerSessionId !== leadSessionId');
+ expect(orcaWorkerPanelSource).toContain(
+ 'workerConversationVisible && workerSessionId && workerSessionId !== leadSessionId',
+ );
});
it('acknowledges notification focus navigation to collapse Agent Island after jumping', () => {
diff --git a/apps/desktop/src/renderer/__tests__/orcaWorkflowRoute.test.ts b/apps/desktop/src/renderer/__tests__/orcaWorkflowRoute.test.ts
index af3529ac76..d5c424f2f3 100644
--- a/apps/desktop/src/renderer/__tests__/orcaWorkflowRoute.test.ts
+++ b/apps/desktop/src/renderer/__tests__/orcaWorkflowRoute.test.ts
@@ -420,8 +420,12 @@ describe('OrcaWorkflowRoute source invariants', () => {
it('reports the visible right-sidebar collaboration worker sessions to Agent Island', () => {
expect(workerPanelSource).toContain("import { isAgentIslandSupported } from '@/hooks/useAgentIslandSettings';");
expect(workerPanelSource).toContain('if (!isAgentIslandSupported()) return;');
- expect(workerPanelSource).toContain('viewVisible && workerSessionId && workerSessionId !== leadSessionId');
+ expect(workerPanelSource).toContain(
+ 'workerConversationVisible && workerSessionId && workerSessionId !== leadSessionId',
+ );
expect(workerPanelSource).toContain('[leadSessionId, workerSessionId]');
+ // 分离窗只显示占位,不能把 Worker 上报为可见。
+ expect(workerPanelSource).toContain('const workerConversationVisible = viewVisible && !isSidebarWindow();');
expect(workerPanelSource).toContain('window.electronAPI.agentIsland?.setVisibleSession?.(visibleSessionIds)');
});
diff --git a/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx b/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx
index a94644ece3..748b540e2a 100644
--- a/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx
@@ -174,15 +174,16 @@ export function OrcaWorkerPanel({
if (!isAgentIslandSupported()) return;
// 可见性归属契约:协同 tab 真正可见时由 worker panel 上报 [lead, worker];
// 隐藏、切 tab 或折叠 RSB 时回落为 lead,避免和主 Lead 视图靠 effect 时序抢归属。
+ // 分离窗只显示占位,Worker 对话不可见,同样回落为 lead。
const visibleSessionIds =
- viewVisible && workerSessionId && workerSessionId !== leadSessionId
+ workerConversationVisible && workerSessionId && workerSessionId !== leadSessionId
? [leadSessionId, workerSessionId]
: leadSessionId;
if (!sameVisibleSessionPayload(lastAgentIslandPayloadRef.current, visibleSessionIds)) {
lastAgentIslandPayloadRef.current = visibleSessionIds;
void window.electronAPI.agentIsland?.setVisibleSession?.(visibleSessionIds);
}
- }, [leadSessionId, viewVisible, workerSessionId]);
+ }, [leadSessionId, workerConversationVisible, workerSessionId]);
useEffect(() => {
return () => {