import Link from "next/link"; async function getStats() { try { const base = process.env.BLACKROAD_GATEWAY_URL || "http://127.0.0.1:8787"; const [health, agentsRes, tasksRes, memRes] = await Promise.allSettled([ fetch(`${base}/health`, { cache: "no-store" }).then(r => r.json()), fetch(`${base}/agents`, { cache: "no-store" }).then(r => r.json()), fetch(`${base}/tasks`, { cache: "no-store" }).then(r => r.json()), fetch(`${base}/memory?limit=1`, { cache: "no-store" }).then(r => r.json()), ]); return { gateway: health.status === "fulfilled" ? "online" : "offline", agents: agentsRes.status === "fulfilled" ? (agentsRes.value as Record).agents?.length ?? 0 : 0, online: agentsRes.status === "fulfilled" ? ((agentsRes.value as Record).agents || []).filter(a => a.status === "online").length : 0, tasks: tasksRes.status === "fulfilled" ? (tasksRes.value as Record).tasks?.length ?? 0 : 0, memory: memRes.status === "fulfilled" ? (memRes.value as Record).total ?? 0 : 0, }; } catch { return { gateway: "offline", agents: 0, online: 0, tasks: 0, memory: 0 }; } } const CARDS = [ { href: "/agents", icon: "◈", label: "Agents", desc: "Fleet status and capabilities", color: "from-red-950 to-red-900/50 border-red-900" }, { href: "/tasks", icon: "◉", label: "Tasks", desc: "Post and claim work items", color: "from-blue-950 to-blue-900/50 border-blue-900" }, { href: "/memory", icon: "◫", label: "Memory", desc: "PS-SHA∞ chain viewer", color: "from-purple-950 to-purple-900/50 border-purple-900" }, { href: "/chat", icon: "◎", label: "Chat", desc: "Talk to agent personas", color: "from-green-950 to-green-900/50 border-green-900" }, ]; export default async function DashboardPage() { const stats = await getStats(); const statItems = [ { label: "Gateway", value: stats.gateway === "online" ? "Online" : "Offline", color: stats.gateway === "online" ? "text-green-400" : "text-red-400" }, { label: "Agents Online", value: stats.online.toLocaleString(), color: "text-blue-400" }, { label: "Active Tasks", value: stats.tasks.toLocaleString(), color: "text-yellow-400" }, { label: "Memories", value: stats.memory.toLocaleString(), color: "text-purple-400" }, ]; return (
{/* Header */}

BlackRoad{" "} OS

Your AI. Your Hardware. Your Rules.

{/* Stats */}
{statItems.map(({ label, value, color }) => (
{value}
{label}
))}
{/* Nav cards */}
{CARDS.map(({ href, icon, label, desc, color }) => (
{icon}
{label}
{desc}
))}
{/* Fleet identity */}

Core Agent Fleet

{[ { name: "LUCIDIA", role: "Philosopher", color: "text-red-400", dot: "bg-red-400" }, { name: "ALICE", role: "Executor", color: "text-green-400", dot: "bg-green-400" }, { name: "OCTAVIA", role: "Operator", color: "text-purple-400", dot: "bg-purple-400" }, { name: "PRISM", role: "Analyst", color: "text-yellow-400", dot: "bg-yellow-400" }, { name: "ECHO", role: "Librarian", color: "text-blue-400", dot: "bg-blue-400" }, { name: "CIPHER", role: "Guardian", color: "text-slate-300", dot: "bg-slate-300" }, ].map(({ name, role, color, dot }) => (
{name}
{role}
))}
); }