import { useSimulationDispatch, useSimulationState } from '../../store/simulationStore'; import { motion } from 'framer-motion'; import { getApiBase } from '../../hooks/useSimulation'; const AGENT_DISPLAY = { COMMANDER: 'Commander', DETECTIVE: 'Detective', CODER: 'Coder', MANAGER: 'Manager', EVALUATOR: 'Validator', DBA_AGENT: 'Data Agent', SRE_AGENT: 'Reliability', SECURITY_AGENT: 'Security', COMPLIANCE_AGENT: 'Compliance', }; export default function Header({ onClearReset }) { const dispatch = useSimulationDispatch(); const { slaRemaining, spent, budget, activeAgents, telemetry, validatorRuntime } = useSimulationState(); const slaMin = Math.floor(slaRemaining / 60); const slaSec = Math.floor(slaRemaining % 60); const slaColor = slaRemaining > 300 ? 'text-emerald-400' : slaRemaining > 60 ? 'text-amber-400' : 'text-red-500'; const slaUrgent = slaRemaining <= 60; const spentPct = budget > 0 ? (spent / budget) * 100 : 0; const budgetColor = spentPct < 50 ? 'bg-emerald-500' : spentPct < 80 ? 'bg-amber-500' : 'bg-red-500'; const runtime = validatorRuntime || telemetry.validator_runtime || {}; const runtimeLabel = runtime.label || 'Validator Unavailable'; const runtimeBadgeClass = runtime.ready ? runtime.gpu_metrics_applicable ? 'bg-blue-950/40 text-blue-300 border-blue-500/30' : 'bg-emerald-950/40 text-emerald-300 border-emerald-500/30' : 'bg-red-950/40 text-red-300 border-red-500/30'; const handleClear = async () => { const confirmed = window.confirm('Clear the current live dashboard and reset the session?'); if (!confirmed) return; dispatch({ type: 'CLEAR_SIMULATION' }); if (onClearReset) onClearReset(); try { await fetch(`${getApiBase()}/api/frontend/clear`, { method: 'POST' }); } catch (error) { console.warn('Failed to clear backend replay state:', error); } }; return (
{/* ── Left: Branding ── */}
F

FrontierLabs

Swarm-OS v1.0

{/* Active Agents — color-coded by role */}
{activeAgents.map((a) => { const colorMap = { COMMANDER: 'bg-blue-900/40 text-blue-400 border-blue-500/30', DETECTIVE: 'bg-amber-900/40 text-amber-400 border-amber-500/30', CODER: 'bg-emerald-900/40 text-emerald-400 border-emerald-500/30', MANAGER: 'bg-purple-900/40 text-purple-400 border-purple-500/30', EVALUATOR: 'bg-pink-900/40 text-pink-400 border-pink-500/30', DBA_AGENT: 'bg-emerald-900/40 text-emerald-300 border-emerald-500/30', SRE_AGENT: 'bg-cyan-900/40 text-cyan-300 border-cyan-500/30', SECURITY_AGENT: 'bg-orange-900/40 text-orange-300 border-orange-500/30', COMPLIANCE_AGENT: 'bg-yellow-900/40 text-yellow-300 border-yellow-500/30', }; const cls = colorMap[a] || 'bg-zinc-700 text-zinc-300 border-zinc-600'; return ( {AGENT_DISPLAY[a] || a} ); })}
{/* ── Center: SLA Timer + Budget ── */}
{/* SLA Timer */}
SLA {String(slaMin).padStart(2, '0')}:{String(slaSec).padStart(2, '0')}
{/* Budget */}
BUDGET ${spent.toFixed(3)} / ${budget.toFixed(3)}
{/* ── Right: Model Badge ── */}
{runtimeLabel}
PRIMARY SwarmOS-Llama-3.1-8B-GRPO 4-bit QLoRA · GGUF · Local
); }