Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(orca): 协同面板支持选择运行设备并展示远端 Worker
DavidShen3b7f612697ef
diff --git a/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsxindex e60b5cc130..522383fe5e 100644--- a/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx@@ -5,7 +5,7 @@ import { useModelPickerAgents } from '@/hooks/useAvailableAgents';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { useNavigate } from 'react-router-dom';-import { Info, TriangleAlert, X } from 'lucide-react';+import { Info, Laptop, Monitor, TriangleAlert, X } from 'lucide-react';import { requiresFullAccessConfirmation } from '@cindy/maker-shared/permission-mode';import {connectedProvidersForAgent,@@ -66,6 +66,43 @@ export interface CreateWorkerForm {initialTask: string;/** 本次 Worker 权限;提交后同时成为下一次创建 Worker 的默认值。 */workerPermissionMode?: OrcaWorkerPermissionMode;+ /** 运行设备(同账号另一台电脑);缺省 = 这台电脑。 */+ executionDeviceId?: string;+ /** 运行设备名,只用于失败提示。 */+ executionDeviceName?: string;+ /** 运行设备上的工作目录;缺省由那台电脑分配。只在指定运行设备时有意义。 */+ workingDir?: string;+}++/** 可放 Worker 的同账号其他电脑(`maker:orca:execution-devices`)。 */+export interface ExecutionDeviceOption {+ deviceId: string;+ name: string;+ platform: string | null;+ /** false = 版本过旧,不可选。 */+ supported: boolean;+}++export function parseExecutionDevices(value: unknown): ExecutionDeviceOption[] {+ const devices = (value as { devices?: unknown } | null)?.devices;+ if (!Array.isArray(devices)) return [];+ return devices.flatMap((item) => {+ const row = item as Record<string, unknown> | null;+ if (!row || typeof row.deviceId !== 'string' || !row.deviceId) return [];+ return [+ {+ deviceId: row.deviceId,+ name: typeof row.name === 'string' && row.name ? row.name : row.deviceId,+ platform: typeof row.platform === 'string' ? row.platform : null,+ supported: row.supported === true,+ },+ ];+ });+}++/** 运行设备的系统未知:接受 POSIX、Windows 盘符与 UNC 绝对路径,是否存在由那台检查。 */+export function isAbsoluteRemoteDir(value: string): boolean {+ return /^(\/|[a-zA-Z]:[\\/]|\\\\)/.test(value);}export interface CreateWorkerPopoverProps {@@ -86,6 +123,8 @@ export interface CreateWorkerPopoverProps {sshRemote?: boolean;/** 开启新协同时必须确认执行端支持权限偏好;已有旧版远程 Team 创建 Worker 仍兼容旧行为。 */requireWorkerPermissionModeSupport?: boolean;+ /** 允许把 Worker 放到同账号另一台电脑运行(仅本机 Lead)。 */+ executionDevicesEnabled?: boolean;}export function CreateWorkerPopover({@@ -95,9 +134,10 @@ export function CreateWorkerPopover({title,submitLabel,className,- deviceId,+ deviceId: leadDeviceId,sshRemote,requireWorkerPermissionModeSupport = false,+ executionDevicesEnabled = false,}: CreateWorkerPopoverProps) {const { t } = useTranslation();const { confirm: confirmDialog } = useConfirmDialog();@@ -118,6 +158,17 @@ export function CreateWorkerPopover({const [prefsRestored, setPrefsRestored] = useState(false);const [isSubmitting, setIsSubmitting] = useState(false);const submittingRef = useRef(false);+ const [executionDevices, setExecutionDevices] = useState<ExecutionDeviceOption[]>([]);+ const [executionDeviceId, setExecutionDeviceId] = useState<string | null>(null);+ const [remoteDirMode, setRemoteDirMode] = useState<'auto' | 'path'>('auto');+ const [remoteDir, setRemoteDir] = useState('');+ // 模型、供应商与能力按 Worker 实际运行的电脑读取:远程控制的 Lead 读它所在的电脑,+ // 选了运行设备则读运行设备。权限档始终跟 Lead 所在电脑的创建偏好走。+ const deviceId = leadDeviceId ?? executionDeviceId ?? undefined;+ const executionDevice = executionDevices.find((d) => d.deviceId === executionDeviceId) ?? null;+ const trimmedRemoteDir = remoteDir.trim();+ const remoteDirInvalid =+ !!executionDevice && remoteDirMode === 'path' && !isAbsoluteRemoteDir(trimmedRemoteDir);const ccCaps = useAgentCapabilities('claude-code', deviceId);const codexCaps = useAgentCapabilities('codex', deviceId);@@ -132,9 +183,9 @@ export function CreateWorkerPopover({const activeCapabilitiesState = agent === 'codex' ? codexCaps : agent === 'pi' ? piCaps : ccCaps;const activeCaps = activeCapabilitiesState.capabilities;const supportsWorkerPermissionModeSelection =- !deviceId || activeCaps?.supportsOrcaWorkerPermissionMode === true;+ !leadDeviceId || activeCaps?.supportsOrcaWorkerPermissionMode === true;const remoteWorkerPermissionModeUnsupported =- !!deviceId+ !!leadDeviceId&& activeCaps !== null&& activeCaps?.supportsOrcaWorkerPermissionMode !== true;const activeModels = useMemo(() => {@@ -284,11 +335,43 @@ export function CreateWorkerPopover({setModel(agentPrefs.model);setEffort(agentPrefs.effort);setFast(agentPrefs.fast);- setProviderSource(deviceId ? null : agentPrefs.providerId);+ setProviderSource(leadDeviceId ? null : agentPrefs.providerId);setInitialTask('');setSelectedWorkerPermissionMode(stored.workerPermissionMode);+ setExecutionDeviceId(null);+ setRemoteDirMode('auto');+ setRemoteDir('');setPrefsRestored(true);- }, [deviceId, open]);+ }, [leadDeviceId, open]);++ // 可选运行设备:每次打开读一次;读不到就只有这台电脑,不提示错误。+ useEffect(() => {+ if (!open || !executionDevicesEnabled) {+ setExecutionDevices([]);+ return;+ }+ let disposed = false;+ void Promise.resolve(window.electronAPI?.localDb?.orcaWorkflows?.listExecutionDevices?.())+ .then((value) => {+ if (!disposed) setExecutionDevices(parseExecutionDevices(value));+ })+ .catch(() => {+ if (!disposed) setExecutionDevices([]);+ });+ return () => {+ disposed = true;+ };+ }, [executionDevicesEnabled, open]);++ const selectExecutionDevice = useCallback(+ (next: string | null) => {+ if (next === executionDeviceId) return;+ setExecutionDeviceId(next);+ // 另一台电脑的模型目录没有本机的来源维度;回到这台电脑时恢复本机记忆的来源。+ setProviderSource(next || leadDeviceId ? null : prefs[agent].providerId);+ },+ [agent, executionDeviceId, leadDeviceId, prefs],+ );useEffect(() => {if (@@ -545,6 +628,7 @@ export function CreateWorkerPopover({activeRole.length <= 32 &&!customRoleError &&!remoteModelListBlocked &&+ !remoteDirInvalid &&(!requireWorkerPermissionModeSupport || !remoteWorkerPermissionModeUnsupported) &&!!currentModel;const resolvedTitle = title ?? t('orca.createWorker.title');@@ -617,6 +701,13 @@ export function CreateWorkerPopover({...(supportsWorkerPermissionModeSelection? { workerPermissionMode: selectedWorkerPermissionMode }: {}),+ ...(executionDevice+ ? {+ executionDeviceId: executionDevice.deviceId,+ executionDeviceName: executionDevice.name,+ ...(remoteDirMode === 'path' ? { workingDir: trimmedRemoteDir } : {}),+ }+ : {}),});} finally {submittingRef.current = false;@@ -640,6 +731,9 @@ export function CreateWorkerPopover({routeEffortMetaFor,selectedWorkerPermissionMode,supportsWorkerPermissionModeSelection,+ executionDevice,+ remoteDirMode,+ trimmedRemoteDir,]);const roleInputRef = useRef<HTMLInputElement>(null);@@ -747,6 +841,19 @@ export function CreateWorkerPopover({)}</div>+ {executionDevices.length > 0 ? (+ <ExecutionDeviceField+ devices={executionDevices}+ selectedId={executionDevice?.deviceId ?? null}+ onSelect={selectExecutionDevice}+ dirMode={remoteDirMode}+ onDirModeChange={setRemoteDirMode}+ dir={remoteDir}+ onDirChange={setRemoteDir}+ dirInvalid={remoteDirInvalid && trimmedRemoteDir.length > 0}+ />+ ) : null}+<div className="mb-4 grid gap-4">{deviceId && remoteProviders.unsupported && (<VendorSegmentedSwitcher@@ -858,7 +965,7 @@ export function CreateWorkerPopover({void updateWorkerPermissionMode(mode as OrcaWorkerPermissionMode)}vendorKey={vendorKey}- deviceId={deviceId}+ deviceId={leadDeviceId}triggerVariant="field"denseariaContext={t('orca.createWorker.permissionLabel')}@@ -905,3 +1012,153 @@ export function CreateWorkerPopover({</Dialog.Root>);}++const FIELD_LABEL_CLASS =+ 'mb-2 text-12 font-medium uppercase tracking-[0.5px] text-[var(--text-tertiary)]';++/** 运行设备单选 + 选了其他电脑时的工作目录(自动分配 / 指定目录)。 */+function ExecutionDeviceField({+ devices,+ selectedId,+ onSelect,+ dirMode,+ onDirModeChange,+ dir,+ onDirChange,+ dirInvalid,+}: {+ devices: ExecutionDeviceOption[];+ selectedId: string | null;+ onSelect: (deviceId: string | null) => void;+ dirMode: 'auto' | 'path';+ onDirModeChange: (mode: 'auto' | 'path') => void;+ dir: string;+ onDirChange: (dir: string) => void;+ dirInvalid: boolean;+}) {+ const { t } = useTranslation();+ const selected = devices.find((d) => d.deviceId === selectedId) ?? null;+ const optionClass = (checked: boolean) =>+ cn(+ 'flex w-full items-center gap-2.5 rounded-full border px-3 py-1.5 text-left text-13 leading-snug transition-colors',+ 'disabled:cursor-not-allowed disabled:opacity-50',+ checked+ ? 'border-[var(--text-secondary)] bg-[var(--surface-chip)] font-medium text-[var(--text-primary)]'+ : 'border-[var(--border-default)] text-[var(--text-secondary)] enabled:hover:bg-[var(--surface-chip)]',+ );+ const segmentClass = (checked: boolean) =>+ cn(+ 'rounded-full border px-3 py-1.5 text-13 leading-none transition-colors',+ checked+ ? 'border-[var(--text-secondary)] bg-[var(--surface-chip)] font-medium text-[var(--text-primary)]'+ : 'border-[var(--border-default)] text-[var(--text-secondary)] hover:bg-[var(--surface-chip)]',+ );+ return (+ <div className="mb-4 grid gap-3" data-testid="worker-execution-device">+ <div>+ <div className={FIELD_LABEL_CLASS}>{t('orca.createWorker.executionDeviceLabel')}</div>+ <div+ className="grid gap-1"+ role="radiogroup"+ aria-label={t('orca.createWorker.executionDeviceLabel')}+ >+ <button+ type="button"+ role="radio"+ aria-checked={selected === null}+ className={optionClass(selected === null)}+ onClick={() => onSelect(null)}+ >+ <Laptop size={14} aria-hidden className="shrink-0" />+ <span className="min-w-0 truncate">{t('orca.createWorker.thisComputer')}</span>+ </button>+ {devices.map((device) => (+ <button+ key={device.deviceId}+ type="button"+ role="radio"+ aria-checked={selected?.deviceId === device.deviceId}+ disabled={!device.supported}+ className={optionClass(selected?.deviceId === device.deviceId)}+ onClick={() => onSelect(device.deviceId)}+ >+ <Monitor size={14} aria-hidden className="shrink-0" />+ <span className="min-w-0 truncate">{device.name}</span>+ <span className="ml-auto shrink-0 text-11 font-normal text-[var(--text-secondary)]">+ {device.supported+ ? t('orca.createWorker.deviceOnline')+ : t('orca.createWorker.deviceNeedsUpdate')}+ </span>+ </button>+ ))}+ </div>+ <p className="mt-1.5 text-11 leading-snug text-[var(--text-secondary)]">+ {t('orca.createWorker.executionDeviceHint')}+ {selected+ ? ` ${t('orca.createWorker.executionDeviceRemoteHint', { device: selected.name })}`+ : ''}+ </p>+ </div>+ {selected ? (+ <div>+ <div className={FIELD_LABEL_CLASS}>+ {t('orca.createWorker.remoteDirLabel', { device: selected.name })}+ </div>+ <div+ className="flex flex-wrap gap-2"+ role="radiogroup"+ aria-label={t('orca.createWorker.remoteDirLabel', { device: selected.name })}+ >+ <button+ type="button"+ role="radio"+ aria-checked={dirMode === 'auto'}+ className={segmentClass(dirMode === 'auto')}+ onClick={() => onDirModeChange('auto')}+ >+ {t('orca.createWorker.remoteDirAuto')}+ </button>+ <button+ type="button"+ role="radio"+ aria-checked={dirMode === 'path'}+ className={segmentClass(dirMode === 'path')}+ onClick={() => onDirModeChange('path')}+ >+ {t('orca.createWorker.remoteDirPath')}+ </button>+ </div>+ {dirMode === 'path' ? (+ <input+ type="text"+ className={cn(+ 'mt-2 w-full rounded-full border bg-transparent px-3 py-1.5 font-mono text-13 leading-none text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] outline-none',+ dirInvalid+ ? 'border-[var(--error-fg)]'+ : 'border-[var(--border-default)] focus:border-[var(--text-secondary)]',+ )}+ placeholder="/Users/…/project"+ aria-label={t('orca.createWorker.remoteDirLabel', { device: selected.name })}+ aria-invalid={dirInvalid}+ value={dir}+ onChange={(e) => onDirChange(e.target.value)}+ />+ ) : null}+ <p+ className={cn(+ 'mt-1.5 text-11 leading-snug',+ dirInvalid ? 'text-[var(--error-fg)]' : 'text-[var(--text-secondary)]',+ )}+ role={dirInvalid ? 'status' : undefined}+ >+ {dirInvalid+ ? t('orca.createWorker.remoteDirInvalid', { device: selected.name })+ : dirMode === 'auto'+ ? t('orca.createWorker.remoteDirAutoHint', { device: selected.name })+ : t('orca.createWorker.remoteDirPathHint', { device: selected.name })}+ </p>+ </div>+ ) : null}+ </div>+ );+}diff --git a/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx b/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsxindex 4f2482d080..6cff2e1203 100644--- a/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx@@ -15,6 +15,7 @@ import { toast } from '@/lib/toast';import { isSidebarWindow } from '@/lib/sidebarWindow';import { CCAgentSessionView } from './CCAgentSessionView';import { CreateWorkerPopover } from './CreateWorkerPopover';+import { RemoteWorkerSessionPane } from './RemoteWorkerSessionPane';import { WorkerListToolbar } from './RolePillDropdown';import { useOrcaWorkerSelection } from './hooks/useOrcaWorkerSelection';import { subscribeNewWorkerShortcut } from './lib/newWorkerShortcut';@@ -93,6 +94,12 @@ export function OrcaWorkerPanel({onSelectionIntentCleared,});const lastAgentIslandPayloadRef = useRef<string | string[] | null>(null);+ const shownWorker = selectedWorkerRecord ?? focusedWorker;+ // 在另一台电脑运行的 Worker:本机代理任务不跑 Agent,展示运行设备上的真实任务。+ const remoteDevice =+ shownWorker && shownWorker.sessionId === workerSessionId+ ? shownWorker.executionDevice+ : undefined;const handleOpenCreate = useCallback(async () => {const result = await refreshCreationState();@@ -185,7 +192,15 @@ export function OrcaWorkerPanel({/></div><div className="chat-rail-compact min-h-0 flex-1">- {workerSessionId ? (+ {workerSessionId && remoteDevice ? (+ <RemoteWorkerSessionPane+ key={workerSessionId}+ leadSessionId={leadSessionId}+ device={remoteDevice}+ viewVisible={viewVisible}+ chatRealtime={chatRealtime}+ />+ ) : workerSessionId ? (<CCAgentSessionViewkey={workerSessionId}sessionIdProp={workerSessionId}@@ -211,6 +226,8 @@ export function OrcaWorkerPanel({onCreate={handleCreateWorker}deviceId={deviceId ?? undefined}sshRemote={sshRemote}+ // 运行设备只在本机 Lead 上可选:远程控制或 SSH 的 Lead 由所在电脑自己决定。+ executionDevicesEnabled={deviceId === null && !sshRemote}/></div>);diff --git a/apps/desktop/src/renderer/features/cc-agent/RemoteWorkerSessionPane.tsx b/apps/desktop/src/renderer/features/cc-agent/RemoteWorkerSessionPane.tsxnew file mode 100644index 0000000000..4332d06161--- /dev/null+++ b/apps/desktop/src/renderer/features/cc-agent/RemoteWorkerSessionPane.tsx@@ -0,0 +1,128 @@+/**+ * 协同面板里在另一台电脑(运行设备)上运行的 Worker。+ *+ * 本机只有一条不跑 Agent 的代理任务;这里登记运行设备上真实任务的归属、读一次任务行,+ * 然后用普通的远程任务视图展示与收发。直接在这里发的消息按插话处理,不回报给 Lead。+ * 设备连不上时只提示,不判失败;恢复后自动重新读取。+ */+import { Folder, Monitor, WifiOff } from 'lucide-react';+import { useEffect, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { Spinner } from '@/components/ui/spinner';+import { getDataOwnerGeneration, isDataOwnerGenerationCurrent } from '@/contexts/dataOwnerGeneration';+import { remoteProjectsStore } from '@/features/device-link/remoteProjectsStore';+import type { Session } from '@/lib/ccAgent.types';++import { CCAgentSessionView } from './CCAgentSessionView';+import type { WorkerExecutionDevice } from './hooks/workerProjectionStore';+import { workerDeviceName } from './RolePillDropdown';++export interface RemoteWorkerSessionPaneProps {+ leadSessionId: string;+ device: WorkerExecutionDevice;+ viewVisible: boolean;+ chatRealtime: boolean;+}++type LoadState = 'loading' | 'ready' | 'failed';++export function RemoteWorkerSessionPane({+ leadSessionId,+ device,+ viewVisible,+ chatRealtime,+}: RemoteWorkerSessionPaneProps) {+ const { t } = useTranslation();+ const [state, setState] = useState<LoadState>('loading');+ const { deviceId, remoteSessionId, reachable } = device;+ const name = workerDeviceName(t, device);++ useEffect(() => {+ let disposed = false;+ const owner = getDataOwnerGeneration();+ setState('loading');+ if (reachable === false) {+ setState('failed');+ return;+ }+ void (async () => {+ const existingOrigin = remoteProjectsStore.getSessionDeviceId(remoteSessionId);+ if (existingOrigin && existingOrigin !== deviceId) throw new Error('Conflicting session owner');+ // 归属必须先于任何读写登记,任务视图才会把请求发到运行设备。+ remoteProjectsStore.pinSessionOrigin(deviceId, remoteSessionId);+ const isReadCurrent = remoteProjectsStore.captureSessionRead(deviceId, remoteSessionId);+ const value = (await window.electronAPI.deviceLink.invoke(deviceId, 'local-db:sessions:get', [+ remoteSessionId,+ ])) as Session | null;+ if (disposed || !isDataOwnerGenerationCurrent(owner)) return;+ if (!value || value.id !== remoteSessionId) throw new Error('Remote worker task not found');+ if (isReadCurrent()) {+ const mirror = remoteProjectsStore+ .getDeviceSessions(deviceId)+ .find((row) => row.id === remoteSessionId);+ remoteProjectsStore.mergeDeviceSessions(+ deviceId,+ mirror?.deviceLinkDeviceName ?? remoteProjectsStore.getDeviceName(deviceId) ?? name,+ [isReadCurrent.mergeActivity(value)],+ );+ }+ setState('ready');+ })().catch(() => {+ if (!disposed) setState('failed');+ });+ return () => {+ disposed = true;+ };+ // name 只用于镜像分片缺名时的兜底,不触发重读。+ }, [deviceId, remoteSessionId, reachable]);++ return (+ <div className="flex h-full min-h-0 flex-col">+ <div+ data-testid="remote-worker-device-bar"+ className="flex min-w-0 shrink-0 items-center gap-3 border-b border-border/40 px-3 py-1.5 text-11 leading-snug text-[var(--text-secondary)]"+ >+ <span className="inline-flex min-w-0 shrink-0 items-center gap-1">+ <Monitor size={12} aria-hidden />+ <span className="truncate">{t('orca.rolePill.executionDevice', { device: name })}</span>+ </span>+ {device.workingDir ? (+ <span className="inline-flex min-w-0 items-center gap-1">+ <Folder size={12} aria-hidden className="shrink-0" />+ <code className="truncate font-mono">{device.workingDir}</code>+ </span>+ ) : null}+ {reachable === false ? (+ <span className="ml-auto inline-flex shrink-0 items-center gap-1 text-[var(--warning-fg)]">+ <WifiOff size={12} aria-hidden />+ {t('orca.rolePill.deviceUnreachable')}+ </span>+ ) : null}+ </div>+ <div className="min-h-0 flex-1">+ {state === 'ready' ? (+ <CCAgentSessionView+ key={`${deviceId}:${remoteSessionId}`}+ sessionIdProp={remoteSessionId}+ compact+ compactToolbar+ viewVisible={viewVisible}+ chatRealtime={chatRealtime}+ navigationMode="sidebar-embedded"+ sidebarTargetSessionId={leadSessionId}+ />+ ) : (+ <div className="flex h-full w-full flex-col items-center justify-center gap-3 px-6 text-center text-13 text-[var(--text-secondary)]">+ {state === 'loading' ? <Spinner size={16} /> : null}+ <p>+ {state === 'loading'+ ? t('orca.split.remoteWorkerLoading', { device: name })+ : t('orca.split.remoteWorkerUnreachable', { device: name })}+ </p>+ </div>+ )}+ </div>+ </div>+ );+}diff --git a/apps/desktop/src/renderer/features/cc-agent/RolePillDropdown.tsx b/apps/desktop/src/renderer/features/cc-agent/RolePillDropdown.tsxindex dda32f0387..e8bbfdbdce 100644--- a/apps/desktop/src/renderer/features/cc-agent/RolePillDropdown.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/RolePillDropdown.tsx@@ -15,7 +15,7 @@ import {type WheelEvent,} from 'react';import { useTranslation } from 'react-i18next';-import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Plus, X, EllipsisVertical } from 'lucide-react';+import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Plus, X, EllipsisVertical, Monitor, WifiOff } from 'lucide-react';import { cn } from '@/lib/utils';import { useAppShortcutDisplay } from '@/hooks/useAppShortcut';import { useReducedMotion } from '@/hooks/useReducedMotion';@@ -23,6 +23,7 @@ import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';import { Tip } from '@/components/ui/tooltip';import { VendorIcon, agentKindToVendor } from '@/components/sidebar/VendorIcon';import type { WorkerInfo } from './hooks/useWorkers';+import type { WorkerExecutionDevice } from './hooks/workerProjectionStore';import { shouldShowWorkerLabel } from './workerLabel';import { clearWorkerAttention, useWorkerAttentionSnapshot } from './lib/workerAttentionStore';@@ -42,15 +43,50 @@ function workerEffortLabel(t: (key: string) => string, effort: string | null): sreturn t(`effortLevels.${effort}`);}+/** 在另一台电脑运行的 Worker:副行先标运行设备,连不上时追加状态,模型名照常可截断。 */+export function workerDeviceName(+ t: (key: string) => string,+ device: WorkerExecutionDevice,+): string {+ return device.deviceName ?? t('orca.rolePill.unknownDevice');+}+function WorkerModelLine({model,effort,+ device,}: {model: string;effort: string | null;+ device?: WorkerExecutionDevice;}) {const { t } = useTranslation();const effortLabel = workerEffortLabel(t, effort);+ if (device) {+ const name = workerDeviceName(t, device);+ return (+ <div className="mt-0.5 mr-7 ml-[26px] flex min-w-0 items-center gap-1.5 text-12 leading-snug text-[var(--text-secondary)]">+ <Tip text={t('orca.rolePill.executionDevice', { device: name })} side="top">+ <span className="inline-flex min-w-0 shrink items-center gap-1">+ <Monitor size={11} aria-hidden className="shrink-0" />+ <span className="truncate">{name}</span>+ </span>+ </Tip>+ {device.reachable === false ? (+ <span className="inline-flex shrink-0 items-center gap-1 text-[var(--warning-fg)]">+ <WifiOff size={11} aria-hidden />+ {t('orca.rolePill.deviceUnreachable')}+ </span>+ ) : (+ <>+ <span className="shrink-0">·</span>+ <span className="min-w-0 truncate">{simplifyModelName(model)}</span>+ {effortLabel ? <span className="shrink-0">· {effortLabel}</span> : null}+ </>+ )}+ </div>+ );+ }// 列表选中行是浅色 chip 底,不能套深色药丸上的 --surface-on-card,// 日间会糊成看不清。副行一律走次级字色。// 菜单有 overflow-x-hidden,整行 nowrap 会把后加的档位裁掉;@@ -284,7 +320,7 @@ function WorkerSummary({)}</div>{!compact && (- <WorkerModelLine model={worker.model} effort={worker.effort} />+ <WorkerModelLine model={worker.model} effort={worker.effort} device={worker.executionDevice} />)}</>);@@ -610,7 +646,7 @@ function WorkerLayoutMenu({</>)}</div>- <WorkerModelLine model={w.model} effort={w.effort} />+ <WorkerModelLine model={w.model} effort={w.effort} device={w.executionDevice} /></button>{/* hover archive ✕ */}<button@@ -1306,7 +1342,7 @@ export function RolePillDropdown({</div>{/* 副行: 简化 model 名 (去 provider 前缀) + 档位文字.各模型档位集合不同,不用信号条假装同一把尺子. */}- <WorkerModelLine model={w.model} effort={w.effort} />+ <WorkerModelLine model={w.model} effort={w.effort} device={w.executionDevice} /></button>{/* hover archive ✕ */}<buttondiff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsxindex a8d737afbc..dd25e8fadf 100644--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx@@ -13,7 +13,11 @@ import {setProviderModelChoice,setProviderModelFast,} from '@/state/providerModelMemory';-import { CreateWorkerPopover } from '../CreateWorkerPopover';+import {+ CreateWorkerPopover,+ isAbsoluteRemoteDir,+ parseExecutionDevices,+} from '../CreateWorkerPopover';const mocks = vi.hoisted(() => ({modelsByAgent: {@@ -1600,3 +1604,113 @@ describe('CreateWorkerPopover', () => {);});});++describe('CreateWorkerPopover execution device', () => {+ const listExecutionDevices = vi.fn();++ beforeEach(() => {+ window.localStorage.clear();+ resetProviderModelMemoryForTest();+ mocks.modelsByAgent.codex = [model('codex/gpt-5.5')];+ mocks.capabilitiesByAgent.codex = { availableModels: [{ id: 'codex/gpt-5.5' }] };+ mocks.localProviders = [];+ mocks.remoteProviders = [];+ mocks.remoteUnsupported = false;+ listExecutionDevices.mockReset();+ listExecutionDevices.mockResolvedValue({+ devices: [+ { deviceId: 'mac-mini', name: 'Mac mini', platform: 'darwin', supported: true },+ { deviceId: 'old-pc', name: 'Old PC', platform: 'win32', supported: false },+ ],+ });+ (window as unknown as { electronAPI: unknown }).electronAPI = {+ localDb: { orcaWorkflows: { listExecutionDevices } },+ };+ });++ afterEach(() => {+ cleanup();+ delete (window as unknown as { electronAPI?: unknown }).electronAPI;+ });++ it('offers other computers only when enabled and the list is not empty', async () => {+ const { unmount } = render(<CreateWorkerPopover open onClose={vi.fn()} onCreate={vi.fn()} />);+ expect(listExecutionDevices).not.toHaveBeenCalled();+ expect(screen.queryByTestId('worker-execution-device')).toBeNull();+ unmount();++ listExecutionDevices.mockResolvedValueOnce({ devices: [] });+ render(<CreateWorkerPopover open executionDevicesEnabled onClose={vi.fn()} onCreate={vi.fn()} />);+ await waitFor(() => expect(listExecutionDevices).toHaveBeenCalledTimes(1));+ expect(screen.queryByTestId('worker-execution-device')).toBeNull();+ });++ it('creates on the chosen computer with its folder and leaves outdated computers unselectable', async () => {+ const onCreate = vi.fn();+ render(<CreateWorkerPopover open executionDevicesEnabled onClose={vi.fn()} onCreate={onCreate} />);++ const thisComputer = await screen.findByRole('radio', { name: 'orca.createWorker.thisComputer' });+ expect(thisComputer.getAttribute('aria-checked')).toBe('true');+ expect((screen.getByRole('radio', { name: /Old PC/ }) as HTMLButtonElement).disabled).toBe(true);++ fireEvent.click(screen.getByRole('radio', { name: /Mac mini/ }));+ // 另一台电脑的模型目录:不接本机来源记忆,也不跳本机供应商设置。+ expect(screen.getByTestId('model-selector').dataset.memoryWired).toBe('false');+ expect(screen.getByTestId('model-selector').dataset.navigateWired).toBe('false');++ fireEvent.click(screen.getByRole('radio', { name: 'orca.createWorker.remoteDirPath' }));+ const dirInput = screen.getByRole('textbox', { name: 'orca.createWorker.remoteDirLabel' });+ const submit = screen.getByRole('button', { name: 'orca.createWorker.submit' }) as HTMLButtonElement;+ fireEvent.change(dirInput, { target: { value: 'Interviews' } });+ expect(submit.disabled).toBe(true);+ expect(screen.getByText('orca.createWorker.remoteDirInvalid')).toBeTruthy();++ fireEvent.change(dirInput, { target: { value: ' /Users/demo/Interviews ' } });+ expect(submit.disabled).toBe(false);+ fireEvent.click(submit);+ await waitFor(() =>+ expect(onCreate).toHaveBeenCalledWith(+ expect.objectContaining({+ executionDeviceId: 'mac-mini',+ executionDeviceName: 'Mac mini',+ workingDir: '/Users/demo/Interviews',+ }),+ ),+ );+ });++ it('lets the device assign the folder and keeps local workers unchanged', async () => {+ const onCreate = vi.fn();+ render(<CreateWorkerPopover open executionDevicesEnabled onClose={vi.fn()} onCreate={onCreate} />);+ fireEvent.click(await screen.findByRole('radio', { name: /Mac mini/ }));+ fireEvent.click(screen.getByRole('button', { name: 'orca.createWorker.submit' }));+ await waitFor(() => expect(onCreate).toHaveBeenCalledTimes(1));+ expect(onCreate.mock.calls[0]![0]).toMatchObject({ executionDeviceId: 'mac-mini' });+ expect(onCreate.mock.calls[0]![0]).not.toHaveProperty('workingDir');++ fireEvent.click(screen.getByRole('radio', { name: 'orca.createWorker.thisComputer' }));+ fireEvent.click(screen.getByRole('button', { name: 'orca.createWorker.submit' }));+ await waitFor(() => expect(onCreate).toHaveBeenCalledTimes(2));+ expect(onCreate.mock.calls[1]![0]).not.toHaveProperty('executionDeviceId');+ });+});++describe('execution device helpers', () => {+ it('parses the device list defensively', () => {+ expect(parseExecutionDevices(null)).toEqual([]);+ expect(+ parseExecutionDevices({+ devices: [{ deviceId: 'a', name: '', platform: 1, supported: 'yes' }, { name: 'no id' }],+ }),+ ).toEqual([{ deviceId: 'a', name: 'a', platform: null, supported: false }]);+ });++ it('accepts absolute paths for any operating system', () => {+ expect(isAbsoluteRemoteDir('/Users/demo')).toBe(true);+ expect(isAbsoluteRemoteDir('D:\\work')).toBe(true);+ expect(isAbsoluteRemoteDir('C:/work')).toBe(true);+ expect(isAbsoluteRemoteDir('\\\\nas\\share')).toBe(true);+ expect(isAbsoluteRemoteDir('~/work')).toBe(false);+ expect(isAbsoluteRemoteDir('work')).toBe(false);+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/OrcaWorkerPanel.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/OrcaWorkerPanel.test.tsxindex 69919e0421..ee2b03b9a1 100644--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/OrcaWorkerPanel.test.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/OrcaWorkerPanel.test.tsx@@ -12,6 +12,10 @@ const mocks = vi.hoisted(() => ({setCreateOpen: vi.fn(),toastError: vi.fn(),toolbarProps: {} as Record<string, unknown>,+ createProps: {} as Record<string, unknown>,+ sessionViewProps: null as Record<string, unknown> | null,+ remotePaneProps: null as Record<string, unknown> | null,+ selection: {} as Record<string, unknown>,}));vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn() }));@@ -19,8 +23,24 @@ vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => kvi.mock('@/hooks/useAgentIslandSettings', () => ({ isAgentIslandSupported: () => false }));vi.mock('@/lib/sidebarWindow', () => ({ isSidebarWindow: () => false }));vi.mock('@/lib/toast', () => ({ toast: { error: mocks.toastError } }));-vi.mock('../CCAgentSessionView', () => ({ CCAgentSessionView: () => null }));-vi.mock('../CreateWorkerPopover', () => ({ CreateWorkerPopover: () => null }));+vi.mock('../CCAgentSessionView', () => ({+ CCAgentSessionView: (props: Record<string, unknown>) => {+ mocks.sessionViewProps = props;+ return null;+ },+}));+vi.mock('../CreateWorkerPopover', () => ({+ CreateWorkerPopover: (props: Record<string, unknown>) => {+ mocks.createProps = props;+ return null;+ },+}));+vi.mock('../RemoteWorkerSessionPane', () => ({+ RemoteWorkerSessionPane: (props: Record<string, unknown>) => {+ mocks.remotePaneProps = props;+ return null;+ },+}));vi.mock('../RolePillDropdown', () => ({WorkerListToolbar: (props: Record<string, unknown>) => {mocks.toolbarProps = props;@@ -45,6 +65,7 @@ vi.mock('../hooks/useOrcaWorkerSelection', () => ({handleSwitchFocus: vi.fn(),handleArchiveWorker: vi.fn(),workerPermissionMode: 'auto',+ ...mocks.selection,}),}));@@ -146,3 +167,74 @@ describe('OrcaWorkerPanel settings navigation wiring', () => {expect(mocks.toolbarProps.onOpenSettings).toBeUndefined();});});++describe('OrcaWorkerPanel worker on another computer', () => {+ afterEach(() => {+ cleanup();+ mocks.selection = {};+ mocks.sessionViewProps = null;+ mocks.remotePaneProps = null;+ });++ const remoteWorker = {+ workerId: 'w-1',+ sessionId: 'proxy-1',+ role: 'transcriber',+ agent: 'claude-code',+ model: 'm',+ effort: null,+ label: null,+ status: 'running',+ focused: true,+ idleSince: null,+ executionDevice: {+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-1',+ deviceName: 'Mac mini',+ reachable: true,+ workingDir: '/Users/demo/Interviews',+ },+ };++ it('shows the task on the execution device instead of the local proxy task', () => {+ mocks.selection = {+ workers: [remoteWorker],+ focusedWorker: remoteWorker,+ selectedWorkerRecord: remoteWorker,+ selectedWorkerId: 'w-1',+ workerSessionId: 'proxy-1',+ };+ render(<OrcaWorkerPanel leadSessionId="lead-1" deviceId={null} viewVisible />);+ expect(mocks.sessionViewProps).toBeNull();+ expect(mocks.remotePaneProps).toMatchObject({+ leadSessionId: 'lead-1',+ device: remoteWorker.executionDevice,+ });+ });++ it('keeps local workers on the local task view', () => {+ const localWorker: Record<string, unknown> = { ...remoteWorker };+ delete localWorker.executionDevice;+ mocks.selection = {+ workers: [localWorker],+ focusedWorker: localWorker,+ selectedWorkerRecord: localWorker,+ selectedWorkerId: 'w-1',+ workerSessionId: 'proxy-1',+ };+ render(<OrcaWorkerPanel leadSessionId="lead-1" deviceId={null} viewVisible />);+ expect(mocks.remotePaneProps).toBeNull();+ expect(mocks.sessionViewProps).toMatchObject({ sessionIdProp: 'proxy-1' });+ });++ it('offers execution devices only for a local, non-SSH Lead', () => {+ const { rerender } = render(<OrcaWorkerPanel leadSessionId="lead-1" deviceId={null} viewVisible />);+ expect(mocks.createProps.executionDevicesEnabled).toBe(true);+ rerender(<OrcaWorkerPanel leadSessionId="lead-1" deviceId={null} sshRemote viewVisible />);+ expect(mocks.createProps.executionDevicesEnabled).toBe(false);+ rerender(<OrcaWorkerPanel leadSessionId="lead-1" deviceId="dev-1" viewVisible />);+ expect(mocks.createProps.executionDevicesEnabled).toBe(false);+ rerender(<OrcaWorkerPanel leadSessionId="lead-1" viewVisible />);+ expect(mocks.createProps.executionDevicesEnabled).toBe(false);+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/RemoteWorkerSessionPane.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/RemoteWorkerSessionPane.test.tsxnew file mode 100644index 0000000000..8dbd5743f6--- /dev/null+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/RemoteWorkerSessionPane.test.tsx@@ -0,0 +1,114 @@+// @vitest-environment jsdom++import { cleanup, render, screen, waitFor } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { RemoteWorkerSessionPane } from '../RemoteWorkerSessionPane';++const mocks = vi.hoisted(() => ({+ invoke: vi.fn(),+ sessionViewProps: null as Record<string, unknown> | null,+ store: {+ getSessionDeviceId: vi.fn<(id: string) => string | undefined>(() => undefined),+ pinSessionOrigin: vi.fn(),+ captureSessionRead: vi.fn(() =>+ Object.assign(() => true, { mergeActivity: (session: unknown) => session }),+ ),+ getDeviceSessions: vi.fn(() => []),+ getDeviceName: vi.fn(() => 'Mac mini'),+ mergeDeviceSessions: vi.fn(),+ },+}));++vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: (key: string, opts?: { device?: string }) => (opts?.device ? `${key}:${opts.device}` : key),+ }),+}));+vi.mock('@/features/device-link/remoteProjectsStore', () => ({ remoteProjectsStore: mocks.store }));+vi.mock('../CCAgentSessionView', () => ({+ CCAgentSessionView: (props: Record<string, unknown>) => {+ mocks.sessionViewProps = props;+ return <div data-testid="session-view" />;+ },+}));++const device = {+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-1',+ deviceName: 'Mac mini',+ reachable: true as boolean | null,+ workingDir: '/Users/demo/Interviews',+};++describe('RemoteWorkerSessionPane', () => {+ beforeEach(() => {+ mocks.invoke.mockReset();+ mocks.sessionViewProps = null;+ Object.values(mocks.store).forEach((fn) => fn.mockClear());+ mocks.store.getSessionDeviceId.mockReturnValue(undefined);+ (window as unknown as { electronAPI: unknown }).electronAPI = {+ deviceLink: { invoke: mocks.invoke },+ };+ });++ afterEach(() => {+ cleanup();+ delete (window as unknown as { electronAPI?: unknown }).electronAPI;+ });++ it('pins the task to the execution device before reading it, then shows it', async () => {+ mocks.invoke.mockResolvedValue({ id: 'remote-1', status: 'active' });+ render(+ <RemoteWorkerSessionPane leadSessionId="lead-1" device={device} viewVisible chatRealtime />,+ );+ expect(screen.getByText('orca.rolePill.executionDevice:Mac mini')).toBeTruthy();+ expect(screen.getByText('/Users/demo/Interviews')).toBeTruthy();+ await screen.findByTestId('session-view');+ expect(mocks.store.pinSessionOrigin).toHaveBeenCalledWith('mac-mini', 'remote-1');+ expect(mocks.store.pinSessionOrigin.mock.invocationCallOrder[0]).toBeLessThan(+ mocks.invoke.mock.invocationCallOrder[0]!,+ );+ expect(mocks.invoke).toHaveBeenCalledWith('mac-mini', 'local-db:sessions:get', ['remote-1']);+ expect(mocks.store.mergeDeviceSessions).toHaveBeenCalledWith('mac-mini', 'Mac mini', [+ { id: 'remote-1', status: 'active' },+ ]);+ expect(mocks.sessionViewProps).toMatchObject({+ sessionIdProp: 'remote-1',+ sidebarTargetSessionId: 'lead-1',+ navigationMode: 'sidebar-embedded',+ });+ });++ it('only explains the situation while the device is unreachable, then recovers', async () => {+ const { rerender } = render(+ <RemoteWorkerSessionPane+ leadSessionId="lead-1"+ device={{ ...device, reachable: false }}+ viewVisible+ chatRealtime+ />,+ );+ expect(screen.getByText('orca.split.remoteWorkerUnreachable:Mac mini')).toBeTruthy();+ expect(screen.getByText('orca.rolePill.deviceUnreachable')).toBeTruthy();+ expect(mocks.invoke).not.toHaveBeenCalled();++ mocks.invoke.mockResolvedValue({ id: 'remote-1', status: 'active' });+ rerender(+ <RemoteWorkerSessionPane leadSessionId="lead-1" device={device} viewVisible chatRealtime />,+ );+ await screen.findByTestId('session-view');+ });++ it('refuses a task already owned by another device', async () => {+ mocks.store.getSessionDeviceId.mockReturnValue('other-pc');+ render(+ <RemoteWorkerSessionPane leadSessionId="lead-1" device={device} viewVisible chatRealtime />,+ );+ await waitFor(() =>+ expect(screen.getByText('orca.split.remoteWorkerUnreachable:Mac mini')).toBeTruthy(),+ );+ expect(mocks.store.pinSessionOrigin).not.toHaveBeenCalled();+ expect(mocks.sessionViewProps).toBeNull();+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/RolePillDropdown.executionDevice.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/RolePillDropdown.executionDevice.test.tsxnew file mode 100644index 0000000000..2e0d471176--- /dev/null+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/RolePillDropdown.executionDevice.test.tsx@@ -0,0 +1,94 @@+// @vitest-environment jsdom++import { cleanup, fireEvent, render, screen } from '@testing-library/react';+import { afterEach, describe, expect, it, vi } from 'vitest';++import type { WorkerInfo } from '../hooks/useWorkers';+import { RolePillDropdown } from '../RolePillDropdown';++vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}));++vi.mock('@/hooks/useAppShortcut', () => ({+ useAppShortcutDisplay: () => '',+}));++vi.mock('@/components/ui/confirm-dialog-provider', () => ({+ useConfirmDialog: () => ({ confirm: vi.fn(async () => false) }),+}));++function worker(overrides: Partial<WorkerInfo> = {}): WorkerInfo {+ return {+ workerId: 'worker-a',+ sessionId: 'proxy-a',+ role: 'transcriber',+ agent: 'claude-code',+ model: 'claude-opus-5-5',+ effort: 'high',+ label: null,+ status: 'running',+ focused: true,+ idleSince: null,+ ...overrides,+ };+}++function openMenu(current: WorkerInfo) {+ render(+ <RolePillDropdown+ worker={current}+ workers={[current]}+ selectedWorkerId={current.workerId}+ activeWorkerCount={1}+ onSwitchFocus={vi.fn()}+ onArchiveWorker={vi.fn()}+ />,+ );+ fireEvent.click(screen.getByRole('button', { name: /transcriber/ }));+}++describe('RolePillDropdown worker on another computer', () => {+ afterEach(() => {+ cleanup();+ });++ it('names the execution device before the model', () => {+ openMenu(+ worker({+ executionDevice: {+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-a',+ deviceName: 'Mac mini',+ reachable: true,+ workingDir: null,+ },+ }),+ );+ expect(screen.getAllByText('Mac mini').length).toBeGreaterThan(0);+ expect(screen.getAllByText('claude-opus-5-5').length).toBeGreaterThan(0);+ expect(screen.queryByText('orca.rolePill.deviceUnreachable')).toBeNull();+ });++ it('shows that status is unavailable instead of the model while unreachable', () => {+ openMenu(+ worker({+ executionDevice: {+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-a',+ deviceName: null,+ reachable: false,+ workingDir: null,+ },+ }),+ );+ expect(screen.getAllByText('orca.rolePill.unknownDevice').length).toBeGreaterThan(0);+ expect(screen.getAllByText('orca.rolePill.deviceUnreachable').length).toBeGreaterThan(0);+ });++ it('leaves local workers unchanged', () => {+ openMenu(worker());+ expect(screen.queryByText('orca.rolePill.unknownDevice')).toBeNull();+ expect(screen.getAllByText('claude-opus-5-5').length).toBeGreaterThan(0);+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/collaborationErrors.test.ts b/apps/desktop/src/renderer/features/cc-agent/__tests__/collaborationErrors.test.tsindex b00814efd7..ebfe852d04 100644--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/collaborationErrors.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/collaborationErrors.test.ts@@ -1,7 +1,10 @@import type { TFunction } from 'i18next';import { describe, expect, it } from 'vitest';-import { getCollaborationStartErrorMessage } from '../collaborationErrors';+import {+ executionDeviceErrorMessage,+ getCollaborationStartErrorMessage,+} from '../collaborationErrors';const t = ((key: string) => key) as unknown as TFunction;@@ -47,3 +50,22 @@ describe('getCollaborationStartErrorMessage', () => {).toBe('newChat.collaboration.unsupportedRemoteHint');});});++describe('executionDeviceErrorMessage', () => {+ it('explains why a Worker could not be created on another computer', () => {+ expect(+ executionDeviceErrorMessage(new Error('[REMOTE_AGENT_DEVICE_UNREACHABLE] x'), t, 'Mac mini', false),+ ).toBe('orca.createWorker.errors.deviceUnreachable');+ expect(+ executionDeviceErrorMessage(new Error('[UNSUPPORTED_CAPABILITY] x'), t, 'Mac mini', false),+ ).toBe('orca.createWorker.errors.deviceOutdated');+ expect(+ executionDeviceErrorMessage(new Error('[INVALID_PARAMS] x'), t, 'Mac mini', true),+ ).toBe('orca.createWorker.errors.dirRejected');+ });++ it('falls back to the generic collaboration message for anything else', () => {+ expect(executionDeviceErrorMessage(new Error('[INVALID_PARAMS] x'), t, 'Mac mini', false)).toBeNull();+ expect(executionDeviceErrorMessage(new Error('[INTERNAL] x'), t, undefined, true)).toBeNull();+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/collaborationErrors.ts b/apps/desktop/src/renderer/features/cc-agent/collaborationErrors.tsindex 9ee89e0f03..dd1716ce40 100644--- a/apps/desktop/src/renderer/features/cc-agent/collaborationErrors.ts+++ b/apps/desktop/src/renderer/features/cc-agent/collaborationErrors.ts@@ -52,3 +52,23 @@ export function getCollaborationStartErrorMessage(}return base;}++/** 运行设备(另一台电脑)创建失败时的具体原因;其余错误沿用协同通用文案。 */+export function executionDeviceErrorMessage(+ err: unknown,+ t: TFunction,+ deviceName: string | undefined,+ withDir: boolean,+): string | null {+ const device = deviceName || t('orca.rolePill.unknownDevice');+ switch (extractIpcError(err)?.code) {+ case 'REMOTE_AGENT_DEVICE_UNREACHABLE':+ return t('orca.createWorker.errors.deviceUnreachable', { device });+ case 'UNSUPPORTED_CAPABILITY':+ return t('orca.createWorker.errors.deviceOutdated', { device });+ case 'INVALID_PARAMS':+ return withDir ? t('orca.createWorker.errors.dirRejected', { device }) : null;+ default:+ return null;+ }+}diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/__tests__/useWorkers.test.tsx b/apps/desktop/src/renderer/features/cc-agent/hooks/__tests__/useWorkers.test.tsxindex 57d41839cc..c4356dc77b 100644--- a/apps/desktop/src/renderer/features/cc-agent/hooks/__tests__/useWorkers.test.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/__tests__/useWorkers.test.tsx@@ -131,6 +131,35 @@ describe('useWorkers / worker projection store', () => {vi.useRealTimers();});+ it('projects the execution device of a worker running on another computer', async () => {+ mocks.listWorkersByLeads.mockResolvedValue({+ 'lead-1': [+ {+ ...workerRecord('worker-a', 'proxy-a', true, 'running'),+ executionDevice: {+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-a',+ deviceName: 'Mac mini',+ reachable: false,+ workingDir: '/Users/demo/Interviews',+ },+ },+ { ...workerRecord('worker-b', 'session-b'), executionDevice: { deviceId: 'x' } },+ ],+ });+ const hook = renderHook(() => useWorkers('lead-1'));+ await waitFor(() => expect(hook.result.current.workers).toHaveLength(2));+ expect(hook.result.current.workers[0]!.executionDevice).toEqual({+ deviceId: 'mac-mini',+ remoteSessionId: 'remote-a',+ deviceName: 'Mac mini',+ reachable: false,+ workingDir: '/Users/demo/Interviews',+ });+ // 缺远端任务 id 的记录不当成远端 Worker。+ expect(hook.result.current.workers[1]).not.toHaveProperty('executionDevice');+ });+it('hydrates local N lead projections through one batch IPC', async () => {const sessions = [leadSession('lead-1'), leadSession('lead-2')];const hook = renderHook(() => useOrcaLeadWorkerMap(sessions));diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/useOrcaWorkerSelection.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/useOrcaWorkerSelection.tsindex 8fb58578cf..7910fbc11d 100644--- a/apps/desktop/src/renderer/features/cc-agent/hooks/useOrcaWorkerSelection.ts+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/useOrcaWorkerSelection.ts@@ -11,7 +11,10 @@ import {type ConversationSearchJump,} from '../../../../shared/conversationSearchJump';import type { CreateWorkerForm } from '../CreateWorkerPopover';-import { getCollaborationStartErrorMessage } from '../collaborationErrors';+import {+ executionDeviceErrorMessage,+ getCollaborationStartErrorMessage,+} from '../collaborationErrors';import { createWorkerLabel } from '../workerLabel';import { useWorkers } from './useWorkers';import { clearWorkerAttention } from '../lib/workerAttentionStore';@@ -312,6 +315,12 @@ export function useOrcaWorkerSelection({// null(未显式选来源)不传字段:IPC 侧只认非空 string 为显式来源。providerId: form.providerId ?? undefined,workerPermissionMode: form.workerPermissionMode,+ ...(form.executionDeviceId+ ? {+ executionDeviceId: form.executionDeviceId,+ ...(form.workingDir ? { workingDir: form.workingDir } : {}),+ }+ : {}),label,initialTask: form.initialTask || undefined,});@@ -325,7 +334,9 @@ export function useOrcaWorkerSelection({continue;}toast.error(- getCollaborationStartErrorMessage(err, t, { remoteDevice: Boolean(deviceId) }),+ (form.executionDeviceId &&+ executionDeviceErrorMessage(err, t, form.executionDeviceName, Boolean(form.workingDir)))+ || getCollaborationStartErrorMessage(err, t, { remoteDevice: Boolean(deviceId) }),);return;}diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/workerProjectionStore.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/workerProjectionStore.tsindex 5e3f879efc..d09a4ddd60 100644--- a/apps/desktop/src/renderer/features/cc-agent/hooks/workerProjectionStore.ts+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/workerProjectionStore.ts@@ -23,6 +23,33 @@ export interface WorkerInfo {status: OrcaWorkerStatus;focused: boolean;idleSince: string | null;+ /** 在同账号另一台电脑运行的 Worker;本机 Worker 无此字段。 */+ executionDevice?: WorkerExecutionDevice;+}++export interface WorkerExecutionDevice {+ deviceId: string;+ /** 运行设备上的真实任务 id;sessionId 是本机不跑 Agent 的代理任务。 */+ remoteSessionId: string;+ deviceName: string | null;+ /** false = 暂时无法获取状态;null = 尚未探测。 */+ reachable: boolean | null;+ workingDir: string | null;+}++function mapExecutionDevice(raw: unknown): WorkerExecutionDevice | undefined {+ if (!raw || typeof raw !== 'object') return undefined;+ const value = raw as Record<string, unknown>;+ if (typeof value.deviceId !== 'string' || typeof value.remoteSessionId !== 'string') {+ return undefined;+ }+ return {+ deviceId: value.deviceId,+ remoteSessionId: value.remoteSessionId,+ deviceName: typeof value.deviceName === 'string' && value.deviceName ? value.deviceName : null,+ reachable: typeof value.reachable === 'boolean' ? value.reachable : null,+ workingDir: typeof value.workingDir === 'string' && value.workingDir ? value.workingDir : null,+ };}export interface WorkersSnapshot {@@ -166,6 +193,9 @@ function mapWorkerRecord(raw: Record<string, unknown>): WorkerInfo {status: (raw.status as WorkerInfo['status']) ?? 'idle',focused: (raw.focused as boolean) ?? false,idleSince: (raw.idleSince as string | null) ?? null,+ ...(mapExecutionDevice(raw.executionDevice)+ ? { executionDevice: mapExecutionDevice(raw.executionDevice) }+ : {}),};}diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 53275d4892..077d41cb8c 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -13426,7 +13426,24 @@"optional": "(optional)","initialTaskPlaceholder": "Optional first task for this worker","enableCollabTitle": "Start Collaboration",- "enableCollabSubmit": "Start Collaboration"+ "enableCollabSubmit": "Start Collaboration",+ "executionDeviceLabel": "Run on",+ "thisComputer": "This computer",+ "deviceOnline": "Online",+ "deviceNeedsUpdate": "Needs update",+ "executionDeviceHint": "Only computers on this account that are online and have remote control enabled are listed.",+ "executionDeviceRemoteHint": "The Worker's task, folder and commands all stay on {{device}}.",+ "remoteDirLabel": "Folder on {{device}}",+ "remoteDirAuto": "Assign automatically",+ "remoteDirPath": "Specify folder",+ "remoteDirAutoHint": "{{device}} assigns the task folder using its own settings.",+ "remoteDirPathHint": "Checked on {{device}}. If it doesn't exist, creation fails; a folder on this computer is never used instead.",+ "remoteDirInvalid": "Enter an absolute path on {{device}}.",+ "errors": {+ "deviceUnreachable": "{{device}} isn't available: it must be online with remote control enabled. The Worker wasn't created.",+ "deviceOutdated": "Cindy on {{device}} is out of date. Update it to run Workers there.",+ "dirRejected": "The folder wasn't found on {{device}} or can't be used. The Worker wasn't created."+ }},"rolePill": {"unread": "Unread update",@@ -13449,13 +13466,18 @@"scrollWorkersLeftEdge": "Already at the earliest worker","scrollWorkersRightEdge": "Already at the latest worker","errorBadge": "ERR",- "errorBadgeAria": "A worker has an error"+ "errorBadgeAria": "A worker has an error",+ "executionDevice": "Runs on {{device}}",+ "deviceUnreachable": "Status unavailable",+ "unknownDevice": "Another computer"},"split": {"leadLabel": "Lead ({{agent}})","workerLabel": "Worker ({{agent}})","leadNotFound": "Orca lead session not found","waitingForWorker": "Waiting for worker",+ "remoteWorkerLoading": "Loading the task on {{device}}…",+ "remoteWorkerUnreachable": "{{device}} can't be reached right now. This Worker's task will appear again once it reconnects.","closeAria": "Close"}},diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex b8d861bb88..389fd3f549 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -13397,7 +13397,24 @@"optional": "(任意)","initialTaskPlaceholder": "この Worker に渡す任意の最初のタスク","enableCollabTitle": "コラボレーションを開始",- "enableCollabSubmit": "コラボレーションを開始"+ "enableCollabSubmit": "コラボレーションを開始",+ "executionDeviceLabel": "実行デバイス",+ "thisComputer": "このコンピューター",+ "deviceOnline": "オンライン",+ "deviceNeedsUpdate": "要アップデート",+ "executionDeviceHint": "同じアカウントで、オンラインかつリモート操作が有効なコンピューターのみ表示します。",+ "executionDeviceRemoteHint": "Worker のタスク、フォルダー、コマンドはすべて {{device}} 上にあります。",+ "remoteDirLabel": "{{device}} 上の作業フォルダー",+ "remoteDirAuto": "自動で割り当て",+ "remoteDirPath": "フォルダーを指定",+ "remoteDirAutoHint": "{{device}} が自身の設定でタスクのフォルダーを割り当てます。",+ "remoteDirPathHint": "{{device}} 上で確認します。存在しない場合はエラーになり、このコンピューターのフォルダーに置き換えることはありません。",+ "remoteDirInvalid": "{{device}} 上の絶対パスを入力してください。",+ "errors": {+ "deviceUnreachable": "{{device}} は現在使用できません。オンラインでリモート操作が有効になっている必要があります。Worker は作成されていません。",+ "deviceOutdated": "{{device}} の Cindy が古いため、アップデートすると Worker を実行できます。",+ "dirRejected": "{{device}} 上にこのフォルダーが見つからないか、使用できません。Worker は作成されていません。"+ }},"rolePill": {"unread": "未読の更新",@@ -13419,13 +13436,18 @@"scrollWorkersLeftEdge": "すでに先頭の Worker を表示しています","scrollWorkersRightEdge": "すでに末尾の Worker を表示しています","errorBadge": "エラー",- "errorBadgeAria": "エラーが発生した Worker があります"+ "errorBadgeAria": "エラーが発生した Worker があります",+ "executionDevice": "{{device}} で実行",+ "deviceUnreachable": "状態を取得できません",+ "unknownDevice": "別のコンピューター"},"split": {"leadLabel": "Lead ({{agent}})","workerLabel": "Worker ({{agent}})","leadNotFound": "Orca lead session が見つかりません","waitingForWorker": "Worker を待機中",+ "remoteWorkerLoading": "{{device}} 上のタスクを読み込み中…",+ "remoteWorkerUnreachable": "{{device}} に現在接続できません。再接続すると、この Worker のタスクが再び表示されます。","closeAria": "閉じる"}},diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex e8c3ece04c..c99e2ab5ca 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -13397,7 +13397,24 @@"optional": "(선택)","initialTaskPlaceholder": "이 Worker 에게 보낼 선택적 첫 작업","enableCollabTitle": "협업 시작",- "enableCollabSubmit": "협업 시작"+ "enableCollabSubmit": "협업 시작",+ "executionDeviceLabel": "실행 기기",+ "thisComputer": "이 컴퓨터",+ "deviceOnline": "온라인",+ "deviceNeedsUpdate": "업데이트 필요",+ "executionDeviceHint": "같은 계정에서 온라인이고 원격 제어를 켠 컴퓨터만 표시됩니다.",+ "executionDeviceRemoteHint": "Worker의 작업, 폴더, 명령은 모두 {{device}}에 있습니다.",+ "remoteDirLabel": "{{device}}의 작업 폴더",+ "remoteDirAuto": "자동 할당",+ "remoteDirPath": "폴더 지정",+ "remoteDirAutoHint": "{{device}}가 자체 설정으로 작업 폴더를 할당합니다.",+ "remoteDirPathHint": "{{device}}에서 확인합니다. 없으면 오류가 나며, 이 컴퓨터의 폴더로 대신하지 않습니다.",+ "remoteDirInvalid": "{{device}}의 절대 경로를 입력하세요.",+ "errors": {+ "deviceUnreachable": "{{device}}을(를) 지금 사용할 수 없습니다. 온라인이고 원격 제어가 켜져 있어야 합니다. Worker가 생성되지 않았습니다.",+ "deviceOutdated": "{{device}}의 Cindy 버전이 오래되었습니다. 업데이트해야 Worker를 실행할 수 있습니다.",+ "dirRejected": "{{device}}에서 이 폴더를 찾을 수 없거나 사용할 수 없습니다. Worker가 생성되지 않았습니다."+ }},"rolePill": {"unread": "읽지 않은 업데이트",@@ -13419,13 +13436,18 @@"scrollWorkersLeftEdge": "이미 첫 Worker 를 표시하고 있습니다","scrollWorkersRightEdge": "이미 마지막 Worker 를 표시하고 있습니다","errorBadge": "오류",- "errorBadgeAria": "오류가 발생한 Worker 가 있습니다"+ "errorBadgeAria": "오류가 발생한 Worker 가 있습니다",+ "executionDevice": "{{device}}에서 실행",+ "deviceUnreachable": "상태를 가져올 수 없음",+ "unknownDevice": "다른 컴퓨터"},"split": {"leadLabel": "Lead ({{agent}})","workerLabel": "Worker ({{agent}})","leadNotFound": "Orca lead session 을 찾을 수 없습니다","waitingForWorker": "Worker 대기 중",+ "remoteWorkerLoading": "{{device}}의 작업을 불러오는 중…",+ "remoteWorkerUnreachable": "{{device}}에 지금 연결할 수 없습니다. 다시 연결되면 이 Worker의 작업이 다시 표시됩니다.","closeAria": "닫기"}},diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 42f248fe2e..62141787fe 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -13397,7 +13397,24 @@"optional": "(可选)","initialTaskPlaceholder": "给这个 Worker 的可选第一条任务","enableCollabTitle": "开启协同",- "enableCollabSubmit": "开启协同"+ "enableCollabSubmit": "开启协同",+ "executionDeviceLabel": "运行设备",+ "thisComputer": "这台电脑",+ "deviceOnline": "在线",+ "deviceNeedsUpdate": "版本过旧,需更新",+ "executionDeviceHint": "只列出同账号、在线并开启远程控制的电脑。",+ "executionDeviceRemoteHint": "Worker 的任务、目录和命令都在 {{device}}。",+ "remoteDirLabel": "{{device}} 上的工作目录",+ "remoteDirAuto": "自动分配",+ "remoteDirPath": "指定目录",+ "remoteDirAutoHint": "由 {{device}} 按自己的设置分配任务目录。",+ "remoteDirPathHint": "在 {{device}} 上检查;不存在时报错,不会换成这台电脑的目录。",+ "remoteDirInvalid": "请输入 {{device}} 上的绝对路径。",+ "errors": {+ "deviceUnreachable": "{{device}} 当前不可用:需要在线并开启远程控制。Worker 没有创建。",+ "deviceOutdated": "{{device}} 的 Cindy 版本过旧,更新后才能运行 Worker。",+ "dirRejected": "{{device}} 上找不到这个目录或不允许使用。Worker 没有创建。"+ }},"rolePill": {"unread": "未读更新",@@ -13419,13 +13436,18 @@"scrollWorkersLeftEdge": "已是最左侧的 Worker","scrollWorkersRightEdge": "已是最右侧的 Worker","errorBadge": "错误",- "errorBadgeAria": "有 Worker 出错"+ "errorBadgeAria": "有 Worker 出错",+ "executionDevice": "在 {{device}} 运行",+ "deviceUnreachable": "暂时无法获取状态",+ "unknownDevice": "另一台电脑"},"split": {"leadLabel": "Lead ({{agent}})","workerLabel": "Worker ({{agent}})","leadNotFound": "找不到 Orca lead 任务","waitingForWorker": "等待 Worker",+ "remoteWorkerLoading": "正在读取 {{device}} 上的任务…",+ "remoteWorkerUnreachable": "{{device}} 当前无法连接,恢复后会自动显示这个 Worker 的任务。","closeAria": "关闭"}},diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 7a3b3fddc6..99048f0078 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -13397,7 +13397,24 @@"optional": "(可選)","initialTaskPlaceholder": "給這個 Worker 的可選第一條任務","enableCollabTitle": "開啟協同",- "enableCollabSubmit": "開啟協同"+ "enableCollabSubmit": "開啟協同",+ "executionDeviceLabel": "執行裝置",+ "thisComputer": "這台電腦",+ "deviceOnline": "線上",+ "deviceNeedsUpdate": "版本過舊,需更新",+ "executionDeviceHint": "只列出同帳號、線上並開啟遠端控制的電腦。",+ "executionDeviceRemoteHint": "Worker 的任務、目錄和指令都在 {{device}}。",+ "remoteDirLabel": "{{device}} 上的工作目錄",+ "remoteDirAuto": "自動分配",+ "remoteDirPath": "指定目錄",+ "remoteDirAutoHint": "由 {{device}} 依自己的設定分配任務目錄。",+ "remoteDirPathHint": "在 {{device}} 上檢查;不存在時報錯,不會換成這台電腦的目錄。",+ "remoteDirInvalid": "請輸入 {{device}} 上的絕對路徑。",+ "errors": {+ "deviceUnreachable": "{{device}} 目前無法使用:需要在線並開啟遠端控制。Worker 沒有建立。",+ "deviceOutdated": "{{device}} 的 Cindy 版本過舊,更新後才能執行 Worker。",+ "dirRejected": "{{device}} 上找不到這個目錄或不允許使用。Worker 沒有建立。"+ }},"rolePill": {"unread": "未讀更新",@@ -13419,13 +13436,18 @@"scrollWorkersLeftEdge": "已是最左側的 Worker","scrollWorkersRightEdge": "已是最右側的 Worker","errorBadge": "錯誤",- "errorBadgeAria": "有 Worker 出錯"+ "errorBadgeAria": "有 Worker 出錯",+ "executionDevice": "在 {{device}} 執行",+ "deviceUnreachable": "暫時無法取得狀態",+ "unknownDevice": "另一台電腦"},"split": {"leadLabel": "Lead ({{agent}})","workerLabel": "Worker ({{agent}})","leadNotFound": "找不到 Orca lead 任務","waitingForWorker": "等待 Worker",+ "remoteWorkerLoading": "正在讀取 {{device}} 上的任務…",+ "remoteWorkerUnreachable": "{{device}} 目前無法連線,恢復後會自動顯示這個 Worker 的任務。","closeAria": "關閉"}},diff --git a/docs/dev-rules/orca-team-architecture.md b/docs/dev-rules/orca-team-architecture.mdindex 8b69d2da21..0b563f1d52 100644--- a/docs/dev-rules/orca-team-architecture.md+++ b/docs/dev-rules/orca-team-architecture.md@@ -384,7 +384,7 @@ Worker turn 被 vendor 报终止型 error,但 interrupted-turn auto-resume 仍Lead 派完活结束本轮时,团队仍在干活,这一轮不是完成:灵动岛保持 Lead 为运行中(不出完成卡片、不响完成音、不记未读),Work Louder 键盘、侧栏卡片与远程会话列表读同一份活动快照,因此一起保持运行中;renderer 不发完成通知(桌面/手机/飞书)、不亮完成角标。Worker 回报送达后 Lead 被唤起,那一轮的 done 才是团队完成。判据只有一份,在 Main:以「仍有 accepted 派活欠 Lead 回报」(auto-bridge pending)为准,最后一份回报送达或被丢弃(手动停止、归档等)时,若 Lead 空闲则补发被推迟的完成;renderer 不自行推算 Worker 状态,完成去抖落地时读灵动岛活动快照,Main 仍把该会话保持为 `running` 就不算完成(暂停的输入队列同样会让灵动岛保持运行中,但保留原有完成提醒,故排除)。Worker 自身仍不进灵动岛、不单独发通知。已知边界(刻意不处理,保持简单):派给正忙 Worker、尚在其队列里未被接收的任务还没有待回报记录(Worker 正忙通常意味着已有同一 Lead 的待回报记录);静默完成(如静默的自动运行)不走推迟,Lead 活动会直接变为完成。实现指针:`orcaTeamService.ts` 的 `hasPendingWorkerReports` / `deletePendingReport` / `onLeadWorkerReportsSettled`,`register.ts` 的 `setCompletionDeferResolver` 与 `onLeadWorkerReportsSettled` wiring,`agent-island/service.ts` 的 `notifyQueueEmptied`,renderer `state/agentIslandActivity.ts` 的 `isSessionCompletionHeldByAgentIsland` 与 `useSessionRunningStatus.ts` 的 done debounce。10. **远端 Worker 只在运行设备上跑(状态:不变量)**- Worker 可以放到同账号另一台电脑(运行设备)上运行:真实任务在那台,本机只有一条不跑 Agent、`working_dir` 为空的代理任务行,`orca_workers.execution_device_id` / `remote_session_id` 记录位置。代理行承接计槽、状态机、auto-bridge 与归档,任何路径都不得在本机为它起 Agent(`bootstrapSession` 对远端 Worker 直接拒绝)、不得把它复制到其他电脑;派活、停止与存活查询经 `orcaRemoteWorkers.ts` 的 `wrapTeamDeps` 分流到运行设备,其余依赖原样透传,不另造状态机。回报靠轮询:派出的消息已进入对话(投递回执 accepted)且设备不在跑时取最后一条 assistant 消息,按消息 id 去重;用户在运行设备上直接发的消息算插话,不触发回报。设备不可达只是运行期投影(`executionDevice.reachable`),不扩展 `OrcaWorkerStatus`;派活时不可达直接失败,不回退到本机。首版远端 Worker 没有 `send_to_lead` 桥,也不支持 steer / 队列编辑。实现指针:`orcaRemoteWorkerRuntime.ts`、`orcaRemoteWorkers.ts`、`orcaWorkerCreationService.ts` 的 `createRemoteWorkerInTeam`、运行设备侧 `orcaRemoteWorkerHost.ts`;协议见 `protocol-compatibility.md`「协同远端 Worker」。+ Worker 可以放到同账号另一台电脑(运行设备)上运行:真实任务在那台,本机只有一条不跑 Agent、`working_dir` 为空的代理任务行,`orca_workers.execution_device_id` / `remote_session_id` 记录位置。代理行承接计槽、状态机、auto-bridge 与归档,任何路径都不得在本机为它起 Agent(`bootstrapSession` 对远端 Worker 直接拒绝)、不得把它复制到其他电脑;派活、停止与存活查询经 `orcaRemoteWorkers.ts` 的 `wrapTeamDeps` 分流到运行设备,其余依赖原样透传,不另造状态机。回报靠轮询:派出的消息已进入对话(投递回执 accepted)且设备不在跑时取最后一条 assistant 消息,按消息 id 去重;用户在运行设备上直接发的消息算插话,不触发回报。设备不可达只是运行期投影(`executionDevice.reachable`),不扩展 `OrcaWorkerStatus`;派活时不可达直接失败,不回退到本机。首版远端 Worker 没有 `send_to_lead` 桥,也不支持 steer / 队列编辑。界面:创建弹窗的「运行设备」只在本机 Lead 上出现(`CreateWorkerPopover` 的 `executionDevicesEnabled`),协同面板对远端 Worker 展示运行设备上的真实任务(`RemoteWorkerSessionPane`,先登记归属再读写)。实现指针:`orcaRemoteWorkerRuntime.ts`、`orcaRemoteWorkers.ts`、`orcaWorkerCreationService.ts` 的 `createRemoteWorkerInTeam`、运行设备侧 `orcaRemoteWorkerHost.ts`;协议见 `protocol-compatibility.md`「协同远端 Worker」。### 测试与回归清单diff --git a/docs/orca-cross-device-worker-plan.md b/docs/orca-cross-device-worker-plan.mdindex 151dbd53a8..ba58695f5a 100644--- a/docs/orca-cross-device-worker-plan.md+++ b/docs/orca-cross-device-worker-plan.md@@ -1,9 +1,10 @@# 协同扩展:Worker 在另一台电脑运行> 状态:产品决策已定(2026-10-09,见 §5),分三步实现,不是产品规则。-> 第一步(运行设备侧支持与 schema)与第二步(Lead 侧编排、Agent 工具)已落地,协议见-> `docs/dev-rules/protocol-compatibility.md`「协同远端 Worker」,运行时契约见-> `docs/dev-rules/orca-team-architecture.md`「远端 Worker」;第三步(协同面板界面)进行中。+> 三步均已实现,待验收:运行设备侧支持与 schema、Lead 侧编排与 Agent 工具、协同面板界面。+> 协议见 `docs/dev-rules/protocol-compatibility.md`「协同远端 Worker」,运行时契约见+> `docs/dev-rules/orca-team-architecture.md`「远端 Worker」。界面首版只在本机 Lead 上提供「运行设备」;+> 被远程控制的 Lead 仍可由它自己的 Agent 经 `execution_device_id` 创建;SSH 主机上的 Lead 不支持。> 来源讨论:issue #5620「远程控制功能疑问」→ 跨设备派活。## 1. 结论