import { useEffect, useRef } from 'react' import { MessageSquare } from 'lucide-react' import type { Agent, ChatMessage } from '../../types' import { getAgentMeta } from '../../lib/agentMeta' import { cn } from '../../lib/utils' type Props = { messages: ChatMessage[] agents: Agent[] selectedAgent: Agent | null busy: boolean } export function CommsPanel({ messages, agents, selectedAgent, busy }: Props) { const bottomRef = useRef(null) const meta = selectedAgent ? getAgentMeta(selectedAgent.id) : null useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [messages, busy]) return (

Comms

{selectedAgent && meta && ( {selectedAgent.name.split(' ·')[0]} )}
{!messages.length && (

Send a command below — routing selects the right specialist automatically.

)} {messages.map((m, i) => { const ag = m.role === 'agent' ? agents.find((a) => a.id === m.agent) : null const agMeta = ag ? getAgentMeta(ag.id) : null return (

{m.role === 'user' ? 'You' : ag?.name || m.agent} {m.ts && ` · ${new Date(m.ts).toLocaleTimeString('en-US', { hour12: false })}`}

{m.text}

) })} {busy && (
Agent gathering cluster data and querying Llama 70B… expect ~30–90 sec
)}
) }