@assistant-ui/mcp-docs-server 0.2.2 → 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 +2 -2
- package/.docs/organized/code-examples/with-a2a.md +4 -3
- package/.docs/organized/code-examples/with-ag-ui.md +5 -4
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +12 -11
- package/.docs/organized/code-examples/with-artifacts.md +10 -9
- package/.docs/organized/code-examples/with-assistant-transport.md +4 -3
- package/.docs/organized/code-examples/with-browser-extension.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +14 -12
- package/.docs/organized/code-examples/with-cloud-standalone.md +5 -5
- package/.docs/organized/code-examples/with-cloud.md +9 -8
- package/.docs/organized/code-examples/with-custom-thread-list.md +8 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -11
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -11
- package/.docs/organized/code-examples/with-eve.md +5 -4
- package/.docs/organized/code-examples/with-expo.md +214 -31
- package/.docs/organized/code-examples/with-external-store.md +4 -3
- package/.docs/organized/code-examples/with-ffmpeg.md +9 -8
- package/.docs/organized/code-examples/with-generative-ui.md +13 -15
- package/.docs/organized/code-examples/with-google-adk.md +4 -3
- package/.docs/organized/code-examples/with-heat-graph.md +2 -2
- package/.docs/organized/code-examples/with-image-generation.md +7 -6
- package/.docs/organized/code-examples/with-interactables.md +9 -8
- package/.docs/organized/code-examples/with-langchain.md +6 -5
- package/.docs/organized/code-examples/with-langgraph.md +6 -5
- package/.docs/organized/code-examples/with-livekit.md +13 -12
- package/.docs/organized/code-examples/with-mcp.md +11 -9
- package/.docs/organized/code-examples/with-nuxt.md +502 -502
- package/.docs/organized/code-examples/with-opencode.md +3 -3
- package/.docs/organized/code-examples/with-openui.md +14 -13
- package/.docs/organized/code-examples/with-pi.md +5 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +13 -10
- package/.docs/organized/code-examples/with-react-ink-web.md +64 -14
- package/.docs/organized/code-examples/with-react-ink.md +3 -2
- package/.docs/organized/code-examples/with-react-router.md +6 -5
- package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
- package/.docs/organized/code-examples/with-store.md +2 -2
- package/.docs/organized/code-examples/with-svelte.md +3 -3
- package/.docs/organized/code-examples/with-sveltekit.md +9 -9
- package/.docs/organized/code-examples/with-tanstack.md +8 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +4 -3
- package/.docs/organized/code-examples/with-virtualized-thread.md +5 -4
- package/.docs/organized/code-examples/with-vue.md +2 -2
- 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 +24 -24
- 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/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +19 -19
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +22 -1
- 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/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +3 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +2 -0
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +2 -2
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/dictation.mdx +1 -1
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- 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 +2 -2
- 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/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 +3 -3
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- 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 +1 -1
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +1 -1
- 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 +13 -1
- 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/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +5 -5
- package/.docs/raw/docs/runtimes/langchain.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -1
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +2 -2
- package/.docs/raw/docs/tools/generative-ui.mdx +2 -2
- package/.docs/raw/docs/tools/interactables.mdx +3 -3
- 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 +2 -2
- package/.docs/raw/docs/tools/tool-ui.mdx +17 -5
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +2 -2
- 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 +30 -10
- 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 +1 -1
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +1 -1
- 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 +3 -3
- 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/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)}/cli.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: Build stateful components and tool UIs that both the user and the m
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { InteractableSample } from "@/components/docs/samples/interactable";
|
|
7
|
+
import { InteractableSample } from "@/components/pages/docs/samples/interactable";
|
|
8
8
|
|
|
9
9
|
Interactables allow both agents and users to read and edit tool UIs and components. They can be in-thread tool UIs like an email composer, or app-scoped components, like artifacts, task boards, or settings panels.
|
|
10
10
|
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
AssistantRuntimeProvider,
|
|
47
47
|
Tools,
|
|
48
48
|
} from "@assistant-ui/react";
|
|
49
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
49
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
50
50
|
|
|
51
51
|
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
52
52
|
const runtime = useChatRuntime();
|
|
@@ -196,7 +196,7 @@ Each user message carries its state snapshots in its metadata, but the AI SDK's
|
|
|
196
196
|
```ts title="app/api/chat/route.ts"
|
|
197
197
|
import { openai } from "@ai-sdk/openai";
|
|
198
198
|
import { convertToModelMessages, streamText } from "ai";
|
|
199
|
-
import { unstable_injectInteractableContext as injectInteractableContext } from "@assistant-ui/
|
|
199
|
+
import { unstable_injectInteractableContext as injectInteractableContext } from "@assistant-ui/ai-sdk";
|
|
200
200
|
|
|
201
201
|
export async function POST(req: Request) {
|
|
202
202
|
const { messages } = await req.json();
|
|
@@ -90,6 +90,23 @@ const mcpApp = McpAppRenderer({
|
|
|
90
90
|
|
|
91
91
|
`openLink` is auto-wired to `window.open(url, "_blank", "noopener,noreferrer")`. `sendMessage` is auto-wired to append a user message to the current thread (accepts `string`, `{ prompt }`, `{ text }`, or `{ message }`).
|
|
92
92
|
|
|
93
|
+
Pass `handlers` when the widget needs host-side UI or lifecycle callbacks. The capabilities are advertised during mount, so provide the handlers before the widget initializes:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
McpAppRenderer({
|
|
97
|
+
host: McpAppsRemoteHost({ url: "/api/mcp-apps" }),
|
|
98
|
+
handlers: {
|
|
99
|
+
requestDisplayMode: ({ mode }) => applyHostDisplayMode(mode),
|
|
100
|
+
updateModelContext: applyHostModelContext,
|
|
101
|
+
openLink: ({ url }) => window.open(url, "_blank", "noopener,noreferrer"),
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`requestDisplayMode` should update host chrome and return the mode that was actually honored. Echoing `{ mode }` without applying it tells the widget the change succeeded while the host stays `inline`.
|
|
107
|
+
|
|
108
|
+
Caller handlers override the default `openLink` and `sendMessage` behavior and can provide `requestDisplayMode`, `updateModelContext`, and lifecycle hooks such as `onInitialized` and `onSizeChange`. `callTool`, `readResource`, and `listResources` remain bound to the configured `host`; use a custom host to change those data-plane operations.
|
|
109
|
+
|
|
93
110
|
### Route handler
|
|
94
111
|
|
|
95
112
|
The route accepts `POST` requests with `{ method, params }` JSON bodies. Dispatch by method name and return the result as JSON. Example for Next.js App Router:
|
|
@@ -170,7 +187,7 @@ Per-name `setToolUI` registrations always win over the MCP fallback — you can
|
|
|
170
187
|
|
|
171
188
|
## AI SDK integration
|
|
172
189
|
|
|
173
|
-
`@assistant-ui/
|
|
190
|
+
`@assistant-ui/ai-sdk` forwards `callProviderMetadata.mcp.app` from AI SDK tool UI parts into `ToolCallMessagePart.mcp.app`. With AI SDK 5.x and an MCP-Apps-capable MCP server, no extra wiring is required on the part shape.
|
|
174
191
|
|
|
175
192
|
The rich UI comes from the MCP server's metadata, not from the model, so the path is identical whichever provider drives the conversation. Running Claude is just a different `model:` in `streamText` (`anthropic("claude-sonnet-4-6")` via `@ai-sdk/anthropic`); the MCP server, `splitMcpAppTools`, and the renderer are unchanged. MCP Apps is an open standard in the MCP ecosystem (Claude is one of its hosts), so a standard MCP-Apps server renders out of the box. The bridge below is only needed for servers that use OpenAI's `openai/outputTemplate` convention, again independent of which model you run.
|
|
176
193
|
|
|
@@ -164,7 +164,7 @@ the server-side MCP readiness flow (`createMCPClient()` plus `tools()`) before
|
|
|
164
164
|
a bad URL or hanging local process can stall the route.
|
|
165
165
|
|
|
166
166
|
```ts title="app/api/chat/route.ts"
|
|
167
|
-
import { AISDKToolkit } from "@assistant-ui/
|
|
167
|
+
import { AISDKToolkit } from "@assistant-ui/ai-sdk";
|
|
168
168
|
import { openai } from "@ai-sdk/openai";
|
|
169
169
|
import { streamText, convertToModelMessages } from "ai";
|
|
170
170
|
import type { UIMessage } from "ai";
|
|
@@ -370,7 +370,7 @@ Register the toolkit once with `Tools({ toolkit })`. Renderer keys such as
|
|
|
370
370
|
"use client";
|
|
371
371
|
|
|
372
372
|
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
|
|
373
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
373
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
374
374
|
import type { ReactNode } from "react";
|
|
375
375
|
|
|
376
376
|
import { toolkit } from "./GitHubIssueToolUI";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
AuiConfig,
|
|
64
64
|
Tools,
|
|
65
65
|
} from "@assistant-ui/react";
|
|
66
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
66
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
67
67
|
import { OpenUIInstructions, openuiIntegration } from "@openuidev/assistant-ui";
|
|
68
68
|
import { shouldContinueAfterOpenUIPrompt } from "@openuidev/assistant-ui/ai-sdk";
|
|
69
69
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
@@ -102,7 +102,7 @@ The default `AssistantChatTransport` forwards the registered instructions and bo
|
|
|
102
102
|
|
|
103
103
|
```ts title="app/api/chat/route.ts"
|
|
104
104
|
import { openai } from "@ai-sdk/openai";
|
|
105
|
-
import { frontendTools } from "@assistant-ui/
|
|
105
|
+
import { frontendTools } from "@assistant-ui/ai-sdk";
|
|
106
106
|
import {
|
|
107
107
|
type JSONSchema7,
|
|
108
108
|
streamText,
|
|
@@ -4,7 +4,9 @@ description: Render AI tool calls as custom React components — show loading, r
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ToolUISample } from "@/components/docs/samples/tool-ui";
|
|
7
|
+
import { ToolUISample } from "@/components/pages/docs/samples/tool-ui";
|
|
8
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
9
|
+
import { ToolUIRendererSample } from "@/components/pages/docs/samples/tool-ui/custom-renderer";
|
|
8
10
|
|
|
9
11
|
Create custom UI components for AI tool calls, providing visual feedback and interactive experiences when tools are executed.
|
|
10
12
|
|
|
@@ -69,7 +71,7 @@ export default defineToolkit({
|
|
|
69
71
|
|
|
70
72
|
```tsx title="app/MyRuntimeProvider.tsx"
|
|
71
73
|
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
|
|
72
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
74
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
73
75
|
import toolkit from "./toolkit";
|
|
74
76
|
|
|
75
77
|
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -109,7 +111,14 @@ const toolkit = defineToolkit({
|
|
|
109
111
|
|
|
110
112
|
## Quick Start Example
|
|
111
113
|
|
|
112
|
-
This example
|
|
114
|
+
This example uses a backend toolkit entry for a tool that the server defines. The preview uses a shorter renderer than the steps below.
|
|
115
|
+
|
|
116
|
+
<PreviewCode
|
|
117
|
+
file="components/pages/docs/samples/tool-ui/custom-renderer"
|
|
118
|
+
name="WeatherToolUI"
|
|
119
|
+
>
|
|
120
|
+
<ToolUIRendererSample />
|
|
121
|
+
</PreviewCode>
|
|
113
122
|
|
|
114
123
|
<Steps>
|
|
115
124
|
<Step>
|
|
@@ -178,12 +187,15 @@ const WeatherToolUI: ToolCallMessagePartComponent<
|
|
|
178
187
|
|
|
179
188
|
### Register the Tool UI
|
|
180
189
|
|
|
181
|
-
Put the renderer on the
|
|
190
|
+
Put the renderer on the related backend toolkit entry.
|
|
191
|
+
|
|
192
|
+
Set `display` to `"standalone"` to keep the tool UI outside the collapsed tool group. A backend tool uses the inline display by default.
|
|
182
193
|
|
|
183
194
|
```tsx
|
|
184
195
|
const toolkit = defineToolkit({
|
|
185
196
|
getWeather: {
|
|
186
197
|
type: "backend",
|
|
198
|
+
display: "standalone",
|
|
187
199
|
render: WeatherToolUI,
|
|
188
200
|
},
|
|
189
201
|
});
|
|
@@ -613,7 +625,7 @@ Renderers respond with the chosen option instead of a boolean; the option's kind
|
|
|
613
625
|
respondToApproval({ optionId: "session" });
|
|
614
626
|
```
|
|
615
627
|
|
|
616
|
-
The runtime receives `{ approvalId, approved, optionId, reason? }`, so a host that persists "always allow" decisions can key its store off `optionId`. Persistence is entirely host-owned: assistant-ui never stores a decision and never auto-answers future approvals. `grants` lists the patterns an option would persist (shown to the user before they commit), and `confirm` opts the option into a confirmation step. Options with custom `_`-prefixed kinds
|
|
628
|
+
The runtime receives `{ approvalId, approved, optionId, reason? }`, so a host that persists "always allow" decisions can key its store off `optionId`. Persistence is entirely host-owned: assistant-ui never stores a decision and never auto-answers future approvals. `grants` lists the patterns an option would persist (shown to the user before they commit), and `confirm` opts the option into a confirmation step. Options with custom `_`-prefixed kinds must be answered with an explicit `approved` value, optionally alongside the `optionId` so the chosen option is still recorded. The default `ToolFallback` bar renders them next to the known kinds and sends `{ optionId, approved: true }` when one is chosen, since picking a declared option is an answer rather than a refusal; it also keeps a Deny control available whenever the request declares no reject-kind option.
|
|
617
629
|
|
|
618
630
|
Approvals that end without a decision (a cancelled run or an expired request) are recorded by the host as `approval.resolution: "cancelled" | "expired"`, which closes the gate without recording a deny.
|
|
619
631
|
|
|
@@ -221,12 +221,12 @@ The callback reads `?state=...&code=...` from the URL, derives the target server
|
|
|
221
221
|
|
|
222
222
|
### That's it — the chat sees your tools
|
|
223
223
|
|
|
224
|
-
`McpManagerResource` registers connected tools as **frontend tools** with the `modelContext` scope. Any chat runtime mounted in the same store (e.g. `@assistant-ui/
|
|
224
|
+
`McpManagerResource` registers connected tools as **frontend tools** with the `modelContext` scope. Any chat runtime mounted in the same store (e.g. `@assistant-ui/ai-sdk`'s `useChatRuntime`) sees them and exposes them to the model — no `useMcpTools` hook, no adapter call.
|
|
225
225
|
|
|
226
226
|
```tsx
|
|
227
227
|
"use client";
|
|
228
228
|
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
|
|
229
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
229
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
230
230
|
|
|
231
231
|
export function Chat() {
|
|
232
232
|
const runtime = useChatRuntime({
|
|
@@ -4,9 +4,9 @@ description: Floating chat bubble for support widgets and help desks.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AssistantModalSample } from "@/components/docs/samples/assistant-modal";
|
|
8
|
-
import * as AssistantModalRadixSamples from "@/components/docs/samples/assistant-modal.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
7
|
+
import { AssistantModalSample } from "@/components/pages/docs/samples/assistant-modal";
|
|
8
|
+
import * as AssistantModalRadixSamples from "@/components/pages/docs/samples/assistant-modal.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
10
|
|
|
11
11
|
A floating chat modal built on the popover primitive of your configured style (Radix UI Popover on Radix styles, Base UI Popover on `base-*` styles). Ideal for support widgets, help desks, and embedded assistants.
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ description: Side panel chat for co-pilot experiences and inline assistance.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AssistantSidebarSample } from "@/components/docs/samples/assistant-sidebar";
|
|
7
|
+
import { AssistantSidebarSample } from "@/components/pages/docs/samples/assistant-sidebar";
|
|
8
8
|
|
|
9
9
|
A resizable side panel layout with your main content on the left and a Thread chat interface on the right. Ideal for co-pilot experiences and inline assistance.
|
|
10
10
|
|
|
@@ -4,14 +4,18 @@ description: UI components for attaching and viewing files in messages.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AttachmentSample } from "@/components/docs/samples/attachment";
|
|
8
|
-
import * as AttachmentRadixSamples from "@/components/docs/samples/attachment.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
10
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
11
|
-
import { AttachmentComposerSample } from "@/components/docs/samples/attachment/composer-attachments";
|
|
12
|
-
import * as AttachmentComposerRadixSample from "@/components/docs/samples/attachment/composer-attachments.radix";
|
|
13
|
-
import { AttachmentMessageContextSample } from "@/components/docs/samples/attachment/message-attachments";
|
|
14
|
-
import * as AttachmentMessageRadixSample from "@/components/docs/samples/attachment/message-attachments.radix";
|
|
7
|
+
import { AttachmentSample } from "@/components/pages/docs/samples/attachment";
|
|
8
|
+
import * as AttachmentRadixSamples from "@/components/pages/docs/samples/attachment.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
11
|
+
import { AttachmentComposerSample } from "@/components/pages/docs/samples/attachment/composer-attachments";
|
|
12
|
+
import * as AttachmentComposerRadixSample from "@/components/pages/docs/samples/attachment/composer-attachments.radix";
|
|
13
|
+
import { AttachmentMessageContextSample } from "@/components/pages/docs/samples/attachment/message-attachments";
|
|
14
|
+
import * as AttachmentMessageRadixSample from "@/components/pages/docs/samples/attachment/message-attachments.radix";
|
|
15
|
+
import { AttachmentTypesSample } from "@/components/pages/docs/samples/attachment/types";
|
|
16
|
+
import * as AttachmentTypesRadixSample from "@/components/pages/docs/samples/attachment/types.radix";
|
|
17
|
+
import { AttachmentPreviewSample } from "@/components/pages/docs/samples/attachment/image-preview";
|
|
18
|
+
import * as AttachmentPreviewRadixSample from "@/components/pages/docs/samples/attachment/image-preview.radix";
|
|
15
19
|
|
|
16
20
|
<FlavorSwitcher />
|
|
17
21
|
|
|
@@ -97,7 +101,7 @@ const UserMessage: FC = () => {
|
|
|
97
101
|
|
|
98
102
|
In the composer, each attachment tile shows a remove button that deletes the attachment from the composer. Use the plus button to add your own files.
|
|
99
103
|
|
|
100
|
-
<PreviewCode file="components/docs/samples/attachment/composer-attachments" name="ComposerWithAttachments" base={<AttachmentComposerSample />}>
|
|
104
|
+
<PreviewCode file="components/pages/docs/samples/attachment/composer-attachments" name="ComposerWithAttachments" base={<AttachmentComposerSample />}>
|
|
101
105
|
<AttachmentComposerRadixSample.AttachmentComposerSample />
|
|
102
106
|
</PreviewCode>
|
|
103
107
|
|
|
@@ -105,10 +109,26 @@ In the composer, each attachment tile shows a remove button that deletes the att
|
|
|
105
109
|
|
|
106
110
|
Message attachments are read-only. The same tile in a sent user message does not show a remove button.
|
|
107
111
|
|
|
108
|
-
<PreviewCode file="components/docs/samples/attachment/message-attachments" name="UserMessageWithAttachments" base={<AttachmentMessageContextSample />}>
|
|
112
|
+
<PreviewCode file="components/pages/docs/samples/attachment/message-attachments" name="UserMessageWithAttachments" base={<AttachmentMessageContextSample />}>
|
|
109
113
|
<AttachmentMessageRadixSample.AttachmentMessageContextSample />
|
|
110
114
|
</PreviewCode>
|
|
111
115
|
|
|
116
|
+
### Custom Types
|
|
117
|
+
|
|
118
|
+
This example shows the image tile and the generic fallback tile used for the built-in document type and the custom attachment type. The two fallback tiles use the same icon, but their accessible labels distinguish them.
|
|
119
|
+
|
|
120
|
+
<PreviewCode file="components/pages/docs/samples/attachment/types" name="AttachmentTypesSample" base={<AttachmentTypesSample />}>
|
|
121
|
+
<AttachmentTypesRadixSample.AttachmentTypesSample />
|
|
122
|
+
</PreviewCode>
|
|
123
|
+
|
|
124
|
+
### Image Preview
|
|
125
|
+
|
|
126
|
+
When you click an image tile or activate it with the keyboard, a full-size preview dialog opens.
|
|
127
|
+
|
|
128
|
+
<PreviewCode file="components/pages/docs/samples/attachment/image-preview" name="AttachmentPreviewSample" base={<AttachmentPreviewSample />}>
|
|
129
|
+
<AttachmentPreviewRadixSample.AttachmentPreviewSample />
|
|
130
|
+
</PreviewCode>
|
|
131
|
+
|
|
112
132
|
## API Reference
|
|
113
133
|
|
|
114
134
|
### Composer Attachments
|
|
@@ -4,7 +4,7 @@ description: Reusable picker UI for @ mentions, / slash commands, and any other
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ComposerTriggerPopoverSample } from "@/components/docs/samples/composer-trigger-popover";
|
|
7
|
+
import { ComposerTriggerPopoverSample } from "@/components/pages/docs/samples/composer-trigger-popover";
|
|
8
8
|
|
|
9
9
|
<ComposerTriggerPopoverSample />
|
|
10
10
|
|
|
@@ -118,6 +118,40 @@ function SlashComposer() {
|
|
|
118
118
|
}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
## Custom Query Matching
|
|
122
|
+
|
|
123
|
+
By default, whitespace closes a trigger query. Pass a stable `matcher` when a picker needs different syntax, such as multi-word business names. The same matcher controls the textarea popover and Lexical directive insertion.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import type { Unstable_TriggerMatcher } from "@assistant-ui/react";
|
|
127
|
+
|
|
128
|
+
const matchMultiWord: Unstable_TriggerMatcher = (
|
|
129
|
+
text,
|
|
130
|
+
triggerChar,
|
|
131
|
+
cursorPosition,
|
|
132
|
+
) => {
|
|
133
|
+
const textUpToCursor = text.slice(0, cursorPosition);
|
|
134
|
+
const offset = textUpToCursor.lastIndexOf(triggerChar);
|
|
135
|
+
if (offset === -1) return null;
|
|
136
|
+
|
|
137
|
+
const preceding = textUpToCursor[offset - 1];
|
|
138
|
+
if (preceding && !/\s/u.test(preceding)) return null;
|
|
139
|
+
|
|
140
|
+
const query = textUpToCursor.slice(offset + triggerChar.length);
|
|
141
|
+
if (/[\n\t]/u.test(query) || query.endsWith(" ")) return null;
|
|
142
|
+
|
|
143
|
+
return { query, offset, endOffset: cursorPosition };
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
<ComposerTriggerPopover
|
|
147
|
+
char="@"
|
|
148
|
+
matcher={matchMultiWord}
|
|
149
|
+
{...mention}
|
|
150
|
+
/>;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The matcher receives the serialized composer text for a textarea and the current text node for Lexical. `offset` is the trigger index in that string. `endOffset` is the exclusive end of the span both inputs replace. `query` is the search string and may differ from that span.
|
|
154
|
+
|
|
121
155
|
## Combining Triggers
|
|
122
156
|
|
|
123
157
|
Multiple popovers coexist under one `TriggerPopoverRoot`. Each reads state from its own declaration, so `@` and `/` never collide.
|
|
@@ -177,6 +211,7 @@ The popover implements the WAI-ARIA editable combobox pattern.
|
|
|
177
211
|
| Prop | Type | Default | Description |
|
|
178
212
|
| --- | --- | --- | --- |
|
|
179
213
|
| `char` | `string` | — | Trigger character, e.g. `"@"` or `"/"` (required; unique within the root) |
|
|
214
|
+
| `matcher` | `Unstable_TriggerMatcher` | whitespace-terminated | Overrides trigger detection and the replace span for both textarea and Lexical inputs |
|
|
180
215
|
| `adapter` | `Unstable_TriggerAdapter` | — | Provides categories, items, and search (required) |
|
|
181
216
|
| `directive` | `{ formatter, onInserted?, chip? }` | — | Enables directive-insert behavior. Mutually exclusive with `action`. |
|
|
182
217
|
| `action` | `{ formatter, onExecute, removeOnExecute?, chip? }` | — | Enables action behavior. Mutually exclusive with `directive`. |
|
|
@@ -4,7 +4,7 @@ description: Visualize token usage relative to a model's context window — ring
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ContextDisplaySample } from "@/components/docs/samples/context-display";
|
|
7
|
+
import { ContextDisplaySample } from "@/components/pages/docs/samples/context-display";
|
|
8
8
|
|
|
9
9
|
<ContextDisplaySample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Render mention directives as inline chips in user messages.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { DirectiveTextSample } from "@/components/docs/samples/directive-text";
|
|
7
|
+
import { DirectiveTextSample } from "@/components/pages/docs/samples/directive-text";
|
|
8
8
|
|
|
9
9
|
<DirectiveTextSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Render runtime-generated follow-up prompt chips after an assistant
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FollowUpSuggestionsSample } from "@/components/docs/samples/follow-up-suggestions";
|
|
7
|
+
import { FollowUpSuggestionsSample } from "@/components/pages/docs/samples/follow-up-suggestions";
|
|
8
8
|
|
|
9
9
|
<FollowUpSuggestionsSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Display image message parts with preview, loading states, and fulls
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ImageSample } from "@/components/docs/samples/image";
|
|
7
|
+
import { ImageSample } from "@/components/pages/docs/samples/image";
|
|
8
8
|
|
|
9
9
|
<ImageSample />
|
|
10
10
|
|
|
@@ -4,7 +4,12 @@ description: Display rich text with headings, lists, links, and code blocks.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MarkdownSample } from "@/components/docs/samples/markdown";
|
|
7
|
+
import { MarkdownSample } from "@/components/pages/docs/samples/markdown";
|
|
8
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
9
|
+
import { MarkdownCodeBlockSample } from "@/components/pages/docs/samples/markdown/code-block-and-copy";
|
|
10
|
+
import { MarkdownRichDocumentSample } from "@/components/pages/docs/samples/markdown/rich-document";
|
|
11
|
+
import { MarkdownStreamingSample } from "@/components/pages/docs/samples/markdown/streaming-markdown";
|
|
12
|
+
import { MarkdownGfmSample } from "@/components/pages/docs/samples/markdown/gfm-extras";
|
|
8
13
|
|
|
9
14
|
<MarkdownSample />
|
|
10
15
|
|
|
@@ -54,6 +59,40 @@ const AssistantMessage: FC = () => {
|
|
|
54
59
|
|
|
55
60
|
</Steps>
|
|
56
61
|
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
### Code Block and Copy
|
|
65
|
+
|
|
66
|
+
Fenced code blocks get a language header and a copy button, and inline code keeps compact styling. The preview also uses [syntax highlighting](/docs/ui/syntax-highlighting), which the copied component does not include by default.
|
|
67
|
+
|
|
68
|
+
<PreviewCode file="components/pages/docs/samples/markdown/code-block-and-copy" name="MarkdownWithCode">
|
|
69
|
+
<MarkdownCodeBlockSample />
|
|
70
|
+
</PreviewCode>
|
|
71
|
+
|
|
72
|
+
### Rich Document
|
|
73
|
+
|
|
74
|
+
The renderer shows headings, emphasis, links, nested lists, a blockquote, a divider, and a table from one completed response.
|
|
75
|
+
|
|
76
|
+
<PreviewCode file="components/pages/docs/samples/markdown/rich-document" name="MarkdownDocument">
|
|
77
|
+
<MarkdownRichDocumentSample />
|
|
78
|
+
</PreviewCode>
|
|
79
|
+
|
|
80
|
+
### Streaming Markdown
|
|
81
|
+
|
|
82
|
+
Select Replay. The markdown increases in steps, and the text part shows a running status until the last chunk.
|
|
83
|
+
|
|
84
|
+
<PreviewCode file="components/pages/docs/samples/markdown/streaming-markdown" name="StreamingMarkdown">
|
|
85
|
+
<MarkdownStreamingSample />
|
|
86
|
+
</PreviewCode>
|
|
87
|
+
|
|
88
|
+
### GitHub Flavored Markdown
|
|
89
|
+
|
|
90
|
+
Task-list checkboxes, strikethrough text, a bare autolink, and an aligned table show through the built-in GFM support.
|
|
91
|
+
|
|
92
|
+
<PreviewCode file="components/pages/docs/samples/markdown/gfm-extras" name="GfmMarkdown">
|
|
93
|
+
<MarkdownGfmSample />
|
|
94
|
+
</PreviewCode>
|
|
95
|
+
|
|
57
96
|
## Syntax highlighting
|
|
58
97
|
|
|
59
98
|
Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/syntax-highlighting) to learn how to add it.
|
|
@@ -4,7 +4,7 @@ description: Render Mermaid diagrams in chat messages with streaming support.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MermaidSample } from "@/components/docs/samples/mermaid";
|
|
7
|
+
import { MermaidSample } from "@/components/pages/docs/samples/mermaid";
|
|
8
8
|
|
|
9
9
|
<MermaidSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Display streaming performance stats — TTFT, total time, tok/s, an
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MessageTimingSample } from "@/components/docs/samples/message-timing";
|
|
7
|
+
import { MessageTimingSample } from "@/components/pages/docs/samples/message-timing";
|
|
8
8
|
|
|
9
9
|
<MessageTimingSample />
|
|
10
10
|
|
|
@@ -4,9 +4,9 @@ description: Composable model picker with reasoning effort levels, search, and r
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ModelSelectorSample } from "@/components/docs/samples/model-selector";
|
|
8
|
-
import * as ModelSelectorRadixSamples from "@/components/docs/samples/model-selector.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
7
|
+
import { ModelSelectorSample } from "@/components/pages/docs/samples/model-selector";
|
|
8
|
+
import * as ModelSelectorRadixSamples from "@/components/pages/docs/samples/model-selector.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
10
|
|
|
11
11
|
A picker that lets users switch between AI models and choose a reasoning effort (thinking) level. It is built on Popover + Command, so search, provider grouping, and filtering compose in without being built in. The default export integrates with assistant-ui's `ModelContext` system, so the selection reaches your backend on every request with no extra wiring.
|
|
12
12
|
|
|
@@ -312,7 +312,7 @@ The default `ModelSelector` export registers the selection with assistant-ui's `
|
|
|
312
312
|
2. The `AssistantChatTransport` includes `config` in the request body of every chat request
|
|
313
313
|
3. Your API route reads `config.modelName` and `config.reasoningEffort`
|
|
314
314
|
|
|
315
|
-
This works out of the box with `@assistant-ui/
|
|
315
|
+
This works out of the box with `@assistant-ui/ai-sdk`. `ModelSelector.Root` performs no registration; it is purely presentational, with controlled and uncontrolled props for the value, effort, and open state.
|
|
316
316
|
|
|
317
317
|
## API Reference
|
|
318
318
|
|
|
@@ -4,7 +4,7 @@ description: Organize message parts into custom groups with flexible grouping fu
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { PartGroupingSample } from "@/components/docs/samples/part-grouping";
|
|
7
|
+
import { PartGroupingSample } from "@/components/pages/docs/samples/part-grouping";
|
|
8
8
|
|
|
9
9
|
<PartGroupingSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Let users select and quote text from messages with a floating toolb
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { QuoteSample } from "@/components/docs/samples/quote";
|
|
7
|
+
import { QuoteSample } from "@/components/pages/docs/samples/quote";
|
|
8
8
|
|
|
9
9
|
<QuoteSample />
|
|
10
10
|
|
|
@@ -97,7 +97,7 @@ Quote data is stored in message metadata, **not** in message content. Use `injec
|
|
|
97
97
|
|
|
98
98
|
```typescript title="app/api/chat/route.ts" {2,9}
|
|
99
99
|
import { convertToModelMessages, streamText } from "ai";
|
|
100
|
-
import { injectQuoteContext } from "@assistant-ui/
|
|
100
|
+
import { injectQuoteContext } from "@assistant-ui/ai-sdk";
|
|
101
101
|
|
|
102
102
|
export async function POST(req: Request) {
|
|
103
103
|
const { messages } = await req.json();
|
|
@@ -180,7 +180,7 @@ Quote preview inside the composer. Only renders when a quote is set.
|
|
|
180
180
|
### `injectQuoteContext`
|
|
181
181
|
|
|
182
182
|
```typescript
|
|
183
|
-
import { injectQuoteContext } from "@assistant-ui/
|
|
183
|
+
import { injectQuoteContext } from "@assistant-ui/ai-sdk";
|
|
184
184
|
|
|
185
185
|
injectQuoteContext(messages: UIMessage[]): UIMessage[]
|
|
186
186
|
```
|
|
@@ -4,7 +4,10 @@ description: Collapsible UI for displaying AI reasoning and thinking messages.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ReasoningSample,
|
|
7
|
+
import { ReasoningSample, ReasoningStreamingSample } from "@/components/pages/docs/samples/reasoning";
|
|
8
|
+
import { ReasoningCompletedSample } from "@/components/pages/docs/samples/reasoning/completed-with-duration";
|
|
9
|
+
import { ReasoningLongSample } from "@/components/pages/docs/samples/reasoning/long-reasoning";
|
|
10
|
+
import { ReasoningVariantsSample } from "@/components/pages/docs/samples/reasoning/variant-showcase";
|
|
8
11
|
|
|
9
12
|
<ReasoningSample />
|
|
10
13
|
|
|
@@ -115,12 +118,36 @@ Use the `variant` prop on `ReasoningRoot` to change the visual style:
|
|
|
115
118
|
| `ghost` | No additional styling |
|
|
116
119
|
| `muted` | Muted background |
|
|
117
120
|
|
|
121
|
+
## Examples
|
|
122
|
+
|
|
123
|
+
### Variant Showcase
|
|
124
|
+
|
|
125
|
+
Each variant renders in its closed and open state side by side. Select a trigger to toggle that disclosure.
|
|
126
|
+
|
|
127
|
+
<ReasoningVariantsSample />
|
|
128
|
+
|
|
129
|
+
### Streaming Reasoning
|
|
130
|
+
|
|
131
|
+
The response shows partial reasoning and stays active. Select Stop to cancel the response and return the composer to its idle state.
|
|
132
|
+
|
|
133
|
+
<ReasoningStreamingSample />
|
|
134
|
+
|
|
135
|
+
### Completed with Duration
|
|
136
|
+
|
|
137
|
+
Set `duration` in seconds on `ReasoningTrigger` to show the completed reasoning time in the trigger label. The disclosure starts closed because `defaultOpen` is `false`. Select the trigger to open or close the reasoning text.
|
|
138
|
+
|
|
139
|
+
<ReasoningCompletedSample />
|
|
140
|
+
|
|
141
|
+
### Long Reasoning
|
|
142
|
+
|
|
143
|
+
The `defaultOpen` prop opens the disclosure when the page loads. `ReasoningText` holds long reasoning in a `max-h-64` scroll area. Scroll the text. Then collapse and expand the disclosure.
|
|
144
|
+
|
|
145
|
+
<ReasoningLongSample />
|
|
146
|
+
|
|
118
147
|
## Legacy ReasoningGroup
|
|
119
148
|
|
|
120
149
|
`ReasoningGroup` is kept for existing code that still uses the deprecated `components.ReasoningGroup` prop on `MessagePrimitive.Parts`. New code should use `MessagePrimitive.GroupedParts` and compose the root/trigger/content pieces directly.
|
|
121
150
|
|
|
122
|
-
<ReasoningGroupSample />
|
|
123
|
-
|
|
124
151
|
```tsx
|
|
125
152
|
import { ReasoningGroup } from "@/components/assistant-ui/reasoning";
|
|
126
153
|
|
|
@@ -149,6 +176,7 @@ const ReasoningGroupImpl: ReasoningGroupComponent = ({
|
|
|
149
176
|
};
|
|
150
177
|
```
|
|
151
178
|
|
|
179
|
+
|
|
152
180
|
## API Reference
|
|
153
181
|
|
|
154
182
|
### Composable API
|
|
@@ -4,7 +4,7 @@ description: Replace the default scrollbar with a custom Radix UI scroll area.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ScrollbarSample } from "@/components/docs/samples/scrollbar";
|
|
7
|
+
import { ScrollbarSample } from "@/components/pages/docs/samples/scrollbar";
|
|
8
8
|
|
|
9
9
|
<ScrollbarSample />
|
|
10
10
|
|
|
@@ -4,7 +4,8 @@ description: Display URL sources with favicon, title, and external link.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { SourcesSample } from "@/components/docs/samples/sources";
|
|
7
|
+
import { SourcesSample } from "@/components/pages/docs/samples/sources";
|
|
8
|
+
import { SourcesUrlSample } from "@/components/pages/docs/samples/sources/url-sources";
|
|
8
9
|
|
|
9
10
|
<SourcesSample />
|
|
10
11
|
|
|
@@ -69,6 +70,14 @@ Use the `size` prop to change the size.
|
|
|
69
70
|
<Source size="lg" /> // Large
|
|
70
71
|
```
|
|
71
72
|
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### URL Sources
|
|
76
|
+
|
|
77
|
+
One source shows its supplied title. The other source uses its domain because its title is absent.
|
|
78
|
+
|
|
79
|
+
<SourcesUrlSample />
|
|
80
|
+
|
|
72
81
|
## API Reference
|
|
73
82
|
|
|
74
83
|
### `Sources`
|
|
@@ -7,8 +7,8 @@ links:
|
|
|
7
7
|
platforms: ["react"]
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
import { PackageManagerTabs } from "@/components/docs/fumadocs/install/package-manager-tabs";
|
|
11
|
-
import { StreamdownSample } from "@/components/docs/samples/streamdown";
|
|
10
|
+
import { PackageManagerTabs } from "@/components/pages/docs/fumadocs/install/package-manager-tabs";
|
|
11
|
+
import { StreamdownSample } from "@/components/pages/docs/samples/streamdown";
|
|
12
12
|
|
|
13
13
|
<StreamdownSample />
|
|
14
14
|
|
|
@@ -4,7 +4,7 @@ description: Code block syntax highlighting with react-shiki or react-syntax-hig
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { SyntaxHighlightingSample } from "@/components/docs/samples/syntax-highlighting";
|
|
7
|
+
import { SyntaxHighlightingSample } from "@/components/pages/docs/samples/syntax-highlighting";
|
|
8
8
|
|
|
9
9
|
<Callout type="warn">Syntax highlighting is not enabled in markdown by default.</Callout>
|
|
10
10
|
|