@assistant-ui/mcp-docs-server 0.2.1 → 0.2.2
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 +1 -1
- package/.docs/organized/code-examples/with-a2a.md +2 -2
- package/.docs/organized/code-examples/with-ag-ui.md +3 -3
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +5 -5
- package/.docs/organized/code-examples/with-artifacts.md +5 -5
- package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
- package/.docs/organized/code-examples/with-browser-extension.md +4 -4
- package/.docs/organized/code-examples/with-chain-of-thought.md +5 -5
- package/.docs/organized/code-examples/with-cloud-standalone.md +5 -5
- package/.docs/organized/code-examples/with-cloud.md +5 -5
- package/.docs/organized/code-examples/with-custom-thread-list.md +6 -6
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
- package/.docs/organized/code-examples/with-eve.md +3 -3
- package/.docs/organized/code-examples/with-expo.md +13 -19
- package/.docs/organized/code-examples/with-external-store.md +3 -3
- package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
- package/.docs/organized/code-examples/with-generative-ui.md +259 -23
- package/.docs/organized/code-examples/with-google-adk.md +2 -2
- package/.docs/organized/code-examples/with-heat-graph.md +1 -1
- package/.docs/organized/code-examples/with-image-generation.md +4 -4
- package/.docs/organized/code-examples/with-interactables.md +5 -5
- package/.docs/organized/code-examples/with-langchain.md +7 -7
- package/.docs/organized/code-examples/with-langgraph.md +4 -4
- package/.docs/organized/code-examples/with-livekit.md +7 -7
- package/.docs/organized/code-examples/with-mcp.md +6 -6
- package/.docs/organized/code-examples/with-nuxt.md +500 -564
- package/.docs/organized/code-examples/with-opencode.md +2 -2
- package/.docs/organized/code-examples/with-openui.md +449 -0
- package/.docs/organized/code-examples/with-pi.md +2 -2
- package/.docs/organized/code-examples/with-react-hook-form.md +7 -7
- package/.docs/organized/code-examples/with-react-ink-web.md +4 -4
- package/.docs/organized/code-examples/with-react-ink.md +2 -2
- package/.docs/organized/code-examples/with-react-router.md +4 -4
- package/.docs/organized/code-examples/with-resumable-stream.md +7 -7
- package/.docs/organized/code-examples/with-store.md +1 -1
- 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 +5 -5
- package/.docs/organized/code-examples/with-tap-runtime.md +2 -2
- package/.docs/organized/code-examples/with-virtualized-thread.md +2 -2
- package/.docs/organized/code-examples/with-vue.md +1 -1
- package/.docs/raw/docs/(docs)/cli.mdx +6 -1
- package/.docs/raw/docs/(docs)/installation.mdx +2 -2
- 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/eve.mdx +39 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +29 -4
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +29 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -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/index.mdx +1 -1
- package/.docs/raw/docs/guides/attachments.mdx +2 -2
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- package/.docs/raw/docs/guides/suggestions.mdx +6 -3
- package/.docs/raw/docs/ink/primitives.mdx +1 -1
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +146 -128
- package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
- package/.docs/raw/docs/primitives/suggestion.mdx +3 -1
- package/.docs/raw/docs/primitives/thread.mdx +1 -1
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +35 -5
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +118 -0
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +68 -28
- 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 +1 -1
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +8 -1
- package/.docs/raw/docs/tools/defining-tools.mdx +19 -0
- 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 +5 -4
- package/.docs/raw/docs/tools/openui.mdx +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +1 -2
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +5 -1
- package/.docs/raw/docs/ui/attachment.mdx +27 -0
- package/.docs/raw/docs/ui/file.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +1 -1
- package/package.json +4 -4
- package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -423
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"@assistant-ui/react": "workspace:*",
|
|
66
66
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
67
67
|
"@tailwindcss/vite": "^4.3.3",
|
|
68
|
-
"@tanstack/react-router": "^1.170.
|
|
69
|
-
"@tanstack/react-start": "^1.168.
|
|
68
|
+
"@tanstack/react-router": "^1.170.27",
|
|
69
|
+
"@tanstack/react-start": "^1.168.44",
|
|
70
70
|
"class-variance-authority": "^0.7.1",
|
|
71
71
|
"clsx": "^2.1.1",
|
|
72
|
-
"lucide-react": "^1.
|
|
72
|
+
"lucide-react": "^1.31.0",
|
|
73
73
|
"nitro": "^3.0.260311-beta",
|
|
74
74
|
"openai": "^7.4.0",
|
|
75
75
|
"react": "^19.2.8",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
84
|
-
"@types/node": "^26.
|
|
84
|
+
"@types/node": "^26.2.0",
|
|
85
85
|
"@types/react": "^19.2.18",
|
|
86
86
|
"@types/react-dom": "^19.2.4",
|
|
87
87
|
"@vitejs/plugin-react": "^6.0.5",
|
|
@@ -463,7 +463,7 @@ export const chatStream = createServerFn({ method: "POST" })
|
|
|
463
463
|
});
|
|
464
464
|
|
|
465
465
|
const stream = await openai.chat.completions.create({
|
|
466
|
-
model: "gpt-5.
|
|
466
|
+
model: "gpt-5.6-luna",
|
|
467
467
|
messages: data.messages,
|
|
468
468
|
stream: true,
|
|
469
469
|
});
|
|
@@ -600,7 +600,7 @@ export default withAui(nextConfig);
|
|
|
600
600
|
"@assistant-ui/ui": "workspace:*",
|
|
601
601
|
"class-variance-authority": "^0.7.1",
|
|
602
602
|
"clsx": "^2.1.1",
|
|
603
|
-
"lucide-react": "^1.
|
|
603
|
+
"lucide-react": "^1.31.0",
|
|
604
604
|
"next": "^16.3.0",
|
|
605
605
|
"react": "^19.2.8",
|
|
606
606
|
"react-dom": "^19.2.8",
|
|
@@ -610,7 +610,7 @@ export default withAui(nextConfig);
|
|
|
610
610
|
"@assistant-ui/next": "workspace:*",
|
|
611
611
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
612
612
|
"@tailwindcss/postcss": "^4.3.3",
|
|
613
|
-
"@types/node": "^26.
|
|
613
|
+
"@types/node": "^26.2.0",
|
|
614
614
|
"@types/react": "^19.2.18",
|
|
615
615
|
"@types/react-dom": "^19.2.4",
|
|
616
616
|
"postcss": "^8.5.26",
|
|
@@ -600,7 +600,7 @@ export default withAui(nextConfig);
|
|
|
600
600
|
"@tanstack/react-virtual": "^3.14.9",
|
|
601
601
|
"class-variance-authority": "^0.7.1",
|
|
602
602
|
"clsx": "^2.1.1",
|
|
603
|
-
"lucide-react": "^1.
|
|
603
|
+
"lucide-react": "^1.31.0",
|
|
604
604
|
"next": "^16.3.0",
|
|
605
605
|
"react": "^19.2.8",
|
|
606
606
|
"react-dom": "^19.2.8",
|
|
@@ -610,7 +610,7 @@ export default withAui(nextConfig);
|
|
|
610
610
|
"@assistant-ui/next": "workspace:*",
|
|
611
611
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
612
612
|
"@tailwindcss/postcss": "^4.3.3",
|
|
613
|
-
"@types/node": "^26.
|
|
613
|
+
"@types/node": "^26.2.0",
|
|
614
614
|
"@types/react": "^19.2.18",
|
|
615
615
|
"@types/react-dom": "^19.2.4",
|
|
616
616
|
"postcss": "^8.5.26",
|
|
@@ -78,6 +78,7 @@ Use `--example` to create a project from one of the monorepo examples with full
|
|
|
78
78
|
| `with-chain-of-thought` | Chain-of-thought reasoning, tool calls, and source citations | `npx assistant-ui create my-app -e with-chain-of-thought` |
|
|
79
79
|
| `with-external-store` | External message store | `npx assistant-ui create my-app -e with-external-store` |
|
|
80
80
|
| `with-interactables` | AI-driven interactive UI components | `npx assistant-ui create my-app -e with-interactables` |
|
|
81
|
+
| `with-openui` | [OpenUI](/docs/tools/openui) generative UI integration | `npx assistant-ui create my-app -e with-openui` |
|
|
81
82
|
| `with-custom-thread-list` | Custom thread list UI | `npx assistant-ui create my-app -e with-custom-thread-list` |
|
|
82
83
|
| `with-react-hook-form` | React Hook Form integration | `npx assistant-ui create my-app -e with-react-hook-form` |
|
|
83
84
|
| `with-ffmpeg` | FFmpeg video processing tool | `npx assistant-ui create my-app -e with-ffmpeg` |
|
|
@@ -233,11 +234,15 @@ This command:
|
|
|
233
234
|
- Prompts to install new packages
|
|
234
235
|
|
|
235
236
|
**What it does:**
|
|
236
|
-
- Applies
|
|
237
|
+
- Applies the current bundled codemods sequentially
|
|
237
238
|
- Shows progress bar with file count
|
|
238
239
|
- Reports any transformation errors
|
|
239
240
|
- Automatically detects and offers to install new dependencies
|
|
240
241
|
|
|
242
|
+
The latest upgrade excludes the historical v0.8 UI package split because its
|
|
243
|
+
`@assistant-ui/react-ui` destination is incompatible with current runtime versions.
|
|
244
|
+
Do not run `codemod v0-8/ui-package-split` as part of a v0.15 upgrade.
|
|
245
|
+
|
|
241
246
|
**Example output:**
|
|
242
247
|
|
|
243
248
|
```bash
|
|
@@ -467,8 +467,8 @@ export default function MyApp() {
|
|
|
467
467
|
/>
|
|
468
468
|
<Card
|
|
469
469
|
title="Generative UI"
|
|
470
|
-
description="
|
|
471
|
-
href="/docs/tools/
|
|
470
|
+
description="Let the model compose UI from a component vocabulary you ship"
|
|
471
|
+
href="/docs/tools/generative-ui"
|
|
472
472
|
/>
|
|
473
473
|
<Card
|
|
474
474
|
title="Add Persistence"
|
|
@@ -63,7 +63,11 @@ The blocks and non-fatal warnings produced by Slack conversion.
|
|
|
63
63
|
|
|
64
64
|
### SlackConversionWarning
|
|
65
65
|
|
|
66
|
-
A non-fatal
|
|
66
|
+
A non-fatal note reported during Slack conversion.
|
|
67
|
+
|
|
68
|
+
`clamped` removed content to fit a limit, `dropped` discarded a node or one
|
|
69
|
+
of its props and may leave a placeholder note behind, and `fallback` emitted
|
|
70
|
+
the node in a different form than requested.
|
|
67
71
|
|
|
68
72
|
<ParametersTable {...SlackConversionWarning} />
|
|
69
73
|
|
|
@@ -50,14 +50,21 @@ The attachments and non-fatal warnings produced by [toTeamsAttachments](/docs/ap
|
|
|
50
50
|
|
|
51
51
|
### TeamsConversionWarning
|
|
52
52
|
|
|
53
|
-
A non-fatal
|
|
53
|
+
A non-fatal note reported during Teams conversion.
|
|
54
|
+
|
|
55
|
+
`clamped` removed content to fit a limit, `dropped` discarded a node or one
|
|
56
|
+
of its props and may leave a placeholder note behind, and `fallback`
|
|
57
|
+
emitted the node in a different form than requested. `advisory` changed
|
|
58
|
+
nothing at all and notes content Teams may still render poorly or refuse,
|
|
59
|
+
such as a payload over the byte budget or a `Row` past the recommended
|
|
60
|
+
column count.
|
|
54
61
|
|
|
55
62
|
<ParametersTable {...TeamsConversionWarning} />
|
|
56
63
|
|
|
57
64
|
### toAdaptiveCard
|
|
58
65
|
|
|
59
66
|
Converts a generative-ui tree into a Microsoft Teams Adaptive Card and
|
|
60
|
-
non-fatal
|
|
67
|
+
non-fatal conversion warnings. Sizes, weights, and colors map to Adaptive
|
|
61
68
|
Card's semantic enums rather than raw values. An Input/Select/RadioGroup/
|
|
62
69
|
Checkbox/DatePicker whose id would be the reserved RESERVED_INPUT_ID
|
|
63
70
|
is renamed with a warning (see `decodeSubmitData`). Never throws: an
|
|
@@ -33,7 +33,7 @@ function QuoteBlock() {
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
const useMessageQuote: () => QuoteInfo;
|
|
36
|
+
const useMessageQuote: () => QuoteInfo | undefined;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### useMessageTiming
|
|
@@ -51,7 +51,7 @@ function MessageStats() {
|
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
|
-
const useMessageTiming: () => MessageTiming;
|
|
54
|
+
const useMessageTiming: () => MessageTiming | undefined;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
### useRuntimeAdapters
|
|
@@ -36,7 +36,7 @@ Converts an assistant-ui append message into the message payload accepted by
|
|
|
36
36
|
Eve's `send` API.
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
const getEveMessageContent: (message: AppendMessage) =>
|
|
39
|
+
const getEveMessageContent: (message: AppendMessage) => EveMessageContent;
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### toEveInputResponse
|
|
@@ -56,4 +56,42 @@ session, supports cancellation, and maps Eve input requests to assistant-ui
|
|
|
56
56
|
tool approval UI.
|
|
57
57
|
|
|
58
58
|
<ParametersTable {...eve_useEveAgentRuntime} />
|
|
59
|
+
|
|
60
|
+
### useEveError
|
|
61
|
+
|
|
62
|
+
Read the last Eve session error from the runtime extras.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const useEveError: () => Error | undefined;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### useEveEvents
|
|
69
|
+
|
|
70
|
+
Read the authoritative Eve server event stream from the runtime extras.
|
|
71
|
+
Defaults to an empty array outside an Eve runtime.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const useEveEvents: () => EveRuntimeExtras["events"];
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### useEveReset
|
|
78
|
+
|
|
79
|
+
Returns a function that resets the Eve session: aborts any in-flight turn,
|
|
80
|
+
recreates the owned session, and clears events and projected data. Pending
|
|
81
|
+
staged messages and tool execution state are discarded. Safe to render
|
|
82
|
+
outside an Eve runtime; invoking the returned function there throws.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const useEveReset: () => () => void;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### useEveSession
|
|
89
|
+
|
|
90
|
+
Read the current Eve session cursor from the runtime extras. Persist it to
|
|
91
|
+
resume the session later via `initialSession`. `undefined` when no session
|
|
92
|
+
exists yet or outside an Eve runtime.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const useEveSession: () => EveRuntimeExtras["session"] | undefined;
|
|
96
|
+
```
|
|
59
97
|
{/* api-reference:end */}
|
|
@@ -3,7 +3,7 @@ title: "@assistant-ui/react-ai-sdk"
|
|
|
3
3
|
description: Vercel AI SDK runtime hooks, chat transports, and message conversion utilities for assistant-ui React applications.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { reactAiSdk_AISDKToolkit, reactAiSdk_AssistantChatTransport, reactAiSdk_createResumableSessionStorage, reactAiSdk_getThreadMessageTokenUsage, reactAiSdk_injectQuoteContext, reactAiSdk_unstable_injectInteractableContext, reactAiSdk_useAISDKRuntime, reactAiSdk_useChatRuntime } from "@/generated/integrationTypeDocs";
|
|
6
|
+
import { reactAiSdk_AISDKChat, reactAiSdk_AISDKThreads, reactAiSdk_AISDKToolkit, reactAiSdk_AssistantChatTransport, reactAiSdk_createResumableSessionStorage, reactAiSdk_getThreadMessageTokenUsage, reactAiSdk_injectQuoteContext, reactAiSdk_unstable_injectInteractableContext, reactAiSdk_useAISDKRuntime, reactAiSdk_useChatRuntime } from "@/generated/integrationTypeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -14,6 +14,31 @@ import { reactAiSdk_AISDKToolkit, reactAiSdk_AssistantChatTransport, reactAiSdk_
|
|
|
14
14
|
|
|
15
15
|
## API Reference
|
|
16
16
|
|
|
17
|
+
### AISDKChat
|
|
18
|
+
|
|
19
|
+
`AuiConfig` entry that runs the AI SDK chat as the `threads` scope. Hosts the
|
|
20
|
+
same orchestration as `useChatRuntime` inside the client's own resource tree,
|
|
21
|
+
so it works with any `AssistantClient` host, React or not. Single thread; the
|
|
22
|
+
multi-thread and assistant-cloud surface is [AISDKThreads](/docs/api-reference/integrations/react-ai-sdk#aisdkthreads). The chat
|
|
23
|
+
id is captured when the entry mounts, so a later `id` change in the options
|
|
24
|
+
has no effect.
|
|
25
|
+
|
|
26
|
+
<ParametersTable {...reactAiSdk_AISDKChat} />
|
|
27
|
+
|
|
28
|
+
### AISDKThreads
|
|
29
|
+
|
|
30
|
+
`AuiConfig` entry that runs one AI SDK chat per thread. Hosts the same
|
|
31
|
+
per-thread orchestration as [AISDKChat](/docs/api-reference/integrations/react-ai-sdk#aisdkchat) inside the client's own
|
|
32
|
+
resource tree, so it works with any `AssistantClient` host, React or not.
|
|
33
|
+
Without `cloud`, threads live in memory for the client's lifetime and keep
|
|
34
|
+
their history across switches; each thread's chat id is its thread id.
|
|
35
|
+
With `cloud`, the list is a `RemoteThreadList` and the factory is keyed so
|
|
36
|
+
cloud history reloads on a switch. The store entry mounts only the visible
|
|
37
|
+
thread, so a switch cancels an in-flight run. Model context is
|
|
38
|
+
registered on the visible thread only.
|
|
39
|
+
|
|
40
|
+
<ParametersTable {...reactAiSdk_AISDKThreads} />
|
|
41
|
+
|
|
17
42
|
### AISDKToolkit
|
|
18
43
|
|
|
19
44
|
<ParametersTable {...reactAiSdk_AISDKToolkit} />
|
|
@@ -109,7 +134,7 @@ runtime hook. `undefined` when the current thread is not backed by the AI
|
|
|
109
134
|
SDK runtime.
|
|
110
135
|
|
|
111
136
|
```ts
|
|
112
|
-
const useAISDKChat: <UI_MESSAGE extends UIMessage = UIMessage<unknown, UIDataTypes, UITools>>() => UseChatHelpers<UI_MESSAGE
|
|
137
|
+
const useAISDKChat: <UI_MESSAGE extends UIMessage = UIMessage<unknown, UIDataTypes, UITools>>() => UseChatHelpers<UI_MESSAGE> | undefined;
|
|
113
138
|
```
|
|
114
139
|
|
|
115
140
|
### useAISDKError
|
|
@@ -119,7 +144,7 @@ Read the last AI SDK chat error object from the runtime extras.
|
|
|
119
144
|
the AI SDK runtime.
|
|
120
145
|
|
|
121
146
|
```ts
|
|
122
|
-
const useAISDKError: () => Error;
|
|
147
|
+
const useAISDKError: () => Error | undefined;
|
|
123
148
|
```
|
|
124
149
|
|
|
125
150
|
### useAISDKRuntime
|
|
@@ -133,7 +158,7 @@ const useAISDKError: () => Error;
|
|
|
133
158
|
### useThreadTokenUsage
|
|
134
159
|
|
|
135
160
|
```ts
|
|
136
|
-
function useThreadTokenUsage(): ThreadTokenUsage;
|
|
161
|
+
function useThreadTokenUsage(): ThreadTokenUsage | undefined;
|
|
137
162
|
```
|
|
138
163
|
|
|
139
164
|
### generativeTools
|
|
@@ -3,7 +3,7 @@ title: Utilities
|
|
|
3
3
|
description: Miscellaneous @assistant-ui/react utilities for custom rendering, composition, and advanced assistant UI behavior.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { AssistantCloud, AuiConfig, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList, Suggestions, useSmooth } from "@/generated/typeDocs";
|
|
6
|
+
import { AssistantCloud, AuiConfig, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, MessageNotSentError, RemoteThreadList, SingleThreadList, Suggestions, useSmooth } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -59,6 +59,34 @@ const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController
|
|
|
59
59
|
|
|
60
60
|
<ParametersTable {...InMemoryThreadList} />
|
|
61
61
|
|
|
62
|
+
### isMessageNotSentError
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const isMessageNotSentError: (error: unknown) => error is MessageNotSentError;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### MessageNotSentError
|
|
69
|
+
|
|
70
|
+
Rejection reason for a send that never reached the backend, so nothing ran
|
|
71
|
+
and nothing is recoverable from the thread. A runtime adapter throws it from
|
|
72
|
+
`onNew` to hand the message back to the thread composer, which restores the
|
|
73
|
+
draft it cleared at dispatch time when nothing has claimed the composer
|
|
74
|
+
since. An edit composer closes at dispatch, so a rejected edit is not
|
|
75
|
+
restored.
|
|
76
|
+
|
|
77
|
+
<ParametersTable {...MessageNotSentError} />
|
|
78
|
+
|
|
79
|
+
### RemoteThreadList
|
|
80
|
+
|
|
81
|
+
`AuiConfig` `threads` entry backed by a `RemoteThreadListAdapter`. Thread
|
|
82
|
+
bodies are born from the `thread` factory inside the client tree, so any
|
|
83
|
+
`AssistantClient` host can run a remote or cloud list. Per-thread history
|
|
84
|
+
and attachments come from `unstable_useAdapters`. `useRemoteThreadListRuntime`
|
|
85
|
+
uses the same hook when `unstable_Provider` is omitted. Key the factory
|
|
86
|
+
with `withKey` so history reloads when the visible thread changes.
|
|
87
|
+
|
|
88
|
+
<ParametersTable {...RemoteThreadList} />
|
|
89
|
+
|
|
62
90
|
### SingleThreadList
|
|
63
91
|
|
|
64
92
|
<ParametersTable {...SingleThreadList} />
|
|
@@ -19,7 +19,7 @@ This integration provides:
|
|
|
19
19
|
|
|
20
20
|
## How It Works
|
|
21
21
|
|
|
22
|
-
The `useChatRuntime` hook from `@assistant-ui/react-ai-sdk` wraps AI SDK's `useChat` and adds cloud persistence via the `cloud` parameter. The runtime automatically:
|
|
22
|
+
The `useChatRuntime` hook from `@assistant-ui/react-ai-sdk` wraps AI SDK's `useChat` and adds cloud persistence via the `cloud` parameter. `AISDKThreads({ cloud })` is the store-entry list for `AuiConfig` / `createAssistantClient` hosts. That host mounts only the visible thread, so a switch cancels an in-flight run. The runtime automatically:
|
|
23
23
|
|
|
24
24
|
1. Creates a cloud thread on the first user message
|
|
25
25
|
2. Persists messages as they complete streaming
|
|
@@ -332,7 +332,7 @@ Plus all other properties from AI SDK's [`UseChatHelpers`](https://sdk.vercel.ai
|
|
|
332
332
|
| Value | Type | Description |
|
|
333
333
|
|-------|------|-------------|
|
|
334
334
|
| `threads.cloud` | `AssistantCloud` | The cloud instance used for thread operations |
|
|
335
|
-
| `threads.threads` | `CloudThread[]` |
|
|
335
|
+
| `threads.threads` | `CloudThread[]` | Threads sorted by recency; includes archived threads when supplied by `useThreads({ includeArchived: true })` |
|
|
336
336
|
| `threads.threadId` | `string \| null` | Current thread ID (`null` for a new unsaved chat) |
|
|
337
337
|
| `threads.selectThread` | `(id: string \| null) => void` | Switch threads or pass `null` for a new chat |
|
|
338
338
|
| `threads.isLoading` | `boolean` | `true` during initial load or refresh |
|
|
@@ -378,7 +378,7 @@ The `useCloudChat` hook automatically reports run telemetry to Assistant Cloud a
|
|
|
378
378
|
**Requires route configuration:**
|
|
379
379
|
- `model_id` — The model used for the response
|
|
380
380
|
- `input_tokens` / `output_tokens` — Token usage statistics
|
|
381
|
-
- `reasoning_tokens` — Tokens used for chain-of-thought reasoning (e.g. GPT-5.
|
|
381
|
+
- `reasoning_tokens` — Tokens used for chain-of-thought reasoning (e.g. GPT-5.6 Luna or other reasoning models)
|
|
382
382
|
- `cached_input_tokens` — Input tokens served from the provider's prompt cache
|
|
383
383
|
|
|
384
384
|
To capture model and usage data, configure the `messageMetadata` callback in your AI SDK route:
|
|
@@ -16,7 +16,7 @@ Assistant Cloud is a hosted service that adds thread management, message persist
|
|
|
16
16
|
|
|
17
17
|
| Backend | Standalone Mode | With assistant-ui |
|
|
18
18
|
|---------|----------------|-------------------|
|
|
19
|
-
| AI SDK | [`useCloudChat`](/docs/cloud/ai-sdk) | [`useChatRuntime`](/docs/cloud/ai-sdk-assistant-ui) |
|
|
19
|
+
| AI SDK | [`useCloudChat`](/docs/cloud/ai-sdk) | [`useChatRuntime`](/docs/cloud/ai-sdk-assistant-ui) / `AISDKThreads` |
|
|
20
20
|
| LangGraph | — | [`useLangGraphRuntime`](/docs/cloud/langgraph) |
|
|
21
21
|
| Custom | — | Local Runtime |
|
|
22
22
|
|
|
@@ -118,7 +118,7 @@ Build your own adapters for specialized file handling. Below are complete exampl
|
|
|
118
118
|
|
|
119
119
|
### Vision-Capable Image Adapter
|
|
120
120
|
|
|
121
|
-
Send images to vision-capable LLMs like GPT-5.
|
|
121
|
+
Send images to vision-capable LLMs like GPT-5.6, Claude Sonnet 4.6, or Gemini Pro Vision:
|
|
122
122
|
|
|
123
123
|
```tsx
|
|
124
124
|
import {
|
|
@@ -276,7 +276,7 @@ const MyModelAdapter: ChatModelAdapter = {
|
|
|
276
276
|
msg.role === "user" &&
|
|
277
277
|
msg.content.some((part) => part.type === "image")
|
|
278
278
|
) {
|
|
279
|
-
// Format for GPT-5.
|
|
279
|
+
// Format for GPT-5.6 or similar vision models
|
|
280
280
|
return {
|
|
281
281
|
role: "user",
|
|
282
282
|
content: msg.content.map((part) => {
|
|
@@ -519,34 +519,32 @@ The table below covers the most commonly used actions. For the full catalog, see
|
|
|
519
519
|
|
|
520
520
|
### Events vs State Observation
|
|
521
521
|
|
|
522
|
-
`
|
|
522
|
+
Use `useAuiState` to render the current value of something; use `useAuiEvent` to react to the moment something happens. Both are supported: many events mark a transition you could also observe in state, and subscribing to the event is the intended way to run a side effect at that transition.
|
|
523
523
|
|
|
524
524
|
The rule of thumb:
|
|
525
525
|
|
|
526
|
-
1.
|
|
526
|
+
1. Rendering a value? → use `useAuiState`.
|
|
527
527
|
2. Are you the caller and want immediate feedback? → catch the rejection / read the return value.
|
|
528
|
-
3.
|
|
528
|
+
3. Running a side effect when something happens? → use `useAuiEvent`.
|
|
529
529
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
#### Currently Recommended (Truly Transient)
|
|
530
|
+
#### Available Events
|
|
533
531
|
|
|
534
532
|
| Event | When It Fires |
|
|
535
533
|
| ----------------------------- | ---------------------------------------------------------------------------- |
|
|
536
|
-
| `
|
|
534
|
+
| `threads.selectionChanged` | The main thread selection changed. Payload carries `threadId` (newly selected) and `previousThreadId`. Does not fire for the initially selected thread on mount. |
|
|
535
|
+
| `thread.runStart` / `runEnd` | A run started / ended on the thread (also visible as `isRunning` flipping) |
|
|
536
|
+
| `thread.initialize` | The thread transitioned from new to initialized, before the first message is added |
|
|
537
537
|
| `thread.modelContextUpdate` | The model context provider notified a change. The model context lives in a provider, not in thread state, so this event has no state-derivable equivalent. |
|
|
538
|
+
| `composer.send` | The user sent the composer contents; `messageId` is set for edit-composer sends |
|
|
539
|
+
| `composer.attachmentAdd` | An attachment was added to the composer |
|
|
540
|
+
| `composer.attachmentAddError` | An `addAttachment()` call failed. Payload `reason` discriminates `no-adapter` / `not-accepted` / `adapter-error`. The event additionally surfaces a human-readable `message` (and the underlying `Error` instance via the low-level `runtime.unstable_on("attachmentAddError")` API; `useAuiEvent` payloads omit it because raw `Error` objects are not store-serializable). |
|
|
538
541
|
|
|
539
|
-
####
|
|
540
|
-
|
|
541
|
-
These events fire at the same transition you can observe via state. They are kept for backward compatibility but new code should observe state instead.
|
|
542
|
+
#### Deprecated Events
|
|
542
543
|
|
|
543
|
-
|
|
|
544
|
-
|
|
|
545
|
-
| `
|
|
546
|
-
| `
|
|
547
|
-
| `thread.runStart` / `runEnd` | thread `isRunning` flipping to `true` / `false` |
|
|
548
|
-
| `thread.initialize` | thread `messages` becoming non-empty (or `isEmpty` flipping) |
|
|
549
|
-
| `threadListItem.switchedTo` / `switchedAway` | compare `s.threads.mainThreadId` against `s.threadListItem.id` |
|
|
544
|
+
| Deprecated Event | Use Instead |
|
|
545
|
+
| ----------------------------- | ---------------------------------------------------------------------------- |
|
|
546
|
+
| `threadListItem.switchedTo` | `threads.selectionChanged` — its `threadId` is the newly selected thread |
|
|
547
|
+
| `threadListItem.switchedAway` | `threads.selectionChanged` — its `previousThreadId` is the thread switched away from |
|
|
550
548
|
|
|
551
549
|
## Troubleshooting
|
|
552
550
|
|
|
@@ -283,7 +283,7 @@ This pattern records until the user stops dictation, then commits a single final
|
|
|
283
283
|
|
|
284
284
|
## Custom realtime providers
|
|
285
285
|
|
|
286
|
-
You can implement `DictationAdapter` against any streaming STT service. [ElevenLabs Scribe](https://elevenlabs.io/docs/capabilities/speech-to-text) is one option for low-latency WebSocket transcription; scaffold a full example with:
|
|
286
|
+
You can implement `DictationAdapter` against any streaming STT service. [ElevenLabs Scribe](https://elevenlabs.io/docs/overview/capabilities/speech-to-text) is one option for low-latency WebSocket transcription; scaffold a full example with:
|
|
287
287
|
|
|
288
288
|
```bash
|
|
289
289
|
npx assistant-ui create my-app -e with-elevenlabs-scribe
|
|
@@ -82,6 +82,8 @@ const myAdapter: Unstable_TriggerAdapter = {
|
|
|
82
82
|
|
|
83
83
|
The built-in `unstable_useLiveCompletionAdapter` wraps an async fetcher with debouncing, stale-request cancellation (results for an outdated query are dropped), and a single-entry cache. Its `search` returns the last results synchronously and schedules a debounced fetch when the query changes; when results arrive the returned `adapter` re-creates, which re-runs the popover lookup so the fresh items render. It also reports `isLoading`, which you pass to the popover to show a loading state.
|
|
84
84
|
|
|
85
|
+
When the fetcher reads from an account- or workspace-specific source, pass that source ID as `cacheKey`. Changing the key clears cached results and cancels any pending result from the previous source.
|
|
86
|
+
|
|
85
87
|
```tsx
|
|
86
88
|
import {
|
|
87
89
|
unstable_useLiveCompletionAdapter,
|
|
@@ -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
|
|
|
@@ -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>
|
|
@@ -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 />
|