Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(orca): 协同任务的 Lead / Worker 可在本机与远程供应商之间切换
fmfsaisai5f89c8c71186
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.tsindex 0ee8db1b70..3eeac8601f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts@@ -1446,7 +1446,27 @@ describe('远程 Agent:选模型时换 Agent 所在电脑', () => {expect(local.deps.insertBoundaryMessage).not.toHaveBeenCalled();});- it('协同任务:只接受供应商组内部的立即换位置(同引擎同模型)', async () => {+ it.each(['lead', 'worker'])('协同任务 %s:用户换电脑与普通任务一样登记意图,发送时落地', async (orcaRole) => {+ const h = relocationHarness({ orcaRole, agentDeviceId: null, providerId: 'xd' });+ await performSessionAgentSwitch(h.deps, {+ ...backToTaskComputer,+ model: 'claude-opus-5-5',+ providerId: 'anthropic',+ agentDeviceId: 'share:alice-share',+ });+ expect(h.selectSameAgentModel).not.toHaveBeenCalled();+ expect(h.assertAgentDeviceRouteUsable).toHaveBeenCalledWith('share:alice-share', 'claude-code', 'claude-opus-5-5', 'anthropic');+ expect(h.pending.get('s1')).toMatchObject({ targetAgentDeviceId: 'share:alice-share' });++ await applyPendingAgentSwitchIfIdle(h.deps, 's1');+ expect(h.deps.applyAgentSwitchToDb).toHaveBeenCalledWith('s1', expect.objectContaining({+ agentDeviceId: 'share:alice-share',+ sdkSessionId: null,+ }));+ expect(h.pending.get('s1')).toBeUndefined();+ });++ it('协同任务:供应商组内部的立即换位置照常可用(同引擎同模型)', async () => {const lead = relocationHarness({ orcaRole: 'lead', model: 'anthropic/claude-opus-5-5[1m]' });const result = await performSessionAgentSwitch(lead.deps, {...backToTaskComputer,@@ -1472,10 +1492,9 @@ describe('远程 Agent:选模型时换 Agent 所在电脑', () => {});it.each([- { orcaRole: 'worker' },{ orcaRole: null, orcaRemoteLead: JSON.stringify({ leadDeviceId: 'lead-device', leadSessionId: 'lead-1', workerLabel: 'worker' }) },{ orcaRole: null, orcaRemoteLead: JSON.stringify({ leadDeviceId: 'lead-device', leadSessionId: 'lead-1', workerLabel: 'worker', releasedAt: 1 }) },- ])('rejects user relocation while preserving harness/model selection: %j', async (identity) => {+ ])('execution-device Worker rejects user relocation while preserving harness/model selection: %j', async (identity) => {const row = { ...identity, model: 'anthropic/claude-opus-5-5[1m]' };const { agentDeviceId: _omit, ...withoutLocation } = backToTaskComputer;const userMove = relocationHarness(row);diff --git a/apps/desktop/src/main/maker-ipc/sessionAgentSwitchHandler.ts b/apps/desktop/src/main/maker-ipc/sessionAgentSwitchHandler.tsindex 466c04f53c..d39f50c6ac 100644--- a/apps/desktop/src/main/maker-ipc/sessionAgentSwitchHandler.ts+++ b/apps/desktop/src/main/maker-ipc/sessionAgentSwitchHandler.ts@@ -636,15 +636,15 @@ export async function performSessionAgentSwitch(// SSH 远程会话:agent 进程在远端机器,cc-manager 链路仅覆盖 Claude,v1 不支持切换。throwIpcError('UNSUPPORTED_CAPABILITY', 'agent switch is not supported for remote sessions');}- // Orca may switch harness/model, but Agent relocation remains an internal- // provider-group operation so the workflow's execution-device contract stays- // under the group scheduler.+ // Orca Lead / Worker tasks live on this computer, so moving their Agent works like+ // a normal task (2026-10-16). An execution-device Worker's task lives on that device;+ // its Agent only moves through the provider group's internal relocation.const providerGroupRelocationOnly =params.providerGroupRelocation === true &¶ms.applyNow === true &&normalizeDbAgentKind(row.agentKind) === makerToDbAgentKind(targetAgentKind) &&row.model === model;- if ((row.orcaRole || parseOrcaRemoteLead(row.orcaRemoteLead)) &&+ if (parseOrcaRemoteLead(row.orcaRemoteLead) &¶ms.agentDeviceId !== undefined && !providerGroupRelocationOnly) {throwIpcError('UNSUPPORTED_CAPABILITY', 'agent relocation is not supported for Orca sessions');}diff --git a/apps/desktop/src/renderer/__tests__/orcaModelWindowSelection.test.ts b/apps/desktop/src/renderer/__tests__/orcaModelWindowSelection.test.tsindex fac795f169..e7e4d1ff1a 100644--- a/apps/desktop/src/renderer/__tests__/orcaModelWindowSelection.test.ts+++ b/apps/desktop/src/renderer/__tests__/orcaModelWindowSelection.test.ts@@ -20,7 +20,8 @@ function visit(node: ts.Node) {visit(source);function setup(options: { agent?: string; role?: string; used?: number; current?: number;- target?: number; remote?: boolean; hostGuard?: boolean; displayedAgent?: string } = {}) {+ target?: number; remote?: boolean; hostGuard?: boolean; displayedAgent?: string;+ agentLocationAware?: boolean } = {}) {const agent = options.agent ?? 'codex';const switchSessionAgent = vi.fn(async () => ({ deferred: true, switched: false }));const release = vi.fn();@@ -33,7 +34,7 @@ function setup(options: { agent?: string; role?: string; used?: number; current?activeModel: 'old-model', effectiveSourceId: 'old-provider', activeEffort: 'high',deviceLinkDeviceId: options.remote ? 'remote' : undefined, remoteHostId: null,currentSessionIdRef: { current: 's1' },- agentLocationAware: false, agentDeviceId: null, effectiveAgentDeviceId: null,+ agentLocationAware: options.agentLocationAware ?? false, agentDeviceId: null, effectiveAgentDeviceId: null,providers: [], remoteProviders: { providers: [] }, modelMemory: null,ccCaps: { capabilities: {} }, codexCaps: { capabilities: {} },piCaps: { capabilities: { supportsModelWindowSwitchGuard: options.hostGuard !== false } },@@ -51,7 +52,7 @@ function setup(options: { agent?: string; role?: string; used?: number; current?resolveRequestedEffort: () => 'high', getRememberedEffort: () => undefined, resolveFastSupported: () => false,makerApiFor: () => ({ switchSessionAgent }), makerApiForDevice: () => ({ switchSessionAgent }),resolveAgentSwitchAckAction: () => 'apply-intent', isAgentSwitchEchoConfigConsistent: () => true,- syncSessionDraftModelPrefs: vi.fn(), mapIpcErrorToI18nKey: (error: unknown) => { throw error; },+ syncSessionDraftModelPrefs: vi.fn(), rememberCatalogModelPrefs: vi.fn(), taskComputerModelMemory: null, mapIpcErrorToI18nKey: (error: unknown) => { throw error; },};const compiled = ts.transpileModule(`const confirmModelSwitchContextGuard = ${callbacks.get('confirmModelSwitchContextGuard')};return ${callbacks.get('performAgentSwitch')};`, { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText;@@ -124,6 +125,17 @@ describe('Orca same-Agent window preflight', () => {expect(h.confirmDialog).not.toHaveBeenCalled();});+ it('skips the window preflight when the pick moves the Agent to another computer', async () => {+ for (const role of ['lead', 'worker']) {+ const h = setup({ role, agentLocationAware: true });+ expect(await h.pick('codex', 'small', 'provider', { agentDeviceId: 'share:alice-share' })).toBe(true);+ expect(h.confirmDialog).not.toHaveBeenCalled();+ expect(h.bindings.resolveProviderModelContextWindow).not.toHaveBeenCalled();+ expect(h.switchSessionAgent).toHaveBeenCalledWith('s1', 'codex', 'small', 'provider', 'high', false,+ { agentDeviceId: 'share:alice-share' });+ }+ });+it('does not register a choice if the user leaves the session during confirmation', async () => {const h = setup();h.confirmDialog.mockImplementation(async () => { h.bindings.currentSessionIdRef.current = 's2'; return true; });diff --git a/apps/desktop/src/renderer/__tests__/remoteAgentRelocationWiring.test.ts b/apps/desktop/src/renderer/__tests__/remoteAgentRelocationWiring.test.tsindex 29150ada79..d46a184951 100644--- a/apps/desktop/src/renderer/__tests__/remoteAgentRelocationWiring.test.ts+++ b/apps/desktop/src/renderer/__tests__/remoteAgentRelocationWiring.test.ts@@ -91,7 +91,9 @@ describe('ChatInput:换位置进切换事务', () => {it('只对本机任务、或支持远程 Agent 的被控端任务开放,且要能走切换事务', () => {expect(chatInputSource).toContain(- 'if (!sessionId || !agentLocationAware || remoteHostId || !sessionEngineFilter ||\n sessionOrcaRole !== null || sessionOrcaRemoteWorker) return undefined;',+ 'if (!sessionId || !agentLocationAware || remoteHostId || !sessionEngineFilter ||\n' ++ ' sessionOrcaRole === undefined || (sessionOrcaRole !== null && deviceLinkDeviceId) ||\n' ++ ' sessionOrcaRemoteWorker) return undefined;',);expect(chatInputSource).toContain('agentDeviceId: selection.agentDevice?.deviceId ?? null,');});@@ -123,9 +125,10 @@ describe('被控电脑上的任务:换 Agent 所在电脑', () => {});it('换位置带给被控端的前提与面板入口同一个判定', () => {- const start = chatInputSource.indexOf('const relocateTo =');+ const start = chatInputSource.indexOf('const resolveRelocateTo = () => {');expect(start).toBeGreaterThan(0);- expect(chatInputSource.slice(start, start + 200)).toContain('agentLocationAware &&');+ expect(chatInputSource.slice(start, start + 400)).toContain('return agentLocationAware &&');+ expect(chatInputSource).toContain('const relocateTo = resolveRelocateTo();');});it('面板不浏览其他电脑时列被控电脑的目录与它的镜像记忆', () => {diff --git a/apps/desktop/src/renderer/__tests__/sessionAgentSwitchRemoteRouting.test.ts b/apps/desktop/src/renderer/__tests__/sessionAgentSwitchRemoteRouting.test.tsindex 68fef629e8..bddd7f0cc9 100644--- a/apps/desktop/src/renderer/__tests__/sessionAgentSwitchRemoteRouting.test.ts+++ b/apps/desktop/src/renderer/__tests__/sessionAgentSwitchRemoteRouting.test.ts@@ -924,19 +924,25 @@ describe('ChatInput 的入口门控与调用路由', () => {expect(supported(undefined, 'codex', null, true, true)).toBe(false);const remoteOptions = source.slice(source.indexOf('const sessionRemoteAgentOptions ='),source.indexOf('// composer pill 尾部引擎小标'));- expect(remoteOptions).toContain('sessionOrcaRole !== null || sessionOrcaRemoteWorker) return undefined;');expect(remoteOptions).toContain(' sessionOrcaRole,');expect(remoteOptions).toContain(' sessionOrcaRemoteWorker,');const relocationGuard = remoteOptions.match(/if \(([\s\S]*?)\) return undefined;/)?.[1];expect(relocationGuard).toBeDefined();- const hidden = new Function('sessionOrcaRole', 'sessionOrcaRemoteWorker',+ const hidden = new Function('sessionOrcaRole', 'sessionOrcaRemoteWorker', 'deviceLinkDeviceId',`const sessionId = 's1', agentLocationAware = true, remoteHostId = null, sessionEngineFilter = {};return !!(${relocationGuard});`);- expect(hidden(null, false)).toBe(false);+ // 本机的 Lead / Worker 与普通任务一样可换 Agent 所在电脑。+ for (const role of [null, 'lead', 'worker']) {+ expect(hidden(role, false, null)).toBe(false);+ }+ // 被控电脑上的协同任务先不开放(旧版被控端会拒绝);普通被控任务不受影响。+ expect(hidden('lead', false, 'host')).toBe(true);+ expect(hidden('worker', false, 'host')).toBe(true);+ expect(hidden(null, false, 'host')).toBe(false);for (const role of [null, 'lead', 'worker', undefined]) {- expect(hidden(role, true)).toBe(true);+ expect(hidden(role, true, null)).toBe(true);}- expect(hidden(undefined, false)).toBe(true);+ expect(hidden(undefined, false, null)).toBe(true);// 会话视图必须保留 undefined 未知态,避免在完整 session 回流前冒充具体身份。const viewSource = readFileSync(resolve(process.cwd(), 'src/renderer/features/cc-agent/CCAgentSessionView.tsx'),diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsxindex 8e3c0746c6..a78afe0bbf 100644--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx@@ -6768,10 +6768,28 @@ export function ChatInput({try {await exclusiveTurn.ready;let confirmedContextWindow: number | undefined;+ // 远程 Agent:这次选择落在哪台电脑。左侧栏点了另一台电脑的目录就用那台;否则沿用已登记+ // 的换位置意图 —— 意图期内在同一份目录里改选,不能被当成原来那台的选择。与任务当前+ // 所在电脑相同 = 位置不变,不带给 main(旧被控端 / 内部调用同样不带)。被控电脑上的任务+ // 只在那台支持远程 Agent 时才带(null = 改回被控电脑)。+ const resolveRelocateTo = () => {+ const pendingAgentDeviceId =+ makerChatStore.getAgentSwitchIntent(sourceSessionId)?.agentDeviceId;+ const requestedAgentDeviceId =+ overrides?.agentDeviceId !== undefined ? overrides.agentDeviceId : pendingAgentDeviceId;+ return agentLocationAware &&+ requestedAgentDeviceId !== undefined &&+ requestedAgentDeviceId !== agentDeviceId+ ? requestedAgentDeviceId+ : undefined;+ };// Same-Agent Orca picks stage instead of calling SET_MODEL. Keep its window// preflight before registration, including same-id provider changes. Effort/// Fast edits of an already selected route do not need another confirmation.- if (sessionOrcaRole && targetAgentKind === runtimeAgentKind && !overrides?.axesOnly &&+ // Moving the Agent to another computer starts a fresh session with a handoff,+ // so the current window does not carry over and needs no preflight.+ if (sessionOrcaRole && resolveRelocateTo() === undefined && targetAgentKind === runtimeAgentKind &&+ !overrides?.axesOnly &&(targetAgentKind !== currentModelAgentKind || newModelId !== activeModel ||providerId !== effectiveSourceId || makerChatStore.getAgentSwitchIntent(sourceSessionId))) {const proceed = await confirmModelSwitchContextGuard(@@ -6782,20 +6800,7 @@ export function ChatInput({writeSeq !== getAgentSwitchWriteSeq(sourceSessionId)) return false;if (typeof proceed === 'number') confirmedContextWindow = proceed;}- // 远程 Agent:这次选择落在哪台电脑。左侧栏点了另一台电脑的目录就用那台;否则沿用已登记- // 的换位置意图 —— 意图期内在同一份目录里改选,不能被当成原来那台的选择。与任务当前- // 所在电脑相同 = 位置不变,不带给 main(旧被控端 / 内部调用同样不带)。被控电脑上的任务- // 只在那台支持远程 Agent 时才带(null = 改回被控电脑)。- const pendingAgentDeviceId =- makerChatStore.getAgentSwitchIntent(sourceSessionId)?.agentDeviceId;- const requestedAgentDeviceId =- overrides?.agentDeviceId !== undefined ? overrides.agentDeviceId : pendingAgentDeviceId;- const relocateTo =- agentLocationAware &&- requestedAgentDeviceId !== undefined &&- requestedAgentDeviceId !== agentDeviceId- ? requestedAgentDeviceId- : undefined;+ const relocateTo = resolveRelocateTo();// 这一行来自当前没在显示的那份目录:档位与 Fast 已由面板按那份目录解析好,原样采用,// 不拿当前目录再解析一遍(同 id 模型两台电脑的档位 / Fast 能力可以不同)。const fromOtherCatalog =@@ -7253,9 +7258,11 @@ export function ChatInput({[agentDeviceId, intentAgentDeviceId, deviceLinkDeviceId, deviceLinkDeviceName, confirmDialog, t],);const sessionRemoteAgentOptions = useMemo<RemoteAgentSelectorOptions | undefined>(() => {- // 本机或能力已确认的被控端任务可换电脑;SSH / Orca 不开放位置选择。+ // 本机或能力已确认的被控端任务可换电脑;SSH 与运行设备 Worker 不开放位置选择。协同的 Lead / Worker+ // 任务在本机,换 Agent 位置与普通任务同一套(2026-10-16);被控电脑上的协同任务旧版会拒绝,先不开放。if (!sessionId || !agentLocationAware || remoteHostId || !sessionEngineFilter ||- sessionOrcaRole !== null || sessionOrcaRemoteWorker) return undefined;+ sessionOrcaRole === undefined || (sessionOrcaRole !== null && deviceLinkDeviceId) ||+ sessionOrcaRemoteWorker) return undefined;if (!remoteAgentDevices || (remoteAgentDevices.length === 0 && !effectiveAgentDeviceId)) {return undefined;}diff --git a/docs/dev-rules/orca-team-architecture.md b/docs/dev-rules/orca-team-architecture.mdindex f48e00c9b5..26e087564c 100644--- a/docs/dev-rules/orca-team-architecture.md+++ b/docs/dev-rules/orca-team-architecture.md@@ -388,13 +388,13 @@ Worker turn 被 vendor 报终止型 error,但 interrupted-turn auto-resume 仍Worker 可以放到同账号另一台电脑(运行设备)上运行:真实任务在那台,本机只有一条不跑 Agent、`working_dir` 为空的代理任务行,`orca_workers.execution_device_id` / `remote_session_id` 记录位置。代理行承接计槽、状态机、auto-bridge 与归档,任何路径都不得在本机为它起 Agent(`bootstrapSession` 对远端 Worker 直接拒绝)、不得把它复制到其他电脑;派活、停止与存活查询经 `orcaRemoteWorkers.ts` 的 `wrapTeamDeps` 分流到运行设备,其余依赖原样透传,不另造状态机。回报靠轮询:派出的消息已进入对话(投递回执 accepted)且设备不在跑时,分页读取 user / assistant 历史,按派活 user 的 clientId 定位对应的最后一条 assistant 回复并按消息 id 去重;后续用户插话的回复和异常状态不得归给此前派活,历史读取期间的新派活不得被旧回报清除。每轮最多扫描 2000 行,预算不足时保留游标下一轮续读,不误判缺少回复;宿主 onAccepted / onAcceptedCommit 完成后才冻结回报身份并允许轮询收尾,accepted 回调失败恢复上一代等待状态,保存旧结果期间不得消费新派活身份或写入其捕获文本。同一远端 Worker 的 enqueue、accepted / commit 和身份确认复用现成 session 发送锁串行执行,避免并发回调与投递顺序错位。用户在运行设备上直接发的消息算插话,不触发回报。设备不可达只是运行期投影(`executionDevice.reachable`),不扩展 `OrcaWorkerStatus`;派活时不可达直接失败,不回退到本机。首版远端 Worker 没有 `send_to_lead` 桥,也不支持 steer / 队列编辑。界面:创建弹窗的「运行设备」只在本机 Lead 上出现(`CreateWorkerPopover` 的 `executionDevicesEnabled`),复用标准下拉列表,以有界滚动和键盘按名称定位应对多设备;选了其他电脑后,工作目录提供「对话 / 指定目录」,「对话」不传 `workingDir`、在运行设备创建不绑定项目的任务,「指定目录」只使用那台电脑上的绝对路径。手机版的新任务「开启协同」与 Lead「创建 Worker」共用设备下拉列表和两种目录模式;设备列表从 Lead 所在电脑读取,Agent、模型和供应商目录从所选运行设备读取。协同面板对远端 Worker 展示运行设备上的真实任务(`RemoteWorkerSessionPane`,先登记归属再读写)。实现指针:`orcaRemoteWorkerRuntime.ts`、`orcaRemoteWorkers.ts`、`orcaWorkerCreationService.ts` 的 `createRemoteWorkerInTeam`、运行设备侧 `orcaRemoteWorkerHost.ts`;协议见 `protocol-compatibility.md`「协同远端 Worker」。11. **Worker 的 Agent 位置:远程供应商与本机供应商一视同仁(状态:不变量,2026-10-10 用户裁决)**- 与上一条「运行设备」不同,这里任务、目录、命令与文件都留在 Lead 所在电脑,只有 Worker 的 Agent 在另一台同账号电脑或分享来的供应商上运行(与普通任务的远程 Agent 同一机制,`sessions.agent_device_id`)。每个 Worker 可以单独选位置:`OrcaWorkerCreateParams.agentDeviceId` 不传 = 跟 Lead(旧调用方、旧控制端与 MCP 省略时都走这里),`null` = 任务所在电脑,string = 那台电脑或 `share:<id>`;等于本机设备 id 时按 `null`。模型与来源按 Worker 自己的位置读目录(那台只列允许被远程调用的供应商),只有与 Lead 同一位置时才沿用 Lead 的来源(来源 id 在不同电脑上不是一回事);Agent 在另一台时不按本机的 Cindy AI key 判预算模型。那台读不到目录在占槽与启动前失败(`REMOTE_AGENT_DEVICE_UNREACHABLE` / `REMOTE_AGENT_SHARE_*`),不回退到本机。SSH Lead 与运行设备 Worker 不能再指定另一台(`INVALID_PARAMS`),插件任务只能跟 Lead 或留在任务所在电脑。入口一处一套:桌面「创建 Worker / 开启协同」弹窗与新建任务用同一个模型面板,任务所在电脑的供应商之后列其他电脑与分享(`useWorkerAgentDevices`),选中哪一行 Worker 的 Agent 就在哪运行,默认选中 Lead 的位置;选了远程就不提供运行设备,选了运行设备回到任务所在电脑。远程选择不写本机 Worker 偏好,档位记在本机为那台单独记的一份(`agentDeviceModelMemory`)。手机同口径(`useOrcaWorkerForm` 的 `agentDeviceId`,模型面板 `remote` 与新建任务同一份 `useRemoteAgentCatalogs`),被控电脑声明 `supportsOrcaWorkerAgentDevice` 时新建任务的远程供应商与协同不再互斥。Lead 的 `list_available_models` 可按 `agent_device_id` 列那里的模型并给出 `locations`,`create_worker` / `create_workers` 用同一个 `agent_device_id`。Worker 列表投影 `session.agentDeviceId`,桌面 Worker 头像叠与远程任务同款的单波纹 + 点;手机 Worker 行保持原来的状态圆点,不加远程标识(2026-10-11 用户要求维持原样)。已开始的 Worker 不能由用户中途换 Agent 位置;Agent/模型选择在下一次发送边界应用;供应商组为它换电脑是唯一例外,见第 12 条。实现指针:`orcaWorkerCreationService.ts` 的 `resolveWorkerAgentDeviceId` / `agentDeviceCatalogFailure`,`register.ts` 的 `listWorkerAgentLocations` 与 `listAvailableModels`,renderer `CreateWorkerPopover.tsx`、`hooks/useWorkerAgentDevices.ts`;协议见 `protocol-compatibility.md`「协同 Worker 的 Agent 位置」。+ 与上一条「运行设备」不同,这里任务、目录、命令与文件都留在 Lead 所在电脑,只有 Worker 的 Agent 在另一台同账号电脑或分享来的供应商上运行(与普通任务的远程 Agent 同一机制,`sessions.agent_device_id`)。每个 Worker 可以单独选位置:`OrcaWorkerCreateParams.agentDeviceId` 不传 = 跟 Lead(旧调用方、旧控制端与 MCP 省略时都走这里),`null` = 任务所在电脑,string = 那台电脑或 `share:<id>`;等于本机设备 id 时按 `null`。模型与来源按 Worker 自己的位置读目录(那台只列允许被远程调用的供应商),只有与 Lead 同一位置时才沿用 Lead 的来源(来源 id 在不同电脑上不是一回事);Agent 在另一台时不按本机的 Cindy AI key 判预算模型。那台读不到目录在占槽与启动前失败(`REMOTE_AGENT_DEVICE_UNREACHABLE` / `REMOTE_AGENT_SHARE_*`),不回退到本机。SSH Lead 与运行设备 Worker 不能再指定另一台(`INVALID_PARAMS`),插件任务只能跟 Lead 或留在任务所在电脑。入口一处一套:桌面「创建 Worker / 开启协同」弹窗与新建任务用同一个模型面板,任务所在电脑的供应商之后列其他电脑与分享(`useWorkerAgentDevices`),选中哪一行 Worker 的 Agent 就在哪运行,默认选中 Lead 的位置;选了远程就不提供运行设备,选了运行设备回到任务所在电脑。远程选择不写本机 Worker 偏好,档位记在本机为那台单独记的一份(`agentDeviceModelMemory`)。手机同口径(`useOrcaWorkerForm` 的 `agentDeviceId`,模型面板 `remote` 与新建任务同一份 `useRemoteAgentCatalogs`),被控电脑声明 `supportsOrcaWorkerAgentDevice` 时新建任务的远程供应商与协同不再互斥。Lead 的 `list_available_models` 可按 `agent_device_id` 列那里的模型并给出 `locations`,`create_worker` / `create_workers` 用同一个 `agent_device_id`。Worker 列表投影 `session.agentDeviceId`,桌面 Worker 头像叠与远程任务同款的单波纹 + 点;手机 Worker 行保持原来的状态圆点,不加远程标识(2026-10-11 用户要求维持原样)。已开始的 Lead 与 Worker 可以由用户在模型列表里换 Agent 位置(本机供应商、其他电脑、分享来的供应商一起列出),与普通任务同一套换电脑事务:选择先登记为意图,下一次发送边界全量交接后在新位置重建,协同身份不变(2026-10-16 用户裁决:任务都在本机,只换供应商所在电脑,不应排除)。运行设备 Worker 与 SSH 任务仍不开放;被控电脑上的协同任务暂不在控制端开放(旧版被控端会拒绝),手机端同样暂未开放。供应商组为任务换电脑见第 12 条。实现指针:`orcaWorkerCreationService.ts` 的 `resolveWorkerAgentDeviceId` / `agentDeviceCatalogFailure`,`register.ts` 的 `listWorkerAgentLocations` 与 `listAvailableModels`,renderer `CreateWorkerPopover.tsx`、`hooks/useWorkerAgentDevices.ts`;协议见 `protocol-compatibility.md`「协同 Worker 的 Agent 位置」。12. **协同任务归供应商组,换电脑不丢回报(状态:不变量,2026-10-10 用户裁决)**Lead 与 Worker 与普通任务一样归供应商组分配、出问题时自动换电脑(产品口径见 `docs/product-rules/provider-groups.md` §6.1「协同任务」),只有审查任务仍排除(`readProviderGroupSessionRow`)。要点:- **新 Worker 也分配**:Worker 的任务记录由启动这一步写入,分配时还读不到,`applyProviderGroupAssignment` 用启动参数作为「从没运行过」的快照(`assignBeforeStart` 的 `startRow`);记录已存在时以记录为准。- **跟 Lead 就是跟 Lead 的组**:Lead 有组绑定、Worker 选的位置就是 Lead 现在所在且来源没另选(或选的就是 Lead 现在的来源 / 组那一项)、同一种 Agent 时,Worker 改用组那一项(本机的组:任务所在电脑 + 组的供应商;另一台电脑上的组:那台 + 组的供应商),再由组按策略选电脑;组那一项不提供该模型或读不到时照旧跟 Lead 所在那台。`list_available_models` 不指定位置时同口径。实现:`OrcaLeadSessionSnapshot.providerGroupEntry`、`leadProviderGroupFollowCandidate`。- - **只放行组的换位置**:`performSessionAgentSwitch` 允许协同任务在原 Agent 位置切换 Agent/模型;显式改变 `agentDeviceId` 仍只接受 main 内部带 `providerGroupRelocation` 的 applyNow 调用,且引擎与模型都不变;该标记不从 IPC 读取。+ - **换位置的入口**:Lead 与本机 Worker 显式改变 `agentDeviceId` 与普通任务一样走 `performSessionAgentSwitch`(2026-10-16 起,见第 11 条)。运行设备 Worker(`orcaRemoteLead`)的显式 `agentDeviceId` 仍只接受 main 内部带 `providerGroupRelocation` 的 applyNow 调用,且引擎与模型都不变;该标记不从 IPC 读取。- **换电脑资格与等额度恢复分开**:组的 `isFailoverEligible` 用 `isProviderGroupFailoverEligible`(Worker 可换),额度恢复后自动继续仍用 `isUsageLimitAutoResumeEligible`(Worker 不等,失败交给 Lead)。- **换过去仍是成员**:`bootstrapSwitchedSession` 对协同任务调 `synthesizeOrcaVendorOptionsFromDb`,新会话带着协同身份、提示词与 `cindy_orca` / `orca_worker_bridge`,不靠下一次发送二次重启。- **Worker 终态按换电脑那次登记结算**(与 5a 同一原则):输入协调器登记「先不呈现」期间,Worker 的终态不调 `handleWorkerTerminalTurn`,而是按登记 id 暂存(`provider-group/heldWorkerTerminals.ts`;error 事件随 error 行一起暂存,只以 done 收尾的失败在 terminal 末尾暂存)。换成了(续跑已发出)丢掉,auto-bridge pending 保留到续跑那一轮的产品终态再回报;没换成、迟迟没有结局或有人接手时恰好一次回报这次异常终止,账号已切换则不回报。迟到的旧结算只认自己那次登记。diff --git a/docs/product-rules/provider-groups.md b/docs/product-rules/provider-groups.mdindex ca108c8451..0faa375daa 100644--- a/docs/product-rules/provider-groups.md+++ b/docs/product-rules/provider-groups.md@@ -332,7 +332,8 @@少见的时序例外:错误早于这一轮的用户消息落库完成到达时,错误卡与红点在判断之前已经出现,换电脑期间只是不再挂横幅。- 换过去之后任务固定在新电脑上,原电脑恢复后也不换回去(每换一次都要重新交接)。- **协同任务**(2026-10-10):Lead 与 Worker 都按上面的规则分配和换电脑,引擎与模型不变、只换 Agent 所在电脑;- 用户仍不能中途给协同任务换模型或换位置(`docs/dev-rules/orca-team-architecture.md`)。+ 用户也可以像普通任务一样在模型列表里给 Lead 与 Worker 换模型、换位置(2026-10-16 用户裁决;运行设备 Worker+ 除外,见 `docs/dev-rules/orca-team-architecture.md` 第 11 条)。- 新建的 Worker 跟普通新任务一样按组策略选电脑。Worker 跟着 Lead(没另选位置,或选的就是 Lead 现在所在那台)而 Lead 用的是组那一项时,Worker 跟的是这个组,不是 Lead 这次落到的那台;组那一项不提供所选模型时照旧跟 Lead所在那台。Lead 的 `list_available_models` 不指定位置时同样列组那一项所在电脑的模型。