@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.
- package/.docs/organized/code-examples/waterfall.md +4 -2
- package/.docs/organized/code-examples/with-a2a.md +676 -0
- package/.docs/organized/code-examples/with-ag-ui.md +5 -6
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +27 -15
- package/.docs/organized/code-examples/with-artifacts.md +4 -4
- package/.docs/organized/code-examples/with-assistant-transport.md +2 -2
- package/.docs/organized/code-examples/with-chain-of-thought.md +33 -25
- package/.docs/organized/code-examples/with-cloud-standalone.md +9 -6
- package/.docs/organized/code-examples/with-cloud.md +4 -4
- package/.docs/organized/code-examples/with-custom-thread-list.md +6 -6
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +7 -7
- package/.docs/organized/code-examples/with-expo.md +565 -514
- package/.docs/organized/code-examples/with-external-store.md +2 -2
- package/.docs/organized/code-examples/with-ffmpeg.md +4 -4
- package/.docs/organized/code-examples/with-google-adk.md +353 -0
- package/.docs/organized/code-examples/with-heat-graph.md +304 -0
- package/.docs/organized/code-examples/with-langgraph.md +24 -22
- package/.docs/organized/code-examples/with-parent-id-grouping.md +3 -3
- package/.docs/organized/code-examples/with-react-hook-form.md +4 -4
- package/.docs/organized/code-examples/with-react-ink.md +265 -0
- package/.docs/organized/code-examples/with-react-router.md +5 -5
- package/.docs/organized/code-examples/with-store.md +28 -17
- package/.docs/organized/code-examples/with-tanstack.md +7 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -3
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
- package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
- package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
- package/.docs/raw/docs/(docs)/cli.mdx +14 -9
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
- package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
- package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
- package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
- package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
- package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
- package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
- package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
- package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
- package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
- package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
- package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
- package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
- package/.docs/raw/docs/(docs)/index.mdx +3 -3
- package/.docs/raw/docs/(docs)/installation.mdx +69 -46
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
- package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
- package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
- package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +84 -6
- package/.docs/raw/docs/cloud/ai-sdk.mdx +14 -4
- package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
- package/.docs/raw/docs/ink/adapters.mdx +41 -0
- package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
- package/.docs/raw/docs/ink/hooks.mdx +448 -0
- package/.docs/raw/docs/ink/index.mdx +239 -0
- package/.docs/raw/docs/ink/migration.mdx +140 -0
- package/.docs/raw/docs/ink/primitives.mdx +699 -0
- package/.docs/raw/docs/react-native/adapters.mdx +63 -87
- package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
- package/.docs/raw/docs/react-native/hooks.mdx +214 -232
- package/.docs/raw/docs/react-native/index.mdx +118 -159
- package/.docs/raw/docs/react-native/migration.mdx +144 -0
- package/.docs/raw/docs/react-native/primitives.mdx +431 -302
- package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
- package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
- package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
- package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
- package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
- package/.docs/raw/docs/ui/file.mdx +5 -4
- package/.docs/raw/docs/ui/image.mdx +5 -4
- package/.docs/raw/docs/ui/markdown.mdx +3 -1
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
- package/.docs/raw/docs/ui/quote.mdx +210 -0
- package/.docs/raw/docs/ui/reasoning.mdx +12 -11
- package/.docs/raw/docs/ui/sources.mdx +88 -17
- package/.docs/raw/docs/ui/streamdown.mdx +16 -7
- package/.docs/raw/docs/ui/thread-list.mdx +11 -13
- package/.docs/raw/docs/ui/thread.mdx +28 -33
- package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
- package/.docs/raw/docs/ui/tool-group.mdx +9 -8
- package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
- package/package.json +4 -4
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
- package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
- /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
|
|
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
|
-
|
|
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
|
|
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
|
|
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: "
|
|
161
|
+
name: "UserEditComposer",
|
|
97
162
|
type: "ComponentType",
|
|
98
|
-
description:
|
|
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
|
-
|
|
114
|
-
|
|
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
|
|
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: "
|
|
239
|
+
name: "UserEditComposer",
|
|
156
240
|
type: "ComponentType",
|
|
157
|
-
description:
|
|
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
|
-
|
|
197
|
-
|
|
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
|
|
6
|
+
import { AssistantRuntime } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
The `AssistantRuntime` is the root runtime of the application.
|
|
9
9
|
|
|
10
|
-
### `
|
|
10
|
+
### `useAui`
|
|
11
|
+
|
|
12
|
+
Access the assistant runtime via `useAui`:
|
|
11
13
|
|
|
12
14
|
```tsx
|
|
13
|
-
import {
|
|
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
|
-
|
|
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
|
-
### `
|
|
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 {
|
|
13
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
17
14
|
|
|
18
|
-
const
|
|
19
|
-
const
|
|
15
|
+
const name = useAuiState((s) => s.attachment.name);
|
|
16
|
+
const type = useAuiState((s) => s.attachment.type);
|
|
20
17
|
```
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
When working with a composer’s attachment:
|
|
19
|
+
For imperative access and actions, use `useAui`:
|
|
25
20
|
|
|
26
21
|
```tsx
|
|
27
|
-
import {
|
|
22
|
+
import { useAui } from "@assistant-ui/react";
|
|
28
23
|
|
|
29
|
-
const
|
|
30
|
-
|
|
24
|
+
const aui = useAui();
|
|
25
|
+
aui.attachment().remove();
|
|
26
|
+
const state = aui.attachment().getState();
|
|
31
27
|
```
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### `useMessageAttachment` (Message)
|
|
29
|
+
### Attachment Runtime
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
<ParametersTable {...AttachmentRuntime} />
|
|
38
32
|
|
|
39
|
-
|
|
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 {...
|
|
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,
|
|
8
|
+
import { ComposerRuntime, ThreadComposerRuntime, EditComposerRuntime, ThreadComposerState } from "@/generated/typeDocs";
|
|
9
9
|
|
|
10
|
-
### `
|
|
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 {
|
|
16
|
+
import { useAui } from "@assistant-ui/react";
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const aui = useAui();
|
|
19
19
|
|
|
20
20
|
// set the text
|
|
21
|
-
|
|
21
|
+
aui.composer().setText("Hello from the composer");
|
|
22
22
|
|
|
23
23
|
// send whatever is in the composer
|
|
24
|
-
|
|
24
|
+
aui.composer().send();
|
|
25
25
|
|
|
26
26
|
// get the current text in the composer state
|
|
27
|
-
const composerState =
|
|
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
|
-
### `
|
|
35
|
+
### `useAuiState` (Thread Composer State)
|
|
36
36
|
|
|
37
37
|
Access the thread’s new message composer state:
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
|
-
import {
|
|
40
|
+
import { useAuiState, useAui } from "@assistant-ui/react";
|
|
41
41
|
|
|
42
|
-
const
|
|
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
|
-
|
|
49
|
+
aui.composer().setText("Hello from the thread composer");
|
|
46
50
|
|
|
47
51
|
// send whatever is in the thread composer
|
|
48
|
-
|
|
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 {
|
|
6
|
+
import { MessagePartRuntime, TextMessagePartState } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
|
-
### `
|
|
8
|
+
### `useAui` (Message Part Actions)
|
|
9
9
|
|
|
10
|
-
Access
|
|
10
|
+
Access message part actions via `useAui`:
|
|
11
11
|
|
|
12
12
|
```tsx
|
|
13
|
-
import {
|
|
13
|
+
import { useAui } from "@assistant-ui/react";
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const partState = useMessagePart.getState();
|
|
15
|
+
const aui = useAui();
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
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 {...
|
|
46
|
+
<ParametersTable {...TextMessagePartState} />
|
|
@@ -1,49 +1,76 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MessageRuntime
|
|
3
|
-
description: Hooks for accessing message state
|
|
3
|
+
description: Hooks for accessing message state and edit composer.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
MessageRuntime,
|
|
7
8
|
MessageState,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "@/components/docs/parameters-table.context";
|
|
9
|
+
ComposerState,
|
|
10
|
+
} from "@/generated/typeDocs";
|
|
11
11
|
|
|
12
|
-
### `
|
|
12
|
+
### `useAui` (Message Actions)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Access message actions via `useAui`:
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
import {
|
|
17
|
+
import { useAui } from "@assistant-ui/react";
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
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 {...
|
|
49
|
+
<ParametersTable {...MessageRuntime} />
|
|
24
50
|
|
|
25
|
-
### `
|
|
51
|
+
### `useAuiState` (Message State)
|
|
26
52
|
|
|
27
|
-
|
|
53
|
+
Access message state reactively:
|
|
28
54
|
|
|
29
55
|
```tsx
|
|
30
|
-
import {
|
|
56
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
31
57
|
|
|
32
|
-
const
|
|
33
|
-
const
|
|
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 {...
|
|
63
|
+
<ParametersTable {...MessageState} />
|
|
37
64
|
|
|
38
|
-
### `
|
|
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 {
|
|
70
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
44
71
|
|
|
45
|
-
const
|
|
46
|
-
const
|
|
72
|
+
const editText = useAuiState((s) => s.message.composer.text);
|
|
73
|
+
const isEditing = useAuiState((s) => s.message.composer.isEditing);
|
|
47
74
|
```
|
|
48
75
|
|
|
49
|
-
<ParametersTable {...
|
|
76
|
+
<ParametersTable {...ComposerState} />
|
|
@@ -8,25 +8,54 @@ import {
|
|
|
8
8
|
ThreadListItemState,
|
|
9
9
|
} from "@/generated/typeDocs";
|
|
10
10
|
|
|
11
|
-
### `
|
|
11
|
+
### `useAui` (Thread List Item Actions)
|
|
12
|
+
|
|
13
|
+
Access thread list item actions via `useAui`:
|
|
12
14
|
|
|
13
15
|
```tsx
|
|
14
|
-
import {
|
|
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
|
-
|
|
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
|
-
### `
|
|
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 {
|
|
54
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
27
55
|
|
|
28
|
-
const
|
|
29
|
-
const
|
|
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} />
|