'use client' import { Session } from '@/types' import { formatAge, parseTokenUsage, getStatusBadgeColor } from '@/lib/utils' interface SessionsListProps { sessions: Session[] } interface SessionCardProps { session: Session } function SessionCard({ session }: SessionCardProps) { const tokenUsage = parseTokenUsage(session.tokens) const statusColor = session.active ? 'success' : 'warning' const getSessionTypeIcon = (key: string) => { if (key.includes('main:main')) return '👑' if (key.includes('subagent')) return '🤖' if (key.includes('cron')) return '⏰' if (key.includes('group')) return '👥' return '📄' } const getModelColor = (model: string) => { if (model.includes('opus')) return 'text-purple-400' if (model.includes('sonnet')) return 'text-blue-400' if (model.includes('haiku')) return 'text-green-400' return 'text-gray-400' } const getRoleBadge = (key: string) => { if (key.includes('main:main')) { return { label: 'LEAD', color: 'bg-purple-500/20 text-purple-400 border-purple-500/30' } } if (key.includes('subagent')) { return { label: 'WORKER', color: 'bg-blue-500/20 text-blue-400 border-blue-500/30' } } if (key.includes('cron')) { return { label: 'CRON', color: 'bg-orange-500/20 text-orange-400 border-orange-500/30' } } return { label: 'SYSTEM', color: 'bg-gray-500/20 text-gray-400 border-gray-500/30' } } const getCurrentTask = (session: Session) => { // Extract task from session label or key if (session.label && session.label !== session.key.split(':').pop()) { return session.label } // For sub-agents, try to extract task from key const parts = session.key.split(':') if (parts.length > 3 && parts[2] === 'subagent') { return parts[3] || 'Unknown task' } return session.active ? 'Active' : 'Idle' } const roleBadge = getRoleBadge(session.key) const currentTask = getCurrentTask(session) return (
{session.key}
{sessions.length} total • {activeSessions.length} active
No sessions active
Sessions will appear here when agents start