{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chain-of-thought-demo",
  "title": "Chain of Thought Demo",
  "description": "A worked example of Chain of Thought: The steps an assistant took before answering, open while it is working and folded away once it is done.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/chain-of-thought.json"
  ],
  "files": [
    {
      "path": "components/demos/chain-of-thought-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { ChainOfThought } from \"@/registry/default/chain-of-thought/chain-of-thought\"\n\nconst thoughts = [\n  {\n    id: \"read\",\n    label: \"Read the retry handler\",\n    duration: 0.8,\n    detail: \"src/upload/retry.ts, 140 lines.\",\n  },\n  {\n    id: \"trace\",\n    label: \"Traced where the listener is added\",\n    duration: 2.1,\n    detail: \"onReconnect registers it again without removing the previous one.\",\n  },\n  { id: \"check\", label: \"Checked the reconnect tests\", duration: 1.4 },\n  { id: \"write\", label: \"Wrote the failing case first\", duration: 3.2 },\n]\n\nexport function ChainOfThoughtDemo() {\n  const [shown, setShown] = React.useState(2)\n\n  React.useEffect(() => {\n    if (shown >= thoughts.length) return\n\n    const timer = setTimeout(() => setShown((count) => count + 1), 1400)\n    return () => clearTimeout(timer)\n  }, [shown])\n\n  const thinking = shown < thoughts.length\n\n  return (\n    <div className=\"w-full max-w-lg space-y-3\">\n      <ChainOfThought\n        thinking={thinking}\n        thoughts={thoughts.slice(0, shown).map((thought, at) => ({\n          ...thought,\n          status: thinking && at === shown - 1 ? \"active\" : \"done\",\n          duration: thinking && at === shown - 1 ? undefined : thought.duration,\n        }))}\n      />\n\n      <button\n        type=\"button\"\n        onClick={() => setShown(2)}\n        className=\"text-muted-foreground hover:text-foreground text-xs underline underline-offset-4\"\n      >\n        Run it again\n      </button>\n    </div>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}