/** * Subagent Card - Display card for a single subagent definition * * Shows the subagent's name, description, model, tool count, scope, and type. * Read-only view - agents are managed by editing .md files directly. */ import { useState } from 'react'; import { Badge } from '@/components/ui/badge'; import { Markdown } from '@/components/ui/markdown'; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; import { cn } from '@/lib/utils'; import { Globe, FolderOpen, ChevronDown, ChevronRight, Bot, Cpu, Wrench, FileCode, } from 'lucide-react'; import type { SubagentWithScope } from './hooks/use-subagents'; interface SubagentCardProps { agent: SubagentWithScope; } export function SubagentCard({ agent }: SubagentCardProps) { const [isExpanded, setIsExpanded] = useState(false); const { name, definition, scope, filePath } = agent; const toolCount = definition.tools?.length ?? 'all'; const modelDisplay = definition.model === 'inherit' || !definition.model ? 'Inherit' : definition.model.charAt(0).toUpperCase() + definition.model.slice(1); // Scope icon and label const ScopeIcon = scope === 'global' ? Globe : FolderOpen; const scopeLabel = scope === 'global' ? 'User' : 'Project'; // Model color based on type const getModelColor = () => { const model = definition.model?.toLowerCase(); if (model === 'opus') return 'text-violet-500 bg-violet-500/10 border-violet-500/30'; if (model === 'sonnet') return 'text-blue-500 bg-blue-500/10 border-blue-500/30'; if (model === 'haiku') return 'text-emerald-500 bg-emerald-500/10 border-emerald-500/30'; return 'text-muted-foreground bg-muted/50 border-border/50'; }; return (
{/* Main Card Content */}
{/* Agent Icon */}
{/* Content */}
{/* Header Row */}

{name}

{modelDisplay} {toolCount === 'all' ? 'All' : toolCount} tools {scopeLabel}
{/* Description */}

{definition.description}

{/* File Path */} {filePath && (
{filePath}
)}
{/* Expand Button */}
{/* Expandable Prompt Section */}
System Prompt
{definition.prompt}
); }