{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tool-result",
  "title": "Tool Result",
  "description": "An execution disclosure for running, successful, or failed tools with optional raw output.",
  "dependencies": [
    "@solar-icons/react@^2.2.0",
    "cn@^0.3.0",
    "motion@^13.4.0"
  ],
  "registryDependencies": [
    "collapsible",
    "https://pastaui.com/r/pastaui-styles.json"
  ],
  "files": [
    {
      "path": "src/components/ai/tool-result.tsx",
      "content": "import { AltArrowDownIcon as ChevronDownIcon } from '@solar-icons/react/linear/alt-arrow-down'\nimport { DangerCircleIcon as CircleAlertIcon } from '@solar-icons/react/linear/danger-circle'\nimport { LoaderIcon as LoaderCircleIcon } from '@solar-icons/react/linear/loader'\nimport { ToolboxIcon as WrenchIcon } from '@solar-icons/react/linear/toolbox'\nimport { CheckCircleIcon as CheckIcon } from '@solar-icons/react/linear/check-circle'\nimport { CopyIcon } from '@solar-icons/react/linear/copy'\nimport * as React from 'react'\nimport { AnimatePresence, MotionConfig, motion } from 'motion/react'\n\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'\nimport { cn } from 'cn'\n\ninterface ToolResultProps extends React.ComponentProps<typeof Collapsible> {\n  copyText?: string\n  duration?: string\n  error?: string\n  input?: React.ReactNode\n  name: string\n  onRetry?: () => void\n  output?: React.ReactNode\n  status?: 'complete' | 'error' | 'running'\n  summary: string\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const\nconst spring = { type: 'spring', stiffness: 500, damping: 30 } as const\nconst shimmer = 'agent-text-shimmer'\n\nfunction ToolResult({\n  className,\n  copyText,\n  defaultOpen = false,\n  duration,\n  error,\n  input,\n  name,\n  onRetry,\n  output,\n  status = 'complete',\n  summary,\n  ...props\n}: ToolResultProps) {\n  const [copied, setCopied] = React.useState(false)\n  const expandable = Boolean(output || input)\n\n  React.useEffect(() => {\n    if (!copied) return\n    const timer = setTimeout(() => setCopied(false), 1400)\n    return () => clearTimeout(timer)\n  }, [copied])\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <Collapsible\n        data-slot=\"tool-result\"\n        data-status={status}\n        className={cn(\n          'rounded-[16px] bg-card font-sans text-sm font-[450] tracking-[-0.05px] text-muted-foreground shadow-card transition-shadow duration-300 data-[status=error]:shadow-[0_0_0_1px_color-mix(in_oklch,var(--destructive)_35%,transparent),0_3px_6px_-2px_rgb(0_0_0/0.02),0_1px_1px_0_rgb(0_0_0/0.04)]',\n          className,\n        )}\n        defaultOpen={defaultOpen}\n        {...props}\n      >\n        <CollapsibleTrigger\n          className=\"group flex w-full items-center gap-3 p-3 text-left\"\n          render={<button aria-label={`Toggle ${name} result`} type=\"button\" />}\n        >\n          <ToolStatus status={status} />\n          <div className=\"min-w-0 flex-1\">\n            <p className={cn('truncate card-heading', status === 'running' && shimmer)}>{name}</p>\n            <div className=\"relative h-5 overflow-hidden\">\n              <AnimatePresence initial={false} mode=\"popLayout\">\n                <motion.p\n                  animate={{ opacity: 1, y: 0 }}\n                  className={cn('truncate text-xs leading-5', 'text-muted-foreground')}\n                  exit={{ opacity: 0, y: -12 }}\n                  initial={{ opacity: 0, y: 12 }}\n                  key={summary}\n                  transition={{ duration: 0.25, ease }}\n                >\n                  {summary}\n                </motion.p>\n              </AnimatePresence>\n            </div>\n          </div>\n          {duration && (\n            <span className=\"text-xs leading-5 text-muted-foreground tabular-nums\">{duration}</span>\n          )}\n          {expandable && (\n            <ChevronDownIcon className=\"size-4 text-muted-foreground transition-[rotate] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] group-data-panel-open:rotate-180 motion-reduce:transition-none\" />\n          )}\n        </CollapsibleTrigger>\n        <AnimatePresence initial={false}>\n          {status === 'error' && (error || onRetry) && (\n            <motion.div\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.25, ease }}\n            >\n              <div className=\"flex items-center gap-3 px-3 pb-3 pl-10\">\n                {error && (\n                  <p className=\"min-w-0 flex-1 text-xs leading-5 text-destructive\">{error}</p>\n                )}\n                {onRetry && (\n                  <button\n                    className=\"ml-auto h-7 shrink-0 rounded-full bg-foreground/8 px-3 text-xs leading-5 text-foreground/80 transition-[background-color,scale] duration-150 outline-none hover:bg-foreground/12 focus-visible:ring-2 focus-visible:ring-ring/40 active:scale-[0.97]\"\n                    onClick={onRetry}\n                    type=\"button\"\n                  >\n                    Retry\n                  </button>\n                )}\n              </div>\n            </motion.div>\n          )}\n        </AnimatePresence>\n        {expandable && (\n          <CollapsibleContent className=\"h-(--collapsible-panel-height) overflow-hidden transition-[height,opacity] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] data-ending-style:h-0 data-ending-style:opacity-0 data-starting-style:h-0 data-starting-style:opacity-0 motion-reduce:transition-opacity\">\n            <div className=\"space-y-3 border-t border-foreground/8 p-3 font-mono text-xs leading-5 text-muted-foreground\">\n              {input && (\n                <div>\n                  <p className=\"mb-1 font-sans text-[11px] leading-4 text-muted-foreground/70\">\n                    Input\n                  </p>\n                  <div className=\"break-all whitespace-pre-wrap\">{input}</div>\n                </div>\n              )}\n              {output && (\n                <div>\n                  <div className=\"mb-1 flex items-center justify-between gap-2\">\n                    {input && (\n                      <p className=\"font-sans text-[11px] leading-4 text-muted-foreground/70\">\n                        Output\n                      </p>\n                    )}\n                    {copyText && (\n                      <button\n                        aria-label={copied ? 'Copied' : 'Copy output'}\n                        className=\"ml-auto flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-foreground/8 focus-visible:ring-2 focus-visible:ring-ring/40\"\n                        onClick={() => {\n                          void navigator.clipboard?.writeText(copyText).catch(() => undefined)\n                          setCopied(true)\n                        }}\n                        type=\"button\"\n                      >\n                        <span className=\"grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 motion-reduce:*:transition-opacity\">\n                          <CopyIcon className={cn('size-3.5', copied && 'scale-75 opacity-0')} />\n                          <CheckIcon className={cn('size-3.5', !copied && 'scale-75 opacity-0')} />\n                        </span>\n                      </button>\n                    )}\n                  </div>\n                  {output}\n                </div>\n              )}\n            </div>\n          </CollapsibleContent>\n        )}\n      </Collapsible>\n    </MotionConfig>\n  )\n}\n\nfunction ToolStatus({ status }: Pick<ToolResultProps, 'status'>) {\n  return (\n    <span className=\"flex size-4 shrink-0 items-center justify-center\">\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.span\n          animate={{ opacity: 1, scale: 1, x: 0 }}\n          className=\"flex\"\n          exit={{ opacity: 0, scale: 0.6 }}\n          initial={\n            status === 'error' ? { opacity: 0, scale: 0.6, x: -3 } : { opacity: 0, scale: 0.6 }\n          }\n          key={status}\n          transition={status === 'error' ? { ...spring, stiffness: 700, damping: 12 } : spring}\n        >\n          {status === 'running' ? (\n            <LoaderCircleIcon\n              aria-label=\"Running\"\n              className=\"size-4 animate-spin motion-reduce:animate-none\"\n            />\n          ) : status === 'error' ? (\n            <CircleAlertIcon aria-label=\"Failed\" className=\"size-4 text-destructive\" />\n          ) : (\n            <>\n              <svg\n                aria-hidden=\"true\"\n                className=\"size-4 text-emerald-500\"\n                viewBox=\"0 0 16 16\"\n              >\n                <circle cx=\"8\" cy=\"8\" fill=\"currentColor\" r=\"7.5\" />\n                <motion.path\n                  animate={{ pathLength: 1 }}\n                  d=\"M5 8.25 7 10.25 11 6\"\n                  fill=\"none\"\n                  initial={{ pathLength: 0 }}\n                  stroke=\"white\"\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                  strokeWidth=\"1.5\"\n                  transition={{ delay: 0.1, duration: 0.3, ease }}\n                />\n              </svg>\n              <span className=\"sr-only\">Complete</span>\n            </>\n          )}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  )\n}\n\nfunction ToolResultIcon() {\n  return <WrenchIcon className=\"size-4\" />\n}\n\nexport { ToolResult, ToolResultIcon }\nexport type { ToolResultProps }\nexport default ToolResult\n",
      "type": "registry:component",
      "target": "@components/ai/tool-result.tsx"
    }
  ],
  "css": {
    ".agent-text-shimmer": {
      "color": "transparent",
      "background-image": "linear-gradient( 90deg, var(--muted-foreground), var(--foreground), var(--muted-foreground) )",
      "background-size": "200% 100%",
      "background-clip": "text",
      "animation": "agent-text-shimmer 1.6s linear infinite"
    },
    "@keyframes agent-text-shimmer": {
      "from": {
        "background-position": "200% 0"
      },
      "to": {
        "background-position": "-200% 0"
      }
    },
    "@media (prefers-reduced-motion: reduce)": {
      ".agent-text-shimmer": {
        "color": "var(--muted-foreground)",
        "background-image": "none",
        "animation": "none"
      }
    }
  },
  "type": "registry:component"
}