{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "memory",
  "title": "Memory",
  "description": "Visible, removable facts an agent retains about the user or ongoing work.",
  "dependencies": [
    "@solar-icons/react@^2.2.0",
    "cn@^0.3.0"
  ],
  "registryDependencies": [
    "button",
    "https://pastaui.com/r/pastaui-styles.json"
  ],
  "files": [
    {
      "path": "src/components/ai/memory.tsx",
      "content": "import { BrainIcon } from '@solar-icons/react/linear/brain'\nimport { AddIcon as PlusIcon } from '@solar-icons/react/linear/add'\nimport { CloseIcon as XIcon } from '@solar-icons/react/linear/close'\nimport * as React from 'react'\n\nimport { Button } from '@/components/ui/button'\nimport { cn } from 'cn'\n\ninterface MemoryItem {\n  category?: string\n  id: string\n  value: string\n}\n\ninterface MemoryProps extends React.ComponentProps<'section'> {\n  items: MemoryItem[]\n  onAdd?: () => void\n  onRemove?: (id: string) => void\n}\n\nfunction Memory({ className, items, onAdd, onRemove, ...props }: MemoryProps) {\n  const [pendingId, setPendingId] = React.useState<string | null>(null)\n  const visibleCount = items.filter((item) => item.id !== pendingId).length\n  const onRemoveRef = React.useRef(onRemove)\n\n  React.useEffect(() => {\n    onRemoveRef.current = onRemove\n  })\n\n  React.useEffect(() => {\n    if (!pendingId) return\n    const timer = window.setTimeout(() => {\n      onRemoveRef.current?.(pendingId)\n      setPendingId(null)\n    }, 4000)\n    return () => window.clearTimeout(timer)\n  }, [pendingId])\n\n  function forget(id: string) {\n    if (pendingId) onRemove?.(pendingId)\n    setPendingId(id)\n  }\n\n  return (\n    <section\n      data-slot=\"agent-memory\"\n      className={cn(\n        'rounded-[16px] bg-card p-2 font-sans text-sm font-[450] tracking-[-0.05px] text-muted-foreground shadow-card',\n        className,\n      )}\n      {...props}\n    >\n      <header className=\"flex h-9 items-center gap-2 pr-1 pl-3\">\n        <BrainIcon className=\"size-4 text-muted-foreground\" />\n        <h3 className=\"text-sm leading-5 font-medium text-muted-foreground\">\n          Memory <span className=\"text-muted-foreground/60 tabular-nums\">· {visibleCount}</span>\n        </h3>\n        {onAdd && (\n          <Button\n            className=\"ml-auto h-7 rounded-full px-2.5 text-xs text-muted-foreground hover:bg-foreground/8 hover:text-foreground\"\n            onClick={onAdd}\n            size=\"xs\"\n            type=\"button\"\n            variant=\"ghost\"\n          >\n            <PlusIcon data-icon=\"inline-start\" /> Add\n          </Button>\n        )}\n      </header>\n      <ul className=\"mt-1 flex flex-col\">\n        {items.map((item) =>\n          item.id === pendingId ? (\n            <li\n              className=\"flex min-h-10 items-center gap-3 rounded-[10px] px-3 py-2 text-[13px] leading-5 text-muted-foreground transition-opacity duration-150 ease-out starting:opacity-0\"\n              key={item.id}\n            >\n              <span className=\"min-w-0 flex-1 truncate\">Forgot “{item.value}”</span>\n              <Button\n                className=\"h-6 rounded-full px-2 text-xs text-foreground/85 hover:bg-foreground/8\"\n                onClick={() => setPendingId(null)}\n                size=\"xs\"\n                type=\"button\"\n                variant=\"ghost\"\n              >\n                Undo\n              </Button>\n            </li>\n          ) : (\n            <li\n              className=\"group relative flex min-h-10 items-baseline gap-3 rounded-[10px] px-3 py-2 transition-[opacity,background-color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] hover:bg-foreground/4 starting:opacity-0\"\n              key={item.id}\n            >\n              <span className=\"w-16 shrink-0 truncate text-[13px] leading-5 font-medium text-muted-foreground/70\">\n                {item.category}\n              </span>\n              <span\n                className={cn(\n                  'min-w-0 flex-1 text-sm leading-5 text-foreground/85',\n                  onRemove && 'pr-6',\n                )}\n              >\n                {item.value}\n              </span>\n              {onRemove && (\n                <Button\n                  aria-label={`Forget ${item.value}`}\n                  className=\"absolute top-2 right-2 opacity-0 transition-[opacity,background-color] duration-150 ease-out group-focus-within:opacity-100 group-hover:opacity-100 pointer-coarse:opacity-100\"\n                  onClick={() => forget(item.id)}\n                  size=\"icon-xs\"\n                  type=\"button\"\n                  variant=\"ghost\"\n                >\n                  <XIcon />\n                </Button>\n              )}\n            </li>\n          ),\n        )}\n      </ul>\n    </section>\n  )\n}\n\nexport { Memory }\nexport type { MemoryItem, MemoryProps }\n",
      "type": "registry:component",
      "target": "@components/ai/memory.tsx"
    }
  ],
  "type": "registry:component"
}