@hex-core/components 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +575 -18
  2. package/dist/accordion.js.map +1 -1
  3. package/dist/alert-dialog.js.map +1 -1
  4. package/dist/alert.js.map +1 -1
  5. package/dist/arc.js.map +1 -1
  6. package/dist/attachment.js.map +1 -1
  7. package/dist/audio-player.js.map +1 -1
  8. package/dist/audio-waveform.js.map +1 -1
  9. package/dist/auth-forgot-password.js.map +1 -1
  10. package/dist/auth-reset-password.js.map +1 -1
  11. package/dist/auth-sign-in-split.js.map +1 -1
  12. package/dist/auth-sign-up-card.js.map +1 -1
  13. package/dist/auth-verify-email.js.map +1 -1
  14. package/dist/auth-verify-otp.js.map +1 -1
  15. package/dist/avatar.js.map +1 -1
  16. package/dist/badge.js.map +1 -1
  17. package/dist/branch.d.ts +2 -0
  18. package/dist/branch.js +136 -0
  19. package/dist/branch.js.map +1 -0
  20. package/dist/breadcrumb.js.map +1 -1
  21. package/dist/button.js.map +1 -1
  22. package/dist/calendar.js.map +1 -1
  23. package/dist/canvas.js.map +1 -1
  24. package/dist/card.js.map +1 -1
  25. package/dist/chain-of-thought.d.ts +3 -0
  26. package/dist/chain-of-thought.js +119 -0
  27. package/dist/chain-of-thought.js.map +1 -0
  28. package/dist/checkbox.js.map +1 -1
  29. package/dist/chord.js.map +1 -1
  30. package/dist/citation.js.map +1 -1
  31. package/dist/cloze.js.map +1 -1
  32. package/dist/cluster.js.map +1 -1
  33. package/dist/code-block-copy.js.map +1 -1
  34. package/dist/code-block.js.map +1 -1
  35. package/dist/color-picker.js.map +1 -1
  36. package/dist/combobox.js.map +1 -1
  37. package/dist/command.js.map +1 -1
  38. package/dist/compare-table.js.map +1 -1
  39. package/dist/composer.js.map +1 -1
  40. package/dist/container.js.map +1 -1
  41. package/dist/context-menu.js.map +1 -1
  42. package/dist/conversation.d.ts +3 -0
  43. package/dist/conversation.js +358 -0
  44. package/dist/conversation.js.map +1 -0
  45. package/dist/data-table.js.map +1 -1
  46. package/dist/date-picker.js.map +1 -1
  47. package/dist/deck.js.map +1 -1
  48. package/dist/dendrogram.js.map +1 -1
  49. package/dist/diagram.js.map +1 -1
  50. package/dist/dialog.js.map +1 -1
  51. package/dist/drawer.js.map +1 -1
  52. package/dist/dropdown-menu.js.map +1 -1
  53. package/dist/dropzone.js.map +1 -1
  54. package/dist/empty.js.map +1 -1
  55. package/dist/error-state.js.map +1 -1
  56. package/dist/file-tree.js.map +1 -1
  57. package/dist/flashcard.js.map +1 -1
  58. package/dist/flowchart.js.map +1 -1
  59. package/dist/form.js.map +1 -1
  60. package/dist/funnel.js.map +1 -1
  61. package/dist/gantt.js.map +1 -1
  62. package/dist/grid.js.map +1 -1
  63. package/dist/hover-card.js.map +1 -1
  64. package/dist/image-occlusion.js.map +1 -1
  65. package/dist/index.d.ts +21 -0
  66. package/dist/index.js +1011 -13
  67. package/dist/index.js.map +1 -1
  68. package/dist/inline-citation.d.ts +2 -0
  69. package/dist/inline-citation.js +108 -0
  70. package/dist/inline-citation.js.map +1 -0
  71. package/dist/input-otp.js.map +1 -1
  72. package/dist/input.js.map +1 -1
  73. package/dist/label.js.map +1 -1
  74. package/dist/loading-indicator.js.map +1 -1
  75. package/dist/loading.js.map +1 -1
  76. package/dist/markdown.d.ts +1 -0
  77. package/dist/markdown.js +784 -4
  78. package/dist/markdown.js.map +1 -1
  79. package/dist/matrix.js.map +1 -1
  80. package/dist/menubar.js.map +1 -1
  81. package/dist/message-actions.js.map +1 -1
  82. package/dist/message-list.js.map +1 -1
  83. package/dist/message.js.map +1 -1
  84. package/dist/mind-map.js.map +1 -1
  85. package/dist/multi-combobox.js.map +1 -1
  86. package/dist/navigation-menu.js.map +1 -1
  87. package/dist/org-chart.js.map +1 -1
  88. package/dist/pagination.js.map +1 -1
  89. package/dist/plan.d.ts +3 -0
  90. package/dist/plan.js +183 -0
  91. package/dist/plan.js.map +1 -0
  92. package/dist/popover.js.map +1 -1
  93. package/dist/progress.js.map +1 -1
  94. package/dist/pyramid.js.map +1 -1
  95. package/dist/quiz.js.map +1 -1
  96. package/dist/radio-group.js.map +1 -1
  97. package/dist/reasoning.js.map +1 -1
  98. package/dist/resizable.js.map +1 -1
  99. package/dist/sankey.js.map +1 -1
  100. package/dist/schemas.d.ts +8 -0
  101. package/dist/schemas.js +774 -17
  102. package/dist/schemas.js.map +1 -1
  103. package/dist/scroll-area.js.map +1 -1
  104. package/dist/select.js.map +1 -1
  105. package/dist/separator.js.map +1 -1
  106. package/dist/sequence.js.map +1 -1
  107. package/dist/sheet.js.map +1 -1
  108. package/dist/shimmer.d.ts +2 -0
  109. package/dist/shimmer.js +39 -0
  110. package/dist/shimmer.js.map +1 -0
  111. package/dist/sidebar.js.map +1 -1
  112. package/dist/skeleton.js.map +1 -1
  113. package/dist/slider.js.map +1 -1
  114. package/dist/sources.d.ts +3 -0
  115. package/dist/sources.js +164 -0
  116. package/dist/sources.js.map +1 -0
  117. package/dist/spaced-repetition.js.map +1 -1
  118. package/dist/spacer.js.map +1 -1
  119. package/dist/speech-recognition.js.map +1 -1
  120. package/dist/stack.js.map +1 -1
  121. package/dist/stepper.js.map +1 -1
  122. package/dist/suggestion.js.map +1 -1
  123. package/dist/sunburst.js.map +1 -1
  124. package/dist/switch.js.map +1 -1
  125. package/dist/table.js.map +1 -1
  126. package/dist/tabs.js.map +1 -1
  127. package/dist/tag.js.map +1 -1
  128. package/dist/task.d.ts +3 -0
  129. package/dist/task.js +189 -0
  130. package/dist/task.js.map +1 -0
  131. package/dist/terminal.js +11 -0
  132. package/dist/terminal.js.map +1 -1
  133. package/dist/textarea.js.map +1 -1
  134. package/dist/time-axis.js.map +1 -1
  135. package/dist/time-picker.js.map +1 -1
  136. package/dist/timeline.js.map +1 -1
  137. package/dist/toggle-group.js.map +1 -1
  138. package/dist/toggle.js.map +1 -1
  139. package/dist/tool-call.js +5 -6
  140. package/dist/tool-call.js.map +1 -1
  141. package/dist/toolbar.js.map +1 -1
  142. package/dist/tooltip.js.map +1 -1
  143. package/dist/tree-map.js.map +1 -1
  144. package/dist/tree.js.map +1 -1
  145. package/dist/venn.js.map +1 -1
  146. package/package.json +8 -3
package/dist/schemas.js CHANGED
@@ -6147,7 +6147,7 @@ var citationSchema = {
6147
6147
  var markdownSchema = {
6148
6148
  name: "markdown",
6149
6149
  displayName: "Markdown",
6150
- description: "Streaming-safe markdown renderer wrapping Vercel's streamdown. Handles partial input mid-stream without throwing.",
6150
+ description: "Streaming-safe markdown renderer with AI-aware element slots. Native pipeline (react-markdown + remark-gfm + rehype-raw + rehype-sanitize) with slot wiring for fenced code, footnote citations, tool-call elements, and [!think] admonitions.",
6151
6151
  category: "ai",
6152
6152
  subcategory: "content",
6153
6153
  props: [
@@ -6174,11 +6174,17 @@ var markdownSchema = {
6174
6174
  }
6175
6175
  ],
6176
6176
  dependencies: {
6177
- npm: ["streamdown", "clsx", "tailwind-merge"],
6178
- internal: ["lib/utils"],
6177
+ npm: ["react-markdown", "remark-gfm", "rehype-raw", "rehype-sanitize", "unist-util-visit", "clsx", "tailwind-merge"],
6178
+ internal: [
6179
+ "lib/utils",
6180
+ "components/inline-citation/inline-citation",
6181
+ "components/sources/sources",
6182
+ "components/tool-call/tool-call",
6183
+ "components/reasoning/reasoning"
6184
+ ],
6179
6185
  peer: ["react", "react-dom"]
6180
6186
  },
6181
- tokensUsed: ["foreground", "primary"],
6187
+ tokensUsed: ["foreground", "primary", "muted", "muted-foreground", "border"],
6182
6188
  examples: [
6183
6189
  {
6184
6190
  title: "Streaming assistant turn",
@@ -6187,25 +6193,45 @@ var markdownSchema = {
6187
6193
  composition: ["chat", "streaming", "markdown"]
6188
6194
  },
6189
6195
  {
6190
- title: "Custom rendering: drop down to Streamdown",
6191
- description: "For per-element overrides, use streamdown directly with our CodeBlock primitive.",
6192
- code: 'import { Streamdown } from "streamdown";\nimport { CodeBlock } from "@hex-core/components";\n\n<Streamdown components={{ pre: ({ children }) => <CodeBlock code={extractCode(children)} /> }}>\n {markdown}\n</Streamdown>',
6193
- composition: ["chat", "code", "override"]
6196
+ title: "Fenced code preserves the language class",
6197
+ description: 'Triple-backtick fences render as `<pre><code class="language-ts">` so consumer-side highlighters (or Tailwind Typography styles) can target them. For server-side Shiki highlighting in an RSC tree, compose `<CodeBlock>` separately \u2014 Markdown stays client-safe so it works mid-stream.',
6198
+ code: 'const md = "```ts\\nconst x = 1;\\n```";\n<Markdown>{md}</Markdown>',
6199
+ composition: ["chat", "code"]
6200
+ },
6201
+ {
6202
+ title: "Footnote-style links route to Citation",
6203
+ description: "Link text matching `[N]` with a URL renders as a citation chip with the index preserved.",
6204
+ code: 'const md = "[1](https://anthropic.com/research) [2](https://openai.com)";\n<Markdown>{md}</Markdown>',
6205
+ composition: ["rag", "citations"]
6206
+ },
6207
+ {
6208
+ title: "[!think] admonition routes to Reasoning",
6209
+ description: "GitHub-style admonition blockquotes wrap the body in the in-house Reasoning primitive.",
6210
+ code: 'const md = "> [!think]\\n> Let me work through the steps.";\n<Markdown>{md}</Markdown>',
6211
+ composition: ["chat", "reasoning"]
6212
+ },
6213
+ {
6214
+ title: "<tool-call> element routes to ToolCall",
6215
+ description: "The custom tool-call element survives sanitize and wires to the ToolCall primitive with name/state/args/result.",
6216
+ code: `const md = \`<tool-call name="searchDocs" state="result" args='{"q":"x"}' result='{"hits":3}' />\`;
6217
+ <Markdown>{md}</Markdown>`,
6218
+ composition: ["chat", "tool-use"]
6194
6219
  }
6195
6220
  ],
6196
6221
  ai: {
6197
- whenToUse: "Render any markdown content from an LLM \u2014 assistant turns, system messages with formatting, RAG citations with inline links. Required for streaming because raw markdown parsers throw on unfinished input.",
6198
- whenNotToUse: "Don't use for plain text without formatting (just render the string). Don't bypass it for streamed content \u2014 partial input WILL break a non-streaming parser.",
6222
+ whenToUse: "Render any markdown content from an LLM \u2014 assistant turns, system messages with formatting, RAG citations with inline links, tool-call placeholders, [!think] reasoning traces. Required for streaming because raw markdown parsers throw on unfinished input.",
6223
+ whenNotToUse: "Don't use for plain text without formatting (just render the string). Don't bypass it for streamed content \u2014 partial input WILL break a non-streaming parser. Don't compose Markdown inside Markdown.",
6199
6224
  commonMistakes: [
6200
6225
  "Passing JSX children instead of a markdown string \u2014 Markdown only accepts strings",
6201
- "Trying to override per-element renderers via Markdown \u2014 drop down to `Streamdown` directly for that (we keep our public surface minimal so the DTS bundle doesn't drag in shiki's giant language union)",
6202
- "Forgetting Tailwind Typography (`prose`) classes are required to style the output"
6226
+ "Forgetting Tailwind Typography (`prose`) classes are required to style the output",
6227
+ "Reaching for an `overrides` / `components` prop \u2014 slot wiring is built in (fenced code, footnotes, <tool-call>, [!think]); compose those primitives instead of overriding renderers",
6228
+ "Embedding JSON in <tool-call> attrs without quoting the value (use single-quoted args/result so embedded double quotes survive HTML parsing)"
6203
6229
  ],
6204
- relatedComponents: ["message", "code-block", "citation"],
6205
- accessibilityNotes: "Inherits semantics from streamdown: real headings, lists, links. Verify Tailwind Typography (prose) is enabled in your CSS \u2014 without it, output renders unstyled.",
6206
- tokenBudget: 280
6230
+ relatedComponents: ["message", "code-block", "citation", "inline-citation", "sources", "tool-call", "reasoning"],
6231
+ accessibilityNotes: "Renders real semantic HTML (headings, lists, links, blockquotes). Verify Tailwind Typography (`prose`) is enabled in your CSS. Slot wiring preserves a11y semantics: Reasoning ships its own collapsible disclosure, Citation ships an inline link with a labeled index, ToolCall ships a labeled status region.",
6232
+ tokenBudget: 320
6207
6233
  },
6208
- tags: ["ai", "markdown", "streaming", "content", "renderer"]
6234
+ tags: ["ai", "markdown", "streaming", "content", "renderer", "slots"]
6209
6235
  };
6210
6236
 
6211
6237
  // src/ai/code-block/code-block.schema.ts
@@ -6286,6 +6312,737 @@ var codeBlockSchema = {
6286
6312
  tags: ["ai", "code", "shiki", "highlight", "copy", "rsc"]
6287
6313
  };
6288
6314
 
6315
+ // src/ai/sources/sources.schema.ts
6316
+ var sourcesSchema = {
6317
+ name: "sources",
6318
+ displayName: "Sources",
6319
+ description: "Bordered card listing 1\u2013N citation chips for a RAG response. Re-uses Citation per row inside a Radix Collapsible so consumers can collapse the list when the response references many sources.",
6320
+ category: "ai",
6321
+ subcategory: "rag",
6322
+ props: [
6323
+ {
6324
+ name: "sources",
6325
+ type: "object",
6326
+ required: true,
6327
+ description: "Array of `SourceRef` objects ({ title: string; url?: string; page?: number }). Each becomes a Citation chip."
6328
+ },
6329
+ {
6330
+ name: "defaultOpen",
6331
+ type: "boolean",
6332
+ required: false,
6333
+ default: true,
6334
+ description: "Whether the list is expanded by default."
6335
+ },
6336
+ {
6337
+ name: "className",
6338
+ type: "string",
6339
+ required: false,
6340
+ description: "Additional CSS classes on the root."
6341
+ }
6342
+ ],
6343
+ variants: [],
6344
+ slots: [],
6345
+ dependencies: {
6346
+ npm: ["@radix-ui/react-collapsible", "clsx", "tailwind-merge"],
6347
+ internal: ["lib/utils", "components/citation/citation"],
6348
+ peer: ["react", "react-dom"]
6349
+ },
6350
+ tokensUsed: ["card", "card-foreground", "border", "muted-foreground", "foreground", "ring"],
6351
+ examples: [
6352
+ {
6353
+ title: "RAG response sources",
6354
+ description: "Three retrieved sources for a question about auth.",
6355
+ code: 'const refs = [\n { title: "Auth research", url: "https://example.com/auth", page: 3 },\n { title: "OAuth 2.1 spec", url: "https://oauth.net/2.1" },\n { title: "Internal RFC #42", url: "https://example.com/rfc-42" },\n];\n<Sources sources={refs} />',
6356
+ composition: ["rag", "citations", "sources"]
6357
+ },
6358
+ {
6359
+ title: "Streamed via <sources> markdown element",
6360
+ description: "Render an LLM response that emits <sources data='[\u2026]' /> via the Markdown slot wiring.",
6361
+ code: 'const md = `<sources data=\'[{"title":"Auth research","url":"https://example.com/auth","page":3}]\' />`;\n<Markdown>{md}</Markdown>',
6362
+ composition: ["chat", "rag", "streaming"]
6363
+ }
6364
+ ],
6365
+ ai: {
6366
+ whenToUse: "At the bottom of a RAG-style assistant response, listing every source the model cited. Pair with InlineCitation in the body text so the inline refs and the bottom-of-card list reference the same sources by index.",
6367
+ whenNotToUse: "Don't use for a single-source attribution (drop in a plain Citation). Don't use as navigation \u2014 Sources is reference-only; for query history use a sidebar or breadcrumb.",
6368
+ commonMistakes: [
6369
+ "Passing strings instead of `{ title, url? }` objects in the `sources` array",
6370
+ "Composing inline citations with `Citation` (block-level) when `InlineCitation` (inline + hover popover) is the right choice",
6371
+ "Setting `defaultOpen={false}` on a chat surface \u2014 users miss provenance information by default",
6372
+ "Embedding raw URLs as titles (use the source's display name; URL hostname is a fallback Citation already provides)"
6373
+ ],
6374
+ relatedComponents: ["citation", "inline-citation", "markdown", "message"],
6375
+ accessibilityNotes: "Wraps Radix Collapsible \u2014 the trigger is a real <button> with aria-expanded; content gets aria-hidden when closed. Each Citation chip is keyboard-focusable when its url is set.",
6376
+ tokenBudget: 240
6377
+ },
6378
+ tags: ["ai", "rag", "citations", "sources", "collapsible"]
6379
+ };
6380
+
6381
+ // src/ai/inline-citation/inline-citation.schema.ts
6382
+ var inlineCitationSchema = {
6383
+ name: "inline-citation",
6384
+ displayName: "InlineCitation",
6385
+ description: "Inline footnote-style reference with a hover-preview popover. Pairs with Sources for the bottom-of-card list; fills the inline-text gap that the block Citation chip can't.",
6386
+ category: "ai",
6387
+ subcategory: "rag",
6388
+ props: [
6389
+ {
6390
+ name: "index",
6391
+ type: "number",
6392
+ required: true,
6393
+ description: "Footnote number (1-based). Renders inside the visible <sup>."
6394
+ },
6395
+ {
6396
+ name: "title",
6397
+ type: "string",
6398
+ required: true,
6399
+ description: "Source title shown in the hover preview."
6400
+ },
6401
+ {
6402
+ name: "url",
6403
+ type: "string",
6404
+ required: false,
6405
+ description: "Optional URL \u2014 when set, the trigger becomes a focusable anchor."
6406
+ },
6407
+ {
6408
+ name: "excerpt",
6409
+ type: "string",
6410
+ required: false,
6411
+ description: "Optional excerpt or context shown under the title in the preview."
6412
+ },
6413
+ {
6414
+ name: "openDelay",
6415
+ type: "number",
6416
+ required: false,
6417
+ default: 200,
6418
+ description: "Hover open delay in ms."
6419
+ },
6420
+ {
6421
+ name: "className",
6422
+ type: "string",
6423
+ required: false,
6424
+ description: "Additional CSS classes on the trigger."
6425
+ }
6426
+ ],
6427
+ variants: [],
6428
+ slots: [],
6429
+ dependencies: {
6430
+ npm: ["@radix-ui/react-hover-card", "clsx", "tailwind-merge"],
6431
+ internal: ["lib/utils"],
6432
+ peer: ["react", "react-dom"]
6433
+ },
6434
+ tokensUsed: ["primary", "popover", "popover-foreground", "border", "muted-foreground", "foreground", "ring"],
6435
+ examples: [
6436
+ {
6437
+ title: "Inline reference in a sentence",
6438
+ description: "Drop a citation in the middle of an assistant turn.",
6439
+ code: '<p>\n The frontier models all publish reasoning evals\n <InlineCitation\n index={1}\n title="Anthropic \u2014 Claude Sonnet 4.5"\n url="https://anthropic.com/claude"\n />.\n</p>',
6440
+ composition: ["chat", "rag", "inline"]
6441
+ },
6442
+ {
6443
+ title: "Pair with Sources for the bottom-of-card list",
6444
+ description: "Same source surfaces inline AND in the sources panel \u2014 same index in both places.",
6445
+ code: 'const refs = [\n { title: "Auth research", url: "https://example.com/auth", page: 3 },\n];\n<>\n <p>Studies on this <InlineCitation index={1} title={refs[0].title} url={refs[0].url} /> agree.</p>\n <Sources sources={refs} />\n</>',
6446
+ composition: ["rag", "citations", "sources"]
6447
+ },
6448
+ {
6449
+ title: "Streamed via Markdown [N](url) shape",
6450
+ description: "Markdown's footnote-style link slot routes [1](url) to InlineCitation automatically.",
6451
+ code: 'const md = "Reasoning quality scales [1](https://anthropic.com/research) with compute.";\n<Markdown>{md}</Markdown>',
6452
+ composition: ["chat", "streaming", "markdown"]
6453
+ }
6454
+ ],
6455
+ ai: {
6456
+ whenToUse: "In the body of an assistant message when you want to reference a source mid-sentence without breaking flow. Pair with Sources at the end of the message to give the user a scannable list.",
6457
+ whenNotToUse: "Don't use as a primary navigation element (it's a reference, not a link). Don't use for a single source attribution at the end of a message \u2014 just use Citation instead.",
6458
+ commonMistakes: [
6459
+ "Using `<Citation index={...}>` for inline references \u2014 that's the block-level chip; use InlineCitation for inline-text refs",
6460
+ "Mismatched `index` between the inline ref and the corresponding row in the Sources panel \u2014 keep them aligned",
6461
+ "Setting `openDelay={0}` \u2014 the hover popover triggers on accidental mouseover and feels noisy; the 200ms default keeps a calm hover cadence",
6462
+ "Missing `url` AND missing `excerpt` \u2014 leaves the popover with just a title; provide one of the two for context"
6463
+ ],
6464
+ relatedComponents: ["citation", "sources", "markdown", "message"],
6465
+ accessibilityNotes: "Wraps Radix HoverCard. The trigger is a real anchor (with `url`) or button; both carry an `aria-label` exposing the index + title to screen readers and are in the keyboard tab order. HoverCard content opens on focus AND hover so keyboard users get the same preview.",
6466
+ tokenBudget: 200
6467
+ },
6468
+ tags: ["ai", "rag", "citations", "inline", "popover", "footnote"]
6469
+ };
6470
+
6471
+ // src/ai/task/task.schema.ts
6472
+ var taskSchema = {
6473
+ name: "task",
6474
+ displayName: "Task",
6475
+ description: "Multi-step task progress card. Each step's state re-uses the canonical ToolCallState vocabulary; the header tracks aggregate progress.",
6476
+ category: "ai",
6477
+ subcategory: "agent",
6478
+ props: [
6479
+ {
6480
+ name: "label",
6481
+ type: "string",
6482
+ required: false,
6483
+ description: "Optional title shown above the step list."
6484
+ },
6485
+ {
6486
+ name: "steps",
6487
+ type: "object",
6488
+ required: true,
6489
+ description: "Array of `TaskStep` objects ({ id: string; label: string; state: ToolCallState; detail?: string }). State enum matches ToolCall: pending / running / result / error."
6490
+ },
6491
+ {
6492
+ name: "durationMs",
6493
+ type: "number",
6494
+ required: false,
6495
+ description: "Total time spent on the task. Renders 'Done in X.Xs' when all steps complete."
6496
+ },
6497
+ {
6498
+ name: "defaultOpen",
6499
+ type: "boolean",
6500
+ required: false,
6501
+ default: true,
6502
+ description: "Whether the step list is expanded by default."
6503
+ },
6504
+ {
6505
+ name: "className",
6506
+ type: "string",
6507
+ required: false,
6508
+ description: "Additional CSS classes on the root."
6509
+ }
6510
+ ],
6511
+ variants: [],
6512
+ slots: [],
6513
+ dependencies: {
6514
+ npm: ["@radix-ui/react-collapsible", "clsx", "tailwind-merge"],
6515
+ internal: ["lib/utils"],
6516
+ peer: ["react", "react-dom"]
6517
+ },
6518
+ tokensUsed: ["card", "card-foreground", "border", "muted", "muted-foreground", "foreground", "primary", "destructive", "ring"],
6519
+ examples: [
6520
+ {
6521
+ title: "Refactor task in progress",
6522
+ description: "Three steps \u2014 first is done, second is running, third is pending.",
6523
+ code: 'const steps = [\n { id: "read", label: "Read existing auth", state: "result" },\n { id: "write", label: "Apply changes", state: "running" },\n { id: "test", label: "Run tests", state: "pending" },\n];\n<Task label="Refactoring auth" steps={steps} />',
6524
+ composition: ["agent", "task", "progress"]
6525
+ },
6526
+ {
6527
+ title: "Completed task with duration",
6528
+ description: "All steps done; header shows total time.",
6529
+ code: 'const steps = [\n { id: "a", label: "Plan", state: "result" },\n { id: "b", label: "Apply", state: "result" },\n { id: "c", label: "Verify", state: "result" },\n];\n<Task label="Migrate users table" steps={steps} durationMs={12_400} />',
6530
+ composition: ["agent", "task", "complete"]
6531
+ },
6532
+ {
6533
+ title: "Compose with Reasoning per step",
6534
+ description: "Wrap a step's detail prop with Reasoning when the model wants to expose a thinking trace inline.",
6535
+ code: 'const steps = [\n { id: "plan", label: "Plan migration", state: "result", detail: "Identified 4 tables, 2 with existing indexes." },\n];\n<Task steps={steps} />',
6536
+ composition: ["agent", "task", "reasoning"]
6537
+ }
6538
+ ],
6539
+ ai: {
6540
+ whenToUse: "To show an agent's multi-step plan execution. Each step should map to a discrete unit of work the model claims it's doing \u2014 read, write, run, verify. Pair with ToolCall when a step actually invokes a tool, and Reasoning when the step exposes thinking.",
6541
+ whenNotToUse: "Don't use for a flat list of facts (use a real list). Don't use for a single-step operation (just render the result directly). Don't use as a navigation surface \u2014 it's a status display, not an interactive component.",
6542
+ commonMistakes: [
6543
+ "Mixing `state` strings \u2014 use the canonical `ToolCallState` (`pending` / `running` / `result` / `error`); novel states like 'in-progress' or 'finished' will render with the pending icon",
6544
+ "Setting all steps to `pending` upfront and never updating \u2014 the component is a status display, not a planner; consumers must update step state as the agent progresses",
6545
+ "Using `Task` for stateful wizard flows (use `Stepper` instead \u2014 Stepper is interactive, Task is read-only)",
6546
+ "Putting agent reasoning in `step.label` \u2014 keep labels short; put thinking in `step.detail` or compose Reasoning separately"
6547
+ ],
6548
+ relatedComponents: ["tool-call", "reasoning", "stepper", "message"],
6549
+ accessibilityNotes: "Wraps Radix Collapsible \u2014 trigger is a real <button> with aria-expanded; content gets aria-hidden when closed. Each step icon carries an aria-label so screen readers announce status (e.g. 'Done', 'Running', 'Error', 'Pending'). The 'running' spinner is gated on `motion-safe:` \u2014 users with `prefers-reduced-motion: reduce` see a static circle.",
6550
+ tokenBudget: 280
6551
+ },
6552
+ tags: ["ai", "agent", "task", "progress", "collapsible", "tool-use"]
6553
+ };
6554
+
6555
+ // src/ai/shimmer/shimmer.schema.ts
6556
+ var shimmerSchema = {
6557
+ name: "shimmer",
6558
+ displayName: "Shimmer",
6559
+ description: "Single-line streaming placeholder. Used during the dead-time between user submission and first stream token. Renders a motion-safe pulsing bar (Tailwind animate-pulse) that gates on `prefers-reduced-motion`.",
6560
+ category: "ai",
6561
+ subcategory: "feedback",
6562
+ props: [
6563
+ {
6564
+ name: "width",
6565
+ type: "string",
6566
+ required: false,
6567
+ default: "100%",
6568
+ description: "CSS width \u2014 accepts any width value."
6569
+ },
6570
+ {
6571
+ name: "height",
6572
+ type: "string",
6573
+ required: false,
6574
+ default: "1.5rem",
6575
+ description: "CSS height \u2014 defaults to a single line."
6576
+ },
6577
+ {
6578
+ name: "durationMs",
6579
+ type: "number",
6580
+ required: false,
6581
+ default: 1500,
6582
+ description: "Sweep cycle duration in milliseconds."
6583
+ },
6584
+ {
6585
+ name: "label",
6586
+ type: "string",
6587
+ required: false,
6588
+ default: "Loading\u2026",
6589
+ description: "Accessible label announced to screen readers."
6590
+ },
6591
+ {
6592
+ name: "className",
6593
+ type: "string",
6594
+ required: false,
6595
+ description: "Additional CSS classes on the root."
6596
+ }
6597
+ ],
6598
+ variants: [],
6599
+ slots: [],
6600
+ dependencies: {
6601
+ npm: ["clsx", "tailwind-merge"],
6602
+ internal: ["lib/utils"],
6603
+ peer: ["react", "react-dom"]
6604
+ },
6605
+ tokensUsed: ["muted", "foreground"],
6606
+ examples: [
6607
+ {
6608
+ title: "Streaming placeholder before first token",
6609
+ description: "Shows up between user submit and first model token; replaces with the streaming Markdown once tokens arrive.",
6610
+ code: '{isStreaming && firstTokenAt === null ? <Shimmer width="80%" /> : null}',
6611
+ composition: ["chat", "streaming", "loading"]
6612
+ },
6613
+ {
6614
+ title: "Compose with MessageList for the assistant placeholder row",
6615
+ description: "Render a Shimmer inside a Message while waiting for the first chunk.",
6616
+ code: '<MessageList>\n {messages.map((m) => <Message key={m.id} role={m.role}>{m.content}</Message>)}\n {isStreaming ? (\n <Message role="assistant"><Shimmer width="60%" /></Message>\n ) : null}\n</MessageList>',
6617
+ composition: ["chat", "streaming"]
6618
+ }
6619
+ ],
6620
+ ai: {
6621
+ whenToUse: "In the conversation pane during the dead-time between a user prompt submission and the first streaming token. Pair with Message so the placeholder occupies the same visual slot the streamed content will land in.",
6622
+ whenNotToUse: "Don't use for whole-screen loading (use Loading). Don't use for arbitrary skeleton shapes (use Skeleton). Don't use after the first token has arrived \u2014 once the model is streaming, render the partial content directly.",
6623
+ commonMistakes: [
6624
+ "Showing Shimmer through the entire response \u2014 once the first token arrives, swap to a Markdown render of the partial buffer",
6625
+ "Sizing the bar too short (width < 30%) \u2014 the sweep cycle becomes visually jittery; keep at ~60\u201380% of message-row width",
6626
+ "Using Shimmer for a whole-card placeholder (use Skeleton or Loading)",
6627
+ "Setting `durationMs` < 800 \u2014 feels nervous; the 1500ms default matches a calm waiting cadence"
6628
+ ],
6629
+ relatedComponents: ["loading", "loading-indicator", "skeleton", "message"],
6630
+ accessibilityNotes: 'Renders with `role="status"` and `aria-live="polite"`, so screen readers announce the loading label without preempting other content. The pulse animation is gated on `motion-safe:` \u2014 users with `prefers-reduced-motion: reduce` see a static bar rather than the pulsing one.',
6631
+ tokenBudget: 160
6632
+ },
6633
+ tags: ["ai", "loading", "streaming", "placeholder", "feedback"]
6634
+ };
6635
+
6636
+ // src/ai/branch/branch.schema.ts
6637
+ var branchSchema = {
6638
+ name: "branch",
6639
+ displayName: "Branch",
6640
+ description: "Headless alternate-response navigator. Renders one active branch with a prev/next control chip beneath it. Stateless \u2014 consumer owns `current` and `total`.",
6641
+ category: "ai",
6642
+ subcategory: "agent",
6643
+ props: [
6644
+ {
6645
+ name: "current",
6646
+ type: "number",
6647
+ required: true,
6648
+ description: "Zero-indexed active branch."
6649
+ },
6650
+ {
6651
+ name: "total",
6652
+ type: "number",
6653
+ required: true,
6654
+ description: "Total number of branches."
6655
+ },
6656
+ {
6657
+ name: "onCurrentChange",
6658
+ type: "function",
6659
+ required: false,
6660
+ description: "Called with the next index when the user steps prev/next. Omit to render the controls disabled (read-only)."
6661
+ },
6662
+ {
6663
+ name: "children",
6664
+ type: "ReactNode",
6665
+ required: true,
6666
+ description: "The active branch's content \u2014 typically a `<Message>` wrapping `<Markdown>`."
6667
+ },
6668
+ {
6669
+ name: "aria-label",
6670
+ type: "string",
6671
+ required: false,
6672
+ default: "Response branches",
6673
+ description: "Accessible name for the navigator landmark."
6674
+ },
6675
+ {
6676
+ name: "className",
6677
+ type: "string",
6678
+ required: false,
6679
+ description: "Additional CSS classes on the root."
6680
+ }
6681
+ ],
6682
+ variants: [],
6683
+ slots: [
6684
+ {
6685
+ name: "children",
6686
+ description: "The active branch's content. Render any node \u2014 typically `<Message>` + `<Markdown>`.",
6687
+ required: true,
6688
+ acceptedTypes: ["ReactNode"]
6689
+ }
6690
+ ],
6691
+ dependencies: {
6692
+ npm: ["clsx", "tailwind-merge"],
6693
+ internal: ["lib/utils"],
6694
+ peer: ["react", "react-dom"]
6695
+ },
6696
+ tokensUsed: ["muted", "muted-foreground", "foreground", "ring"],
6697
+ examples: [
6698
+ {
6699
+ title: "Switch between alternate model responses",
6700
+ description: "Three response candidates; arrow keys + chip step through them.",
6701
+ code: 'const [i, setI] = useState(0);\n<Branch current={i} total={alternatives.length} onCurrentChange={setI}>\n <Message role="assistant"><Markdown>{alternatives[i]}</Markdown></Message>\n</Branch>',
6702
+ composition: ["chat", "branch", "alternates"]
6703
+ },
6704
+ {
6705
+ title: "Read-only single-branch view",
6706
+ description: "Omit `onCurrentChange` to render the chip disabled \u2014 for archived conversations or when the model only produced one response.",
6707
+ code: '<Branch current={0} total={1}>\n <Message role="assistant"><Markdown>{response}</Markdown></Message>\n</Branch>',
6708
+ composition: ["chat", "branch", "read-only"]
6709
+ }
6710
+ ],
6711
+ ai: {
6712
+ whenToUse: "When a model returns multiple alternate responses (regenerate, n>1, ensemble) and the user should be able to navigate between them. Pair with `<Message>` + `<Markdown>` for the body and let the consumer own the active index.",
6713
+ whenNotToUse: "Don't use for sequential chat history (use `<MessageList>`). Don't use for unrelated tabs (use `<Tabs>`). Don't use to gate streaming \u2014 render the in-flight response directly.",
6714
+ commonMistakes: [
6715
+ "Passing `current` outside `[0, total - 1]` \u2014 the prev/next controls disable at the boundaries; out-of-range values render the controls but show the wrong index in the chip",
6716
+ "Treating Branch as stateful \u2014 it's headless, the consumer must keep `current` in their own state and react to `onCurrentChange`",
6717
+ "Rendering all branches inside `children` \u2014 Branch shows ONE branch at a time; the consumer slices to the active branch before passing in",
6718
+ "Using Branch for tabs or steppers \u2014 they're separate primitives with different semantics (Tabs = labeled regions, Stepper = ordered progress)"
6719
+ ],
6720
+ relatedComponents: ["pagination", "tabs", "message", "markdown"],
6721
+ accessibilityNotes: 'Wraps the body in a `role="group"` with a labelled landmark. Prev/next are real `<button>`s with aria-labels ("Previous response" / "Next response") and disabled state at boundaries. The N-of-M chip is `aria-live="polite"` + `aria-atomic="true"` only when interactive (so AT announces the new position as one unit when the user steps); read-only branches drop the live-region to avoid initial-mount noise on chat surfaces with many `<Branch>` blocks. Arrow keys (Left/Right) step through branches when focus is anywhere inside the group; the wrapper itself is not focusable, so the prev/next buttons or any focusable descendant carry the keys.',
6722
+ tokenBudget: 220
6723
+ },
6724
+ tags: ["ai", "agent", "branch", "navigation", "alternates"]
6725
+ };
6726
+
6727
+ // src/ai/plan/plan.schema.ts
6728
+ var planSchema = {
6729
+ name: "plan",
6730
+ displayName: "Plan",
6731
+ description: "Pre-execution multi-step plan card with an optional approval gate. Distinct from `<Task>` \u2014 Task is during/post-execution status; Plan is pre-execution intent.",
6732
+ category: "ai",
6733
+ subcategory: "agent",
6734
+ props: [
6735
+ {
6736
+ name: "label",
6737
+ type: "string",
6738
+ required: false,
6739
+ description: "Optional title shown above the step list."
6740
+ },
6741
+ {
6742
+ name: "description",
6743
+ type: "string",
6744
+ required: false,
6745
+ description: "Optional secondary description shown under the label."
6746
+ },
6747
+ {
6748
+ name: "steps",
6749
+ type: "object",
6750
+ required: true,
6751
+ description: "Array of `PlanStep` objects ({ id: string; label: string; detail?: string }). Steps don't carry state \u2014 flip the rendered Plan into a Task once approved."
6752
+ },
6753
+ {
6754
+ name: "onApprove",
6755
+ type: "function",
6756
+ required: false,
6757
+ description: "Called when the user clicks Approve. When provided, the footer renders an Approve button."
6758
+ },
6759
+ {
6760
+ name: "onCancel",
6761
+ type: "function",
6762
+ required: false,
6763
+ description: "Called when the user clicks Cancel. When provided, the footer renders a Cancel button."
6764
+ },
6765
+ {
6766
+ name: "approveLabel",
6767
+ type: "string",
6768
+ required: false,
6769
+ default: "Approve",
6770
+ description: "Override the approve button label."
6771
+ },
6772
+ {
6773
+ name: "cancelLabel",
6774
+ type: "string",
6775
+ required: false,
6776
+ default: "Cancel",
6777
+ description: "Override the cancel button label."
6778
+ },
6779
+ {
6780
+ name: "className",
6781
+ type: "string",
6782
+ required: false,
6783
+ description: "Additional CSS classes on the root."
6784
+ }
6785
+ ],
6786
+ variants: [],
6787
+ slots: [],
6788
+ dependencies: {
6789
+ npm: ["clsx", "tailwind-merge", "class-variance-authority", "@radix-ui/react-slot"],
6790
+ internal: ["lib/utils", "primitives/button/button"],
6791
+ peer: ["react", "react-dom"]
6792
+ },
6793
+ tokensUsed: ["card", "card-foreground", "border", "input", "muted", "muted-foreground", "foreground", "background"],
6794
+ examples: [
6795
+ {
6796
+ title: "Approval-gated plan",
6797
+ description: "Three steps with Approve/Cancel buttons in the footer.",
6798
+ code: '<Plan\n label="Refactor auth"\n steps={[\n { id: "read", label: "Read existing auth" },\n { id: "apply", label: "Apply changes" },\n { id: "test", label: "Run tests" },\n ]}\n onApprove={() => execute()}\n onCancel={() => discard()}\n/>',
6799
+ composition: ["agent", "plan", "approval"]
6800
+ },
6801
+ {
6802
+ title: "Read-only plan (no footer)",
6803
+ description: "Omit both onApprove and onCancel for a display-only plan.",
6804
+ code: '<Plan\n label="Migration plan"\n description="Three-table migration with backfill."\n steps={[\n { id: "users", label: "Migrate users", detail: "1.2M rows, batched" },\n { id: "orders", label: "Migrate orders", detail: "8M rows, dual-write window" },\n { id: "verify", label: "Verify integrity" },\n ]}\n/>',
6805
+ composition: ["agent", "plan", "read-only"]
6806
+ },
6807
+ {
6808
+ title: "Flip Plan \u2192 Task once approved",
6809
+ description: "Plan renders pre-execution; once the user approves, swap to a Task driven by the running agent.",
6810
+ code: 'const [approved, setApproved] = useState(false);\n{approved ? (\n <Task label="Refactor auth" steps={runningSteps} />\n) : (\n <Plan label="Refactor auth" steps={proposedSteps} onApprove={() => setApproved(true)} />\n)}',
6811
+ composition: ["agent", "plan", "task", "lifecycle"]
6812
+ }
6813
+ ],
6814
+ ai: {
6815
+ whenToUse: "To show an agent's proposed multi-step plan BEFORE it executes \u2014 typically gated on user approval. Pair with `<Task>` for the execution phase. Use the optional description prop to summarize tradeoffs the user is approving.",
6816
+ whenNotToUse: "Don't use `<Plan>` for the execution phase (use `<Task>` \u2014 its steps carry lifecycle state). Don't use it as a stateful wizard (use `<Stepper>` \u2014 Stepper is interactive, Plan is read-only intent). Don't use it for a single proposed action (just render a confirm dialog).",
6817
+ commonMistakes: [
6818
+ "Treating Plan as a stateful wizard \u2014 Plan is pre-execution display; once the user approves, swap the rendered Plan for a `<Task>` whose steps update as the agent runs",
6819
+ "Adding `state` to Plan steps \u2014 that's `TaskStep`. PlanStep has only `id`, `label`, `detail`",
6820
+ "Omitting both `onApprove` and `onCancel` when an approval gate is intended \u2014 the footer renders only when at least one handler is set",
6821
+ "Putting reasoning in `step.label` \u2014 keep labels short imperative phrases; put any rationale in `step.detail` or a separate `<Reasoning>` block above the Plan"
6822
+ ],
6823
+ relatedComponents: ["task", "stepper", "reasoning", "tool-call"],
6824
+ accessibilityNotes: "The step list renders as a real `<ol>` with an aria-label tied to the optional plan label, so screen readers announce it as an ordered list. Step indicators are aria-hidden (decorative) \u2014 the step label is the announced content. Approve / Cancel buttons inherit Button primitive accessibility (real `<button>`, focus ring, disabled handling).",
6825
+ tokenBudget: 240
6826
+ },
6827
+ tags: ["ai", "agent", "plan", "approval", "pre-execution"]
6828
+ };
6829
+
6830
+ // src/ai/conversation/conversation.schema.ts
6831
+ var conversationSchema = {
6832
+ name: "conversation",
6833
+ displayName: "Conversation",
6834
+ description: "High-level chat shell. Composes `<MessageList>` over a messages array, an optional `<Sources>` panel, an optional `<Shimmer>` placeholder during the dead-time before the first stream token, and a `<Composer>` row at the bottom.",
6835
+ category: "ai",
6836
+ subcategory: "chat",
6837
+ props: [
6838
+ {
6839
+ name: "messages",
6840
+ type: "object",
6841
+ required: true,
6842
+ description: "Array of `ConversationMessage` objects ({ id: string; role: Role; content: ReactNode }). Each renders as one `<Message>`."
6843
+ },
6844
+ {
6845
+ name: "onSubmit",
6846
+ type: "function",
6847
+ required: true,
6848
+ description: "Called with the trimmed text when the user submits the composer."
6849
+ },
6850
+ {
6851
+ name: "placeholder",
6852
+ type: "string",
6853
+ required: false,
6854
+ default: "Ask anything\u2026",
6855
+ description: "Composer placeholder."
6856
+ },
6857
+ {
6858
+ name: "value",
6859
+ type: "string",
6860
+ required: false,
6861
+ description: "Controlled composer text. Pass with `onValueChange` to take control of the input \u2014 useful for suggested prompts, voice transcripts, or form-library integration."
6862
+ },
6863
+ {
6864
+ name: "onValueChange",
6865
+ type: "function",
6866
+ required: false,
6867
+ description: "Called whenever the composer text changes. Required when `value` is set."
6868
+ },
6869
+ {
6870
+ name: "isStreaming",
6871
+ type: "boolean",
6872
+ required: false,
6873
+ default: false,
6874
+ description: "When true, renders a `<Shimmer>` placeholder above the composer (use during the dead time before the first stream token arrives)."
6875
+ },
6876
+ {
6877
+ name: "sources",
6878
+ type: "object",
6879
+ required: false,
6880
+ description: "Optional `SourceRef[]` rendered as a `<Sources>` panel beneath the message stream."
6881
+ },
6882
+ {
6883
+ name: "disabled",
6884
+ type: "boolean",
6885
+ required: false,
6886
+ default: false,
6887
+ description: "Disable the composer (e.g. while waiting on a tool call)."
6888
+ },
6889
+ {
6890
+ name: "composerActions",
6891
+ type: "ReactNode",
6892
+ required: false,
6893
+ description: "Trailing slot inside the composer \u2014 typically a Send button."
6894
+ },
6895
+ {
6896
+ name: "className",
6897
+ type: "string",
6898
+ required: false,
6899
+ description: "Additional CSS classes on the root."
6900
+ }
6901
+ ],
6902
+ variants: [],
6903
+ slots: [
6904
+ {
6905
+ name: "composerActions",
6906
+ description: "Trailing children passed into the underlying `<Composer>` \u2014 render Send button, attachment buttons, etc.",
6907
+ required: false,
6908
+ acceptedTypes: ["ReactNode"]
6909
+ }
6910
+ ],
6911
+ dependencies: {
6912
+ npm: ["clsx", "tailwind-merge", "@radix-ui/react-collapsible", "class-variance-authority"],
6913
+ internal: [
6914
+ "lib/utils",
6915
+ "components/composer/composer",
6916
+ "components/message/message",
6917
+ "components/message-list/message-list",
6918
+ "components/shimmer/shimmer",
6919
+ "components/sources/sources"
6920
+ ],
6921
+ peer: ["react", "react-dom"]
6922
+ },
6923
+ tokensUsed: ["card", "card-foreground", "border", "muted", "muted-foreground", "background", "secondary", "accent", "ring"],
6924
+ examples: [
6925
+ {
6926
+ title: "Off-the-shelf chat surface",
6927
+ description: "Pass a messages array + onSubmit handler. Internal composer state is managed for you.",
6928
+ code: 'const [messages, setMessages] = useState<ConversationMessage[]>([]);\nfunction handle(text: string) {\n setMessages((m) => [...m, { id: nanoid(), role: "user", content: text }]);\n // \u2026kick off the model call\n}\n<Conversation messages={messages} onSubmit={handle} />',
6929
+ composition: ["chat", "shell", "conversation"]
6930
+ },
6931
+ {
6932
+ title: "Streaming + RAG sources",
6933
+ description: "Show a Shimmer placeholder for the in-flight assistant turn and a Sources panel when the response cites sources.",
6934
+ code: '<Conversation\n messages={messages}\n onSubmit={handle}\n isStreaming={waitingForFirstToken}\n sources={lastResponse?.sources}\n placeholder="Ask the docs\u2026"\n/>',
6935
+ composition: ["chat", "rag", "streaming"]
6936
+ },
6937
+ {
6938
+ title: "Markdown-formatted assistant turns",
6939
+ description: "Pass `<Markdown>` (or any node) as the message content for streaming-safe formatting.",
6940
+ code: 'const messages = chunks.map((c) => ({\n id: c.id,\n role: c.role,\n content: c.role === "assistant" ? <Markdown>{c.text}</Markdown> : c.text,\n}));\n<Conversation messages={messages} onSubmit={handle} />',
6941
+ composition: ["chat", "markdown", "streaming"]
6942
+ }
6943
+ ],
6944
+ ai: {
6945
+ whenToUse: "As the off-the-shelf entry point for any chat surface \u2014 saves consumers from wiring `<MessageList>` + `<Composer>` + `<Sources>` + `<Shimmer>` manually. Use when the standard layout (history above, composer below) fits.",
6946
+ whenNotToUse: "Don't use when you need a non-standard layout (composer-on-top, side-by-side branches, threaded sub-conversations) \u2014 drop down to the underlying primitives. Don't use for a single-shot prompt UI (just a Composer + a result panel).",
6947
+ commonMistakes: [
6948
+ "Passing message strings as `content` when you wanted markdown rendering \u2014 wrap with `<Markdown>{text}</Markdown>` so streaming-safe formatting kicks in",
6949
+ "Forgetting the `id` field on each ConversationMessage \u2014 without a stable id React re-mounts every row on each update, killing input focus and animation continuity",
6950
+ "Passing `value` without `onValueChange` (or vice-versa) \u2014 controlled mode requires both props together; without the handler, the input goes read-only because internal state can't update",
6951
+ "Setting `isStreaming` for the entire response \u2014 only set it during the dead time BEFORE the first token; once tokens arrive, render the partial in the messages array and clear isStreaming"
6952
+ ],
6953
+ relatedComponents: ["message-list", "composer", "message", "sources", "shimmer", "markdown"],
6954
+ accessibilityNotes: 'Inherits accessibility from each composed primitive: MessageList is a `role="log"` with `aria-live="polite"` so new turns announce, Composer\'s textarea is a labelled form input that submits on Enter, Sources is a labelled Collapsible, and Shimmer is `role="status"`. The composer disables cleanly via the `disabled` prop, propagating to its `<textarea>`.',
6955
+ tokenBudget: 280
6956
+ },
6957
+ tags: ["ai", "chat", "shell", "conversation", "messages", "composer"]
6958
+ };
6959
+
6960
+ // src/ai/chain-of-thought/chain-of-thought.schema.ts
6961
+ var chainOfThoughtSchema = {
6962
+ name: "chain-of-thought",
6963
+ displayName: "ChainOfThought",
6964
+ description: "Structured ReAct-shape reasoning trace \u2014 each step has a thought, optional action, and optional observation. Final answer renders below the trace. Distinct from `<Reasoning>` (unstructured prose).",
6965
+ category: "ai",
6966
+ subcategory: "reasoning",
6967
+ props: [
6968
+ {
6969
+ name: "steps",
6970
+ type: "object",
6971
+ required: true,
6972
+ description: "Array of `ChainOfThoughtStep` objects ({ thought: ReactNode; action?: ReactNode; observation?: ReactNode }). Every step has a thought; action and observation are optional."
6973
+ },
6974
+ {
6975
+ name: "finalAnswer",
6976
+ type: "ReactNode",
6977
+ required: false,
6978
+ description: "Optional final answer rendered beneath the collapsible trace \u2014 typically a `<Markdown>` block."
6979
+ },
6980
+ {
6981
+ name: "label",
6982
+ type: "string",
6983
+ required: false,
6984
+ default: "Chain of thought",
6985
+ description: "Header label on the collapsible."
6986
+ },
6987
+ {
6988
+ name: "defaultOpen",
6989
+ type: "boolean",
6990
+ required: false,
6991
+ default: false,
6992
+ description: "Whether the trace is expanded by default."
6993
+ },
6994
+ {
6995
+ name: "className",
6996
+ type: "string",
6997
+ required: false,
6998
+ description: "Additional CSS classes on the root."
6999
+ }
7000
+ ],
7001
+ variants: [],
7002
+ slots: [
7003
+ {
7004
+ name: "finalAnswer",
7005
+ description: "Final answer rendered beneath the trace. Typically a `<Markdown>` block.",
7006
+ required: false,
7007
+ acceptedTypes: ["ReactNode"]
7008
+ }
7009
+ ],
7010
+ dependencies: {
7011
+ npm: ["@radix-ui/react-collapsible", "clsx", "tailwind-merge"],
7012
+ internal: ["lib/utils", "components/reasoning/reasoning"],
7013
+ peer: ["react", "react-dom"]
7014
+ },
7015
+ tokensUsed: ["foreground", "muted-foreground", "muted", "ring"],
7016
+ examples: [
7017
+ {
7018
+ title: "ReAct trace with a final answer",
7019
+ description: "Two steps + a final summary rendered as Markdown.",
7020
+ code: '<ChainOfThought\n steps={[\n {\n thought: "Need to look up the auth module",\n action: "read auth.ts",\n observation: "200 lines, uses bcrypt + jwt",\n },\n { thought: "The bug is on line 42 \u2014 missing salt rounds." },\n ]}\n finalAnswer={<Markdown>{"Set `bcrypt.hash(pw, 12)` instead of `bcrypt.hash(pw)`."}</Markdown>}\n/>',
7021
+ composition: ["agent", "react", "reasoning"]
7022
+ },
7023
+ {
7024
+ title: "Pure thought trace (no actions)",
7025
+ description: "When the model is reasoning without tool calls, omit action/observation.",
7026
+ code: '<ChainOfThought\n steps={[\n { thought: "The user wants a 3-step migration." },\n { thought: "Step 1 is read-only, so it can run during business hours." },\n { thought: "Steps 2-3 need maintenance window \u2014 recommend Saturday 2am." },\n ]}\n/>',
7027
+ composition: ["agent", "reasoning"]
7028
+ }
7029
+ ],
7030
+ ai: {
7031
+ whenToUse: "To expose the model's structured thinking when it's doing ReAct-style tool-augmented reasoning. Each step's thought / action / observation triple matches the canonical ReAct prompting format. Pair with `<ToolCall>` for the actual tool invocations and `<Markdown>` for the final answer.",
7032
+ whenNotToUse: "Don't use for unstructured reasoning prose (use `<Reasoning>`). Don't use for the user-facing answer itself (the `finalAnswer` slot is for the answer; the trace is the scratchpad). Don't use to render ALL agent thinking \u2014 most models also produce free-form prose that doesn't fit the ReAct shape. Don't pass a Server Component subtree as `finalAnswer` \u2014 `<ChainOfThought>` is client-only (it composes Radix Collapsible via `<Reasoning>`), so the answer must be client-renderable too.",
7033
+ commonMistakes: [
7034
+ "Putting the final answer inside a step's thought \u2014 it belongs in `finalAnswer` so it stays visible when the trace is collapsed",
7035
+ "Omitting `thought` on a step (it's required) \u2014 every step represents a reasoning move, even if the action is what carries the work",
7036
+ "Using `<ChainOfThought>` for arbitrary structured data (use a real list or table) \u2014 this primitive's labels are specifically `Thought` / `Action` / `Observation`",
7037
+ "Setting `defaultOpen={true}` for every assistant turn \u2014 the trace can be long; default-collapsed matches user expectations and lets them peek when they want more depth"
7038
+ ],
7039
+ relatedComponents: ["reasoning", "tool-call", "markdown", "task"],
7040
+ accessibilityNotes: "Wraps `<Reasoning>` (Radix Collapsible) \u2014 header is a real `<button>` with aria-expanded; content gets aria-hidden when closed. The step list renders as an `<ol>`; per-step term labels (Thought / Action / Observation) read as inline text rather than `<dt>`/`<dd>` because the visual structure is a vertical row, not a definition list. Final answer renders outside the collapsible so it stays visible regardless of trace state.",
7041
+ tokenBudget: 260
7042
+ },
7043
+ tags: ["ai", "agent", "reasoning", "react", "chain-of-thought", "trace"]
7044
+ };
7045
+
6289
7046
  // src/artifacts/mind-map/mind-map.schema.ts
6290
7047
  var mindMapSchema = {
6291
7048
  name: "mind-map",
@@ -8493,6 +9250,6 @@ var spacedRepetitionSchema = {
8493
9250
  tags: ["artifact", "study", "spaced-repetition", "srs", "anki", "rating"]
8494
9251
  };
8495
9252
 
8496
- export { accordionSchema, alertDialogSchema, alertSchema, arcSchema, aspectRatioSchema, attachmentSchema, avatarSchema, badgeSchema, breadcrumbSchema, buttonSchema, calendarSchema, cardSchema, checkboxSchema, chordSchema, citationSchema, clozeSchema, clusterSchema, codeBlockSchema, collapsibleSchema, colorPickerSchema, comboboxSchema, commandSchema, compareTableSchema, composerSchema, containerSchema, contextMenuSchema, dataTableSchema, datePickerSchema, deckSchema, dendrogramSchema, dialogSchema, drawerSchema, dropdownMenuSchema, dropzoneSchema, emptySchema, errorStateSchema, fileTreeSchema, flashcardSchema, flowchartSchema, formSchema, funnelSchema, ganttSchema, gridSchema, hoverCardSchema, imageOcclusionSchema, inputOTPSchema, inputSchema, labelSchema, loadingIndicatorSchema, loadingSchema, markdownSchema, matrixSchema, menubarSchema, messageActionsSchema, messageListSchema, messageSchema, mindMapSchema, multiComboboxSchema, navigationMenuSchema, orgChartSchema, paginationSchema, popoverSchema, progressSchema, pyramidSchema, quizSchema, radioGroupSchema, reasoningSchema, resizableSchema, sankeySchema, scrollAreaSchema, selectSchema, separatorSchema, sequenceSchema, sheetSchema, sidebarSchema, skeletonSchema, sliderSchema, sonnerSchema, spacedRepetitionSchema, spacerSchema, stackSchema, stepperSchema, suggestionSchema, sunburstSchema, switchSchema, tableSchema, tabsSchema, tagSchema, textareaSchema, timeAxisSchema, timePickerSchema, timelineSchema, toggleGroupSchema, toggleSchema, toolCallSchema, toolbarSchema, tooltipSchema, treeMapSchema, treeSchema, vennSchema };
9253
+ export { accordionSchema, alertDialogSchema, alertSchema, arcSchema, aspectRatioSchema, attachmentSchema, avatarSchema, badgeSchema, branchSchema, breadcrumbSchema, buttonSchema, calendarSchema, cardSchema, chainOfThoughtSchema, checkboxSchema, chordSchema, citationSchema, clozeSchema, clusterSchema, codeBlockSchema, collapsibleSchema, colorPickerSchema, comboboxSchema, commandSchema, compareTableSchema, composerSchema, containerSchema, contextMenuSchema, conversationSchema, dataTableSchema, datePickerSchema, deckSchema, dendrogramSchema, dialogSchema, drawerSchema, dropdownMenuSchema, dropzoneSchema, emptySchema, errorStateSchema, fileTreeSchema, flashcardSchema, flowchartSchema, formSchema, funnelSchema, ganttSchema, gridSchema, hoverCardSchema, imageOcclusionSchema, inlineCitationSchema, inputOTPSchema, inputSchema, labelSchema, loadingIndicatorSchema, loadingSchema, markdownSchema, matrixSchema, menubarSchema, messageActionsSchema, messageListSchema, messageSchema, mindMapSchema, multiComboboxSchema, navigationMenuSchema, orgChartSchema, paginationSchema, planSchema, popoverSchema, progressSchema, pyramidSchema, quizSchema, radioGroupSchema, reasoningSchema, resizableSchema, sankeySchema, scrollAreaSchema, selectSchema, separatorSchema, sequenceSchema, sheetSchema, shimmerSchema, sidebarSchema, skeletonSchema, sliderSchema, sonnerSchema, sourcesSchema, spacedRepetitionSchema, spacerSchema, stackSchema, stepperSchema, suggestionSchema, sunburstSchema, switchSchema, tableSchema, tabsSchema, tagSchema, taskSchema, textareaSchema, timeAxisSchema, timePickerSchema, timelineSchema, toggleGroupSchema, toggleSchema, toolCallSchema, toolbarSchema, tooltipSchema, treeMapSchema, treeSchema, vennSchema };
8497
9254
  //# sourceMappingURL=schemas.js.map
8498
9255
  //# sourceMappingURL=schemas.js.map