@assistant-ui/mcp-docs-server 0.1.24 → 0.1.25

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 (135) hide show
  1. package/.docs/organized/code-examples/waterfall.md +4 -2
  2. package/.docs/organized/code-examples/with-a2a.md +676 -0
  3. package/.docs/organized/code-examples/with-ag-ui.md +5 -6
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +27 -15
  5. package/.docs/organized/code-examples/with-artifacts.md +4 -4
  6. package/.docs/organized/code-examples/with-assistant-transport.md +2 -2
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +33 -25
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +9 -6
  9. package/.docs/organized/code-examples/with-cloud.md +4 -4
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +6 -6
  11. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +7 -7
  12. package/.docs/organized/code-examples/with-expo.md +565 -514
  13. package/.docs/organized/code-examples/with-external-store.md +2 -2
  14. package/.docs/organized/code-examples/with-ffmpeg.md +4 -4
  15. package/.docs/organized/code-examples/with-google-adk.md +353 -0
  16. package/.docs/organized/code-examples/with-heat-graph.md +304 -0
  17. package/.docs/organized/code-examples/with-langgraph.md +24 -22
  18. package/.docs/organized/code-examples/with-parent-id-grouping.md +3 -3
  19. package/.docs/organized/code-examples/with-react-hook-form.md +4 -4
  20. package/.docs/organized/code-examples/with-react-ink.md +265 -0
  21. package/.docs/organized/code-examples/with-react-router.md +5 -5
  22. package/.docs/organized/code-examples/with-store.md +28 -17
  23. package/.docs/organized/code-examples/with-tanstack.md +7 -7
  24. package/.docs/organized/code-examples/with-tap-runtime.md +5 -3
  25. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
  26. package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
  27. package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
  28. package/.docs/raw/docs/(docs)/cli.mdx +14 -9
  29. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
  30. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
  31. package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
  32. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
  33. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
  34. package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
  35. package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
  36. package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
  37. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
  38. package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
  39. package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
  40. package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
  41. package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
  42. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
  43. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
  44. package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
  45. package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
  46. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
  47. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
  48. package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
  49. package/.docs/raw/docs/(docs)/index.mdx +3 -3
  50. package/.docs/raw/docs/(docs)/installation.mdx +69 -46
  51. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
  52. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
  53. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
  63. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
  64. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
  65. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
  66. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
  67. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
  68. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
  69. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
  70. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
  71. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
  72. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
  73. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
  74. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
  75. package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
  76. package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
  77. package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
  78. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
  79. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
  80. package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
  81. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +84 -6
  82. package/.docs/raw/docs/cloud/ai-sdk.mdx +14 -4
  83. package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
  84. package/.docs/raw/docs/ink/adapters.mdx +41 -0
  85. package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
  86. package/.docs/raw/docs/ink/hooks.mdx +448 -0
  87. package/.docs/raw/docs/ink/index.mdx +239 -0
  88. package/.docs/raw/docs/ink/migration.mdx +140 -0
  89. package/.docs/raw/docs/ink/primitives.mdx +699 -0
  90. package/.docs/raw/docs/react-native/adapters.mdx +63 -87
  91. package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
  92. package/.docs/raw/docs/react-native/hooks.mdx +214 -232
  93. package/.docs/raw/docs/react-native/index.mdx +118 -159
  94. package/.docs/raw/docs/react-native/migration.mdx +144 -0
  95. package/.docs/raw/docs/react-native/primitives.mdx +431 -302
  96. package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
  97. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
  98. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
  99. package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
  100. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
  101. package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
  102. package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
  103. package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
  104. package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
  105. package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
  106. package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
  107. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
  108. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
  109. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
  110. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
  111. package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
  112. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
  113. package/.docs/raw/docs/ui/file.mdx +5 -4
  114. package/.docs/raw/docs/ui/image.mdx +5 -4
  115. package/.docs/raw/docs/ui/markdown.mdx +3 -1
  116. package/.docs/raw/docs/ui/model-selector.mdx +8 -8
  117. package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
  118. package/.docs/raw/docs/ui/quote.mdx +210 -0
  119. package/.docs/raw/docs/ui/reasoning.mdx +12 -11
  120. package/.docs/raw/docs/ui/sources.mdx +88 -17
  121. package/.docs/raw/docs/ui/streamdown.mdx +16 -7
  122. package/.docs/raw/docs/ui/thread-list.mdx +11 -13
  123. package/.docs/raw/docs/ui/thread.mdx +28 -33
  124. package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
  125. package/.docs/raw/docs/ui/tool-group.mdx +9 -8
  126. package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
  127. package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
  128. package/package.json +4 -4
  129. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
  130. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
  131. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
  132. package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
  133. package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
  134. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
  135. /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
@@ -15,9 +15,11 @@ const Thread = () => (
15
15
  <ThreadPrimitive.Root>
16
16
  <ThreadPrimitive.Viewport>
17
17
  <AuiIf condition={(s) => s.thread.isEmpty}>...</AuiIf>
18
- <ThreadPrimitive.Messages components={...} />
18
+ <ThreadPrimitive.Messages>{...}</ThreadPrimitive.Messages>
19
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0">
20
+ <Composer />
21
+ </ThreadPrimitive.ViewportFooter>
19
22
  </ThreadPrimitive.Viewport>
20
- <Composer />
21
23
  </ThreadPrimitive.Root>
22
24
  );
23
25
  ```
@@ -26,7 +28,7 @@ const Thread = () => (
26
28
 
27
29
  ### Root
28
30
 
29
- Containts all parts of the thread.
31
+ Contains all parts of the thread.
30
32
 
31
33
  This primitive renders a `<div>` element unless `asChild` is set.
32
34
 
@@ -54,9 +56,62 @@ This primitive renders a `<div>` element unless `asChild` is set.
54
56
  {
55
57
  name: "autoScroll",
56
58
  type: "boolean",
59
+ default: 'true (false when turnAnchor is "top")',
60
+ description:
61
+ "Whether to automatically scroll to the bottom of the viewport when new messages are added while the viewport was previously scrolled to the bottom.",
62
+ },
63
+ {
64
+ name: "turnAnchor",
65
+ type: '"top" | "bottom"',
66
+ default: '"bottom"',
67
+ description:
68
+ 'Controls scroll anchoring behavior for new messages. "bottom" is the classic chat behavior where messages anchor at the bottom. "top" anchors new user messages at the top of the viewport for a focused reading experience.',
69
+ },
70
+ {
71
+ name: "scrollToBottomOnRunStart",
72
+ type: "boolean",
73
+ default: "true",
74
+ description: "Whether to scroll to bottom when a new run starts.",
75
+ },
76
+ {
77
+ name: "scrollToBottomOnInitialize",
78
+ type: "boolean",
57
79
  default: "true",
58
80
  description:
59
- "Whether to automatically scroll to the bottom of the viewport when new messages are added while the viewport is was previously scrolled to the bottom.",
81
+ "Whether to scroll to bottom when thread history is first loaded.",
82
+ },
83
+ {
84
+ name: "scrollToBottomOnThreadSwitch",
85
+ type: "boolean",
86
+ default: "true",
87
+ description:
88
+ "Whether to scroll to bottom when switching to a different thread.",
89
+ },
90
+ ]}
91
+ />
92
+
93
+ ### ViewportFooter
94
+
95
+ A footer container placed inside `ThreadPrimitive.Viewport` that measures its own height (including top margin) and reports it to the viewport context. The viewport uses this measurement in scroll calculations — for example, as the minimum height for `ViewportSlack` — so that the scroll-to-bottom behaviour accounts for any sticky footer overlapping the message list.
96
+
97
+ Multiple `ViewportFooter` components may be used; their heights are summed.
98
+
99
+ This primitive renders a `<div>` element unless `asChild` is set.
100
+
101
+ ```tsx
102
+ <ThreadPrimitive.Viewport>
103
+ <ThreadPrimitive.Messages>{...}</ThreadPrimitive.Messages>
104
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0">
105
+ <Composer />
106
+ </ThreadPrimitive.ViewportFooter>
107
+ </ThreadPrimitive.Viewport>
108
+ ```
109
+
110
+ <ParametersTable
111
+ type="ThreadPrimitiveViewportFooterProps"
112
+ parameters={[
113
+ {
114
+ name: "asChild",
60
115
  },
61
116
  ]}
62
117
  />
@@ -86,16 +141,39 @@ Renders all messages. This primitive renders a separate component for each messa
86
141
  type: "ComponentType",
87
142
  description: "The component to render for user messages.",
88
143
  },
144
+ {
145
+ name: "AssistantMessage",
146
+ type: "ComponentType",
147
+ description: "The component to render for assistant messages.",
148
+ },
149
+ {
150
+ name: "SystemMessage",
151
+ type: "ComponentType",
152
+ description: "The component to render for system messages.",
153
+ },
89
154
  {
90
155
  name: "EditComposer",
91
156
  type: "ComponentType",
92
157
  description:
93
- "The component to render for user messages that are being edited.",
158
+ "The component to render when any message type is being edited. Used as a fallback when a role-specific edit composer is not provided.",
94
159
  },
95
160
  {
96
- name: "AssistantMessage",
161
+ name: "UserEditComposer",
97
162
  type: "ComponentType",
98
- description: "The component to render for assistant messages.",
163
+ description:
164
+ "The component to render when a user message is being edited. Takes precedence over EditComposer for user messages.",
165
+ },
166
+ {
167
+ name: "AssistantEditComposer",
168
+ type: "ComponentType",
169
+ description:
170
+ "The component to render when an assistant message is being edited. Takes precedence over EditComposer for assistant messages.",
171
+ },
172
+ {
173
+ name: "SystemEditComposer",
174
+ type: "ComponentType",
175
+ description:
176
+ "The component to render when a system message is being edited. Takes precedence over EditComposer for system messages.",
99
177
  },
100
178
  ],
101
179
  },
@@ -109,13 +187,9 @@ Renders all messages. This primitive renders a separate component for each messa
109
187
  Renders a single message at the specified index in the current thread.
110
188
 
111
189
  ```tsx
112
- <ThreadPrimitive.MessageByIndex
113
- index={0}
114
- components={{
115
- UserMessage: MyUserMessage,
116
- AssistantMessage: MyAssistantMessage
117
- }}
118
- />
190
+ <ThreadPrimitive.MessageByIndex index={0}>
191
+ {({ message }) => message.role === "user" ? <MyUserMessage /> : <MyAssistantMessage />}
192
+ </ThreadPrimitive.MessageByIndex>
119
193
  ```
120
194
 
121
195
  <ParametersTable
@@ -145,16 +219,39 @@ Renders a single message at the specified index in the current thread.
145
219
  type: "ComponentType",
146
220
  description: "The component to render for user messages.",
147
221
  },
222
+ {
223
+ name: "AssistantMessage",
224
+ type: "ComponentType",
225
+ description: "The component to render for assistant messages.",
226
+ },
227
+ {
228
+ name: "SystemMessage",
229
+ type: "ComponentType",
230
+ description: "The component to render for system messages.",
231
+ },
148
232
  {
149
233
  name: "EditComposer",
150
234
  type: "ComponentType",
151
235
  description:
152
- "The component to render for user messages that are being edited.",
236
+ "The component to render when any message type is being edited. Used as a fallback when a role-specific edit composer is not provided.",
153
237
  },
154
238
  {
155
- name: "AssistantMessage",
239
+ name: "UserEditComposer",
156
240
  type: "ComponentType",
157
- description: "The component to render for assistant messages.",
241
+ description:
242
+ "The component to render when a user message is being edited. Takes precedence over EditComposer for user messages.",
243
+ },
244
+ {
245
+ name: "AssistantEditComposer",
246
+ type: "ComponentType",
247
+ description:
248
+ "The component to render when an assistant message is being edited. Takes precedence over EditComposer for assistant messages.",
249
+ },
250
+ {
251
+ name: "SystemEditComposer",
252
+ type: "ComponentType",
253
+ description:
254
+ "The component to render when a system message is being edited. Takes precedence over EditComposer for system messages.",
158
255
  },
159
256
  ],
160
257
  },
@@ -165,6 +262,10 @@ Renders a single message at the specified index in the current thread.
165
262
 
166
263
  ### Empty
167
264
 
265
+ <Callout type="warn">
266
+ **Deprecated.** Use `<AuiIf condition={(s) => s.thread.isEmpty}>` instead.
267
+ </Callout>
268
+
168
269
  Renders children only when there are no messages.
169
270
 
170
271
  ### ScrollToBottom
@@ -179,6 +280,54 @@ This primitive renders a `<button>` element unless `asChild` is set.
179
280
  {
180
281
  name: "asChild",
181
282
  },
283
+ {
284
+ name: "behavior",
285
+ type: '"auto" | "instant" | "smooth"',
286
+ description:
287
+ "The scroll behavior to use when scrolling to the bottom. Passed to the browser's scrollIntoView API.",
288
+ },
289
+ ]}
290
+ />
291
+
292
+ ### Suggestion
293
+
294
+ A button that applies a suggestion prompt to the composer. When clicked, it sets the composer text to the given prompt and optionally sends the message immediately.
295
+
296
+ This primitive renders a `<button>` element unless `asChild` is set.
297
+
298
+ ```tsx
299
+ <ThreadPrimitive.Suggestion prompt="Tell me a joke" send>
300
+ Tell me a joke
301
+ </ThreadPrimitive.Suggestion>
302
+ ```
303
+
304
+ <ParametersTable
305
+ type="ThreadPrimitiveSuggestionProps"
306
+ parameters={[
307
+ {
308
+ name: "prompt",
309
+ type: "string",
310
+ required: true,
311
+ description:
312
+ "The text to place in the composer when this suggestion is activated.",
313
+ },
314
+ {
315
+ name: "send",
316
+ type: "boolean",
317
+ default: "false",
318
+ description:
319
+ "When true, immediately sends the message instead of only populating the composer.",
320
+ },
321
+ {
322
+ name: "clearComposer",
323
+ type: "boolean",
324
+ default: "true",
325
+ description:
326
+ "When send is false, determines whether the composer text is replaced by the prompt (true) or appended to it (false).",
327
+ },
328
+ {
329
+ name: "asChild",
330
+ },
182
331
  ]}
183
332
  />
184
333
 
@@ -192,11 +341,9 @@ import { ThreadPrimitive, SuggestionPrimitive } from "@assistant-ui/react";
192
341
  const SuggestionsList = () => {
193
342
  return (
194
343
  <div className="grid grid-cols-2 gap-2">
195
- <ThreadPrimitive.Suggestions
196
- components={{
197
- Suggestion: SuggestionItem,
198
- }}
199
- />
344
+ <ThreadPrimitive.Suggestions>
345
+ {() => <SuggestionItem />}
346
+ </ThreadPrimitive.Suggestions>
200
347
  </div>
201
348
  );
202
349
  };
@@ -3,16 +3,26 @@ title: AssistantRuntime
3
3
  description: Root runtime for managing threads, tool UIs, and assistant state.
4
4
  ---
5
5
 
6
- import { AssistantRuntime, AssistantToolUIsState } from "@/generated/typeDocs";
6
+ import { AssistantRuntime } from "@/generated/typeDocs";
7
7
 
8
8
  The `AssistantRuntime` is the root runtime of the application.
9
9
 
10
- ### `useAssistantRuntime`
10
+ ### `useAui`
11
+
12
+ Access the assistant runtime via `useAui`:
11
13
 
12
14
  ```tsx
13
- import { useAssistantRuntime } from "@assistant-ui/react";
15
+ import { useAui } from "@assistant-ui/react";
16
+
17
+ const aui = useAui();
18
+
19
+ // Thread management
20
+ aui.threads().switchToNewThread();
21
+ aui.threads().switchToThread(threadId);
14
22
 
15
- const runtime = useAssistantRuntime();
23
+ // Thread actions
24
+ aui.thread().cancelRun();
25
+ aui.thread().append(message);
16
26
  ```
17
27
 
18
28
  <ParametersTable {...AssistantRuntime} />
@@ -3,44 +3,33 @@ title: AttachmentRuntime
3
3
  description: Hooks for accessing attachment state in composer and messages.
4
4
  ---
5
5
 
6
- import {
7
- ComposerAttachmentState,
8
- MessageAttachmentState,
9
- } from "@/components/docs/parameters-table.context";
6
+ import { AttachmentRuntime, AttachmentState } from "@/generated/typeDocs";
10
7
 
11
- ### `useAttachment`
8
+ ### `useAuiState` (Attachment State)
12
9
 
13
- Access the current attachment state:
10
+ Access the current attachment state reactively:
14
11
 
15
12
  ```tsx
16
- import { useAttachment } from "@assistant-ui/react";
13
+ import { useAuiState } from "@assistant-ui/react";
17
14
 
18
- const { attachment } = useAttachment();
19
- const att = useAttachment((m) => m.attachment);
15
+ const name = useAuiState((s) => s.attachment.name);
16
+ const type = useAuiState((s) => s.attachment.type);
20
17
  ```
21
18
 
22
- ### `useComposerAttachment` (Composer)
23
-
24
- When working with a composer’s attachment:
19
+ For imperative access and actions, use `useAui`:
25
20
 
26
21
  ```tsx
27
- import { useComposerAttachment } from "@assistant-ui/react";
22
+ import { useAui } from "@assistant-ui/react";
28
23
 
29
- const { attachment } = useComposerAttachment();
30
- const composerAttachment = useComposerAttachment((m) => m.attachment);
24
+ const aui = useAui();
25
+ aui.attachment().remove();
26
+ const state = aui.attachment().getState();
31
27
  ```
32
28
 
33
- <ParametersTable {...ComposerAttachmentState} />
34
-
35
- ### `useMessageAttachment` (Message)
29
+ ### Attachment Runtime
36
30
 
37
- For managing a message’s attachment:
31
+ <ParametersTable {...AttachmentRuntime} />
38
32
 
39
- ```tsx
40
- import { useMessageAttachment } from "@assistant-ui/react";
41
-
42
- const { attachment } = useMessageAttachment();
43
- const messageAttachment = useMessageAttachment((m) => m.attachment);
44
- ```
33
+ ### Attachment State
45
34
 
46
- <ParametersTable {...MessageAttachmentState} />
35
+ <ParametersTable {...AttachmentState} />
@@ -5,26 +5,26 @@ description: Runtime for programmatically controlling the message composer.
5
5
 
6
6
  The composer runtime allows you to view or edit anything related to how new information is added and sent. For instance you can use the composer runtime to read the state, add attachments, update text, send a message, etc.
7
7
 
8
- import { ComposerRuntime, ThreadComposerRuntime, ThreadComposerState, EditComposerState } from "@/generated/typeDocs";
8
+ import { ComposerRuntime, ThreadComposerRuntime, EditComposerRuntime, ThreadComposerState } from "@/generated/typeDocs";
9
9
 
10
- ### `useComposerRuntime`
10
+ ### `useAui` (Composer Actions)
11
11
 
12
- Grabs the nearest composer (whether it’s the edit composer or the thread’s composer):
12
+ Grabs the nearest composer (whether it’s the edit composer or the thread’s composer) via `useAui`:
13
13
 
14
14
  ```tsx
15
15
  // Example
16
- import { useComposerRuntime } from "@assistant-ui/react";
16
+ import { useAui } from "@assistant-ui/react";
17
17
 
18
- const composerRuntime = useComposerRuntime();
18
+ const aui = useAui();
19
19
 
20
20
  // set the text
21
- composerRuntime.setText("Hello from the composer runtime");
21
+ aui.composer().setText("Hello from the composer");
22
22
 
23
23
  // send whatever is in the composer
24
- composerRuntime.send();
24
+ aui.composer().send();
25
25
 
26
26
  // get the current text in the composer state
27
- const composerState = composerRuntime.getState();
27
+ const composerState = aui.composer().getState();
28
28
  const currentText = composerState.text;
29
29
 
30
30
  ```
@@ -32,38 +32,56 @@ const currentText = composerState.text;
32
32
  <ParametersTable {...ComposerRuntime} />
33
33
 
34
34
 
35
- ### `useThreadComposer`
35
+ ### `useAuiState` (Thread Composer State)
36
36
 
37
37
  Access the thread’s new message composer state:
38
38
 
39
39
  ```tsx
40
- import { useThreadComposer } from "@assistant-ui/react";
40
+ import { useAuiState, useAui } from "@assistant-ui/react";
41
41
 
42
- const threadComposerRuntime = useThreadComposer();
42
+ const text = useAuiState((s) => s.composer.text);
43
+ const isEmpty = useAuiState((s) => s.composer.isEmpty);
44
+
45
+ // For actions, use useAui
46
+ const aui = useAui();
43
47
 
44
48
  // set the text
45
- threadComposerRuntime.setText("Hello from the thread composer runtime");
49
+ aui.composer().setText("Hello from the thread composer");
46
50
 
47
51
  // send whatever is in the thread composer
48
- threadComposerRuntime.send();
49
-
50
- // get the current text in the composer state
51
- const threadComposerState = threadComposerRuntime.getState();
52
- const currentText = threadComposerRuntime.text;
52
+ aui.composer().send();
53
53
 
54
54
  ```
55
55
 
56
56
  <ParametersTable {...ThreadComposerRuntime} />
57
57
 
58
58
 
59
+ ### `useAui` (Edit Composer Actions)
60
+
61
+ Access edit composer actions via `useAui` from within a message component:
62
+
63
+ ```tsx
64
+ import { useAui } from "@assistant-ui/react";
65
+
66
+ const aui = useAui();
67
+
68
+ // Begin editing the current message (populates the composer with its content)
69
+ aui.message().composer().beginEdit();
70
+
71
+ // Update the text and send the edit
72
+ aui.message().composer().setText("Updated message text");
73
+ aui.message().composer().send();
74
+
75
+ // Cancel editing without saving
76
+ aui.message().composer().cancel();
77
+ ```
78
+
79
+ <ParametersTable {...EditComposerRuntime} />
80
+
59
81
  ### `ThreadComposerState`
60
82
 
61
83
  The state of the thread composer which is the composer the user can interact with at the bottom.
62
84
 
63
85
  <ParametersTable {...ThreadComposerState} />
64
86
 
65
- ### `EditComposerState`
66
-
67
- The state of the edit composer which is the composer the user can edit messages with.
68
87
 
69
- <ParametersTable {...EditComposerState} />
@@ -3,20 +3,44 @@ title: MessagePartRuntime
3
3
  description: Hook for accessing message part state within parts.
4
4
  ---
5
5
 
6
- import { MessagePartState } from "@/components/docs/parameters-table.context";
6
+ import { MessagePartRuntime, TextMessagePartState } from "@/generated/typeDocs";
7
7
 
8
- ### `useMessagePart`
8
+ ### `useAui` (Message Part Actions)
9
9
 
10
- Access the message part state:
10
+ Access message part actions via `useAui`:
11
11
 
12
12
  ```tsx
13
- import { useMessagePart } from "@assistant-ui/react";
13
+ import { useAui } from "@assistant-ui/react";
14
14
 
15
- const part = useMessagePart();
16
- const partState = useMessagePart.getState();
15
+ const aui = useAui();
17
16
 
18
- const status = useMessagePart((m) => m.status);
19
- const statusAgain = useMessagePart.getState().status;
17
+ // Add a tool result to a tool-call message part
18
+ aui.part().addToolResult({ result: "Tool output" });
19
+
20
+ // Resume an interrupted tool call
21
+ aui.part().resumeToolCall({ approved: true });
22
+ ```
23
+
24
+ <ParametersTable {...MessagePartRuntime} />
25
+
26
+ ### `useAuiState` (Message Part State)
27
+
28
+ Access the message part state reactively:
29
+
30
+ ```tsx
31
+ import { useAuiState } from "@assistant-ui/react";
32
+
33
+ const status = useAuiState((s) => s.part.status);
34
+ const type = useAuiState((s) => s.part.type);
35
+ ```
36
+
37
+ For imperative access, use `useAui`:
38
+
39
+ ```tsx
40
+ import { useAui } from "@assistant-ui/react";
41
+
42
+ const aui = useAui();
43
+ const partState = aui.part().getState();
20
44
  ```
21
45
 
22
- <ParametersTable {...MessagePartState} />
46
+ <ParametersTable {...TextMessagePartState} />
@@ -1,49 +1,76 @@
1
1
  ---
2
2
  title: MessageRuntime
3
- description: Hooks for accessing message state, utilities, and edit composer.
3
+ description: Hooks for accessing message state and edit composer.
4
4
  ---
5
5
 
6
6
  import {
7
+ MessageRuntime,
7
8
  MessageState,
8
- MessageUtilsState,
9
- EditComposerState,
10
- } from "@/components/docs/parameters-table.context";
9
+ ComposerState,
10
+ } from "@/generated/typeDocs";
11
11
 
12
- ### `useMessage`
12
+ ### `useAui` (Message Actions)
13
13
 
14
- Retrieve the message object:
14
+ Access message actions via `useAui`:
15
15
 
16
16
  ```tsx
17
- import { useMessage } from "@assistant-ui/react";
17
+ import { useAui } from "@assistant-ui/react";
18
18
 
19
- const { message } = useMessage();
20
- const msg = useMessage((m) => m.message);
19
+ const aui = useAui();
20
+
21
+ // Reload an assistant message (regenerate the response)
22
+ aui.message().reload();
23
+
24
+ // Switch to the previous or next branch
25
+ aui.message().switchToBranch({ position: "previous" });
26
+ aui.message().switchToBranch({ position: "next" });
27
+
28
+ // Submit feedback on a message
29
+ aui.message().submitFeedback({ type: "positive" });
30
+ aui.message().submitFeedback({ type: "negative" });
31
+
32
+ // Get the plain-text content of the message
33
+ const text = aui.message().getCopyText();
34
+
35
+ // Access a message part by index or tool call ID
36
+ aui.message().part({ index: 0 });
37
+ aui.message().part({ toolCallId: "call_123" });
38
+
39
+ // Access an attachment by index
40
+ aui.message().attachment({ index: 0 });
41
+
42
+ // Access the edit composer for this message
43
+ aui.message().composer();
44
+
45
+ // Get a snapshot of the full message state
46
+ const state = aui.message().getState();
21
47
  ```
22
48
 
23
- <ParametersTable {...MessageState} />
49
+ <ParametersTable {...MessageRuntime} />
24
50
 
25
- ### `useMessageUtils`
51
+ ### `useAuiState` (Message State)
26
52
 
27
- Provides utility functions for a message (e.g., copy status):
53
+ Access message state reactively:
28
54
 
29
55
  ```tsx
30
- import { useMessageUtils } from "@assistant-ui/react";
56
+ import { useAuiState } from "@assistant-ui/react";
31
57
 
32
- const messageUtils = useMessageUtils();
33
- const isCopied = useMessageUtils((m) => m.isCopied);
58
+ const role = useAuiState((s) => s.message.role);
59
+ const content = useAuiState((s) => s.message.content);
60
+ const isLast = useAuiState((s) => s.message.isLast);
34
61
  ```
35
62
 
36
- <ParametersTable {...MessageUtilsState} />
63
+ <ParametersTable {...MessageState} />
37
64
 
38
- ### `useEditComposer`
65
+ ### `useAuiState` (Edit Composer)
39
66
 
40
67
  Access the edit composer state (used when editing a message):
41
68
 
42
69
  ```tsx
43
- import { useEditComposer } from "@assistant-ui/react";
70
+ import { useAuiState } from "@assistant-ui/react";
44
71
 
45
- const editComposer = useEditComposer();
46
- const text = useEditComposer((m) => m.text);
72
+ const editText = useAuiState((s) => s.message.composer.text);
73
+ const isEditing = useAuiState((s) => s.message.composer.isEditing);
47
74
  ```
48
75
 
49
- <ParametersTable {...EditComposerState} />
76
+ <ParametersTable {...ComposerState} />
@@ -8,25 +8,54 @@ import {
8
8
  ThreadListItemState,
9
9
  } from "@/generated/typeDocs";
10
10
 
11
- ### `useThreadListItemRuntime`
11
+ ### `useAui` (Thread List Item Actions)
12
+
13
+ Access thread list item actions via `useAui`:
12
14
 
13
15
  ```tsx
14
- import { useThreadListItemRuntime } from "@assistant-ui/react";
16
+ import { useAui } from "@assistant-ui/react";
17
+
18
+ const aui = useAui();
19
+
20
+ // Navigation
21
+ await aui.threadListItem().switchTo();
22
+
23
+ // Rename
24
+ await aui.threadListItem().rename("New Title");
25
+
26
+ // Archive / unarchive
27
+ await aui.threadListItem().archive();
28
+ await aui.threadListItem().unarchive();
29
+
30
+ // Delete
31
+ await aui.threadListItem().delete();
32
+
33
+ // Initialize a new thread (returns remoteId and externalId)
34
+ const { remoteId, externalId } = await aui.threadListItem().initialize();
35
+
36
+ // Auto-generate a title from thread content
37
+ await aui.threadListItem().generateTitle();
38
+
39
+ // Detach the thread list item from its thread
40
+ aui.threadListItem().detach();
15
41
 
16
- const threadListItemRuntime = useThreadListItemRuntime();
42
+ // Get current state
43
+ const state = aui.threadListItem().getState();
44
+ const { id, title, status } = state;
17
45
  ```
18
46
 
19
47
  <ParametersTable {...ThreadListItemRuntime} />
20
48
 
21
- ### `useThreadListItem`
49
+ ### `useAuiState` (Thread List Item State)
22
50
 
23
51
  Access the state for a specific thread list item:
24
52
 
25
53
  ```tsx
26
- import { useThreadListItem } from "@assistant-ui/react";
54
+ import { useAuiState } from "@assistant-ui/react";
27
55
 
28
- const threadListItem = useThreadListItem();
29
- const title = useThreadListItem((m) => m.title);
56
+ const title = useAuiState((s) => s.threadListItem.title);
57
+ const status = useAuiState((s) => s.threadListItem.status);
58
+ const id = useAuiState((s) => s.threadListItem.id);
30
59
  ```
31
60
 
32
61
  <ParametersTable {...ThreadListItemState} />