{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-bento-grid",
  "type": "registry:ui",
  "dependencies": [
    "framer-motion"
  ],
  "files": [
    {
      "path": "components/ui/agent-bento-grid.tsx",
      "content": "\"use client\";\n\nimport { useState, useEffect } from \"react\";\nimport { motion } from \"framer-motion\";\nimport {\n  ChatCircle,\n  Brain,\n  Database,\n  TerminalWindow,\n  Code,\n  FileText,\n  SlackLogo,\n  NotionLogo,\n  Check,\n  CircleNotch,\n  Clock,\n  Minus,\n  Globe,\n} from \"@phosphor-icons/react\";\nimport { cn } from \"@/lib/utils\";\n\n/* ──────────────────────────────────────────────────────\n   Niche: AI Agent Workspace\n   Grid: 3 cards top row · 2 cards bottom row\n   Each FeatCard takes: title, description, children (visual)\n────────────────────────────────────────────────────── */\n\ninterface FeatCardProps {\n  title: string;\n  description: string;\n  children: React.ReactNode;\n  /** Optional extra classes for sizing/spanning */\n  className?: string;\n}\n\nexport function FeatCard({ title, description, children, className = \"\" }: FeatCardProps) {\n  return (\n    <motion.div\n      initial={{ opacity: 0, y: 16 }}\n      animate={{ opacity: 1, y: 0 }}\n      transition={{ duration: 0.45, ease: [0.22, 1, 0.36, 1] }}\n      className={cn(\n        \"group relative flex flex-col gap-2 overflow-hidden rounded-[20px] p-4\",\n        \"bg-white dark:bg-neutral-900\",\n        \"shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_2px_4px_rgba(0,0,0,0.04)]\",\n        \"dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05),0_0_0_1px_rgba(255,255,255,0.05),0_2px_4px_rgba(0,0,0,0.2)]\",\n        className\n      )}\n    >\n      <div className=\"z-10 flex flex-col gap-1.5\">\n        <h3 className=\"font-semibold text-foreground text-sm tracking-tight\">{title}</h3>\n        <p className=\"text-muted-foreground text-xs leading-relaxed max-w-[90%]\">{description}</p>\n      </div>\n      <div className=\"relative mt-2 flex-1 w-full rounded-[14px] overflow-hidden border border-border/50 bg-background/50 dark:bg-neutral-950/50\">\n        {children}\n      </div>\n    </motion.div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Card1 – Agent Pipeline\n   Minimalist precise node graph with real-time task flows\n   ───────────────────────────────────────────── */\n\ntype ActiveStep = 'request' | 'router' | 'agent' | 'memory' | 'tools' | 'response';\n\nconst VW = 320;\nconst VH = 240;\n\ninterface NodeConfig {\n  id: string;\n  x: number;\n  y: number;\n  icon?: any;\n  label?: string;\n  type: 'box' | 'circle';\n}\n\nconst NODES: NodeConfig[] = [\n  { id: 'A', x: 50, y: 120, icon: ChatCircle, label: \"REQUEST\", type: 'box' },\n  { id: 'Router', x: 125, y: 120, type: 'circle' },\n  { id: 'C', x: 200, y: 120, icon: Brain, label: \"AGENT\", type: 'box' },\n  { id: 'B', x: 280, y: 50, icon: Database, label: \"MEMORY\", type: 'box' },\n  { id: 'D', x: 280, y: 190, icon: TerminalWindow, label: \"TOOLS\", type: 'box' },\n];\n\ninterface FlowPath {\n  id: string;\n  d: string;\n  activeSteps: ActiveStep[];\n  flowDirection: 'forward' | 'backward' | 'both';\n  colorClass: string;\n}\n\nconst PATHS: FlowPath[] = [\n  {\n    id: \"a-to-router\",\n    d: \"M 78 120 L 113 120\",\n    activeSteps: [\"request\"],\n    flowDirection: \"forward\",\n    colorClass: \"text-cyan-500 dark:text-cyan-400\",\n  },\n  {\n    id: \"router-to-agent\",\n    d: \"M 137 120 L 172 120\",\n    activeSteps: [\"agent\"],\n    flowDirection: \"forward\",\n    colorClass: \"text-violet-500 dark:text-violet-400\",\n  },\n  {\n    id: \"agent-to-memory\",\n    d: \"M 200 92 L 200 50 L 252 50\",\n    activeSteps: [\"memory\"],\n    flowDirection: \"both\",\n    colorClass: \"text-fuchsia-500 dark:text-fuchsia-400\",\n  },\n  {\n    id: \"agent-to-tools\",\n    d: \"M 200 148 L 200 190 L 252 190\",\n    activeSteps: [\"tools\"],\n    flowDirection: \"both\",\n    colorClass: \"text-emerald-500 dark:text-emerald-400\",\n  },\n  {\n    id: \"response-flow-1\",\n    d: \"M 172 120 L 137 120\",\n    activeSteps: [\"response\"],\n    flowDirection: \"forward\",\n    colorClass: \"text-cyan-500 dark:text-cyan-400\",\n  },\n  {\n    id: \"response-flow-2\",\n    d: \"M 113 120 L 78 120\",\n    activeSteps: [\"response\"],\n    flowDirection: \"forward\",\n    colorClass: \"text-cyan-500 dark:text-cyan-400\",\n  },\n];\n\nconst NODE_COLORS: Record<string, { bg: string; border: string; text: string; buttonBg: string; buttonBorder: string }> = {\n  A: {\n    bg: \"bg-cyan-500/10 dark:bg-cyan-500/5\",\n    border: \"border-cyan-500/60 dark:border-cyan-400/50\",\n    text: \"text-cyan-600 dark:text-cyan-400\",\n    buttonBg: \"bg-cyan-500\",\n    buttonBorder: \"border-cyan-600\",\n  },\n  Router: {\n    bg: \"bg-amber-500/10 dark:bg-amber-500/5\",\n    border: \"border-amber-500/60 dark:border-amber-400/50\",\n    text: \"text-amber-600 dark:text-amber-400\",\n    buttonBg: \"bg-amber-500\",\n    buttonBorder: \"border-amber-600\",\n  },\n  C: {\n    bg: \"bg-violet-500/10 dark:bg-violet-500/5\",\n    border: \"border-violet-500/60 dark:border-violet-400/50\",\n    text: \"text-violet-600 dark:text-violet-400\",\n    buttonBg: \"bg-violet-500\",\n    buttonBorder: \"border-violet-600\",\n  },\n  B: {\n    bg: \"bg-fuchsia-500/10 dark:bg-fuchsia-500/5\",\n    border: \"border-fuchsia-500/60 dark:border-fuchsia-400/50\",\n    text: \"text-fuchsia-600 dark:text-fuchsia-400\",\n    buttonBg: \"bg-fuchsia-500\",\n    buttonBorder: \"border-fuchsia-600\",\n  },\n  D: {\n    bg: \"bg-emerald-500/10 dark:bg-emerald-500/5\",\n    border: \"border-emerald-500/60 dark:border-emerald-400/50\",\n    text: \"text-emerald-600 dark:text-emerald-400\",\n    buttonBg: \"bg-emerald-500\",\n    buttonBorder: \"border-emerald-600\",\n  },\n};\n\nexport function Card1() {\n  const [step, setStep] = useState<ActiveStep>(\"request\");\n\n  useEffect(() => {\n    const steps: ActiveStep[] = [\"request\", \"router\", \"agent\", \"memory\", \"tools\", \"response\"];\n    let idx = 0;\n    const interval = setInterval(() => {\n      idx = (idx + 1) % steps.length;\n      setStep(steps[idx]);\n    }, 2000);\n    return () => clearInterval(interval);\n  }, []);\n\n  const isNodeActive = (nodeId: string) => {\n    switch (step) {\n      case 'request':\n        return nodeId === 'A';\n      case 'router':\n        return nodeId === 'Router';\n      case 'agent':\n        return nodeId === 'C';\n      case 'memory':\n        return nodeId === 'C' || nodeId === 'B';\n      case 'tools':\n        return nodeId === 'C' || nodeId === 'D';\n      case 'response':\n        return nodeId === 'C' || nodeId === 'Router' || nodeId === 'A';\n      default:\n        return false;\n    }\n  };\n\n  return (\n    <div className=\"w-full h-full relative overflow-hidden select-none bg-neutral-50 dark:bg-neutral-950/80 rounded-xl flex items-center justify-center p-2\">\n      {/* ── Layer 1: Clean dotted grid ── */}\n      <svg className=\"absolute inset-0 w-full h-full\" aria-hidden>\n        <defs>\n          <pattern id=\"clean-grid\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\">\n            <circle cx=\"1.5\" cy=\"1.5\" r=\"0.75\" fill=\"currentColor\" className=\"text-zinc-200 dark:text-zinc-800/60\" />\n          </pattern>\n        </defs>\n        <rect width=\"100%\" height=\"100%\" fill=\"url(#clean-grid)\" />\n      </svg>\n\n      {/* ── Layer 2: Connector SVG & Nodes ── */}\n      <svg\n        className=\"absolute inset-0 w-full h-full\"\n        viewBox={`0 0 ${VW} ${VH}`}\n        preserveAspectRatio=\"xMidYMid meet\"\n        aria-hidden\n      >\n        {/* Base Static Connection Paths */}\n        <path d=\"M 78 120 L 113 120\" fill=\"none\" stroke=\"currentColor\" className=\"text-zinc-200 dark:text-zinc-800/80\" strokeWidth=\"1\" />\n        <path d=\"M 137 120 L 172 120\" fill=\"none\" stroke=\"currentColor\" className=\"text-zinc-200 dark:text-zinc-800/80\" strokeWidth=\"1\" />\n        <path d=\"M 200 92 L 200 50 L 252 50\" fill=\"none\" stroke=\"currentColor\" className=\"text-zinc-200 dark:text-zinc-800/80\" strokeWidth=\"1\" />\n        <path d=\"M 200 148 L 200 190 L 252 190\" fill=\"none\" stroke=\"currentColor\" className=\"text-zinc-200 dark:text-zinc-800/80\" strokeWidth=\"1\" />\n\n        {/* Animated Flow Overlays */}\n        {PATHS.map((p) => {\n          const isActive = p.activeSteps.includes(step);\n          if (!isActive) return null;\n\n          return (\n            <g key={p.id}>\n              {/* Outer soft glow stroke - travels once */}\n              <motion.path\n                d={p.d}\n                fill=\"none\"\n                stroke=\"currentColor\"\n                className={p.colorClass}\n                strokeWidth=\"3.5\"\n                strokeOpacity=\"0.2\"\n                initial={{ pathLength: 0 }}\n                animate={{ pathLength: 1 }}\n                transition={{ duration: 0.8, ease: \"easeInOut\" }}\n              />\n              {/* Sharp solid flowing stroke - travels once */}\n              <motion.path\n                d={p.d}\n                fill=\"none\"\n                stroke=\"currentColor\"\n                className={p.colorClass}\n                strokeWidth=\"1.5\"\n                initial={{ pathLength: 0 }}\n                animate={{ pathLength: 1 }}\n                transition={{ duration: 0.8, ease: \"easeInOut\" }}\n              />\n            </g>\n          );\n        })}\n\n        {/* ForeignObjects for Nodes */}\n        {NODES.map((node) => {\n          const isBox = node.type === 'box';\n          const w = isBox ? 56 : 24;\n          const h = isBox ? 56 : 24;\n          const isActive = isNodeActive(node.id);\n          const colorStyles = NODE_COLORS[node.id];\n\n          return (\n            <foreignObject\n              key={node.id}\n              x={node.x - w / 2}\n              y={node.y - h / 2}\n              width={w}\n              height={h}\n              className=\"overflow-visible\"\n            >\n              <div className=\"w-full h-full flex items-center justify-center\">\n                {isBox && node.icon ? (\n                  <div\n                    className={`w-full h-full rounded-[14px] border flex flex-col items-center justify-center shadow-[inset_0_1px_0_0_rgba(255,255,255,0.4),inset_4px_4px_0_0_rgba(255,255,255,0.06),inset_6px_6px_0_0_rgba(255,255,255,0.04),inset_8px_8px_0_0_rgba(255,255,255,0.02),0_1px_2px_0_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.06),0_4px_6px_0_rgba(0,0,0,0.04),0_6px_8px_0_rgba(0,0,0,0.02)] text-white ${colorStyles.buttonBg} ${colorStyles.buttonBorder}`}\n                  >\n                    {/* Centered Static Icon */}\n                    <div className=\"mb-0.5 flex items-center justify-center\">\n                      <node.icon className=\"w-5 h-5\" weight=\"fill\" />\n                    </div>\n                    <span className=\"text-[8.5px] font-mono font-bold tracking-wider select-none\">\n                      {node.label}\n                    </span>\n                  </div>\n                ) : (\n                  /* Central Router Node Upgrade */\n                  <div\n                    className={`w-5 h-5 rounded-full border-2 flex items-center justify-center shadow-sm transition-all duration-300 ${isActive\n                      ? \"bg-amber-500/20 border-amber-500/70\"\n                      : \"bg-background/80 border-zinc-300 dark:border-zinc-800\"\n                      }`}\n                  >\n                    <motion.div\n                      className={`w-2.5 h-2.5 rounded-full border border-dashed ${isActive ? \"border-amber-500\" : \"border-zinc-400 dark:border-zinc-600\"\n                        }`}\n                      animate={{ rotate: 360 }}\n                      transition={{ repeat: Infinity, duration: 4, ease: \"linear\" }}\n                    />\n                  </div>\n                )}\n              </div>\n            </foreignObject>\n          );\n        })}\n      </svg>\n    </div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Card2 – Live Token / Cost Monitor\n───────────────────────────────────────────── */\nexport function Card2() {\n  const bars = [45, 75, 35, 85, 60, 95, 50];\n  const days = [\"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\", \"SUN\"];\n\n  const [activeIdx, setActiveIdx] = useState(0);\n  const [hoveredIdx, setHoveredIdx] = useState<number | null>(null);\n\n  useEffect(() => {\n    const interval = setInterval(() => {\n      setActiveIdx((prev) => (prev === 0 ? 1 : 0));\n    }, 3000);\n    return () => clearInterval(interval);\n  }, []);\n\n  return (\n    <div className=\"w-full h-full flex flex-col gap-3.5 justify-between\">\n      {/* Stats row with a 0.5rem slide offset margin to prevent slide-up overflow clipping */}\n      <div className=\"flex gap-4 pt-[0.625rem] pr-[0.625rem] pb-0.5 pl-0.5\">\n        {[\n          { label: \"Tokens/min\", value: \"12.4k\", trend: \"+8%\" },\n          { label: \"Cost/run\", value: \"$0.042\", trend: \"-3%\" },\n        ].map((s, i) => {\n          const isActive = i === activeIdx || hoveredIdx === i;\n\n          return (\n            <div key={i} className=\"flex-1 h-[76px] relative select-none\">\n              {/* Background Hatched Scale Card */}\n              <div\n                className=\"absolute inset-0 rounded-xl border border-border/40 dark:border-border/20 bg-muted/5 text-border/30 dark:text-border/20\"\n                style={{\n                  backgroundImage: \"repeating-linear-gradient(45deg, transparent, transparent 6px, currentColor 6px, currentColor 7px)\",\n                }}\n              />\n\n              {/* Foreground Card sliding up and right on hover or cycle activation (0.5rem offset) */}\n              <motion.div\n                className=\"absolute inset-0 w-full h-full rounded-xl bg-muted/20 dark:bg-neutral-950/80 border border-border/50 shadow-[inset_0_0_0_1px_rgba(255,255,255,1)] dark:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.01)] p-3 hover:bg-muted/30 transition-colors duration-300 backdrop-blur-[2px] flex items-center justify-between gap-3 cursor-pointer\"\n                animate={{\n                  x: isActive ? \"0.5rem\" : \"0rem\",\n                  y: isActive ? \"-0.5rem\" : \"0rem\",\n                }}\n                transition={{ type: \"spring\", stiffness: 200, damping: 16 }}\n                onMouseEnter={() => setHoveredIdx(i)}\n                onMouseLeave={() => setHoveredIdx(null)}\n              >\n                {/* Left Column: Metric Details */}\n                <div className=\"flex flex-col min-w-0\">\n                  <span className=\"text-[8px] text-muted-foreground/80 font-mono uppercase tracking-widest leading-none\">{s.label}</span>\n                  <span className=\"text-base font-bold font-mono text-foreground leading-none mt-1.5 tracking-tight\">{s.value}</span>\n                  <div className=\"flex items-center gap-1.5 mt-2\">\n                    <span className={`text-[8px] font-mono font-bold ${s.trend.startsWith(\"+\") ? \"text-emerald-500\" : \"text-rose-400\"\n                      }`}>\n                      {s.trend}\n                    </span>\n                    <span className=\"text-[8px] text-muted-foreground/50 font-mono\">prev</span>\n                  </div>\n                </div>\n\n                {/* Right Column: High-Precision Sparkline with Micro Vertices */}\n                <div className=\"w-12 h-6 flex items-center justify-center shrink-0\">\n                  <svg className=\"w-full h-full overflow-visible\" viewBox=\"0 0 48 24\">\n                    {/* Connecting Line */}\n                    <motion.path\n                      d={i === 0\n                        ? \"M 0 18 L 16 11 L 32 14 L 48 4\"\n                        : \"M 0 4 L 16 12 L 32 8 L 48 18\"\n                      }\n                      fill=\"none\"\n                      stroke=\"currentColor\"\n                      className=\"text-muted-foreground/30 dark:text-muted-foreground/20\"\n                      strokeWidth=\"1\"\n                      strokeLinecap=\"round\"\n                      strokeLinejoin=\"round\"\n                      initial={{ pathLength: 0 }}\n                      animate={{ pathLength: 1 }}\n                      transition={{ duration: 0.8, delay: 0.2 + i * 0.15, ease: \"easeOut\" }}\n                    />\n\n                    {/* Vertex Dots */}\n                    {(i === 0\n                      ? [{ x: 0, y: 18 }, { x: 16, y: 11 }, { x: 32, y: 14 }, { x: 48, y: 4 }]\n                      : [{ x: 0, y: 4 }, { x: 16, y: 12 }, { x: 32, y: 8 }, { x: 48, y: 18 }]\n                    ).map((pt, idx) => (\n                      <motion.circle\n                        key={idx}\n                        cx={pt.x}\n                        cy={pt.y}\n                        r=\"1.5\"\n                        className=\"fill-background stroke-muted-foreground/40 dark:stroke-muted-foreground/30\"\n                        strokeWidth=\"1\"\n                        initial={{ scale: 0, opacity: 0 }}\n                        animate={{ scale: 1, opacity: 1 }}\n                        transition={{ delay: 0.5 + idx * 0.08, duration: 0.25 }}\n                      />\n                    ))}\n                  </svg>\n                </div>\n              </motion.div>\n            </div>\n          );\n        })}\n      </div>\n\n      {/* Bar chart */}\n      <div className=\"flex-1 flex items-end gap-2.5 px-0.5 min-h-[90px]\">\n        {bars.map((h, i) => (\n          <div\n            key={i}\n            className=\"flex-1 h-full rounded-xl dark:bg-neutral-950/80 border border-border/80 dark:border-border/30 relative overflow-hidden bg-muted/5 text-border/40 dark:text-border/20\"\n            style={{\n              backgroundImage: \"repeating-linear-gradient(45deg, transparent, transparent 6px, currentColor 6px, currentColor 7px)\",\n            }}\n          >\n            {/* Animated Solid Filled Bar at bottom */}\n            <motion.div\n              className=\"absolute bottom-0 left-0 right-0 bg-primary border-t border-x border-primary/80 shadow-[inset_0_0.5px_0_0_rgba(255,255,255,0.6),inset_0_8px_12px_0_rgba(255,255,255,0.03),inset_0.5px_0_0_0_rgba(255,255,255,0.2),inset_0_2px_6px_0_rgba(255,255,255,0.3),inset_0_-0.5px_0_0_rgba(0,0,0,0.2),inset_-0.5px_0_0_0_rgba(0,0,0,0.1),inset_0_-2px_6px_0_rgba(0,0,0,0.1),0_1px_2px_0_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.06),0_4px_6px_0_rgba(0,0,0,0.04),inset_0_-4px_8px_0_rgba(0,0,0,0.05)] rounded-t-[10px]\"\n              initial={{ height: \"0%\" }}\n              animate={{\n                height: [\n                  `${h}%`,\n                  `${Math.min(95, h + 15)}%`,\n                  `${Math.max(10, h - 20)}%`,\n                  `${Math.min(90, h + 8)}%`,\n                  `${h}%`\n                ],\n              }}\n              transition={{\n                repeat: Infinity,\n                duration: 3 + (i % 3) * 0.8,\n                ease: \"easeInOut\",\n                delay: i * 0.1,\n              }}\n            />\n          </div>\n        ))}\n      </div>\n\n      {/* X labels */}\n      <div className=\"flex gap-2.5 px-0.5\">\n        {days.map((d, i) => (\n          <p key={i} className=\"flex-1 text-center text-[8px] text-muted-foreground font-mono font-medium\">{d}</p>\n        ))}\n      </div>\n    </div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Card3 – Stacked Infinite-Scroll Activity Feed\n   ───────────────────────────────────────────── */\n\nconst STATUS_ICONS: Record<string, { icon: any; color: string; bg: string; gradient: string; border: string }> = {\n  done: { icon: Check, color: \"text-lime-500\", bg: \"bg-lime-500/15\", gradient: \"bg-gradient-to-b from-lime-400 to-lime-600\", border: \"border-lime-600\" },\n  running: { icon: CircleNotch, color: \"text-blue-400\", bg: \"bg-blue-400/15\", gradient: \"bg-gradient-to-b from-blue-400 to-blue-600\", border: \"border-blue-600\" },\n  waiting: { icon: Clock, color: \"text-amber-400\", bg: \"bg-amber-400/15\", gradient: \"bg-gradient-to-b from-amber-400 to-amber-600\", border: \"border-amber-600\" },\n  idle: { icon: Minus, color: \"text-muted-foreground/60\", bg: \"bg-muted/40\", gradient: \"bg-gradient-to-b from-zinc-400 to-zinc-600\", border: \"border-zinc-600\" },\n};\n\nexport function Card3() {\n  const logs = [\n    { agent: \"Planner\", action: \"Decomposed task into 4 sub-goals\", status: \"done\", t: \"0.2s\" },\n    { agent: \"Researcher\", action: \"Queried web for latest embeddings\", status: \"done\", t: \"1.4s\" },\n    { agent: \"Coder\", action: \"Generating vector DB schema…\", status: \"running\", t: \"3.1s\" },\n    { agent: \"Reviewer\", action: \"Awaiting output from Coder\", status: \"waiting\", t: \"—\" },\n    { agent: \"Writer\", action: \"Idle — queued\", status: \"idle\", t: \"—\" },\n  ];\n\n  const [activeIdx, setActiveIdx] = useState(0);\n\n  useEffect(() => {\n    const interval = setInterval(() => {\n      setActiveIdx((prev) => (prev + 1) % logs.length);\n    }, 2400);\n    return () => clearInterval(interval);\n  }, [logs.length]);\n\n  // Signed slot: 0 = active front, negative = above (upcoming), positive = below (past)\n  const getSlot = (i: number) => {\n    const N = logs.length;\n    let rel = i - activeIdx;\n    if (rel > Math.floor(N / 2)) rel -= N;\n    if (rel < -Math.floor(N / 2)) rel += N;\n    return rel;\n  };\n\n  // Fixed y positions: tighter stack, not linear steps\n  const Y: Record<string, number> = { \"-2\": -68, \"-1\": -38, \"0\": 0, \"1\": 38, \"2\": 68 };\n\n  return (\n    <div className=\"w-full h-full relative flex items-center justify-center overflow-hidden\">\n      {logs.map((l, i) => {\n        const slot = getSlot(i);\n        const si = STATUS_ICONS[l.status];\n        const abs = Math.abs(slot);\n        const isActive = slot === 0;\n        const isVisible = abs <= 2;\n\n        const yOffset = Y[String(slot)] ?? (slot < 0 ? -120 : 120);\n        const scale = isActive ? 1 : abs === 1 ? 0.93 : 0.87;\n        const opacity = isActive ? 1 : abs === 1 ? 0.65 : 0.38;\n        const zIndex = isActive ? 30 : abs === 1 ? 20 : 10;\n\n        return (\n          <motion.div\n            key={l.agent}\n            className=\"absolute left-0 right-0 mx-auto px-1.5\"\n            style={{ zIndex }}\n            animate={{\n              y: isVisible ? yOffset : slot < 0 ? -150 : 150,\n              scale,\n              opacity: isVisible ? opacity : 0,\n            }}\n            transition={{\n              y: { type: \"spring\", stiffness: 500, damping: 35 },\n              scale: { type: \"spring\", stiffness: 500, damping: 35 },\n              opacity: { duration: 0.25, ease: \"easeOut\" },\n            }}\n          >\n            <div className={`w-full rounded-2xl border flex items-center gap-2.5 ${isActive\n              ? \"px-3 py-2.5 bg-background border-border\"\n              : \"px-2.5 py-1.5 bg-muted/30 border-border/50\"\n              }`}>\n\n              {/* Icon badge — full on active, compact on behind */}\n              <div className={`shrink-0 rounded-[8px] flex items-center justify-center font-bold text-white transition-all duration-300 ${si.gradient} border ${si.border} shadow-[inset_0_0.5px_0_0_rgba(255,255,255,0.6),inset_0.5px_0_0_0_rgba(255,255,255,0.2),inset_0_2px_6px_0_rgba(255,255,255,0.3),inset_0_-0.5px_0_0_rgba(0,0,0,0.3),inset_-0.5px_0_0_0_rgba(0,0,0,0.1),inset_0_-2px_6px_0_rgba(0,0,0,0.1),0_1px_2px_0_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.06),0_4px_6px_0_rgba(0,0,0,0.04)] ${isActive ? \"w-8 h-8\" : \"w-5 h-5\"\n                }`}>\n                <si.icon weight=\"bold\" className={`${isActive ? \"w-4 h-4\" : \"w-2.5 h-2.5\"} ${l.status === \"running\" ? \"animate-spin\" : \"\"}`} />\n              </div>\n\n              {/* Text — full on active, name-only on behind */}\n              <div className=\"flex-1 min-w-0\">\n                <div className=\"flex items-center gap-1.5\">\n                  <span className={`font-mono font-semibold text-foreground leading-none ${isActive ? \"text-[10px]\" : \"text-[9px]\"\n                    }`}>{l.agent}</span>\n                  <span className={`font-mono uppercase tracking-wide rounded px-1 py-0.5 ${si.bg} ${si.color} ${isActive ? \"text-[7px]\" : \"text-[6px]\"\n                    }`}>{l.status}</span>\n                </div>\n                {isActive && (\n                  <p className=\"text-[9px] text-muted-foreground truncate mt-0.5 leading-tight\">{l.action}</p>\n                )}\n              </div>\n\n              {isActive && (\n                <span className=\"text-[9px] font-mono text-muted-foreground shrink-0\">{l.t}</span>\n              )}\n            </div>\n          </motion.div>\n        );\n      })}\n\n      {/* Progress dots */}\n      <div className=\"absolute bottom-1 left-0 right-0 flex justify-center gap-1\">\n        {logs.map((_, i) => (\n          <motion.div\n            key={i}\n            className=\"rounded-full bg-foreground/25\"\n            animate={{\n              width: i === activeIdx ? 14 : 4,\n              opacity: i === activeIdx ? 0.7 : 0.2,\n            }}\n            style={{ height: 3 }}\n            transition={{ duration: 0.4, ease: [0.16, 1, 0.3, 1] }}\n          />\n        ))}\n      </div>\n    </div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Card4 – Memory / Knowledge Base Namespaces\n   ───────────────────────────────────────────── */\n\nconst NS_ICONS: Record<string, React.ElementType> = {\n  codebase: Code,\n  docs: FileText,\n  slack: SlackLogo,\n  notion: NotionLogo,\n};\n\nconst NS_COLORS: Record<string, { bar: string; dot: string; badge: string; buttonBg: string; buttonBorder: string }> = {\n  codebase: { bar: \"from-violet-500 to-violet-400\", dot: \"bg-violet-500\", badge: \"bg-violet-500/15 text-violet-400\", buttonBg: \"bg-violet-500\", buttonBorder: \"border-violet-600\" },\n  docs: { bar: \"from-sky-500    to-sky-400\", dot: \"bg-sky-500\", badge: \"bg-sky-500/15 text-sky-400\", buttonBg: \"bg-sky-500\", buttonBorder: \"border-sky-600\" },\n  slack: { bar: \"from-emerald-500 to-emerald-400\", dot: \"bg-emerald-500\", badge: \"bg-emerald-500/15 text-emerald-400\", buttonBg: \"bg-emerald-500\", buttonBorder: \"border-emerald-600\" },\n  notion: { bar: \"from-amber-500  to-amber-400\", dot: \"bg-amber-500\", badge: \"bg-amber-500/15 text-amber-400\", buttonBg: \"bg-amber-500\", buttonBorder: \"border-amber-600\" },\n};\n\nconst RETRIEVAL_QUERIES = [\n  { ns: \"codebase\", q: \"vector embeddings auth module\", t: \"0.2s\" },\n  { ns: \"docs\", q: \"API rate limiting config\", t: \"1.1s\" },\n  { ns: \"codebase\", q: \"Redis cache invalidation patterns\", t: \"2.4s\" },\n  { ns: \"slack\", q: \"deployment discussion #eng\", t: \"4.0s\" },\n  { ns: \"notion\", q: \"Q3 roadmap — agent features\", t: \"5.8s\" },\n  { ns: \"docs\", q: \"OpenAI function calling schema\", t: \"7.2s\" },\n];\n\nexport function Card4() {\n  const namespaces = [\n    { name: \"codebase\", hits: 342, fill: 88 },\n    { name: \"docs\", hits: 218, fill: 56 },\n    { name: \"slack\", hits: 97, fill: 25 },\n    { name: \"notion\", hits: 54, fill: 14 },\n  ];\n\n  const [tick, setTick] = useState(0);\n\n  useEffect(() => {\n    const interval = setInterval(() => {\n      setTick((prev) => (prev + 1) % RETRIEVAL_QUERIES.length);\n    }, 2000);\n    return () => clearInterval(interval);\n  }, []);\n\n  const activeNs = RETRIEVAL_QUERIES[tick].ns;\n  const recentQueries = [0, 1, 2, 3].map(\n    (offset) => RETRIEVAL_QUERIES[(tick - offset + RETRIEVAL_QUERIES.length) % RETRIEVAL_QUERIES.length]\n  );\n\n  return (\n    <div className=\"w-full h-full flex gap-5 py-2 px-3\">\n\n      {/* ── Left panel: Namespace bars ── */}\n      <div className=\"flex-1 flex flex-col gap-0 min-w-0 pr-2\">\n        <p className=\"text-[8px] font-mono uppercase tracking-widest text-muted-foreground mb-3\">Namespaces</p>\n\n        <div className=\"flex flex-col gap-3 flex-1\">\n          {namespaces.map((ns, i) => {\n            const c = NS_COLORS[ns.name];\n            const isActive = ns.name === activeNs;\n            const Icon = (NS_ICONS[ns.name] || Database) as React.ComponentType<{ size?: number; weight?: string; className?: string }>;\n\n            return (\n              <div key={ns.name} className=\"flex items-center gap-3 group relative\">\n\n                {/* Icon Container with 3D effect */}\n                <div\n                  className={`relative flex shrink-0 items-center justify-center w-[36px] h-[36px] rounded-[12px] border transition-all duration-500 ${isActive ? `shadow-[inset_0_1px_0_0_rgba(255,255,255,0.4),inset_4px_4px_0_0_rgba(255,255,255,0.06),inset_6px_6px_0_0_rgba(255,255,255,0.04),inset_8px_8px_0_0_rgba(255,255,255,0.02),0_1px_2px_0_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.06),0_4px_6px_0_rgba(0,0,0,0.04),0_6px_8px_0_rgba(0,0,0,0.02)] text-white ${c.buttonBg} ${c.buttonBorder} scale-105` : 'dark:bg-neutral-950/80 shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_1px_2px_-1px_rgba(0,0,0,0.06),0_2px_4px_0px_rgba(0,0,0,0.04)] bg-white border-transparent text-[#A1A1A1]'}`}\n                >\n                  <Icon size={16} weight={isActive ? \"fill\" : \"regular\"} className=\"relative z-10\" />\n                </div>\n\n                {/* Name */}\n                <span className={`text-[10px] font-mono w-16 shrink-0 transition-colors duration-400 ${isActive ? \"text-foreground font-semibold\" : \"text-muted-foreground group-hover:text-foreground/70\"}`}>\n                  {ns.name}\n                </span>\n\n                {/* Cyberpunk Bar track */}\n                <div className=\"flex-1 h-1.5 bg-muted/30 rounded-full overflow-hidden relative backdrop-blur-sm shadow-inner\">\n                  <motion.div\n                    className={`absolute left-0 top-0 bottom-0 rounded-full overflow-hidden bg-gradient-to-r ${c.bar}`}\n                    initial={{ width: \"0%\" }}\n                    animate={{ width: `${ns.fill}%`, opacity: isActive ? 1 : 0.25 }}\n                    transition={{\n                      width: { duration: 1.2, delay: i * 0.1, type: \"spring\", bounce: 0.2 },\n                      opacity: { duration: 0.4 },\n                    }}\n                  >\n                    {/* Scanning light beam effect inside the bar */}\n                    {isActive && (\n                      <motion.div\n                        className=\"absolute inset-y-0 left-0 w-full bg-gradient-to-r from-transparent via-white/50 to-transparent\"\n                        initial={{ x: \"-100%\" }}\n                        animate={{ x: \"100%\" }}\n                        transition={{ repeat: Infinity, duration: 1.5, ease: \"linear\" }}\n                      />\n                    )}\n                  </motion.div>\n                </div>\n\n                {/* Hit count */}\n                <div className={`flex items-center gap-1.5 w-10 justify-end transition-all duration-500 ${isActive ? \"opacity-100 scale-105\" : \"opacity-60 scale-100\"}`}>\n                  <span className={`text-[9px] font-mono font-medium ${isActive ? \"text-foreground\" : \"text-muted-foreground\"}`}>\n                    {ns.hits}\n                  </span>\n                  {isActive && (\n                    <motion.div\n                      className={`w-1 h-1 rounded-full ${c.dot}`}\n                      animate={{ opacity: [1, 0.2, 1], scale: [1, 1.5, 1] }}\n                      transition={{ repeat: Infinity, duration: 1 }}\n                    />\n                  )}\n                </div>\n              </div>\n            );\n          })}\n        </div>\n\n        {/* Live indicator */}\n        <div className=\"flex items-center gap-2 pt-3 mt-auto\">\n          <div className=\"relative flex items-center justify-center w-2 h-2\">\n            <motion.div\n              className=\"absolute inset-0 rounded-full bg-emerald-400/40\"\n              animate={{ scale: [1, 2.5, 1], opacity: [0.5, 0, 0.5] }}\n              transition={{ repeat: Infinity, duration: 2, ease: \"easeInOut\" }}\n            />\n            <div className=\"w-1.5 h-1.5 rounded-full bg-emerald-400\" />\n          </div>\n          <span className=\"text-[8px] font-mono text-muted-foreground font-medium tracking-wide\">Live retrieval active</span>\n        </div>\n      </div>\n\n      {/* Thin divider */}\n      <div className=\"w-px bg-border/30 self-stretch shrink-0\" />\n\n      {/* ── Right panel: Retrieval log ── */}\n      <div className=\"w-[172px] shrink-0 flex flex-col gap-0\">\n        <p className=\"text-[8px] font-mono uppercase tracking-widest text-muted-foreground mb-2.5\">Retrieval Log</p>\n\n        <div className=\"flex flex-col gap-1.5 flex-1 overflow-hidden\">\n          {recentQueries.map((q, qi) => {\n            const c = NS_COLORS[q.ns];\n            return (\n              <motion.div\n                key={`${q.ns}-${q.q}-${qi}`}\n                className=\"rounded-xl border border-border/40 bg-muted/20 dark:bg-neutral-950/80 px-2.5 py-2\"\n                initial={{ opacity: 0, y: -8 }}\n                animate={{\n                  opacity: qi === 0 ? 1 : qi === 1 ? 0.8 : qi === 2 ? 0.5 : 0.25,\n                  y: 0,\n                }}\n                transition={{ type: \"spring\", stiffness: 500, damping: 35, delay: qi * 0.05 }}\n              >\n                <div className=\"flex items-center gap-1 mb-1\">\n                  <span className={`text-[6.5px] font-mono font-semibold uppercase px-1.5 py-0.5 rounded-md ${c.badge}`}>\n                    {q.ns}\n                  </span>\n                  <span className=\"text-[7px] font-mono text-muted-foreground/50 ml-auto tabular-nums\">{q.t}</span>\n                </div>\n                <p className=\"text-[8px] text-foreground/75 leading-tight font-mono truncate\">{q.q}</p>\n              </motion.div>\n            );\n          })}\n        </div>\n      </div>\n\n    </div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Card5 – Tool Call Inspector\n───────────────────────────────────────────── */\nexport function Card5() {\n  const tools = [\n    { name: \"web_search\", calls: 14, icon: Globe, latency: \"280ms\", color: \"bg-gradient-to-b from-sky-400 to-sky-600\", borderColor: \"border-sky-600\" },\n    { name: \"code_exec\", calls: 8, icon: TerminalWindow, latency: \"1.2s\", color: \"bg-gradient-to-b from-emerald-400 to-emerald-600\", borderColor: \"border-emerald-600\" },\n    { name: \"file_read\", calls: 22, icon: FileText, latency: \"12ms\", color: \"bg-gradient-to-b from-amber-400 to-amber-600\", borderColor: \"border-amber-600\" },\n    { name: \"vector_query\", calls: 31, icon: Brain, latency: \"95ms\", color: \"bg-gradient-to-b from-violet-400 to-violet-600\", borderColor: \"border-violet-600\" },\n  ];\n\n  return (\n    <div className=\"w-full h-full flex items-center justify-center\">\n      <div className=\"grid grid-cols-2 gap-2 w-full\">\n        {tools.map((t, i) => (\n          <motion.div\n            key={i}\n            className=\"relative rounded-[16px] border border-border/50 bg-background dark:bg-neutral-950/50 shadow-sm hover:shadow-md transition-all duration-300 flex flex-col justify-between p-2.5 group hover:border-border\"\n            initial={{ opacity: 0, y: 10 }}\n            animate={{ opacity: 1, y: 0 }}\n            transition={{ delay: i * 0.1, type: \"spring\", stiffness: 300, damping: 25 }}\n          >\n            {/* Top Row: 3D Icon + Calls */}\n            <div className=\"flex items-start justify-between\">\n              <div className={`w-[28px] h-[28px] rounded-[8px] flex items-center justify-center text-white ${t.color} border ${t.borderColor} shadow-[inset_0_0.5px_0_0_rgba(255,255,255,0.6),inset_0.5px_0_0_0_rgba(255,255,255,0.2),inset_0_2px_6px_0_rgba(255,255,255,0.3),inset_0_-0.5px_0_0_rgba(0,0,0,0.3),inset_-0.5px_0_0_0_rgba(0,0,0,0.1),inset_0_-2px_6px_0_rgba(0,0,0,0.1),0_1px_2px_0_rgba(0,0,0,0.08),0_2px_4px_0_rgba(0,0,0,0.06),0_4px_6px_0_rgba(0,0,0,0.04)] group-hover:scale-105 transition-transform duration-300`}>\n                <t.icon weight=\"fill\" className=\"w-3.5 h-3.5 relative z-10\" />\n              </div>\n\n              <div className=\"flex flex-col items-end gap-0.5 mt-0.5\">\n                <span className=\"text-[12px] font-mono font-bold text-foreground leading-none\">{t.calls}</span>\n                <span className=\"text-[7px] font-mono text-muted-foreground/80 uppercase tracking-widest leading-none\">Calls</span>\n              </div>\n            </div>\n\n            {/* Bottom Row: Name + Latency + Progress */}\n            <div className=\"mt-2 flex flex-col gap-1.5\">\n              <div className=\"flex items-center justify-between\">\n                <span className=\"text-[10px] font-mono font-medium text-foreground tracking-tight\">{t.name}</span>\n                <span className=\"text-[8px] font-mono text-muted-foreground tabular-nums\">{t.latency}</span>\n              </div>\n              <div className=\"w-full h-1.5 bg-muted/50 rounded-full overflow-hidden shadow-inner relative\">\n                <motion.div\n                  className={`absolute left-0 top-0 bottom-0 rounded-full ${t.color}`}\n                  initial={{ width: \"0%\" }}\n                  animate={{ width: `${(t.calls / 31) * 100}%` }}\n                  transition={{ delay: 0.4 + i * 0.1, duration: 0.8, ease: \"easeOut\" }}\n                />\n              </div>\n            </div>\n          </motion.div>\n        ))}\n      </div>\n    </div>\n  );\n}\n\n/* ─────────────────────────────────────────────\n   Main Grid Component\n───────────────────────────────────────────── */\nconst CARDS = [\n  {\n    title: \"Agent Pipeline\",\n    description: \"Visualise how tasks flow across your multi-agent graph in real time.\",\n    visual: <Card1 />,\n    colSpan: \"lg:col-span-1\",\n    height: \"h-[260px]\",\n  },\n  {\n    title: \"Token Monitor\",\n    description: \"Track LLM token usage and cost-per-run across every model call.\",\n    visual: <Card2 />,\n    colSpan: \"lg:col-span-1\",\n    height: \"h-[260px]\",\n  },\n  {\n    title: \"Activity Feed\",\n    description: \"Real-time logs of agent actions, tool calls, and memory retrievals.\",\n    visual: <Card3 />,\n    colSpan: \"lg:col-span-1\",\n    height: \"h-[260px]\",\n  },\n  {\n    title: \"Knowledge Base\",\n    description: \"Semantic search across documents, codebases, and conversations.\",\n    visual: <Card4 />,\n    colSpan: \"lg:col-span-2\",\n    height: \"h-[260px]\",\n  },\n  {\n    title: \"Tool Inspector\",\n    description: \"Monitor tool usage, latency, and success rates across all agents.\",\n    visual: <Card5 />,\n    colSpan: \"lg:col-span-1\",\n    height: \"h-[260px]\",\n  }\n];\n\nexport interface AgentBentoGridProps {\n  className?: string;\n}\n\nexport function AgentBentoGrid({ className }: AgentBentoGridProps) {\n  return (\n    <div className={cn(\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2 w-full max-w-5xl mx-auto\", className)}>\n      {CARDS.map((card, idx) => (\n        <FeatCard\n          key={idx}\n          title={card.title}\n          description={card.description}\n          className={cn(card.colSpan, card.height)}\n        >\n          {card.visual}\n        </FeatCard>\n      ))}\n    </div>\n  );\n}\n\nexport default AgentBentoGrid;\n",
      "type": "registry:ui",
      "target": "components/ui/agent-bento-grid.tsx"
    }
  ]
}