{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tool-timeline",
  "title": "Tool Timeline",
  "description": "A live timeline of agent tool calls with timings and expandable input and output for each call.",
  "dependencies": [
    "@solar-icons/react@^2.2.0",
    "cn@^0.3.0",
    "motion@^13.4.0"
  ],
  "registryDependencies": [
    "https://pastaui.com/r/pastaui-styles.json"
  ],
  "files": [
    {
      "path": "src/components/ai/tool-timeline.tsx",
      "content": "import { ToolboxIcon as WrenchIcon } from '@solar-icons/react/linear/toolbox'\nimport { AnimatePresence, motion } from 'motion/react'\nimport * as React from 'react'\n\nimport { TimelineStatusIcon } from '@/components/ai/timeline-status'\nimport { cn } from 'cn'\n\nfunction TimelineConnector({ reached }: { reached: boolean }) {\n  return (\n    <span\n      aria-hidden=\"true\"\n      className=\"absolute top-6 bottom-1 left-2 w-px -translate-x-1/2 overflow-hidden bg-foreground/8\"\n    >\n      <span\n        className={cn(\n          'absolute inset-0 origin-top bg-foreground/25 transition-transform duration-500 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none',\n          reached ? 'scale-y-100' : 'scale-y-0',\n        )}\n      />\n    </span>\n  )\n}\n\ninterface ToolTimelineItem {\n  detail?: string\n  id: string\n  input?: string\n  output?: string\n  status: 'complete' | 'pending' | 'running'\n  target?: string\n  time?: string\n  verb: string\n}\n\ninterface ToolTimelineProps extends React.ComponentProps<'section'> {\n  defaultOpenId?: string\n  items: ToolTimelineItem[]\n  summary?: string\n  title?: string\n}\n\nconst rowTone = {\n  complete: { verb: 'text-muted-foreground', target: 'text-foreground/70' },\n  running: { verb: 'text-muted-foreground', target: 'text-foreground' },\n  pending: { verb: 'text-muted-foreground/55', target: 'text-muted-foreground/55' },\n}\n\nfunction ToolTimeline({\n  className,\n  defaultOpenId,\n  items,\n  summary,\n  title = 'Tool timeline',\n  ...props\n}: ToolTimelineProps) {\n  const [openId, setOpenId] = React.useState<string | undefined>(defaultOpenId)\n  return (\n    <section\n      data-slot=\"tool-timeline\"\n      className={cn(\n        'rounded-[16px] bg-card p-4 font-sans text-sm font-[450] tracking-[-0.05px] text-muted-foreground shadow-card',\n        className,\n      )}\n      {...props}\n    >\n      <header className=\"flex items-center gap-2\">\n        <WrenchIcon className=\"size-4 text-muted-foreground\" />\n        <h3 className=\"text-sm leading-5 font-medium text-muted-foreground\">{title}</h3>\n        {summary && (\n          <span className=\"ml-auto text-[13px] leading-5 text-muted-foreground/70\">{summary}</span>\n        )}\n      </header>\n\n      <ol className=\"mt-4\">\n        {items.map((item, index) => {\n          const next = items[index + 1]\n          const tone = rowTone[item.status]\n          const isFile = item.target ? /\\.[a-z0-9]+$/i.test(item.target) : false\n\n          return (\n            <li\n              className=\"relative flex gap-3 pb-5 transition-opacity duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] last:pb-0 starting:opacity-0\"\n              key={item.id}\n            >\n              {next && <TimelineConnector reached={next.status !== 'pending'} />}\n              <TimelineStatusIcon className=\"mt-0.5\" status={item.status} />\n              <div className=\"min-w-0 flex-1\">\n                <button\n                  aria-expanded={item.input || item.output ? openId === item.id : undefined}\n                  className=\"group/row -mx-1.5 -my-0.5 flex w-[calc(100%+0.75rem)] items-baseline gap-3 rounded-md px-1.5 py-0.5 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/40 enabled:hover:bg-muted disabled:cursor-default\"\n                  disabled={!item.input && !item.output}\n                  onClick={() =>\n                    setOpenId((current) => (current === item.id ? undefined : item.id))\n                  }\n                  type=\"button\"\n                >\n                  <p className=\"min-w-0 flex-1 truncate text-sm leading-5\">\n                    <span className={tone.verb}>{item.verb}</span>\n                    {item.target && (\n                      <>\n                        {' '}\n                        <span\n                          className={cn(\n                            'font-medium',\n                            tone.target,\n                            isFile && 'font-mono text-[13px] font-normal',\n                          )}\n                        >\n                          {item.target}\n                        </span>\n                      </>\n                    )}\n                  </p>\n                  {item.time && (\n                    <time\n                      className={cn(\n                        'shrink-0 font-mono text-[11px] tabular-nums',\n                        item.status === 'running'\n                          ? 'text-foreground/70'\n                          : 'text-muted-foreground/70',\n                      )}\n                    >\n                      {item.time}\n                      {item.status === 'running' && '…'}\n                    </time>\n                  )}\n                </button>\n                {item.detail && (\n                  <p className=\"mt-0.5 text-xs leading-4 text-muted-foreground/70\">{item.detail}</p>\n                )}\n                <AnimatePresence initial={false}>\n                  {openId === item.id && (item.input || item.output) && (\n                    <motion.dl\n                      animate={{ height: 'auto', opacity: 1 }}\n                      className=\"overflow-hidden\"\n                      exit={{ height: 0, opacity: 0 }}\n                      initial={{ height: 0, opacity: 0 }}\n                      transition={{ duration: 0.2, ease: [0.23, 1, 0.32, 1] }}\n                    >\n                      <div className=\"mt-2 space-y-2 rounded-[10px] bg-muted p-3 font-mono text-[11px] leading-4\">\n                        {item.input && (\n                          <div>\n                            <dt className=\"font-sans text-muted-foreground/70\">Input</dt>\n                            <dd className=\"mt-0.5 break-all whitespace-pre-wrap text-foreground/70\">\n                              {item.input}\n                            </dd>\n                          </div>\n                        )}\n                        {item.output && (\n                          <div>\n                            <dt className=\"font-sans text-muted-foreground/70\">Output</dt>\n                            <dd className=\"mt-0.5 break-all whitespace-pre-wrap text-foreground/70\">\n                              {item.output}\n                            </dd>\n                          </div>\n                        )}\n                      </div>\n                    </motion.dl>\n                  )}\n                </AnimatePresence>\n              </div>\n            </li>\n          )\n        })}\n      </ol>\n    </section>\n  )\n}\n\nexport { ToolTimeline }\nexport type { ToolTimelineItem, ToolTimelineProps }\n",
      "type": "registry:component",
      "target": "@components/ai/tool-timeline.tsx"
    },
    {
      "path": "src/components/ai/timeline-status.tsx",
      "content": "import { LoaderIcon as LoaderCircleIcon } from '@solar-icons/react/linear/loader'\n\nimport { cn } from 'cn'\n\ntype TimelineStatus = 'complete' | 'pending' | 'running'\n\nconst timelineLabelTone: Record<TimelineStatus, string> = {\n  complete: 'text-muted-foreground',\n  pending: 'text-muted-foreground/55',\n  running: 'text-foreground',\n}\n\nconst timelineDetailTone: Record<TimelineStatus, string> = {\n  complete: 'text-muted-foreground/55',\n  pending: 'text-muted-foreground/45',\n  running: 'text-muted-foreground',\n}\n\nconst timelineStatusLabel: Record<TimelineStatus, string> = {\n  complete: 'Complete',\n  pending: 'Pending',\n  running: 'Running',\n}\n\nfunction TimelineStatusIcon({ className, status }: { className?: string; status: TimelineStatus }) {\n  return (\n    <span className={cn('flex size-4 shrink-0 items-center justify-center', className)}>\n      {status === 'complete' ? (\n        <svg\n          aria-hidden=\"true\"\n          className=\"size-3.5 text-muted-foreground transition-[opacity,scale] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] starting:scale-90 starting:opacity-0 motion-reduce:starting:scale-100\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth=\"1.75\"\n          viewBox=\"0 0 16 16\"\n        >\n          <path d=\"m3.5 8.5 3 3 6-7\" />\n        </svg>\n      ) : status === 'running' ? (\n        <LoaderCircleIcon\n          aria-hidden=\"true\"\n          className=\"size-3.5 animate-spin text-blue-500 motion-reduce:animate-none dark:text-blue-400\"\n        />\n      ) : (\n        <span\n          aria-hidden=\"true\"\n          className=\"size-3 rounded-full border-[1.5px] border-muted-foreground/45\"\n        />\n      )}\n      <span className=\"sr-only\">{timelineStatusLabel[status]}</span>\n    </span>\n  )\n}\n\nfunction TimelineConnector({ reached }: { reached: boolean }) {\n  return (\n    <span\n      aria-hidden=\"true\"\n      className={cn(\n        'absolute top-6 bottom-1 left-2 w-px -translate-x-1/2 transition-colors duration-200 ease-out',\n        reached ? 'bg-foreground/25' : 'bg-foreground/8',\n      )}\n    />\n  )\n}\n\nexport { TimelineConnector, TimelineStatusIcon, timelineDetailTone, timelineLabelTone }\nexport type { TimelineStatus }\n",
      "type": "registry:component",
      "target": "@components/ai/timeline-status.tsx"
    }
  ],
  "type": "registry:component"
}