"use client"; // The claw "anatomy" view (design comp, CLAW tier): a central core surrounded by // compartment cards — Skills / Personality / Memory / Tools·Doors / Capabilities // / Safety·§15 — aggregated from the backend. Each compartment is color-tinted. import Link from "next/link"; import { useEffect, useState } from "react"; import { ArrowLeft } from "lucide-react"; interface Compartment { key: string; label: string; items: string[]; count: number | null; } interface RuntimeConfig { model: string | null; sandbox_enabled: boolean; network_allowed: boolean; } const TINT: Record = { skills: "#ff6f61", personality: "#c98af0", memory: "#5fd08a", tools: "#5ec8d8", capabilities: "#e8b465", safety: "#6fd0c0", }; export function ClawAnatomy({ clawId }: { clawId: string }) { const [compartments, setCompartments] = useState([]); const [cfg, setCfg] = useState(null); const [name, setName] = useState("Agent"); const [loaded, setLoaded] = useState(false); useEffect(() => { let live = true; void (async () => { const [c, rc, settings] = await Promise.all([ fetch(`/api/claws/${clawId}/compartments`).then((x) => (x.ok ? x.json() : [])).catch(() => []), fetch(`/api/claws/${clawId}/runtime-config`).then((x) => (x.ok ? x.json() : null)).catch(() => null), fetch(`/api/claws/settings/full?clawId=${clawId}`).then((x) => (x.ok ? x.json() : null)).catch(() => null), ]); if (!live) return; setCompartments(c as Compartment[]); setCfg(rc as RuntimeConfig | null); const n = (settings as { agent?: { name?: string } } | null)?.agent?.name; if (n) setName(n); setLoaded(true); })(); return () => { live = false; }; }, [clawId]); return (
back to chat
{/* Core */}
{name.charAt(0).toUpperCase()}

{name}

ANATOMY · what {name} is made of {cfg?.model ? ● {cfg.model} : null}

{/* Compartments */} {!loaded ? (

Loading…

) : (
{compartments.map((c) => { const tint = TINT[c.key] ?? "#ff6f61"; return (
{c.label.toUpperCase()} {c.count != null ? ( {c.count} ) : null}
{c.items.length === 0 ? (

—

) : (
{c.items.slice(0, 5).map((it, i) => (
{it}
))} {c.items.length > 5 ? (
+{c.items.length - 5} more
) : null}
)}
); })}
)}
); }