{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "claude-code",
  "title": "Claude Code",
  "description": "A Claude Code terminal session with the compact header, tool calls, a running turn and the prompt, built from the Claude Code components on shadcn Base UI.",
  "dependencies": [
    "cn"
  ],
  "registryDependencies": [
    "button",
    "card",
    "collapsible",
    "input-group",
    "kbd",
    "scroll-area"
  ],
  "files": [
    {
      "path": "registry/notra/claude-code/components/claude-code-terminal.tsx",
      "content": "import { cn } from \"cn\";\n\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\n\nimport type { ClaudeCodeTerminalProps } from \"../types/claude-code\";\n\nexport const ClaudeCodeTerminal = ({\n  children,\n  className,\n  contentClassName,\n  footer,\n  title,\n  ...props\n}: ClaudeCodeTerminalProps) => (\n  <Card\n    className={cn(\n      \"bg-claude-code-bg font-claude-code text-claude-code-fg ring-claude-code-ring w-full min-w-0 gap-0 overflow-clip rounded-xl py-0 shadow-[0_1.5rem_3.5rem_-1rem_var(--claude-code-shadow)] ring-1\",\n      className\n    )}\n    data-slot=\"claude-code-terminal\"\n    {...props}\n  >\n    <CardHeader className=\"bg-claude-code-chrome relative flex h-8 shrink-0 items-center justify-center rounded-none px-3 py-0\">\n      <div\n        aria-hidden=\"true\"\n        className=\"absolute inset-y-0 left-3 flex items-center gap-2\"\n      >\n        <span className=\"bg-claude-code-traffic size-3 shrink-0 rounded-full\" />\n        <span className=\"bg-claude-code-traffic size-3 shrink-0 rounded-full\" />\n        <span className=\"bg-claude-code-traffic size-3 shrink-0 rounded-full\" />\n      </div>\n      {title && (\n        <CardTitle className=\"font-claude-code text-claude-code-title max-w-[60%] min-w-0 truncate text-xs leading-4 font-normal\">\n          {title}\n        </CardTitle>\n      )}\n    </CardHeader>\n    <ScrollArea className=\"min-h-0 flex-1\">\n      <CardContent\n        className={cn(\n          \"flex flex-col gap-5 px-3 py-4 text-[0.8125rem] leading-5 sm:px-4\",\n          contentClassName\n        )}\n        data-slot=\"claude-code-terminal-content\"\n      >\n        {children}\n      </CardContent>\n    </ScrollArea>\n    {footer && (\n      <div className=\"shrink-0 px-3 pb-3 text-[0.8125rem] leading-5 sm:px-4\">\n        {footer}\n      </div>\n    )}\n  </Card>\n);\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-terminal.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-header.tsx",
      "content": "import { cn } from \"cn\";\n\nimport { CLAUDE_CODE_RESULT_GLYPH } from \"../constants/claude-code\";\nimport { renderClaudeCodeInline } from \"../lib/claude-code-inline\";\nimport type { ClaudeCodeHeaderProps } from \"../types/claude-code\";\nimport { ClaudeCodeLogo } from \"./claude-code-logo\";\n\nexport const ClaudeCodeHeader = ({\n  className,\n  cwd = \"~/\",\n  model,\n  org,\n  tips = [],\n  version = \"v2.1.0\",\n  whatsNew = [],\n  ...props\n}: ClaudeCodeHeaderProps) => {\n  const plan = [model, org].filter(Boolean).join(\" · \");\n  const hasNotices = whatsNew.length > 0 || tips.length > 0;\n\n  return (\n    <div\n      className={cn(\n        \"font-claude-code text-claude-code-fg flex min-w-0 flex-col gap-5 text-[0.8125rem] leading-5\",\n        className\n      )}\n      data-slot=\"claude-code-header\"\n      {...props}\n    >\n      <div className=\"flex min-w-0 items-center gap-[2ch]\">\n        <ClaudeCodeLogo className=\"text-claude-code-accent shrink-0\" />\n        <div className=\"flex min-w-0 flex-col\">\n          <p className=\"truncate\">\n            <span className=\"text-claude-code-strong font-bold\">\n              Claude Code\n            </span>{\" \"}\n            <span className=\"text-claude-code-muted\">{version}</span>\n          </p>\n          {plan && <p className=\"text-claude-code-muted truncate\">{plan}</p>}\n          {cwd && <p className=\"text-claude-code-muted truncate\">{cwd}</p>}\n        </div>\n      </div>\n      {hasNotices && (\n        <div className=\"flex min-w-0 flex-col pl-[2ch]\">\n          {whatsNew.map((line) => (\n            <p key={line}>{renderClaudeCodeInline(line)}</p>\n          ))}\n          {tips.map((line) => (\n            <p className=\"text-claude-code-muted flex gap-[2ch]\" key={line}>\n              <span aria-hidden=\"true\" className=\"shrink-0\">\n                {CLAUDE_CODE_RESULT_GLYPH}\n              </span>\n              <span className=\"min-w-0\">{renderClaudeCodeInline(line)}</span>\n            </p>\n          ))}\n        </div>\n      )}\n    </div>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-header.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-logo.tsx",
      "content": "import { useId } from \"react\";\n\nimport {\n  CLAUDE_CODE_MASCOT_BODY,\n  CLAUDE_CODE_MASCOT_EYES,\n  CLAUDE_CODE_MASCOT_SIZE,\n} from \"../constants/claude-code\";\nimport type { ClaudeCodeLogoProps } from \"../types/claude-code\";\n\nconst { height, width } = CLAUDE_CODE_MASCOT_SIZE;\n\nexport const ClaudeCodeLogo = ({\n  size = 76,\n  ...props\n}: ClaudeCodeLogoProps) => {\n  const maskId = useId();\n\n  return (\n    <svg\n      aria-hidden=\"true\"\n      fill=\"currentColor\"\n      height={(size * height) / width}\n      shapeRendering=\"crispEdges\"\n      viewBox={`0 0 ${width} ${height}`}\n      width={size}\n      xmlns=\"http://www.w3.org/2000/svg\"\n      {...props}\n    >\n      <mask id={maskId}>\n        {CLAUDE_CODE_MASCOT_BODY.map(([x, y, w, h]) => (\n          <rect\n            fill=\"white\"\n            height={h}\n            key={`${x}-${y}`}\n            width={w}\n            x={x}\n            y={y}\n          />\n        ))}\n        {CLAUDE_CODE_MASCOT_EYES.map(([x, y, w, h]) => (\n          <rect\n            fill=\"black\"\n            height={h}\n            key={`${x}-${y}`}\n            width={w}\n            x={x}\n            y={y}\n          />\n        ))}\n      </mask>\n      <rect height={height} mask={`url(#${maskId})`} width={width} />\n    </svg>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-logo.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-message.tsx",
      "content": "import { cn } from \"cn\";\n\nimport { renderClaudeCodeChildren } from \"../lib/claude-code-inline\";\nimport type { ClaudeCodeMessageProps } from \"../types/claude-code\";\n\nexport const ClaudeCodeMessage = ({\n  children,\n  className,\n  from = \"assistant\",\n  ...props\n}: ClaudeCodeMessageProps) => {\n  const isUser = from === \"user\";\n\n  return (\n    <div\n      className={cn(\n        \"font-claude-code grid min-w-0 grid-cols-[2ch_minmax(0,1fr)] text-[0.8125rem] leading-5\",\n        isUser\n          ? \"bg-claude-code-user-bg text-claude-code-strong\"\n          : \"text-claude-code-fg\",\n        className\n      )}\n      data-from={from}\n      data-slot=\"claude-code-message\"\n      {...props}\n    >\n      <span\n        aria-hidden=\"true\"\n        className={cn(\n          \"select-none\",\n          isUser ? \"text-claude-code-user-prompt\" : \"text-claude-code-strong\"\n        )}\n      >\n        {isUser ? \"❯\" : \"●\"}\n      </span>\n      <div className=\"min-w-0 break-words whitespace-pre-wrap\">\n        {renderClaudeCodeChildren(children)}\n      </div>\n    </div>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-message.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-thinking.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"cn\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\n\nimport type { ClaudeCodeThinkingProps } from \"../types/claude-code\";\n\nexport const ClaudeCodeThinking = ({\n  children,\n  className,\n  label = \"Thinking…\",\n  ...props\n}: ClaudeCodeThinkingProps) => (\n  <Collapsible\n    className={cn(\n      \"group/thinking font-claude-code text-claude-code-muted flex min-w-0 flex-col text-[0.8125rem] leading-5\",\n      className\n    )}\n    data-slot=\"claude-code-thinking\"\n    {...props}\n  >\n    <CollapsibleTrigger\n      render={\n        <Button\n          className=\"text-claude-code-muted hover:text-claude-code-muted aria-expanded:text-claude-code-muted focus-visible:ring-claude-code-muted/60 grid h-auto w-fit grid-cols-[2ch_auto] justify-start rounded-sm border-0 p-0 text-start text-[length:inherit] leading-[inherit] font-normal whitespace-normal italic hover:bg-transparent focus-visible:border-transparent focus-visible:ring-2 aria-expanded:bg-transparent dark:hover:bg-transparent\"\n          variant=\"ghost\"\n        />\n      }\n    >\n      <span aria-hidden=\"true\" className=\"not-italic\">\n        ∴\n      </span>\n      <span>\n        {label}\n        <span className=\"not-italic group-data-[open]/thinking:hidden\">\n          {\" \"}\n          (click to expand)\n        </span>\n      </span>\n    </CollapsibleTrigger>\n    <CollapsibleContent className=\"pl-[2ch] break-words whitespace-pre-wrap italic\">\n      {children}\n    </CollapsibleContent>\n  </Collapsible>\n);\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-thinking.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-todo-list.tsx",
      "content": "import { cn } from \"cn\";\n\nimport {\n  CLAUDE_CODE_RESULT_GLYPH,\n  CLAUDE_CODE_TODOS,\n} from \"../constants/claude-code\";\nimport type { ClaudeCodeTodoListProps } from \"../types/claude-code\";\n\nexport const ClaudeCodeTodoList = ({\n  className,\n  heading = \"Update Todos\",\n  todos,\n  ...props\n}: ClaudeCodeTodoListProps) => (\n  <div\n    className={cn(\n      \"font-claude-code text-claude-code-fg flex min-w-0 flex-col text-[0.8125rem] leading-5\",\n      className\n    )}\n    data-slot=\"claude-code-todo-list\"\n    {...props}\n  >\n    {heading !== null && (\n      <p className=\"grid grid-cols-[2ch_minmax(0,1fr)]\">\n        <span aria-hidden=\"true\" className=\"text-claude-code-success\">\n          ●\n        </span>\n        <span className=\"text-claude-code-strong font-bold\">{heading}</span>\n      </p>\n    )}\n    <ul className=\"flex min-w-0 flex-col pl-[2ch]\">\n      {todos.map((todo, index) => {\n        const config = CLAUDE_CODE_TODOS[todo.status];\n\n        return (\n          <li\n            className=\"grid grid-cols-[3ch_2ch_minmax(0,1fr)]\"\n            data-status={todo.status}\n            key={todo.label}\n          >\n            <span aria-hidden=\"true\" className=\"text-claude-code-muted\">\n              {index === 0 && heading !== null ? CLAUDE_CODE_RESULT_GLYPH : \"\"}\n            </span>\n            <span\n              aria-hidden=\"true\"\n              className={cn(\n                \"text-center\",\n                todo.status === \"done\"\n                  ? \"text-claude-code-muted\"\n                  : \"text-claude-code-fg\"\n              )}\n            >\n              {config.glyph}\n            </span>\n            <span className={cn(\"min-w-0 pl-[1ch]\", config.labelClassName)}>\n              <span className=\"sr-only\">{config.srLabel}: </span>\n              {todo.label}\n            </span>\n          </li>\n        );\n      })}\n    </ul>\n  </div>\n);\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-todo-list.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-tool-call.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"cn\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\n\nimport {\n  CLAUDE_CODE_RESULT_GLYPH,\n  CLAUDE_CODE_TOOL_CALLS,\n} from \"../constants/claude-code\";\nimport type {\n  ClaudeCodeToolCallProps,\n  ClaudeCodeToolSummaryProps,\n} from \"../types/claude-code\";\n\nconst ROW = \"grid min-w-0 grid-cols-[2ch_minmax(0,1fr)]\";\nconst RESULT_ROW = \"grid min-w-0 grid-cols-[3ch_minmax(0,1fr)] pl-[2ch]\";\n\nconst TRIGGER_CLASS =\n  \"text-claude-code-muted hover:text-claude-code-fg aria-expanded:text-claude-code-muted focus-visible:ring-claude-code-muted/60 h-auto justify-start rounded-sm border-0 p-0 text-start text-[length:inherit] leading-[inherit] font-normal whitespace-normal hover:bg-transparent focus-visible:border-transparent focus-visible:ring-2 aria-expanded:bg-transparent dark:hover:bg-transparent\";\n\nexport const ClaudeCodeToolCall = ({\n  arg,\n  children,\n  className,\n  result,\n  status = \"success\",\n  tool,\n  ...props\n}: ClaudeCodeToolCallProps) => {\n  const config = CLAUDE_CODE_TOOL_CALLS[status];\n  const hasDetail = Boolean(children);\n  const resultLine = (\n    <>\n      <span aria-hidden=\"true\">{CLAUDE_CODE_RESULT_GLYPH}</span>\n      <span className=\"min-w-0 break-words whitespace-pre-wrap\">\n        {result}\n        {hasDetail && (\n          <span className=\"group-data-[open]/tool:hidden\">\n            {\" \"}\n            (click to expand)\n          </span>\n        )}\n      </span>\n    </>\n  );\n\n  return (\n    <Collapsible\n      className={cn(\n        \"group/tool font-claude-code text-claude-code-fg flex min-w-0 flex-col text-[0.8125rem] leading-5\",\n        className\n      )}\n      data-slot=\"claude-code-tool-call\"\n      data-status={status}\n      {...props}\n    >\n      <p className={ROW}>\n        <span aria-hidden=\"true\" className={config.className}>\n          ●\n        </span>\n        <span className=\"min-w-0 break-words\">\n          <span className=\"sr-only\">{config.srLabel}: </span>\n          {arg === undefined ? (\n            tool\n          ) : (\n            <>\n              <span className=\"text-claude-code-strong font-bold\">{tool}</span>\n              <span>({arg})</span>\n            </>\n          )}\n        </span>\n      </p>\n      {hasDetail ? (\n        <CollapsibleTrigger\n          render={\n            <Button\n              className={cn(TRIGGER_CLASS, RESULT_ROW, \"w-full\")}\n              variant=\"ghost\"\n            />\n          }\n        >\n          {resultLine}\n        </CollapsibleTrigger>\n      ) : (\n        <p className={cn(RESULT_ROW, \"text-claude-code-muted\")}>{resultLine}</p>\n      )}\n      {hasDetail && (\n        <CollapsibleContent className=\"text-claude-code-muted pl-[5ch] break-words whitespace-pre-wrap\">\n          {children}\n        </CollapsibleContent>\n      )}\n    </Collapsible>\n  );\n};\n\nexport const ClaudeCodeToolSummary = ({\n  children,\n  className,\n  count,\n  noun = \"shell command\",\n  verb = \"Ran\",\n  ...props\n}: ClaudeCodeToolSummaryProps) => {\n  const label = count === 1 ? noun : `${noun}s`;\n  const summary = (\n    <>\n      {verb} <span className=\"font-bold\">{count}</span> {label}\n    </>\n  );\n\n  return (\n    <Collapsible\n      className={cn(\n        \"group/summary font-claude-code text-claude-code-muted flex min-w-0 flex-col gap-5 pl-[2ch] text-[0.8125rem] leading-5\",\n        className\n      )}\n      data-slot=\"claude-code-tool-summary\"\n      {...props}\n    >\n      {children ? (\n        <CollapsibleTrigger\n          render={\n            <Button className={cn(TRIGGER_CLASS, \"w-fit\")} variant=\"ghost\" />\n          }\n        >\n          {summary}\n          <span className=\"opacity-0 transition-opacity group-focus-within/summary:opacity-100 group-hover/summary:opacity-100 group-data-[open]/summary:hidden\">\n            {\" \"}\n            (click to expand)\n          </span>\n        </CollapsibleTrigger>\n      ) : (\n        <p>{summary}</p>\n      )}\n      {children && (\n        <CollapsibleContent className=\"-ml-[2ch] flex flex-col gap-5\">\n          {children}\n        </CollapsibleContent>\n      )}\n    </Collapsible>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-tool-call.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-status.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"cn\";\nimport { useEffect, useState } from \"react\";\n\nimport {\n  CLAUDE_CODE_RESULT_GLYPH,\n  CLAUDE_CODE_SPINNER_FRAMES,\n  CLAUDE_CODE_SPINNER_INTERVAL_MS,\n} from \"../constants/claude-code\";\nimport { renderClaudeCodeInline } from \"../lib/claude-code-inline\";\nimport type {\n  ClaudeCodeInterruptedProps,\n  ClaudeCodeSpinnerProps,\n  ClaudeCodeTurnSummaryProps,\n} from \"../types/claude-code\";\n\nconst FRAME_CYCLE = [\n  ...CLAUDE_CODE_SPINNER_FRAMES,\n  ...CLAUDE_CODE_SPINNER_FRAMES.slice(1, -1).reverse(),\n];\n\nconst REDUCED_MOTION_QUERY = \"(prefers-reduced-motion: reduce)\";\n\nconst useSpinnerFrame = (paused: boolean) => {\n  const [frame, setFrame] = useState(0);\n\n  useEffect(() => {\n    if (paused || window.matchMedia(REDUCED_MOTION_QUERY).matches) {\n      return;\n    }\n    const id = window.setInterval(() => {\n      setFrame((current) => (current + 1) % FRAME_CYCLE.length);\n    }, CLAUDE_CODE_SPINNER_INTERVAL_MS);\n    return () => window.clearInterval(id);\n  }, [paused]);\n\n  return FRAME_CYCLE[frame];\n};\n\nconst formatTokens = (tokens: number) =>\n  `↓ ${tokens.toLocaleString(\"en-US\")} tokens`;\n\nexport const ClaudeCodeSpinner = ({\n  className,\n  details = [],\n  elapsed,\n  paused = false,\n  tip,\n  tokens,\n  verb = \"Thinking\",\n  ...props\n}: ClaudeCodeSpinnerProps) => {\n  const glyph = useSpinnerFrame(paused);\n  const meta = [\n    elapsed,\n    tokens === undefined ? undefined : formatTokens(tokens),\n    ...details,\n  ].filter(Boolean);\n\n  return (\n    <div\n      className={cn(\n        \"font-claude-code text-claude-code-muted flex min-w-0 flex-col text-[0.8125rem] leading-5\",\n        className\n      )}\n      data-slot=\"claude-code-spinner\"\n      role=\"status\"\n      {...props}\n    >\n      <p className=\"grid grid-cols-[2ch_minmax(0,1fr)]\">\n        <span aria-hidden=\"true\" className=\"text-claude-code-accent\">\n          {glyph}\n        </span>\n        <span className=\"min-w-0\">\n          <span className=\"text-claude-code-accent\">{verb}…</span>\n          {meta.length > 0 && <> ({meta.join(\" · \")})</>}\n        </span>\n      </p>\n      {tip && (\n        <p className=\"grid grid-cols-[3ch_minmax(0,1fr)] pl-[2ch]\">\n          <span aria-hidden=\"true\">{CLAUDE_CODE_RESULT_GLYPH}</span>\n          <span className=\"min-w-0\">{renderClaudeCodeInline(tip)}</span>\n        </p>\n      )}\n    </div>\n  );\n};\n\nexport const ClaudeCodeTurnSummary = ({\n  className,\n  doneAt,\n  duration,\n  verb = \"Worked\",\n  ...props\n}: ClaudeCodeTurnSummaryProps) => (\n  <p\n    className={cn(\n      \"font-claude-code text-claude-code-muted grid min-w-0 grid-cols-[2ch_minmax(0,1fr)] text-[0.8125rem] leading-5\",\n      className\n    )}\n    data-slot=\"claude-code-turn-summary\"\n    {...props}\n  >\n    <span aria-hidden=\"true\">✻</span>\n    <span className=\"min-w-0\">\n      {verb} for {duration}\n      {doneAt && <> · done {doneAt}</>}\n    </span>\n  </p>\n);\n\nexport const ClaudeCodeInterrupted = ({\n  className,\n  hint = \"What should Claude do instead?\",\n  ...props\n}: ClaudeCodeInterruptedProps) => (\n  <p\n    className={cn(\n      \"font-claude-code text-claude-code-muted grid min-w-0 grid-cols-[3ch_minmax(0,1fr)] pl-[2ch] text-[0.8125rem] leading-5\",\n      className\n    )}\n    data-slot=\"claude-code-interrupted\"\n    role=\"status\"\n    {...props}\n  >\n    <span aria-hidden=\"true\">{CLAUDE_CODE_RESULT_GLYPH}</span>\n    <span className=\"min-w-0\">\n      <span className=\"text-claude-code-error\">Interrupted</span>\n      {hint && <> · {hint}</>}\n    </span>\n  </p>\n);\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-status.tsx"
    },
    {
      "path": "registry/notra/claude-code/components/claude-code-prompt.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"cn\";\nimport { useState } from \"react\";\nimport type { ChangeEvent, FormEvent, KeyboardEvent } from \"react\";\n\nimport {\n  InputGroup,\n  InputGroupAddon,\n  InputGroupInput,\n} from \"@/components/ui/input-group\";\nimport { Kbd } from \"@/components/ui/kbd\";\n\nimport {\n  CLAUDE_CODE_EFFORTS,\n  CLAUDE_CODE_MODES,\n} from \"../constants/claude-code\";\nimport type { ClaudeCodePromptProps } from \"../types/claude-code\";\n\nconst KBD_CLASS =\n  \"font-claude-code text-claude-code-muted inline h-auto min-w-0 rounded-none bg-transparent p-0 text-[length:inherit] leading-[inherit] font-normal select-auto\";\n\nexport const ClaudeCodePrompt = ({\n  busy = false,\n  className,\n  defaultValue = \"\",\n  effort = false,\n  inputClassName,\n  inputRef,\n  mode = \"manual\",\n  onChange,\n  onKeyDown,\n  onSend,\n  onStop,\n  placeholder,\n  pullRequest,\n  value,\n  ...props\n}: ClaudeCodePromptProps) => {\n  const [draft, setDraft] = useState(defaultValue);\n  const isControlled = value !== undefined;\n  const text = isControlled ? value : draft;\n  const isEmpty = text === \"\";\n  const modeConfig = CLAUDE_CODE_MODES[mode];\n  const effortConfig = effort ? CLAUDE_CODE_EFFORTS[effort] : undefined;\n\n  const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n    if (!isControlled) {\n      setDraft(event.target.value);\n    }\n    onChange?.(event);\n  };\n\n  const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n    if (event.key === \"Escape\" && busy && onStop) {\n      event.preventDefault();\n      onStop();\n    }\n    onKeyDown?.(event);\n  };\n\n  const handleSubmit = (event: FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    const message = text.trim();\n    if (!message || busy || !onSend) {\n      return;\n    }\n    onSend(message);\n    if (!isControlled) {\n      setDraft(\"\");\n    }\n  };\n\n  return (\n    <form\n      className={cn(\n        \"font-claude-code text-claude-code-fg flex min-w-0 flex-col gap-5 text-[0.8125rem] leading-5\",\n        className\n      )}\n      data-slot=\"claude-code-prompt\"\n      onSubmit={handleSubmit}\n      {...props}\n    >\n      <InputGroup className=\"border-claude-code-rule has-[[data-slot=input-group-control]:focus-visible]:border-claude-code-rule grid h-auto min-w-0 grid-cols-[2ch_minmax(0,1fr)] items-stretch rounded-none border-0 border-y bg-transparent py-1.5 has-[[data-slot=input-group-control]:focus-visible]:ring-0 dark:bg-transparent\">\n        <InputGroupAddon className=\"text-claude-code-strong order-none cursor-text justify-start p-0 text-[length:inherit] leading-[inherit] font-normal\">\n          <span aria-hidden=\"true\">❯</span>\n        </InputGroupAddon>\n        <span className=\"relative flex min-w-0\">\n          <InputGroupInput\n            aria-label=\"Message Claude Code\"\n            autoComplete=\"off\"\n            className={cn(\n              \"font-claude-code text-claude-code-strong placeholder:text-claude-code-muted caret-claude-code-strong h-auto p-0 text-[length:inherit] leading-[inherit] transition-none md:text-[length:inherit]\",\n              isEmpty && \"caret-transparent\",\n              inputClassName\n            )}\n            enterKeyHint=\"send\"\n            onChange={handleChange}\n            onKeyDown={handleKeyDown}\n            placeholder={placeholder}\n            ref={inputRef}\n            spellCheck={false}\n            type=\"text\"\n            value={text}\n          />\n          {isEmpty && (\n            <span\n              aria-hidden=\"true\"\n              className=\"pointer-events-none absolute inset-y-0 left-0 w-[1ch] bg-white mix-blend-difference\"\n            />\n          )}\n        </span>\n      </InputGroup>\n      <div className=\"flex min-w-0 flex-wrap items-baseline justify-between gap-x-[2ch] pl-[2ch]\">\n        <p className=\"text-claude-code-muted min-w-0\">\n          <span className={modeConfig.className}>{modeConfig.label}</span>\n          {modeConfig.cycles && (\n            <>\n              {\" (\"}\n              <Kbd className={KBD_CLASS}>shift+tab</Kbd>\n              {\" to cycle)\"}\n            </>\n          )}\n          {pullRequest && (\n            <>\n              {\" · PR \"}\n              <a\n                className=\"text-claude-code-pr underline underline-offset-2\"\n                href={pullRequest.href ?? \"#\"}\n              >\n                #{pullRequest.number}\n              </a>\n            </>\n          )}\n        </p>\n        {effortConfig && (\n          <p className={cn(\"shrink-0\", effortConfig.className)}>\n            {effortConfig.glyph} {effort} · /effort\n          </p>\n        )}\n      </div>\n    </form>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/claude-code/components/claude-code-prompt.tsx"
    },
    {
      "path": "registry/notra/claude-code/types/claude-code.ts",
      "content": "import type {\n  ChangeEventHandler,\n  ComponentProps,\n  KeyboardEventHandler,\n  ReactNode,\n  Ref,\n} from \"react\";\n\nimport type { Card } from \"@/components/ui/card\";\nimport type { Collapsible } from \"@/components/ui/collapsible\";\n\nexport type ClaudeCodeMode =\n  | \"auto\"\n  | \"manual\"\n  | \"accept-edits\"\n  | \"plan\"\n  | \"bypass\";\n\nexport type ClaudeCodeEffort =\n  | \"low\"\n  | \"medium\"\n  | \"high\"\n  | \"xhigh\"\n  | \"max\"\n  | \"ultracode\";\n\nexport type ClaudeCodeTodoStatus = \"done\" | \"active\" | \"todo\";\n\nexport type ClaudeCodeToolCallStatus = \"success\" | \"error\" | \"pending\";\n\nexport interface ClaudeCodeModeConfig {\n  className: string;\n  /** Whether the status line shows the shift+tab hint. */\n  cycles: boolean;\n  label: string;\n}\n\nexport interface ClaudeCodeEffortConfig {\n  className: string;\n  glyph: string;\n}\n\nexport interface ClaudeCodeTodoConfig {\n  glyph: string;\n  labelClassName: string;\n  srLabel: string;\n}\n\nexport interface ClaudeCodeToolCallConfig {\n  className: string;\n  srLabel: string;\n}\n\nexport interface ClaudeCodeTodo {\n  label: string;\n  status: ClaudeCodeTodoStatus;\n}\n\nexport interface ClaudeCodePullRequest {\n  href?: string;\n  number: number;\n}\n\nexport interface ClaudeCodeTerminalProps extends Omit<\n  ComponentProps<typeof Card>,\n  \"title\"\n> {\n  contentClassName?: string;\n  /** Pinned under the scrolling transcript, like Claude Code's prompt. */\n  footer?: ReactNode;\n  title?: ReactNode;\n}\n\nexport interface ClaudeCodeLogoProps extends ComponentProps<\"svg\"> {\n  size?: number;\n}\n\nexport interface ClaudeCodeHeaderProps extends ComponentProps<\"div\"> {\n  cwd?: string;\n  model?: string;\n  org?: string;\n  /** Dim `⎿` lines under the notices, like hook output or tips. */\n  tips?: string[];\n  version?: string;\n  /** Notice lines printed under the header. Supports `code` and **bold**. */\n  whatsNew?: string[];\n}\n\nexport interface ClaudeCodeMessageProps extends ComponentProps<\"div\"> {\n  from?: \"user\" | \"assistant\";\n}\n\nexport interface ClaudeCodeThinkingProps extends Omit<\n  ComponentProps<typeof Collapsible>,\n  \"children\"\n> {\n  children?: ReactNode;\n  label?: ReactNode;\n}\n\nexport interface ClaudeCodeSpinnerProps extends ComponentProps<\"div\"> {\n  /** Extra fields in the parentheses, like `thinking`. */\n  details?: string[];\n  elapsed?: string;\n  /** Freeze the glyph, for screenshots and reduced motion. */\n  paused?: boolean;\n  tip?: string;\n  tokens?: number;\n  verb?: string;\n}\n\nexport interface ClaudeCodeTurnSummaryProps extends ComponentProps<\"div\"> {\n  doneAt?: string;\n  duration: string;\n  verb?: string;\n}\n\nexport interface ClaudeCodeInterruptedProps extends ComponentProps<\"p\"> {\n  /** Shown after `Interrupted ·`. */\n  hint?: ReactNode;\n}\n\nexport interface ClaudeCodeTodoListProps extends ComponentProps<\"div\"> {\n  /** The tool line above the list. Pass `null` to leave it out. */\n  heading?: string | null;\n  todos: ClaudeCodeTodo[];\n}\n\nexport interface ClaudeCodeToolCallProps extends Omit<\n  ComponentProps<typeof Collapsible>,\n  \"children\"\n> {\n  arg?: string;\n  children?: ReactNode;\n  result: ReactNode;\n  status?: ClaudeCodeToolCallStatus;\n  tool: string;\n}\n\nexport interface ClaudeCodeToolSummaryProps extends Omit<\n  ComponentProps<typeof Collapsible>,\n  \"children\"\n> {\n  children?: ReactNode;\n  count: number;\n  noun?: string;\n  verb?: string;\n}\n\nexport interface ClaudeCodePromptProps extends Omit<\n  ComponentProps<\"form\">,\n  \"defaultValue\" | \"onChange\" | \"onKeyDown\" | \"onSubmit\"\n> {\n  /** A turn is running: Enter does not send and Escape calls `onStop`. */\n  busy?: boolean;\n  defaultValue?: string;\n  effort?: ClaudeCodeEffort | false;\n  inputClassName?: string;\n  inputRef?: Ref<HTMLInputElement>;\n  mode?: ClaudeCodeMode;\n  onChange?: ChangeEventHandler<HTMLInputElement>;\n  onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n  /**\n   * Called with the trimmed text on Enter. An uncontrolled prompt clears\n   * afterwards; with `value`, clear it yourself here.\n   */\n  onSend?: (text: string) => void;\n  /** Called on Escape while `busy`, to interrupt the running turn. */\n  onStop?: () => void;\n  placeholder?: string;\n  pullRequest?: ClaudeCodePullRequest;\n  value?: string;\n}\n\nexport interface ClaudeCodeSessionHeader {\n  cwd: string;\n  model: string;\n  org: string;\n  tips: string[];\n  version: string;\n  whatsNew: string[];\n}\n\nexport interface ClaudeCodeSessionToolCall {\n  arg?: string;\n  detail?: string;\n  id: string;\n  result: string;\n  status?: ClaudeCodeToolCallStatus;\n  tool: string;\n}\n\nexport interface ClaudeCodeSessionSpinner {\n  details: string[];\n  elapsed: string;\n  tip: string;\n  tokens: number;\n  verb: string;\n}\n\nexport interface ClaudeCodeSessionTurn {\n  answer: string;\n  commands: ClaudeCodeSessionToolCall[];\n  id: string;\n  prompt: string;\n  summary: ClaudeCodeSessionSummary;\n  thinking?: string;\n  todos?: ClaudeCodeTodo[];\n}\n\nexport interface ClaudeCodeSessionSummary {\n  doneAt: string;\n  duration: string;\n  verb: string;\n}\n\nexport type ClaudeCodeTurnStatus =\n  | \"working\"\n  | \"streaming\"\n  | \"done\"\n  | \"interrupted\";\n\n/** A scripted answer the demo plays back when you send a prompt. */\nexport interface ClaudeCodeReply {\n  answer: string;\n  commands: ClaudeCodeSessionToolCall[];\n  /** The spinner verb while the turn runs, like `Sketching`. */\n  spinnerVerb: string;\n  /** The verb on the summary line once the turn is done, like `Cooked`. */\n  summaryVerb: string;\n}\n\nexport interface ClaudeCodeChatTurn extends Omit<\n  ClaudeCodeSessionTurn,\n  \"summary\"\n> {\n  status: ClaudeCodeTurnStatus;\n  summary?: ClaudeCodeSessionSummary;\n}\n\nexport interface ClaudeCodeChat {\n  busy: boolean;\n  /** Whole seconds since the running turn started. */\n  elapsed: number;\n  send: (text: string) => Promise<void>;\n  spinnerVerb: string;\n  stop: () => void;\n  /** Tokens streamed in the running turn so far. */\n  tokens: number;\n  turns: ClaudeCodeChatTurn[];\n}\n\nexport interface ClaudeCodeSessionPendingTurn {\n  prompt: string;\n  spinner: ClaudeCodeSessionSpinner;\n  todos: ClaudeCodeTodo[];\n  toolCall: ClaudeCodeSessionToolCall;\n}\n\nexport interface ClaudeCodeSession {\n  header: ClaudeCodeSessionHeader;\n  pending: ClaudeCodeSessionPendingTurn;\n  promptPlaceholder: string;\n  pullRequest: ClaudeCodePullRequest;\n  title: string;\n  turns: ClaudeCodeSessionTurn[];\n}\n",
      "type": "registry:lib",
      "target": "components/claude-code/types/claude-code.ts"
    },
    {
      "path": "registry/notra/claude-code/constants/claude-code.ts",
      "content": "import type {\n  ClaudeCodeEffort,\n  ClaudeCodeEffortConfig,\n  ClaudeCodeMode,\n  ClaudeCodeModeConfig,\n  ClaudeCodeTodoConfig,\n  ClaudeCodeTodoStatus,\n  ClaudeCodeToolCallConfig,\n  ClaudeCodeToolCallStatus,\n} from \"../types/claude-code\";\n\nexport const CLAUDE_CODE_MODE_ORDER: ClaudeCodeMode[] = [\n  \"manual\",\n  \"accept-edits\",\n  \"plan\",\n  \"auto\",\n  \"bypass\",\n];\n\nexport const CLAUDE_CODE_EFFORT_ORDER: ClaudeCodeEffort[] = [\n  \"low\",\n  \"medium\",\n  \"high\",\n  \"xhigh\",\n  \"max\",\n  \"ultracode\",\n];\n\nexport const CLAUDE_CODE_MODES: Record<ClaudeCodeMode, ClaudeCodeModeConfig> = {\n  \"accept-edits\": {\n    className: \"text-claude-code-mode-accept-edits\",\n    cycles: true,\n    label: \"⏵⏵ accept edits on\",\n  },\n  auto: {\n    className: \"text-claude-code-mode-auto\",\n    cycles: true,\n    label: \"⏵⏵ auto mode on\",\n  },\n  bypass: {\n    className: \"text-claude-code-mode-bypass\",\n    cycles: true,\n    label: \"⏵⏵ bypass permissions on\",\n  },\n  manual: {\n    className: \"text-claude-code-muted\",\n    cycles: false,\n    label: \"? for shortcuts\",\n  },\n  plan: {\n    className: \"text-claude-code-mode-plan\",\n    cycles: true,\n    label: \"⏸ plan mode on\",\n  },\n};\n\nexport const CLAUDE_CODE_EFFORTS: Record<\n  ClaudeCodeEffort,\n  ClaudeCodeEffortConfig\n> = {\n  high: { className: \"text-claude-code-muted\", glyph: \"◕\" },\n  low: { className: \"text-claude-code-muted\", glyph: \"○\" },\n  max: { className: \"text-claude-code-muted\", glyph: \"●\" },\n  medium: { className: \"text-claude-code-muted\", glyph: \"◑\" },\n  ultracode: { className: \"text-claude-code-accent\", glyph: \"✦\" },\n  xhigh: { className: \"text-claude-code-muted\", glyph: \"◉\" },\n};\n\nexport const CLAUDE_CODE_TODOS: Record<\n  ClaudeCodeTodoStatus,\n  ClaudeCodeTodoConfig\n> = {\n  active: {\n    glyph: \"☐\",\n    labelClassName: \"text-claude-code-strong font-bold\",\n    srLabel: \"In progress\",\n  },\n  done: {\n    glyph: \"☒\",\n    labelClassName: \"text-claude-code-muted line-through\",\n    srLabel: \"Done\",\n  },\n  todo: {\n    glyph: \"☐\",\n    labelClassName: \"text-claude-code-fg\",\n    srLabel: \"To do\",\n  },\n};\n\nexport const CLAUDE_CODE_TOOL_CALLS: Record<\n  ClaudeCodeToolCallStatus,\n  ClaudeCodeToolCallConfig\n> = {\n  error: { className: \"text-claude-code-error\", srLabel: \"Failed\" },\n  pending: {\n    className:\n      \"text-claude-code-muted animate-pulse motion-reduce:animate-none\",\n    srLabel: \"Running\",\n  },\n  success: { className: \"text-claude-code-success\", srLabel: \"Done\" },\n};\n\nexport const CLAUDE_CODE_SPINNER_FRAMES = [\"·\", \"✢\", \"✳\", \"✶\", \"✻\", \"✽\"];\n\nexport const CLAUDE_CODE_SPINNER_INTERVAL_MS = 120;\n\nexport const CLAUDE_CODE_RESULT_GLYPH = \"⎿\";\n\nexport const CLAUDE_CODE_CHAT_TIMING = {\n  thinkMs: 1200,\n  toolMs: 900,\n  wordMs: 28,\n  reducedMaxMs: 60,\n  tickMs: 1000,\n} as const;\n\nexport const CLAUDE_CODE_MASCOT_SIZE = { height: 14, width: 22 };\n\nexport const CLAUDE_CODE_MASCOT_BODY: [number, number, number, number][] = [\n  [2, 0, 18, 10],\n  [0, 4, 22, 3],\n  [3, 10, 2, 4],\n  [7, 10, 2, 4],\n  [13, 10, 2, 4],\n  [17, 10, 2, 4],\n];\n\nexport const CLAUDE_CODE_MASCOT_EYES: [number, number, number, number][] = [\n  [6, 2, 2, 3],\n  [14, 2, 2, 3],\n];\n",
      "type": "registry:lib",
      "target": "components/claude-code/constants/claude-code.ts"
    },
    {
      "path": "registry/notra/claude-code/constants/claude-code-session.ts",
      "content": "import type { ClaudeCodeReply, ClaudeCodeSession } from \"../types/claude-code\";\n\nexport const CLAUDE_CODE_SESSION: ClaudeCodeSession = {\n  header: {\n    cwd: \"~/acme/web\",\n    model: \"Opus 5.5 (1M context)\",\n    org: \"Claude Max\",\n    tips: [\n      \"SessionStart:startup hook succeeded\",\n      \"notra MCP server connected · 24 tools\",\n    ],\n    version: \"v2.1.285\",\n    whatsNew: [\n      \"Get to finished work sooner with Opus 5.5. Switch anytime with `/model`.\",\n    ],\n  },\n  pending: {\n    prompt: \"draft the changelog for v1.9 and queue it in notra\",\n    spinner: {\n      details: [\"thinking\"],\n      elapsed: \"14s\",\n      tip: \"Tip: Run `/resume` to pick up an earlier conversation\",\n      tokens: 688,\n      verb: \"Sketching\",\n    },\n    todos: [\n      { label: \"Group the 14 merged PRs by area\", status: \"done\" },\n      { label: \"Draft the changelog in brand voice\", status: \"active\" },\n      { label: \"Queue the post in notra\", status: \"todo\" },\n    ],\n    toolCall: {\n      id: \"brand-voice\",\n      result:\n        \"$ notra brand voice --json && notra posts list --type changelog --limit 3\",\n      status: \"pending\",\n      tool: \"Checking brand voice and the last changelogs\",\n    },\n  },\n  promptPlaceholder: 'Try \"write a LinkedIn post about the release\"',\n  pullRequest: { number: 1317 },\n  title: \"claude — ~/acme/web\",\n  turns: [\n    {\n      answer:\n        \"Since **v1.8.0** there are 14 merged PRs on `main`, split across three areas.\\n\\n`apps/dashboard` got the new **GEO scan** view with per-engine citations, `packages/api` added `POST /v1/posts/:id/schedule`, and `apps/web` moved the changelog to `/changelog/[slug]`. Two PRs are fixes from review.\\n\\nWant me to draft the changelog for v1.9 from these?\",\n      commands: [\n        {\n          arg: \"git log --oneline v1.8.0..HEAD\",\n          id: \"git-log\",\n          result: \"14 commits\",\n          tool: \"Bash\",\n        },\n      ],\n      id: \"what-changed\",\n      prompt: \"what changed since the last release?\",\n      summary: { doneAt: \"9:41 AM\", duration: \"7s\", verb: \"Cogitated\" },\n    },\n    {\n      answer:\n        \"Drafted **v1.9** in your brand voice and queued it in Notra for Thursday 9:00 AM. The post groups the 14 PRs into features and fixes and links each one.\\n\\nOpen it with `notra posts open changelog-v1-9` to review before it goes out.\",\n      commands: [\n        {\n          arg: \"type: changelog, voice: acme\",\n          id: \"brand-voice\",\n          result: \"Loaded brand voice and the last 3 changelogs\",\n          tool: \"notra - get_brand_voice (MCP)\",\n        },\n        {\n          arg: \"title: v1.9, schedule: thu 09:00\",\n          id: \"queue-post\",\n          result: \"Queued changelog-v1-9\",\n          tool: \"notra - create_post (MCP)\",\n        },\n      ],\n      id: \"draft-changelog\",\n      prompt: \"draft the changelog for v1.9 and queue it in notra\",\n      summary: { doneAt: \"9:43 AM\", duration: \"38s\", verb: \"Brewed\" },\n      todos: [\n        { label: \"Group the 14 merged PRs by area\", status: \"done\" },\n        { label: \"Draft the changelog in brand voice\", status: \"done\" },\n        { label: \"Queue the post in notra\", status: \"done\" },\n      ],\n    },\n  ],\n};\n\nexport const CLAUDE_CODE_REPLIES: ClaudeCodeReply[] = [\n  {\n    answer:\n      \"Here's a LinkedIn post for the release:\\n\\n**Acme v1.9 is out.** Track which AI engines cite you with the new GEO scan view, schedule posts straight from the API, and find every release at `/changelog`.\\n\\nSaved it as a draft next to the changelog. Want a shorter version for X?\",\n    commands: [\n      {\n        arg: \"id: changelog-v1-9\",\n        id: \"get-post\",\n        result: \"Read changelog-v1-9 (412 words)\",\n        tool: \"notra - get_post (MCP)\",\n      },\n      {\n        arg: \"type: linkedin, source: changelog-v1-9\",\n        id: \"create-linkedin\",\n        result: \"Created linkedin-v1-9 as a draft\",\n        tool: \"notra - create_post (MCP)\",\n      },\n    ],\n    spinnerVerb: \"Crafting\",\n    summaryVerb: \"Crafted\",\n  },\n  {\n    answer:\n      \"The scheduler fix is in `packages/api/src/jobs/publish.ts`. Failed publish jobs now retry three times with backoff before they surface in the dashboard.\\n\\nThe tests in `publish.test.ts` cover both the retry and the final failure.\",\n    commands: [\n      {\n        arg: 'pattern: \"retry\", path: packages/api',\n        id: \"grep-retry\",\n        result: \"Found 4 files\",\n        tool: \"Search\",\n      },\n      {\n        arg: \"packages/api/src/jobs/publish.ts\",\n        id: \"read-publish\",\n        result: \"Read 86 lines\",\n        tool: \"Read\",\n      },\n    ],\n    spinnerVerb: \"Spelunking\",\n    summaryVerb: \"Worked\",\n  },\n  {\n    answer:\n      \"All 212 tests pass and the build is clean. Nothing else is blocking **v1.9**.\",\n    commands: [\n      {\n        arg: \"bun run test\",\n        id: \"run-tests\",\n        result: \"212 passed\",\n        tool: \"Bash\",\n      },\n    ],\n    spinnerVerb: \"Verifying\",\n    summaryVerb: \"Cogitated\",\n  },\n];\n",
      "type": "registry:lib",
      "target": "components/claude-code/constants/claude-code-session.ts"
    },
    {
      "path": "registry/notra/claude-code/lib/claude-code-inline.tsx",
      "content": "import type { ReactNode } from \"react\";\n\nconst INLINE_TOKEN = /(`[^`]+`|\\*\\*[^*]+\\*\\*)/g;\n\nexport const renderClaudeCodeInline = (text: string): ReactNode[] => {\n  let offset = 0;\n\n  return text.split(INLINE_TOKEN).map((part) => {\n    const key = `${offset}-${part}`;\n    offset += part.length;\n\n    if (part.length > 2 && part.startsWith(\"`\") && part.endsWith(\"`\")) {\n      return (\n        <code className=\"text-claude-code-link font-claude-code\" key={key}>\n          {part.slice(1, -1)}\n        </code>\n      );\n    }\n\n    if (part.length > 4 && part.startsWith(\"**\") && part.endsWith(\"**\")) {\n      return (\n        <strong className=\"text-claude-code-strong font-bold\" key={key}>\n          {part.slice(2, -2)}\n        </strong>\n      );\n    }\n\n    return part;\n  });\n};\n\nexport const renderClaudeCodeChildren = (children: ReactNode): ReactNode =>\n  typeof children === \"string\" ? renderClaudeCodeInline(children) : children;\n",
      "type": "registry:lib",
      "target": "components/claude-code/lib/claude-code-inline.tsx"
    },
    {
      "path": "registry/notra/claude-code/hooks/use-claude-code-chat.ts",
      "content": "\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { CLAUDE_CODE_CHAT_TIMING } from \"../constants/claude-code\";\nimport type {\n  ClaudeCodeChat,\n  ClaudeCodeChatTurn,\n  ClaudeCodeReply,\n  ClaudeCodeSessionTurn,\n} from \"../types/claude-code\";\n\nconst WORD_PATTERN = /(\\s+)/;\n\nconst REDUCED_MOTION_QUERY = \"(prefers-reduced-motion: reduce)\";\n\nconst CHARS_PER_TOKEN = 4;\n\nconst wait = (ms: number) =>\n  new Promise<void>((resolve) => {\n    window.setTimeout(resolve, ms);\n  });\n\nconst formatClock = (date: Date) =>\n  date.toLocaleTimeString(\"en-US\", { hour: \"numeric\", minute: \"2-digit\" });\n\nconst settle = (turn: ClaudeCodeSessionTurn): ClaudeCodeChatTurn => ({\n  ...turn,\n  status: \"done\",\n});\n\nexport const useClaudeCodeChat = (\n  history: readonly ClaudeCodeSessionTurn[],\n  replies: readonly ClaudeCodeReply[]\n): ClaudeCodeChat => {\n  const [turns, setTurns] = useState<ClaudeCodeChatTurn[]>(() =>\n    history.map(settle)\n  );\n  const [activeId, setActiveId] = useState<string | null>(null);\n  const [spinnerVerb, setSpinnerVerb] = useState(\"\");\n  const [startedAt, setStartedAt] = useState(0);\n  const [now, setNow] = useState(0);\n  const [streamed, setStreamed] = useState(0);\n  const runRef = useRef(0);\n  const activeRef = useRef<string | null>(null);\n  const replyRef = useRef(0);\n\n  useEffect(() => {\n    if (!activeId) {\n      return;\n    }\n    const timer = window.setInterval(() => {\n      setNow(Date.now());\n    }, CLAUDE_CODE_CHAT_TIMING.tickMs);\n    return () => window.clearInterval(timer);\n  }, [activeId]);\n\n  useEffect(\n    () => () => {\n      runRef.current += 1;\n    },\n    []\n  );\n\n  const patch = useCallback(\n    (\n      id: string,\n      next: (turn: ClaudeCodeChatTurn) => Partial<ClaudeCodeChatTurn>\n    ) => {\n      setTurns((current) =>\n        current.map((turn) =>\n          turn.id === id ? { ...turn, ...next(turn) } : turn\n        )\n      );\n    },\n    []\n  );\n\n  const finish = useCallback(() => {\n    activeRef.current = null;\n    setActiveId(null);\n  }, []);\n\n  const stop = useCallback(() => {\n    const id = activeRef.current;\n    if (!id) {\n      return;\n    }\n    runRef.current += 1;\n    patch(id, (turn) => ({\n      commands: turn.commands.filter((command) => command.status !== \"pending\"),\n      status: \"interrupted\",\n    }));\n    finish();\n  }, [finish, patch]);\n\n  const send = useCallback(\n    async (text: string) => {\n      const reply = replies[replyRef.current % replies.length];\n      if (activeRef.current || !reply) {\n        return;\n      }\n      replyRef.current += 1;\n      const run = runRef.current + 1;\n      runRef.current = run;\n      const alive = () => runRef.current === run;\n      const reduced = window.matchMedia(REDUCED_MOTION_QUERY).matches;\n      const delay = (ms: number) =>\n        wait(reduced ? Math.min(ms, CLAUDE_CODE_CHAT_TIMING.reducedMaxMs) : ms);\n      const start = Date.now();\n      const id = `turn-${start}`;\n\n      activeRef.current = id;\n      setActiveId(id);\n      setStartedAt(start);\n      setNow(start);\n      setStreamed(0);\n      setSpinnerVerb(reply.spinnerVerb);\n      setTurns((current) => [\n        ...current,\n        { answer: \"\", commands: [], id, prompt: text, status: \"working\" },\n      ]);\n\n      await delay(CLAUDE_CODE_CHAT_TIMING.thinkMs);\n\n      for (const command of reply.commands) {\n        if (!alive()) {\n          return;\n        }\n        const commandId = `${id}-${command.id}`;\n        patch(id, (turn) => ({\n          commands: [\n            ...turn.commands,\n            { ...command, id: commandId, status: \"pending\" },\n          ],\n        }));\n        // react-doctor-disable-next-line react-doctor/async-await-in-loop -- tool calls run one after another\n        await delay(CLAUDE_CODE_CHAT_TIMING.toolMs);\n        if (!alive()) {\n          return;\n        }\n        patch(id, (turn) => ({\n          commands: turn.commands.map((item) =>\n            item.id === commandId\n              ? { ...item, status: command.status ?? \"success\" }\n              : item\n          ),\n        }));\n      }\n\n      if (!alive()) {\n        return;\n      }\n      patch(id, () => ({ status: \"streaming\" }));\n\n      let answer = \"\";\n      const words = reduced ? [reply.answer] : reply.answer.split(WORD_PATTERN);\n      for (const word of words) {\n        if (!alive()) {\n          return;\n        }\n        answer += word;\n        const snapshot = answer;\n        patch(id, () => ({ answer: snapshot }));\n        setStreamed(snapshot.length);\n        // react-doctor-disable-next-line react-doctor/async-await-in-loop -- words stream in order\n        await delay(CLAUDE_CODE_CHAT_TIMING.wordMs);\n      }\n\n      if (!alive()) {\n        return;\n      }\n      const seconds = Math.max(1, Math.round((Date.now() - start) / 1000));\n      patch(id, () => ({\n        status: \"done\",\n        summary: {\n          doneAt: formatClock(new Date()),\n          duration: `${seconds}s`,\n          verb: reply.summaryVerb,\n        },\n      }));\n      finish();\n    },\n    [finish, patch, replies]\n  );\n\n  return {\n    busy: activeId !== null,\n    elapsed: Math.max(0, Math.floor((now - startedAt) / 1000)),\n    send,\n    spinnerVerb,\n    stop,\n    tokens: Math.round(streamed / CHARS_PER_TOKEN),\n    turns,\n  };\n};\n",
      "type": "registry:hook",
      "target": "components/claude-code/hooks/use-claude-code-chat.ts"
    },
    {
      "path": "registry/notra/claude-code/examples/claude-code-demo.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent } from \"react\";\n\nimport { ClaudeCodeHeader } from \"../components/claude-code-header\";\nimport { ClaudeCodeMessage } from \"../components/claude-code-message\";\nimport { ClaudeCodePrompt } from \"../components/claude-code-prompt\";\nimport {\n  ClaudeCodeInterrupted,\n  ClaudeCodeSpinner,\n  ClaudeCodeTurnSummary,\n} from \"../components/claude-code-status\";\nimport { ClaudeCodeTerminal } from \"../components/claude-code-terminal\";\nimport { ClaudeCodeTodoList } from \"../components/claude-code-todo-list\";\nimport {\n  ClaudeCodeToolCall,\n  ClaudeCodeToolSummary,\n} from \"../components/claude-code-tool-call\";\nimport { CLAUDE_CODE_MODE_ORDER } from \"../constants/claude-code\";\nimport {\n  CLAUDE_CODE_REPLIES,\n  CLAUDE_CODE_SESSION,\n} from \"../constants/claude-code-session\";\nimport { useClaudeCodeChat } from \"../hooks/use-claude-code-chat\";\nimport type { ClaudeCodeChatTurn, ClaudeCodeMode } from \"../types/claude-code\";\n\nconst FOLLOW_THRESHOLD_PX = 48;\n\nconst nextMode = (current: ClaudeCodeMode) => {\n  const index = CLAUDE_CODE_MODE_ORDER.indexOf(current);\n  return CLAUDE_CODE_MODE_ORDER[(index + 1) % CLAUDE_CODE_MODE_ORDER.length];\n};\n\nconst ClaudeCodeTurn = ({ turn }: { turn: ClaudeCodeChatTurn }) => {\n  const toolCalls = turn.commands.map((command) => (\n    <ClaudeCodeToolCall\n      arg={command.arg}\n      key={command.id}\n      result={command.result}\n      status={command.status}\n      tool={command.tool}\n    >\n      {command.detail}\n    </ClaudeCodeToolCall>\n  ));\n  const foldsShell =\n    turn.status === \"done\" &&\n    turn.commands.length > 0 &&\n    turn.commands.every((command) => command.tool === \"Bash\");\n\n  return (\n    <div className=\"flex flex-col gap-5\">\n      <ClaudeCodeMessage from=\"user\">{turn.prompt}</ClaudeCodeMessage>\n      {turn.todos && <ClaudeCodeTodoList todos={turn.todos} />}\n      {foldsShell ? (\n        <ClaudeCodeToolSummary count={turn.commands.length}>\n          {toolCalls}\n        </ClaudeCodeToolSummary>\n      ) : (\n        toolCalls\n      )}\n      {turn.answer && <ClaudeCodeMessage>{turn.answer}</ClaudeCodeMessage>}\n      {turn.status === \"interrupted\" && <ClaudeCodeInterrupted />}\n      {turn.summary && <ClaudeCodeTurnSummary {...turn.summary} />}\n    </div>\n  );\n};\n\nexport default function ClaudeCodeDemo() {\n  const { header, pending, promptPlaceholder, pullRequest, title, turns } =\n    CLAUDE_CODE_SESSION;\n  const chat = useClaudeCodeChat(turns, CLAUDE_CODE_REPLIES);\n  const [mode, setMode] = useState<ClaudeCodeMode>(\"bypass\");\n  const terminalRef = useRef<HTMLDivElement>(null);\n  const followRef = useRef(false);\n  const activeTurn = chat.busy ? chat.turns.at(-1) : undefined;\n\n  const viewportOf = () =>\n    terminalRef.current?.querySelector<HTMLElement>(\n      '[data-slot=\"scroll-area-viewport\"]'\n    );\n\n  useEffect(() => {\n    const viewport = viewportOf();\n    if (!viewport) {\n      return;\n    }\n    const handleScroll = () => {\n      followRef.current =\n        viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight <\n        FOLLOW_THRESHOLD_PX;\n    };\n    handleScroll();\n    viewport.addEventListener(\"scroll\", handleScroll, { passive: true });\n    return () => viewport.removeEventListener(\"scroll\", handleScroll);\n  }, []);\n\n  useEffect(() => {\n    if (!followRef.current) {\n      return;\n    }\n    const viewport = viewportOf();\n    viewport?.scrollTo({ top: viewport.scrollHeight });\n  }, [chat.turns, chat.busy]);\n\n  const handleSend = (text: string) => {\n    followRef.current = true;\n    return chat.send(text);\n  };\n\n  const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n    if (event.key === \"Tab\" && event.shiftKey) {\n      event.preventDefault();\n      setMode(nextMode);\n    }\n  };\n\n  return (\n    <ClaudeCodeTerminal\n      className=\"h-170\"\n      footer={\n        <ClaudeCodePrompt\n          busy={chat.busy}\n          mode={mode}\n          onKeyDown={handleKeyDown}\n          onSend={handleSend}\n          onStop={chat.stop}\n          placeholder={promptPlaceholder}\n          pullRequest={pullRequest}\n        />\n      }\n      ref={terminalRef}\n      title={title}\n    >\n      <ClaudeCodeHeader {...header} />\n      {chat.turns.map((turn) => (\n        <ClaudeCodeTurn key={turn.id} turn={turn} />\n      ))}\n      {activeTurn && (\n        <ClaudeCodeSpinner\n          details={\n            activeTurn.status === \"working\"\n              ? [\"thinking\", \"esc to interrupt\"]\n              : [\"esc to interrupt\"]\n          }\n          elapsed={`${chat.elapsed}s`}\n          tip={pending.spinner.tip}\n          tokens={chat.tokens > 0 ? chat.tokens : undefined}\n          verb={chat.spinnerVerb}\n        />\n      )}\n    </ClaudeCodeTerminal>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/claude-code/examples/claude-code-demo.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-claude-code-bg": "var(--claude-code-bg)",
      "color-claude-code-chrome": "var(--claude-code-chrome)",
      "color-claude-code-traffic": "var(--claude-code-traffic)",
      "color-claude-code-title": "var(--claude-code-title)",
      "color-claude-code-shadow": "var(--claude-code-shadow)",
      "color-claude-code-ring": "var(--claude-code-ring)",
      "color-claude-code-fg": "var(--claude-code-fg)",
      "color-claude-code-strong": "var(--claude-code-strong)",
      "color-claude-code-accent": "var(--claude-code-accent)",
      "color-claude-code-muted": "var(--claude-code-muted)",
      "color-claude-code-rule": "var(--claude-code-rule)",
      "color-claude-code-link": "var(--claude-code-link)",
      "color-claude-code-pr": "var(--claude-code-pr)",
      "color-claude-code-user-bg": "var(--claude-code-user-bg)",
      "color-claude-code-user-prompt": "var(--claude-code-user-prompt)",
      "color-claude-code-success": "var(--claude-code-success)",
      "color-claude-code-error": "var(--claude-code-error)",
      "color-claude-code-mode-auto": "var(--claude-code-mode-auto)",
      "color-claude-code-mode-accept-edits": "var(--claude-code-mode-accept-edits)",
      "color-claude-code-mode-plan": "var(--claude-code-mode-plan)",
      "color-claude-code-mode-bypass": "var(--claude-code-mode-bypass)",
      "font-claude-code": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace"
    },
    "light": {
      "claude-code-bg": "#ffffff",
      "claude-code-chrome": "#ececec",
      "claude-code-traffic": "#d4d4d4",
      "claude-code-title": "#00000073",
      "claude-code-shadow": "#00000026",
      "claude-code-ring": "#0000001a",
      "claude-code-fg": "#1f1f1f",
      "claude-code-strong": "#000000",
      "claude-code-accent": "#d77757",
      "claude-code-muted": "#666666",
      "claude-code-rule": "#999999",
      "claude-code-link": "#5769f7",
      "claude-code-pr": "#966c1e",
      "claude-code-user-bg": "#f0f0f0",
      "claude-code-user-prompt": "#999999",
      "claude-code-success": "#2c7a39",
      "claude-code-error": "#ab2b3f",
      "claude-code-mode-auto": "#966c1e",
      "claude-code-mode-accept-edits": "#8700ff",
      "claude-code-mode-plan": "#006666",
      "claude-code-mode-bypass": "#d1245a"
    },
    "dark": {
      "claude-code-bg": "#0f0f0f",
      "claude-code-chrome": "#1c1c1c",
      "claude-code-traffic": "#3a3a3a",
      "claude-code-title": "#ffffff66",
      "claude-code-shadow": "#0000004d",
      "claude-code-ring": "#ffffff1a",
      "claude-code-fg": "#f7f7f7",
      "claude-code-strong": "#ffffff",
      "claude-code-accent": "#e06443",
      "claude-code-muted": "#8c8c8c",
      "claude-code-rule": "#7b7b7b",
      "claude-code-link": "#a4b0fc",
      "claude-code-pr": "#d9b559",
      "claude-code-user-bg": "#2e2e2e",
      "claude-code-user-prompt": "#5c5c5c",
      "claude-code-success": "#4eba65",
      "claude-code-error": "#ff6b80",
      "claude-code-mode-auto": "#e5c07b",
      "claude-code-mode-accept-edits": "#af87ff",
      "claude-code-mode-plan": "#48968c",
      "claude-code-mode-bypass": "#fd526f"
    }
  },
  "type": "registry:block"
}