{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-agent-orchestrator",
  "title": "Ai Agent Orchestrator",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-react/blocks/ai-agent-orchestrator/AiAgentOrchestrator.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport {\n  Activity,\n  Bot,\n  Check,\n  CheckCircle2,\n  ChevronDown,\n  ChevronRight,\n  Clock,\n  Code2,\n  Compass,\n  Copy,\n  FastForward,\n  FileCode2,\n  FileText,\n  Globe,\n  Layers,\n  Pause,\n  Play,\n  RefreshCw,\n  RotateCcw,\n  Search,\n  ShieldCheck,\n  Sparkles,\n  Terminal,\n  X,\n} from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Progress } from '@/components/ui/progress'\n\ninterface Props {\n  className?: string\n}\n\ntype AgentId = 'planner' | 'researcher' | 'engineer' | 'reviewer'\ntype NodeStatus = 'completed' | 'running' | 'queued'\n\ninterface ThoughtStep {\n  id: string\n  title: string\n  duration: string\n  status: 'completed' | 'running' | 'queued'\n  detail: string\n}\n\ninterface ToolInvocation {\n  name: string\n  count: number\n  icon: string\n}\n\ninterface AgentNode {\n  id: AgentId\n  stepNumber: number\n  name: string\n  role: string\n  iconName: string\n  model: string\n  status: NodeStatus\n  duration: string\n  task: string\n  tokens: string\n  speed: string\n  progress: number\n  tools: ToolInvocation[]\n  thoughts: ThoughtStep[]\n  artifactFileName: string\n  artifactSize: string\n  artifactCode: string\n}\n\nconst initialCodeSnippet = `import * as React from 'react'\nimport { useAgentGraph } from '@/hooks/useAgentGraph'\n\nexport interface AgentWorkflowConfig {\n  pipelineId: string\n  name: string\n  autonomousMode: boolean\n  maxRetries: number\n  timeoutMs: number\n}\n\nexport interface ExecutionArtifact {\n  fileName: string\n  language: string\n  content: string\n  checksum: string\n}\n\nexport async function dispatchAgentWorkflow(\n  config: AgentWorkflowConfig\n): Promise<ExecutionArtifact[]> {\n  const orchestrator = new MultiAgentEngine({\n    model: 'claude-3-5-sonnet',\n    telemetry: true,\n  })\n\n  // Stream reasoning thoughts and token outputs\n  const stream = await orchestrator.executePipeline(config.pipelineId)\n  return stream.collectArtifacts()\n}`\n\nconst initialNodes: AgentNode[] = [\n  {\n    id: 'planner',\n    stepNumber: 1,\n    name: 'Planner Agent',\n    role: 'Task Decomposition & Schema',\n    iconName: 'Compass',\n    model: 'Claude 3.5',\n    status: 'completed',\n    duration: '12s',\n    task: 'Deconstruct task into 4 sub-goals',\n    tokens: '842 tokens',\n    speed: '52 tok/s',\n    progress: 100,\n    tools: [\n      { name: 'spec_parse', count: 1, icon: 'Terminal' },\n      { name: 'context_index', count: 4, icon: 'FileText' },\n    ],\n    thoughts: [\n      {\n        id: 'p1',\n        title: 'Analyze project manifest and user constraints',\n        duration: '3.2s',\n        status: 'completed',\n        detail:\n          'Identified dual-framework registry requirement (Vue SFC + React TSX) with Tailwind v4 OKLCH token mapping.',\n      },\n      {\n        id: 'p2',\n        title: 'Partition workflow into 4 autonomous agent stages',\n        duration: '8.8s',\n        status: 'completed',\n        detail: 'Created topological execution graph: Planner -> Researcher -> Code Engineer -> Reviewer & QA.',\n      },\n    ],\n    artifactFileName: 'pipeline-manifest.json',\n    artifactSize: '1.1 kB',\n    artifactCode: `{\\n  \"pipeline\": \"autonomous-research-codegen\",\\n  \"stages\": 4,\\n  \"target\": \"UIPKGE Block Registry\",\\n  \"strictMode\": true\\n}`,\n  },\n  {\n    id: 'researcher',\n    stepNumber: 2,\n    name: 'Research Agent',\n    role: 'Documentation & API Contracts',\n    iconName: 'Search',\n    model: 'GPT-4o',\n    status: 'completed',\n    duration: '45s',\n    task: 'Query documentation and verify API contracts',\n    tokens: '1,420 tokens',\n    speed: '64 tok/s',\n    progress: 100,\n    tools: [\n      { name: 'web_search', count: 2, icon: 'Globe' },\n      { name: 'doc_scrape', count: 6, icon: 'FileText' },\n    ],\n    thoughts: [\n      {\n        id: 'r1',\n        title: 'Verify Reka UI and Radix UI primitive specifications',\n        duration: '18s',\n        status: 'completed',\n        detail: 'Confirmed Radix Progress and Reka Progress Root/Indicator element bindings for zero-drift parity.',\n      },\n      {\n        id: 'r2',\n        title: 'Check Lucide icon availability in Vue and React packages',\n        duration: '27s',\n        status: 'completed',\n        detail:\n          'Validated Compass, Search, Code2, ShieldCheck, FastForward, RotateCcw, RefreshCw icons across registries.',\n      },\n    ],\n    artifactFileName: 'api-contracts.d.ts',\n    artifactSize: '1.8 kB',\n    artifactCode: `export interface NodeContract {\\n  id: string\\n  status: 'completed' | 'running' | 'queued'\\n  duration: string\\n}`,\n  },\n  {\n    id: 'engineer',\n    stepNumber: 3,\n    name: 'Code Engineer Agent',\n    role: 'Component Synthesis & Tests',\n    iconName: 'Code2',\n    model: 'Claude 3.5',\n    status: 'running',\n    duration: '1m 17s',\n    task: 'Generate component architecture & unit tests',\n    tokens: '2,840 tokens',\n    speed: '48 tok/s',\n    progress: 68,\n    tools: [\n      { name: 'web_search', count: 2, icon: 'Globe' },\n      { name: 'file_read', count: 8, icon: 'FileText' },\n      { name: 'ast_parse', count: 1, icon: 'Terminal' },\n      { name: 'typecheck', count: 1, icon: 'ShieldCheck' },\n    ],\n    thoughts: [\n      {\n        id: 't1',\n        title: 'Parse upstream specifications from Planner & Research Agent',\n        duration: '14ms',\n        status: 'completed',\n        detail:\n          'Loaded 4 sub-goal definitions. Validated schema definitions for Reka UI and Radix UI primitive bindings.',\n      },\n      {\n        id: 't2',\n        title: 'Synthesize component state machine & reactive bindings',\n        duration: '420ms',\n        status: 'completed',\n        detail:\n          'Constructed state flow machine for pipeline progression. Hooked up active execution timers and streaming buffers.',\n      },\n      {\n        id: 't3',\n        title: 'Construct test matrix with boundary coverage',\n        duration: '850ms',\n        status: 'completed',\n        detail:\n          'Generated unit test cases covering step navigation, retry triggers, state pausing, and copy payload verification.',\n      },\n      {\n        id: 't4',\n        title: 'Stream production TypeScript & TSX definitions',\n        duration: '1m 17s',\n        status: 'running',\n        detail:\n          'Writing template layout with responsive CSS grid, glowing node state markers, tool invocation badge metrics, and dark-mode safe styling.',\n      },\n    ],\n    artifactFileName: 'AiAgentOrchestrator.tsx',\n    artifactSize: '2.4 kB',\n    artifactCode: initialCodeSnippet,\n  },\n  {\n    id: 'reviewer',\n    stepNumber: 4,\n    name: 'Reviewer & QA Agent',\n    role: 'Typecheck & Token Audit',\n    iconName: 'ShieldCheck',\n    model: 'Claude 3.5',\n    status: 'queued',\n    duration: '0s',\n    task: 'Validate TypeScript types and token standards',\n    tokens: '0 tokens',\n    speed: '0 tok/s',\n    progress: 0,\n    tools: [\n      { name: 'typecheck', count: 1, icon: 'ShieldCheck' },\n      { name: 'token_audit', count: 1, icon: 'Terminal' },\n    ],\n    thoughts: [\n      {\n        id: 'q1',\n        title: 'Perform static type-safety and interface contract validation',\n        duration: '0s',\n        status: 'queued',\n        detail:\n          'Awaiting Code Engineer stream completion to run full TypeScript compiler validation without any types.',\n      },\n      {\n        id: 'q2',\n        title: 'Verify minimum 12px font scale and OKLCH color token conformance',\n        duration: '0s',\n        status: 'queued',\n        detail: 'Scanning AST for forbidden sub-12px micro-classes and hardcoded hex color values.',\n      },\n    ],\n    artifactFileName: 'qa-audit-report.md',\n    artifactSize: '0.9 kB',\n    artifactCode: `# QA Verification Gate\\n- [ ] TypeScript parity check\\n- [ ] Design token conformance\\n- [ ] Accessibility keyboard focus`,\n  },\n]\n\nexport function AiAgentOrchestrator({ className }: Props) {\n  const [isPaused, setIsPaused] = React.useState(false)\n  const [elapsedSeconds, setElapsedSeconds] = React.useState(134)\n  const [selectedAgentId, setSelectedAgentId] = React.useState<AgentId>('engineer')\n  const [activeStepIndex, setActiveStepIndex] = React.useState(2)\n  const [copied, setCopied] = React.useState(false)\n  const [nodes, setNodes] = React.useState<AgentNode[]>(initialNodes)\n  const [expandedThoughts, setExpandedThoughts] = React.useState<Record<string, boolean>>({\n    t1: false,\n    t2: false,\n    t3: false,\n    t4: true,\n  })\n\n  React.useEffect(() => {\n    const timer = setInterval(() => {\n      if (!isPaused && activeStepIndex < 4) {\n        setElapsedSeconds((prev) => prev + 1)\n      }\n    }, 1000)\n    return () => clearInterval(timer)\n  }, [isPaused, activeStepIndex])\n\n  const selectedAgent = React.useMemo(() => {\n    return nodes.find((n) => n.id === selectedAgentId) ?? nodes[2]\n  }, [nodes, selectedAgentId])\n\n  const formattedTime = React.useMemo(() => {\n    const mins = Math.floor(elapsedSeconds / 60)\n    const secs = elapsedSeconds % 60\n    return `${mins.toString().padStart(2, '0')}m:${secs.toString().padStart(2, '0')}s`\n  }, [elapsedSeconds])\n\n  const overallProgress = React.useMemo(() => {\n    const completedCount = nodes.filter((n) => n.status === 'completed').length\n    const running = nodes.find((n) => n.status === 'running')\n    const runningBonus = running ? running.progress / 100 : 0\n    return Math.round(((completedCount + runningBonus) / nodes.length) * 100)\n  }, [nodes])\n\n  const togglePause = () => {\n    setIsPaused((prev) => !prev)\n  }\n\n  const selectAgent = (id: AgentId) => {\n    setSelectedAgentId(id)\n  }\n\n  const toggleThought = (id: string) => {\n    setExpandedThoughts((prev) => ({ ...prev, [id]: !prev[id] }))\n  }\n\n  const toggleAllThoughts = () => {\n    const anyClosed = selectedAgent.thoughts.some((t) => !expandedThoughts[t.id])\n    const next: Record<string, boolean> = { ...expandedThoughts }\n    selectedAgent.thoughts.forEach((t) => {\n      next[t.id] = anyClosed\n    })\n    setExpandedThoughts(next)\n  }\n\n  const stepForward = () => {\n    if (activeStepIndex < nodes.length - 1) {\n      setNodes((prev) => {\n        const next = [...prev]\n        next[activeStepIndex] = { ...next[activeStepIndex], status: 'completed', progress: 100 }\n        const nextIdx = activeStepIndex + 1\n        next[nextIdx] = { ...next[nextIdx], status: 'running', progress: 45 }\n        return next\n      })\n      const nextIdx = activeStepIndex + 1\n      setActiveStepIndex(nextIdx)\n      setSelectedAgentId(nodes[nextIdx].id)\n    } else if (activeStepIndex === nodes.length - 1) {\n      setNodes((prev) => {\n        const next = [...prev]\n        next[activeStepIndex] = { ...next[activeStepIndex], status: 'completed', progress: 100 }\n        return next\n      })\n      setActiveStepIndex(4)\n    }\n  }\n\n  const retryStep = () => {\n    if (activeStepIndex < nodes.length) {\n      setNodes((prev) => {\n        const next = [...prev]\n        next[activeStepIndex] = { ...next[activeStepIndex], status: 'running', progress: 10 }\n        return next\n      })\n      setSelectedAgentId(nodes[activeStepIndex].id)\n    }\n  }\n\n  const rerunPipeline = () => {\n    setElapsedSeconds(0)\n    setIsPaused(false)\n    setActiveStepIndex(0)\n    setNodes((prev) =>\n      prev.map((node, idx) => ({\n        ...node,\n        status: idx === 0 ? 'running' : 'queued',\n        progress: idx === 0 ? 25 : 0,\n      })),\n    )\n    setSelectedAgentId('planner')\n  }\n\n  const cancelWorkflow = () => {\n    setIsPaused(true)\n  }\n\n  const copyArtifact = async () => {\n    try {\n      await navigator.clipboard.writeText(selectedAgent.artifactCode)\n      setCopied(true)\n      setTimeout(() => {\n        setCopied(false)\n      }, 2000)\n    } catch {\n      // Clipboard fallback\n    }\n  }\n\n  const renderAgentIcon = (id: AgentId) => {\n    switch (id) {\n      case 'planner':\n        return <Compass className=\"size-5\" />\n      case 'researcher':\n        return <Search className=\"size-5\" />\n      case 'engineer':\n        return <Code2 className=\"size-5\" />\n      case 'reviewer':\n        return <ShieldCheck className=\"size-5\" />\n    }\n  }\n\n  const renderToolIcon = (icon: string) => {\n    switch (icon) {\n      case 'Globe':\n        return <Globe className=\"text-muted-foreground size-3.5\" />\n      case 'FileText':\n        return <FileText className=\"text-muted-foreground size-3.5\" />\n      case 'Terminal':\n        return <Terminal className=\"text-muted-foreground size-3.5\" />\n      default:\n        return <ShieldCheck className=\"text-muted-foreground size-3.5\" />\n    }\n  }\n\n  return (\n    <div data-slot=\"ai-agent-orchestrator\" className={cn('w-full space-y-6', className)}>\n      {/* Top Header Bar */}\n      <Card className=\"border-border bg-card shadow-xs\">\n        <CardContent className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between\">\n          <div className=\"flex items-start gap-3.5 sm:items-center\">\n            <div className=\"bg-primary/10 text-primary border-primary/20 flex size-11 shrink-0 items-center justify-center rounded-xl border\">\n              <Bot className=\"size-5\" />\n            </div>\n            <div className=\"space-y-1\">\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <h2 className=\"text-foreground text-lg font-semibold tracking-tight sm:text-xl\">\n                  Autonomous Research & Code Generation Squad\n                </h2>\n              </div>\n              <div className=\"text-muted-foreground flex flex-wrap items-center gap-2 text-xs\">\n                <span className=\"font-mono\">Pipeline ID: pipe-892f4c</span>\n                <span>•</span>\n                <span>4 Agents Orchestrated</span>\n                <span>•</span>\n                <span>Target: UIPKGE Registry Block</span>\n              </div>\n            </div>\n          </div>\n\n          <div className=\"flex flex-wrap items-center gap-2.5\">\n            {/* Status Badge */}\n            {!isPaused && activeStepIndex < 4 ? (\n              <Badge variant=\"outline\" className=\"border-primary/40 bg-primary/10 text-primary shadow-xs\">\n                <span className=\"relative mr-1.5 flex size-2\">\n                  <span className=\"bg-primary absolute inline-flex h-full w-full rounded-full opacity-75\" />\n                  <span className=\"bg-primary relative inline-flex size-2 rounded-full\" />\n                </span>\n                Running • Step {Math.min(activeStepIndex + 1, 4)} of 4\n              </Badge>\n            ) : isPaused ? (\n              <Badge variant=\"warning\" className=\"shadow-xs\">\n                <Pause className=\"mr-1 size-3\" />\n                Paused • Step {Math.min(activeStepIndex + 1, 4)} of 4\n              </Badge>\n            ) : (\n              <Badge variant=\"success\" className=\"shadow-xs\">\n                <CheckCircle2 className=\"mr-1 size-3\" />\n                Completed • 4 of 4 Steps\n              </Badge>\n            )}\n\n            {/* Timer */}\n            <div className=\"border-border bg-muted/40 text-foreground flex items-center gap-1.5 rounded-md border px-2.5 py-1 font-mono text-xs font-medium\">\n              <Clock className=\"text-muted-foreground size-3.5\" />\n              <span>{formattedTime}</span>\n            </div>\n\n            {/* Controls */}\n            <Button variant=\"outline\" size=\"sm\" className=\"h-8 gap-1.5 text-xs\" onClick={togglePause}>\n              {isPaused ? <Play className=\"size-3.5\" /> : <Pause className=\"size-3.5\" />}\n              <span>{isPaused ? 'Resume Workflow' : 'Pause Workflow'}</span>\n            </Button>\n\n            <Button\n              variant=\"ghost\"\n              size=\"sm\"\n              className=\"text-muted-foreground hover:text-foreground h-8 gap-1 text-xs\"\n              onClick={cancelWorkflow}\n            >\n              <X className=\"size-3.5\" />\n              <span>Cancel</span>\n            </Button>\n          </div>\n        </CardContent>\n      </Card>\n\n      {/* Agent Flow Pipeline Nodes (Horizontal Connected Flow) */}\n      <Card className=\"border-border bg-card shadow-xs\">\n        <CardHeader className=\"pb-3\">\n          <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n            <div>\n              <CardTitle className=\"text-base font-semibold\">Agent Execution Graph</CardTitle>\n              <CardDescription className=\"text-xs\">\n                Real-time multi-agent execution pipeline. Select any node to inspect telemetry.\n              </CardDescription>\n            </div>\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <span className=\"text-muted-foreground text-xs font-medium\">Pipeline Progress</span>\n              <div className=\"bg-muted h-2 w-28 overflow-hidden rounded-full\">\n                <div\n                  className=\"bg-primary h-full transition-[width] duration-500 ease-out\"\n                  style={{ width: `${overallProgress}%` }}\n                />\n              </div>\n              <span className=\"font-mono text-xs font-semibold\">{overallProgress}%</span>\n            </div>\n          </div>\n        </CardHeader>\n\n        <CardContent className=\"p-6 pt-2\">\n          <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n            {/* Node 1: Planner Agent */}\n            <button\n              type=\"button\"\n              className={cn(\n                'group focus-visible:ring-ring relative flex w-full cursor-pointer flex-col justify-between rounded-xl border p-4 text-left transition-[border-color,box-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none',\n                selectedAgentId === 'planner'\n                  ? 'border-primary ring-primary/30 shadow-xs ring-2'\n                  : 'border-border hover:border-muted-foreground/40',\n                nodes[0].status === 'completed'\n                  ? 'bg-card'\n                  : nodes[0].status === 'running'\n                    ? 'border-primary/60 bg-primary/[0.03]'\n                    : 'bg-muted/20 opacity-75',\n              )}\n              aria-pressed={selectedAgentId === 'planner'}\n              onClick={() => selectAgent('planner')}\n            >\n              <div className=\"space-y-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex flex-wrap items-center gap-2.5\">\n                    <div\n                      className={cn(\n                        'flex size-9 items-center justify-center rounded-lg border text-xs',\n                        nodes[0].status === 'completed'\n                          ? 'border-success/30 bg-success/10 text-success'\n                          : nodes[0].status === 'running'\n                            ? 'border-primary/30 bg-primary/10 text-primary'\n                            : 'border-border bg-muted text-muted-foreground',\n                      )}\n                    >\n                      <Compass className=\"size-4\" />\n                    </div>\n                    <div>\n                      <p className=\"text-foreground text-xs leading-none font-semibold\">Planner Agent</p>\n                      <p className=\"text-muted-foreground mt-0.5 text-xs\">Stage 01</p>\n                    </div>\n                  </div>\n\n                  {nodes[0].status === 'completed' ? (\n                    <Badge variant=\"success\" className=\"gap-1 text-xs\">\n                      <Check className=\"size-3\" />\n                      12s\n                    </Badge>\n                  ) : nodes[0].status === 'running' ? (\n                    <Badge variant=\"outline\" className=\"border-primary/40 bg-primary/10 text-primary text-xs\">\n                      Running\n                    </Badge>\n                  ) : (\n                    <Badge variant=\"outline\" className=\"text-muted-foreground text-xs\">\n                      Queued\n                    </Badge>\n                  )}\n                </div>\n\n                <div className=\"space-y-1\">\n                  <p className=\"text-muted-foreground line-clamp-2 text-xs leading-relaxed\">\n                    Deconstruct task into 4 sub-goals\n                  </p>\n                </div>\n              </div>\n\n              <div className=\"border-border/60 mt-3 flex items-center justify-between border-t pt-2.5 text-xs\">\n                <span className=\"text-muted-foreground font-mono\">Claude 3.5</span>\n                <span className=\"text-foreground font-medium\">100% done</span>\n              </div>\n            </button>\n\n            {/* Node 2: Research Agent */}\n            <button\n              type=\"button\"\n              className={cn(\n                'group focus-visible:ring-ring relative flex w-full cursor-pointer flex-col justify-between rounded-xl border p-4 text-left transition-[border-color,box-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none',\n                selectedAgentId === 'researcher'\n                  ? 'border-primary ring-primary/30 shadow-xs ring-2'\n                  : 'border-border hover:border-muted-foreground/40',\n                nodes[1].status === 'completed'\n                  ? 'bg-card'\n                  : nodes[1].status === 'running'\n                    ? 'border-primary/60 bg-primary/[0.03]'\n                    : 'bg-muted/20 opacity-75',\n              )}\n              aria-pressed={selectedAgentId === 'researcher'}\n              onClick={() => selectAgent('researcher')}\n            >\n              <div className=\"space-y-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex flex-wrap items-center gap-2.5\">\n                    <div\n                      className={cn(\n                        'flex size-9 items-center justify-center rounded-lg border text-xs',\n                        nodes[1].status === 'completed'\n                          ? 'border-success/30 bg-success/10 text-success'\n                          : nodes[1].status === 'running'\n                            ? 'border-primary/30 bg-primary/10 text-primary'\n                            : 'border-border bg-muted text-muted-foreground',\n                      )}\n                    >\n                      <Search className=\"size-4\" />\n                    </div>\n                    <div>\n                      <p className=\"text-foreground text-xs leading-none font-semibold\">Research Agent</p>\n                      <p className=\"text-muted-foreground mt-0.5 text-xs\">Stage 02</p>\n                    </div>\n                  </div>\n\n                  {nodes[1].status === 'completed' ? (\n                    <Badge variant=\"success\" className=\"gap-1 text-xs\">\n                      <Check className=\"size-3\" />\n                      45s\n                    </Badge>\n                  ) : nodes[1].status === 'running' ? (\n                    <Badge variant=\"outline\" className=\"border-primary/40 bg-primary/10 text-primary text-xs\">\n                      Running\n                    </Badge>\n                  ) : (\n                    <Badge variant=\"outline\" className=\"text-muted-foreground text-xs\">\n                      Queued\n                    </Badge>\n                  )}\n                </div>\n\n                <div className=\"space-y-1\">\n                  <p className=\"text-muted-foreground line-clamp-2 text-xs leading-relaxed\">\n                    Query documentation and verify API contracts\n                  </p>\n                </div>\n              </div>\n\n              <div className=\"border-border/60 mt-3 flex items-center justify-between border-t pt-2.5 text-xs\">\n                <span className=\"text-muted-foreground font-mono\">GPT-4o</span>\n                <span className=\"text-foreground font-medium\">100% done</span>\n              </div>\n            </button>\n\n            {/* Node 3: Code Engineer Agent */}\n            <button\n              type=\"button\"\n              className={cn(\n                'group focus-visible:ring-ring relative flex w-full cursor-pointer flex-col justify-between rounded-xl border p-4 text-left transition-[border-color,box-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none',\n                selectedAgentId === 'engineer'\n                  ? 'border-primary ring-primary/40 shadow-xs ring-2'\n                  : 'border-border hover:border-muted-foreground/40',\n                nodes[2].status === 'completed'\n                  ? 'bg-card'\n                  : nodes[2].status === 'running'\n                    ? 'border-primary/60 bg-primary/[0.04]'\n                    : 'bg-muted/20 opacity-75',\n              )}\n              aria-pressed={selectedAgentId === 'engineer'}\n              onClick={() => selectAgent('engineer')}\n            >\n              <div className=\"space-y-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex flex-wrap items-center gap-2.5\">\n                    <div\n                      className={cn(\n                        'flex size-9 items-center justify-center rounded-lg border text-xs',\n                        nodes[2].status === 'completed'\n                          ? 'border-success/30 bg-success/10 text-success'\n                          : nodes[2].status === 'running'\n                            ? 'border-primary/40 bg-primary/15 text-primary'\n                            : 'border-border bg-muted text-muted-foreground',\n                      )}\n                    >\n                      <Code2 className=\"size-4\" />\n                    </div>\n                    <div>\n                      <p className=\"text-foreground text-xs leading-none font-semibold\">Code Engineer</p>\n                      <p className=\"text-muted-foreground mt-0.5 text-xs\">Stage 03</p>\n                    </div>\n                  </div>\n\n                  {nodes[2].status === 'completed' ? (\n                    <Badge variant=\"success\" className=\"gap-1 text-xs\">\n                      <Check className=\"size-3\" />\n                      1m 17s\n                    </Badge>\n                  ) : nodes[2].status === 'running' ? (\n                    <Badge\n                      variant=\"outline\"\n                      className=\"border-primary/50 bg-primary/15 text-primary text-xs font-medium\"\n                    >\n                      <span className=\"relative mr-1 flex size-1.5\">\n                        <span className=\"bg-primary absolute inline-flex h-full w-full rounded-full opacity-75\" />\n                        <span className=\"bg-primary relative inline-flex size-1.5 rounded-full\" />\n                      </span>\n                      Streaming\n                    </Badge>\n                  ) : (\n                    <Badge variant=\"outline\" className=\"text-muted-foreground text-xs\">\n                      Queued\n                    </Badge>\n                  )}\n                </div>\n\n                <div className=\"space-y-1\">\n                  <p className=\"text-muted-foreground line-clamp-2 text-xs leading-relaxed\">\n                    Generate component architecture & unit tests\n                  </p>\n                </div>\n              </div>\n\n              <div className=\"border-border/60 mt-3 flex items-center justify-between border-t pt-2.5 text-xs\">\n                <span className=\"text-muted-foreground font-mono\">Claude 3.5</span>\n                <span className=\"text-primary font-medium\">{nodes[2].progress}% active</span>\n              </div>\n            </button>\n\n            {/* Node 4: Reviewer & QA Agent */}\n            <button\n              type=\"button\"\n              className={cn(\n                'group focus-visible:ring-ring relative flex w-full cursor-pointer flex-col justify-between rounded-xl border p-4 text-left transition-[border-color,box-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none',\n                selectedAgentId === 'reviewer'\n                  ? 'border-primary ring-primary/30 shadow-xs ring-2'\n                  : 'border-border/80 hover:border-muted-foreground/40',\n                nodes[3].status === 'completed'\n                  ? 'bg-card'\n                  : nodes[3].status === 'running'\n                    ? 'border-primary/60 bg-primary/[0.03]'\n                    : 'bg-muted/15 border-dashed',\n              )}\n              aria-pressed={selectedAgentId === 'reviewer'}\n              onClick={() => selectAgent('reviewer')}\n            >\n              <div className=\"space-y-3\">\n                <div className=\"flex items-center justify-between\">\n                  <div className=\"flex flex-wrap items-center gap-2.5\">\n                    <div\n                      className={cn(\n                        'flex size-9 items-center justify-center rounded-lg border text-xs',\n                        nodes[3].status === 'completed'\n                          ? 'border-success/30 bg-success/10 text-success'\n                          : nodes[3].status === 'running'\n                            ? 'border-primary/30 bg-primary/10 text-primary'\n                            : 'border-border bg-muted/60 text-muted-foreground',\n                      )}\n                    >\n                      <ShieldCheck className=\"size-4\" />\n                    </div>\n                    <div>\n                      <p className=\"text-foreground text-xs leading-none font-semibold\">Reviewer & QA</p>\n                      <p className=\"text-muted-foreground mt-0.5 text-xs\">Stage 04</p>\n                    </div>\n                  </div>\n\n                  {nodes[3].status === 'completed' ? (\n                    <Badge variant=\"success\" className=\"gap-1 text-xs\">\n                      <Check className=\"size-3\" />\n                      Passed\n                    </Badge>\n                  ) : nodes[3].status === 'running' ? (\n                    <Badge variant=\"outline\" className=\"border-primary/40 bg-primary/10 text-primary text-xs\">\n                      Running\n                    </Badge>\n                  ) : (\n                    <Badge variant=\"outline\" className=\"text-muted-foreground border-border/80 text-xs\">\n                      Queued\n                    </Badge>\n                  )}\n                </div>\n\n                <div className=\"space-y-1\">\n                  <p className=\"text-muted-foreground line-clamp-2 text-xs leading-relaxed\">\n                    Validate TypeScript types and token standards\n                  </p>\n                </div>\n              </div>\n\n              <div className=\"border-border/60 mt-3 flex items-center justify-between border-t pt-2.5 text-xs\">\n                <span className=\"text-muted-foreground font-mono\">Claude 3.5</span>\n                <span className=\"text-muted-foreground font-medium\">Pending</span>\n              </div>\n            </button>\n          </div>\n        </CardContent>\n      </Card>\n\n      {/* Active Execution Detail Panel (2-Column Bento) */}\n      <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-12\">\n        {/* Left Column: Agent Overview, Thought Stream & Tool Invocations */}\n        <div className=\"space-y-6 lg:col-span-7\">\n          {/* Active Agent Header & Progress */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-4\">\n              <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n                <div className=\"flex items-center gap-3\">\n                  <div className=\"bg-primary/10 text-primary border-primary/20 flex size-10 items-center justify-center rounded-lg border\">\n                    {renderAgentIcon(selectedAgent.id)}\n                  </div>\n                  <div>\n                    <div className=\"flex flex-wrap items-center gap-2\">\n                      <CardTitle className=\"text-base font-semibold\">{selectedAgent.name}</CardTitle>\n                      <Badge variant=\"outline\" className=\"font-mono text-xs\">\n                        {selectedAgent.model}\n                      </Badge>\n                    </div>\n                    <CardDescription className=\"text-xs\">{selectedAgent.task}</CardDescription>\n                  </div>\n                </div>\n\n                <div className=\"flex flex-wrap items-center gap-2\">\n                  {selectedAgent.status === 'completed' ? (\n                    <Badge variant=\"success\" className=\"text-xs\">\n                      Completed in {selectedAgent.duration}\n                    </Badge>\n                  ) : selectedAgent.status === 'running' ? (\n                    <Badge variant=\"outline\" className=\"border-primary/40 bg-primary/10 text-primary text-xs\">\n                      <Activity className=\"mr-1 size-3 animate-pulse\" />\n                      Streaming • {selectedAgent.duration}\n                    </Badge>\n                  ) : (\n                    <Badge variant=\"outline\" className=\"text-muted-foreground text-xs\">\n                      Queued\n                    </Badge>\n                  )}\n                </div>\n              </div>\n            </CardHeader>\n\n            <CardContent className=\"space-y-4 pt-0\">\n              <div className=\"space-y-1.5\">\n                <div className=\"text-muted-foreground flex justify-between text-xs font-medium\">\n                  <span>Task Execution State</span>\n                  <span className=\"font-mono\">{selectedAgent.progress}%</span>\n                </div>\n                <Progress value={selectedAgent.progress} className=\"h-2\" />\n              </div>\n\n              <div className=\"bg-muted/30 border-border grid grid-cols-2 gap-3 rounded-lg border p-3 sm:grid-cols-4\">\n                <div>\n                  <p className=\"text-muted-foreground text-xs\">Duration</p>\n                  <p className=\"text-foreground font-mono text-xs font-semibold\">{selectedAgent.duration}</p>\n                </div>\n                <div>\n                  <p className=\"text-muted-foreground text-xs\">Tokens Output</p>\n                  <p className=\"text-foreground font-mono text-xs font-semibold\">{selectedAgent.tokens}</p>\n                </div>\n                <div>\n                  <p className=\"text-muted-foreground text-xs\">Throughput</p>\n                  <p className=\"text-foreground font-mono text-xs font-semibold\">{selectedAgent.speed}</p>\n                </div>\n                <div>\n                  <p className=\"text-muted-foreground text-xs\">Agent Role</p>\n                  <p className=\"text-foreground truncate text-xs font-semibold\">{selectedAgent.role}</p>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* Agent Thought Stream Card */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"flex flex-row items-center justify-between pb-3\">\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <Sparkles className=\"text-primary size-4\" />\n                <CardTitle className=\"text-sm font-semibold\">Agent Thought Stream & Reasoning</CardTitle>\n              </div>\n              <Button\n                variant=\"ghost\"\n                size=\"xs\"\n                className=\"text-muted-foreground hover:text-foreground h-7 text-xs\"\n                onClick={toggleAllThoughts}\n              >\n                Toggle Details\n              </Button>\n            </CardHeader>\n\n            <CardContent className=\"space-y-3 pt-0\">\n              {selectedAgent.thoughts.map((thought) => (\n                <div\n                  key={thought.id}\n                  className=\"border-border bg-muted/20 hover:bg-muted/30 rounded-lg border transition-colors\"\n                >\n                  <button\n                    type=\"button\"\n                    className=\"focus-visible:ring-ring flex w-full cursor-pointer items-center justify-between rounded-lg p-3 text-left focus-visible:ring-2 focus-visible:outline-none\"\n                    aria-expanded={expandedThoughts[thought.id]}\n                    onClick={() => toggleThought(thought.id)}\n                  >\n                    <div className=\"flex flex-wrap items-center gap-2.5\">\n                      <div\n                        className={cn(\n                          'flex size-5 shrink-0 items-center justify-center rounded-full',\n                          thought.status === 'completed'\n                            ? 'text-success'\n                            : thought.status === 'running'\n                              ? 'text-primary animate-spin'\n                              : 'text-muted-foreground',\n                        )}\n                      >\n                        {thought.status === 'completed' ? (\n                          <CheckCircle2 className=\"size-4\" />\n                        ) : thought.status === 'running' ? (\n                          <Activity className=\"size-4\" />\n                        ) : (\n                          <div className=\"border-muted-foreground size-3 rounded-full border border-dashed\" />\n                        )}\n                      </div>\n                      <p className=\"text-foreground text-xs font-medium\">{thought.title}</p>\n                    </div>\n\n                    <div className=\"flex flex-wrap items-center gap-2\">\n                      <Badge variant=\"outline\" className=\"font-mono text-xs\">\n                        {thought.duration}\n                      </Badge>\n                      {expandedThoughts[thought.id] ? (\n                        <ChevronDown className=\"text-muted-foreground size-3.5\" />\n                      ) : (\n                        <ChevronRight className=\"text-muted-foreground size-3.5\" />\n                      )}\n                    </div>\n                  </button>\n\n                  {expandedThoughts[thought.id] && (\n                    <div className=\"border-border/60 bg-muted/40 text-muted-foreground border-t px-3 py-2.5 text-xs leading-relaxed\">\n                      {thought.detail}\n                    </div>\n                  )}\n                </div>\n              ))}\n            </CardContent>\n          </Card>\n\n          {/* Tool Invocations Badge Row & Logs */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <Terminal className=\"text-primary size-4\" />\n                <CardTitle className=\"text-sm font-semibold\">Active Tool Invocations</CardTitle>\n              </div>\n            </CardHeader>\n\n            <CardContent className=\"space-y-3 pt-0\">\n              {/* Badge Row */}\n              <div className=\"flex flex-wrap items-center gap-2\">\n                {selectedAgent.tools.map((tool) => (\n                  <Badge\n                    key={tool.name}\n                    variant=\"outline\"\n                    className=\"border-border bg-muted/40 hover:bg-muted text-foreground gap-1.5 px-2.5 py-1 text-xs font-medium\"\n                  >\n                    {renderToolIcon(tool.icon)}\n                    <span className=\"font-mono\">{tool.name}</span>\n                    <span className=\"bg-primary/10 text-primary py-0.2 rounded-full px-1.5 text-xs font-bold\">\n                      {tool.count}\n                    </span>\n                  </Badge>\n                ))}\n              </div>\n\n              {/* Execution Log Terminal Row */}\n              <div className=\"border-border bg-muted/50 overflow-x-auto rounded-lg border p-3 font-mono text-xs\">\n                <div className=\"text-muted-foreground space-y-1\">\n                  <div className=\"flex flex-wrap items-center gap-2 whitespace-nowrap\">\n                    <span className=\"text-success font-semibold\">[02:14:02]</span>\n                    <span>GET https://uipkge.dev/r/button.json → 200 OK (38ms)</span>\n                  </div>\n                  <div className=\"flex flex-wrap items-center gap-2 whitespace-nowrap\">\n                    <span className=\"text-success font-semibold\">[02:14:05]</span>\n                    <span>READ packages/registry-react/components/card/card.tsx (12ms)</span>\n                  </div>\n                  <div className=\"flex flex-wrap items-center gap-2\">\n                    <span className=\"text-primary font-semibold\">[02:14:09]</span>\n                    <span>AST parse: 4 exports identified, 0 cycle violations</span>\n                  </div>\n                  <div className=\"flex flex-wrap items-center gap-2 whitespace-nowrap\">\n                    <span className=\"text-success font-semibold\">[02:14:14]</span>\n                    <span>Typecheck: 0 errors across 6 test suites</span>\n                  </div>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n        </div>\n\n        {/* Right Column: Live Artifact Output & Pipeline Actions */}\n        <div className=\"space-y-6 lg:col-span-5\">\n          {/* Live Artifact Output Card */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"flex flex-row items-center justify-between pb-3\">\n              <div className=\"flex flex-wrap items-center gap-2 overflow-hidden\">\n                <FileCode2 className=\"text-primary size-4 shrink-0\" />\n                <CardTitle className=\"truncate font-mono text-xs font-medium\">\n                  {selectedAgent.artifactFileName}\n                </CardTitle>\n              </div>\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <Badge variant=\"secondary\" className=\"font-mono text-xs\">\n                  {selectedAgent.artifactSize}\n                </Badge>\n                <Button variant=\"outline\" size=\"xs\" className=\"h-7 gap-1 text-xs\" onClick={copyArtifact}>\n                  {copied ? <Check className=\"size-3\" /> : <Copy className=\"size-3\" />}\n                  <span>{copied ? 'Copied!' : 'Copy'}</span>\n                </Button>\n              </div>\n            </CardHeader>\n\n            <CardContent className=\"pt-0\">\n              <div className=\"border-border bg-muted/40 relative overflow-hidden rounded-lg border font-mono text-xs\">\n                {/* Window top bar */}\n                <div className=\"border-border/60 bg-muted/60 flex items-center justify-between border-b px-3 py-1.5\">\n                  <div className=\"flex items-center gap-1.5\">\n                    <div className=\"bg-destructive/60 size-2.5 rounded-full\" />\n                    <div className=\"bg-warning/60 size-2.5 rounded-full\" />\n                    <div className=\"bg-success/60 size-2.5 rounded-full\" />\n                  </div>\n                  <span className=\"text-muted-foreground text-xs\">Live Generated Output</span>\n                </div>\n\n                {/* Code area with syntax styling */}\n                <div className=\"max-h-[380px] overflow-auto p-3 text-xs leading-relaxed\">\n                  <pre className=\"text-foreground font-mono whitespace-pre-wrap\">\n                    <code>{selectedAgent.artifactCode}</code>\n                  </pre>\n                  {selectedAgent.status === 'running' && (\n                    <span className=\"bg-primary ml-0.5 inline-block h-3.5 w-1.5 animate-pulse align-middle\" />\n                  )}\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* Pipeline Action Controls */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <Layers className=\"text-primary size-4\" />\n                <CardTitle className=\"text-sm font-semibold\">Pipeline Orchestrator Controls</CardTitle>\n              </div>\n            </CardHeader>\n\n            <CardContent className=\"space-y-3 pt-0\">\n              <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n                <Button\n                  variant=\"default\"\n                  size=\"sm\"\n                  className=\"gap-1.5 text-xs font-medium\"\n                  disabled={activeStepIndex >= 4}\n                  onClick={stepForward}\n                >\n                  <FastForward className=\"size-3.5\" />\n                  <span>Step Forward</span>\n                </Button>\n\n                <Button variant=\"outline\" size=\"sm\" className=\"gap-1.5 text-xs font-medium\" onClick={retryStep}>\n                  <RotateCcw className=\"size-3.5\" />\n                  <span>Retry Step</span>\n                </Button>\n\n                <Button variant=\"outline\" size=\"sm\" className=\"gap-1.5 text-xs font-medium\" onClick={rerunPipeline}>\n                  <RefreshCw className=\"size-3.5\" />\n                  <span>Re-run Pipeline</span>\n                </Button>\n\n                <Button variant=\"outline\" size=\"sm\" className=\"gap-1.5 text-xs font-medium\" onClick={togglePause}>\n                  {isPaused ? <Play className=\"size-3.5\" /> : <Pause className=\"size-3.5\" />}\n                  <span>{isPaused ? 'Resume' : 'Pause'}</span>\n                </Button>\n              </div>\n\n              <p className=\"text-muted-foreground pt-1 text-center text-xs\">\n                Actions dispatch commands across connected autonomous agent nodes.\n              </p>\n            </CardContent>\n          </Card>\n        </div>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/AiAgentOrchestrator.tsx"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/progress.json"
  ],
  "description": "Multi-agent workflow visualizer and execution graph. Displays real-time agent pipeline topology, active reasoning streams, tool invocation metrics, live code artifact generation, and pipeline control actions.",
  "categories": [
    "ai",
    "app"
  ]
}