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): keep Orca in-place agent switch after upstream merge

Praise158122c02eaa
diff --git a/apps/desktop/src/renderer/__tests__/orcaLeadOfflineModelPanel.test.ts b/apps/desktop/src/renderer/__tests__/orcaLeadOfflineModelPanel.test.ts
index 6967e749c7..263d3c0991 100644
--- a/apps/desktop/src/renderer/__tests__/orcaLeadOfflineModelPanel.test.ts
+++ b/apps/desktop/src/renderer/__tests__/orcaLeadOfflineModelPanel.test.ts
@@ -43,33 +43,47 @@ describe('orcaLeadLocalFallbackOpen', () => {
});
describe('sessionAgentSwitchSupported', () => {
- it('非协同会话保持原能力位;协同 Lead 仅离线回落时开放切换事务', () => {
+ it('仅在角色、运行时引擎和被控端能力都确认后开放切换事务', () => {
expect(
sessionAgentSwitchSupported({
sessionOrcaRole: null,
+ runtimeAgentKind: 'codex',
hostSwitchCapable: true,
- orcaLeadLocalFallback: false,
}),
).toBe(true);
expect(
sessionAgentSwitchSupported({
sessionOrcaRole: 'lead',
+ runtimeAgentKind: 'codex',
hostSwitchCapable: true,
- orcaLeadLocalFallback: false,
}),
- ).toBe(false);
+ ).toBe(true);
expect(
sessionAgentSwitchSupported({
- sessionOrcaRole: 'lead',
+ sessionOrcaRole: 'worker',
+ runtimeAgentKind: 'codex',
hostSwitchCapable: true,
- orcaLeadLocalFallback: true,
}),
).toBe(true);
expect(
sessionAgentSwitchSupported({
sessionOrcaRole: undefined,
+ runtimeAgentKind: 'codex',
+ hostSwitchCapable: true,
+ }),
+ ).toBe(false);
+ expect(
+ sessionAgentSwitchSupported({
+ sessionOrcaRole: 'lead',
+ runtimeAgentKind: undefined,
hostSwitchCapable: true,
- orcaLeadLocalFallback: false,
+ }),
+ ).toBe(false);
+ expect(
+ sessionAgentSwitchSupported({
+ sessionOrcaRole: 'lead',
+ runtimeAgentKind: 'codex',
+ hostSwitchCapable: false,
}),
).toBe(false);
});
diff --git a/apps/desktop/src/renderer/components/new-chat/sessionAgentSwitchGate.ts b/apps/desktop/src/renderer/components/new-chat/sessionAgentSwitchGate.ts
index ba0bd6e8a9..c9d7419a1d 100644
--- a/apps/desktop/src/renderer/components/new-chat/sessionAgentSwitchGate.ts
+++ b/apps/desktop/src/renderer/components/new-chat/sessionAgentSwitchGate.ts
@@ -1,8 +1,8 @@
/**
* 会话换 Agent / 换电脑的入口门控。
*
- * 协同任务默认不开放跨电脑切换(handler 对 orcaRole 拒 UNSUPPORTED_CAPABILITY)。
- * 唯一产品例外:Orca Lead 的 Agent 落在另一台电脑、且那台目录读取失败时,只开放切回本机。
+ * Orca Lead/Worker 可在当前 Agent 位置使用切换事务;用户发起的位置迁移仍受 main 限制。
+ * Lead 的远端目录读取失败时,额外开放只回任务本机的入口。
*/
export type RemoteCatalogStatus = 'idle' | 'loading' | 'error' | 'ready';
@@ -22,12 +22,14 @@ export function orcaLeadLocalFallbackOpen(input: {
export function sessionAgentSwitchSupported(input: {
sessionOrcaRole: string | null | undefined;
+ runtimeAgentKind: string | null | undefined;
hostSwitchCapable: boolean;
- orcaLeadLocalFallback: boolean;
}): boolean {
- if (!input.hostSwitchCapable) return false;
- if (input.sessionOrcaRole === null) return true;
- return input.orcaLeadLocalFallback;
+ return (
+ input.sessionOrcaRole !== undefined &&
+ input.runtimeAgentKind != null &&
+ input.hostSwitchCapable
+ );
}
/** 离线回落只露出本机格,不把其它电脑列进左栏。 */