@assistant-ui/mcp-docs-server 0.1.30 → 0.1.32

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 (341) hide show
  1. package/.docs/organized/code-examples/waterfall.md +8 -8
  2. package/.docs/organized/code-examples/with-a2a.md +10 -10
  3. package/.docs/organized/code-examples/with-ag-ui.md +12 -12
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +14 -14
  5. package/.docs/organized/code-examples/with-artifacts.md +14 -14
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
  7. package/.docs/organized/code-examples/with-browser-extension.md +345 -0
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +129 -63
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +13 -13
  10. package/.docs/organized/code-examples/with-cloud.md +13 -13
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +65 -20
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -17
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +18 -17
  14. package/.docs/organized/code-examples/with-expo.md +25 -25
  15. package/.docs/organized/code-examples/with-external-store.md +10 -10
  16. package/.docs/organized/code-examples/with-ffmpeg.md +14 -14
  17. package/.docs/organized/code-examples/with-generative-ui.md +211 -14
  18. package/.docs/organized/code-examples/with-google-adk.md +12 -12
  19. package/.docs/organized/code-examples/with-heat-graph.md +8 -8
  20. package/.docs/organized/code-examples/with-image-generation.md +454 -0
  21. package/.docs/organized/code-examples/with-interactables.md +14 -14
  22. package/.docs/organized/code-examples/with-langchain.md +12 -12
  23. package/.docs/organized/code-examples/with-langgraph.md +15 -12
  24. package/.docs/organized/code-examples/with-livekit.md +19 -18
  25. package/.docs/organized/code-examples/with-mcp.md +748 -0
  26. package/.docs/organized/code-examples/with-opencode.md +107 -62
  27. package/.docs/organized/code-examples/with-parent-id-grouping.md +12 -12
  28. package/.docs/organized/code-examples/with-react-hook-form.md +14 -14
  29. package/.docs/organized/code-examples/with-react-ink.md +4 -4
  30. package/.docs/organized/code-examples/with-react-router.md +16 -16
  31. package/.docs/organized/code-examples/with-resumable-stream.md +660 -0
  32. package/.docs/organized/code-examples/with-store.md +8 -8
  33. package/.docs/organized/code-examples/with-tanstack.md +14 -14
  34. package/.docs/organized/code-examples/with-tap-runtime.md +11 -10
  35. package/.docs/raw/docs/(docs)/cli.mdx +3 -1
  36. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  38. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  39. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  43. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  44. package/.docs/raw/docs/(docs)/index.mdx +3 -2
  45. package/.docs/raw/docs/(docs)/installation.mdx +2 -1
  46. package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +36 -0
  48. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +34 -0
  50. package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
  51. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +55 -0
  52. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +20 -0
  53. package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
  54. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
  55. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +22 -0
  56. package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
  57. package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
  58. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
  59. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +36 -0
  60. package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
  61. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +31 -0
  62. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +33 -0
  63. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
  64. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +28 -0
  65. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +94 -0
  66. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +464 -0
  67. package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
  68. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +22 -0
  69. package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +79 -0
  70. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +52 -0
  71. package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
  72. package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
  73. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +125 -125
  74. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
  75. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
  76. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +46 -20
  77. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
  78. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
  79. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
  80. package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
  81. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
  82. package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
  83. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +70 -0
  84. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
  85. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +182 -554
  86. package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
  87. package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
  88. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
  89. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
  90. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
  91. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +82 -86
  92. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -314
  93. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
  94. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
  95. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
  96. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +43 -0
  97. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
  98. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
  99. package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
  100. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
  101. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -42
  102. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
  103. package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +68 -0
  104. package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
  105. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +79 -0
  106. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
  107. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +92 -0
  108. package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
  109. package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
  110. package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
  111. package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
  112. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +131 -0
  113. package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
  114. package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
  115. package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
  116. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
  117. package/.docs/raw/docs/cloud/ai-sdk.mdx +222 -4
  118. package/.docs/raw/docs/cloud/index.mdx +2 -2
  119. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  120. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +45 -40
  121. package/.docs/raw/docs/guides/branching.mdx +76 -0
  122. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  123. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +54 -26
  124. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +3 -1
  125. package/.docs/raw/docs/guides/editing.mdx +102 -0
  126. package/.docs/raw/docs/guides/generative-ui.mdx +142 -0
  127. package/.docs/raw/docs/guides/image-generation.mdx +74 -0
  128. package/.docs/raw/docs/guides/index.mdx +103 -0
  129. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +51 -2
  130. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +53 -10
  131. package/.docs/raw/docs/guides/mcp-apps.mdx +231 -0
  132. package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +63 -88
  133. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +45 -6
  134. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +66 -6
  135. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +11 -18
  136. package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
  137. package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
  138. package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
  139. package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +104 -38
  140. package/.docs/raw/docs/guides/speech.mdx +156 -0
  141. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +91 -69
  142. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +110 -38
  143. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +197 -40
  144. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +41 -2
  145. package/.docs/raw/docs/ink/adapters.mdx +37 -1
  146. package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
  147. package/.docs/raw/docs/ink/index.mdx +11 -14
  148. package/.docs/raw/docs/ink/migration.mdx +1 -3
  149. package/.docs/raw/docs/ink/primitives.mdx +386 -9
  150. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  151. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  152. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  153. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  154. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  155. package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
  156. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  157. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  158. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  159. package/.docs/raw/docs/integrations/gateways/index.mdx +162 -0
  160. package/.docs/raw/docs/integrations/index.mdx +185 -0
  161. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  162. package/.docs/raw/docs/integrations/observability/langfuse.mdx +163 -0
  163. package/.docs/raw/docs/integrations/observability/langsmith.mdx +150 -0
  164. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  165. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  166. package/.docs/raw/docs/integrations/tools/react-mcp.mdx +337 -0
  167. package/.docs/raw/docs/migrations/v0-14.mdx +297 -0
  168. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  169. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  170. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  171. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  172. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  173. package/.docs/raw/docs/primitives/composer.mdx +55 -1
  174. package/.docs/raw/docs/primitives/error.mdx +1 -0
  175. package/.docs/raw/docs/primitives/index.mdx +4 -3
  176. package/.docs/raw/docs/primitives/message.mdx +68 -5
  177. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  178. package/.docs/raw/docs/primitives/suggestion.mdx +10 -0
  179. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  180. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  181. package/.docs/raw/docs/react-native/hooks.mdx +2 -2
  182. package/.docs/raw/docs/react-native/index.mdx +5 -7
  183. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  184. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  185. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  186. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  187. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  188. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  189. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +154 -0
  190. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  191. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +73 -128
  192. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +70 -64
  193. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +337 -123
  194. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  195. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  196. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  197. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  198. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  199. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +348 -0
  200. package/.docs/raw/docs/runtimes/custom/external-store.mdx +261 -1236
  201. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  202. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  203. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  204. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  205. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  206. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  207. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  208. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  209. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  210. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  211. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  212. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  213. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  214. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  215. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  216. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  217. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  218. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  219. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  220. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +78 -203
  221. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  222. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  223. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  224. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  225. package/.docs/raw/docs/ui/badge.mdx +1 -0
  226. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +12 -1
  227. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  228. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  229. package/.docs/raw/docs/ui/directive-text.mdx +1 -0
  230. package/.docs/raw/docs/ui/file.mdx +1 -0
  231. package/.docs/raw/docs/ui/image.mdx +1 -0
  232. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  233. package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
  234. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  235. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  236. package/.docs/raw/docs/ui/model-selector.mdx +9 -8
  237. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  238. package/.docs/raw/docs/ui/quote.mdx +1 -0
  239. package/.docs/raw/docs/ui/reasoning.mdx +66 -33
  240. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  241. package/.docs/raw/docs/ui/select.mdx +1 -0
  242. package/.docs/raw/docs/ui/sources.mdx +18 -0
  243. package/.docs/raw/docs/ui/streamdown.mdx +35 -2
  244. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  245. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  246. package/.docs/raw/docs/ui/thread-list.mdx +19 -2
  247. package/.docs/raw/docs/ui/thread.mdx +58 -3
  248. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  249. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  250. package/.docs/raw/docs/ui/voice.mdx +1 -0
  251. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  252. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  253. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  254. package/README.md +14 -72
  255. package/dist/constants.d.ts +12 -9
  256. package/dist/constants.d.ts.map +1 -1
  257. package/dist/constants.js +13 -9
  258. package/dist/constants.js.map +1 -1
  259. package/dist/index.d.ts +7 -3
  260. package/dist/index.d.ts.map +1 -1
  261. package/dist/index.js +25 -24
  262. package/dist/index.js.map +1 -1
  263. package/dist/prepare-docs/code-examples.d.ts +4 -1
  264. package/dist/prepare-docs/code-examples.d.ts.map +1 -1
  265. package/dist/prepare-docs/code-examples.js +109 -121
  266. package/dist/prepare-docs/code-examples.js.map +1 -1
  267. package/dist/prepare-docs/copy-raw.d.ts +4 -1
  268. package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
  269. package/dist/prepare-docs/copy-raw.js +45 -42
  270. package/dist/prepare-docs/copy-raw.js.map +1 -1
  271. package/dist/prepare-docs/prepare.d.ts +1 -2
  272. package/dist/prepare-docs/prepare.js +17 -17
  273. package/dist/prepare-docs/prepare.js.map +1 -1
  274. package/dist/stdio.d.ts +1 -3
  275. package/dist/stdio.js +6 -3
  276. package/dist/stdio.js.map +1 -1
  277. package/dist/tools/docs.d.ts +20 -15
  278. package/dist/tools/docs.d.ts.map +1 -1
  279. package/dist/tools/docs.js +140 -161
  280. package/dist/tools/docs.js.map +1 -1
  281. package/dist/tools/examples.d.ts +20 -15
  282. package/dist/tools/examples.d.ts.map +1 -1
  283. package/dist/tools/examples.js +74 -86
  284. package/dist/tools/examples.js.map +1 -1
  285. package/dist/tools/tests/test-setup.d.ts +5 -2
  286. package/dist/tools/tests/test-setup.d.ts.map +1 -1
  287. package/dist/tools/tests/test-setup.js +21 -28
  288. package/dist/tools/tests/test-setup.js.map +1 -1
  289. package/dist/utils/logger.d.ts +8 -5
  290. package/dist/utils/logger.d.ts.map +1 -1
  291. package/dist/utils/logger.js +17 -17
  292. package/dist/utils/logger.js.map +1 -1
  293. package/dist/utils/mcp-format.d.ts +8 -5
  294. package/dist/utils/mcp-format.d.ts.map +1 -1
  295. package/dist/utils/mcp-format.js +9 -9
  296. package/dist/utils/mcp-format.js.map +1 -1
  297. package/dist/utils/mdx.d.ts +8 -6
  298. package/dist/utils/mdx.d.ts.map +1 -1
  299. package/dist/utils/mdx.js +22 -22
  300. package/dist/utils/mdx.js.map +1 -1
  301. package/dist/utils/paths.d.ts +9 -6
  302. package/dist/utils/paths.d.ts.map +1 -1
  303. package/dist/utils/paths.js +66 -76
  304. package/dist/utils/paths.js.map +1 -1
  305. package/dist/utils/security.d.ts +4 -1
  306. package/dist/utils/security.d.ts.map +1 -1
  307. package/dist/utils/security.js +19 -40
  308. package/dist/utils/security.js.map +1 -1
  309. package/package.json +6 -6
  310. package/src/tools/tests/path-traversal.test.ts +1 -1
  311. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  312. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  313. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  314. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  315. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
  316. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
  317. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
  318. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
  319. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +0 -159
  320. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  321. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  322. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
  323. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  324. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  325. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  326. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  327. package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
  328. package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
  329. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
  330. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  331. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  332. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  333. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  334. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  335. package/dist/prepare-docs/prepare.d.ts.map +0 -1
  336. package/dist/stdio.d.ts.map +0 -1
  337. /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
  338. /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
  339. /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
  340. /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
  341. /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
@@ -1,6 +1,7 @@
1
1
  ---
2
- title: Tools
3
- description: Give your assistant actions like API calls, database queries, and more.
2
+ title: Tool Calling
3
+ description: Add API calls, database queries, and custom actions to your AI chat with assistant-ui's tool calling. Real-time visualization, type safety, and streaming.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  Tools enable LLMs to take actions and interact with external systems. assistant-ui provides a comprehensive toolkit for creating, managing, and visualizing tool interactions in real-time.
@@ -24,9 +25,9 @@ When tools are executed, you can display custom generative UI components that pr
24
25
  creating your own Tool UI component for the tool's name.
25
26
  </Callout>
26
27
 
27
- ## Recommended: Tools() API
28
+ ## Tools() API
28
29
 
29
- The `Tools()` API is the recommended way to register tools in assistant-ui. It provides centralized tool registration that prevents duplicate registrations and works seamlessly with all runtimes.
30
+ The `Tools()` API is the recommended starting point for registering tools in assistant-ui. It provides centralized tool registration that prevents duplicate registrations and works seamlessly with all runtimes. For tools whose availability depends on a specific part of your UI being mounted, see the [component-based APIs](#component-based-apis) below; both styles are supported and can be mixed in the same app.
30
31
 
31
32
  ### Quick Start
32
33
 
@@ -99,6 +100,7 @@ type ToolDefinition =
99
100
  description?: string;
100
101
  parameters: StandardSchemaV1 | JSONSchema7; // e.g. a Zod schema
101
102
  execute: (args, context) => Promise<any>;
103
+ toModelOutput?: (opts) => ToolModelContentPart[]; // see "Multi-modal tool results"
102
104
  render?: (props) => React.ReactNode;
103
105
  }
104
106
  | {
@@ -115,6 +117,66 @@ type ToolDefinition =
115
117
  };
116
118
  ```
117
119
 
120
+ ### Multi-modal Tool Results
121
+
122
+ By default, the value returned from `execute` is sent to the model as a single JSON blob. That is fine for most tools, but it does not work for tools whose useful output is a file or image: a "read PDF" tool, an OCR tool, a chart-rendering tool, etc.
123
+
124
+ `toModelOutput` is an optional callback that maps the developer-facing `execute` result into the multi-modal content the model actually sees. Your `render` function still receives the rich, typed `result`; the model receives the projection.
125
+
126
+ ```tsx
127
+ import { tool } from "@assistant-ui/react";
128
+ import { convertUint8ArrayToBase64 } from "@ai-sdk/provider-utils";
129
+ import { z } from "zod";
130
+
131
+ const readPdfTool = tool({
132
+ description: "Fetch a PDF from a URL and return it",
133
+ parameters: z.object({ url: z.string().url() }),
134
+ execute: async ({ url }) => {
135
+ const res = await fetch(url);
136
+ const buf = new Uint8Array(await res.arrayBuffer());
137
+ const base64 = convertUint8ArrayToBase64(buf);
138
+ return { mediaType: "application/pdf", base64, byteLength: buf.byteLength };
139
+ },
140
+ toModelOutput: ({ output }) => [
141
+ { type: "text", text: "PDF contents:" },
142
+ {
143
+ type: "file",
144
+ data: output.base64,
145
+ mediaType: output.mediaType,
146
+ },
147
+ ],
148
+ });
149
+ ```
150
+
151
+ `ToolModelContentPart` is a union of `{ type: "text"; text }` and `{ type: "file"; data; mediaType; filename? }`. Use `mediaType` (e.g. `image/png`, `application/pdf`) to tell the model how to interpret the bytes.
152
+
153
+ When using the AI SDK runtime, frontend tool results round-trip through the AI SDK chat protocol back to your route handler on the next turn. For `toModelOutput` to fire on those round-tripped results, your route handler must also pass the tool registry to `convertToModelMessages`. This is the [same pattern AI SDK documents](https://ai-sdk.dev/docs/reference/ai-sdk-ui/convert-to-model-messages#multi-modal-tool-responses) for any multi-modal tool response:
154
+
155
+ ```ts
156
+ import { frontendTools } from "@assistant-ui/react-ai-sdk";
157
+ import { convertToModelMessages, streamText } from "ai";
158
+
159
+ const aiSDKTools = { ...frontendTools(tools ?? {}) };
160
+
161
+ const result = streamText({
162
+ model,
163
+ // Pass tools to both calls. convertToModelMessages reads `toModelOutput`
164
+ // from `tools[toolName]` to project prior tool results.
165
+ messages: await convertToModelMessages(messages, { tools: aiSDKTools }),
166
+ tools: aiSDKTools,
167
+ });
168
+ ```
169
+
170
+ If you skip the `{ tools: aiSDKTools }` argument, prior tool results will be sent to the model as a plain JSON blob (the AI SDK default), and your `toModelOutput` will be silently ignored. Tools that do not declare `toModelOutput` are unaffected either way.
171
+
172
+ <Callout type="warn">
173
+ **Reserved property name.** When `toModelOutput` is set, the runtime wraps the AI SDK chat output as `{ __aui_modelContent: ToolModelContentPart[], value: <your result> }` before persisting. Do not return objects whose top-level key is literally `__aui_modelContent` from any tool's `execute`, or it will be misread as the envelope. The prefix is namespaced for this reason; any other property name is fine.
174
+ </Callout>
175
+
176
+ <Callout type="warn">
177
+ **Read/write compatibility for persisted threads.** The `__aui_modelContent` envelope is recognized by `@assistant-ui/react-ai-sdk` from this version onward. If you persist UI messages (thread history adapter, cloud, etc.) and read them from multiple environments, upgrade every reader before any writer starts producing `toModelOutput`. Older readers will treat the entire envelope as the `result`, which breaks tool `render` functions for those messages.
178
+ </Callout>
179
+
118
180
  ### Organizing Large Toolkits
119
181
 
120
182
  For larger applications, split tools across multiple files:
@@ -207,6 +269,32 @@ execute: async (args, context) => {
207
269
  };
208
270
  ```
209
271
 
272
+ ### Cancellation
273
+
274
+ `context.abortSignal` is an `AbortSignal` that fires when the user stops the run. Pass it to any async I/O so the work stops immediately:
275
+
276
+ ```tsx
277
+ execute: async ({ query }, { abortSignal }) => {
278
+ const res = await fetch(`/api/search?q=${query}`, { signal: abortSignal });
279
+ return res.json();
280
+ },
281
+ ```
282
+
283
+ When using LangGraph with `unstable_createLangGraphStream`, the default `onDisconnect` value is already `"cancel"`, which tells the LangGraph server to cancel the run on abort:
284
+
285
+ ```ts
286
+ import { unstable_createLangGraphStream } from "@assistant-ui/react-langgraph";
287
+
288
+ const stream = unstable_createLangGraphStream({
289
+ client,
290
+ assistantId,
291
+ // onDisconnect defaults to "cancel"; the server cancels the run when the
292
+ // client disconnects or the user stops the message.
293
+ });
294
+ ```
295
+
296
+ See the [LangGraph quickstart](/docs/runtimes/langgraph/quickstart) for full setup.
297
+
210
298
  ### Human-in-the-Loop
211
299
 
212
300
  Tools can pause execution to request user input or approval:
@@ -260,15 +348,51 @@ const confirmationToolkit: Toolkit = {
260
348
  };
261
349
  ```
262
350
 
263
- ## Alternative Methods (Legacy)
351
+ ### Streaming Tool Args
264
352
 
265
- <Callout type="warning">
266
- The following methods are supported for backwards compatibility but are not
267
- recommended for new code. They can cause duplicate registration errors and are
268
- harder to maintain. Use the `Tools()` API instead.
353
+ While a tool is running, its arguments arrive as partial JSON. Use `useToolArgsStatus` inside a tool UI render function to react to each top-level field as it streams in. The hook is exported from `@assistant-ui/react`.
354
+
355
+ ```tsx
356
+ import { useToolArgsStatus } from "@assistant-ui/react";
357
+
358
+ const SearchToolUI = makeAssistantToolUI<{ query: string; limit: number }, unknown>({
359
+ toolName: "search",
360
+ render: ({ args }) => {
361
+ const { propStatus } = useToolArgsStatus<{ query: string; limit: number }>();
362
+
363
+ return (
364
+ <div>
365
+ <span className={propStatus.query === "streaming" ? "animate-pulse" : ""}>
366
+ {args.query ?? "..."}
367
+ </span>
368
+ {propStatus.limit === "complete" && <span> (limit: {args.limit})</span>}
369
+ </div>
370
+ );
371
+ },
372
+ });
373
+ ```
374
+
375
+ `propStatus` maps each top-level key in the args object to `"streaming"` while it is still being parsed and to `"complete"` once that field is fully present.
376
+
377
+ ## Component-Based APIs
378
+
379
+ `makeAssistantTool`, `useAssistantTool`, and `makeAssistantToolUI` are component-and-hook-based APIs that coexist with the [`Tools()`](#tools-api) toolkit pattern. They are fully supported and the natural fit for the [intelligent components](/docs/copilots/motivation) pattern, where each part of your UI registers the tools it owns when it is mounted, for example a product-specific tool that should only be exposed while that product's screen is open.
380
+
381
+ <Callout type="info">
382
+ Be careful not to register the same tool from both APIs at once: each API
383
+ registers under `toolName`, and duplicate registrations will be rejected.
269
384
  </Callout>
270
385
 
271
- ### Using `makeAssistantTool` (Deprecated)
386
+ <Callout type="warn">
387
+ Tool **execution** can be registered dynamically (when a component mounts),
388
+ but tool **UI** should generally be pre-registered. A `render` function that
389
+ is only registered while a specific component is mounted will not render
390
+ when chat history is replayed or during server-side rendering. Either
391
+ declare the tool's `render` in a `Tools()` toolkit, or mount
392
+ `makeAssistantToolUI` near the root of your tree.
393
+ </Callout>
394
+
395
+ ### Using `makeAssistantTool`
272
396
 
273
397
  Register tools with the assistant context. Returns a React component that registers the tool when rendered:
274
398
 
@@ -303,9 +427,9 @@ function App() {
303
427
  }
304
428
  ```
305
429
 
306
- **Why this is deprecated**: Component-based registration can lead to duplicate registrations if components are remounted or if the same tool is defined in multiple places.
430
+ Tradeoff: component-based registration is tied to React lifecycle, so the tool is registered when the component mounts and unregistered when it unmounts. Take care not to remount it accidentally if you also register the same tool elsewhere.
307
431
 
308
- ### Using `useAssistantTool` Hook (Deprecated)
432
+ ### Using the `useAssistantTool` Hook
309
433
 
310
434
  Register tools dynamically using React hooks:
311
435
 
@@ -329,9 +453,9 @@ function DynamicTools() {
329
453
  }
330
454
  ```
331
455
 
332
- **Why this is deprecated**: Hook-based registration ties tool definitions to component lifecycle, making them harder to test and potentially causing duplicate registrations.
456
+ Tradeoff: like `makeAssistantTool`, the registration follows the component lifecycle. Useful for dynamic tools that depend on component state or props.
333
457
 
334
- ### Using `makeAssistantToolUI` (Deprecated)
458
+ ### Using `makeAssistantToolUI`
335
459
 
336
460
  Create UI-only components for tools defined elsewhere:
337
461
 
@@ -365,7 +489,7 @@ function App() {
365
489
  }
366
490
  ```
367
491
 
368
- **Why this is deprecated**: Component-based UI registration can cause issues with tool UI not appearing or appearing multiple times.
492
+ Tradeoff: like the other component-based APIs, the UI is registered while the component is mounted. Useful when the tool UI needs access to surrounding component state or context.
369
493
 
370
494
  ## Tool Paradigms
371
495
 
@@ -391,37 +515,32 @@ const frontendToolkit: Toolkit = {
391
515
 
392
516
  ### Backend Tools
393
517
 
394
- Tools executed server-side:
518
+ Tools executed server-side live in your API route. A minimal example with the AI SDK:
519
+
520
+ ```ts title="@/app/api/chat/route.ts"
521
+ import { openai } from "@ai-sdk/openai";
522
+ import { streamText, convertToModelMessages, tool, zodSchema } from "ai";
523
+ import { z } from "zod";
395
524
 
396
- ```tsx
397
- // Backend route (AI SDK)
398
525
  export async function POST(req: Request) {
399
526
  const { messages } = await req.json();
400
-
401
527
  const result = streamText({
402
- model: openai("gpt-4o"),
528
+ model: openai("gpt-5.4-nano"),
403
529
  messages: await convertToModelMessages(messages),
404
530
  tools: {
405
- queryDatabase: {
531
+ queryDatabase: tool({
406
532
  description: "Query the application database",
407
- inputSchema: zodSchema(
408
- z.object({
409
- query: z.string(),
410
- table: z.string(),
411
- }),
412
- ),
413
- execute: async ({ query, table }) => {
414
- const results = await db.query(query, { table });
415
- return results;
416
- },
417
- },
533
+ inputSchema: zodSchema(z.object({ query: z.string(), table: z.string() })),
534
+ execute: async ({ query, table }) => db.query(query, { table }),
535
+ }),
418
536
  },
419
537
  });
420
-
421
538
  return result.toUIMessageStreamResponse();
422
539
  }
423
540
  ```
424
541
 
542
+ For the full AI SDK v6 backend setup including multi-step tool calls, frontend tools, history persistence with `withFormat`, and more, see the [AI SDK v6 guide](/docs/runtimes/ai-sdk/v6).
543
+
425
544
  ### Client-Defined Tools with frontendTools
426
545
 
427
546
  The Vercel AI SDK adapter implements automatic serialization of client-defined tools. Tools registered via the `Tools()` API are automatically included in API requests:
@@ -461,7 +580,7 @@ export async function POST(req: Request) {
461
580
  const { messages, tools } = await req.json();
462
581
 
463
582
  const result = streamText({
464
- model: openai("gpt-4o"),
583
+ model: openai("gpt-5.4-nano"),
465
584
  messages: await convertToModelMessages(messages),
466
585
  tools: {
467
586
  ...frontendTools(tools), // Client-defined tools
@@ -500,7 +619,7 @@ export async function POST(req: Request) {
500
619
  const tools = await client.tools();
501
620
 
502
621
  const result = streamText({
503
- model: openai("gpt-4o"),
622
+ model: openai("gpt-5.4-nano"),
504
623
  tools,
505
624
  messages: await convertToModelMessages(messages),
506
625
  });
@@ -512,9 +631,47 @@ export async function POST(req: Request) {
512
631
  }
513
632
  ```
514
633
 
634
+ ## LangGraph subgraph events
635
+
636
+ When a LangGraph graph contains sub-agents (nested subgraphs), events from those subgraphs arrive with a `metadata.namespace` field identifying the originating subgraph. Pass event handlers to `useLangGraphRuntime` (or `useLangGraphMessages`) to react to them:
637
+
638
+ ```ts
639
+ const runtime = useLangGraphRuntime({
640
+ stream,
641
+ eventHandlers: {
642
+ onSubgraphValues: (namespace, values) => {
643
+ console.log("subgraph", namespace, "state:", values);
644
+ },
645
+ onSubgraphUpdates: (namespace, updates) => {
646
+ console.log("subgraph", namespace, "updates:", updates);
647
+ },
648
+ onSubgraphError: (namespace, error) => {
649
+ console.error("subgraph", namespace, "error:", error);
650
+ },
651
+ },
652
+ });
653
+ ```
654
+
655
+ `namespace` is a pipe-separated string like `"parent|child_agent"`. Messages emitted by a subgraph include `metadata.namespace` so you can attribute tool results to the correct sub-agent.
656
+
657
+ ## `useLangChainState`
658
+
659
+ When using `@assistant-ui/react-langchain` (`useStreamRuntime`), the `useLangChainState` hook lets you read any key from the current LangChain/LangGraph state on the client without a separate API call:
660
+
661
+ ```tsx
662
+ import { useLangChainState } from "@assistant-ui/react-langchain";
663
+
664
+ function TodoSidebar() {
665
+ const todos = useLangChainState<string[]>("todos", []);
666
+ return <ul>{todos.map((t) => <li key={t}>{t}</li>)}</ul>;
667
+ }
668
+ ```
669
+
670
+ The second argument is an optional default value. The hook re-renders whenever the state key changes during a stream.
671
+
515
672
  ## Best Practices
516
673
 
517
- 1. **Use Tools() API**: Always prefer the `Tools()` API over legacy component/hook-based registration
674
+ 1. **Pick one registration style per tool**: avoid registering the same tool through both the `Tools()` toolkit and a component-based API; both routes will register, and duplicates are rejected
518
675
  2. **Centralize Definitions**: Keep all tools in a toolkit file for easy management
519
676
  3. **Clear Descriptions**: Write descriptive tool descriptions that help the LLM understand when to use each tool
520
677
  4. **Parameter Validation**: Use Zod schemas to ensure type safety
@@ -524,9 +681,9 @@ export async function POST(req: Request) {
524
681
  8. **Performance**: Use abort signals for cancellable operations
525
682
  9. **Testing**: Test tools in isolation and with the full assistant flow
526
683
 
527
- ## Migration from Legacy APIs
684
+ ## Switching from Component-Based to Toolkit
528
685
 
529
- To migrate from legacy APIs to the `Tools()` API:
686
+ If you prefer the toolkit shape, switching is mechanical:
530
687
 
531
688
  1. **Create a toolkit object** with all your tools
532
689
  2. **Move tool definitions** from `makeAssistantTool`/`useAssistantTool` calls into the toolkit
@@ -537,7 +694,7 @@ To migrate from legacy APIs to the `Tools()` API:
537
694
  Example migration:
538
695
 
539
696
  ```tsx
540
- // Before (Legacy)
697
+ // Component-based API
541
698
  const WeatherTool = makeAssistantTool({
542
699
  toolName: "getWeather",
543
700
  description: "Get weather",
@@ -554,7 +711,7 @@ function App() {
554
711
  );
555
712
  }
556
713
 
557
- // After (Recommended)
714
+ // Toolkit API
558
715
  const toolkit: Toolkit = {
559
716
  getWeather: {
560
717
  description: "Get weather",
@@ -1,6 +1,7 @@
1
1
  ---
2
- title: Realtime Voice
3
- description: Bidirectional realtime voice conversations with AI agents.
2
+ title: Realtime Voice Chat
3
+ description: Build bidirectional voice conversations with AI in React — realtime audio streaming, interruption handling, and visual state, integrated via assistant-ui.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  import { VoiceSample } from "@/components/docs/samples/voice";
@@ -63,6 +64,10 @@ const { connect, disconnect, mute, unmute } = useVoiceControls();
63
64
 
64
65
  ## UI Example
65
66
 
67
+ <Callout type="info">
68
+ For a ready-made control bar with a voice orb and call controls, see the [Voice component](/docs/ui/voice).
69
+ </Callout>
70
+
66
71
  ```tsx
67
72
  import { useVoiceState, useVoiceControls } from "@assistant-ui/react";
68
73
  import { PhoneIcon, PhoneOffIcon, MicIcon, MicOffIcon } from "lucide-react";
@@ -301,6 +306,40 @@ const runtime = useChatRuntime({
301
306
  });
302
307
  ```
303
308
 
309
+ ## Using `createVoiceSession`
310
+
311
+ `createVoiceSession` is a helper that eliminates the manual `Set<callback>` boilerplate shown in the ElevenLabs example above. Pass it an async `setup` function that receives a `helpers` object and returns `{ disconnect, mute, unmute }`. The helper wires up all callback sets, status tracking, and abort-signal handling for you.
312
+
313
+ ```tsx title="lib/my-voice-adapter.ts"
314
+ import { createVoiceSession, type RealtimeVoiceAdapter } from "@assistant-ui/react";
315
+
316
+ export class MyVoiceAdapter implements RealtimeVoiceAdapter {
317
+ connect(options: { abortSignal?: AbortSignal }): RealtimeVoiceAdapter.Session {
318
+ return createVoiceSession(options, async (helpers) => {
319
+ // Connect to your provider
320
+ const client = await MyVoiceClient.connect();
321
+
322
+ client.on("open", () => helpers.setStatus({ type: "running" }));
323
+ client.on("close", () => helpers.end("finished"));
324
+ client.on("error", (err) => helpers.end("error", err));
325
+
326
+ client.on("transcript", (item) => helpers.emitTranscript(item));
327
+ client.on("mode", (mode) => helpers.emitMode(mode));
328
+ client.on("volume", (v) => helpers.emitVolume(v));
329
+
330
+ // Return controls — createVoiceSession calls these on disconnect/mute/unmute
331
+ return {
332
+ disconnect: () => client.close(),
333
+ mute: () => client.setMuted(true),
334
+ unmute: () => client.setMuted(false),
335
+ };
336
+ });
337
+ }
338
+ }
339
+ ```
340
+
341
+ The `helpers` object exposes `setStatus`, `end`, `emitTranscript`, `emitMode`, `emitVolume`, and `isDisposed`. When `isDisposed()` is true the session has been torn down and you can skip further event handling.
342
+
304
343
  ## Example: LiveKit
305
344
 
306
345
  [LiveKit](https://livekit.io/) provides realtime voice via WebRTC rooms with transcription support. Unlike fully-hosted agent services, LiveKit follows a "bring-your-own-agent" model: the browser adapter only joins a room, and you run a separate **agent worker** that joins the same room and handles STT, LLM, and TTS. Without an agent in the room, the client will connect successfully but have nothing to talk to.
@@ -1,10 +1,46 @@
1
1
  ---
2
2
  title: Adapters
3
- description: Title generation adapters for React Ink.
3
+ description: Title generation and storage adapters for React Ink.
4
4
  ---
5
5
 
6
6
  Adapters customize runtime behavior. They can be passed as options to `useLocalRuntime` or `useRemoteThreadListRuntime`.
7
7
 
8
+ ## createFileStorageAdapter
9
+
10
+ A `RemoteThreadListAdapter` that persists threads and messages to a local directory. See [Custom Backend → Option 2](/docs/ink/custom-backend#option-2-local-file-persistence) for usage.
11
+
12
+ ```ts
13
+ import { createFileStorageAdapter } from "@assistant-ui/react-ink";
14
+
15
+ const adapter = createFileStorageAdapter({
16
+ dir: "/path/to/threads",
17
+ });
18
+ ```
19
+
20
+ ## TitleGenerationAdapter
21
+
22
+ Produces a thread title from a thread's messages. Pass one as the `titleGenerator` option to `createFileStorageAdapter`, or call it from a custom `RemoteThreadListAdapter`.
23
+
24
+ ```ts
25
+ type TitleGenerationAdapter = {
26
+ generateTitle(messages: readonly ThreadMessage[]): Promise<string>;
27
+ };
28
+ ```
29
+
30
+ `createSimpleTitleAdapter` is the built-in implementation; it derives the title from the first user message, truncated to 50 characters.
31
+
32
+ ```ts
33
+ import {
34
+ createFileStorageAdapter,
35
+ createSimpleTitleAdapter,
36
+ } from "@assistant-ui/react-ink";
37
+
38
+ const adapter = createFileStorageAdapter({
39
+ dir: "/path/to/threads",
40
+ titleGenerator: createSimpleTitleAdapter(),
41
+ });
42
+ ```
43
+
8
44
  ## RemoteThreadListAdapter
9
45
 
10
46
  Title generation is configured via the `generateTitle` method on `RemoteThreadListAdapter`. See the [Custom Backend](/docs/ink/custom-backend) page for a full example.
@@ -59,7 +59,57 @@ This gives you:
59
59
  - In-memory thread list (lost on process exit)
60
60
  - Multi-thread support
61
61
 
62
- ## Option 2: Full backend thread management
62
+ ## Option 2: Local file persistence
63
+
64
+ When you want threads and messages to survive across sessions without running a backend, use `createFileStorageAdapter`. It writes each thread to a JSON file on disk and plugs into `useRemoteThreadListRuntime`.
65
+
66
+ ```tsx title="app.tsx"
67
+ import { join } from "node:path";
68
+ import { homedir } from "node:os";
69
+ import {
70
+ useLocalRuntime,
71
+ useRemoteThreadListRuntime,
72
+ createFileStorageAdapter,
73
+ AssistantRuntimeProvider,
74
+ } from "@assistant-ui/react-ink";
75
+ import { myChatAdapter } from "./adapters/my-chat-adapter.js";
76
+
77
+ const threadListAdapter = createFileStorageAdapter({
78
+ dir: join(homedir(), ".my-cli", "threads"),
79
+ });
80
+
81
+ function useAppRuntime() {
82
+ return useRemoteThreadListRuntime({
83
+ runtimeHook: () => useLocalRuntime(myChatAdapter),
84
+ adapter: threadListAdapter,
85
+ });
86
+ }
87
+
88
+ export function App() {
89
+ const runtime = useAppRuntime();
90
+ return (
91
+ <AssistantRuntimeProvider runtime={runtime}>
92
+ {/* your chat UI */}
93
+ </AssistantRuntimeProvider>
94
+ );
95
+ }
96
+ ```
97
+
98
+ Writes are atomic (temp file + `rename`), so a crash mid-write cannot leave a partial JSON file. The directory is created lazily on first write.
99
+
100
+ ### Options
101
+
102
+ | Option | Description |
103
+ |---|---|
104
+ | `dir` | Directory where thread files are stored. Created if missing. |
105
+ | `prefix` | Key prefix for stored files. Defaults to `@assistant-ui:`. Useful when two apps share a directory. |
106
+ | `titleGenerator` | Optional [`TitleGenerationAdapter`](/docs/ink/adapters#titlegenerationadapter) that auto-generates thread titles from the first messages. Pass `createSimpleTitleAdapter()` for the built-in implementation. |
107
+
108
+ ### When this fits
109
+
110
+ Designed for single-process terminal apps where one user has one CLI running at a time. The wrapped read-modify-write on the thread list isn't lock-safe, so two CLI processes pointed at the same directory can lose updates to thread metadata (rename, archive). If that's your scenario, use Option 3 instead.
111
+
112
+ ## Option 3: Full backend thread management
63
113
 
64
114
  When you want your backend to own thread state (e.g. for persistence across sessions, team sharing, or server-side history), implement a `RemoteThreadListAdapter`.
65
115
 
@@ -194,10 +244,11 @@ export function App() {
194
244
 
195
245
  ## Which option to choose?
196
246
 
197
- | | Option 1: ChatModelAdapter | Option 2: RemoteThreadListAdapter |
198
- |---|---|---|
199
- | **Thread storage** | In-memory (process lifetime) | Your backend |
200
- | **Message storage** | In-memory | On-device (can add history adapter for server-side) |
201
- | **Cross-session persistence** | No | Yes |
202
- | **Setup complexity** | Minimal | Moderate |
203
- | **Best for** | CLI tools, demos, prototypes | Production apps with persistence |
247
+ | | Option 1: ChatModelAdapter | Option 2: createFileStorageAdapter | Option 3: RemoteThreadListAdapter |
248
+ |---|---|---|---|
249
+ | **Thread storage** | In-memory (process lifetime) | Local disk | Your backend |
250
+ | **Message storage** | In-memory | Local disk | In-memory (can add history adapter for server-side) |
251
+ | **Cross-session persistence** | No | Yes | Yes |
252
+ | **Multi-process safe** | N/A | No | Depends on backend |
253
+ | **Setup complexity** | Minimal | Minimal | Moderate |
254
+ | **Best for** | Demos, prototypes | Local CLI tools | Production apps with sync / team sharing |
@@ -1,6 +1,6 @@
1
1
  ---
2
- title: Getting Started
3
- description: Build AI chat interfaces for the terminal with @assistant-ui/react-ink.
2
+ title: Terminal AI Chat with Ink
3
+ description: Build AI chat interfaces for the terminal in TypeScript with @assistant-ui/react-ink — streaming, tool calls, and keyboard navigation in CLI apps.
4
4
  ---
5
5
 
6
6
  ## Quick Start
@@ -47,9 +47,7 @@ If you prefer to add assistant-ui to an existing Node.js project, follow these s
47
47
 
48
48
  ### Install dependencies
49
49
 
50
- ```sh
51
- npm install @assistant-ui/react-ink @assistant-ui/react-ink-markdown ink react
52
- ```
50
+ <InstallCommand npm={["@assistant-ui/react-ink", "@assistant-ui/react-ink-markdown", "ink", "react"]} />
53
51
 
54
52
  </Step>
55
53
  <Step>
@@ -131,6 +129,7 @@ import { Box, Text } from "ink";
131
129
  import {
132
130
  ThreadPrimitive,
133
131
  ComposerPrimitive,
132
+ LoadingPrimitive,
134
133
  useAuiState,
135
134
  } from "@assistant-ui/react-ink";
136
135
  import { MarkdownText } from "@assistant-ui/react-ink-markdown";
@@ -160,15 +159,13 @@ const Message = () => {
160
159
  );
161
160
  };
162
161
 
163
- const StatusIndicator = () => {
164
- const isRunning = useAuiState((s) => s.thread.isRunning);
165
- if (!isRunning) return null;
166
- return (
167
- <Box marginBottom={1}>
168
- <Text color="yellow">Thinking...</Text>
169
- </Box>
170
- );
171
- };
162
+ const StatusIndicator = () => (
163
+ <LoadingPrimitive.Root marginBottom={1} gap={1}>
164
+ <LoadingPrimitive.Spinner variant="bar" />
165
+ <LoadingPrimitive.Text />
166
+ <LoadingPrimitive.ElapsedTime />
167
+ </LoadingPrimitive.Root>
168
+ );
172
169
 
173
170
  export const Thread = () => {
174
171
  return (
@@ -30,9 +30,7 @@ If you already have an assistant-ui web app, most of your code transfers directl
30
30
 
31
31
  ### Install the React Ink package
32
32
 
33
- ```sh
34
- npm install @assistant-ui/react-ink ink react
35
- ```
33
+ <InstallCommand npm={["@assistant-ui/react-ink", "ink", "react"]} />
36
34
 
37
35
  </Step>
38
36
  <Step>