import { useMemo } from "react"; import { Bot } from "lucide-react"; import type { Agent } from "@fusion/core"; interface AgentMentionPopupProps { /** List of agents to show */ agents: Agent[]; /** Current search filter text (the text typed after @) */ filter: string; /** Currently highlighted index for keyboard navigation */ highlightedIndex: number; /** Whether popup is visible */ visible: boolean; /** Callback when an agent is selected */ onSelect: (agent: Agent) => void; /** Positioning anchor: "above" | "below" the input */ position?: "above" | "below"; } export function AgentMentionPopup({ agents, filter, highlightedIndex, visible, onSelect, position = "below", }: AgentMentionPopupProps) { const filteredAgents = useMemo(() => { const normalizedFilter = filter.trim().toLowerCase(); if (!normalizedFilter) { return agents; } return agents.filter((agent) => agent.name.toLowerCase().includes(normalizedFilter)); }, [agents, filter]); if (!visible) { return null; } return (
{filteredAgents.length === 0 ? (
No agents found
) : ( filteredAgents.map((agent, index) => ( )) )}
); }