/** * Health Dashboard * * System pulse. Not BI. Not statistics. * Just: which engines are running? */ import { useEffect, useState } from 'react'; interface EngineStatus { name: string; status: 'running' | 'stopped' | 'error'; lastHeartbeat: string; } function HealthDashboard() { const [engines, setEngines] = useState([ { name: 'Reality', status: 'running', lastHeartbeat: new Date().toISOString() }, { name: 'Knowledge', status: 'running', lastHeartbeat: new Date().toISOString() }, { name: 'Decision', status: 'stopped', lastHeartbeat: '-' }, { name: 'Mission', status: 'stopped', lastHeartbeat: '-' }, { name: 'Economic', status: 'running', lastHeartbeat: new Date().toISOString() }, { name: 'Learning', status: 'stopped', lastHeartbeat: '-' }, ]); useEffect(() => { // Poll health status const interval = setInterval(() => { fetch('/health') .then(r => r.json()) .then(data => { // Update engine status based on health response setEngines(prev => prev.map(engine => ({ ...engine, status: data.status === 'ok' ? 'running' : 'error', lastHeartbeat: new Date().toISOString(), }))); }) .catch(() => { setEngines(prev => prev.map(engine => ({ ...engine, status: 'error', }))); }); }, 30000); // Every 30 seconds return () => clearInterval(interval); }, []); return (

Health Dashboard

System pulse — not statistics

{engines.map(engine => (

{engine.name} Engine

Last heartbeat: {engine.lastHeartbeat === '-' ? '-' : new Date(engine.lastHeartbeat).toLocaleTimeString()}

))}
); } function StatusIndicator({ status }: { status: 'running' | 'stopped' | 'error' }) { const colors = { running: '#32cd32', stopped: '#ccc', error: '#dc143c', }; const labels = { running: '✓ Running', stopped: '○ Stopped', error: '✗ Error', }; return ( {labels[status]} ); } export default HealthDashboard;