import { AuiIf, ErrorPrimitive, MessagePrimitive, ThreadPrimitive, type ToolCallMessagePartComponent } from "@assistant-ui/react"; import { ArrowDownIcon, Bot, Plug, UserRound, Wrench } from "lucide-react"; import { type FC, useRef } from "react"; import { MarkdownText } from "@/components/assistant-ui/markdown-text"; import { Reasoning, ReasoningGroup } from "@/components/assistant-ui/reasoning"; import { Mono, parseMcpToolName, ToolShell } from "./tool-uis"; // ─── Props ─── interface AgentThreadProps { taskDone: boolean; } // ─── Thread Root ─── export const AgentThread: FC = ({ taskDone }) => { const viewportRef = useRef(null); return ( s.thread.isEmpty}>

{taskDone ? "No activity recorded." : "Waiting for agent activity..."}

); }; // ─── Generic Tool Fallback ────────────────────────────────────────────────── // Routes through the same ToolShell as per-tool UIs. For MCP tools it parses // the `mcp__namespace__name` convention and renders a cleaner header. export const ChatToolFallback: ToolCallMessagePartComponent = ({ toolName, argsText, result, status }) => { const mcp = parseMcpToolName(toolName); const icon = mcp ? : ; const label = mcp ? `mcp:${mcp.ns}` : "tool"; const summary = mcp ? mcp.name : toolName; const resultText = result == null ? null : typeof result === "string" ? result : JSON.stringify(result, null, 2); return ( {argsText && ( <>
args
{argsText} )} {resultText != null && ( <>
result
{resultText} )}
); }; // ─── Assistant Message ─── const AgentMessage: FC = () => { return (
Agent
); }; // ─── User Message ─── const HumanMessage: FC = () => { return (
You
); }; // ─── Scroll to Bottom ─── const ScrollToBottom: FC = () => { return ( ); };