mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Infer DM agents for task starts
This commit is contained in:
@@ -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<string, { name: string; pubkey: string }>();
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user