@assistant-ui/mcp-docs-server 0.1.38 → 0.2.0
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 +11 -12
- package/.docs/organized/code-examples/with-a2a.md +18 -13
- package/.docs/organized/code-examples/with-ag-ui.md +19 -14
- package/.docs/organized/code-examples/{with-ai-sdk-v6.md → with-ai-sdk-v7.md} +34 -23
- package/.docs/organized/code-examples/with-artifacts.md +473 -141
- package/.docs/organized/code-examples/with-assistant-transport.md +17 -10
- package/.docs/organized/code-examples/with-browser-extension.md +17 -10
- package/.docs/organized/code-examples/with-chain-of-thought.md +21 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +12 -11
- package/.docs/organized/code-examples/with-cloud.md +20 -15
- package/.docs/organized/code-examples/with-custom-thread-list.md +19 -12
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +22 -15
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +22 -15
- package/.docs/organized/code-examples/with-eve.md +18 -11
- package/.docs/organized/code-examples/with-expo.md +35 -52
- package/.docs/organized/code-examples/with-external-store.md +18 -13
- package/.docs/organized/code-examples/with-ffmpeg.md +20 -15
- package/.docs/organized/code-examples/with-generative-ui.md +22 -17
- package/.docs/organized/code-examples/with-google-adk.md +18 -11
- package/.docs/organized/code-examples/with-heat-graph.md +10 -11
- package/.docs/organized/code-examples/with-image-generation.md +19 -12
- package/.docs/organized/code-examples/with-interactables.md +21 -17
- package/.docs/organized/code-examples/with-langchain.md +19 -12
- package/.docs/organized/code-examples/with-langgraph.md +19 -12
- package/.docs/organized/code-examples/with-livekit.md +23 -16
- package/.docs/organized/code-examples/with-mcp.md +46 -28
- package/.docs/organized/code-examples/with-opencode.md +25 -23
- package/.docs/organized/code-examples/with-pi.md +54 -19
- package/.docs/organized/code-examples/with-react-hook-form.md +21 -16
- package/.docs/organized/code-examples/with-react-ink-web.md +9 -9
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +22 -17
- package/.docs/organized/code-examples/with-resumable-stream.md +21 -14
- package/.docs/organized/code-examples/with-store.md +10 -11
- package/.docs/organized/code-examples/with-tanstack.md +19 -13
- package/.docs/organized/code-examples/with-tap-runtime.md +18 -13
- package/.docs/organized/code-examples/with-virtualized-thread.md +19 -14
- package/.docs/raw/docs/(docs)/base-ui.mdx +39 -0
- package/.docs/raw/docs/(docs)/cli.mdx +19 -1
- package/.docs/raw/docs/(docs)/devtools.mdx +7 -2
- package/.docs/raw/docs/(docs)/installation.mdx +15 -1
- package/.docs/raw/docs/(docs)/rtl.mdx +2 -4
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/a2ui.mdx +40 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/actions.mdx +56 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/components.mdx +86 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +22 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/json-generative-ui.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +53 -2
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +81 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +86 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/tokens.mdx +62 -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/index.mdx +4 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +25 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +37 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -9
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +1 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +14 -31
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +1 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +3 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +2 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +0 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +12 -9
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +4 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +7 -1
- package/.docs/raw/docs/cloud/langgraph.mdx +4 -2
- package/.docs/raw/docs/copilots/model-context.mdx +1 -1
- package/.docs/raw/docs/copilots/motivation.mdx +1 -1
- package/.docs/raw/docs/guides/attachments.mdx +3 -3
- package/.docs/raw/docs/guides/branching.mdx +2 -2
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +108 -0
- package/.docs/raw/docs/guides/context-api.mdx +89 -111
- package/.docs/raw/docs/guides/dictation.mdx +185 -257
- 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 +20 -0
- package/.docs/raw/docs/guides/mentions.mdx +31 -3
- 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 +12 -1
- package/.docs/raw/docs/guides/speech.mdx +47 -29
- package/.docs/raw/docs/guides/suggestions.mdx +70 -1
- package/.docs/raw/docs/guides/voice.mdx +197 -267
- package/.docs/raw/docs/ink/hooks.mdx +3 -3
- package/.docs/raw/docs/ink/primitives.mdx +49 -8
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +2 -2
- package/.docs/raw/docs/integrations/auth/clerk.mdx +2 -2
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +10 -4
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +3 -3
- 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 +1 -1
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +1 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +36 -9
- package/.docs/raw/docs/migrations/index.mdx +50 -0
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +4 -2
- package/.docs/raw/docs/migrations/v0-15.mdx +156 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +6 -1
- package/.docs/raw/docs/primitives/composer.mdx +17 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +25 -0
- package/.docs/raw/docs/primitives/thread-list.mdx +2 -2
- package/.docs/raw/docs/react-native/hooks.mdx +3 -3
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +62 -5
- package/.docs/raw/docs/runtimes/ag-ui/agent-state.mdx +124 -0
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +10 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +14 -5
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +15 -15
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +8 -8
- package/.docs/raw/docs/runtimes/ai-sdk/{v6.mdx → v6-legacy.mdx} +11 -9
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +717 -0
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +1 -1
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +1 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +10 -10
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +10 -19
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +5 -3
- package/.docs/raw/docs/runtimes/eve/overview.mdx +1 -1
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/agent-state.mdx +181 -0
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +3 -1
- package/.docs/raw/docs/tools/a2ui.mdx +107 -0
- package/.docs/raw/docs/tools/backend.mdx +6 -3
- package/.docs/raw/docs/tools/defining-tools.mdx +7 -1
- package/.docs/raw/docs/tools/generative-ui.mdx +60 -2
- package/.docs/raw/docs/tools/interactables-legacy.mdx +4 -4
- package/.docs/raw/docs/tools/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +90 -13
- package/.docs/raw/docs/tools/mcp.mdx +100 -3
- package/.docs/raw/docs/tools/tool-ui.mdx +6 -4
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +77 -9
- package/.docs/raw/docs/ui/accordion.mdx +16 -10
- package/.docs/raw/docs/ui/assistant-modal.mdx +8 -4
- package/.docs/raw/docs/ui/attachment.mdx +5 -1
- package/.docs/raw/docs/ui/badge.mdx +23 -12
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +4 -2
- package/.docs/raw/docs/ui/model-selector.mdx +33 -3
- package/.docs/raw/docs/ui/part-grouping.mdx +0 -4
- package/.docs/raw/docs/ui/reasoning.mdx +1 -1
- package/.docs/raw/docs/ui/select.mdx +22 -14
- package/.docs/raw/docs/ui/sources.mdx +1 -1
- package/.docs/raw/docs/ui/tabs.mdx +25 -14
- package/.docs/raw/docs/utilities/heat-graph.mdx +2 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -2
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -1
- package/dist/prompts/xulux-playground.d.ts +12 -0
- package/dist/prompts/xulux-playground.d.ts.map +1 -0
- package/dist/prompts/xulux-playground.js +33 -0
- package/dist/prompts/xulux-playground.js.map +1 -0
- package/dist/stdio.d.ts +1 -1
- package/dist/tools/docs.d.ts +8 -14
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +26 -10
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +6 -12
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +11 -8
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/resources.d.ts +1 -2
- package/dist/tools/resources.d.ts.map +1 -1
- package/dist/tools/resources.js +1 -1
- package/dist/tools/resources.js.map +1 -1
- package/dist/tools/search.d.ts +6 -15
- 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 +5 -1
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/tools/xulux-templates.d.ts +58 -0
- package/dist/tools/xulux-templates.d.ts.map +1 -0
- package/dist/tools/xulux-templates.js +82 -0
- package/dist/tools/xulux-templates.js.map +1 -0
- package/dist/utils/cache.d.ts +5 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +18 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/mcp-format.d.ts +1 -0
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +7 -4
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/paths.d.ts +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +3 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/search.d.ts.map +1 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js.map +1 -1
- package/dist/xulux/catalog-client.d.ts +14 -0
- package/dist/xulux/catalog-client.d.ts.map +1 -0
- package/dist/xulux/catalog-client.js +67 -0
- package/dist/xulux/catalog-client.js.map +1 -0
- package/dist/xulux/fallback-catalog.d.ts +7 -0
- package/dist/xulux/fallback-catalog.d.ts.map +1 -0
- package/dist/xulux/fallback-catalog.js +47 -0
- package/dist/xulux/fallback-catalog.js.map +1 -0
- package/dist/xulux/fetch-sandbox.d.ts +5 -0
- package/dist/xulux/fetch-sandbox.d.ts.map +1 -0
- package/dist/xulux/fetch-sandbox.js +40 -0
- package/dist/xulux/fetch-sandbox.js.map +1 -0
- package/dist/xulux/template-service.d.ts +84 -0
- package/dist/xulux/template-service.d.ts.map +1 -0
- package/dist/xulux/template-service.js +223 -0
- package/dist/xulux/template-service.js.map +1 -0
- package/dist/xulux/types.d.ts +55 -0
- package/dist/xulux/types.d.ts.map +1 -0
- package/dist/xulux/types.js +6 -0
- package/dist/xulux/types.js.map +1 -0
- package/package.json +7 -6
- package/src/index.ts +55 -2
- package/src/prompts/xulux-playground.ts +36 -0
- package/src/tools/docs.ts +27 -5
- package/src/tools/examples.ts +17 -12
- 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 +20 -0
- package/src/tools/tests/examples.test.ts +5 -5
- package/src/tools/tests/integration.test.ts +3 -4
- package/src/tools/tests/listings-cache.test.ts +19 -0
- package/src/tools/tests/mcp-protocol.test.ts +173 -108
- package/src/tools/tests/mcp-test-client.ts +111 -0
- package/src/tools/tests/resources.test.ts +97 -66
- package/src/tools/tests/test-setup.ts +8 -0
- package/src/tools/tests/xulux-templates.test.ts +262 -0
- package/src/tools/xulux-templates.ts +141 -0
- package/src/utils/cache.ts +20 -0
- package/src/utils/mcp-format.ts +8 -6
- package/src/utils/paths.ts +4 -1
- package/src/utils/tests/cache.test.ts +51 -0
- package/src/utils/tests/mcp-format.test.ts +22 -0
- package/src/utils/tests/security.test.ts +1 -1
- package/src/xulux/catalog-client.ts +105 -0
- package/src/xulux/fallback-catalog.ts +63 -0
- package/src/xulux/fetch-sandbox.ts +56 -0
- package/src/xulux/template-service.ts +406 -0
- package/src/xulux/types.ts +60 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +0 -464
|
@@ -3,7 +3,7 @@ title: Primitives
|
|
|
3
3
|
description: Composable terminal components for building chat UIs with Ink.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Primitives are thin wrappers around Ink components (`Box`, `Text
|
|
6
|
+
Primitives are thin wrappers around Ink components (`Box`, `Text`) that integrate with the assistant-ui runtime. They accept all standard Ink props and add runtime-aware behavior.
|
|
7
7
|
|
|
8
8
|
Primitives use namespace imports, the same pattern as the web package (e.g. `ThreadPrimitive.Root`, `ComposerPrimitive.Input`).
|
|
9
9
|
|
|
@@ -396,7 +396,7 @@ Renders the quoted text from `s.composer.quote?.text`. Pass `children` to overri
|
|
|
396
396
|
|
|
397
397
|
### QuoteDismiss
|
|
398
398
|
|
|
399
|
-
Pressable that clears the active quote by calling `aui.composer
|
|
399
|
+
Pressable that clears the active quote by calling `aui.composer.setQuote(undefined)`.
|
|
400
400
|
|
|
401
401
|
```tsx
|
|
402
402
|
<ComposerPrimitive.QuoteDismiss>
|
|
@@ -683,7 +683,7 @@ Container `Box` for an attachment. Forwards all `Box` props.
|
|
|
683
683
|
|
|
684
684
|
### Remove
|
|
685
685
|
|
|
686
|
-
`Pressable` that calls `aui.attachment
|
|
686
|
+
`Pressable` that calls `aui.attachment.remove()` when activated (Enter while focused). Disabled when not focused or when the `disabled` prop is set.
|
|
687
687
|
|
|
688
688
|
| Prop | Type | Description |
|
|
689
689
|
|------|------|-------------|
|
|
@@ -725,7 +725,7 @@ Renders the queue item's prompt with Ink `<Text>`. Pass `children` to override t
|
|
|
725
725
|
|
|
726
726
|
### Remove
|
|
727
727
|
|
|
728
|
-
Pressable that removes the queue item by calling `aui.queueItem
|
|
728
|
+
Pressable that removes the queue item by calling `aui.queueItem.remove()`.
|
|
729
729
|
|
|
730
730
|
```tsx
|
|
731
731
|
<QueueItemPrimitive.Remove>
|
|
@@ -742,7 +742,7 @@ Remaining props are forwarded to the underlying `Pressable` (Ink `Box` props).
|
|
|
742
742
|
|
|
743
743
|
### Steer
|
|
744
744
|
|
|
745
|
-
Pressable that promotes the queue item to run next by calling `aui.queueItem
|
|
745
|
+
Pressable that promotes the queue item to run next by calling `aui.queueItem.steer()`.
|
|
746
746
|
|
|
747
747
|
```tsx
|
|
748
748
|
<QueueItemPrimitive.Steer>
|
|
@@ -765,10 +765,17 @@ import { ActionBarPrimitive } from "@assistant-ui/react-ink";
|
|
|
765
765
|
|
|
766
766
|
### Copy
|
|
767
767
|
|
|
768
|
-
Pressable that copies the message content. Supports function-as-children for copy state feedback.
|
|
768
|
+
Pressable that copies the message content. Pass a platform clipboard writer through `copyToClipboard`. Supports function-as-children for copy state feedback.
|
|
769
|
+
|
|
770
|
+
<InstallCommand npm={["clipboardy"]} />
|
|
769
771
|
|
|
770
772
|
```tsx
|
|
771
|
-
|
|
773
|
+
import clipboard from "clipboardy";
|
|
774
|
+
|
|
775
|
+
<ActionBarPrimitive.Copy
|
|
776
|
+
copiedDuration={3000}
|
|
777
|
+
copyToClipboard={clipboard.write}
|
|
778
|
+
>
|
|
772
779
|
{({ isCopied }) => <Text>{isCopied ? "[Copied!]" : "[Copy]"}</Text>}
|
|
773
780
|
</ActionBarPrimitive.Copy>
|
|
774
781
|
```
|
|
@@ -776,7 +783,7 @@ Pressable that copies the message content. Supports function-as-children for cop
|
|
|
776
783
|
| Prop | Type | Description |
|
|
777
784
|
|------|------|-------------|
|
|
778
785
|
| `copiedDuration` | `number` | Duration in ms to show "copied" state (default: 3000) |
|
|
779
|
-
| `copyToClipboard` | `(text: string) => void
|
|
786
|
+
| `copyToClipboard` | `(text: string) => void \| Promise<void>` | Platform clipboard writer |
|
|
780
787
|
|
|
781
788
|
### Edit
|
|
782
789
|
|
|
@@ -1215,3 +1222,37 @@ Container `Box` for the status bar. Forwards all `Box` props; pass `gap` to spac
|
|
|
1215
1222
|
<StatusBarPrimitive.Latency />
|
|
1216
1223
|
</StatusBarPrimitive.Root>
|
|
1217
1224
|
```
|
|
1225
|
+
|
|
1226
|
+
## TextInput
|
|
1227
|
+
|
|
1228
|
+
```tsx
|
|
1229
|
+
import { TextInput } from "@assistant-ui/react-ink";
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
Store-free, controlled single/multi-line text field. Ink ships no native text input, so this is the terminal equivalent of the DOM `<textarea>` or React Native's `<TextInput>` — the editing engine (buffer, grapheme-aware cursor, and the full emacs/arrow keymap) without any runtime or composer coupling. `ComposerPrimitive.Input` is a thin adapter that wraps `TextInput` and binds it to the composer store; reach for `TextInput` directly when you need an editable field outside the thread composer (for example, editing a value before confirming an action).
|
|
1233
|
+
|
|
1234
|
+
It is controlled on `value`/`onChange`, so an external owner can override the text at any time (the buffer absorbs the echo without thrashing the cursor). An owner may also transform the emitted text in `onChange` (uppercase, mask, reject); the buffer applies the corrected value while keeping the cursor at the edit position, snapped to a grapheme boundary. A replacement that does not respond to an edit (a programmatic set while idle) still places the cursor at the end:
|
|
1235
|
+
|
|
1236
|
+
```tsx
|
|
1237
|
+
const [command, setCommand] = useState(approval.action.command);
|
|
1238
|
+
|
|
1239
|
+
<TextInput
|
|
1240
|
+
value={command}
|
|
1241
|
+
onChange={setCommand}
|
|
1242
|
+
submitOnEnter
|
|
1243
|
+
onSubmit={(text) => runEdited(text)}
|
|
1244
|
+
/>
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
| Prop | Type | Description |
|
|
1248
|
+
|------|------|-------------|
|
|
1249
|
+
| `value` | `string` | Current text (controlled) |
|
|
1250
|
+
| `onChange` | `(text: string) => void` | Called with the next text whenever the buffer changes |
|
|
1251
|
+
| `onSubmit` | `(text: string) => void` | Called on Enter when `submitOnEnter` is set, with the text as displayed; owners that validate in `onChange` should validate again in `onSubmit` |
|
|
1252
|
+
| `submitOnEnter` | `boolean` | Whether Enter calls `onSubmit` (default: `false`) |
|
|
1253
|
+
| `placeholder` | `string` | Placeholder text when empty (default: `""`) |
|
|
1254
|
+
| `autoFocus` | `boolean` | Auto-focus on mount (default: `true`) |
|
|
1255
|
+
| `multiLine` | `boolean` | When true, Enter inserts a newline unless `submitOnEnter` is enabled |
|
|
1256
|
+
| `...rest` | `ComponentProps<typeof Box>` | Forwarded to the underlying Ink `Box` |
|
|
1257
|
+
|
|
1258
|
+
Keyboard bindings, grapheme handling, and terminal-capability caveats are identical to [`ComposerPrimitive.Input`](#input).
|
|
@@ -22,7 +22,7 @@ Three integration points:
|
|
|
22
22
|
|
|
23
23
|
1. **Auth handlers** mounted at `/api/auth/[...all]/route.ts` via `toNextJsHandler(auth)`.
|
|
24
24
|
2. **API routes** read the session server-side with `auth.api.getSession({ headers: await headers() })`.
|
|
25
|
-
3. **Reload-on-auth** uses better-auth's React client to detect sign-in and trigger `aui.threads
|
|
25
|
+
3. **Reload-on-auth** uses better-auth's React client to detect sign-in and trigger `aui.threads.reload()`.
|
|
26
26
|
|
|
27
27
|
`session.user.id` is exposed on the session object directly, so route handlers can scope queries against it.
|
|
28
28
|
|
|
@@ -136,7 +136,7 @@ export function ReloadOnAuth() {
|
|
|
136
136
|
const aui = useAui();
|
|
137
137
|
const { data: session, isPending } = authClient.useSession();
|
|
138
138
|
useEffect(() => {
|
|
139
|
-
if (!isPending && session) aui.threads
|
|
139
|
+
if (!isPending && session) aui.threads.reload();
|
|
140
140
|
}, [isPending, session?.user?.id]);
|
|
141
141
|
return null;
|
|
142
142
|
}
|
|
@@ -102,7 +102,7 @@ const rows = await db
|
|
|
102
102
|
|
|
103
103
|
### Reload threads after async auth
|
|
104
104
|
|
|
105
|
-
The first render of `<MyProvider>` may run before Clerk resolves the user on the client. Drop a small effect inside `<AssistantRuntimeProvider>` that calls `aui.threads
|
|
105
|
+
The first render of `<MyProvider>` may run before Clerk resolves the user on the client. Drop a small effect inside `<AssistantRuntimeProvider>` that calls `aui.threads.reload()` once the user is loaded:
|
|
106
106
|
|
|
107
107
|
```tsx title="app/components/ReloadOnAuth.tsx"
|
|
108
108
|
"use client";
|
|
@@ -115,7 +115,7 @@ export function ReloadOnAuth() {
|
|
|
115
115
|
const aui = useAui();
|
|
116
116
|
const { isLoaded, isSignedIn, user } = useUser();
|
|
117
117
|
useEffect(() => {
|
|
118
|
-
if (isLoaded && isSignedIn) aui.threads
|
|
118
|
+
if (isLoaded && isSignedIn) aui.threads.reload();
|
|
119
119
|
}, [isLoaded, isSignedIn, user?.id]);
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
@@ -18,7 +18,7 @@ Three places auth touches the integration:
|
|
|
18
18
|
|
|
19
19
|
1. **API routes** (`/api/chat`, `/api/threads/*`) call `auth()` server-side, return 401 if no session, then scope DB queries by `session.user.id`.
|
|
20
20
|
2. **`RemoteThreadListAdapter`** does nothing auth-specific; the cookie travels with the `fetch` calls automatically (same origin).
|
|
21
|
-
3. **Reload-on-auth**: if the session resolves after the initial render, call `aui.threads
|
|
21
|
+
3. **Reload-on-auth**: if the session resolves after the initial render, call `aui.threads.reload()` so the list re-fetches with the new identity.
|
|
22
22
|
|
|
23
23
|
## Setup
|
|
24
24
|
|
|
@@ -113,7 +113,7 @@ Apply the same pattern to `POST`, `PATCH`, and `DELETE` handlers. Always verify
|
|
|
113
113
|
|
|
114
114
|
### Reload threads after async auth
|
|
115
115
|
|
|
116
|
-
The first render of `<MyProvider>` may run before `auth()` resolves on the client. The thread list will be empty until the user refreshes. Drop a small effect into the layout to call `aui.threads
|
|
116
|
+
The first render of `<MyProvider>` may run before `auth()` resolves on the client. The thread list will be empty until the user refreshes. Drop a small effect into the layout to call `aui.threads.reload()` once the session resolves.
|
|
117
117
|
|
|
118
118
|
`useSession` requires `<SessionProvider>` higher in the tree. Wrap your root layout's client subtree once:
|
|
119
119
|
|
|
@@ -140,7 +140,7 @@ export function ReloadOnAuth() {
|
|
|
140
140
|
const aui = useAui();
|
|
141
141
|
const { status, data } = useSession();
|
|
142
142
|
useEffect(() => {
|
|
143
|
-
if (status === "authenticated") aui.threads
|
|
143
|
+
if (status === "authenticated") aui.threads.reload();
|
|
144
144
|
}, [status, data?.user?.id]);
|
|
145
145
|
return null;
|
|
146
146
|
}
|
|
@@ -8,7 +8,7 @@ import { VercelIcon } from "@/components/icons/vercel";
|
|
|
8
8
|
[Vercel AI SDK](https://ai-sdk.dev/) is the most common framework people pair with assistant-ui. The full setup, attachments, persistence, tool-call patterns, and version notes are documented under [runtimes/ai-sdk](/docs/runtimes/ai-sdk/overview); this page is the entry point in the integrations tree for discoverability and architecture context.
|
|
9
9
|
|
|
10
10
|
<Callout type="info">
|
|
11
|
-
If you arrived here looking to wire up your first chat: jump to [AI SDK
|
|
11
|
+
If you arrived here looking to wire up your first chat: jump to [AI SDK v7 quickstart](/docs/runtimes/ai-sdk/v7). This page is a high-level pointer.
|
|
12
12
|
</Callout>
|
|
13
13
|
|
|
14
14
|
## Where it slots in
|
|
@@ -27,14 +27,20 @@ flowchart LR
|
|
|
27
27
|
|
|
28
28
|
## Pick a version
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Four versions of `ai` are supported. New projects should pick **v7**; v6, v5, and v4 are documented for migration and existing apps that haven't upgraded.
|
|
31
31
|
|
|
32
32
|
<Cards>
|
|
33
33
|
<Card
|
|
34
34
|
icon={<VercelIcon width={20} height={20} />}
|
|
35
|
-
title="AI SDK
|
|
35
|
+
title="AI SDK v7 (current)"
|
|
36
|
+
description="Requires ai@^7 and @ai-sdk/react@^4. Async convertToModelMessages, tool inputSchema, toUIMessageStreamResponse."
|
|
37
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
38
|
+
/>
|
|
39
|
+
<Card
|
|
40
|
+
icon={<VercelIcon width={20} height={20} />}
|
|
41
|
+
title="AI SDK v6 (legacy)"
|
|
36
42
|
description="Requires ai@^6 and @ai-sdk/react@^3. Async convertToModelMessages, tool inputSchema, toUIMessageStreamResponse."
|
|
37
|
-
href="/docs/runtimes/ai-sdk/v6"
|
|
43
|
+
href="/docs/runtimes/ai-sdk/v6-legacy"
|
|
38
44
|
/>
|
|
39
45
|
<Card
|
|
40
46
|
icon={<VercelIcon width={20} height={20} />}
|
|
@@ -9,14 +9,14 @@ import { VercelIcon } from "@/components/icons/vercel";
|
|
|
9
9
|
[Cloudflare Agents](https://developers.cloudflare.com/agents/) is Cloudflare's framework for stateful AI agents that run on Durable Objects at the edge. Each agent owns its own SQLite-backed message history, exposes a WebSocket channel for low-latency streaming, and can call tools (server-side or client-side).
|
|
10
10
|
|
|
11
11
|
<Callout type="info">
|
|
12
|
-
This is an integration guide, not a runtime adapter. assistant-ui does not ship a `@assistant-ui/react-cloudflare-agents` package. `@cloudflare/ai-chat`'s `useAgentChat` returns a structural extension of the AI SDK's `useChat`, so the existing [AI SDK runtime](/docs/runtimes/ai-sdk/
|
|
12
|
+
This is an integration guide, not a runtime adapter. assistant-ui does not ship a `@assistant-ui/react-cloudflare-agents` package. `@cloudflare/ai-chat`'s `useAgentChat` returns a structural extension of the AI SDK's `useChat`, so the existing [AI SDK runtime](/docs/runtimes/ai-sdk/v7) consumes it directly.
|
|
13
13
|
</Callout>
|
|
14
14
|
|
|
15
15
|
## Architecture
|
|
16
16
|
|
|
17
17
|
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
18
|
|
|
19
|
-
assistant-ui handles the client half. `useAISDKRuntime` from [`@assistant-ui/react-ai-sdk`](/docs/runtimes/ai-sdk/
|
|
19
|
+
assistant-ui handles the client half. `useAISDKRuntime` from [`@assistant-ui/react-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
20
|
|
|
21
21
|
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
22
|
|
|
@@ -277,6 +277,6 @@ Destructure these alongside `chat` and pass them into your UI directly; they don
|
|
|
277
277
|
icon={<VercelIcon width={20} height={20} />}
|
|
278
278
|
title="AI SDK runtime"
|
|
279
279
|
description="The runtime that handles the client side of this integration."
|
|
280
|
-
href="/docs/runtimes/ai-sdk/
|
|
280
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
281
281
|
/>
|
|
282
282
|
</Cards>
|
|
@@ -183,6 +183,6 @@ Open `http://localhost:3000`, send a message like *"What can I make with eggs an
|
|
|
183
183
|
icon={<VercelIcon width={20} height={20} />}
|
|
184
184
|
title="AI SDK runtime"
|
|
185
185
|
description="The runtime that handles the client side of this integration."
|
|
186
|
-
href="/docs/runtimes/ai-sdk/
|
|
186
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
187
187
|
/>
|
|
188
188
|
</Cards>
|
|
@@ -9,7 +9,7 @@ import { VercelIcon } from "@/components/icons/vercel";
|
|
|
9
9
|
[Mastra](https://mastra.ai/) is an open-source TypeScript agent framework. It provides primitives for AI applications: agents with memory and tool calling, deterministic LLM workflows, RAG, model routing, workflow graphs, and automated evals.
|
|
10
10
|
|
|
11
11
|
<Callout type="info">
|
|
12
|
-
This is an integration guide, not a runtime adapter. assistant-ui does not ship a `@assistant-ui/react-mastra` package. You wire up Mastra through the standard [AI SDK runtime](/docs/runtimes/ai-sdk/
|
|
12
|
+
This is an integration guide, not a runtime adapter. assistant-ui does not ship a `@assistant-ui/react-mastra` package. You wire up Mastra through the standard [AI SDK runtime](/docs/runtimes/ai-sdk/v7) by routing your API endpoint through Mastra's agent stream.
|
|
13
13
|
</Callout>
|
|
14
14
|
|
|
15
15
|
## Pick a pattern
|
|
@@ -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/react-ai-sdk`](/docs/runtimes/ai-sdk/
|
|
22
|
+
Both use the same client-side `useChatRuntime` from [`@assistant-ui/react-ai-sdk`](/docs/runtimes/ai-sdk/v7). The only difference is where the Mastra agent lives.
|
|
23
23
|
|
|
24
24
|
## Architecture
|
|
25
25
|
|
|
@@ -52,6 +52,6 @@ Shared adapters (attachments, speech, feedback, history) work the same way descr
|
|
|
52
52
|
icon={<VercelIcon width={20} height={20} />}
|
|
53
53
|
title="AI SDK runtime"
|
|
54
54
|
description="The runtime that handles the client side of this integration."
|
|
55
|
-
href="/docs/runtimes/ai-sdk/
|
|
55
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
56
56
|
/>
|
|
57
57
|
</Cards>
|
|
@@ -196,6 +196,6 @@ Open `http://localhost:3000`, send a message, and confirm:
|
|
|
196
196
|
icon={<VercelIcon width={20} height={20} />}
|
|
197
197
|
title="AI SDK runtime"
|
|
198
198
|
description="The runtime that handles the client side of this integration."
|
|
199
|
-
href="/docs/runtimes/ai-sdk/
|
|
199
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
200
200
|
/>
|
|
201
201
|
</Cards>
|
|
@@ -8,7 +8,7 @@ import { VercelIcon } from "@/components/icons/vercel";
|
|
|
8
8
|
|
|
9
9
|
LLM gateways sit between your route handler and the upstream provider. They give you a single endpoint that fronts many providers, plus features like multi-provider fallback, prompt caching, and BYOK (bring-your-own-key) flows. Most are OpenAI API-compatible, so the integration is a `baseURL` swap on `createOpenAI` from `@ai-sdk/openai`.
|
|
10
10
|
|
|
11
|
-
For pure observability (proxy that logs every call) see [Helicone](/docs/integrations/observability/helicone). The gateways here overlap in spirit but are positioned around routing rather than logging.
|
|
11
|
+
For pure observability (proxy that logs every call) see [Helicone](/docs/integrations/observability/helicone). The gateways here overlap in spirit but are positioned around routing rather than logging. For local personal projects there is also a keyless option in the same `baseURL`-swap shape: a local OAuth proxy billed to your ChatGPT subscription; see [ChatGPT Subscription](/docs/guides/chatgpt-subscription).
|
|
12
12
|
|
|
13
13
|
## Compare
|
|
14
14
|
|
|
@@ -157,6 +157,6 @@ When to pick: self-host requirement, BYOK metering for end-users, or unified bil
|
|
|
157
157
|
icon={<VercelIcon width={20} height={20} />}
|
|
158
158
|
title="AI SDK runtime"
|
|
159
159
|
description="The runtime that ferries gateway responses to the chat UI."
|
|
160
|
-
href="/docs/runtimes/ai-sdk/
|
|
160
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
161
161
|
/>
|
|
162
162
|
</Cards>
|
|
@@ -124,6 +124,6 @@ If nothing appears, check the request in your network tab. The host should be `o
|
|
|
124
124
|
icon={<VercelIcon width={20} height={20} />}
|
|
125
125
|
title="AI SDK runtime"
|
|
126
126
|
description="The most common pairing: AI SDK route handler proxied through Helicone."
|
|
127
|
-
href="/docs/runtimes/ai-sdk/
|
|
127
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
128
128
|
/>
|
|
129
129
|
</Cards>
|
|
@@ -156,6 +156,6 @@ If nothing appears, check the server logs for OTel errors and confirm `LANGFUSE_
|
|
|
156
156
|
icon={<VercelIcon width={20} height={20} />}
|
|
157
157
|
title="AI SDK runtime"
|
|
158
158
|
description="The runtime that emits the telemetry Langfuse consumes."
|
|
159
|
-
href="/docs/runtimes/ai-sdk/
|
|
159
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
160
160
|
/>
|
|
161
161
|
</Cards>
|
|
@@ -35,7 +35,7 @@ LANGSMITH_API_KEY=lsv2_pt_...
|
|
|
35
35
|
LANGSMITH_PROJECT=assistant-ui
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
`LANGSMITH_PROJECT` controls which project receives traces; the default project applies if you omit it. See LangSmith's [
|
|
38
|
+
`LANGSMITH_PROJECT` controls which project receives traces; the default project applies if you omit it. See LangSmith's [project configuration guide](https://docs.langchain.com/langsmith/log-traces-to-project) for details.
|
|
39
39
|
|
|
40
40
|
</Step>
|
|
41
41
|
<Step>
|
|
@@ -146,6 +146,6 @@ Send a message. The trace should appear in your LangSmith project within seconds
|
|
|
146
146
|
icon={<VercelIcon width={20} height={20} />}
|
|
147
147
|
title="AI SDK runtime"
|
|
148
148
|
description="The runtime that ferries traces from the route to the chat UI."
|
|
149
|
-
href="/docs/runtimes/ai-sdk/
|
|
149
|
+
href="/docs/runtimes/ai-sdk/v7"
|
|
150
150
|
/>
|
|
151
151
|
</Cards>
|
|
@@ -305,7 +305,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
305
305
|
async append() {},
|
|
306
306
|
withFormat: (fmt) => ({
|
|
307
307
|
async load() {
|
|
308
|
-
const { remoteId } = aui.threadListItem
|
|
308
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
309
309
|
if (!remoteId) return { messages: [] };
|
|
310
310
|
const rows = await fetch(
|
|
311
311
|
`/api/threads/${remoteId}/messages`,
|
|
@@ -322,7 +322,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
322
322
|
};
|
|
323
323
|
},
|
|
324
324
|
async append(item) {
|
|
325
|
-
const { remoteId } = await aui.threadListItem
|
|
325
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
326
326
|
await fetch(`/api/threads/${remoteId}/messages`, {
|
|
327
327
|
method: "POST",
|
|
328
328
|
body: JSON.stringify({
|
|
@@ -422,7 +422,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
422
422
|
async append() {},
|
|
423
423
|
withFormat: (fmt) => ({
|
|
424
424
|
async load() {
|
|
425
|
-
const { remoteId } = aui.threadListItem
|
|
425
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
426
426
|
if (!remoteId) return { messages: [] };
|
|
427
427
|
const rows = await fetch(
|
|
428
428
|
`${API_URL}/threads/${remoteId}/messages`,
|
|
@@ -439,7 +439,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
439
439
|
};
|
|
440
440
|
},
|
|
441
441
|
async append(item) {
|
|
442
|
-
const { remoteId } = await aui.threadListItem
|
|
442
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
443
443
|
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
444
444
|
method: "POST",
|
|
445
445
|
body: JSON.stringify({
|
|
@@ -541,7 +541,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
541
541
|
async append() {},
|
|
542
542
|
withFormat: (fmt) => ({
|
|
543
543
|
async load() {
|
|
544
|
-
const { remoteId } = aui.threadListItem
|
|
544
|
+
const { remoteId } = aui.threadListItem.getState();
|
|
545
545
|
if (!remoteId) return { messages: [] };
|
|
546
546
|
const rows = await fetch(
|
|
547
547
|
`${API_URL}/threads/${remoteId}/messages`,
|
|
@@ -558,7 +558,7 @@ export const threadListAdapter: RemoteThreadListAdapter = {
|
|
|
558
558
|
};
|
|
559
559
|
},
|
|
560
560
|
async append(item) {
|
|
561
|
-
const { remoteId } = await aui.threadListItem
|
|
561
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
562
562
|
await fetch(`${API_URL}/threads/${remoteId}/messages`, {
|
|
563
563
|
method: "POST",
|
|
564
564
|
body: JSON.stringify({
|
|
@@ -592,6 +592,32 @@ The top-level `load`/`append` on the history adapter are required by the type bu
|
|
|
592
592
|
</Step>
|
|
593
593
|
<Step>
|
|
594
594
|
|
|
595
|
+
### Support in-place updates (optional)
|
|
596
|
+
|
|
597
|
+
The optional `update(item, localMessageId)` method on the object returned from `withFormat` lets the runtime rewrite an already-persisted message in place. It receives the same `{ parentId, message }` item shape as `append`, plus the id of the row to rewrite.
|
|
598
|
+
|
|
599
|
+
The runtime calls `update` after a run for persisted messages whose content changed, to finalize assistant messages persisted early while waiting for tool call approval, and to refresh run timing metadata.
|
|
600
|
+
|
|
601
|
+
`update` is opt-in. When it is absent, messages paused for tool approval are not persisted until the run reaches a terminal status, so a page refresh during the pause loses the pending approval state. Implementing `update` enables early persistence.
|
|
602
|
+
|
|
603
|
+
```tsx title="runtime/thread-adapter.tsx"
|
|
604
|
+
async update(item, localMessageId) {
|
|
605
|
+
const { remoteId } = await aui.threadListItem.initialize();
|
|
606
|
+
await fetch(`${API_URL}/threads/${remoteId}/messages/${localMessageId}`, {
|
|
607
|
+
method: "PATCH",
|
|
608
|
+
body: JSON.stringify({
|
|
609
|
+
format: fmt.format,
|
|
610
|
+
content: fmt.encode(item),
|
|
611
|
+
}),
|
|
612
|
+
});
|
|
613
|
+
},
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
The backend needs a matching update route keyed by message id, mirroring the append route from the earlier step.
|
|
617
|
+
|
|
618
|
+
</Step>
|
|
619
|
+
<Step>
|
|
620
|
+
|
|
595
621
|
### Mount the runtime
|
|
596
622
|
|
|
597
623
|
Wrap the app in a `useRemoteThreadListRuntime` that delegates per-thread runtime to `useChatRuntime`:
|
|
@@ -694,7 +720,7 @@ Send a message in a fresh thread. Check the database:
|
|
|
694
720
|
|
|
695
721
|
- The `threads` table has a new row with the current `userId`.
|
|
696
722
|
- The `messages` table has at least two rows (user + assistant) for that thread.
|
|
697
|
-
- `format` matches what `fmt.format` wrote (`"ai-sdk/v6"`
|
|
723
|
+
- `format` matches what `fmt.format` wrote (`"ai-sdk/v6"`) and `content` is the encoded `UIMessage` (a `role` plus `parts`), not a placeholder blob. The format string names the stored `UIMessage` shape, not the installed AI SDK major; it stays `"ai-sdk/v6"` on AI SDK v7 and must never be renamed, or previously stored history stops matching.
|
|
698
724
|
- Reload the page; the thread list and the messages survive.
|
|
699
725
|
|
|
700
726
|
</Step>
|
|
@@ -702,9 +728,10 @@ Send a message in a fresh thread. Check the database:
|
|
|
702
728
|
|
|
703
729
|
## Notes
|
|
704
730
|
|
|
705
|
-
- **First-message race.** `append` may fire before the thread row exists. The `unstable_Provider` example above always awaits `aui.threadListItem
|
|
706
|
-
- **Reload after async auth.** If `auth()` resolves after the initial `list()` call, threads won't appear until the user refreshes. Call `aui.threads
|
|
731
|
+
- **First-message race.** `append` may fire before the thread row exists. The `unstable_Provider` example above always awaits `aui.threadListItem.initialize()` before writing; do the same in any custom implementation.
|
|
732
|
+
- **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).
|
|
707
733
|
- **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
|
+
- **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.
|
|
708
735
|
- **`unstable_Provider` synchronous-children rule.** The Provider must render `children` on first commit; do not gate them behind suspense, loading state, or `useEffect`. Load data inside an always-rendered child.
|
|
709
736
|
|
|
710
737
|
## Related
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration Guides
|
|
3
|
+
description: Upgrade assistant-ui versions and migrate deprecated APIs and integrations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use these guides when upgrading assistant-ui or moving from APIs that have been deprecated or replaced.
|
|
7
|
+
|
|
8
|
+
## Version upgrades
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Migration to v0.14" href="/docs/migrations/v0-14">
|
|
12
|
+
Replace APIs removed after v0.11 and v0.12, and migrate primitive
|
|
13
|
+
`components` props to children render functions.
|
|
14
|
+
</Card>
|
|
15
|
+
<Card title="Migration to v0.12" href="/docs/migrations/v0-12">
|
|
16
|
+
Move from individual context hooks to the unified state API.
|
|
17
|
+
</Card>
|
|
18
|
+
<Card title="Migration to v0.11" href="/docs/migrations/v0-11">
|
|
19
|
+
Update code affected by the `ContentPart` to `MessagePart` rename.
|
|
20
|
+
</Card>
|
|
21
|
+
</Cards>
|
|
22
|
+
|
|
23
|
+
## APIs and integrations
|
|
24
|
+
|
|
25
|
+
<Cards>
|
|
26
|
+
<Card title="Migrating Tools to Toolkits" href="/docs/migrations/toolkit-tools">
|
|
27
|
+
Move legacy tool and tool UI registrations to the toolkit API.
|
|
28
|
+
</Card>
|
|
29
|
+
<Card
|
|
30
|
+
title="Migrating to react-langgraph v0.7"
|
|
31
|
+
href="/docs/migrations/react-langgraph-v0-7"
|
|
32
|
+
>
|
|
33
|
+
Upgrade to the simplified LangGraph integration API.
|
|
34
|
+
</Card>
|
|
35
|
+
<Card
|
|
36
|
+
title="Using old React versions"
|
|
37
|
+
href="/docs/migrations/react-compatibility"
|
|
38
|
+
>
|
|
39
|
+
Review compatibility notes for React 18 and React 19.
|
|
40
|
+
</Card>
|
|
41
|
+
</Cards>
|
|
42
|
+
|
|
43
|
+
## Stability
|
|
44
|
+
|
|
45
|
+
<Cards>
|
|
46
|
+
<Card title="Deprecation Policy" href="/docs/migrations/deprecation-policy">
|
|
47
|
+
Review stability guarantees and deprecation timelines for assistant-ui
|
|
48
|
+
features.
|
|
49
|
+
</Card>
|
|
50
|
+
</Cards>
|
|
@@ -32,7 +32,7 @@ const WeatherTool = makeAssistantTool({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
export function App() {
|
|
35
|
-
const runtime = useChatRuntime(
|
|
35
|
+
const runtime = useChatRuntime();
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<AssistantRuntimeProvider runtime={runtime}>
|
|
@@ -80,7 +80,7 @@ import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
|
80
80
|
import toolkit from "./toolkit";
|
|
81
81
|
|
|
82
82
|
export function App() {
|
|
83
|
-
const runtime = useChatRuntime(
|
|
83
|
+
const runtime = useChatRuntime();
|
|
84
84
|
const aui = useAui({
|
|
85
85
|
tools: Tools({ toolkit }),
|
|
86
86
|
});
|
|
@@ -93,6 +93,8 @@ export function App() {
|
|
|
93
93
|
}
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
`useChatRuntime()` targets `/api/chat` by default. To point at a different endpoint or customize requests, see [Custom transport](/docs/runtimes/ai-sdk/v7#custom-transport).
|
|
97
|
+
|
|
96
98
|
## Mechanical Steps
|
|
97
99
|
|
|
98
100
|
1. Create a `Toolkit` object.
|