interface NodeSpec { name: string ip: string user: string role: string capacity: number model: string ram: string } interface NodeStatus extends NodeSpec { online: boolean worlds: number lastSeen: string | null } const PI_NODES: NodeSpec[] = [ { name: 'aria64', ip: '192.168.4.38', user: 'alexa', role: 'Primary', capacity: 22500, model: 'Pi 5 + AI HAT+', ram: '8GB' }, { name: 'alice', ip: '192.168.4.49', user: 'blackroad', role: 'Secondary', capacity: 7500, model: 'Pi 4B', ram: '8GB' }, { name: 'lucidia', ip: '192.168.4.99', user: 'pi', role: 'Backup', capacity: 2000, model: 'Pi 4B', ram: '4GB' }, ] async function getFleetStatus() { try { const res = await fetch('https://worlds.blackroad.io/stats', { next: { revalidate: 30 }, }) return res.ok ? res.json() : null } catch { return null } } function SSHBadge({ active }: { active: boolean }) { return (
SSH {active ? 'Active' : 'Offline'}
) } export default async function FleetPage() { const data = await getFleetStatus() const nodeWorlds: Record = data?.worlds?.by_node ?? data?.by_node ?? {} const recentWorlds: Array<{ node: string; generated_at: string }> = data?.worlds?.recent ?? data?.recent ?? [] const totalWorlds: number = data?.worlds?.total ?? data?.total ?? 0 // Derive last-seen per node from recent world list const nodeLastSeen: Record = {} for (const w of recentWorlds) { if (!nodeLastSeen[w.node]) nodeLastSeen[w.node] = w.generated_at } const nodes: NodeStatus[] = PI_NODES.map((n) => ({ ...n, worlds: nodeWorlds[n.name] ?? 0, online: (nodeWorlds[n.name] ?? 0) > 0, lastSeen: nodeLastSeen[n.name] ?? null, })) const totalCapacity = PI_NODES.reduce((s, n) => s + n.capacity, 0) const onlineNodes = nodes.filter((n) => n.online).length return (
{/* Header */}

🖥️ Fleet {onlineNodes}/{PI_NODES.length} online

Raspberry Pi agent nodes powering BlackRoad OS

{totalCapacity.toLocaleString()}
total agent slots
{/* Node cards */}
{nodes.map((node) => (
{/* Node header */}
{node.name} {node.role}
{node.user}@{node.ip}
{node.model} · {node.ram} RAM
{node.worlds}
worlds
{node.lastSeen && (
{new Date(node.lastSeen).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', })}
)}
{/* Capacity bar */}
Agent capacity {node.capacity.toLocaleString()}
{Math.round((node.capacity / totalCapacity) * 100)}% of fleet capacity
{/* Grid metrics */}
Status
{node.online ? '● Online' : '○ Offline'}
Worlds
{node.worlds}
Share
{totalWorlds > 0 ? `${Math.round((node.worlds / totalWorlds) * 100)}%` : '—'}
))}
{/* Fleet summary */}

Fleet Summary

{onlineNodes}
Nodes Online
{totalWorlds}
Worlds Generated
{totalCapacity.toLocaleString()}
Agent Slots

Auto-refreshes every 30s · SSH indicators reflect world generation activity

) }