@assistant-ui/mcp-docs-server 0.2.1 → 0.2.3
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 +3 -3
- package/.docs/organized/code-examples/with-a2a.md +5 -4
- package/.docs/organized/code-examples/with-ag-ui.md +7 -6
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
- package/.docs/organized/code-examples/with-artifacts.md +12 -11
- package/.docs/organized/code-examples/with-assistant-transport.md +6 -5
- package/.docs/organized/code-examples/with-browser-extension.md +6 -6
- package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +11 -10
- package/.docs/organized/code-examples/with-custom-thread-list.md +11 -10
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -13
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +15 -14
- package/.docs/organized/code-examples/with-eve.md +6 -5
- package/.docs/organized/code-examples/with-expo.md +213 -36
- package/.docs/organized/code-examples/with-external-store.md +6 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +11 -10
- package/.docs/organized/code-examples/with-generative-ui.md +263 -29
- package/.docs/organized/code-examples/with-google-adk.md +5 -4
- package/.docs/organized/code-examples/with-heat-graph.md +3 -3
- package/.docs/organized/code-examples/with-image-generation.md +8 -7
- package/.docs/organized/code-examples/with-interactables.md +11 -10
- package/.docs/organized/code-examples/with-langchain.md +10 -9
- package/.docs/organized/code-examples/with-langgraph.md +7 -6
- package/.docs/organized/code-examples/with-livekit.md +15 -14
- package/.docs/organized/code-examples/with-mcp.md +14 -12
- package/.docs/organized/code-examples/with-nuxt.md +511 -575
- package/.docs/organized/code-examples/with-opencode.md +4 -4
- package/.docs/organized/code-examples/with-openui.md +450 -0
- package/.docs/organized/code-examples/with-pi.md +6 -5
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -13
- package/.docs/organized/code-examples/with-react-ink-web.md +65 -15
- package/.docs/organized/code-examples/with-react-ink.md +5 -4
- package/.docs/organized/code-examples/with-react-router.md +8 -7
- package/.docs/organized/code-examples/with-resumable-stream.md +13 -12
- package/.docs/organized/code-examples/with-store.md +3 -3
- package/.docs/organized/code-examples/with-svelte.md +415 -0
- package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
- package/.docs/organized/code-examples/with-tanstack.md +10 -9
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -4
- package/.docs/organized/code-examples/with-virtualized-thread.md +6 -5
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +6 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +26 -26
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +43 -18
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +61 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +32 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -2
- package/.docs/raw/docs/cloud/index.mdx +1 -1
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- package/.docs/raw/docs/guides/message-timing.mdx +11 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
- package/.docs/raw/docs/guides/speech.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +8 -5
- package/.docs/raw/docs/guides/voice.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +1 -1
- package/.docs/raw/docs/ink/index.mdx +3 -2
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +1 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +149 -131
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
- package/.docs/raw/docs/primitives/attachment.mdx +1 -1
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
- package/.docs/raw/docs/primitives/composer.mdx +1 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -1
- package/.docs/raw/docs/primitives/message.mdx +1 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +4 -2
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +2 -2
- package/.docs/raw/docs/react-native/adapters.mdx +1 -1
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/migration.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +142 -5
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +48 -6
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +118 -0
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +73 -33
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +9 -2
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +21 -2
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
- package/.docs/raw/docs/tools/index.mdx +2 -1
- package/.docs/raw/docs/tools/interactables.mdx +8 -7
- package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
- package/.docs/raw/docs/tools/mcp.mdx +2 -2
- package/.docs/raw/docs/tools/openui.mdx +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +18 -7
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +7 -3
- package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
- package/.docs/raw/docs/ui/attachment.mdx +50 -3
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -1
- package/.docs/raw/docs/ui/directive-text.mdx +1 -1
- package/.docs/raw/docs/ui/file.mdx +2 -2
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +2 -2
- package/.docs/raw/docs/ui/markdown.mdx +40 -1
- package/.docs/raw/docs/ui/mermaid.mdx +1 -1
- package/.docs/raw/docs/ui/message-timing.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/quote.mdx +3 -3
- package/.docs/raw/docs/ui/reasoning.mdx +31 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
- package/.docs/raw/docs/ui/sources.mdx +10 -1
- package/.docs/raw/docs/ui/streamdown.mdx +2 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread-list.mdx +40 -1
- package/.docs/raw/docs/ui/thread.mdx +49 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
- package/.docs/raw/docs/ui/tool-group.mdx +1 -1
- package/.docs/raw/docs/ui/voice.mdx +1 -1
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/xulux/catalog-client.d.ts.map +1 -1
- package/dist/xulux/catalog-client.js +51 -6
- package/dist/xulux/catalog-client.js.map +1 -1
- package/dist/xulux/types.d.ts +7 -7
- package/dist/xulux/types.d.ts.map +1 -1
- package/dist/xulux/types.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/tests/docs.test.ts +10 -7
- package/src/tools/tests/path-traversal.test.ts +5 -2
- package/src/tools/tests/xulux-templates.test.ts +63 -0
- package/src/xulux/catalog-client.ts +68 -23
- package/src/xulux/types.ts +17 -13
- package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -423
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
|
@@ -4,7 +4,7 @@ description: Let users select text from AI messages and quote it back into the c
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { QuoteComposerSample } from "@/components/docs/samples/quote-composer";
|
|
7
|
+
import { QuoteComposerSample } from "@/components/pages/docs/samples/quote-composer";
|
|
8
8
|
|
|
9
9
|
<QuoteComposerSample />
|
|
10
10
|
|
|
@@ -84,7 +84,7 @@ The context exposes two more verbs: `ctx.status(streamId)` returns `"streaming"
|
|
|
84
84
|
|
|
85
85
|
## Client side: native integration
|
|
86
86
|
|
|
87
|
-
`@assistant-ui/
|
|
87
|
+
`@assistant-ui/ai-sdk` ships a `resumable` option on `AssistantChatTransport`. It captures the stream id from the response header, redirects `chat.resumeStream()` reconnects to your resume route, and clears the stored id when the response finishes naturally. Pair it with `useChatRuntime`, which fires `chat.resumeStream()` whenever its resumable storage reports a pending id, including ids discovered after mount.
|
|
88
88
|
|
|
89
89
|
```tsx title="/app/page.tsx"
|
|
90
90
|
"use client";
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
AssistantChatTransport,
|
|
95
95
|
createResumableSessionStorage,
|
|
96
96
|
useChatRuntime,
|
|
97
|
-
} from "@assistant-ui/
|
|
97
|
+
} from "@assistant-ui/ai-sdk";
|
|
98
98
|
import { useMemo } from "react";
|
|
99
99
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
100
100
|
|
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
AssistantChatTransport,
|
|
154
154
|
createResumableSessionStorage,
|
|
155
155
|
useChatRuntime,
|
|
156
|
-
} from "@assistant-ui/
|
|
156
|
+
} from "@assistant-ui/ai-sdk";
|
|
157
157
|
import { useMemo } from "react";
|
|
158
158
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
159
159
|
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
|
@@ -4,7 +4,7 @@ description: Read AI chat messages aloud with the Web Speech API or a custom TTS
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { SpeechSample } from "@/components/docs/samples/speech";
|
|
7
|
+
import { SpeechSample } from "@/components/pages/docs/samples/speech";
|
|
8
8
|
|
|
9
9
|
assistant-ui supports text-to-speech via the `SpeechSynthesisAdapter` interface. When a speech adapter is configured, users can trigger playback for any assistant message.
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ Configure suggestions using the `Suggestions()` API in your runtime provider:
|
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { AuiConfig, Tools, Suggestions } from "@assistant-ui/react";
|
|
19
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
19
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
20
20
|
|
|
21
21
|
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
22
22
|
const runtime = useChatRuntime();
|
|
@@ -138,7 +138,7 @@ The primitives available for rendering suggestions are `ThreadPrimitive.Suggesti
|
|
|
138
138
|
|
|
139
139
|
## Runtime driven suggestions
|
|
140
140
|
|
|
141
|
-
The static `Suggestions(...)` API covers welcome screens. For follow up prompts that depend on the conversation, a tool result, or your backend, push suggestions through the runtime itself. They land on `thread.suggestions
|
|
141
|
+
The static `Suggestions(...)` API covers welcome screens. For follow up prompts that depend on the conversation, a tool result, or your backend, push suggestions through the runtime itself. They land on `thread.suggestions`, and when no static `Suggestions(...)` configuration is set, the `suggestions` scope derives from them, so `ThreadPrimitive.Suggestions` renders them as well. Runtime suggestions use the `ThreadSuggestion` shape: a required `prompt` plus optional `title` and `label`. When `title` is omitted it falls back to the prompt, and an omitted `label` renders as empty, so a prompt-only runtime suggestion looks exactly like a plain string suggestion.
|
|
142
142
|
|
|
143
143
|
### Local runtime: `SuggestionAdapter`
|
|
144
144
|
|
|
@@ -218,7 +218,7 @@ They also accept the same `suggestion` adapter as the local runtime under `adapt
|
|
|
218
218
|
|
|
219
219
|
```tsx
|
|
220
220
|
import { createSuggestionAdapter } from "@assistant-ui/react";
|
|
221
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
221
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
222
222
|
|
|
223
223
|
const runtime = useChatRuntime({
|
|
224
224
|
adapters: {
|
|
@@ -263,7 +263,7 @@ The local runtime clears its suggestions when a new run starts. External store r
|
|
|
263
263
|
|
|
264
264
|
### Rendering runtime suggestions
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
Runtime suggestions land on `thread.suggestions`, and `ThreadPrimitive.Suggestions` picks them up unless a static `Suggestions(...)` configuration overrides the scope. The shadcn registry ships `ThreadFollowupSuggestions` for the common single line pill layout. For a custom layout, read the array yourself:
|
|
267
267
|
|
|
268
268
|
```tsx
|
|
269
269
|
import { useAuiState, ThreadPrimitive, AuiIf } from "@assistant-ui/react";
|
|
@@ -280,7 +280,10 @@ function FollowUps() {
|
|
|
280
280
|
method="replace"
|
|
281
281
|
autoSend
|
|
282
282
|
>
|
|
283
|
-
{s.prompt}
|
|
283
|
+
{s.title ?? s.prompt}
|
|
284
|
+
{s.label && (
|
|
285
|
+
<span className="text-muted-foreground ms-1">{s.label}</span>
|
|
286
|
+
)}
|
|
284
287
|
</ThreadPrimitive.Suggestion>
|
|
285
288
|
))}
|
|
286
289
|
</div>
|
|
@@ -4,7 +4,7 @@ description: Build bidirectional voice conversations with AI in React. Realtime
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { VoiceSample } from "@/components/docs/samples/voice";
|
|
7
|
+
import { VoiceSample } from "@/components/pages/docs/samples/voice";
|
|
8
8
|
|
|
9
9
|
assistant-ui supports realtime bidirectional voice through the `RealtimeVoiceAdapter` interface. Users speak into their microphone, the agent answers with audio, and transcripts appear in the thread while the session runs.
|
|
10
10
|
|
|
@@ -129,7 +129,7 @@ const runtime = useLocalRuntime(chatModel, {
|
|
|
129
129
|
| `adapters.dictation` | `DictationAdapter` | Adapter for speech-to-text input |
|
|
130
130
|
| `adapters.feedback` | `FeedbackAdapter` | Adapter for message feedback (thumbs up/down) |
|
|
131
131
|
| `adapters.suggestion` | `SuggestionAdapter` | Adapter for suggested prompts |
|
|
132
|
-
| `cloud` | `AssistantCloud` | Cloud instance for thread persistence via
|
|
132
|
+
| `cloud` | `AssistantCloud` | Cloud instance for thread persistence via `assistant-cloud` |
|
|
133
133
|
| `unstable_humanToolNames` | `string[]` | Tool names that pause the run until a result is added via `addResult` |
|
|
134
134
|
|
|
135
135
|
### useRemoteThreadListRuntime
|
|
@@ -127,6 +127,7 @@ Use primitives to compose your terminal chat interface:
|
|
|
127
127
|
```tsx title="components/thread.tsx"
|
|
128
128
|
import { Box, Text } from "ink";
|
|
129
129
|
import {
|
|
130
|
+
AuiIf,
|
|
130
131
|
ThreadPrimitive,
|
|
131
132
|
ComposerPrimitive,
|
|
132
133
|
LoadingPrimitive,
|
|
@@ -170,11 +171,11 @@ const StatusIndicator = () => (
|
|
|
170
171
|
export const Thread = () => {
|
|
171
172
|
return (
|
|
172
173
|
<ThreadPrimitive.Root>
|
|
173
|
-
<
|
|
174
|
+
<AuiIf condition={(s) => s.thread.isEmpty}>
|
|
174
175
|
<Box marginBottom={1}>
|
|
175
176
|
<Text dimColor>No messages yet. Start typing below!</Text>
|
|
176
177
|
</Box>
|
|
177
|
-
</
|
|
178
|
+
</AuiIf>
|
|
178
179
|
|
|
179
180
|
<ThreadPrimitive.Messages>
|
|
180
181
|
{() => <Message />}
|
|
@@ -8,7 +8,7 @@ If you already have an assistant-ui web app, most of your code transfers directl
|
|
|
8
8
|
## What stays the same
|
|
9
9
|
|
|
10
10
|
- **Runtime setup** — `useLocalRuntime`, `ChatModelAdapter`, and all runtime options work identically.
|
|
11
|
-
- **AI SDK integration** — `@assistant-ui/
|
|
11
|
+
- **AI SDK integration** — `@assistant-ui/ai-sdk` works with React Ink. Your runtime setup transfers directly.
|
|
12
12
|
- **Tool definitions** — `Tools({ toolkit })` and toolkit renderers use the same API.
|
|
13
13
|
- **State hooks** — `useAuiState`, `useAui`, and selector patterns are the same.
|
|
14
14
|
- **Backend code** — Your API routes, streaming endpoints, and server-side logic need zero changes.
|
|
@@ -1217,7 +1217,7 @@ Container `Box` for the status bar. Forwards all `Box` props; pass `gap` to spac
|
|
|
1217
1217
|
```tsx
|
|
1218
1218
|
<StatusBarPrimitive.Root gap={1}>
|
|
1219
1219
|
<StatusBarPrimitive.Status />
|
|
1220
|
-
<StatusBarPrimitive.ModelName name="gpt-5" />
|
|
1220
|
+
<StatusBarPrimitive.ModelName name="gpt-5.6-luna" />
|
|
1221
1221
|
<StatusBarPrimitive.MessageCount />
|
|
1222
1222
|
<StatusBarPrimitive.TokenCount />
|
|
1223
1223
|
<StatusBarPrimitive.Latency />
|
|
@@ -340,7 +340,7 @@ The shape of `content` matches the AI SDK part types. Use `image` for images and
|
|
|
340
340
|
"use client";
|
|
341
341
|
|
|
342
342
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
343
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
343
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
344
344
|
import { attachmentAdapter } from "./attachment-adapter";
|
|
345
345
|
|
|
346
346
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -363,7 +363,7 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react-native";
|
|
|
363
363
|
import {
|
|
364
364
|
AssistantChatTransport,
|
|
365
365
|
useChatRuntime,
|
|
366
|
-
} from "@assistant-ui/
|
|
366
|
+
} from "@assistant-ui/ai-sdk";
|
|
367
367
|
import { attachmentAdapter } from "./attachment-adapter";
|
|
368
368
|
|
|
369
369
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -387,7 +387,7 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react-ink";
|
|
|
387
387
|
import {
|
|
388
388
|
AssistantChatTransport,
|
|
389
389
|
useChatRuntime,
|
|
390
|
-
} from "@assistant-ui/
|
|
390
|
+
} from "@assistant-ui/ai-sdk";
|
|
391
391
|
import { attachmentAdapter } from "./attachment-adapter";
|
|
392
392
|
|
|
393
393
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Vercel AI SDK
|
|
2
|
+
title: Vercel AI SDK
|
|
3
3
|
description: Wire the Vercel AI SDK into a React chat UI with assistant-ui — useChat, streaming, tools, attachments, multi-step agents, and persistence covered end-to-end.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -16,14 +16,14 @@ If you arrived here looking to wire up your first chat: jump to [AI SDK v7 quick
|
|
|
16
16
|
```mermaid
|
|
17
17
|
flowchart LR
|
|
18
18
|
client["client"]
|
|
19
|
-
runtime["useChatRuntime (
|
|
19
|
+
runtime["useChatRuntime (ai-sdk)<br/>(thread state · tool calls · attachments<br/>speech · dictation · feedback adapters)"]
|
|
20
20
|
api["/api/chat<br/>(streamText)"]
|
|
21
21
|
provider["provider"]
|
|
22
22
|
|
|
23
23
|
client --> runtime --> api --> provider
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
`@assistant-ui/
|
|
26
|
+
`@assistant-ui/ai-sdk` wraps the AI SDK's `useChat` hook and exposes it as an assistant-ui runtime. The runtime owns conversation state on the client; your `/api/chat` route returns a UI message stream from `streamText`. Everything else (tools, attachments, observability, gateways, custom persistence) layers on top of this base.
|
|
27
27
|
|
|
28
28
|
## Pick a version
|
|
29
29
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Cloudflare Agents
|
|
2
|
+
title: Cloudflare Agents
|
|
3
3
|
description: Wire Cloudflare's stateful agent framework into a React chat UI with assistant-ui via the standard AI SDK runtime. WebSocket transport, server-side persistence, tool calling, all preserved.
|
|
4
|
+
platforms: ["react"]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
import { CloudflareIcon } from "@/components/icons/cloudflare";
|
|
@@ -16,7 +17,7 @@ This is an integration guide, not a runtime adapter. assistant-ui does not ship
|
|
|
16
17
|
|
|
17
18
|
Cloudflare Agents handles the server half: a Durable Object subclasses `AIChatAgent` from `@cloudflare/ai-chat`, owns the message history, and streams responses back over a WebSocket. `@cloudflare/ai-chat/react`'s `useAgentChat` hook wraps that WebSocket and exposes the same `messages`, `sendMessage`, `regenerate`, `status`, `stop`, `setMessages`, `addToolOutput` surface that the AI SDK's `useChat` does, plus a few Cloudflare-specific extras (`clearHistory`, `isServerStreaming`, `isToolContinuation`).
|
|
18
19
|
|
|
19
|
-
assistant-ui handles the client half. `useAISDKRuntime` from [`@assistant-ui/
|
|
20
|
+
assistant-ui handles the client half. `useAISDKRuntime` from [`@assistant-ui/ai-sdk`](/docs/runtimes/ai-sdk/v7) reads exactly those AI SDK methods off whatever you pass in, so feeding it `useAgentChat`'s return value yields a fully-featured runtime: streaming, tool calling, edit, reload, history import and export, attachments, suggestions.
|
|
20
21
|
|
|
21
22
|
Shared adapters (attachments, speech, feedback, history) work the same way as described in [adapters](/docs/runtimes/concepts/adapters). Multi-thread support needs a [custom thread list](/docs/runtimes/concepts/threads) wired around `useAISDKRuntime`; [AssistantCloud](/docs/cloud) integrates via `useChatRuntime` (which constructs its own `useChat` internally) and is not compatible with the `useAgentChat` wiring shown here.
|
|
22
23
|
|
|
@@ -198,7 +199,7 @@ In the frontend project:
|
|
|
198
199
|
import { useAgent } from "agents/react";
|
|
199
200
|
import { useAgentChat } from "@cloudflare/ai-chat/react";
|
|
200
201
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
201
|
-
import { useAISDKRuntime } from "@assistant-ui/
|
|
202
|
+
import { useAISDKRuntime } from "@assistant-ui/ai-sdk";
|
|
202
203
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
203
204
|
|
|
204
205
|
export const Assistant = () => {
|
|
@@ -19,7 +19,7 @@ This is an integration guide, not a runtime adapter. assistant-ui does not ship
|
|
|
19
19
|
| [Full-stack](/docs/integrations/frameworks/mastra/full-stack) | One Next.js app: API routes call Mastra in-process. Simpler deployment, single repo. |
|
|
20
20
|
| [Separate server](/docs/integrations/frameworks/mastra/separate-server) | Mastra runs as its own service; the Next.js frontend hits its API. Independent scaling, clearer separation of concerns. |
|
|
21
21
|
|
|
22
|
-
Both use the same client-side `useChatRuntime` from [`@assistant-ui/
|
|
22
|
+
Both use the same client-side `useChatRuntime` from [`@assistant-ui/ai-sdk`](/docs/runtimes/ai-sdk/v7). The only difference is where the Mastra agent lives.
|
|
23
23
|
|
|
24
24
|
## Architecture
|
|
25
25
|
|
|
@@ -129,7 +129,7 @@ Open the file containing `useChatRuntime` (typically `app/assistant.tsx`) and pa
|
|
|
129
129
|
"use client";
|
|
130
130
|
|
|
131
131
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
132
|
-
import { AssistantChatTransport, useChatRuntime } from "@assistant-ui/
|
|
132
|
+
import { AssistantChatTransport, useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
133
133
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
134
134
|
|
|
135
135
|
export const Assistant = () => {
|
|
@@ -11,7 +11,7 @@ import { LangChainIcon } from "@/components/icons/langchain";
|
|
|
11
11
|
import { McpIcon } from "@/components/icons/mcp";
|
|
12
12
|
import { VercelIcon } from "@/components/icons/vercel";
|
|
13
13
|
|
|
14
|
-
Integrations are wiring guides for using third-party services with assistant-ui, plus canonical recipes for the adapter slots (persistence, attachments). They are distinct from [runtimes](/docs/runtimes/pick-a-runtime), which are the React adapter packages (`@assistant-ui/
|
|
14
|
+
Integrations are wiring guides for using third-party services with assistant-ui, plus canonical recipes for the adapter slots (persistence, attachments). They are distinct from [runtimes](/docs/runtimes/pick-a-runtime), which are the React adapter packages (`@assistant-ui/ai-sdk`, `@assistant-ui/react-langgraph`, etc.) that connect the UI to a backend. An integration assumes you already have a working runtime and adds something on top.
|
|
15
15
|
|
|
16
16
|
## Where integrations slot in
|
|
17
17
|
|
|
@@ -40,7 +40,7 @@ Framework integrations that pair with assistant-ui at the API-route layer.
|
|
|
40
40
|
icon={<CloudflareIcon width={20} height={20} />}
|
|
41
41
|
title="Cloudflare Agents"
|
|
42
42
|
description="Stateful Durable Object agents. Wired through the AI SDK runtime with WebSocket streaming."
|
|
43
|
-
href="/docs/integrations/frameworks/cloudflare-agents
|
|
43
|
+
href="/docs/integrations/frameworks/cloudflare-agents"
|
|
44
44
|
/>
|
|
45
45
|
<Card
|
|
46
46
|
icon={<MastraIcon width={20} height={20} />}
|
|
@@ -227,7 +227,7 @@ export async function POST(
|
|
|
227
227
|
|
|
228
228
|
### Implement `RemoteThreadListAdapter`
|
|
229
229
|
|
|
230
|
-
The adapter calls your endpoints. `
|
|
230
|
+
The adapter calls your endpoints. `unstable_useAdapters` injects the per-thread history adapter on the `RemoteThreadList` store entry and on `useRemoteThreadListRuntime` when `unstable_Provider` is omitted. `unstable_Provider` is an optional React face for that runtime. On the `RemoteThreadList` store entry, key the thread factory with `withKey(id, …)` so history reloads when the visible thread changes.
|
|
231
231
|
|
|
232
232
|
<PlatformTabs>
|
|
233
233
|
<Tab value="React">
|
|
@@ -244,6 +244,51 @@ import {
|
|
|
244
244
|
import { createAssistantStream } from "assistant-stream";
|
|
245
245
|
import { useMemo } from "react";
|
|
246
246
|
|
|
247
|
+
function useThreadListAdapters() {
|
|
248
|
+
const aui = useAui();
|
|
249
|
+
const history = useMemo<ThreadHistoryAdapter>(
|
|
250
|
+
() => ({
|
|
251
|
+
async load() {
|
|
252
|
+
return { messages: [] };
|
|
253
|
+
},
|
|
254
|
+
async append() {},
|
|
255
|
+
withFormat: (fmt) => ({
|
|
256
|
+
async load() {
|
|
257
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
258
|
+
if (!remoteId) return { messages: [] };
|
|
259
|
+
const rows = await fetch(
|
|
260
|
+
`/api/threads/${remoteId}/messages`,
|
|
261
|
+
).then((r) => r.json());
|
|
262
|
+
return {
|
|
263
|
+
messages: rows.map((row: any) =>
|
|
264
|
+
fmt.decode({
|
|
265
|
+
id: row.id,
|
|
266
|
+
parent_id: row.parent_id,
|
|
267
|
+
format: row.format,
|
|
268
|
+
content: row.content,
|
|
269
|
+
}),
|
|
270
|
+
),
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
async append(item) {
|
|
274
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
275
|
+
await fetch(`/api/threads/${remoteId}/messages`, {
|
|
276
|
+
method: "POST",
|
|
277
|
+
body: JSON.stringify({
|
|
278
|
+
id: fmt.getId(item.message),
|
|
279
|
+
parent_id: item.parentId,
|
|
280
|
+
format: fmt.format,
|
|
281
|
+
content: fmt.encode(item),
|
|
282
|
+
}),
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
}),
|
|
287
|
+
[aui],
|
|
288
|
+
);
|
|
289
|
+
return useMemo(() => ({ history }), [history]);
|
|
290
|
+
}
|
|
291
|
+
|
|
247
292
|
export const threadListAdapter: RemoteThreadListAdapter = {
|
|
248
293
|
async list() {
|
|
249
294
|
const rows = await fetch("/api/threads").then((r) => r.json());
|
|
@@ -295,50 +340,11 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
295
340
|
controller.appendText(title);
|
|
296
341
|
});
|
|
297
342
|
},
|
|
343
|
+
unstable_useAdapters: useThreadListAdapters,
|
|
298
344
|
unstable_Provider({ children }) {
|
|
299
|
-
const
|
|
300
|
-
const history = useMemo<ThreadHistoryAdapter>(
|
|
301
|
-
() => ({
|
|
302
|
-
async load() {
|
|
303
|
-
return { messages: [] };
|
|
304
|
-
},
|
|
305
|
-
async append() {},
|
|
306
|
-
withFormat: (fmt) => ({
|
|
307
|
-
async load() {
|
|
308
|
-
const { remoteId } = aui.threadListItem.getState();
|
|
309
|
-
if (!remoteId) return { messages: [] };
|
|
310
|
-
const rows = await fetch(
|
|
311
|
-
`/api/threads/${remoteId}/messages`,
|
|
312
|
-
).then((r) => r.json());
|
|
313
|
-
return {
|
|
314
|
-
messages: rows.map((row: any) =>
|
|
315
|
-
fmt.decode({
|
|
316
|
-
id: row.id,
|
|
317
|
-
parent_id: row.parent_id,
|
|
318
|
-
format: row.format,
|
|
319
|
-
content: row.content,
|
|
320
|
-
}),
|
|
321
|
-
),
|
|
322
|
-
};
|
|
323
|
-
},
|
|
324
|
-
async append(item) {
|
|
325
|
-
const { remoteId } = await aui.threadListItem.initialize();
|
|
326
|
-
await fetch(`/api/threads/${remoteId}/messages`, {
|
|
327
|
-
method: "POST",
|
|
328
|
-
body: JSON.stringify({
|
|
329
|
-
id: fmt.getId(item.message),
|
|
330
|
-
parent_id: item.parentId,
|
|
331
|
-
format: fmt.format,
|
|
332
|
-
content: fmt.encode(item),
|
|
333
|
-
}),
|
|
334
|
-
});
|
|
335
|
-
},
|
|
336
|
-
}),
|
|
337
|
-
}),
|
|
338
|
-
[aui],
|
|
339
|
-
);
|
|
345
|
+
const adapters = useThreadListAdapters();
|
|
340
346
|
return (
|
|
341
|
-
<RuntimeAdapterProvider adapters={
|
|
347
|
+
<RuntimeAdapterProvider adapters={adapters}>
|
|
342
348
|
{children}
|
|
343
349
|
</RuntimeAdapterProvider>
|
|
344
350
|
);
|
|
@@ -359,6 +365,51 @@ import {
|
|
|
359
365
|
import { createAssistantStream } from "assistant-stream";
|
|
360
366
|
import { useMemo } from "react";
|
|
361
367
|
|
|
368
|
+
function useThreadListAdapters() {
|
|
369
|
+
const aui = useAui();
|
|
370
|
+
const history = useMemo<ThreadHistoryAdapter>(
|
|
371
|
+
() => ({
|
|
372
|
+
async load() {
|
|
373
|
+
return { messages: [] };
|
|
374
|
+
},
|
|
375
|
+
async append() {},
|
|
376
|
+
withFormat: (fmt) => ({
|
|
377
|
+
async load() {
|
|
378
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
379
|
+
if (!remoteId) return { messages: [] };
|
|
380
|
+
const rows = await fetch(
|
|
381
|
+
`${API_URL}/threads/${remoteId}/messages`,
|
|
382
|
+
).then((r) => r.json());
|
|
383
|
+
return {
|
|
384
|
+
messages: rows.map((row: any) =>
|
|
385
|
+
fmt.decode({
|
|
386
|
+
id: row.id,
|
|
387
|
+
parent_id: row.parent_id,
|
|
388
|
+
format: row.format,
|
|
389
|
+
content: row.content,
|
|
390
|
+
}),
|
|
391
|
+
),
|
|
392
|
+
};
|
|
393
|
+
},
|
|
394
|
+
async append(item) {
|
|
395
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
396
|
+
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
397
|
+
method: "POST",
|
|
398
|
+
body: JSON.stringify({
|
|
399
|
+
id: fmt.getId(item.message),
|
|
400
|
+
parent_id: item.parentId,
|
|
401
|
+
format: fmt.format,
|
|
402
|
+
content: fmt.encode(item),
|
|
403
|
+
}),
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
}),
|
|
407
|
+
}),
|
|
408
|
+
[aui],
|
|
409
|
+
);
|
|
410
|
+
return useMemo(() => ({ history }), [history]);
|
|
411
|
+
}
|
|
412
|
+
|
|
362
413
|
export const threadListAdapter: RemoteThreadListAdapter = {
|
|
363
414
|
async list() {
|
|
364
415
|
const rows = await fetch(`${API_URL}/threads`).then((r) => r.json());
|
|
@@ -412,50 +463,11 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
412
463
|
controller.appendText(title);
|
|
413
464
|
});
|
|
414
465
|
},
|
|
466
|
+
unstable_useAdapters: useThreadListAdapters,
|
|
415
467
|
unstable_Provider({ children }) {
|
|
416
|
-
const
|
|
417
|
-
const history = useMemo<ThreadHistoryAdapter>(
|
|
418
|
-
() => ({
|
|
419
|
-
async load() {
|
|
420
|
-
return { messages: [] };
|
|
421
|
-
},
|
|
422
|
-
async append() {},
|
|
423
|
-
withFormat: (fmt) => ({
|
|
424
|
-
async load() {
|
|
425
|
-
const { remoteId } = aui.threadListItem.getState();
|
|
426
|
-
if (!remoteId) return { messages: [] };
|
|
427
|
-
const rows = await fetch(
|
|
428
|
-
`${API_URL}/threads/${remoteId}/messages`,
|
|
429
|
-
).then((r) => r.json());
|
|
430
|
-
return {
|
|
431
|
-
messages: rows.map((row: any) =>
|
|
432
|
-
fmt.decode({
|
|
433
|
-
id: row.id,
|
|
434
|
-
parent_id: row.parent_id,
|
|
435
|
-
format: row.format,
|
|
436
|
-
content: row.content,
|
|
437
|
-
}),
|
|
438
|
-
),
|
|
439
|
-
};
|
|
440
|
-
},
|
|
441
|
-
async append(item) {
|
|
442
|
-
const { remoteId } = await aui.threadListItem.initialize();
|
|
443
|
-
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
444
|
-
method: "POST",
|
|
445
|
-
body: JSON.stringify({
|
|
446
|
-
id: fmt.getId(item.message),
|
|
447
|
-
parent_id: item.parentId,
|
|
448
|
-
format: fmt.format,
|
|
449
|
-
content: fmt.encode(item),
|
|
450
|
-
}),
|
|
451
|
-
});
|
|
452
|
-
},
|
|
453
|
-
}),
|
|
454
|
-
}),
|
|
455
|
-
[aui],
|
|
456
|
-
);
|
|
468
|
+
const adapters = useThreadListAdapters();
|
|
457
469
|
return (
|
|
458
|
-
<RuntimeAdapterProvider adapters={
|
|
470
|
+
<RuntimeAdapterProvider adapters={adapters}>
|
|
459
471
|
{children}
|
|
460
472
|
</RuntimeAdapterProvider>
|
|
461
473
|
);
|
|
@@ -478,6 +490,51 @@ import {
|
|
|
478
490
|
import { createAssistantStream } from "assistant-stream";
|
|
479
491
|
import { useMemo } from "react";
|
|
480
492
|
|
|
493
|
+
function useThreadListAdapters() {
|
|
494
|
+
const aui = useAui();
|
|
495
|
+
const history = useMemo<ThreadHistoryAdapter>(
|
|
496
|
+
() => ({
|
|
497
|
+
async load() {
|
|
498
|
+
return { messages: [] };
|
|
499
|
+
},
|
|
500
|
+
async append() {},
|
|
501
|
+
withFormat: (fmt) => ({
|
|
502
|
+
async load() {
|
|
503
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
504
|
+
if (!remoteId) return { messages: [] };
|
|
505
|
+
const rows = await fetch(
|
|
506
|
+
`${API_URL}/threads/${remoteId}/messages`,
|
|
507
|
+
).then((r) => r.json());
|
|
508
|
+
return {
|
|
509
|
+
messages: rows.map((row: any) =>
|
|
510
|
+
fmt.decode({
|
|
511
|
+
id: row.id,
|
|
512
|
+
parent_id: row.parent_id,
|
|
513
|
+
format: row.format,
|
|
514
|
+
content: row.content,
|
|
515
|
+
}),
|
|
516
|
+
),
|
|
517
|
+
};
|
|
518
|
+
},
|
|
519
|
+
async append(item) {
|
|
520
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
521
|
+
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
522
|
+
method: "POST",
|
|
523
|
+
body: JSON.stringify({
|
|
524
|
+
id: fmt.getId(item.message),
|
|
525
|
+
parent_id: item.parentId,
|
|
526
|
+
format: fmt.format,
|
|
527
|
+
content: fmt.encode(item),
|
|
528
|
+
}),
|
|
529
|
+
});
|
|
530
|
+
},
|
|
531
|
+
}),
|
|
532
|
+
}),
|
|
533
|
+
[aui],
|
|
534
|
+
);
|
|
535
|
+
return useMemo(() => ({ history }), [history]);
|
|
536
|
+
}
|
|
537
|
+
|
|
481
538
|
export const threadListAdapter: RemoteThreadListAdapter = {
|
|
482
539
|
async list() {
|
|
483
540
|
const rows = await fetch(`${API_URL}/threads`).then((r) => r.json());
|
|
@@ -531,50 +588,11 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
531
588
|
controller.appendText(title);
|
|
532
589
|
});
|
|
533
590
|
},
|
|
591
|
+
unstable_useAdapters: useThreadListAdapters,
|
|
534
592
|
unstable_Provider({ children }) {
|
|
535
|
-
const
|
|
536
|
-
const history = useMemo<ThreadHistoryAdapter>(
|
|
537
|
-
() => ({
|
|
538
|
-
async load() {
|
|
539
|
-
return { messages: [] };
|
|
540
|
-
},
|
|
541
|
-
async append() {},
|
|
542
|
-
withFormat: (fmt) => ({
|
|
543
|
-
async load() {
|
|
544
|
-
const { remoteId } = aui.threadListItem.getState();
|
|
545
|
-
if (!remoteId) return { messages: [] };
|
|
546
|
-
const rows = await fetch(
|
|
547
|
-
`${API_URL}/threads/${remoteId}/messages`,
|
|
548
|
-
).then((r) => r.json());
|
|
549
|
-
return {
|
|
550
|
-
messages: rows.map((row: any) =>
|
|
551
|
-
fmt.decode({
|
|
552
|
-
id: row.id,
|
|
553
|
-
parent_id: row.parent_id,
|
|
554
|
-
format: row.format,
|
|
555
|
-
content: row.content,
|
|
556
|
-
}),
|
|
557
|
-
),
|
|
558
|
-
};
|
|
559
|
-
},
|
|
560
|
-
async append(item) {
|
|
561
|
-
const { remoteId } = await aui.threadListItem.initialize();
|
|
562
|
-
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
563
|
-
method: "POST",
|
|
564
|
-
body: JSON.stringify({
|
|
565
|
-
id: fmt.getId(item.message),
|
|
566
|
-
parent_id: item.parentId,
|
|
567
|
-
format: fmt.format,
|
|
568
|
-
content: fmt.encode(item),
|
|
569
|
-
}),
|
|
570
|
-
});
|
|
571
|
-
},
|
|
572
|
-
}),
|
|
573
|
-
}),
|
|
574
|
-
[aui],
|
|
575
|
-
);
|
|
593
|
+
const adapters = useThreadListAdapters();
|
|
576
594
|
return (
|
|
577
|
-
<RuntimeAdapterProvider adapters={
|
|
595
|
+
<RuntimeAdapterProvider adapters={adapters}>
|
|
578
596
|
{children}
|
|
579
597
|
</RuntimeAdapterProvider>
|
|
580
598
|
);
|
|
@@ -632,7 +650,7 @@ import {
|
|
|
632
650
|
AssistantRuntimeProvider,
|
|
633
651
|
useRemoteThreadListRuntime,
|
|
634
652
|
} from "@assistant-ui/react";
|
|
635
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
653
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
636
654
|
import { threadListAdapter } from "./thread-adapter";
|
|
637
655
|
|
|
638
656
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -659,7 +677,7 @@ import {
|
|
|
659
677
|
import {
|
|
660
678
|
AssistantChatTransport,
|
|
661
679
|
useChatRuntime,
|
|
662
|
-
} from "@assistant-ui/
|
|
680
|
+
} from "@assistant-ui/ai-sdk";
|
|
663
681
|
import { threadListAdapter } from "./thread-adapter";
|
|
664
682
|
|
|
665
683
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -689,7 +707,7 @@ import {
|
|
|
689
707
|
import {
|
|
690
708
|
AssistantChatTransport,
|
|
691
709
|
useChatRuntime,
|
|
692
|
-
} from "@assistant-ui/
|
|
710
|
+
} from "@assistant-ui/ai-sdk";
|
|
693
711
|
import { threadListAdapter } from "./thread-adapter";
|
|
694
712
|
|
|
695
713
|
export function MyProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -728,7 +746,7 @@ Send a message in a fresh thread. Check the database:
|
|
|
728
746
|
|
|
729
747
|
## Notes
|
|
730
748
|
|
|
731
|
-
- **First-message race.** `append` may fire before the thread row exists. The
|
|
749
|
+
- **First-message race.** `append` may fire before the thread row exists. The example above always awaits `aui.threadListItem.initialize()` before writing; do the same in any custom implementation.
|
|
732
750
|
- **Reload after async auth.** If `auth()` resolves after the initial `list()` call, threads won't appear until the user refreshes. Call `aui.threads.reload()` from a `useEffect` watching the session. Pattern is documented in [threads](/docs/runtimes/concepts/threads#reloading-after-async-authentication).
|
|
733
751
|
- **Format string.** The `format` column is *not* a free-text label; it identifies the on-disk shape so multiple runtimes can coexist. Don't strip it. Don't make assumptions about its value (`useChatRuntime` is responsible for setting and decoding it).
|
|
734
752
|
- **Pending approvals need `update`.** Tool call approvals persist across reloads only when the formatted adapter implements `update`; omitting it keeps the pre-approval snapshot out of storage by design.
|
|
@@ -16,7 +16,7 @@ Use a toolkit registered with `Tools({ toolkit })` instead. Toolkits keep the mo
|
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { AssistantRuntimeProvider, makeAssistantTool } from "@assistant-ui/react";
|
|
19
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
19
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
20
20
|
import { z } from "zod";
|
|
21
21
|
|
|
22
22
|
const WeatherTool = makeAssistantTool({
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
AuiConfig,
|
|
77
77
|
Tools,
|
|
78
78
|
} from "@assistant-ui/react";
|
|
79
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
79
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
80
80
|
import toolkit from "./toolkit";
|
|
81
81
|
|
|
82
82
|
export function App() {
|