Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(companion-cloud): D6 explain why "move to this computer" is missing from the home menu
nana37e490a8fe99
diff --git a/apps/desktop/src/main/companion-cloud/__tests__/control.test.ts b/apps/desktop/src/main/companion-cloud/__tests__/control.test.tsindex 21190d7334..fd11c8dae1 100644--- a/apps/desktop/src/main/companion-cloud/__tests__/control.test.ts+++ b/apps/desktop/src/main/companion-cloud/__tests__/control.test.ts@@ -332,6 +332,12 @@ describe('switch home from any computer', () => {handOver: vi.fn(async (): Promise<{ ok: true } | { ok: false; code: 'BUSY' }> => ({ ok: true })),});+ it('says why this computer is not offered when it has not allowed same-account control', async () => {+ const t = setup({ home: 'laptop', devices: [device('laptop'), device('desk', { isSelf: true, name: 'Desk', remoteControlEnabled: false })], homeLink: link(2, [{ deviceId: 'tablet', name: 'Tablet', online: true }]) });+ expect(await t.runtime.homeChoices('bot_mia')).toMatchObject({ mode: 'remote', thisComputer: 'REMOTE_CONTROL_OFF',+ targets: [{ deviceId: 'tablet', name: 'Tablet', online: true, isSelf: false }] });+ });+it('hands over from here when this computer is the home', async () => {const t = setup({ home: 'desk', devices: [device('laptop')] });expect(await t.runtime.homeChoices('bot_mia')).toEqual({ homeDeviceId: 'desk', homeName: '', mode: 'local', targets: [{ deviceId: 'laptop', name: 'laptop', online: true }] });diff --git a/apps/desktop/src/main/companion-cloud/runtime.ts b/apps/desktop/src/main/companion-cloud/runtime.tsindex a47813c567..1685743b68 100644--- a/apps/desktop/src/main/companion-cloud/runtime.ts+++ b/apps/desktop/src/main/companion-cloud/runtime.ts@@ -720,7 +720,10 @@ export function startCompanionCloud(input: {const targets = await input.host.homeLink!.targets(home);return { homeDeviceId: home, homeName, mode: 'remote',targets: targets.filter(target => target.deviceId !== home).map(target => target.deviceId === self- ? { ...target, name: target.name || here.name, isSelf: true } : { ...target, isSelf: false }) };+ ? { ...target, name: target.name || here.name, isSelf: true } : { ...target, isSelf: false }),+ // The home only lists computers that allow its control, so this one is missing for that reason.+ ...(selfDevice?.remoteControlEnabled === false && !targets.some(target => target.deviceId === self)+ ? { thisComputer: 'REMOTE_CONTROL_OFF' as const } : {}) };},async switchHome(botId, targetDeviceId, options) {diff --git a/apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsx b/apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsxindex b6dad0a606..0d17a50f0f 100644--- a/apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsx+++ b/apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsx@@ -191,8 +191,10 @@ function HomeMenuItems({ bot, state }: { bot: CompanionHomeBot; state: HomeSwitc: t('bots.cloud.notEnabled')}</DropdownMenuItem>);+ const hereOff = choices.thisComputer === 'REMOTE_CONTROL_OFF'+ ? <DropdownMenuItem disabled className="whitespace-normal">{t('bots.cloud.hereControlOff')}</DropdownMenuItem> : null;if (choices.targets.length === 0)- return <DropdownMenuItem disabled className="whitespace-normal">{t('bots.cloud.noTargets')}</DropdownMenuItem>;+ return <><DropdownMenuItem disabled className="whitespace-normal">{t('bots.cloud.noTargets')}</DropdownMenuItem>{hereOff}</>;return (<>{choices.targets.map((target) => (@@ -202,6 +204,7 @@ function HomeMenuItems({ bot, state }: { bot: CompanionHomeBot; state: HomeSwitc</span></DropdownMenuItem>))}+ {hereOff}</>);}diff --git a/apps/desktop/src/renderer/features/bots/__tests__/companionCloudUi.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/companionCloudUi.test.tsxindex 0647b85381..b24b1dd6e7 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/companionCloudUi.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/companionCloudUi.test.tsx@@ -301,6 +301,15 @@ describe('BotHomeComputerSetting', () => {expect(await screen.findByText('bots.cloud.noTargets')).toBeTruthy();});+ it('explains why this computer is missing from the choices of a remote home', async () => {+ maker.getCompanionHomeChoices.mockResolvedValue({ homeDeviceId: 'laptop', mode: 'remote', thisComputer: 'REMOTE_CONTROL_OFF',+ targets: [{ deviceId: 'tablet', name: 'Tablet', online: true, isSelf: false }] });+ show(snapshot('laptop'));+ openMenu();+ expect(await screen.findByText('bots.cloud.hereControlOff')).toBeTruthy();+ expect(screen.getByText('bots.cloud.switchTo:{"device":"Tablet"}')).toBeTruthy();+ });+it('counts a companion as arrived only once it is built here and no longer demoted', () => {const cloud = snapshot('desk');expect(companionArrivedHere(cloud, 'mia', [])).toBe(false);diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex b143812449..a57598f939 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -9987,6 +9987,7 @@"loadingDevices": "Loading your computers…","devicesFailed": "Couldn’t load your computers","noTargets": "No computer can take over. The other computer must be online, signed in to the same account, and have “Allow same-account devices to control this machine” turned on",+ "hereControlOff": "“Allow same-account devices to control this machine” is off on this computer, so it can’t be chosen here. Turn it on in Settings → Device Link and try again","resumeToMove": "Resume {{name}} before moving it to another computer","transferBusy": "{{name}} is still working on a reply. Move it after the reply finishes","targetUnavailable": "“{{device}}” isn’t available. It must be online with remote control turned on",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 73357a8fff..8d9ce37df2 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -9953,6 +9953,7 @@"loadingDevices": "パソコンの一覧を読み込んでいます…","devicesFailed": "パソコンの一覧を読み込めませんでした","noTargets": "引き継げるパソコンがありません。別のパソコンがオンラインで、同じアカウントでログインし、「同一アカウントのデバイスによる操作を許可」をオンにしている必要があります",+ "hereControlOff": "このパソコンは「同一アカウントのデバイスによる操作を許可」がオフのため、ここからは選べません。設定 → デバイス連携 でオンにしてからもう一度お試しください","resumeToMove": "{{name}} を再開してから別のパソコンに移動してください","transferBusy": "{{name}} はまだ返信中です。返信が終わってから移動してください","targetUnavailable": "「{{device}}」は今は使えません。オンラインでリモート操作がオンになっている必要があります",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 659ffe4e90..ac780b5179 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -9953,6 +9953,7 @@"loadingDevices": "컴퓨터 목록을 불러오는 중…","devicesFailed": "컴퓨터 목록을 불러오지 못했습니다","noTargets": "이어받을 수 있는 컴퓨터가 없습니다. 다른 컴퓨터가 온라인 상태이고 같은 계정으로 로그인한 뒤 '동일 계정 기기의 이 컴퓨터 제어 허용'을 켜야 합니다",+ "hereControlOff": "이 컴퓨터는 '동일 계정 기기의 이 컴퓨터 제어 허용'이 꺼져 있어 여기서 선택할 수 없습니다. 설정 → 기기 연동에서 켠 뒤 다시 시도하세요","resumeToMove": "{{name}}을(를) 다시 시작한 뒤 다른 컴퓨터로 옮겨 주세요","transferBusy": "{{name}}이(가) 아직 답장 중입니다. 답장이 끝난 뒤 옮겨 주세요","targetUnavailable": "'{{device}}'은(는) 지금 사용할 수 없습니다. 온라인 상태이고 원격 제어가 켜져 있어야 합니다",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex e38106eba1..b796452a6a 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -9953,6 +9953,7 @@"loadingDevices": "正在读取电脑列表…","devicesFailed": "未能读取电脑列表","noTargets": "没有可接手的电脑。另一台电脑需要在线、登录同一账号,并开启「允许同账号设备控制本机」",+ "hereControlOff": "这台电脑还没有开启「允许同账号设备控制本机」,所以不能从这里换过来。到 设置 → 设备互联 打开后再试","resumeToMove": "先恢复 {{name}},再换到另一台电脑","transferBusy": "{{name}} 还在回复,等这一轮结束再换电脑","targetUnavailable": "「{{device}}」现在不可用,它需要在线并开启远程控制",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 8f8e577e4e..3dad8e7339 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -9953,6 +9953,7 @@"loadingDevices": "正在讀取電腦清單…","devicesFailed": "未能讀取電腦清單","noTargets": "沒有可接手的電腦。另一台電腦需要上線、登入同一帳號,並開啟「允許同帳號裝置控制本機」",+ "hereControlOff": "這台電腦還沒有開啟「允許同帳號裝置控制本機」,所以不能從這裡換過來。到 設定 → 裝置互聯 開啟後再試","resumeToMove": "先恢復 {{name}},再換到另一台電腦","transferBusy": "{{name}} 還在回覆,等這一輪結束再換電腦","targetUnavailable": "「{{device}}」現在無法使用,它需要上線並開啟遠端控制",diff --git a/apps/desktop/src/shared/companionCloud.ts b/apps/desktop/src/shared/companionCloud.tsindex 4dc52879c9..df7bc11552 100644--- a/apps/desktop/src/shared/companionCloud.ts+++ b/apps/desktop/src/shared/companionCloud.ts@@ -117,4 +117,6 @@ export interface CompanionHomeChoices {reason?: 'HOME_OUTDATED' | 'NOT_ENABLED' | 'NOT_FOUND';/** Computers it can move to (never the current home). */targets: CompanionTransferTarget[];+ /** Why this computer is not among the targets of a remote home: it has not allowed same-account control. */+ thisComputer?: 'REMOTE_CONTROL_OFF';}diff --git a/docs/product-rules/cloud-companions.md b/docs/product-rules/cloud-companions.mdindex 5e5d055848..304a7acdc3 100644--- a/docs/product-rules/cloud-companions.md+++ b/docs/product-rules/cloud-companions.md@@ -107,6 +107,7 @@请主力电脑按同一套交出规则交出(`maker:companion-cloud:targets` / `maker:companion-cloud:hand-over`);还在回复、资料没传完等情况由主力电脑拒绝并原样提示。换到这台电脑时,交出完成后立即重读主力电脑,本机按自动接管建立伙伴,建好后打开本机伙伴(约 2 分钟内没建好则提示稍后出现在列表里)。+ - 这台电脑没有开启「允许同账号设备控制本机」时,主力电脑不会把它列为可接手的电脑;菜单里补一行说明(为什么不能选、到 设置 → 设备互联 开启),授权门槛不变(`CompanionHomeChoices.thisComputer`)。- 主力电脑离线或连不上:只能「在这台电脑继续」(上面的接管)。- 主力电脑上的 Cindy 版本不支持被远程请求交出:提示先更新那台电脑或在那台电脑上更换。- 伙伴已暂停时不交出,提示先恢复。