@assistant-ui/mcp-docs-server 0.1.39 → 0.2.1
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 +17 -18
- package/.docs/organized/code-examples/with-a2a.md +20 -15
- package/.docs/organized/code-examples/with-ag-ui.md +19 -17
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +17 -16
- package/.docs/organized/code-examples/with-artifacts.md +471 -145
- package/.docs/organized/code-examples/with-assistant-transport.md +23 -31
- package/.docs/organized/code-examples/with-browser-extension.md +21 -14
- package/.docs/organized/code-examples/with-chain-of-thought.md +22 -20
- package/.docs/organized/code-examples/with-cloud-standalone.md +13 -14
- package/.docs/organized/code-examples/with-cloud.md +22 -17
- package/.docs/organized/code-examples/with-custom-thread-list.md +17 -16
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +17 -17
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +21 -19
- package/.docs/organized/code-examples/with-eve.md +70 -16
- package/.docs/organized/code-examples/with-expo.md +32 -51
- package/.docs/organized/code-examples/with-external-store.md +20 -15
- package/.docs/organized/code-examples/with-ffmpeg.md +24 -18
- package/.docs/organized/code-examples/with-generative-ui.md +20 -21
- package/.docs/organized/code-examples/with-google-adk.md +21 -16
- package/.docs/organized/code-examples/with-heat-graph.md +10 -11
- package/.docs/organized/code-examples/with-image-generation.md +13 -14
- package/.docs/organized/code-examples/with-interactables.md +17 -16
- package/.docs/organized/code-examples/with-langchain.md +13 -14
- package/.docs/organized/code-examples/with-langgraph.md +23 -17
- package/.docs/organized/code-examples/with-livekit.md +17 -17
- package/.docs/organized/code-examples/with-mcp.md +36 -32
- package/.docs/organized/code-examples/with-nuxt.md +2492 -0
- package/.docs/organized/code-examples/with-opencode.md +27 -21
- package/.docs/organized/code-examples/with-pi.md +69 -67
- package/.docs/organized/code-examples/with-react-hook-form.md +18 -17
- package/.docs/organized/code-examples/with-react-ink-web.md +10 -11
- package/.docs/organized/code-examples/with-react-ink.md +7 -7
- package/.docs/organized/code-examples/with-react-router.md +23 -17
- package/.docs/organized/code-examples/with-resumable-stream.md +15 -16
- package/.docs/organized/code-examples/with-store.md +31 -20
- package/.docs/organized/code-examples/with-tanstack.md +22 -16
- package/.docs/organized/code-examples/with-tap-runtime.md +19 -19
- package/.docs/organized/code-examples/with-virtualized-thread.md +12 -13
- package/.docs/organized/code-examples/with-vue.md +408 -0
- package/.docs/raw/docs/(docs)/cli.mdx +3 -1
- package/.docs/raw/docs/(docs)/devtools.mdx +7 -2
- package/.docs/raw/docs/(docs)/index.mdx +9 -76
- package/.docs/raw/docs/(docs)/installation.mdx +4 -18
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/a2ui.mdx +40 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +3 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +19 -420
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +4 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +8 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +21 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -9
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +1 -18
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +24 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk.mdx +2 -2
- package/.docs/raw/docs/cloud/langgraph.mdx +1 -1
- package/.docs/raw/docs/copilots/model-context.mdx +5 -4
- package/.docs/raw/docs/copilots/motivation.mdx +5 -5
- package/.docs/raw/docs/guides/attachments.mdx +3 -3
- package/.docs/raw/docs/guides/branching.mdx +2 -2
- package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +89 -111
- package/.docs/raw/docs/guides/editing.mdx +5 -5
- package/.docs/raw/docs/guides/electron.mdx +369 -0
- package/.docs/raw/docs/guides/index.mdx +10 -0
- package/.docs/raw/docs/guides/quoting.mdx +3 -3
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +2 -2
- package/.docs/raw/docs/guides/resumable-streams.mdx +74 -3
- package/.docs/raw/docs/guides/suggestions.mdx +9 -9
- package/.docs/raw/docs/ink/hooks.mdx +12 -7
- package/.docs/raw/docs/ink/primitives.mdx +18 -10
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +16 -0
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +3 -3
- package/.docs/raw/docs/integrations/auth/clerk.mdx +3 -3
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +4 -4
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/gateways/index.mdx +2 -2
- package/.docs/raw/docs/integrations/observability/helicone.mdx +2 -2
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +1 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +3 -3
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +36 -9
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +15 -13
- package/.docs/raw/docs/migrations/v0-15.mdx +236 -0
- package/.docs/raw/docs/primitives/attachment.mdx +2 -2
- package/.docs/raw/docs/primitives/composer.mdx +3 -3
- package/.docs/raw/docs/primitives/message.mdx +33 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +1 -1
- package/.docs/raw/docs/primitives/thread-list.mdx +2 -2
- package/.docs/raw/docs/react-native/hooks.mdx +17 -7
- package/.docs/raw/docs/react-native/index.mdx +3 -3
- package/.docs/raw/docs/react-native/primitives.mdx +41 -7
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +5 -5
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +5 -5
- package/.docs/raw/docs/runtimes/ai-sdk/v6-legacy.mdx +13 -14
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +11 -12
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +50 -11
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +20 -2
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +31 -2
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +39 -12
- package/.docs/raw/docs/runtimes/eve/overview.mdx +51 -0
- package/.docs/raw/docs/runtimes/eve/quickstart.mdx +51 -2
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -12
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -7
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +4 -4
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +4 -1
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +10 -0
- package/.docs/raw/docs/tools/a2ui.mdx +107 -0
- package/.docs/raw/docs/tools/backend.mdx +2 -2
- package/.docs/raw/docs/tools/defining-tools.mdx +9 -7
- package/.docs/raw/docs/tools/dynamic-tools.mdx +6 -4
- package/.docs/raw/docs/tools/interactables-legacy.mdx +28 -15
- package/.docs/raw/docs/tools/interactables.mdx +27 -16
- package/.docs/raw/docs/tools/mcp-apps.mdx +96 -8
- package/.docs/raw/docs/tools/mcp.mdx +9 -7
- package/.docs/raw/docs/tools/tool-ui.mdx +26 -22
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +64 -14
- package/.docs/raw/docs/ui/file.mdx +6 -1
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +2 -0
- package/.docs/raw/docs/ui/mcp-config.mdx +8 -3
- package/.docs/raw/docs/ui/model-selector.mdx +9 -9
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -5
- package/.docs/raw/docs/ui/reasoning.mdx +1 -1
- package/.docs/raw/docs/ui/thread.mdx +24 -5
- package/.docs/raw/docs/utilities/react-o11y.mdx +7 -9
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -1
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -1
- package/dist/tools/docs.d.ts +6 -10
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +6 -4
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +4 -8
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +4 -3
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/resources.d.ts +1 -1
- package/dist/tools/resources.d.ts.map +1 -1
- package/dist/tools/resources.js +3 -2
- package/dist/tools/resources.js.map +1 -1
- package/dist/tools/search.d.ts +4 -10
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/tests/mcp-test-client.d.ts +15 -0
- package/dist/tools/tests/mcp-test-client.d.ts.map +1 -0
- package/dist/tools/tests/mcp-test-client.js +68 -0
- package/dist/tools/tests/mcp-test-client.js.map +1 -0
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +2 -1
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/tools/xulux-templates.d.ts +9 -23
- package/dist/tools/xulux-templates.d.ts.map +1 -1
- package/dist/tools/xulux-templates.js +8 -6
- package/dist/tools/xulux-templates.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/mdx.js +2 -1
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/security.js.map +1 -1
- package/dist/xulux/catalog-client.js +1 -1
- package/dist/xulux/catalog-client.js.map +1 -1
- package/package.json +6 -5
- package/src/index.ts +2 -2
- package/src/tools/docs.ts +2 -2
- package/src/tools/examples.ts +2 -2
- package/src/tools/resources.ts +1 -4
- package/src/tools/search.ts +2 -2
- package/src/tools/tests/completions.test.ts +40 -26
- package/src/tools/tests/docs.test.ts +2 -2
- package/src/tools/tests/integration.test.ts +3 -4
- package/src/tools/tests/mcp-protocol.test.ts +160 -175
- package/src/tools/tests/mcp-test-client.ts +111 -0
- package/src/tools/tests/resources.test.ts +97 -66
- package/src/tools/xulux-templates.ts +4 -4
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration to v0.15
|
|
3
|
+
description: Drops the v0.12-era legacy runtime hooks, the deprecated tools map, and the "mcp-app" group key. Scope accessors become properties.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Version 0.15 finishes the deprecation cycle started in v0.12: the legacy context hooks are removed in favor of `useAui` / `useAuiState`, and `aui` scope accessors become properties.
|
|
7
|
+
|
|
8
|
+
## Migrate with an AI Agent
|
|
9
|
+
|
|
10
|
+
Paste this into an AI coding agent to run the migration for you:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
Migrate this codebase from assistant-ui v0.14 to v0.15.
|
|
14
|
+
|
|
15
|
+
1. Read the migration guide: https://assistant-ui.com/docs/migrations/v0-15
|
|
16
|
+
2. Run `npx assistant-ui@latest upgrade` to apply the codemods.
|
|
17
|
+
3. Apply the remaining changes from the guide by hand:
|
|
18
|
+
- Replace removed legacy hooks with the useAui / useAuiState
|
|
19
|
+
equivalents from the guide's mapping table.
|
|
20
|
+
- Replace availability checks with `aui.<scope>.source != null`.
|
|
21
|
+
- Replace `s.tools.tools` reads with `s.tools.toolUIs`.
|
|
22
|
+
- Replace the "mcp-app" groupPartByType key with "standalone-tool-call".
|
|
23
|
+
4. Typecheck, build, and run tests; fix any remaining fallout.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Automatic Migration
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx assistant-ui@latest upgrade
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This runs the `v0-15/aui-accessor-calls-to-properties` codemod, which rewrites nullary accessor calls (`aui.thread()`) to property access (`aui.thread`).
|
|
33
|
+
|
|
34
|
+
## Scope Accessors Are Properties
|
|
35
|
+
|
|
36
|
+
Nullary scope accessors are now properties. Calling them still works but is deprecated:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// Before
|
|
40
|
+
aui.thread().getState();
|
|
41
|
+
aui.threads().switchToNewThread();
|
|
42
|
+
|
|
43
|
+
// After
|
|
44
|
+
aui.thread.getState();
|
|
45
|
+
aui.threads.switchToNewThread();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Selecting an unavailable scope no longer throws: `aui.thread` always succeeds and is always truthy. Its `source` is `null` when the scope is unavailable, and any other property read (or a call) throws. Check availability via:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
if (aui.thread.source != null) {
|
|
52
|
+
// scope is available
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Accessors expose `source`, `query`, and `name` selection metadata as properties — previously found on the accessor function, now on the same names on the proxy. These three names are reserved and never resolve to scope methods.
|
|
57
|
+
|
|
58
|
+
## Legacy Context Hooks Removed
|
|
59
|
+
|
|
60
|
+
The v0.12-era runtime hooks are removed. Replace state reads with `useAuiState` and actions with `useAui`:
|
|
61
|
+
|
|
62
|
+
| Removed | Replacement |
|
|
63
|
+
| ------------------------------------------------------------- | ----------------------------------------------- |
|
|
64
|
+
| `useAssistantRuntime()` | `useAui()` |
|
|
65
|
+
| `useThreadList(selector)` | `useAuiState((s) => s.threads)` |
|
|
66
|
+
| `useThreadRuntime()` | `useAui().thread` |
|
|
67
|
+
| `useThread(selector)` | `useAuiState((s) => s.thread)` |
|
|
68
|
+
| `useThreadComposer(selector)` | `useAuiState((s) => s.thread.composer)` |
|
|
69
|
+
| `useThreadModelContext(selector)` | `useAuiState((s) => s.thread.modelContext)` |
|
|
70
|
+
| `useMessageRuntime()` | `useAui().message` |
|
|
71
|
+
| `useMessage(selector)` | `useAuiState((s) => s.message)` |
|
|
72
|
+
| `useEditComposer(selector)` | `useAuiState((s) => s.message.composer)` |
|
|
73
|
+
| `useComposerRuntime()` | `useAui().composer` |
|
|
74
|
+
| `useComposer(selector)` | `useAuiState((s) => s.composer)` |
|
|
75
|
+
| `useMessagePartRuntime()` | `useAui().part` |
|
|
76
|
+
| `useMessagePart(selector)` | `useAuiState((s) => s.part)` |
|
|
77
|
+
| `useAttachmentRuntime()` | `useAui().attachment` |
|
|
78
|
+
| `useAttachment(selector)` | `useAuiState((s) => s.attachment)` |
|
|
79
|
+
| `useThreadListItemRuntime()` | `useAui().threadListItem` |
|
|
80
|
+
| `useThreadListItem(selector)` | `useAuiState((s) => s.threadListItem)` |
|
|
81
|
+
|
|
82
|
+
The attachment variants (`useThreadComposerAttachment(Runtime)`, `useEditComposerAttachment(Runtime)`, `useMessageAttachment(Runtime)`) are removed with them; use `useAui().attachment` / `useAuiState((s) => s.attachment)`.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// Before
|
|
86
|
+
const runtime = useAssistantRuntime();
|
|
87
|
+
const isRunning = useThread((s) => s.isRunning);
|
|
88
|
+
runtime.threads.switchToNewThread();
|
|
89
|
+
|
|
90
|
+
// After
|
|
91
|
+
const aui = useAui();
|
|
92
|
+
const isRunning = useAuiState((s) => s.thread.isRunning);
|
|
93
|
+
aui.threads.switchToNewThread();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## `ToolsState.tools` Removed
|
|
97
|
+
|
|
98
|
+
The component-only tool-UI map is replaced by `toolUIs`, whose entries carry the renderer alongside its presentation options:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
// Before
|
|
102
|
+
const Render = useAuiState((s) => s.tools.tools[toolName]?.[0]);
|
|
103
|
+
|
|
104
|
+
// After
|
|
105
|
+
const Render = useAuiState((s) => s.tools.toolUIs[toolName]?.[0]?.render);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## `"mcp-app"` Group Key Removed
|
|
109
|
+
|
|
110
|
+
`groupPartByType` no longer accepts the `"mcp-app"` key. Use `"standalone-tool-call"`, a superset that matches MCP-app tool calls plus any tool call whose registered UI opts into standalone display:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
// Before
|
|
114
|
+
groupPartByType({
|
|
115
|
+
"tool-call": ["group-tool"],
|
|
116
|
+
"mcp-app": [],
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// After
|
|
120
|
+
groupPartByType({
|
|
121
|
+
"tool-call": ["group-tool"],
|
|
122
|
+
"standalone-tool-call": [],
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## `useAui` `{ parent }` Config Removed
|
|
127
|
+
|
|
128
|
+
The second argument (`useAui(clients, { parent })`) is removed. Provide the parent via context instead: wrap with `AuiProvider` and call the context form beneath it.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
// Before
|
|
132
|
+
const aui = useAui(scopes, { parent });
|
|
133
|
+
|
|
134
|
+
// After
|
|
135
|
+
const Scoped = ({ children }) => {
|
|
136
|
+
const aui = useAui();
|
|
137
|
+
const config = AuiConfig(scopes);
|
|
138
|
+
return (
|
|
139
|
+
<AuiProvider extends={aui} config={config}>
|
|
140
|
+
{children}
|
|
141
|
+
</AuiProvider>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const rootConfig = AuiConfig({});
|
|
146
|
+
|
|
147
|
+
<AuiProvider extends={parent} config={rootConfig}>
|
|
148
|
+
<Scoped />
|
|
149
|
+
</AuiProvider>;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Where `{ parent: null }` was used to detach from context, `<AuiProvider extends={null} config={config}>` where `const config = AuiConfig({})` now provides an isolated empty root.
|
|
153
|
+
|
|
154
|
+
## `AuiProvider` Grammar
|
|
155
|
+
|
|
156
|
+
`AuiProvider` takes a `config` built with `AuiConfig(...)` — raw object literals are a type error. At the top level, `config` alone creates the subtree's client. Nested under a parent provider, `extends` is mandatory: `extends={aui}` extends the parent, `extends={null}` isolates (dev-enforced). `ref` receives the resulting client after mount.
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
const aui = useAui();
|
|
160
|
+
const config = AuiConfig({ tools: Tools({ toolkit }) });
|
|
161
|
+
|
|
162
|
+
// Top-level root
|
|
163
|
+
<AuiProvider config={config}>
|
|
164
|
+
|
|
165
|
+
// Nested: extend the parent
|
|
166
|
+
<AuiProvider extends={aui} config={config}>
|
|
167
|
+
|
|
168
|
+
// Nested: isolate from the parent
|
|
169
|
+
<AuiProvider extends={null} config={config}>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`AuiConfig` is exported from `@assistant-ui/store` and re-exported from `@assistant-ui/react`, `@assistant-ui/react-native`, and `@assistant-ui/react-ink`.
|
|
173
|
+
|
|
174
|
+
### `value` Prop Deprecated
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
// Before
|
|
178
|
+
<AuiProvider value={client}>
|
|
179
|
+
<AuiProvider value={null}>
|
|
180
|
+
|
|
181
|
+
// After
|
|
182
|
+
const config = AuiConfig({});
|
|
183
|
+
|
|
184
|
+
<AuiProvider extends={client} config={config}>
|
|
185
|
+
<AuiProvider extends={null} config={config}>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The replacement exposes a client extending the given one, not the same instance — `useAui()` beneath it returns the new client, with scope access delegating to `client`. The deprecated `value={client}` form behaves the same way: it also exposes a derived client rather than the exact instance, and the given client must implement `subscribe`.
|
|
189
|
+
|
|
190
|
+
### `useAui({ ... })` Extension Overload Deprecated
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
// Before
|
|
194
|
+
const aui = useAui({ tools: Tools({ toolkit }) });
|
|
195
|
+
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
196
|
+
|
|
197
|
+
// After
|
|
198
|
+
const aui = useAui();
|
|
199
|
+
const config = AuiConfig({ tools: Tools({ toolkit }) });
|
|
200
|
+
return (
|
|
201
|
+
<AuiProvider extends={aui} config={config}>
|
|
202
|
+
{children}
|
|
203
|
+
</AuiProvider>
|
|
204
|
+
);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Where the extended client was passed to `<AssistantRuntimeProvider aui={aui}>`, use the new `config` prop instead — the scopes are provided alongside the runtime's threads scope:
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
// Before
|
|
211
|
+
const aui = useAui({ tools: Tools({ toolkit }) });
|
|
212
|
+
return (
|
|
213
|
+
<AssistantRuntimeProvider aui={aui} runtime={runtime}>
|
|
214
|
+
{children}
|
|
215
|
+
</AssistantRuntimeProvider>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// After
|
|
219
|
+
const config = AuiConfig({ tools: Tools({ toolkit }) });
|
|
220
|
+
return (
|
|
221
|
+
<AssistantRuntimeProvider runtime={runtime} config={config}>
|
|
222
|
+
{children}
|
|
223
|
+
</AssistantRuntimeProvider>
|
|
224
|
+
);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Still Deprecated (not removed)
|
|
228
|
+
|
|
229
|
+
- Primitive `If` components (`ThreadPrimitive.If`, `MessagePrimitive.If`, `ThreadPrimitive.Empty`) — replaced by `AuiIf`. The codemod migrates these.
|
|
230
|
+
- `useMessagePartText` / `useMessagePartReasoning` / `useMessagePartSource` / `useMessagePartImage` / `useMessagePartFile` / `useMessagePartData` — use `useAuiState` to select and narrow `s.part`.
|
|
231
|
+
- The `components` prop on primitives — replaced by the children render function pattern (see the [v0.14 guide](/docs/migrations/v0-14)).
|
|
232
|
+
|
|
233
|
+
## Getting Help
|
|
234
|
+
|
|
235
|
+
- File issues at https://github.com/assistant-ui/assistant-ui/issues
|
|
236
|
+
- See the [deprecation policy](/docs/migrations/deprecation-policy) for the support window
|
|
@@ -53,7 +53,7 @@ import { AttachmentPrimitive, ComposerPrimitive } from "@assistant-ui/react";
|
|
|
53
53
|
</ComposerPrimitive.Root>
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
`Root` renders a `<div>`, `unstable_Thumb` renders a `<div>` showing the file extension with a leading dot (e.g., `.pdf`), `Name` renders plain text, and `Remove` renders a `<button>`.
|
|
56
|
+
`Root` renders a `<div>`, `unstable_Thumb` renders a `<div>` showing the file extension with a leading dot (e.g., `.pdf`), or the attachment type (e.g., `image`) when the filename has no extension (including leading-dot names like `.env`), `Name` renders plain text, and `Remove` renders a `<button>`. If you pass `children` to `unstable_Thumb`, they override that text.
|
|
57
57
|
|
|
58
58
|
<Callout type="info">
|
|
59
59
|
Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRuntimeProvider` with a runtime (for example `useLocalRuntime(...)`). See [Pick a Runtime](/docs/runtimes/pick-a-runtime).
|
|
@@ -124,7 +124,7 @@ Container for a single attachment item. Renders a `<div>` element unless `asChil
|
|
|
124
124
|
|
|
125
125
|
### unstable_Thumb
|
|
126
126
|
|
|
127
|
-
Thumbnail slot for attachment previews. Renders a `<div>` element unless `asChild` is set.
|
|
127
|
+
Thumbnail slot for attachment previews. Renders a `<div>` element unless `asChild` is set. By default it shows the file extension with a leading dot (e.g., `.pdf`); if you pass `children`, they override the automatic text.
|
|
128
128
|
|
|
129
129
|
```tsx
|
|
130
130
|
<AttachmentPrimitive.unstable_Thumb className="flex size-10 items-center justify-center rounded bg-muted text-xs" />
|
|
@@ -258,7 +258,7 @@ Renders a single attachment at a specific index.
|
|
|
258
258
|
|
|
259
259
|
### AttachmentDropzone
|
|
260
260
|
|
|
261
|
-
Drag-and-drop zone for file attachments. Sets `data-dragging` when a file is being dragged over it. Renders a `<div>` element unless `asChild` is set.
|
|
261
|
+
Drag-and-drop zone for file attachments. Sets `data-dragging` when a file is being dragged over it and the runtime supports attachments; without the attachments capability the dropzone accepts no files and shows no highlight. Non-file drags (text, links) are ignored. Renders a `<div>` element unless `asChild` is set.
|
|
262
262
|
|
|
263
263
|
```tsx
|
|
264
264
|
<ComposerPrimitive.AttachmentDropzone className="rounded-xl border-2 border-dashed data-[dragging]:border-primary data-[dragging]:bg-primary/5">
|
|
@@ -507,7 +507,7 @@ Wrap your composer with `AttachmentDropzone` to support dragging files directly
|
|
|
507
507
|
</ComposerPrimitive.AttachmentDropzone>
|
|
508
508
|
```
|
|
509
509
|
|
|
510
|
-
The dropzone sets `data-dragging` when a file is being dragged over it, so you can style the active state with CSS.
|
|
510
|
+
The dropzone sets `data-dragging` when a file is being dragged over it, so you can style the active state with CSS. It requires the runtime's attachments capability (an attachment adapter); without it the dropzone stays inert.
|
|
511
511
|
|
|
512
512
|
### With Voice Input
|
|
513
513
|
|
|
@@ -570,7 +570,7 @@ When `isSendDisabled` is `true`:
|
|
|
570
570
|
- `composer.canSend` becomes `false`
|
|
571
571
|
- `<ComposerPrimitive.Send>` is disabled
|
|
572
572
|
- Enter and the `Cmd/Ctrl+Shift+Enter` steer hotkey become no-ops
|
|
573
|
-
- `aui.composer
|
|
573
|
+
- `aui.composer.send()` short-circuits at the runtime, so direct calls cannot escape the gate
|
|
574
574
|
|
|
575
575
|
Read the same flag from React with `<AuiIf>` to render hints alongside the input:
|
|
576
576
|
|
|
@@ -112,6 +112,37 @@ Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRun
|
|
|
112
112
|
For most new code, prefer `MessagePrimitive.Parts` with a `children` render function. When you need adjacent grouping, use `MessagePrimitive.GroupedParts`.
|
|
113
113
|
</Callout>
|
|
114
114
|
|
|
115
|
+
### Part Types
|
|
116
|
+
|
|
117
|
+
A message part is one of three kinds, and which kind a new capability belongs to is decided by the list below rather than case by case.
|
|
118
|
+
|
|
119
|
+
| Kind | Parts | Grows by |
|
|
120
|
+
|------|-------|----------|
|
|
121
|
+
| Modality | `text`, `image`, `file` | Never. `file` carries every non-image binary modality through its `mimeType`. |
|
|
122
|
+
| Provider channel | `reasoning`, `source`, `tool-call`, `generative-ui` | Never. These mirror channels a model already emits. |
|
|
123
|
+
| Extensibility | `data` | Freely, through `name`. This is the growth path for anything app-level. |
|
|
124
|
+
|
|
125
|
+
`file` is the media carrier. Audio, video, PDFs and everything else are `{ type: "file", mimeType: "audio/mpeg" }` rather than part types of their own, so one renderer and one converter branch handle them all. The payload can be inline base64 or a URL; `sourceType` additionally allows an opaque storage id, which the LangChain-family runtimes honor and other adapters ignore.
|
|
126
|
+
|
|
127
|
+
Anything that is not a modality the model consumes or a channel it emits is a `data` part, routed by `name`:
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<MessagePrimitive.Parts
|
|
131
|
+
components={{
|
|
132
|
+
data: {
|
|
133
|
+
by_name: { citation: MyCitation },
|
|
134
|
+
Fallback: MyDataFallback,
|
|
135
|
+
},
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<Callout type="warn">
|
|
141
|
+
`Unstable_AudioMessagePart` and the `Unstable_Audio` slot are deprecated. The audio part cannot carry a filename, has no way to declare how its payload goes on the wire (no `sourceType`, so no storage id), and exists only on user messages, so a model that returns audio has no way to express it. Send audio as a `file` part with an `audio/*` mime type instead, and give it a filename.
|
|
142
|
+
|
|
143
|
+
Adapter coverage for the file path is still uneven, so check your adapter's converter before relying on file parts. Known so far: `react-pi` and the assistant-transport runtime have no file part on their user-content surface at all, so one is dropped; `react-data-stream` carries the payload but not the filename. Existing audio parts keep working; they will not gain fields.
|
|
144
|
+
</Callout>
|
|
145
|
+
|
|
115
146
|
### Tool Resolution
|
|
116
147
|
|
|
117
148
|
Tool call parts resolve in this order:
|
|
@@ -149,7 +180,8 @@ Returning `null` still allows registered tool UIs and data renderer UIs to rende
|
|
|
149
180
|
- `components.ChainOfThought` takes over all reasoning and tool-call rendering (mutually exclusive with `ToolGroup`, `ReasoningGroup`, `tools`, and `Reasoning`). This legacy path is deprecated; use `MessagePrimitive.GroupedParts` for grouped Chain of Thought in new code.
|
|
150
181
|
- `data.by_name` and `data.Fallback` let you route custom data part types
|
|
151
182
|
- `Quote` renders quoted message references from metadata
|
|
152
|
-
- `Empty`
|
|
183
|
+
- `Empty` is available for edge rendering paths
|
|
184
|
+
- `Unstable_Audio` is deprecated; render `audio/*` from the `File` slot instead
|
|
153
185
|
|
|
154
186
|
```tsx
|
|
155
187
|
<MessagePrimitive.Parts
|
|
@@ -106,7 +106,7 @@ Both render a `<span>` and accept `children` to override the value from state:
|
|
|
106
106
|
|
|
107
107
|
`Trigger`'s `send` prop controls what happens on click:
|
|
108
108
|
|
|
109
|
-
- **`send={true}`**: immediately sends the suggestion as a new message.
|
|
109
|
+
- **`send={true}`**: immediately sends the suggestion as a new message. While a run is in progress, the suggestion is queued on runtimes that support queueing (leaving the composer draft untouched); otherwise the trigger is disabled.
|
|
110
110
|
- **`send={false}`** (default): populates the composer text so the user can edit before sending
|
|
111
111
|
|
|
112
112
|
```tsx
|
|
@@ -253,7 +253,7 @@ Button that appends the next page of threads. Renders a `<button>` element unles
|
|
|
253
253
|
</ThreadListPrimitive.LoadMore>
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
For scroll-driven loading, wrap `aui.threads
|
|
256
|
+
For scroll-driven loading, wrap `aui.threads.loadMore()` in your own `IntersectionObserver` at the application layer; assistant-ui ships the explicit button to keep the primitive surface predictable.
|
|
257
257
|
|
|
258
258
|
```tsx
|
|
259
259
|
import { useAui, useAuiState } from "@assistant-ui/react";
|
|
@@ -271,7 +271,7 @@ function LoadMoreSentinel() {
|
|
|
271
271
|
const el = ref.current;
|
|
272
272
|
if (!el || disabled) return;
|
|
273
273
|
const observer = new IntersectionObserver(([entry]) => {
|
|
274
|
-
if (entry?.isIntersecting) aui.threads
|
|
274
|
+
if (entry?.isIntersecting) aui.threads.loadMore();
|
|
275
275
|
});
|
|
276
276
|
observer.observe(el);
|
|
277
277
|
return () => observer.disconnect();
|
|
@@ -41,11 +41,11 @@ import { useAui } from "@assistant-ui/react-native";
|
|
|
41
41
|
const aui = useAui();
|
|
42
42
|
|
|
43
43
|
// Composer actions
|
|
44
|
-
aui.composer
|
|
45
|
-
aui.composer
|
|
44
|
+
aui.composer.setText("Hello");
|
|
45
|
+
aui.composer.send();
|
|
46
46
|
|
|
47
47
|
// Thread actions
|
|
48
|
-
aui.thread
|
|
48
|
+
aui.thread.cancelRun();
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### useAuiEvent
|
|
@@ -155,12 +155,22 @@ export default defineToolkit({
|
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
```tsx title="ToolProvider.tsx"
|
|
158
|
-
import {
|
|
158
|
+
import {
|
|
159
|
+
AuiConfig,
|
|
160
|
+
AuiProvider,
|
|
161
|
+
Tools,
|
|
162
|
+
useAui,
|
|
163
|
+
} from "@assistant-ui/react-native";
|
|
159
164
|
import toolkit from "./weather-toolkit";
|
|
160
165
|
|
|
161
166
|
function ToolProvider({ children }: { children: React.ReactNode }) {
|
|
162
|
-
const aui = useAui(
|
|
163
|
-
|
|
167
|
+
const aui = useAui();
|
|
168
|
+
const config = AuiConfig({ tools: Tools({ toolkit }) });
|
|
169
|
+
return (
|
|
170
|
+
<AuiProvider extends={aui} config={config}>
|
|
171
|
+
{children}
|
|
172
|
+
</AuiProvider>
|
|
173
|
+
);
|
|
164
174
|
}
|
|
165
175
|
```
|
|
166
176
|
|
|
@@ -218,7 +228,7 @@ export function useMyToolToolkit(someOuterProp: string) {
|
|
|
218
228
|
}
|
|
219
229
|
```
|
|
220
230
|
|
|
221
|
-
Import the toolkit hook,
|
|
231
|
+
Import the toolkit hook, hoist `const aui = useAui()` and `const config = AuiConfig({ tools: Tools({ toolkit }) })` in the component body, and mount it with `<AuiProvider extends={aui} config={config}>`, as shown in the [Tools](#tools) section above.
|
|
222
232
|
|
|
223
233
|
### makeAssistantDataUI
|
|
224
234
|
|
|
@@ -69,7 +69,7 @@ export const maxDuration = 30;
|
|
|
69
69
|
export async function POST(req: Request) {
|
|
70
70
|
const { messages } = await req.json();
|
|
71
71
|
const result = streamText({
|
|
72
|
-
model: openai("gpt-5.
|
|
72
|
+
model: openai("gpt-5.6-luna"),
|
|
73
73
|
messages: await convertToModelMessages(messages),
|
|
74
74
|
});
|
|
75
75
|
return result.toUIMessageStreamResponse();
|
|
@@ -197,7 +197,7 @@ function Composer() {
|
|
|
197
197
|
>
|
|
198
198
|
<TextInput
|
|
199
199
|
value={text}
|
|
200
|
-
onChangeText={(t) => aui.composer
|
|
200
|
+
onChangeText={(t) => aui.composer.setText(t)}
|
|
201
201
|
placeholder="Message..."
|
|
202
202
|
multiline
|
|
203
203
|
style={{
|
|
@@ -211,7 +211,7 @@ function Composer() {
|
|
|
211
211
|
}}
|
|
212
212
|
/>
|
|
213
213
|
<Pressable
|
|
214
|
-
onPress={() => aui.composer
|
|
214
|
+
onPress={() => aui.composer.send()}
|
|
215
215
|
disabled={isEmpty}
|
|
216
216
|
style={{
|
|
217
217
|
marginLeft: 8,
|
|
@@ -31,7 +31,9 @@ Container `View` for the thread area.
|
|
|
31
31
|
|
|
32
32
|
### ThreadPrimitive.Messages
|
|
33
33
|
|
|
34
|
-
`FlatList`-based message list
|
|
34
|
+
Deprecated `FlatList`-based message list kept for backwards compatibility. It uses `ThreadPrimitive.MessagesFlatList` internally, but keeps the previous no-auto-scroll default so existing apps with custom scroll handling do not change behavior on upgrade.
|
|
35
|
+
|
|
36
|
+
Use `ThreadPrimitive.MessagesFlatList` for new React Native threads.
|
|
35
37
|
|
|
36
38
|
```tsx
|
|
37
39
|
<ThreadPrimitive.Messages>
|
|
@@ -53,7 +55,29 @@ You can also provide role-specific components:
|
|
|
53
55
|
| Prop | Type | Description |
|
|
54
56
|
|------|------|-------------|
|
|
55
57
|
| `components` | `MessageComponents` | Component map — provide either a `Message` component (used for all roles) or role-specific `UserMessage`, `AssistantMessage`, and optionally `SystemMessage`. Edit composers can be set via `EditComposer` or role-specific variants (`UserEditComposer`, `AssistantEditComposer`, `SystemEditComposer`). |
|
|
56
|
-
| `...rest` | `
|
|
58
|
+
| `...rest` | `ThreadPrimitive.MessagesFlatList` props | Same props as `ThreadPrimitive.MessagesFlatList`, with the auto-scroll options defaulting to `false` on this deprecated wrapper |
|
|
59
|
+
|
|
60
|
+
### ThreadPrimitive.MessagesFlatList
|
|
61
|
+
|
|
62
|
+
Canonical React Native message viewport backed by `FlatList`. It scopes each row to its message, forwards refs to the underlying `FlatList`, and handles scroll-to-bottom behavior for common chat flows.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<ThreadPrimitive.MessagesFlatList autoScroll>
|
|
66
|
+
{() => <MyMessage />}
|
|
67
|
+
</ThreadPrimitive.MessagesFlatList>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
| Prop | Type | Description |
|
|
71
|
+
|------|------|-------------|
|
|
72
|
+
| `children` | `({ message }) => ReactNode` | Render function for each message |
|
|
73
|
+
| `components` | `MessageComponents` | Component map alternative to `children` |
|
|
74
|
+
| `autoScroll` | `boolean` | Automatically keeps the list at the bottom while it is already near the bottom. Defaults to `true` |
|
|
75
|
+
| `scrollToBottomOnRunStart` | `boolean` | Scrolls to the bottom when a run starts. Defaults to `true` |
|
|
76
|
+
| `scrollToBottomOnInitialize` | `boolean` | Scrolls to the bottom when messages first appear. Defaults to `true` |
|
|
77
|
+
| `scrollToBottomOnThreadSwitch` | `boolean` | Scrolls to the bottom when switching threads. Defaults to `true` |
|
|
78
|
+
| `...rest` | `FlatListProps` | Standard FlatList props, except `data`, `renderItem`, and `children` |
|
|
79
|
+
|
|
80
|
+
The built-in auto-scroll behavior assumes the default, non-inverted `FlatList` direction.
|
|
57
81
|
|
|
58
82
|
### ThreadPrimitive.MessageByIndex
|
|
59
83
|
|
|
@@ -413,7 +437,7 @@ Renders message content parts via a `components` prop. Tool call and data parts
|
|
|
413
437
|
| `Reasoning` | `ReasoningMessagePartComponent` | Reasoning part renderer |
|
|
414
438
|
| `Source` | `SourceMessagePartComponent` | Source part renderer |
|
|
415
439
|
| `File` | `FileMessagePartComponent` | File part renderer |
|
|
416
|
-
| `Unstable_Audio` | `
|
|
440
|
+
| `Unstable_Audio` | `Unstable_AudioMessagePartComponent` | Audio part renderer (deprecated, render `audio/*` from `File`) |
|
|
417
441
|
| `tools` | `{ by_name?, Fallback? }` or `{ Override }` | Tool call rendering config — use `by_name` to map tool names to components, `Fallback` for unregistered tools, or `Override` to handle all tool calls |
|
|
418
442
|
| `data` | `{ by_name?, Fallback? }` | Data part rendering config — use `by_name` to map data event names, `Fallback` for unmatched events |
|
|
419
443
|
| `Empty` | `EmptyMessagePartComponent` | Component shown for empty messages |
|
|
@@ -517,7 +541,7 @@ Container `View` for an attachment.
|
|
|
517
541
|
|
|
518
542
|
### AttachmentPrimitive.Thumb
|
|
519
543
|
|
|
520
|
-
`Text` component displaying the file extension (e.g. `.pdf`).
|
|
544
|
+
`Text` component displaying the file extension (e.g. `.pdf`), or the attachment type (e.g. `image`) when the filename has no extension (including leading-dot names like `.env`). If you pass `children`, they override that text.
|
|
521
545
|
|
|
522
546
|
```tsx
|
|
523
547
|
<AttachmentPrimitive.Thumb style={styles.extension} />
|
|
@@ -541,10 +565,20 @@ import { ActionBarPrimitive } from "@assistant-ui/react-native";
|
|
|
541
565
|
|
|
542
566
|
### ActionBarPrimitive.Copy
|
|
543
567
|
|
|
544
|
-
`Pressable` that copies the message content. Supports function-as-children for copy state feedback.
|
|
568
|
+
`Pressable` that copies the message content. Pass a platform clipboard writer through `copyToClipboard`. Supports function-as-children for copy state feedback.
|
|
545
569
|
|
|
546
570
|
```tsx
|
|
547
|
-
|
|
571
|
+
import * as Clipboard from "expo-clipboard";
|
|
572
|
+
|
|
573
|
+
const copyToClipboard = async (text: string) => {
|
|
574
|
+
const didCopy = await Clipboard.setStringAsync(text);
|
|
575
|
+
if (!didCopy) throw new Error("Clipboard write failed");
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
<ActionBarPrimitive.Copy
|
|
579
|
+
copiedDuration={3000}
|
|
580
|
+
copyToClipboard={copyToClipboard}
|
|
581
|
+
>
|
|
548
582
|
{({ isCopied }) => <Text>{isCopied ? "Copied!" : "Copy"}</Text>}
|
|
549
583
|
</ActionBarPrimitive.Copy>
|
|
550
584
|
```
|
|
@@ -552,7 +586,7 @@ import { ActionBarPrimitive } from "@assistant-ui/react-native";
|
|
|
552
586
|
| Prop | Type | Description |
|
|
553
587
|
|------|------|-------------|
|
|
554
588
|
| `copiedDuration` | `number` | Duration in ms to show "copied" state (default: 3000) |
|
|
555
|
-
| `copyToClipboard` | `(text: string) => void
|
|
589
|
+
| `copyToClipboard` | `(text: string) => void \| Promise<void>` | Platform clipboard writer |
|
|
556
590
|
|
|
557
591
|
### ActionBarPrimitive.Edit
|
|
558
592
|
|
|
@@ -11,9 +11,9 @@ import { VercelIcon } from "@/components/icons/vercel";
|
|
|
11
11
|
|
|
12
12
|
| AI SDK | Runtime package | Docs |
|
|
13
13
|
| --- | --- | --- |
|
|
14
|
-
| `ai@^7` + `@ai-sdk/react@^4` | `@assistant-ui/react-ai-sdk` (latest) | [v7 (current)](/docs/runtimes/ai-sdk/v7) |
|
|
15
|
-
| `ai@^6` + `@ai-sdk/react@^3` | `@assistant-ui/react-ai-sdk@1.
|
|
16
|
-
| `ai@^5` + `@ai-sdk/react@^2` | `@assistant-ui/react-ai-sdk@
|
|
14
|
+
| `ai@^7` + `@ai-sdk/react@^4` | `@assistant-ui/react-ai-sdk@^1.4` (latest) | [v7 (current)](/docs/runtimes/ai-sdk/v7) |
|
|
15
|
+
| `ai@^6` + `@ai-sdk/react@^3` | `@assistant-ui/react-ai-sdk@1.3.40` | [v6 (legacy)](/docs/runtimes/ai-sdk/v6-legacy) |
|
|
16
|
+
| `ai@^5` + `@ai-sdk/react@^2` | `@assistant-ui/react-ai-sdk@1.1.21` | [v5 (legacy)](/docs/runtimes/ai-sdk/v5-legacy) |
|
|
17
17
|
| `ai@^4` | `@assistant-ui/react-data-stream` | [v4 (legacy)](/docs/runtimes/ai-sdk/v4-legacy) |
|
|
18
18
|
|
|
19
19
|
New projects should target v7. v6, v5, and v4 are documented for projects that have not migrated yet; all have known compatibility gaps and receive no new features.
|
|
@@ -11,9 +11,9 @@ AI SDK v4 is a legacy version. New projects should use [AI SDK v7](/docs/runtime
|
|
|
11
11
|
|
|
12
12
|
## Why legacy
|
|
13
13
|
|
|
14
|
-
Vercel ships AI SDK majors roughly yearly; v4 is
|
|
14
|
+
Vercel ships AI SDK majors roughly yearly; v4 is three majors behind v7. The current `@assistant-ui/react-ai-sdk` package targets the current AI SDK major (v7) exclusively, so v4 users plug into [`@assistant-ui/react-data-stream`](/docs/runtimes/custom/data-stream) instead — the same data stream protocol that v4's `toDataStreamResponse()` emits.
|
|
15
15
|
|
|
16
|
-
This page is reference for existing v4 projects. Plan to migrate to
|
|
16
|
+
This page is reference for existing v4 projects. Plan to migrate to v7 when feasible.
|
|
17
17
|
|
|
18
18
|
## Setup
|
|
19
19
|
|
|
@@ -35,7 +35,7 @@ import { openai } from "@ai-sdk/openai";
|
|
|
35
35
|
|
|
36
36
|
export async function POST(req: Request) {
|
|
37
37
|
const { messages } = await req.json();
|
|
38
|
-
const result = streamText({ model: openai("gpt-5.
|
|
38
|
+
const result = streamText({ model: openai("gpt-5.6-luna"), messages });
|
|
39
39
|
return result.toDataStreamResponse();
|
|
40
40
|
}
|
|
41
41
|
```
|
|
@@ -95,9 +95,9 @@ When you are ready to upgrade:
|
|
|
95
95
|
|
|
96
96
|
AI SDK provides codemods at [ai-sdk.dev/docs/migration-guides](https://ai-sdk.dev/docs/migration-guides) that handle the package-side rewrites.
|
|
97
97
|
|
|
98
|
-
## Alternative: react-ai-sdk@0.
|
|
98
|
+
## Alternative: react-ai-sdk@0.10.16
|
|
99
99
|
|
|
100
|
-
An older release line of `@assistant-ui/react-ai-sdk`
|
|
100
|
+
An older release line of `@assistant-ui/react-ai-sdk` supported AI SDK v4 directly; its last release was `0.10.16`. It is no longer maintained and has no upgrade path; if you are starting a new v4 project, use `@assistant-ui/react-data-stream` instead.
|
|
101
101
|
|
|
102
102
|
## Related
|
|
103
103
|
|
|
@@ -6,12 +6,12 @@ description: Reference for projects still on AI SDK v5. New projects should use
|
|
|
6
6
|
import { VercelIcon } from "@/components/icons/vercel";
|
|
7
7
|
|
|
8
8
|
<Callout type="warn">
|
|
9
|
-
AI SDK v5 is a legacy version. New projects should use [AI SDK v7](/docs/runtimes/ai-sdk/v7). v5 users
|
|
9
|
+
AI SDK v5 is a legacy version. New projects should use [AI SDK v7](/docs/runtimes/ai-sdk/v7). v5 users pin `@assistant-ui/react-ai-sdk@1.1.21` (the last v5-compatible release); later releases target newer AI SDK majors.
|
|
10
10
|
</Callout>
|
|
11
11
|
|
|
12
12
|
## Why legacy
|
|
13
13
|
|
|
14
|
-
AI SDK v6 introduced major API changes: async `convertToModelMessages`, a new tool schema, and `toUIMessageStreamResponse()`. v5 still works but no longer receives new features in `@assistant-ui/react-ai-sdk`. Pinning to
|
|
14
|
+
AI SDK v6 introduced major API changes: async `convertToModelMessages`, a new tool schema, and `toUIMessageStreamResponse()`. v5 still works but no longer receives new features in `@assistant-ui/react-ai-sdk`. Pinning to `1.1.21` keeps you on the v5-compatible surface.
|
|
15
15
|
|
|
16
16
|
This page is reference for existing v5 projects. Plan to migrate to v7 when feasible.
|
|
17
17
|
|
|
@@ -22,7 +22,7 @@ This page is reference for existing v5 projects. Plan to migrate to v7 when feas
|
|
|
22
22
|
|
|
23
23
|
### Install v5-compatible versions
|
|
24
24
|
|
|
25
|
-
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk@
|
|
25
|
+
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk@1.1.21", "ai@^5", "@ai-sdk/openai@^1", "zod"]} />
|
|
26
26
|
|
|
27
27
|
</Step>
|
|
28
28
|
<Step>
|
|
@@ -40,7 +40,7 @@ export const maxDuration = 30;
|
|
|
40
40
|
export async function POST(req: Request) {
|
|
41
41
|
const { messages }: { messages: Message[] } = await req.json();
|
|
42
42
|
const result = streamText({
|
|
43
|
-
model: openai("gpt-5.
|
|
43
|
+
model: openai("gpt-5.6-luna"),
|
|
44
44
|
messages,
|
|
45
45
|
tools: {
|
|
46
46
|
get_current_weather: tool({
|
|
@@ -98,7 +98,7 @@ const runtime = useVercelUseChatRuntime(chat);
|
|
|
98
98
|
| Feature | v5 | v6 |
|
|
99
99
|
| --- | --- | --- |
|
|
100
100
|
| `ai` package | `ai@^5` | `ai@^6` |
|
|
101
|
-
| `@assistant-ui/react-ai-sdk` | `@
|
|
101
|
+
| `@assistant-ui/react-ai-sdk` | `@1.1.21` | `@1.3.40` |
|
|
102
102
|
| `@ai-sdk/openai` | `^1` | `^3` |
|
|
103
103
|
| Message type | `Message` | `UIMessage` |
|
|
104
104
|
| `convertToModelMessages` | Sync | Async (`await`) |
|