import { useState } from 'react' import { ChevronDown, ChevronUp, Code, FlaskConical, Clock, Lock, Sparkles } from 'lucide-react' import { OrchestratorAvatar } from './OrchestratorAvatar' import type { OrchestratorStatus, OrchestratorState } from '../lib/types' import { Card, CardContent } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' interface OrchestratorStatusCardProps { status: OrchestratorStatus } // Get a friendly state description function getStateText(state: OrchestratorState): string { switch (state) { case 'idle': return 'Standing by...' case 'initializing': return 'Setting up features...' case 'scheduling': return 'Planning next moves...' case 'spawning': return 'Deploying agents...' case 'monitoring': return 'Watching progress...' case 'complete': return 'Mission accomplished!' default: return 'Orchestrating...' } } // Get state color function getStateColor(state: OrchestratorState): string { switch (state) { case 'complete': return 'text-primary' case 'spawning': return 'text-primary' case 'scheduling': case 'monitoring': return 'text-primary' case 'initializing': return 'text-yellow-600 dark:text-yellow-400' default: return 'text-muted-foreground' } } // Format timestamp to relative time function formatRelativeTime(timestamp: string): string { const now = new Date() const then = new Date(timestamp) const diffMs = now.getTime() - then.getTime() const diffSecs = Math.floor(diffMs / 1000) if (diffSecs < 5) return 'just now' if (diffSecs < 60) return `${diffSecs}s ago` const diffMins = Math.floor(diffSecs / 60) if (diffMins < 60) return `${diffMins}m ago` return `${Math.floor(diffMins / 60)}h ago` } export function OrchestratorStatusCard({ status }: OrchestratorStatusCardProps) { const [showEvents, setShowEvents] = useState(false) return (
{/* Avatar */} {/* Main content */}
{/* Header row */}
Maestro {getStateText(status.state)}
{/* Current message */}

{status.message}

{/* Status badges row */}
{/* Coding agents badge */} Coding: {status.codingAgents} {/* Testing agents badge */} Testing: {status.testingAgents} {/* Ready queue badge */} Ready: {status.readyCount} {/* Blocked badge (only show if > 0) */} {status.blockedCount > 0 && ( Blocked: {status.blockedCount} )}
{/* Recent events toggle */} {status.recentEvents.length > 0 && ( )}
{/* Collapsible recent events */} {showEvents && status.recentEvents.length > 0 && (
{status.recentEvents.map((event, idx) => (
{formatRelativeTime(event.timestamp)} {event.message}
))}
)}
) }