From 14f5a40b2b60af01dc2d188e376f987748c75990 Mon Sep 17 00:00:00 2001 From: klopez4212 Date: Sat, 27 Jun 2026 12:49:55 +0100 Subject: [PATCH] Infer DM agents for task starts --- .../src/features/channels/ui/ChannelPane.tsx | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/desktop/src/features/channels/ui/ChannelPane.tsx b/desktop/src/features/channels/ui/ChannelPane.tsx index 3c8165281..e3f95d4a2 100644 --- a/desktop/src/features/channels/ui/ChannelPane.tsx +++ b/desktop/src/features/channels/ui/ChannelPane.tsx @@ -41,6 +41,7 @@ import { } from "@/features/channels/ui/WelcomeComposerBanner"; import { canOpenAgentConversationInChannel, + getDmAutoRouteAgentPubkeys, getChannelIntroDescription, getChannelIntroKind, isWelcomeSetupSystemMessage, @@ -289,6 +290,15 @@ export const ChannelPane = React.memo(function ChannelPane({ return pubkeys; }, [activityAgents, agentPubkeys, agentSessionAgents]); + const dmAutoRouteAgentPubkeys = React.useMemo( + () => + getDmAutoRouteAgentPubkeys({ + channel: activeChannel, + currentPubkey, + knownAgentPubkeys, + }), + [activeChannel, currentPubkey, knownAgentPubkeys], + ); const knownAgentByPubkey = React.useMemo(() => { const agents = new Map(); const addAgent = (pubkey: string, name?: string | null) => { @@ -364,9 +374,21 @@ export const ChannelPane = React.memo(function ChannelPane({ } } + for (const pubkey of dmAutoRouteAgentPubkeys) { + const dmAgent = knownAgentByPubkey.get(normalizePubkey(pubkey)); + if (dmAgent) { + return dmAgent; + } + } + return null; }, - [activeAgentConversationMarkers, activeChannelId, knownAgentByPubkey], + [ + activeAgentConversationMarkers, + activeChannelId, + dmAutoRouteAgentPubkeys, + knownAgentByPubkey, + ], ); const completeWelcomeComposerBanner = React.useCallback(() => { if (!activeChannelId || !isActiveWelcomeChannel) {