(null)
+
+ useEffect(() => {
+ const fetchStats = async () => {
+ try {
+ const response = await fetch('/api/stats')
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`)
+ }
+ const data = await response.json()
+ setStats(data)
+ } catch (err) {
+ setError(err instanceof Error ? err.message : 'Failed to fetch stats')
+ }
+ }
+
+ fetchStats()
+ const interval = setInterval(fetchStats, 30000) // Refresh every 30 seconds
+ return () => clearInterval(interval)
+ }, [])
+
+ if (error) {
+ return (
+
+ err
+
+ )
+ }
+
+ if (!stats) {
+ return (
+
+ loading...
+
+ )
+ }
+
+ const activeAgents = stats.agent_count
+ const inProgressPlans = stats.plan_counts.in_progress || 0
+ const completedTasks = stats.task_counts.complete || 0
+
+ return (
+
+ {activeAgents}
+ ·
+ {inProgressPlans}
+ ·
+ {completedTasks}
+
+ )
+}
\ No newline at end of file