Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 从任务首页进入的云端伙伴接续对话后仍返回任务
Chris9301c0c4cbac
diff --git a/apps/mobile/app/companions/cloud/[actorId].tsx b/apps/mobile/app/companions/cloud/[actorId].tsxindex 013c3442e6..93400c9444 100644--- a/apps/mobile/app/companions/cloud/[actorId].tsx+++ b/apps/mobile/app/companions/cloud/[actorId].tsx@@ -13,10 +13,11 @@ function firstParam(value: string | string[] | undefined): string {*/export default function CloudCompanionRoute() {const params = useLocalSearchParams<{ actorId?: string | string[]; botId?: string | string[]; deviceId?: string | string[];- deviceName?: string | string[]; title?: string | string[] }>();+ deviceName?: string | string[]; title?: string | string[]; keepMode?: string | string[] }>();const { accountGeneration } = useAuth();const actorId = firstParam(params.actorId);const deviceId = firstParam(params.deviceId);return <CloudCompanionScreen key={`${accountGeneration}:${actorId}`} actorId={actorId} botId={firstParam(params.botId)}- deviceId={deviceId} deviceName={firstParam(params.deviceName) || deviceId} title={firstParam(params.title)} />;+ deviceId={deviceId} deviceName={firstParam(params.deviceName) || deviceId} title={firstParam(params.title)}+ keepMode={firstParam(params.keepMode) === '1'} />;}diff --git a/apps/mobile/src/session/CloudCompanionScreen.tsx b/apps/mobile/src/session/CloudCompanionScreen.tsxindex 8497dc74c4..71021cf5f3 100644--- a/apps/mobile/src/session/CloudCompanionScreen.tsx+++ b/apps/mobile/src/session/CloudCompanionScreen.tsx@@ -50,8 +50,10 @@ type Notice = 'noTargets' | 'devicesFailed' | null;* 1:1 房间里的对话层,横幅「主力电脑「名字」离线」+「换一台电脑继续」。选中电脑后服务器改主力电脑,* 那台电脑自动接手;手机等它在伙伴列表里出现后,像普通点按一样打开那台电脑上的伙伴。*/-export function CloudCompanionScreen({ actorId, botId, deviceId, deviceName, title }: {+export function CloudCompanionScreen({ actorId, botId, deviceId, deviceName, title, keepMode = false }: {actorId: string; botId: string; deviceId: string; deviceName: string; title: string;+ /** Opened from the task home's teammate section: the conversation that takes over keeps the task mode. */+ keepMode?: boolean;}) {const { t } = useTranslation();const { colors } = useTheme();@@ -132,9 +134,9 @@ export function CloudCompanionScreen({ actorId, botId, deviceId, deviceName, titif (arrived) {switchingRef.current = { phase: 'idle' };setSwitching(switchingRef.current);- void openTeammate.current(arrived, { replace: true });+ void openTeammate.current(arrived, { replace: true, keepMode });} else if (state !== switchingRef.current) setSwitching(state);- }, [botId]);+ }, [botId, keepMode]);// Every roster change may be the arrival; the interval re-reads the roster and enforces the timeout.useEffect(() => { if (waiting) tick(); });useEffect(() => {diff --git a/apps/mobile/src/session/HomeTeammatesSection.tsx b/apps/mobile/src/session/HomeTeammatesSection.tsxindex 3cd68e387f..200335e87c 100644--- a/apps/mobile/src/session/HomeTeammatesSection.tsx+++ b/apps/mobile/src/session/HomeTeammatesSection.tsx@@ -101,7 +101,7 @@ function SectionContent({ shared, active, visible, showFooter, runDisclosure, prconst entries = useTeammateEntries(items, showGroups ? groups.items : undefined);const openTeammate = (row: HostedRemoteCollectionItem) => {const actor = cloudActor(row);- if (actor) { Keyboard.dismiss(); push(cloudCompanionRoute(row, actor.id, i18n.language)); }+ if (actor) { Keyboard.dismiss(); push(cloudCompanionRoute(row, actor.id, i18n.language, { keepMode: true })); }else void navigation.openTeammate(row, { keepMode: true });};const openGroup = (row: HostedRemoteCollectionItem) => { Keyboard.dismiss(); push(botGroupRoute(row.host, row.item.ref.id)); };diff --git a/apps/mobile/src/session/teammateNavigation.ts b/apps/mobile/src/session/teammateNavigation.tsindex 9081e8174d..3911fd5c46 100644--- a/apps/mobile/src/session/teammateNavigation.ts+++ b/apps/mobile/src/session/teammateNavigation.ts@@ -49,13 +49,15 @@ export function teammateResourceRoute(hosted: HostedRemoteCollectionItem, locale* The read-only cloud view of a companion whose main computer is offline* (docs/product-rules/cloud-companions.md §3.1). The row's computer is that main computer.*/-export function cloudCompanionRoute(hosted: HostedRemoteCollectionItem, actorId: string, locale: string) {+/** `keepMode`: opened from the task home, so the conversation that takes over still returns to the tasks. */+export function cloudCompanionRoute(hosted: HostedRemoteCollectionItem, actorId: string, locale: string, options?: { keepMode?: boolean }) {return {pathname: '/companions/cloud/[actorId]' as const,params: {actorId, botId: hosted.item.ref.id,deviceId: hosted.host.deviceId, deviceName: hosted.host.deviceName,title: resolveRemoteText(hosted.item.display.title, locale),+ ...(options?.keepMode ? { keepMode: '1' } : {}),},};}