@assistant-ui/mcp-docs-server 0.1.23 → 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 +5 -3
- package/.docs/organized/code-examples/with-a2a.md +676 -0
- package/.docs/organized/code-examples/with-ag-ui.md +7 -8
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +28 -16
- package/.docs/organized/code-examples/with-artifacts.md +5 -5
- package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +34 -26
- package/.docs/organized/code-examples/with-cloud-standalone.md +10 -8
- package/.docs/organized/code-examples/with-cloud.md +5 -5
- package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
- package/.docs/organized/code-examples/with-expo.md +571 -539
- package/.docs/organized/code-examples/with-external-store.md +3 -4
- package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
- 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 +25 -23
- package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +6 -9
- package/.docs/organized/code-examples/with-react-ink.md +265 -0
- package/.docs/organized/code-examples/with-react-router.md +10 -11
- package/.docs/organized/code-examples/with-store.md +29 -18
- package/.docs/organized/code-examples/with-tanstack.md +7 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +6 -4
- 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 +89 -7
- package/.docs/raw/docs/cloud/ai-sdk.mdx +19 -5
- 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/ai-sdk/v6.mdx +53 -0
- 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/context-display.mdx +147 -0
- 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
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Primitives
|
|
3
|
+
description: Composable terminal components for building chat UIs with Ink.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Primitives are thin wrappers around Ink components (`Box`, `Text`, `TextInput`) that integrate with the assistant-ui runtime. They accept all standard Ink props and add runtime-aware behavior.
|
|
7
|
+
|
|
8
|
+
Primitives use namespace imports, the same pattern as the web package (e.g. `ThreadPrimitive.Root`, `ComposerPrimitive.Input`).
|
|
9
|
+
|
|
10
|
+
Many primitives share their core logic with `@assistant-ui/react` via `@assistant-ui/core/react` — only the UI layer (Ink vs DOM) differs.
|
|
11
|
+
|
|
12
|
+
## Thread
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { ThreadPrimitive } from "@assistant-ui/react-ink";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Root
|
|
19
|
+
|
|
20
|
+
Container `Box` for the thread area.
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<ThreadPrimitive.Root>
|
|
24
|
+
{children}
|
|
25
|
+
</ThreadPrimitive.Root>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Description |
|
|
29
|
+
|------|------|-------------|
|
|
30
|
+
| `...rest` | `BoxProps` | Standard Ink Box props |
|
|
31
|
+
|
|
32
|
+
### Messages
|
|
33
|
+
|
|
34
|
+
Renders the message list with automatic runtime integration. Each message is wrapped in a scoped context so that `useAuiState((s) => s.message)` works inside the message component.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<ThreadPrimitive.Messages>
|
|
38
|
+
{() => <MyMessage />}
|
|
39
|
+
</ThreadPrimitive.Messages>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Description |
|
|
43
|
+
|------|------|-------------|
|
|
44
|
+
| `components` | `MessageComponents` | Component map with `Message`, `UserMessage`, `AssistantMessage`, `SystemMessage`, and edit composer variants |
|
|
45
|
+
|
|
46
|
+
### AuiIf
|
|
47
|
+
|
|
48
|
+
Conditional rendering based on assistant state. Replaces the deprecated `ThreadPrimitive.Empty`, `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If`.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { AuiIf } from "@assistant-ui/react-ink";
|
|
52
|
+
|
|
53
|
+
<AuiIf condition={(s) => s.thread.isEmpty}>
|
|
54
|
+
<Text dimColor>Send a message to get started</Text>
|
|
55
|
+
</AuiIf>
|
|
56
|
+
|
|
57
|
+
<AuiIf condition={(s) => s.thread.isRunning}>
|
|
58
|
+
<Text color="yellow">Generating...</Text>
|
|
59
|
+
</AuiIf>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Prop | Type | Description |
|
|
63
|
+
|------|------|-------------|
|
|
64
|
+
| `condition` | `(state) => boolean` | Selector that determines whether children are rendered |
|
|
65
|
+
|
|
66
|
+
### Empty (deprecated)
|
|
67
|
+
|
|
68
|
+
<Callout type="warn">
|
|
69
|
+
Deprecated. Use `AuiIf` with `condition={(s) => s.thread.isEmpty}` instead.
|
|
70
|
+
</Callout>
|
|
71
|
+
|
|
72
|
+
Renders children only when the thread has no messages.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<ThreadPrimitive.Empty>
|
|
76
|
+
<Text dimColor>Send a message to get started</Text>
|
|
77
|
+
</ThreadPrimitive.Empty>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### If (deprecated)
|
|
81
|
+
|
|
82
|
+
<Callout type="warn">
|
|
83
|
+
Deprecated. Use `AuiIf` instead.
|
|
84
|
+
</Callout>
|
|
85
|
+
|
|
86
|
+
Conditional rendering based on thread state.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<ThreadPrimitive.If empty>
|
|
90
|
+
<Text>No messages yet</Text>
|
|
91
|
+
</ThreadPrimitive.If>
|
|
92
|
+
|
|
93
|
+
<ThreadPrimitive.If running>
|
|
94
|
+
<Text color="yellow">Generating...</Text>
|
|
95
|
+
</ThreadPrimitive.If>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| Prop | Type | Description |
|
|
99
|
+
|------|------|-------------|
|
|
100
|
+
| `empty` | `boolean` | Render when thread is empty |
|
|
101
|
+
| `running` | `boolean` | Render when thread is running |
|
|
102
|
+
|
|
103
|
+
### MessageByIndex
|
|
104
|
+
|
|
105
|
+
Low-level provider that sets up the message context for a specific message by index. Used internally by `ThreadPrimitive.Messages`.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<ThreadPrimitive.MessageByIndex index={0}>
|
|
109
|
+
{/* content rendered with message context */}
|
|
110
|
+
</ThreadPrimitive.MessageByIndex>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Prop | Type | Description |
|
|
114
|
+
|------|------|-------------|
|
|
115
|
+
| `index` | `number` | Zero-based message index |
|
|
116
|
+
|
|
117
|
+
### Suggestions
|
|
118
|
+
|
|
119
|
+
Renders all thread suggestions using a provided component. Each suggestion is wrapped in a `SuggestionByIndexProvider` context.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<ThreadPrimitive.Suggestions>
|
|
123
|
+
{() => <MySuggestion />}
|
|
124
|
+
</ThreadPrimitive.Suggestions>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Prop | Type | Description |
|
|
128
|
+
|------|------|-------------|
|
|
129
|
+
| `children` | `() => ReactElement` | Render function for each suggestion |
|
|
130
|
+
|
|
131
|
+
### SuggestionByIndex
|
|
132
|
+
|
|
133
|
+
Low-level provider that sets up the suggestion context for a specific suggestion by index. Used internally by `ThreadPrimitive.Suggestions`.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
<ThreadPrimitive.SuggestionByIndex index={0}>
|
|
137
|
+
<SuggestionPrimitive.Title />
|
|
138
|
+
</ThreadPrimitive.SuggestionByIndex>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
| Prop | Type | Description |
|
|
142
|
+
|------|------|-------------|
|
|
143
|
+
| `index` | `number` | Zero-based suggestion index |
|
|
144
|
+
|
|
145
|
+
### Suggestion
|
|
146
|
+
|
|
147
|
+
Renders a suggestion button. Uses Ink `Box` + `Text`.
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<ThreadPrimitive.Suggestion
|
|
151
|
+
prompt="What is the weather?"
|
|
152
|
+
send
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Prop | Type | Description |
|
|
157
|
+
|------|------|-------------|
|
|
158
|
+
| `prompt` | `string` | The suggestion text |
|
|
159
|
+
| `send` | `boolean` | When true, automatically sends the message |
|
|
160
|
+
| `clearComposer` | `boolean` | When true (default), replaces composer text; when false, appends |
|
|
161
|
+
|
|
162
|
+
## Composer
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { ComposerPrimitive } from "@assistant-ui/react-ink";
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Root
|
|
169
|
+
|
|
170
|
+
Container `Box` for the composer area.
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
<ComposerPrimitive.Root>
|
|
174
|
+
{children}
|
|
175
|
+
</ComposerPrimitive.Root>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Input
|
|
179
|
+
|
|
180
|
+
Ink `TextInput` wired to the composer runtime. Value is managed automatically.
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
<ComposerPrimitive.Input
|
|
184
|
+
submitOnEnter
|
|
185
|
+
placeholder="Type a message..."
|
|
186
|
+
autoFocus
|
|
187
|
+
/>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
| Prop | Type | Description |
|
|
191
|
+
|------|------|-------------|
|
|
192
|
+
| `submitOnEnter` | `boolean` | Whether Enter sends the message (default: `false`) |
|
|
193
|
+
| `placeholder` | `string` | Placeholder text when empty |
|
|
194
|
+
| `autoFocus` | `boolean` | Auto-focus on mount |
|
|
195
|
+
|
|
196
|
+
### Send
|
|
197
|
+
|
|
198
|
+
`Box` that triggers sending the current message. Typically used with a button-like UI.
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
<ComposerPrimitive.Send>
|
|
202
|
+
<Text color="green">[Send]</Text>
|
|
203
|
+
</ComposerPrimitive.Send>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Cancel
|
|
207
|
+
|
|
208
|
+
`Box` that cancels the current run.
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
<ComposerPrimitive.Cancel>
|
|
212
|
+
<Text color="red">[Stop]</Text>
|
|
213
|
+
</ComposerPrimitive.Cancel>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Attachments
|
|
217
|
+
|
|
218
|
+
Renders composer attachments using the provided component configuration.
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<ComposerPrimitive.Attachments>
|
|
222
|
+
{() => <MyAttachment />}
|
|
223
|
+
</ComposerPrimitive.Attachments>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
| Prop | Type | Description |
|
|
227
|
+
|------|------|-------------|
|
|
228
|
+
| `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
|
|
229
|
+
|
|
230
|
+
### AddAttachment
|
|
231
|
+
|
|
232
|
+
Triggers attachment addition.
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
<ComposerPrimitive.AddAttachment>
|
|
236
|
+
<Text>[Attach]</Text>
|
|
237
|
+
</ComposerPrimitive.AddAttachment>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Conditional Rendering (Composer)
|
|
241
|
+
|
|
242
|
+
Use `AuiIf` for conditional rendering based on composer state:
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
<AuiIf condition={(s) => s.composer.isEditing}>
|
|
246
|
+
<Text>Currently editing</Text>
|
|
247
|
+
</AuiIf>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### AttachmentByIndex
|
|
251
|
+
|
|
252
|
+
Low-level provider that sets up the attachment context for a specific attachment by index. Used internally by `ComposerPrimitive.Attachments`.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
<ComposerPrimitive.AttachmentByIndex index={0}>
|
|
256
|
+
<AttachmentPrimitive.Name />
|
|
257
|
+
</ComposerPrimitive.AttachmentByIndex>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
| Prop | Type | Description |
|
|
261
|
+
|------|------|-------------|
|
|
262
|
+
| `index` | `number` | Zero-based attachment index |
|
|
263
|
+
|
|
264
|
+
### If (deprecated)
|
|
265
|
+
|
|
266
|
+
<Callout type="warn">
|
|
267
|
+
Deprecated. Use `AuiIf` instead.
|
|
268
|
+
</Callout>
|
|
269
|
+
|
|
270
|
+
Conditional rendering based on composer state. Shared from `@assistant-ui/core/react`.
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
<ComposerPrimitive.If editing>
|
|
274
|
+
<Text>Currently editing</Text>
|
|
275
|
+
</ComposerPrimitive.If>
|
|
276
|
+
|
|
277
|
+
<ComposerPrimitive.If dictation>
|
|
278
|
+
<Text>Dictating...</Text>
|
|
279
|
+
</ComposerPrimitive.If>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
| Prop | Type | Description |
|
|
283
|
+
|------|------|-------------|
|
|
284
|
+
| `editing` | `boolean` | Render when composer is in editing mode |
|
|
285
|
+
| `dictation` | `boolean` | Render when dictation is currently active |
|
|
286
|
+
|
|
287
|
+
## Message
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
import { MessagePrimitive } from "@assistant-ui/react-ink";
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Root
|
|
294
|
+
|
|
295
|
+
Container `Box` for a single message.
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
<MessagePrimitive.Root>
|
|
299
|
+
{children}
|
|
300
|
+
</MessagePrimitive.Root>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Parts
|
|
304
|
+
|
|
305
|
+
Renders message content parts via a `components` prop. Tool call and data parts automatically render registered tool UIs (via `useAssistantTool` / `useAssistantDataUI`), falling back to components provided here. A default `Text` component using Ink's `<Text>` is provided out of the box.
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
<MessagePrimitive.Parts>
|
|
309
|
+
{({ part }) => {
|
|
310
|
+
if (part.type === "text") return <Text>{part.text}</Text>;
|
|
311
|
+
if (part.type === "tool-call") return <Text dimColor>[Tool: {part.toolName}]</Text>;
|
|
312
|
+
return null;
|
|
313
|
+
}}
|
|
314
|
+
</MessagePrimitive.Parts>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Content (deprecated)
|
|
318
|
+
|
|
319
|
+
<Callout type="warn">
|
|
320
|
+
Deprecated. Use `MessagePrimitive.Parts` instead. See the [v0.11 migration guide](/docs/reference/migrations/v0-11) for details.
|
|
321
|
+
</Callout>
|
|
322
|
+
|
|
323
|
+
Renders message content parts using render props. Tool call and data parts automatically render registered tool UIs (via `useAssistantTool` / `useAssistantDataUI`), falling back to render props if provided.
|
|
324
|
+
|
|
325
|
+
```tsx
|
|
326
|
+
<MessagePrimitive.Content
|
|
327
|
+
renderText={({ part }) => <Text>{part.text}</Text>}
|
|
328
|
+
renderToolCall={({ part }) => <Text dimColor>[Tool: {part.toolName}]</Text>}
|
|
329
|
+
/>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
| Prop | Type | Description |
|
|
333
|
+
|------|------|-------------|
|
|
334
|
+
| `renderText` | `(props: { part; index }) => ReactElement` | Text part renderer |
|
|
335
|
+
| `renderToolCall` | `(props: { part; index }) => ReactElement` | Tool call fallback |
|
|
336
|
+
| `renderImage` | `(props: { part; index }) => ReactElement` | Image part renderer |
|
|
337
|
+
| `renderReasoning` | `(props: { part; index }) => ReactElement` | Reasoning part renderer |
|
|
338
|
+
| `renderSource` | `(props: { part; index }) => ReactElement` | Source part renderer |
|
|
339
|
+
| `renderFile` | `(props: { part; index }) => ReactElement` | File part renderer |
|
|
340
|
+
| `renderData` | `(props: { part; index }) => ReactElement` | Data part fallback |
|
|
341
|
+
|
|
342
|
+
### PartByIndex
|
|
343
|
+
|
|
344
|
+
Low-level provider that sets up the part context for a specific message part by index. Used internally by `MessagePrimitive.Parts`.
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
<MessagePrimitive.PartByIndex index={0}>
|
|
348
|
+
{/* content rendered with part context */}
|
|
349
|
+
</MessagePrimitive.PartByIndex>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
| Prop | Type | Description |
|
|
353
|
+
|------|------|-------------|
|
|
354
|
+
| `index` | `number` | Zero-based part index |
|
|
355
|
+
|
|
356
|
+
### AttachmentByIndex
|
|
357
|
+
|
|
358
|
+
Low-level provider that sets up the attachment context for a specific message attachment by index. Used internally by `MessagePrimitive.Attachments`.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
<MessagePrimitive.AttachmentByIndex index={0}>
|
|
362
|
+
<AttachmentPrimitive.Name />
|
|
363
|
+
</MessagePrimitive.AttachmentByIndex>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
| Prop | Type | Description |
|
|
367
|
+
|------|------|-------------|
|
|
368
|
+
| `index` | `number` | Zero-based attachment index |
|
|
369
|
+
|
|
370
|
+
### Conditional Rendering (Message)
|
|
371
|
+
|
|
372
|
+
Use `AuiIf` for conditional rendering based on message properties:
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
<AuiIf condition={(s) => s.message.role === "user"}>
|
|
376
|
+
<Text bold color="green">You:</Text>
|
|
377
|
+
</AuiIf>
|
|
378
|
+
|
|
379
|
+
<AuiIf condition={(s) => s.message.role === "assistant" && s.message.isLast}>
|
|
380
|
+
<Text color="yellow">Thinking...</Text>
|
|
381
|
+
</AuiIf>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### If (deprecated)
|
|
385
|
+
|
|
386
|
+
<Callout type="warn">
|
|
387
|
+
Deprecated. Use `AuiIf` instead.
|
|
388
|
+
</Callout>
|
|
389
|
+
|
|
390
|
+
Conditional rendering based on message properties.
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
<MessagePrimitive.If user>
|
|
394
|
+
<Text bold color="green">You:</Text>
|
|
395
|
+
</MessagePrimitive.If>
|
|
396
|
+
|
|
397
|
+
<MessagePrimitive.If assistant last>
|
|
398
|
+
<Text color="yellow">Thinking...</Text>
|
|
399
|
+
</MessagePrimitive.If>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
| Prop | Type | Description |
|
|
403
|
+
|------|------|-------------|
|
|
404
|
+
| `user` | `boolean` | Render for user messages |
|
|
405
|
+
| `assistant` | `boolean` | Render for assistant messages |
|
|
406
|
+
| `running` | `boolean` | Render when message is being generated |
|
|
407
|
+
| `last` | `boolean` | Render for the last message |
|
|
408
|
+
|
|
409
|
+
### Attachments
|
|
410
|
+
|
|
411
|
+
Renders user message attachments using the provided component configuration.
|
|
412
|
+
|
|
413
|
+
```tsx
|
|
414
|
+
<MessagePrimitive.Attachments>
|
|
415
|
+
{() => <Text>[attachment]</Text>}
|
|
416
|
+
</MessagePrimitive.Attachments>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
| Prop | Type | Description |
|
|
420
|
+
|------|------|-------------|
|
|
421
|
+
| `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
|
|
422
|
+
|
|
423
|
+
## Attachment
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
import { AttachmentPrimitive } from "@assistant-ui/react-ink";
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Primitives for rendering individual attachments.
|
|
430
|
+
|
|
431
|
+
### Root
|
|
432
|
+
|
|
433
|
+
Container `Box` for an attachment.
|
|
434
|
+
|
|
435
|
+
### Name
|
|
436
|
+
|
|
437
|
+
`Text` component displaying the attachment filename.
|
|
438
|
+
|
|
439
|
+
### Thumb
|
|
440
|
+
|
|
441
|
+
`Text` component displaying the file extension.
|
|
442
|
+
|
|
443
|
+
### Remove
|
|
444
|
+
|
|
445
|
+
Pressable that removes the attachment from the composer.
|
|
446
|
+
|
|
447
|
+
```tsx
|
|
448
|
+
<AttachmentPrimitive.Root>
|
|
449
|
+
<AttachmentPrimitive.Thumb />
|
|
450
|
+
<AttachmentPrimitive.Name />
|
|
451
|
+
<AttachmentPrimitive.Remove>
|
|
452
|
+
<Text color="red">[x]</Text>
|
|
453
|
+
</AttachmentPrimitive.Remove>
|
|
454
|
+
</AttachmentPrimitive.Root>
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## ActionBar
|
|
458
|
+
|
|
459
|
+
```tsx
|
|
460
|
+
import { ActionBarPrimitive } from "@assistant-ui/react-ink";
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Copy
|
|
464
|
+
|
|
465
|
+
Pressable that copies the message content. Supports function-as-children for copy state feedback.
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
<ActionBarPrimitive.Copy copiedDuration={3000}>
|
|
469
|
+
{({ isCopied }) => <Text>{isCopied ? "[Copied!]" : "[Copy]"}</Text>}
|
|
470
|
+
</ActionBarPrimitive.Copy>
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
| Prop | Type | Description |
|
|
474
|
+
|------|------|-------------|
|
|
475
|
+
| `copiedDuration` | `number` | Duration in ms to show "copied" state (default: 3000) |
|
|
476
|
+
| `copyToClipboard` | `(text: string) => void` | Custom clipboard function |
|
|
477
|
+
|
|
478
|
+
### Edit
|
|
479
|
+
|
|
480
|
+
Pressable that enters edit mode for a message.
|
|
481
|
+
|
|
482
|
+
```tsx
|
|
483
|
+
<ActionBarPrimitive.Edit>
|
|
484
|
+
<Text>[Edit]</Text>
|
|
485
|
+
</ActionBarPrimitive.Edit>
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Reload
|
|
489
|
+
|
|
490
|
+
Pressable that regenerates an assistant message.
|
|
491
|
+
|
|
492
|
+
```tsx
|
|
493
|
+
<ActionBarPrimitive.Reload>
|
|
494
|
+
<Text>[Retry]</Text>
|
|
495
|
+
</ActionBarPrimitive.Reload>
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### FeedbackPositive / FeedbackNegative
|
|
499
|
+
|
|
500
|
+
Pressable buttons for submitting message feedback.
|
|
501
|
+
|
|
502
|
+
```tsx
|
|
503
|
+
<ActionBarPrimitive.FeedbackPositive>
|
|
504
|
+
{({ isSubmitted }) => <Text>{isSubmitted ? "[Liked]" : "[Like]"}</Text>}
|
|
505
|
+
</ActionBarPrimitive.FeedbackPositive>
|
|
506
|
+
|
|
507
|
+
<ActionBarPrimitive.FeedbackNegative>
|
|
508
|
+
{({ isSubmitted }) => <Text>{isSubmitted ? "[Disliked]" : "[Dislike]"}</Text>}
|
|
509
|
+
</ActionBarPrimitive.FeedbackNegative>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
## BranchPicker
|
|
513
|
+
|
|
514
|
+
```tsx
|
|
515
|
+
import { BranchPickerPrimitive } from "@assistant-ui/react-ink";
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Previous / Next
|
|
519
|
+
|
|
520
|
+
Pressable buttons to navigate between message branches.
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
<Box>
|
|
524
|
+
<BranchPickerPrimitive.Previous>
|
|
525
|
+
<Text>{"<"}</Text>
|
|
526
|
+
</BranchPickerPrimitive.Previous>
|
|
527
|
+
<BranchPickerPrimitive.Number />
|
|
528
|
+
<Text>/</Text>
|
|
529
|
+
<BranchPickerPrimitive.Count />
|
|
530
|
+
<BranchPickerPrimitive.Next>
|
|
531
|
+
<Text>{">"}</Text>
|
|
532
|
+
</BranchPickerPrimitive.Next>
|
|
533
|
+
</Box>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Number / Count
|
|
537
|
+
|
|
538
|
+
`Text` components displaying the current branch number and total count.
|
|
539
|
+
|
|
540
|
+
## ThreadList
|
|
541
|
+
|
|
542
|
+
```tsx
|
|
543
|
+
import { ThreadListPrimitive } from "@assistant-ui/react-ink";
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Root
|
|
547
|
+
|
|
548
|
+
Container `Box` for the thread list.
|
|
549
|
+
|
|
550
|
+
### Items
|
|
551
|
+
|
|
552
|
+
Renders thread list items with runtime integration.
|
|
553
|
+
|
|
554
|
+
```tsx
|
|
555
|
+
<ThreadListPrimitive.Items
|
|
556
|
+
renderItem={({ threadId }) => (
|
|
557
|
+
<ThreadEntry threadId={threadId} />
|
|
558
|
+
)}
|
|
559
|
+
/>
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
| Prop | Type | Description |
|
|
563
|
+
|------|------|-------------|
|
|
564
|
+
| `renderItem` | `(props: { threadId: string; index: number }) => ReactElement` | Thread item renderer |
|
|
565
|
+
|
|
566
|
+
### New
|
|
567
|
+
|
|
568
|
+
Pressable that creates a new thread.
|
|
569
|
+
|
|
570
|
+
```tsx
|
|
571
|
+
<ThreadListPrimitive.New>
|
|
572
|
+
<Text color="green">[New Chat]</Text>
|
|
573
|
+
</ThreadListPrimitive.New>
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## ThreadListItem
|
|
577
|
+
|
|
578
|
+
```tsx
|
|
579
|
+
import { ThreadListItemPrimitive } from "@assistant-ui/react-ink";
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Root
|
|
583
|
+
|
|
584
|
+
Container `Box` for a thread list item.
|
|
585
|
+
|
|
586
|
+
### Title
|
|
587
|
+
|
|
588
|
+
`Text` component displaying the thread list item title. Shared from `@assistant-ui/core/react`.
|
|
589
|
+
|
|
590
|
+
### Trigger
|
|
591
|
+
|
|
592
|
+
Pressable that switches to the thread.
|
|
593
|
+
|
|
594
|
+
### Delete
|
|
595
|
+
|
|
596
|
+
Pressable that deletes the thread.
|
|
597
|
+
|
|
598
|
+
### Archive / Unarchive
|
|
599
|
+
|
|
600
|
+
Pressable buttons that archive or unarchive the thread.
|
|
601
|
+
|
|
602
|
+
```tsx
|
|
603
|
+
<ThreadListItemPrimitive.Root>
|
|
604
|
+
<ThreadListItemPrimitive.Trigger>
|
|
605
|
+
<ThreadListItemPrimitive.Title />
|
|
606
|
+
</ThreadListItemPrimitive.Trigger>
|
|
607
|
+
<ThreadListItemPrimitive.Delete>
|
|
608
|
+
<Text color="red">[x]</Text>
|
|
609
|
+
</ThreadListItemPrimitive.Delete>
|
|
610
|
+
</ThreadListItemPrimitive.Root>
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Suggestion
|
|
614
|
+
|
|
615
|
+
```tsx
|
|
616
|
+
import { SuggestionPrimitive } from "@assistant-ui/react-ink";
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Title
|
|
620
|
+
|
|
621
|
+
`Text` component displaying the suggestion title.
|
|
622
|
+
|
|
623
|
+
### Description
|
|
624
|
+
|
|
625
|
+
`Text` component displaying the suggestion label. Despite the component name, this reads from the `label` field of the suggestion state (not a separate `description` field).
|
|
626
|
+
|
|
627
|
+
### Trigger
|
|
628
|
+
|
|
629
|
+
Pressable that triggers the suggestion action.
|
|
630
|
+
|
|
631
|
+
```tsx
|
|
632
|
+
<SuggestionPrimitive.Trigger send>
|
|
633
|
+
<SuggestionPrimitive.Title />
|
|
634
|
+
</SuggestionPrimitive.Trigger>
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
| Prop | Type | Description |
|
|
638
|
+
|------|------|-------------|
|
|
639
|
+
| `send` | `boolean` | When true, sends immediately; when false, inserts into composer |
|
|
640
|
+
| `clearComposer` | `boolean` | Whether to clear/replace composer text (default: true) |
|
|
641
|
+
|
|
642
|
+
## ChainOfThought
|
|
643
|
+
|
|
644
|
+
```tsx
|
|
645
|
+
import { ChainOfThoughtPrimitive } from "@assistant-ui/react-ink";
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Root
|
|
649
|
+
|
|
650
|
+
Container `Box` for chain of thought content.
|
|
651
|
+
|
|
652
|
+
### AccordionTrigger
|
|
653
|
+
|
|
654
|
+
Pressable that toggles the collapsed state of the chain of thought.
|
|
655
|
+
|
|
656
|
+
### Parts
|
|
657
|
+
|
|
658
|
+
Renders the individual parts of a chain of thought using a provided components map. Shared from `@assistant-ui/core/react`.
|
|
659
|
+
|
|
660
|
+
```tsx
|
|
661
|
+
<ChainOfThoughtPrimitive.Root>
|
|
662
|
+
<ChainOfThoughtPrimitive.AccordionTrigger>
|
|
663
|
+
<Text dimColor>[Toggle reasoning]</Text>
|
|
664
|
+
</ChainOfThoughtPrimitive.AccordionTrigger>
|
|
665
|
+
<ChainOfThoughtPrimitive.Parts>
|
|
666
|
+
{({ part }) => part.type === "text" ? <Text dimColor>{part.text}</Text> : null}
|
|
667
|
+
</ChainOfThoughtPrimitive.Parts>
|
|
668
|
+
</ChainOfThoughtPrimitive.Root>
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## ToolCall
|
|
672
|
+
|
|
673
|
+
```tsx
|
|
674
|
+
import { ToolCallPrimitive } from "@assistant-ui/react-ink";
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### Fallback
|
|
678
|
+
|
|
679
|
+
A built-in component for rendering tool calls with expandable/collapsible output. Includes a spinner for running tools, formatted JSON args and result output, and status icons for completed, errored, or interrupted calls.
|
|
680
|
+
|
|
681
|
+
```tsx
|
|
682
|
+
<MessagePrimitive.Parts>
|
|
683
|
+
{({ part }) => {
|
|
684
|
+
if (part.type === "tool-call") return <ToolCallPrimitive.Fallback part={part} />;
|
|
685
|
+
return null;
|
|
686
|
+
}}
|
|
687
|
+
</MessagePrimitive.Parts>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
| Prop | Type | Description |
|
|
691
|
+
|------|------|-------------|
|
|
692
|
+
| `part` | `ToolCallMessagePartProps` | The tool call message part (pass the component prop directly) |
|
|
693
|
+
| `expanded` | `boolean` | Force expanded or collapsed. When unset, auto-expands while running, awaiting action, or errored |
|
|
694
|
+
| `maxArgLines` | `number` | Maximum lines to show for args when expanded (default: 20) |
|
|
695
|
+
| `maxResultLines` | `number` | Maximum lines to show for result when expanded (default: 20) |
|
|
696
|
+
| `maxResultPreviewLines` | `number` | Maximum lines to show for result preview when collapsed (default: 1) |
|
|
697
|
+
| `renderHeader` | `(props: { toolName, status, expanded }) => ReactNode` | Custom header renderer |
|
|
698
|
+
| `renderArgs` | `(props: { args, argsText }) => ReactNode` | Custom args renderer |
|
|
699
|
+
| `renderResult` | `(props: { result, isError }) => ReactNode` | Custom result renderer |
|