@assistant-ui/mcp-docs-server 0.1.29 → 0.1.31

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 (214) hide show
  1. package/.docs/organized/code-examples/waterfall.md +15 -7
  2. package/.docs/organized/code-examples/with-a2a.md +9 -21
  3. package/.docs/organized/code-examples/with-ag-ui.md +11 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
  5. package/.docs/organized/code-examples/with-artifacts.md +12 -10
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -12
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +83 -54
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
  9. package/.docs/organized/code-examples/with-cloud.md +9 -10
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +61 -16
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +17 -12
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +13 -13
  13. package/.docs/organized/code-examples/with-expo.md +25 -21
  14. package/.docs/organized/code-examples/with-external-store.md +8 -8
  15. package/.docs/organized/code-examples/with-ffmpeg.md +17 -12
  16. package/.docs/organized/code-examples/with-generative-ui.md +9 -9
  17. package/.docs/organized/code-examples/with-google-adk.md +8 -8
  18. package/.docs/organized/code-examples/with-heat-graph.md +5 -5
  19. package/.docs/organized/code-examples/with-interactables.md +10 -25
  20. package/.docs/organized/code-examples/with-langchain.md +437 -0
  21. package/.docs/organized/code-examples/with-langgraph.md +16 -16
  22. package/.docs/organized/code-examples/with-livekit.md +18 -13
  23. package/.docs/organized/code-examples/with-opencode.md +105 -62
  24. package/.docs/organized/code-examples/with-parent-id-grouping.md +10 -10
  25. package/.docs/organized/code-examples/with-react-hook-form.md +220 -148
  26. package/.docs/organized/code-examples/with-react-ink.md +2 -2
  27. package/.docs/organized/code-examples/with-react-router.md +12 -12
  28. package/.docs/organized/code-examples/with-store.md +8 -5
  29. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  30. package/.docs/organized/code-examples/with-tap-runtime.md +10 -6
  31. package/.docs/raw/docs/(docs)/cli.mdx +2 -1
  32. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  33. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  34. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  35. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  38. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  39. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/index.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/installation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/rtl.mdx +80 -0
  43. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
  44. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
  45. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
  50. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
  51. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
  53. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +149 -40
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +2 -0
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
  63. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
  64. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +9 -0
  65. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
  66. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +231 -3
  67. package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
  68. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  69. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
  70. package/.docs/raw/docs/guides/branching.mdx +76 -0
  71. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  72. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
  73. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
  74. package/.docs/raw/docs/guides/editing.mdx +102 -0
  75. package/.docs/raw/docs/guides/index.mdx +103 -0
  76. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
  77. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
  78. package/.docs/raw/docs/guides/mentions.mdx +520 -0
  79. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
  80. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
  81. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
  82. package/.docs/raw/docs/guides/slash-commands.mdx +361 -0
  83. package/.docs/raw/docs/guides/speech.mdx +156 -0
  84. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
  85. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
  86. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
  87. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
  88. package/.docs/raw/docs/ink/index.mdx +1 -3
  89. package/.docs/raw/docs/ink/migration.mdx +1 -3
  90. package/.docs/raw/docs/ink/primitives.mdx +37 -1
  91. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  92. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  93. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  94. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  95. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  96. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  97. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  98. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  99. package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
  100. package/.docs/raw/docs/integrations/index.mdx +173 -0
  101. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  102. package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
  103. package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
  104. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  105. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  106. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  107. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  108. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  109. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  110. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  111. package/.docs/raw/docs/primitives/composer.mdx +96 -63
  112. package/.docs/raw/docs/primitives/error.mdx +1 -0
  113. package/.docs/raw/docs/primitives/index.mdx +2 -1
  114. package/.docs/raw/docs/primitives/message.mdx +68 -5
  115. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  116. package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
  117. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  118. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  119. package/.docs/raw/docs/react-native/index.mdx +1 -3
  120. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  121. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  122. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  123. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  124. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  125. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  126. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
  127. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  128. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
  129. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
  130. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +365 -101
  131. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  132. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  133. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  134. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  135. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  136. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
  137. package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
  138. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  139. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  140. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  141. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  142. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  143. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  144. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  145. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  146. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  147. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  148. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  149. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  150. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  151. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  152. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  153. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  154. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  155. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  156. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  157. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +74 -198
  158. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  159. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  160. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  161. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  162. package/.docs/raw/docs/ui/badge.mdx +1 -0
  163. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +200 -0
  164. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  165. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  166. package/.docs/raw/docs/ui/directive-text.mdx +114 -0
  167. package/.docs/raw/docs/ui/file.mdx +1 -0
  168. package/.docs/raw/docs/ui/image.mdx +1 -0
  169. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  170. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  171. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  172. package/.docs/raw/docs/ui/model-selector.mdx +1 -0
  173. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  174. package/.docs/raw/docs/ui/quote.mdx +1 -0
  175. package/.docs/raw/docs/ui/reasoning.mdx +69 -32
  176. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  177. package/.docs/raw/docs/ui/select.mdx +1 -0
  178. package/.docs/raw/docs/ui/sources.mdx +1 -0
  179. package/.docs/raw/docs/ui/streamdown.mdx +1 -0
  180. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  181. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  182. package/.docs/raw/docs/ui/thread-list.mdx +17 -0
  183. package/.docs/raw/docs/ui/thread.mdx +56 -1
  184. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  185. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  186. package/.docs/raw/docs/ui/voice.mdx +1 -0
  187. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  188. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  189. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  190. package/dist/utils/logger.js +1 -1
  191. package/dist/utils/logger.js.map +1 -1
  192. package/package.json +4 -4
  193. package/src/tools/tests/path-traversal.test.ts +1 -1
  194. package/src/utils/logger.ts +1 -1
  195. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  196. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  197. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  198. package/.docs/raw/docs/(docs)/guides/mentions.mdx +0 -406
  199. package/.docs/raw/docs/(docs)/guides/slash-commands.mdx +0 -275
  200. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  201. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  202. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  203. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -268
  204. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  205. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  206. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  207. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  208. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -607
  209. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  210. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  211. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  212. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  213. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  214. package/.docs/raw/docs/ui/mention.mdx +0 -168
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: Overview
3
+ description: Practical patterns for building features with assistant-ui.
4
+ platforms: ["react"]
5
+ ---
6
+
7
+ Guides are task-oriented walkthroughs for building specific features on top of assistant-ui. They sit between the [Primitives](/docs/primitives) (low-level building blocks) and [Components](/docs/ui/thread) (pre-styled installs) — pick a guide when you know what you want to build and need the recommended pattern.
8
+
9
+ ## Composer
10
+
11
+ Extend the message input with file attachments, mentions, slash commands, voice, and quoting.
12
+
13
+ <Cards>
14
+ <Card title="Attachments" href="/docs/guides/attachments">
15
+ Let users attach files, images, and documents to messages. Covers upload adapters, validation, and the typed `attachmentAddError` event.
16
+ </Card>
17
+ <Card title="Mentions" href="/docs/guides/mentions">
18
+ `@`-style triggers that insert directives into the composer. Sync and async search patterns.
19
+ </Card>
20
+ <Card title="Slash Commands" href="/docs/guides/slash-commands">
21
+ `/`-style commands with arguments, async loading, and combining with mentions.
22
+ </Card>
23
+ <Card title="Quoting" href="/docs/guides/quoting">
24
+ Selection toolbar, programmatic `setQuote`, and forwarding quote context to the LLM.
25
+ </Card>
26
+ <Card title="Dictation" href="/docs/guides/dictation">
27
+ Speech-to-text into the composer using `DictationAdapter` and `ComposerPrimitive.Dictate`.
28
+ </Card>
29
+ </Cards>
30
+
31
+ ## Messages
32
+
33
+ Customize how messages render, are edited, branched, and suggested.
34
+
35
+ <Cards>
36
+ <Card title="Suggestions" href="/docs/guides/suggestions">
37
+ Welcome-screen prompts, dynamic suggestions, and the `AuiIf` empty-thread pattern.
38
+ </Card>
39
+ <Card title="Editing" href="/docs/guides/editing">
40
+ Edit user messages with `UserEditComposer`, `beginEdit()`, and edit-during-streaming behavior.
41
+ </Card>
42
+ <Card title="Branching" href="/docs/guides/branching">
43
+ Navigate alternative message versions with `BranchPickerPrimitive`, reload, and direct branch-id navigation.
44
+ </Card>
45
+ <Card title="Message Timing" href="/docs/guides/message-timing">
46
+ Display response duration and stream timing with `useMessageTiming` (experimental).
47
+ </Card>
48
+ </Cards>
49
+
50
+ ## Tools & Generative UI
51
+
52
+ Connect tools to the LLM and render their outputs as interactive UI.
53
+
54
+ <Cards>
55
+ <Card title="Tools" href="/docs/guides/tools">
56
+ Define tools with the Toolkit API, stream args, handle cancellation, and integrate with AI SDK / LangGraph / LangChain.
57
+ </Card>
58
+ <Card title="Tool UI" href="/docs/guides/tool-ui">
59
+ Render tool calls and `DataMessagePart` into custom components, with fallback handling.
60
+ </Card>
61
+ <Card title="Interactables" href="/docs/guides/interactables">
62
+ Persisted, schema-validated interactive UI driven by AI state.
63
+ </Card>
64
+ <Card title="Multi-Agent" href="/docs/guides/multi-agent">
65
+ Sub-agent message attribution via `ToolCallMessagePart.messages` and LangGraph subgraph events.
66
+ </Card>
67
+ </Cards>
68
+
69
+ ## Display
70
+
71
+ Render specialized message content.
72
+
73
+ <Cards>
74
+ <Card title="Chain of Thought" href="/docs/guides/chain-of-thought">
75
+ Display the assistant's reasoning steps in a collapsible accordion.
76
+ </Card>
77
+ <Card title="LaTeX" href="/docs/guides/latex">
78
+ Render math via React Markdown or Streamdown, with streaming-safe escape rules.
79
+ </Card>
80
+ </Cards>
81
+
82
+ ## Audio
83
+
84
+ Voice input and output.
85
+
86
+ <Cards>
87
+ <Card title="Voice" href="/docs/guides/voice">
88
+ Realtime bidirectional audio with `RealtimeVoiceAdapter` and `createVoiceSession`.
89
+ </Card>
90
+ <Card title="Speech" href="/docs/guides/speech">
91
+ Text-to-speech for assistant messages via `SpeechSynthesisAdapter`.
92
+ </Card>
93
+ </Cards>
94
+
95
+ ## Programmatic
96
+
97
+ Read and drive runtime state from your own code.
98
+
99
+ <Cards>
100
+ <Card title="Context API" href="/docs/guides/context-api">
101
+ Access threads, messages, composer, and tool state via `useAui` and the runtime scope tree.
102
+ </Card>
103
+ </Cards>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: Interactables
3
3
  description: Persistent UI whose state can be read and updated by the AI assistant.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  import { InteractableSample } from "@/components/docs/samples/interactable";
@@ -344,6 +345,49 @@ const aui = useAui({
344
345
  });
345
346
  ```
346
347
 
348
+ ## Streaming Updates
349
+
350
+ While the AI is generating tool arguments, `useInteractableState` reflects the partial state in real time as fields stream in. You can use the partial state itself plus the thread's running status to show a skeleton UI while the AI is mid-stream:
351
+
352
+ ```tsx
353
+ import { useAuiState } from "@assistant-ui/react";
354
+
355
+ function TaskBoard() {
356
+ const id = useAssistantInteractable("taskBoard", config);
357
+ const [state] = useInteractableState(id, taskBoardInitialState);
358
+ const isRunning = useAuiState((s) => s.thread.isRunning);
359
+
360
+ const isLoading = isRunning && state.tasks.length === 0;
361
+
362
+ return (
363
+ <div>
364
+ <h2>Tasks</h2>
365
+ {isLoading ? (
366
+ <div className="animate-pulse h-8 rounded bg-muted" />
367
+ ) : (
368
+ <ul>
369
+ {state.tasks.map((task) => (
370
+ <li key={task.id}>{task.title}</li>
371
+ ))}
372
+ </ul>
373
+ )}
374
+ </div>
375
+ );
376
+ }
377
+ ```
378
+
379
+ The state object updates progressively as the AI streams in each field, so partial renders work without any extra wiring. Use the runtime's `isRunning` to distinguish "still streaming, no fields yet" from "model returned an empty result".
380
+
381
+ ## Schema Evolution
382
+
383
+ <Callout type="warn">
384
+ If you change a Zod schema after state has been persisted, the imported snapshot may silently mis-match the new shape. The adapter does a shallow merge, so extra fields are preserved and missing fields keep their initial values, but type mismatches are not caught at runtime. To avoid silent corruption, version your schema key (e.g. `"taskBoard_v2"`) or namespace it by schema hash whenever you make breaking changes. Alternatively, add a migration step in your `importState` call.
385
+ </Callout>
386
+
387
+ ## Unmount Behavior
388
+
389
+ When a component that called `useAssistantInteractable` unmounts, the interactable is unregistered from the AI's tool list and system prompt. However, its state is preserved in the `Interactables` scope. When the component mounts again with the same name and id, the scope re-merges the preserved state rather than resetting to `initialState`. This means transient unmounts (such as React Strict Mode double-mounts or tab switches) do not lose state.
390
+
347
391
  ## Full Example
348
392
 
349
393
  See the complete [with-interactables example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-interactables) for a working implementation featuring:
@@ -352,3 +396,8 @@ See the complete [with-interactables example](https://github.com/assistant-ui/as
352
396
  - **Sticky Notes** — multi-instance interactables with selection and partial updates
353
397
  - **localStorage persistence** — state survives page refresh via `setPersistenceAdapter`
354
398
  - **Sync indicator** — spinning icon while a save is in-flight (`isPending`)
399
+
400
+ ## Related
401
+
402
+ - [Generative UI](/docs/guides/tool-ui) — Inline tool call UIs rendered inside messages
403
+ - [LangGraph Generative UI](/docs/runtimes/langgraph/generative-ui) — Structured UI components emitted by a LangGraph graph alongside messages
@@ -1,21 +1,24 @@
1
1
  ---
2
2
  title: LaTeX
3
3
  description: Render mathematical expressions in chat messages using KaTeX.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
7
+ import { PackageManagerTabs } from "@/components/docs/fumadocs/install/package-manager-tabs";
6
8
 
7
9
  Render LaTeX mathematical expressions in chat messages using KaTeX.
8
10
 
9
- <Callout type="warn">LaTeX rendering is not enabled in markdown by default.</Callout>
11
+ <Callout type="warn">LaTeX rendering is not enabled by default.</Callout>
12
+
13
+ <Tabs items={["react-markdown", "Streamdown"]}>
14
+ <Tab value="react-markdown">
10
15
 
11
16
  <Steps>
12
17
  <Step>
13
18
 
14
19
  ### Install dependencies
15
20
 
16
- ```bash
17
- npm i katex rehype-katex remark-math
18
- ```
21
+ <PackageManagerTabs packages={["katex", "rehype-katex", "remark-math"]} />
19
22
 
20
23
  </Step>
21
24
  <Step>
@@ -53,9 +56,50 @@ export const MarkdownText = memo(MarkdownTextImpl);
53
56
  </Step>
54
57
  </Steps>
55
58
 
59
+ </Tab>
60
+ <Tab value="Streamdown">
61
+
62
+ <Callout type="info">
63
+ Using [Streamdown](/docs/ui/streamdown) as your renderer? Math support is a first-party plugin — no remark or rehype packages needed.
64
+ </Callout>
65
+
66
+ <Steps>
67
+ <Step>
68
+
69
+ ### Install dependencies
70
+
71
+ <PackageManagerTabs packages={["@streamdown/math", "katex"]} />
72
+
73
+ </Step>
74
+ <Step>
75
+
76
+ ### Add KaTeX CSS to your layout
77
+
78
+ ```tsx title="/app/layout.tsx"
79
+ import "katex/dist/katex.min.css"; // [!code ++]
80
+ ```
81
+
82
+ </Step>
83
+ <Step>
84
+
85
+ ### Pass the `math` plugin to `StreamdownTextPrimitive`
86
+
87
+ ```tsx title="/components/assistant-ui/streamdown-text.tsx"
88
+ import { math } from "@streamdown/math"; // [!code ++]
89
+ import "katex/dist/katex.min.css"; // [!code ++]
90
+
91
+ <StreamdownTextPrimitive plugins={{ math }} /> // [!code ++]
92
+ ```
93
+
94
+ </Step>
95
+ </Steps>
96
+
97
+ </Tab>
98
+ </Tabs>
99
+
56
100
  ## Supported Formats
57
101
 
58
- By default, remark-math supports:
102
+ By default, remark-math (react-markdown path) supports:
59
103
  - `$...$` for inline math
60
104
  - `$$...$$` for display math
61
105
  - Fenced code blocks with the `math` language identifier
@@ -67,7 +111,7 @@ Many language models generate LaTeX using different delimiter formats:
67
111
  - `\[...\]` for display math
68
112
  - Custom formats like `[/math]...[/math]`
69
113
 
70
- You can use the `preprocess` prop to normalize these formats:
114
+ You can use the `preprocess` prop on `MarkdownTextPrimitive` to normalize these formats before parsing:
71
115
 
72
116
  ```tsx title="/components/assistant-ui/markdown-text.tsx"
73
117
  import { MarkdownTextPrimitive } from "@assistant-ui/react-markdown";
@@ -104,6 +148,5 @@ function normalizeCustomMathTags(input: string): string {
104
148
  ```
105
149
 
106
150
  <Callout type="tip">
107
- The preprocessing function runs before markdown parsing, allowing you to transform any delimiter format into the standard `$` and `$$` format.
151
+ Inside `MarkdownTextPrimitive`, the streamed text first passes through `preprocess` (delimiter normalization) and then through `useSmooth` (character-by-character accumulation), and only then reaches the markdown parser. Both run before remark-math sees the text, so delimiter replacement and the streaming smoothing are streaming-safe — partially-received delimiters are accumulated in the smoothing buffer rather than parsed mid-fragment.
108
152
  </Callout>
109
-