{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "elements-agent-plan",
  "type": "registry:component",
  "title": "Agent plan",
  "description": "A checklist the agent works through, with progress you can glance.",
  "registryDependencies": [
    "https://r.assistant-ui.com/elements-surfaces.json",
    "https://r.assistant-ui.com/elements-range.json"
  ],
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "type": "registry:component",
      "path": "components/assistant-ui/elements/agent-plan.tsx",
      "sourcePath": "packages/ui/src/components/react/assistant-ui/elements/agent-plan.tsx",
      "content": "\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { CheckIcon, Loader2Icon } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport { mono } from \"./surfaces\";\nimport { announced, pct, progressOf } from \"../utils/range\";\n\nexport type AgentPlanStep = {\n  id?: string | undefined;\n  label: string;\n  description?: string | undefined;\n};\n\nexport function AgentPlan({\n  steps,\n  activeIndex,\n  title = \"Plan\",\n  className,\n  ...props\n}: Omit<ComponentProps<\"div\">, \"children\" | \"steps\" | \"activeIndex\"> & {\n  steps: readonly (string | AgentPlanStep)[];\n  activeIndex: number;\n  title?: string | undefined;\n}) {\n  const total = steps.length;\n  const completed = progressOf(activeIndex, total);\n  const allDone = completed >= total;\n  const progress = pct(completed, total);\n\n  return (\n    <div\n      data-slot=\"agent-plan\"\n      className={cn(\"flex w-full max-w-sm flex-col gap-3\", className)}\n\n      {...props}\n    >\n      <div className=\"flex items-center justify-between\">\n        <span className=\"text-[13.5px] font-medium\">{title}</span>\n        <span className={cn(mono, \"text-muted-foreground tabular-nums\")}>\n          {completed} of {total}\n        </span>\n      </div>\n      <div\n        role=\"progressbar\"\n        aria-label={`${title} progress`}\n        aria-valuemin={0}\n        aria-valuemax={100}\n        aria-valuenow={announced(progress)}\n        aria-valuetext={`${completed} of ${total} steps`}\n        className=\"bg-foreground/[0.06] inset-ring-border h-[3px] w-full overflow-hidden rounded-full inset-ring forced-colors:outline\"\n      >\n        <span\n          aria-hidden\n          className=\"bg-foreground/80 block h-full rounded-full transition-[width] duration-500 forced-color-adjust-none motion-reduce:transition-none\"\n          style={{ width: `${progress}%` }}\n        />\n      </div>\n      <ul className=\"flex flex-col gap-2.5\">\n        {steps.map((step, i) => {\n          const item = typeof step === \"string\" ? { label: step } : step;\n          const done = allDone || i < completed;\n          const active = !allDone && i === completed;\n          const status = done ? \"done\" : active ? \"in progress\" : \"not started\";\n          return (\n            <li\n              key={typeof step === \"string\" ? i : (step.id ?? i)}\n              className={cn(\n                \"flex gap-2.5 text-[13.5px]\",\n                active && item.description ? \"items-start\" : \"items-center\",\n              )}\n            >\n              <span className=\"flex size-4 shrink-0 items-center justify-center\">\n                {done ? (\n                  <CheckIcon\n                    aria-hidden\n                    className=\"text-muted-foreground size-3.5\"\n                  />\n                ) : active ? (\n                  <Loader2Icon\n                    aria-hidden\n                    className=\"text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none\"\n                  />\n                ) : (\n                  <span\n                    aria-hidden\n                    className=\"bg-foreground/15 inset-ring-border size-1.5 rounded-full inset-ring forced-colors:border\"\n                  />\n                )}\n              </span>\n              <span className=\"min-w-0\">\n                <span\n                  className={cn(\n                    done && \"text-muted-foreground\",\n                    active && \"text-foreground/90\",\n                    !done && !active && \"text-muted-foreground\",\n                  )}\n                >\n                  {item.label}\n                </span>\n                <span className=\"sr-only\">{` ${status}`}</span>\n                {active && item.description ? (\n                  <span className=\"text-muted-foreground mt-0.5 block text-xs\">\n                    {item.description}\n                  </span>\n                ) : null}\n              </span>\n            </li>\n          );\n        })}\n      </ul>\n    </div>\n  );\n}\n"
    }
  ]
}