{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-ring",
  "title": "Agent Ring",
  "description": "A ring that shows how work is going: an arc spins while it runs, the ring pulses while it waits for a person, and it closes into a tick, an exclamation mark, a cross or a dash once done, warning, failed or stopped. Also `AgentMark`, an agent’s initials in its ring.",
  "registryDependencies": [
    "https://www.dashboardblocks.com/r/radix/status-label.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/agent-ring.tsx",
      "content": "'use client'\n\nimport {\n  type StatusTone,\n  statusToneClasses,\n} from '@/registry/components/dashboardblocks/status-label'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport type { ComponentProps } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype AgentRingStatus =\n  | 'running'\n  | 'waiting'\n  | 'done'\n  | 'warning'\n  | 'failed'\n  | 'stopped'\n  | 'idle'\n\nconst RING_TONES: Record<AgentRingStatus, StatusTone> = {\n  done: 'good',\n  failed: 'bad',\n  idle: 'neutral',\n  running: 'info',\n  stopped: 'neutral',\n  waiting: 'warning',\n  warning: 'warning',\n}\n\ninterface AgentRingProps extends ComponentProps<'span'> {\n  /** `idle` draws the track alone, for something that hasn't started or has nothing to show. Size the mark inside with `--agent-ring-icon`. */\n  status: AgentRingStatus\n  /** Colours the ring in place of its status's own tone, such as `info` for a wait that isn't on a person. */\n  tone?: StatusTone\n}\n\nfunction agentInitials(name: string) {\n  const words = name.split(/\\s+/).filter(Boolean)\n  const letters =\n    words.length > 1\n      ? words\n          .slice(0, 2)\n          .map((word) => word[0])\n          .join('')\n      : name.slice(0, 2)\n  return letters.toUpperCase()\n}\n\ninterface AgentMarkProps extends Omit<AgentRingProps, 'children' | 'status'> {\n  /** @default the first letters of its first two words, or its first two letters: `CC` for Claude Code, `AT` for Atlas */\n  initials?: string\n  name: string\n  /** @default 'idle' */\n  status?: AgentRingStatus\n}\n\n/** An agent's initials in its ring. */\nfunction AgentMark({ initials, name, status = 'idle', ...props }: AgentMarkProps) {\n  return (\n    <AgentRing status={status} {...props}>\n      <span className='leading-none'>{initials ?? agentInitials(name)}</span>\n    </AgentRing>\n  )\n}\n\n/** A ring around `children`: an arc spins while running, the ring pulses while waiting, and it closes into a tick, an exclamation mark, a cross or a dash once done, warning, failed or stopped. */\nfunction AgentRing({ children, className, status, tone, ...props }: AgentRingProps) {\n  const closed =\n    status === 'done' ||\n    status === 'warning' ||\n    status === 'failed' ||\n    status === 'stopped'\n  return (\n    <span\n      data-slot='agent-ring'\n      data-status={status}\n      aria-hidden\n      className={cn(\n        'relative inline-flex size-9 shrink-0 items-center justify-center text-xs [--agent-ring-icon:1rem]',\n        statusToneClasses[tone ?? RING_TONES[status]],\n        className,\n      )}\n      {...props}\n    >\n      <svg viewBox='0 0 36 36' className='absolute inset-0 size-full overflow-visible'>\n        <circle\n          cx='18'\n          cy='18'\n          r='17'\n          fill='none'\n          stroke='var(--color-border)'\n          strokeWidth='2'\n        />\n        <g\n          className={cn(\n            'origin-center',\n            status === 'running' && 'animate-spin motion-reduce:animate-none',\n          )}\n        >\n          <circle\n            cx='18'\n            cy='18'\n            r='17'\n            fill='none'\n            pathLength={100}\n            stroke='currentColor'\n            strokeDasharray='100'\n            strokeDashoffset={status === 'running' ? 72 : status === 'idle' ? 100 : 0}\n            strokeLinecap='round'\n            strokeOpacity={status === 'idle' ? 0 : 1}\n            strokeWidth='2'\n            transform='rotate(-90 18 18)'\n            className='transition-all duration-700 ease-out motion-reduce:transition-none'\n          />\n        </g>\n      </svg>\n      {status === 'waiting' && (\n        <span className='absolute -end-0.5 -top-0.5 flex size-[clamp(0.375rem,28%,0.625rem)]'>\n          <span className='absolute inline-flex size-full animate-ping rounded-full bg-current opacity-60 motion-reduce:animate-none' />\n          <span className='relative inline-flex size-full rounded-full bg-current' />\n        </span>\n      )}\n      {closed ? (\n        <span\n          key={status}\n          className='motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-50 relative flex duration-300 [&_svg]:size-(--agent-ring-icon)'\n        >\n          {status === 'done' ? (\n            <IconPlaceholder\n              lucide='CheckIcon'\n              tabler='IconCheck'\n              hugeicons='Tick02Icon'\n              phosphor='CheckIcon'\n              remixicon='RiCheckLine'\n            />\n          ) : status === 'warning' ? (\n            <svg\n              viewBox='0 0 24 24'\n              fill='none'\n              stroke='currentColor'\n              strokeLinecap='round'\n              strokeWidth='2'\n            >\n              <path d='M12 5v9' />\n              <path d='M12 19h.01' />\n            </svg>\n          ) : status === 'failed' ? (\n            <IconPlaceholder\n              lucide='XIcon'\n              tabler='IconX'\n              hugeicons='Cancel01Icon'\n              phosphor='XIcon'\n              remixicon='RiCloseLine'\n            />\n          ) : (\n            <IconPlaceholder\n              lucide='MinusIcon'\n              tabler='IconMinus'\n              hugeicons='MinusSignIcon'\n              phosphor='MinusIcon'\n              remixicon='RiSubtractLine'\n            />\n          )}\n        </span>\n      ) : (\n        <span className='text-foreground relative flex font-medium [&_svg]:size-(--agent-ring-icon)'>\n          {children}\n        </span>\n      )}\n    </span>\n  )\n}\n\nexport { AgentMark, AgentRing, agentInitials }\n\nexport type { AgentMarkProps, AgentRingProps, AgentRingStatus }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/agent-ring.tsx"
    }
  ],
  "type": "registry:component"
}
