"use client";
import { CheckCircleIcon, Loader2Icon, SquareTerminalIcon, WrenchIcon, XCircleIcon } from "lucide-react";
import { MessageResponse } from "@/components/ai-elements/message";
import { useI18n } from "@/core/i18n/hooks";
import { cn } from "@/lib/utils";
import type { SubagentState } from "@/core/threads/types";
interface SubagentCardProps {
subagentType: string;
state?: SubagentState;
isLoading?: boolean;
prompt?: string;
}
export function SubagentCard({ subagentType, state, isLoading, prompt }: SubagentCardProps) {
const { t } = useI18n();
const getSubagentIcon = (type: string) => {
switch (type) {
case "bash":
return SquareTerminalIcon;
case "general-purpose":
return WrenchIcon;
default:
return WrenchIcon;
}
};
const getSubagentLabel = (type: string) => {
switch (type) {
case "bash":
return t.subagents.bash;
case "general-purpose":
return t.subagents.generalPurpose;
default:
return t.subagents.unknown;
}
};
const IconComponent = getSubagentIcon(subagentType);
const label = getSubagentLabel(subagentType);
// Determine status based on state, not isLoading
const status = state?.status || "running";
const isRunning = status === "running";
const isCompleted = status === "completed";
const isFailed = status === "failed";
const getStatusIcon = () => {
if (isCompleted) {
return