{"$schema":"https:\/\/ui.shadcn.com\/schema\/registry-item.json","name":"agent-activity","type":"registry:component","title":"Agent Activity","description":"One adaptive activity stream for reasoning, searches, tool calls, structured execution traces, or a chronological mix.","author":"Saurabh <saurabh10102@gmail.com>","dependencies":["clsx","lucide-react","motion","tailwind-merge"],"registryDependencies":["https:\/\/beui.dev\/r\/theme.json"],"docs":"Agent Activity: usage, props and types at https:\/\/beui.dev\/components\/agents\/agent-activity.md It uses beUI's theme tokens, added with this install.","files":[{"path":"components\/agents\/agent-activity\/index.tsx","type":"registry:component","target":"@components\/agents\/agent-activity\/index.tsx","content":"\"use client\";\n\/\/ beui.dev\/components\/agents\/agent-activity\n\nimport { ChevronDown } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion\/react\";\nimport { type ReactNode, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { AgentDisclosure } from \"@\/components\/agents\/agent-disclosure\";\nimport { ThinkingShimmer } from \"@\/components\/agents\/loading-states\/thinking-shimmer\";\nimport {\n  EASE_OUT,\n  SPRING_LAYOUT,\n  SPRING_SWAP,\n} from \"@\/lib\/ease\";\nimport { useStatusOpen } from \"@\/lib\/hooks\/use-status-open\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\nimport { ActivityRow } from \".\/activity-row\";\nimport {\n  type AgentActivityTranslate,\n  agentActivityMessages,\n} from \".\/messages\";\nimport type {\n  AgentActivityContentType,\n  AgentActivityItem,\n  AgentActivityProps,\n} from \".\/types\";\n\nexport {\n  type AgentActivityMessages,\n  agentActivityMessages,\n} from \".\/messages\";\nexport type {\n  AgentActivityContentType,\n  AgentActivityItem,\n  AgentActivityProps,\n  AgentActivitySearch,\n  AgentActivityStatus,\n  AgentActivityStep,\n  AgentActivityText,\n  AgentActivityTool,\n  AgentActivityTrace,\n  AgentSearchResult,\n  AgentStepStatus,\n  AgentTraceKind,\n} from \".\/types\";\n\nfunction formatDuration(duration: number, t: AgentActivityTranslate) {\n  const seconds = Math.max(0, Math.round(duration));\n  if (seconds < 60) return t(\"seconds\", { seconds });\n\n  const minutes = Math.floor(seconds \/ 60);\n  const remainder = seconds % 60;\n  return remainder === 0\n    ? t(\"minutes\", { minutes })\n    : t(\"minutesSeconds\", { minutes, seconds: remainder });\n}\n\nfunction getContentType(items: AgentActivityItem[]): AgentActivityContentType {\n  const first = items[0]?.type;\n  return first && items.every((item) => item.type === first) ? first : \"mixed\";\n}\n\nfunction getActiveLabel(\n  type: AgentActivityContentType,\n  t: AgentActivityTranslate,\n) {\n  if (type === \"search\") return t(\"searching\");\n  if (type === \"tool\") return t(\"runningTools\");\n  if (type === \"trace\") return t(\"workingTrace\");\n  if (type === \"mixed\") return t(\"workingMixed\");\n  return t(\"thinking\");\n}\n\nfunction getSummary(\n  type: AgentActivityContentType,\n  items: AgentActivityItem[],\n  duration: number,\n  t: AgentActivityTranslate,\n): ReactNode {\n  const count = items.length;\n  if (type === \"step\" || type === \"text\") {\n    \/\/ Raw template, split around the placeholder so the duration keeps its tabular figures.\n    const [before, after = \"\"] = t(\"thoughtFor\").split(\"{duration}\");\n    return (\n      <>\n        {before}\n        <span className=\"tabular-nums\">{formatDuration(duration, t)}<\/span>\n        {after}\n      <\/>\n    );\n  }\n  if (type === \"search\") return t(\"searched\");\n  if (type === \"tool\") {\n    return t(count === 1 ? \"ranToolsOne\" : \"ranToolsOther\", { count });\n  }\n  if (type === \"trace\") {\n    const messages = items.filter(\n      (item) =>\n        item.type === \"trace\" &&\n        (item.kind === \"thinking\" || item.kind === \"message\"),\n    ).length;\n    const tools = count - messages;\n    return t(\"traceSummary\", {\n      toolCalls: t(tools === 1 ? \"toolCallsOne\" : \"toolCallsOther\", {\n        count: tools,\n      }),\n      messages: t(messages === 1 ? \"messagesOne\" : \"messagesOther\", {\n        count: messages,\n      }),\n    });\n  }\n  return t(count === 1 ? \"completedStepsOne\" : \"completedStepsOther\", {\n    count,\n  });\n}\n\nexport function AgentActivity({\n  items,\n  contentType: initialContentType,\n  status = \"working\",\n  duration = 0,\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  collapseOnComplete = true,\n  activeLabel,\n  summary,\n  renderWorkingStatus,\n  renderCompletedStatus,\n  maxHeight = 208,\n  labels,\n  className,\n  contentClassName,\n}: AgentActivityProps) {\n  const reduce = useReducedMotion() ?? false;\n  const t = useMessages(\"agentActivity\", agentActivityMessages, labels);\n  const baseId = useId();\n  const triggerId = `${baseId}-trigger`;\n  const contentId = `${baseId}-content`;\n  const contentRef = useRef<HTMLDivElement>(null);\n  const viewportRef = useRef<HTMLDivElement>(null);\n  const [contentHeight, setContentHeight] = useState(0);\n  \/\/ When the work completes, the panel stays open or folds as asked.\n  const [currentOpen, setOpen] = useStatusOpen({\n    status,\n    open,\n    defaultOpen,\n    onOpenChange,\n    decide: (previous, next) =>\n      previous === \"working\" && next === \"complete\" ? !collapseOnComplete : undefined,\n  });\n  const working = status === \"working\";\n  const expanded = working || currentOpen;\n  const contentType = items.length\n    ? getContentType(items)\n    : (initialContentType ?? \"mixed\");\n  const cappedHeight = Math.min(contentHeight, Math.max(0, maxHeight));\n  const viewportHeight = working ? Math.max(0, maxHeight) : cappedHeight;\n  const capped = contentHeight > maxHeight;\n  const streamOffset = working\n    ? Math.min(0, viewportHeight - contentHeight)\n    : 0;\n\n  useLayoutEffect(() => {\n    const node = contentRef.current;\n    if (!node) return;\n\n    const measure = () => setContentHeight(node.offsetHeight);\n    measure();\n\n    if (typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(measure);\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, []);\n\n  const toggle = () => {\n    const next = !currentOpen;\n    setOpen(next);\n    if (next) requestAnimationFrame(() => viewportRef.current?.scrollTo({ top: 0 }));\n  };\n\n  const liveLabel = activeLabel ?? getActiveLabel(contentType, t);\n  const completedSummary = summary ?? getSummary(contentType, items, duration, t);\n  const maskImage = capped\n    ? working\n      ? \"linear-gradient(to bottom, transparent, black 12px)\"\n      : \"linear-gradient(to bottom, transparent, black 12px, black calc(100% - 12px), transparent)\"\n    : undefined;\n\n  return (\n    <div\n      data-state={working ? \"working\" : expanded ? \"open\" : \"closed\"}\n      data-content={contentType}\n      aria-busy={working}\n      className={cn(\"w-full text-sm\", className)}\n    >\n      {working ? (\n        <div\n          id={triggerId}\n          role=\"status\"\n          className=\"flex h-7 min-w-0 items-center text-muted-foreground\"\n        >\n          {renderWorkingStatus\n            ? renderWorkingStatus({ label: liveLabel, duration })\n            : <ThinkingShimmer>{liveLabel}<\/ThinkingShimmer>}\n        <\/div>\n      ) : (\n        <button\n          id={triggerId}\n          type=\"button\"\n          aria-expanded={expanded}\n          aria-controls={contentId}\n          onClick={toggle}\n          className=\"group flex h-7 min-w-0 items-center gap-1.5 rounded-full text-left font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n        >\n          <span className=\"truncate\">\n            {renderCompletedStatus\n              ? renderCompletedStatus({ summary: completedSummary, duration })\n              : completedSummary}\n          <\/span>\n          <motion.span\n            aria-hidden=\"true\"\n            animate={{ rotate: expanded ? 180 : 0 }}\n            transition={reduce ? { duration: 0 } : SPRING_SWAP}\n            className=\"inline-flex shrink-0 text-muted-foreground\/70 group-hover:text-foreground\"\n          >\n            <ChevronDown className=\"size-3.5\" \/>\n          <\/motion.span>\n        <\/button>\n      )}\n\n      <AgentDisclosure\n        id={contentId}\n        role=\"region\"\n        aria-labelledby={triggerId}\n        open={expanded}\n        openHeight={viewportHeight}\n      >\n        <div\n          ref={viewportRef}\n          className={cn(\n            \"scrollbar-hide pr-1\",\n            capped && expanded && !working ? \"overflow-y-auto\" : \"overflow-y-hidden\",\n          )}\n          style={{ height: viewportHeight, maskImage, WebkitMaskImage: maskImage }}\n        >\n          <motion.div\n            ref={contentRef}\n            role=\"list\"\n            initial={false}\n            animate={{ y: streamOffset }}\n            transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n            className={cn(\"space-y-0.5 py-2\", contentClassName)}\n          >\n            <AnimatePresence mode=\"popLayout\">\n              {items.map((item) => (\n                <motion.div\n                  layout=\"position\"\n                  key={item.id}\n                  role=\"listitem\"\n                  initial={reduce ? { opacity: 1 } : { opacity: 0, y: 6 }}\n                  animate={{ opacity: 1, y: 0 }}\n                  exit={reduce ? { opacity: 0 } : { opacity: 0, y: -3 }}\n                  transition={\n                    reduce\n                      ? { duration: 0 }\n                      : {\n                          opacity: { duration: 0.18, ease: EASE_OUT },\n                          y: SPRING_LAYOUT,\n                          layout: SPRING_LAYOUT,\n                        }\n                  }\n                >\n                  <ActivityRow item={item} t={t} \/>\n                <\/motion.div>\n              ))}\n            <\/AnimatePresence>\n          <\/motion.div>\n        <\/div>\n      <\/AgentDisclosure>\n    <\/div>\n  );\n}\n"},{"path":"components\/agents\/agent-activity\/activity-row.tsx","type":"registry:component","target":"@components\/agents\/agent-activity\/activity-row.tsx","content":"import {\n  Brain,\n  Check,\n  Circle,\n  FileText,\n  Globe2,\n  ImageIcon,\n  MessageSquare,\n  PencilLine,\n  Search,\n  SquareTerminal,\n  Wrench,\n} from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion\/react\";\nimport { IconSwap } from \"@\/components\/agents\/icon-swap\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"@\/lib\/ease\";\nimport { cn } from \"@\/lib\/utils\";\nimport type { AgentActivityTranslate } from \".\/messages\";\nimport type {\n  AgentActivityItem,\n  AgentActivitySearch,\n  AgentActivityStep,\n  AgentActivityText,\n  AgentActivityTool,\n  AgentActivityTrace,\n  AgentSearchResult,\n} from \".\/types\";\n\nfunction StepRow({ item }: { item: AgentActivityStep }) {\n  const state = item.status ?? \"complete\";\n\n  return (\n    <div className=\"flex min-h-7 items-start gap-2.5 rounded-md px-1.5 py-1\">\n      {\/* The marker morphs as the step moves on: a finished step's dot\n          blurs into its check rather than snapping. *\/}\n      <span\n        aria-hidden=\"true\"\n        className=\"relative mt-0.5 grid size-4 shrink-0 place-items-center text-muted-foreground\/70\"\n      >\n        <IconSwap id={state}>\n            {state === \"complete\" ? (\n              <Check className=\"size-4\" strokeWidth={1.8} \/>\n            ) : state === \"active\" ? (\n              <span className=\"relative grid size-3 place-items-center\">\n                <motion.span\n                  className=\"absolute inset-0 rounded-full bg-foreground\/10\"\n                  animate={{ opacity: [0.35, 0.8, 0.35] }}\n                  transition={{ duration: 1.5, ease: \"easeInOut\", repeat: Number.POSITIVE_INFINITY }}\n                \/>\n                <span className=\"size-1.5 rounded-full bg-foreground\/60\" \/>\n              <\/span>\n            ) : (\n              <Circle className=\"size-3\" strokeWidth={1.5} \/>\n            )}\n        <\/IconSwap>\n      <\/span>\n      <span\n        className={cn(\n          \"min-w-0 flex-1 leading-5\",\n          state === \"pending\" ? \"text-muted-foreground\/55\" : \"text-foreground\/90\",\n        )}\n      >\n        {item.label}\n      <\/span>\n      {item.meta ? (\n        <span className=\"shrink-0 leading-5 text-muted-foreground\/55\">\n          {item.meta}\n        <\/span>\n      ) : null}\n    <\/div>\n  );\n}\n\nfunction TextRow({ item }: { item: AgentActivityText }) {\n  return (\n    <div className=\"rounded-md px-1.5 py-1 leading-5 text-muted-foreground\">\n      {item.content}\n    <\/div>\n  );\n}\n\nfunction SearchResultRow({\n  result,\n}: {\n  result: AgentSearchResult;\n}) {\n  const content = (\n    <>\n      <span\n        aria-hidden=\"true\"\n        className=\"grid size-5 shrink-0 place-items-center text-muted-foreground\"\n      >\n        {result.icon ?? <Globe2 className=\"size-3\" strokeWidth={2} \/>}\n      <\/span>\n      <span className=\"min-w-0 truncate font-medium text-foreground\/90\">\n        {result.title}\n      <\/span>\n      {result.domain ? (\n        <span className=\"min-w-0 truncate text-muted-foreground\/55\">\n          {result.domain}\n        <\/span>\n      ) : null}\n    <\/>\n  );\n  const className = cn(\n    \"flex min-h-7 items-center gap-2 rounded-md px-1.5 py-1 text-left outline-none transition-colors\",\n    result.url && \"hover:bg-foreground\/[0.04] focus-visible:ring-2 focus-visible:ring-ring\",\n  );\n\n  return result.url ? (\n    <a href={result.url} className={className}>\n      {content}\n    <\/a>\n  ) : (\n    <div className={className}>{content}<\/div>\n  );\n}\n\nfunction SearchRow({\n  item,\n  t,\n}: {\n  item: AgentActivitySearch;\n  t: AgentActivityTranslate;\n}) {\n  const reduce = useReducedMotion() ?? false;\n  const enter = reduce ? { opacity: 1 } : { opacity: 0, y: 6 };\n  const visible = { opacity: 1, y: 0 };\n  const exit = reduce ? { opacity: 0 } : { opacity: 0, y: -3 };\n  const transition = reduce\n    ? { duration: 0 }\n    : {\n        opacity: { duration: 0.18, ease: EASE_OUT },\n        y: SPRING_LAYOUT,\n        layout: SPRING_LAYOUT,\n      };\n\n  return (\n    <div className=\"space-y-0.5\">\n      <div className=\"flex min-h-7 items-center gap-2.5 rounded-md px-1.5 py-1 text-muted-foreground\">\n        <Search aria-hidden=\"true\" className=\"size-4 shrink-0\" strokeWidth={1.7} \/>\n        <span className=\"min-w-0 truncate\">{item.query}<\/span>\n      <\/div>\n      {item.results?.length ? (\n        <div className=\"space-y-0.5 pl-4\">\n          <AnimatePresence initial mode=\"popLayout\">\n            {item.results.map((result) => (\n              <motion.div\n                layout=\"position\"\n                key={result.id}\n                initial={enter}\n                animate={visible}\n                exit={exit}\n                transition={transition}\n              >\n                <SearchResultRow result={result} \/>\n              <\/motion.div>\n            ))}\n          <\/AnimatePresence>\n        <\/div>\n      ) : null}\n      <AnimatePresence initial>\n        {item.moreCount ? (\n          <motion.div\n            key=\"more-results\"\n            initial={enter}\n            animate={visible}\n            exit={exit}\n            transition={transition}\n            className=\"px-1.5 py-1 pl-8 text-muted-foreground\/55\"\n          >\n            {t(\"moreResults\", { count: item.moreCount })}\n          <\/motion.div>\n        ) : null}\n      <\/AnimatePresence>\n    <\/div>\n  );\n}\n\nfunction ActionIcon({ action }: { action: string }) {\n  if (action === \"read\") return <FileText className=\"size-4\" \/>;\n  if (action === \"edit\" || action === \"write\") {\n    return <PencilLine className=\"size-4\" \/>;\n  }\n  if (action === \"run\") return <SquareTerminal className=\"size-4\" \/>;\n  return <Wrench className=\"size-4\" \/>;\n}\n\nconst KNOWN_ACTIONS = [\"read\", \"edit\", \"write\", \"run\"] as const;\n\nfunction ToolRow({\n  item,\n  t,\n}: {\n  item: AgentActivityTool;\n  t: AgentActivityTranslate;\n}) {\n  const known = KNOWN_ACTIONS.find((action) => action === item.action);\n  const action = known\n    ? t(known)\n    : item.action.charAt(0).toUpperCase() + item.action.slice(1);\n\n  return (\n    <div className=\"flex min-h-8 min-w-0 items-center gap-2.5 rounded-md px-1.5 py-0.5 leading-5\">\n      <span\n        aria-hidden=\"true\"\n        className=\"grid size-4 shrink-0 place-items-center text-muted-foreground\/70\"\n      >\n        <ActionIcon action={item.action} \/>\n      <\/span>\n      <span className=\"shrink-0 font-medium text-foreground\/90\">{action}<\/span>\n      <span className=\"min-w-0 flex-1 truncate rounded-full bg-muted\/80 px-2.5 py-1 font-mono text-xs text-muted-foreground\/70\">\n        {item.target}\n      <\/span>\n      {typeof item.additions === \"number\" || typeof item.deletions === \"number\" ? (\n        <span className=\"flex shrink-0 items-center gap-2 font-mono tabular-nums\">\n          {typeof item.additions === \"number\" ? (\n            <span className=\"text-emerald-500\">+{item.additions}<\/span>\n          ) : null}\n          {typeof item.deletions === \"number\" ? (\n            <span className=\"text-rose-500\">\u2212{item.deletions}<\/span>\n          ) : null}\n        <\/span>\n      ) : null}\n    <\/div>\n  );\n}\n\nfunction TraceIcon({ kind }: { kind: AgentActivityTrace[\"kind\"] }) {\n  if (kind === \"thinking\") return <Brain className=\"size-4\" \/>;\n  if (kind === \"message\") return <MessageSquare className=\"size-4\" \/>;\n  if (kind === \"write\") return <PencilLine className=\"size-4\" \/>;\n  if (kind === \"run\") return <SquareTerminal className=\"size-4\" \/>;\n  if (kind === \"read\") return <ImageIcon className=\"size-4\" \/>;\n  return <Wrench className=\"size-4\" \/>;\n}\n\nfunction TraceRow({ item }: { item: AgentActivityTrace }) {\n  return (\n    <div className=\"grid min-h-8 grid-cols-[1rem_auto_minmax(0,1fr)] items-center gap-2.5 rounded-md px-1.5 py-0.5\">\n      <span\n        aria-hidden=\"true\"\n        className=\"grid size-4 place-items-center text-muted-foreground\/70\"\n      >\n        {item.icon ?? <TraceIcon kind={item.kind} \/>}\n      <\/span>\n      <span className=\"font-medium text-foreground\/90\">{item.label}<\/span>\n      {item.detail ? (\n        <span className=\"min-w-0 truncate rounded-full bg-muted\/80 px-2.5 py-1 font-mono text-xs text-muted-foreground\/70\">\n          {item.detail}\n        <\/span>\n      ) : (\n        <span \/>\n      )}\n    <\/div>\n  );\n}\n\nexport function ActivityRow({\n  item,\n  t,\n}: {\n  item: AgentActivityItem;\n  t: AgentActivityTranslate;\n}) {\n  if (item.type === \"text\") return <TextRow item={item} \/>;\n  if (item.type === \"search\") return <SearchRow item={item} t={t} \/>;\n  if (item.type === \"tool\") return <ToolRow item={item} t={t} \/>;\n  if (item.type === \"trace\") return <TraceRow item={item} \/>;\n  return <StepRow item={item} \/>;\n}\n"},{"path":"components\/agents\/agent-activity\/messages.ts","type":"registry:component","target":"@components\/agents\/agent-activity\/messages.ts","content":"\/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. *\/\nexport const agentActivityMessages = {\n  thinking: \"Thinking\u2026\",\n  searching: \"Searching the web\u2026\",\n  runningTools: \"Running tools\u2026\",\n  workingTrace: \"Working through the run\u2026\",\n  workingMixed: \"Working through it\u2026\",\n  thoughtFor: \"Thought for {duration}\",\n  seconds: \"{seconds}s\",\n  minutes: \"{minutes}m\",\n  minutesSeconds: \"{minutes}m {seconds}s\",\n  searched: \"Searched the web\",\n  ranToolsOne: \"Ran {count} tool\",\n  ranToolsOther: \"Ran {count} tools\",\n  traceSummary: \"{toolCalls}, {messages}\",\n  toolCallsOne: \"{count} tool call\",\n  toolCallsOther: \"{count} tool calls\",\n  messagesOne: \"{count} message\",\n  messagesOther: \"{count} messages\",\n  completedStepsOne: \"Completed {count} step\",\n  completedStepsOther: \"Completed {count} steps\",\n  moreResults: \"+{count} more\",\n  read: \"Read\",\n  edit: \"Edit\",\n  write: \"Write\",\n  run: \"Run\",\n};\n\nexport type AgentActivityMessages = typeof agentActivityMessages;\n\nexport type AgentActivityTranslate = (\n  key: keyof AgentActivityMessages,\n  values?: Record<string, string | number>,\n) => string;\n"},{"path":"components\/agents\/agent-activity\/types.ts","type":"registry:component","target":"@components\/agents\/agent-activity\/types.ts","content":"import type { ReactNode } from \"react\";\nimport type { AgentActivityMessages } from \".\/messages\";\n\nexport type AgentActivityStatus = \"working\" | \"complete\";\nexport type AgentStepStatus = \"pending\" | \"active\" | \"complete\";\n\nexport interface AgentActivityStep {\n  id: string;\n  type: \"step\";\n  label: ReactNode;\n  status?: AgentStepStatus;\n  meta?: ReactNode;\n}\n\nexport interface AgentActivityText {\n  id: string;\n  type: \"text\";\n  content: ReactNode;\n}\n\nexport interface AgentSearchResult {\n  id: string;\n  title: ReactNode;\n  domain?: ReactNode;\n  url?: string;\n  icon?: ReactNode;\n}\n\nexport interface AgentActivitySearch {\n  id: string;\n  type: \"search\";\n  query: ReactNode;\n  results?: AgentSearchResult[];\n  moreCount?: number;\n}\n\nexport interface AgentActivityTool {\n  id: string;\n  type: \"tool\";\n  action: \"read\" | \"edit\" | \"run\" | (string & {});\n  target: ReactNode;\n  additions?: number;\n  deletions?: number;\n}\n\nexport type AgentTraceKind =\n  | \"thinking\"\n  | \"message\"\n  | \"write\"\n  | \"run\"\n  | \"read\"\n  | (string & {});\n\nexport interface AgentActivityTrace {\n  id: string;\n  type: \"trace\";\n  kind: AgentTraceKind;\n  label: ReactNode;\n  detail?: ReactNode;\n  icon?: ReactNode;\n}\n\nexport type AgentActivityItem =\n  | AgentActivityStep\n  | AgentActivityText\n  | AgentActivitySearch\n  | AgentActivityTool\n  | AgentActivityTrace;\n\nexport type AgentActivityContentType = AgentActivityItem[\"type\"] | \"mixed\";\n\nexport interface AgentActivityProps {\n  \/** Chronological activity entries. Append or update items as events stream. *\/\n  items: AgentActivityItem[];\n  \/** Expected activity kind before the first streamed item arrives. *\/\n  contentType?: AgentActivityContentType;\n  \/** Current run phase. Active runs always stay expanded. *\/\n  status?: AgentActivityStatus;\n  \/** Elapsed run time, in seconds. Used by the step-only summary. *\/\n  duration?: number;\n  \/** Controlled expanded state used after the run completes. *\/\n  open?: boolean;\n  \/** Initial expanded state used after the run completes. *\/\n  defaultOpen?: boolean;\n  \/** Called when the completed activity disclosure changes state. *\/\n  onOpenChange?: (open: boolean) => void;\n  \/** Collapse the disclosure when status changes from working to complete. *\/\n  collapseOnComplete?: boolean;\n  \/** Optional label shown while the run is active. *\/\n  activeLabel?: ReactNode;\n  \/** Optional completed summary. Derived from the item types by default. *\/\n  summary?: ReactNode;\n  \/** Optional renderer for the contents of the active status row. *\/\n  renderWorkingStatus?: (context: {\n    label: ReactNode;\n    duration: number;\n  }) => ReactNode;\n  \/** Optional renderer for the contents before the built-in disclosure chevron. *\/\n  renderCompletedStatus?: (context: {\n    summary: ReactNode;\n    duration: number;\n  }) => ReactNode;\n  \/** Maximum visible activity height before the stream begins gliding. *\/\n  maxHeight?: number;\n  \/** Override any built-in string. Pick `One`\/`Other` keys by count; `{count}`, `{duration}`, `{seconds}` and `{minutes}` fill the matching messages. *\/\n  labels?: Partial<AgentActivityMessages>;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n  \/** Classes merged onto the list of activity items. *\/\n  contentClassName?: string;\n}\n"},{"path":"components\/agents\/agent-disclosure.tsx","type":"registry:component","target":"@components\/agents\/agent-disclosure.tsx","content":"\"use client\";\n\nimport { motion, type HTMLMotionProps, useReducedMotion } from \"motion\/react\";\nimport { type CSSProperties, useState } from \"react\";\nimport { EASE_OUT } from \"@\/lib\/ease\";\nimport { cn } from \"@\/lib\/utils\";\n\nexport interface AgentDisclosureProps\n  extends Omit<HTMLMotionProps<\"div\">, \"animate\" | \"initial\"> {\n  open: boolean;\n  openHeight?: CSSProperties[\"height\"];\n}\n\n\/**\n * Shared reveal for collapsible agent content: a clip, fade and short drop,\n * never an animated height. The box takes its height as soon as it opens and\n * gives it up only once the closing reveal has played, so the exit is seen\n * and mirrors the entrance.\n *\/\nexport function AgentDisclosure({\n  open,\n  openHeight = \"auto\",\n  className,\n  style,\n  transition,\n  onAnimationComplete,\n  ...props\n}: AgentDisclosureProps) {\n  const reduce = useReducedMotion() ?? false;\n  const [collapsed, setCollapsed] = useState(!open);\n  if (open && collapsed) setCollapsed(false);\n\n  return (\n    <motion.div\n      {...props}\n      aria-hidden={!open}\n      inert={!open}\n      initial={false}\n      animate={\n        reduce\n          ? { opacity: open ? 1 : 0 }\n          : {\n              opacity: open ? 1 : 0,\n              clipPath: open ? \"inset(0 0 0% 0)\" : \"inset(0 0 100% 0)\",\n              y: open ? 0 : -4,\n            }\n      }\n      transition={\n        transition ?? {\n          duration: reduce ? 0 : open ? 0.22 : 0.14,\n          ease: EASE_OUT,\n        }\n      }\n      onAnimationComplete={(definition) => {\n        if (!open) setCollapsed(true);\n        onAnimationComplete?.(definition);\n      }}\n      className={cn(\"overflow-hidden\", className)}\n      style={{\n        ...style,\n        height: collapsed ? 0 : openHeight,\n        pointerEvents: open ? undefined : \"none\",\n        transformOrigin: \"top\",\n      }}\n    \/>\n  );\n}\n"},{"path":"components\/agents\/loading-states\/thinking-shimmer.tsx","type":"registry:component","target":"@components\/agents\/loading-states\/thinking-shimmer.tsx","content":"\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { TextShimmer } from \"@\/components\/motion\/text-shimmer\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\nimport { type LoadingStatesMessages, loadingStatesMessages } from \".\/messages\";\n\nexport interface ThinkingShimmerProps {\n  \/** Loading message shown to the user. *\/\n  children?: ReactNode;\n  \/** Seconds taken for one shimmer pass. *\/\n  duration?: number;\n  \/** Override any built-in string. *\/\n  labels?: Partial<LoadingStatesMessages>;\n  \/** Classes merged onto the shimmering text. *\/\n  className?: string;\n}\n\nexport function ThinkingShimmer({\n  children,\n  duration = 1.8,\n  labels,\n  className,\n}: ThinkingShimmerProps) {\n  const t = useMessages(\"loadingStates\", loadingStatesMessages, labels);\n\n  return (\n    <TextShimmer\n      as=\"span\"\n      duration={duration}\n      className={cn(\"font-medium\", className)}\n    >\n      {children ?? t(\"thinking\")}\n    <\/TextShimmer>\n  );\n}\n"},{"path":"lib\/ease.ts","type":"registry:lib","target":"@lib\/ease.ts","content":"\/\/ Shared motion tokens. Easing curves mirror the CSS custom properties in\n\/\/ globals.css; springs are the canonical physics used across components.\n\/\/ Strong custom variants - defaults like `ease-in`\/`ease-out` feel weak.\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\n\/** Accelerating curve for things that fall (a dropped ball, a toppled block). Not for UI entrances. *\/\nexport const EASE_IN = [0.55, 0, 1, 0.45] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n\/** CSS string form of EASE_OUT for inline style transitions. *\/\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n\/** Press feedback on buttons and other tappable surfaces. *\/\nexport const SPRING_PRESS = {\n  type: \"spring\",\n  stiffness: 500,\n  damping: 30,\n  mass: 0.6,\n} as const;\n\n\/** Content swaps - label\/icon slots trading places inside a control. *\/\nexport const SPRING_SWAP = {\n  type: \"spring\",\n  stiffness: 460,\n  damping: 30,\n  mass: 0.55,\n} as const;\n\n\/** Overlay panel entrances - modals and sheets summoned by pointer. *\/\nexport const SPRING_PANEL = {\n  type: \"spring\",\n  stiffness: 420,\n  damping: 40,\n  mass: 0.5,\n} as const;\n\n\/** Shared-layout glides - pills, indicators and panels morphing between positions. *\/\nexport const SPRING_LAYOUT = {\n  type: \"spring\",\n  stiffness: 360,\n  damping: 32,\n  mass: 0.6,\n} as const;\n\n\/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). *\/\nexport const SPRING_MOUSE = {\n  stiffness: 200,\n  damping: 15,\n  mass: 0.3,\n} as const;\n\n\/** Dragged handles and fills (sliders) - critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. *\/\nexport const SPRING_GLIDE = {\n  stiffness: 700,\n  damping: 50,\n  mass: 0.5,\n} as const;\n\n\/** Shared-surface morphs: a trigger growing into its panel and back on one\n * weighted spring, so opening and closing travel the same path. *\/\nexport const SPRING_MORPH = {\n  type: \"spring\",\n  duration: 0.5,\n  bounce: 0.22,\n} as const;\n"},{"path":"lib\/hooks\/use-status-open.ts","type":"registry:hook","target":"@lib\/hooks\/use-status-open.ts","content":"\"use client\";\n\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { useControllable } from \"@\/lib\/hooks\/use-controllable\";\n\n\/**\n * Open state for a disclosure that opens or closes itself when a status\n * changes: a tool result that opens while it runs, a todo list that folds\n * when the work completes. Controlled through `open`, or uncontrolled from\n * `defaultOpen`.\n *\n * `decide(previous, next)` runs in the render that first sees a new status\n * and returns `true` to open, `false` to close, or `undefined` to leave it.\n * An uncontrolled panel flips in that same render, so it never shows one\n * commit in the old state. Telling the consumer through `onOpenChange` is a\n * side effect, so it waits for the commit.\n *\/\nexport function useStatusOpen<Status>({\n  status,\n  initialStatus = status,\n  decide,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: {\n  status: Status;\n  \/**\n   * The status to treat as already seen at mount. Defaults to `status`, so\n   * mounting is not a change; pass another value to let the first render\n   * count as one.\n   *\/\n  initialStatus?: Status;\n  decide: (previous: Status, next: Status) => boolean | undefined;\n  open?: boolean;\n  defaultOpen: boolean;\n  onOpenChange?: (open: boolean) => void;\n}) {\n  const [currentOpen, setOpen, setInternal] = useControllable(open, defaultOpen, onOpenChange);\n  const [seenStatus, setSeenStatus] = useState(initialStatus);\n  const [request, setRequest] = useState<{ open: boolean; from: boolean } | null>(null);\n\n  if (status !== seenStatus) {\n    setSeenStatus(status);\n    const wanted = decide(seenStatus, status);\n    if (wanted !== undefined) {\n      if (open === undefined) setInternal(wanted);\n      setRequest({ open: wanted, from: currentOpen });\n    }\n  }\n\n  const notify = useRef(onOpenChange);\n  useLayoutEffect(() => {\n    notify.current = onOpenChange;\n  });\n  useEffect(() => {\n    if (request && request.open !== request.from) notify.current?.(request.open);\n  }, [request]);\n\n  return [currentOpen, setOpen] as const;\n}\n"},{"path":"lib\/i18n.tsx","type":"registry:lib","target":"@lib\/i18n.tsx","content":"\"use client\";\n\nimport {\n  createContext,\n  type ReactNode,\n  useCallback,\n  useContext,\n  useMemo,\n} from \"react\";\n\n\/**\n * A component's messages. Plain strings with `{name}` placeholders, so a\n * dictionary stays JSON-serializable and can be passed from a server layout.\n * There are no plural forms: write messages that read correctly for any count.\n *\/\nexport type Messages = Record<string, string>;\n\n\/** A language file: component namespace \u2192 any subset of that component's messages. *\/\nexport type LocaleMessages = Record<string, Partial<Messages>>;\n\ntype LocaleContextValue = {\n  locale?: string;\n  messages: LocaleMessages;\n};\n\nconst NO_MESSAGES: LocaleMessages = {};\n\nconst LocaleContext = createContext<LocaleContextValue>({ messages: NO_MESSAGES });\n\n\/** Without a locale, digits stay plain so server and client render the same text. *\/\nexport function formatNumber(value: number, locale?: string) {\n  return locale ? new Intl.NumberFormat(locale).format(value) : String(value);\n}\n\nexport interface LocaleProviderProps {\n  \/** BCP 47 tag, e.g. `de`, `pt-BR`. Drives `Intl` number formatting. *\/\n  locale: string;\n  \/**\n   * Component namespace \u2192 translated strings. Missing keys fall back to English.\n   * Pass a stable object (a module constant, imported JSON or a memoized value):\n   * a new object each render gives every translated component a new `t`.\n   *\/\n  messages?: LocaleMessages;\n  children: ReactNode;\n}\n\nexport function LocaleProvider({ locale, messages = NO_MESSAGES, children }: LocaleProviderProps) {\n  const value = useMemo(() => ({ locale, messages }), [locale, messages]);\n  return <LocaleContext.Provider value={value}>{children}<\/LocaleContext.Provider>;\n}\n\nexport function useLocale(): { locale?: string } {\n  return { locale: useContext(LocaleContext).locale };\n}\n\n\/**\n * Resolves a component's strings: `labels` prop, then the provider's\n * messages for `namespace`, then the component's English `defaults`.\n * Numbers passed as values are formatted for the provider's locale.\n *\/\nexport function useMessages<T extends Messages>(\n  namespace: string,\n  defaults: T,\n  labels?: Partial<T>,\n) {\n  const { locale, messages } = useContext(LocaleContext);\n  const provided = messages[namespace];\n  \/\/ Inline `labels={{ \u2026 }}` is a new object every render. Keying it by content\n  \/\/ keeps `t` one identity until a label changes, so effects and memos that\n  \/\/ depend on `t` don't re-run per render, and render-time reads never lag.\n  const labelsKey = labels ? JSON.stringify(labels) : \"\";\n  const stableLabels = useMemo(\n    () => (labelsKey ? (JSON.parse(labelsKey) as Partial<T>) : undefined),\n    [labelsKey],\n  );\n\n  return useCallback(\n    (key: keyof T & string, values?: Record<string, string | number>) => {\n      const template = stableLabels?.[key] ?? provided?.[key] ?? defaults[key];\n      if (!values) return template;\n      return template.replace(\/\\{(\\w+)\\}\/g, (match, name: string) => {\n        const value = values[name];\n        if (value === undefined) return match;\n        return typeof value === \"number\" ? formatNumber(value, locale) : value;\n      });\n    },\n    [defaults, stableLabels, locale, provided],\n  );\n}\n"},{"path":"lib\/utils.ts","type":"registry:lib","target":"@lib\/utils.ts","content":"import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"},{"path":"components\/agents\/icon-swap.tsx","type":"registry:component","target":"@components\/agents\/icon-swap.tsx","content":"\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion\/react\";\nimport type { ReactNode } from \"react\";\nimport { SPRING_SWAP } from \"@\/lib\/ease\";\nimport { cn } from \"@\/lib\/utils\";\n\nexport interface IconSwapProps {\n  \/** Changes whenever the icon should change (copy \u2192 copied, running \u2192 done). *\/\n  id: string;\n  children: ReactNode;\n  className?: string;\n}\n\n\/**\n * Crossfades one status icon into the next with a little scale and a 2px\n * blur, so the change reads as one icon morphing rather than two crossing.\n * Reduced motion keeps the fade and drops the scale.\n *\/\nexport function IconSwap({ id, children, className }: IconSwapProps) {\n  const reduce = useReducedMotion() ?? false;\n  return (\n    <AnimatePresence mode=\"popLayout\" initial={false}>\n      <motion.span\n        key={id}\n        initial={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.6, filter: \"blur(2px)\" }}\n        animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n        exit={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.6, filter: \"blur(2px)\" }}\n        transition={reduce ? { duration: 0.12 } : SPRING_SWAP}\n        className={cn(\"grid place-items-center\", className)}\n      >\n        {children}\n      <\/motion.span>\n    <\/AnimatePresence>\n  );\n}\n"},{"path":"components\/agents\/loading-states\/messages.ts","type":"registry:component","target":"@components\/agents\/loading-states\/messages.ts","content":"\/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. *\/\nexport const loadingStatesMessages = {\n  thinking: \"Thinking\u2026\",\n  churning: \"Churning\",\n  inProgress: \"{label}, in progress\",\n  reasoning: \"Reasoning\",\n  phraseThinking: \"Thinking\",\n  phraseReading: \"Reading the context\",\n  phraseConnecting: \"Connecting the details\",\n  phraseForming: \"Forming a response\",\n};\n\nexport type LoadingStatesMessages = typeof loadingStatesMessages;\n"},{"path":"components\/motion\/text-shimmer.tsx","type":"registry:component","target":"@components\/motion\/text-shimmer.tsx","content":"import { cn } from \"@\/lib\/utils\";\nimport type { ElementType, ReactNode } from \"react\";\nimport {\n  TEXT_SHIMMER_CLASS_NAME,\n  TEXT_SHIMMER_KEYFRAMES,\n  textShimmerStyle,\n} from \"@\/lib\/text-shimmer\";\n\nexport interface TextShimmerProps {\n  children: ReactNode;\n  \/** Element to render the text as. Default: \"span\" *\/\n  as?: ElementType;\n  \/** Length of one shimmer sweep (s). Default: 2.5 *\/\n  duration?: number;\n  \/** Classes merged onto the text element. *\/\n  className?: string;\n}\n\nexport function TextShimmer({ children, as: Comp = \"span\", duration = 2.5, className }: TextShimmerProps) {\n  return (\n    <>\n      <style>\n        {TEXT_SHIMMER_KEYFRAMES}\n      <\/style>\n      <Comp\n        style={textShimmerStyle(duration)}\n        className={cn(\n          \"inline-block\",\n          TEXT_SHIMMER_CLASS_NAME,\n          className,\n        )}\n      >\n        {children}\n      <\/Comp>\n    <\/>\n  );\n}\n"},{"path":"lib\/hooks\/use-controllable.ts","type":"registry:hook","target":"@lib\/hooks\/use-controllable.ts","content":"\"use client\";\n\nimport { useCallback, useLayoutEffect, useRef, useState } from \"react\";\n\n\/**\n * A value that is controlled when `value` is defined and uncontrolled\n * otherwise. Returns the current value, a setter whose identity never changes,\n * and the raw internal setter for callers that resolve state during render.\n *\n * The setter calls `onChange` only when the value actually changes, so a\n * consumer is never told about a no-op.\n *\/\nexport function useControllable<T>(\n  value: T | undefined,\n  defaultValue: T,\n  onChange?: (next: T) => void,\n) {\n  const [internal, setInternal] = useState(defaultValue);\n  const latest = useRef({ value, internal, onChange });\n  useLayoutEffect(() => {\n    latest.current = { value, internal, onChange };\n  });\n  const set = useCallback((next: T) => {\n    const current = latest.current;\n    if (current.value === undefined) setInternal(next);\n    if ((current.value === undefined ? current.internal : current.value) !== next)\n      current.onChange?.(next);\n  }, []);\n  return [value === undefined ? internal : value, set, setInternal] as const;\n}\n"},{"path":"lib\/text-shimmer.ts","type":"registry:lib","target":"@lib\/text-shimmer.ts","content":"import type { CSSProperties } from \"react\";\n\n\/\/ The reduced-motion rule travels with the component. The site's globals.css calms CSS\n\/\/ animation globally, but the registry bundles imports only, so an installed\n\/\/ copy never receives that reset.\n\/\/\n\/\/ `!important` because the sweep is an inline style, which outranks a plain rule\n\/\/ in a media query. It selects a marker class carried by TEXT_SHIMMER_CLASS_NAME\n\/\/ so it also reaches consumers that build their own span out of these exports.\nexport const TEXT_SHIMMER_KEYFRAMES =\n  \"@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}\" +\n  \"@media (prefers-reduced-motion: reduce){.beui-text-shimmer{animation:none !important}}\";\n\nexport const TEXT_SHIMMER_CLASS_NAME =\n  \"beui-text-shimmer bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]\";\n\n\/**\n * Only the moving highlight band, transparent elsewhere. Laid over text drawn\n * in pieces (a letter cascade), so one band sweeps the whole phrase instead\n * of every piece carrying, and flashing, its own gradient.\n *\/\nexport const TEXT_SHIMMER_HIGHLIGHT_CLASS_NAME =\n  \"beui-text-shimmer bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,transparent_30%,var(--foreground)_50%,transparent_70%)]\";\n\nexport function textShimmerStyle(duration: number): CSSProperties {\n  return {\n    animation: `beui-text-shimmer ${duration}s linear infinite`,\n  };\n}\n"}]}