@assistant-ui/mcp-docs-server 0.1.32 → 0.1.33
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 +15 -17
- package/.docs/organized/code-examples/with-a2a.md +19 -19
- package/.docs/organized/code-examples/with-ag-ui.md +25 -20
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +6 -4
- package/.docs/organized/code-examples/with-artifacts.md +34 -28
- package/.docs/organized/code-examples/with-assistant-transport.md +59 -47
- package/.docs/organized/code-examples/with-browser-extension.md +17 -5
- package/.docs/organized/code-examples/with-chain-of-thought.md +376 -78
- package/.docs/organized/code-examples/with-cloud-standalone.md +20 -19
- package/.docs/organized/code-examples/with-cloud.md +6 -4
- package/.docs/organized/code-examples/with-custom-thread-list.md +9 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -16
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +9 -8
- package/.docs/organized/code-examples/with-expo.md +23 -17
- package/.docs/organized/code-examples/with-external-store.md +4 -2
- package/.docs/organized/code-examples/with-ffmpeg.md +317 -280
- package/.docs/organized/code-examples/with-generative-ui.md +1018 -214
- package/.docs/organized/code-examples/with-google-adk.md +4 -2
- package/.docs/organized/code-examples/with-heat-graph.md +8 -6
- package/.docs/organized/code-examples/with-image-generation.md +19 -17
- package/.docs/organized/code-examples/with-interactables.md +312 -234
- package/.docs/organized/code-examples/with-langchain.md +9 -7
- package/.docs/organized/code-examples/with-langgraph.md +82 -78
- package/.docs/organized/code-examples/with-livekit.md +19 -17
- package/.docs/organized/code-examples/with-mcp.md +13 -7
- package/.docs/organized/code-examples/with-opencode.md +61 -61
- package/.docs/organized/code-examples/with-react-hook-form.md +14 -12
- package/.docs/organized/code-examples/with-react-ink.md +2 -2
- package/.docs/organized/code-examples/with-react-router.md +11 -9
- package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
- package/.docs/organized/code-examples/with-store.md +14 -12
- package/.docs/organized/code-examples/with-tanstack.md +8 -9
- package/.docs/organized/code-examples/with-tap-runtime.md +21 -19
- package/.docs/raw/docs/(docs)/architecture.mdx +43 -2
- package/.docs/raw/docs/(docs)/cli.mdx +1 -2
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +34 -26
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +32 -26
- package/.docs/raw/docs/(docs)/installation.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +14 -14
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +11 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +18 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +45 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +41 -41
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +19 -1
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +122 -122
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +32 -2
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +4 -6
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +30 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +20 -3
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +8 -8
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +52 -4
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +6 -7
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +58 -46
- package/.docs/raw/docs/cloud/ai-sdk.mdx +0 -2
- package/.docs/raw/docs/guides/chain-of-thought.mdx +7 -9
- package/.docs/raw/docs/guides/context-api.mdx +2 -1
- package/.docs/raw/docs/guides/index.mdx +3 -12
- package/.docs/raw/docs/guides/mentions.mdx +4 -4
- package/.docs/raw/docs/guides/slash-commands.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +98 -85
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +17 -2
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +226 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +10 -16
- package/.docs/raw/docs/primitives/message.mdx +9 -10
- package/.docs/raw/docs/react-native/hooks.mdx +57 -82
- package/.docs/raw/docs/react-native/migration.mdx +1 -1
- package/.docs/raw/docs/react-native/primitives.mdx +2 -2
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +3 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +122 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +7 -1
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +18 -7
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +108 -38
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +64 -50
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +98 -86
- package/.docs/raw/docs/tools/backend.mdx +136 -0
- package/.docs/raw/docs/tools/defining-tools.mdx +413 -0
- package/.docs/raw/docs/tools/dynamic-tools.mdx +110 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +214 -0
- package/.docs/raw/docs/tools/index.mdx +76 -0
- package/.docs/raw/docs/{guides → tools}/interactables.mdx +1 -1
- package/.docs/raw/docs/{integrations/tools → tools}/mcp.mdx +77 -50
- package/.docs/raw/docs/{guides → tools}/multi-agent.mdx +17 -19
- package/.docs/raw/docs/tools/tool-ui.mdx +967 -0
- package/.docs/raw/docs/{integrations/tools/react-mcp.mdx → tools/user-managed-mcp.mdx} +3 -3
- package/.docs/raw/docs/ui/directive-text.mdx +3 -3
- package/.docs/raw/docs/ui/mcp-config.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +84 -50
- package/.docs/raw/docs/ui/reasoning.mdx +4 -5
- package/.docs/raw/docs/ui/tool-group.mdx +5 -6
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/package.json +3 -3
- package/.docs/organized/code-examples/with-parent-id-grouping.md +0 -596
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -151
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -230
- package/.docs/raw/docs/guides/generative-ui.mdx +0 -142
- package/.docs/raw/docs/guides/tool-ui.mdx +0 -858
- package/.docs/raw/docs/guides/tools.mdx +0 -736
- /package/.docs/raw/docs/{guides → tools}/mcp-apps.mdx +0 -0
|
@@ -476,9 +476,8 @@ async function createStore(): Promise<ResumableStreamStore> {
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
const { createClient } = await import("redis");
|
|
479
|
-
const { createRedisResumableStreamStore } =
|
|
480
|
-
"assistant-stream/resumable/redis"
|
|
481
|
-
);
|
|
479
|
+
const { createRedisResumableStreamStore } =
|
|
480
|
+
await import("assistant-stream/resumable/redis");
|
|
482
481
|
|
|
483
482
|
const client = createClient({ url });
|
|
484
483
|
client.on("error", (err) => {
|
|
@@ -493,10 +492,11 @@ async function createStore(): Promise<ResumableStreamStore> {
|
|
|
493
492
|
## next.config.js
|
|
494
493
|
|
|
495
494
|
```javascript
|
|
495
|
+
import { withAui } from "@assistant-ui/next";
|
|
496
496
|
/** @type {import('next').NextConfig} */
|
|
497
497
|
const nextConfig = {};
|
|
498
498
|
|
|
499
|
-
export default nextConfig;
|
|
499
|
+
export default withAui(nextConfig);
|
|
500
500
|
|
|
501
501
|
```
|
|
502
502
|
|
|
@@ -514,27 +514,28 @@ export default nextConfig;
|
|
|
514
514
|
"start": "next start"
|
|
515
515
|
},
|
|
516
516
|
"dependencies": {
|
|
517
|
-
"@ai-sdk/openai": "^3.0.
|
|
518
|
-
"@ai-sdk/react": "^3.0.
|
|
517
|
+
"@ai-sdk/openai": "^3.0.67",
|
|
518
|
+
"@ai-sdk/react": "^3.0.195",
|
|
519
519
|
"@assistant-ui/react": "workspace:*",
|
|
520
520
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
521
521
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
522
522
|
"@assistant-ui/store": "workspace:*",
|
|
523
523
|
"@assistant-ui/tap": "workspace:*",
|
|
524
524
|
"@assistant-ui/ui": "workspace:*",
|
|
525
|
-
"ai": "^6.0.
|
|
525
|
+
"ai": "^6.0.193",
|
|
526
526
|
"assistant-stream": "workspace:*",
|
|
527
527
|
"class-variance-authority": "^0.7.1",
|
|
528
528
|
"clsx": "^2.1.1",
|
|
529
|
-
"lucide-react": "^1.
|
|
529
|
+
"lucide-react": "^1.17.0",
|
|
530
530
|
"next": "^16.2.6",
|
|
531
531
|
"react": "^19.2.6",
|
|
532
532
|
"react-dom": "^19.2.6",
|
|
533
|
-
"redis": "^
|
|
533
|
+
"redis": "^6.0.0",
|
|
534
534
|
"tailwind-merge": "^3.6.0",
|
|
535
535
|
"zod": "^4.4.3"
|
|
536
536
|
},
|
|
537
537
|
"devDependencies": {
|
|
538
|
+
"@assistant-ui/next": "workspace:*",
|
|
538
539
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
539
540
|
"@tailwindcss/postcss": "^4.3.0",
|
|
540
541
|
"@types/node": "^25.9.1",
|
|
@@ -82,10 +82,10 @@ export default function Home() {
|
|
|
82
82
|
<div className="min-h-screen bg-linear-to-br from-gray-50 to-gray-100 p-8 dark:from-gray-900 dark:to-gray-800">
|
|
83
83
|
<div className="mx-auto max-w-4xl">
|
|
84
84
|
<div className="mb-8">
|
|
85
|
-
<h1 className="mb-2 font-bold text-
|
|
85
|
+
<h1 className="mb-2 text-4xl font-bold text-gray-900 dark:text-white">
|
|
86
86
|
@assistant-ui/store Example
|
|
87
87
|
</h1>
|
|
88
|
-
<p className="text-gray-600
|
|
88
|
+
<p className="text-lg text-gray-600 dark:text-gray-400">
|
|
89
89
|
Demonstrating tap-based state management with scopes, lists, and
|
|
90
90
|
providers
|
|
91
91
|
</p>
|
|
@@ -134,15 +134,15 @@ const Foo = () => {
|
|
|
134
134
|
<div className="rounded-lg border border-gray-200 bg-white p-6 shadow-md transition-shadow hover:shadow-lg dark:border-gray-700 dark:bg-gray-800">
|
|
135
135
|
<div className="space-y-3">
|
|
136
136
|
<div className="flex items-center gap-2">
|
|
137
|
-
<span className="font-semibold text-gray-500
|
|
137
|
+
<span className="text-sm font-semibold text-gray-500 dark:text-gray-400">
|
|
138
138
|
ID:
|
|
139
139
|
</span>
|
|
140
|
-
<span className="font-mono text-gray-900
|
|
140
|
+
<span className="font-mono text-sm text-gray-900 dark:text-white">
|
|
141
141
|
{fooId}
|
|
142
142
|
</span>
|
|
143
143
|
</div>
|
|
144
144
|
<div className="flex items-center gap-2">
|
|
145
|
-
<span className="font-semibold text-gray-500
|
|
145
|
+
<span className="text-sm font-semibold text-gray-500 dark:text-gray-400">
|
|
146
146
|
Value:
|
|
147
147
|
</span>
|
|
148
148
|
<span className="text-gray-900 dark:text-white">{fooBar}</span>
|
|
@@ -151,14 +151,14 @@ const Foo = () => {
|
|
|
151
151
|
<button
|
|
152
152
|
type="button"
|
|
153
153
|
onClick={handleUpdate}
|
|
154
|
-
className="flex-1 rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-700 focus:
|
|
154
|
+
className="flex-1 rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
|
|
155
155
|
>
|
|
156
156
|
Update
|
|
157
157
|
</button>
|
|
158
158
|
<button
|
|
159
159
|
type="button"
|
|
160
160
|
onClick={() => aui.foo().remove()}
|
|
161
|
-
className="rounded-md bg-red-600 px-4 py-2 font-medium text-white transition-colors hover:bg-red-700 focus:
|
|
161
|
+
className="rounded-md bg-red-600 px-4 py-2 font-medium text-white transition-colors hover:bg-red-700 focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
|
|
162
162
|
>
|
|
163
163
|
Delete
|
|
164
164
|
</button>
|
|
@@ -183,7 +183,7 @@ const AddFooButton = () => {
|
|
|
183
183
|
<button
|
|
184
184
|
type="button"
|
|
185
185
|
onClick={() => aui.fooList().addFoo()}
|
|
186
|
-
className="rounded-md bg-green-600 px-4 py-2 font-medium text-white transition-colors hover:bg-green-700 focus:
|
|
186
|
+
className="rounded-md bg-green-600 px-4 py-2 font-medium text-white transition-colors hover:bg-green-700 focus:ring-2 focus:ring-green-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
|
|
187
187
|
>
|
|
188
188
|
Add New
|
|
189
189
|
</button>
|
|
@@ -224,7 +224,7 @@ const EventLog = () => {
|
|
|
224
224
|
</h3>
|
|
225
225
|
<div className="max-h-48 space-y-2 overflow-y-auto">
|
|
226
226
|
{logs.length === 0 ? (
|
|
227
|
-
<p className="text-gray-500
|
|
227
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">
|
|
228
228
|
No events yet. Try updating or deleting a foo.
|
|
229
229
|
</p>
|
|
230
230
|
) : (
|
|
@@ -266,12 +266,12 @@ export const ExampleApp = () => {
|
|
|
266
266
|
<div className="space-y-6">
|
|
267
267
|
<div className="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-800">
|
|
268
268
|
<div className="flex items-center justify-between">
|
|
269
|
-
<h2 className="font-semibold text-gray-900
|
|
269
|
+
<h2 className="text-xl font-semibold text-gray-900 dark:text-white">
|
|
270
270
|
Foo List <FooListLength />
|
|
271
271
|
</h2>
|
|
272
272
|
<AddFooButton />
|
|
273
273
|
</div>
|
|
274
|
-
<p className="mt-1 text-gray-600
|
|
274
|
+
<p className="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
275
275
|
Each item is rendered in its own FooProvider with scoped access
|
|
276
276
|
</p>
|
|
277
277
|
</div>
|
|
@@ -465,13 +465,14 @@ export const FooList = ({
|
|
|
465
465
|
## next.config.ts
|
|
466
466
|
|
|
467
467
|
```typescript
|
|
468
|
+
import { withAui } from "@assistant-ui/next";
|
|
468
469
|
import type { NextConfig } from "next";
|
|
469
470
|
|
|
470
471
|
const nextConfig: NextConfig = {
|
|
471
472
|
/* config options here */
|
|
472
473
|
};
|
|
473
474
|
|
|
474
|
-
export default nextConfig;
|
|
475
|
+
export default withAui(nextConfig);
|
|
475
476
|
|
|
476
477
|
```
|
|
477
478
|
|
|
@@ -496,6 +497,7 @@ export default nextConfig;
|
|
|
496
497
|
"react-dom": "^19.2.6"
|
|
497
498
|
},
|
|
498
499
|
"devDependencies": {
|
|
500
|
+
"@assistant-ui/next": "workspace:*",
|
|
499
501
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
500
502
|
"@tailwindcss/postcss": "^4.3.0",
|
|
501
503
|
"@types/node": "^25.9.1",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"@assistant-ui/react": "workspace:*",
|
|
66
66
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
67
67
|
"@tailwindcss/vite": "^4.3.0",
|
|
68
|
-
"@tanstack/react-router": "^1.170.
|
|
69
|
-
"@tanstack/react-start": "^1.168.
|
|
68
|
+
"@tanstack/react-router": "^1.170.10",
|
|
69
|
+
"@tanstack/react-start": "^1.168.18",
|
|
70
70
|
"class-variance-authority": "^0.7.1",
|
|
71
71
|
"clsx": "^2.1.1",
|
|
72
|
-
"lucide-react": "^1.
|
|
72
|
+
"lucide-react": "^1.17.0",
|
|
73
73
|
"nitro": "^3.0.260311-beta",
|
|
74
|
-
"openai": "^6.
|
|
74
|
+
"openai": "^6.39.1",
|
|
75
75
|
"react": "^19.2.6",
|
|
76
76
|
"react-dom": "^19.2.6",
|
|
77
77
|
"remark-gfm": "^4.0.1",
|
|
@@ -303,7 +303,6 @@ export const Route = createRootRoute({
|
|
|
303
303
|
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
304
304
|
return (
|
|
305
305
|
<html lang="en">
|
|
306
|
-
{/* biome-ignore lint/style/noHeadElement: TanStack Start uses standard HTML head */}
|
|
307
306
|
<head>
|
|
308
307
|
<HeadContent />
|
|
309
308
|
</head>
|
|
@@ -556,15 +555,16 @@ export const chatStream = createServerFn({ method: "POST" })
|
|
|
556
555
|
}
|
|
557
556
|
body {
|
|
558
557
|
@apply bg-background text-foreground m-0;
|
|
559
|
-
font-family:
|
|
558
|
+
font-family:
|
|
559
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
|
560
560
|
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
|
561
561
|
sans-serif;
|
|
562
562
|
-webkit-font-smoothing: antialiased;
|
|
563
563
|
-moz-osx-font-smoothing: grayscale;
|
|
564
564
|
}
|
|
565
565
|
code {
|
|
566
|
-
font-family:
|
|
567
|
-
monospace;
|
|
566
|
+
font-family:
|
|
567
|
+
source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
|
|
@@ -737,7 +737,6 @@ export const chatStream = createServerFn({ method: "POST" })
|
|
|
737
737
|
{
|
|
738
738
|
"extends": "@assistant-ui/x-buildutils/ts/base",
|
|
739
739
|
"compilerOptions": {
|
|
740
|
-
"types": ["vite/client"],
|
|
741
740
|
"paths": {
|
|
742
741
|
"@/*": ["./src/*"],
|
|
743
742
|
"@/components/assistant-ui/*": [
|
|
@@ -363,7 +363,7 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
363
363
|
{children}
|
|
364
364
|
|
|
365
365
|
{/* Control panel */}
|
|
366
|
-
<div className="border-t
|
|
366
|
+
<div className="bg-card border-t p-4">
|
|
367
367
|
<div className="mx-auto flex max-w-2xl flex-col gap-2">
|
|
368
368
|
<div className="flex items-center gap-2">
|
|
369
369
|
<span className="text-muted-foreground text-sm">Controls:</span>
|
|
@@ -379,7 +379,7 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
379
379
|
},
|
|
380
380
|
]);
|
|
381
381
|
}}
|
|
382
|
-
className="
|
|
382
|
+
className="bg-primary text-primary-foreground hover:bg-primary/90 rounded-md px-3 py-1 text-sm font-medium"
|
|
383
383
|
>
|
|
384
384
|
Add User Message
|
|
385
385
|
</button>
|
|
@@ -397,21 +397,21 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
397
397
|
},
|
|
398
398
|
]);
|
|
399
399
|
}}
|
|
400
|
-
className="
|
|
400
|
+
className="bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-md px-3 py-1 text-sm font-medium"
|
|
401
401
|
>
|
|
402
402
|
Add Assistant Message
|
|
403
403
|
</button>
|
|
404
404
|
<button
|
|
405
405
|
type="button"
|
|
406
406
|
onClick={() => setIsRunning(!isRunning)}
|
|
407
|
-
className="
|
|
407
|
+
className="bg-accent text-accent-foreground hover:bg-accent/80 rounded-md px-3 py-1 text-sm font-medium"
|
|
408
408
|
>
|
|
409
409
|
{isRunning ? "Stop" : "Start"} Running
|
|
410
410
|
</button>
|
|
411
411
|
<button
|
|
412
412
|
type="button"
|
|
413
413
|
onClick={() => updateCurrentThreadMessages(() => [])}
|
|
414
|
-
className="
|
|
414
|
+
className="bg-destructive hover:bg-destructive/90 rounded-md px-3 py-1 text-sm font-medium text-white"
|
|
415
415
|
>
|
|
416
416
|
Clear
|
|
417
417
|
</button>
|
|
@@ -431,9 +431,9 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
431
431
|
|
|
432
432
|
function ThreadListSidebar() {
|
|
433
433
|
return (
|
|
434
|
-
<ThreadListPrimitive.Root className="flex w-64 flex-col border-r
|
|
434
|
+
<ThreadListPrimitive.Root className="bg-muted/30 flex w-64 flex-col border-r">
|
|
435
435
|
<div className="border-b p-4">
|
|
436
|
-
<h2 className="font-semibold
|
|
436
|
+
<h2 className="text-lg font-semibold">Threads</h2>
|
|
437
437
|
</div>
|
|
438
438
|
|
|
439
439
|
<div className="flex-1 overflow-y-auto p-2">
|
|
@@ -443,7 +443,7 @@ function ThreadListSidebar() {
|
|
|
443
443
|
</div>
|
|
444
444
|
|
|
445
445
|
<div className="border-t p-2">
|
|
446
|
-
<ThreadListPrimitive.New className="w-full rounded-md
|
|
446
|
+
<ThreadListPrimitive.New className="bg-primary text-primary-foreground hover:bg-primary/90 w-full rounded-md px-3 py-2 text-sm font-medium">
|
|
447
447
|
+ New Thread
|
|
448
448
|
</ThreadListPrimitive.New>
|
|
449
449
|
</div>
|
|
@@ -453,7 +453,7 @@ function ThreadListSidebar() {
|
|
|
453
453
|
|
|
454
454
|
function ThreadListItem() {
|
|
455
455
|
return (
|
|
456
|
-
<ThreadListItemPrimitive.Root className="mb-1 w-full rounded-md p-3 text-left transition-colors
|
|
456
|
+
<ThreadListItemPrimitive.Root className="hover:bg-muted data-active:bg-primary data-active:text-primary-foreground mb-1 w-full rounded-md p-3 text-left transition-colors">
|
|
457
457
|
<ThreadListItemPrimitive.Trigger className="w-full text-left">
|
|
458
458
|
<div className="font-medium">
|
|
459
459
|
<ThreadListItemPrimitive.Title fallback="New Thread" />
|
|
@@ -486,8 +486,8 @@ export default function Home() {
|
|
|
486
486
|
|
|
487
487
|
return (
|
|
488
488
|
<div className="flex h-full flex-col">
|
|
489
|
-
<header className="border-b
|
|
490
|
-
<h1 className="font-bold
|
|
489
|
+
<header className="bg-card border-b px-6 py-4">
|
|
490
|
+
<h1 className="text-2xl font-bold">Tap-Native Runtime Example</h1>
|
|
491
491
|
<p className="text-muted-foreground text-sm">
|
|
492
492
|
Built with ExternalThread and InMemoryThreadList
|
|
493
493
|
</p>
|
|
@@ -497,7 +497,7 @@ export default function Home() {
|
|
|
497
497
|
{isEmpty ? (
|
|
498
498
|
<div className="flex h-full items-center justify-center">
|
|
499
499
|
<div className="text-center">
|
|
500
|
-
<h2 className="mb-2 font-semibold
|
|
500
|
+
<h2 className="mb-2 text-xl font-semibold">No messages yet</h2>
|
|
501
501
|
<p className="text-muted-foreground text-sm">
|
|
502
502
|
Use the controls below to add messages
|
|
503
503
|
</p>
|
|
@@ -507,14 +507,14 @@ export default function Home() {
|
|
|
507
507
|
<>
|
|
508
508
|
<Thread />
|
|
509
509
|
<div className="mx-auto mt-4 max-w-2xl space-y-2">
|
|
510
|
-
<div className="rounded-lg border
|
|
511
|
-
<h3 className="mb-2 font-semibold
|
|
510
|
+
<div className="bg-card rounded-lg border p-4">
|
|
511
|
+
<h3 className="mb-2 text-sm font-semibold">
|
|
512
512
|
About This Example
|
|
513
513
|
</h3>
|
|
514
|
-
<ul className="space-y-1 text-
|
|
514
|
+
<ul className="text-muted-foreground space-y-1 text-sm">
|
|
515
515
|
<li>
|
|
516
516
|
• Uses{" "}
|
|
517
|
-
<code className="
|
|
517
|
+
<code className="bg-muted rounded px-1">
|
|
518
518
|
ExternalThread
|
|
519
519
|
</code>{" "}
|
|
520
520
|
to display messages
|
|
@@ -525,7 +525,7 @@ export default function Home() {
|
|
|
525
525
|
</ul>
|
|
526
526
|
</div>
|
|
527
527
|
|
|
528
|
-
<div className="text-
|
|
528
|
+
<div className="text-muted-foreground text-center text-xs">
|
|
529
529
|
This is a minimal implementation. Features like editing,
|
|
530
530
|
branching, and attachments can be added.
|
|
531
531
|
</div>
|
|
@@ -572,13 +572,14 @@ export default function Home() {
|
|
|
572
572
|
## next.config.ts
|
|
573
573
|
|
|
574
574
|
```typescript
|
|
575
|
+
import { withAui } from "@assistant-ui/next";
|
|
575
576
|
import type { NextConfig } from "next";
|
|
576
577
|
|
|
577
578
|
const nextConfig: NextConfig = {
|
|
578
579
|
/* config options here */
|
|
579
580
|
};
|
|
580
581
|
|
|
581
|
-
export default nextConfig;
|
|
582
|
+
export default withAui(nextConfig);
|
|
582
583
|
|
|
583
584
|
```
|
|
584
585
|
|
|
@@ -601,13 +602,14 @@ export default nextConfig;
|
|
|
601
602
|
"@assistant-ui/ui": "workspace:*",
|
|
602
603
|
"class-variance-authority": "^0.7.1",
|
|
603
604
|
"clsx": "^2.1.1",
|
|
604
|
-
"lucide-react": "^1.
|
|
605
|
+
"lucide-react": "^1.17.0",
|
|
605
606
|
"next": "^16.2.6",
|
|
606
607
|
"react": "^19.2.6",
|
|
607
608
|
"react-dom": "^19.2.6",
|
|
608
609
|
"tailwind-merge": "^3.6.0"
|
|
609
610
|
},
|
|
610
611
|
"devDependencies": {
|
|
612
|
+
"@assistant-ui/next": "workspace:*",
|
|
611
613
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
612
614
|
"@tailwindcss/postcss": "^4.3.0",
|
|
613
615
|
"@types/node": "^25.9.1",
|
|
@@ -33,7 +33,26 @@ A React state management context for assistant chat. The runtime handles data co
|
|
|
33
33
|
A hosted service that enhances your assistant experience with comprehensive thread management and message history. Assistant Cloud stores complete message history, automatically persists threads, supports human-in-the-loop workflows, and integrates with common auth providers to seamlessly allow users to resume conversations at any point. [Cloud Docs](/docs/cloud)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
## What each layer owns
|
|
37
|
+
|
|
38
|
+
Before picking a runtime or wiring components, it helps to see which layer owns which responsibility. assistant-ui draws hard lines between rendering, conversation state, and where the model actually runs.
|
|
39
|
+
|
|
40
|
+
### UI layer
|
|
41
|
+
Primitives and prebuilt components render the assistant experience: thread, messages, composer, message parts, actions, attachments, suggestions. They read and write through the runtime context, not directly against the backend or model.
|
|
42
|
+
|
|
43
|
+
### Runtime layer
|
|
44
|
+
The state and behavior boundary between UI and backend. The runtime owns or adapts conversation state: messages, thread state, composer state, run lifecycle, branching, editing, regeneration. Different runtimes exist because different backends own this state differently. `LocalRuntime` keeps state internal; `ExternalStoreRuntime` delegates to your store.
|
|
45
|
+
|
|
46
|
+
### Backend / agent layer
|
|
47
|
+
Produces assistant output and app-specific behavior. Depending on the runtime and protocol, the backend may emit text, message parts, tool calls, metadata, agent state, attachments, or other events that the runtime maps into UI state.
|
|
48
|
+
|
|
49
|
+
### Integration / protocol layer
|
|
50
|
+
Runtime adapters and protocols bridge assistant-ui to different backend shapes: AI SDK, LangGraph, LangChain, ADK, A2A, AG-UI, OpenCode, or your own. The DataStream and AssistantTransport protocols let a generic backend talk to assistant-ui without a custom adapter per app.
|
|
51
|
+
|
|
52
|
+
### Persistence layer
|
|
53
|
+
Thread and message history can be stored by Assistant Cloud or by your own database via thread and history adapters. Persistence is separate from rendering and backend generation, though the runtime coordinates with it.
|
|
54
|
+
|
|
55
|
+
## There are three common ways to architect your assistant-ui application:
|
|
37
56
|
|
|
38
57
|
#### **1. Direct Integration with External Providers**
|
|
39
58
|
|
|
@@ -90,4 +109,26 @@ graph TD
|
|
|
90
109
|
style E fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
|
|
91
110
|
|
|
92
111
|
class A,B,C,D,E default
|
|
93
|
-
```
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Going deeper
|
|
115
|
+
|
|
116
|
+
These pages go one level deeper on runtime internals, adapters, and persistence.
|
|
117
|
+
|
|
118
|
+
<Cards>
|
|
119
|
+
<Card
|
|
120
|
+
title="Runtime architecture"
|
|
121
|
+
description="Core runtimes, protocol layers, and framework adapters — what each layer owns."
|
|
122
|
+
href="/docs/runtimes/concepts/architecture"
|
|
123
|
+
/>
|
|
124
|
+
<Card
|
|
125
|
+
title="Adapters"
|
|
126
|
+
description="Attachments, speech, feedback, history, suggestions across runtimes."
|
|
127
|
+
href="/docs/runtimes/concepts/adapters"
|
|
128
|
+
/>
|
|
129
|
+
<Card
|
|
130
|
+
title="Threads"
|
|
131
|
+
description="Multi-thread support: cloud, custom database, ExternalStore."
|
|
132
|
+
href="/docs/runtimes/concepts/threads"
|
|
133
|
+
/>
|
|
134
|
+
</Cards>
|
|
@@ -72,13 +72,12 @@ Use `--example` to create a project from one of the monorepo examples with full
|
|
|
72
72
|
| `with-ag-ui` | [AG-UI protocol](/docs/runtimes/ag-ui) integration | `npx assistant-ui create my-app -e with-ag-ui` |
|
|
73
73
|
| `with-assistant-transport` | Custom backend via Assistant Transport | `npx assistant-ui create my-app -e with-assistant-transport` |
|
|
74
74
|
| `with-resumable-stream` | Resumable LLM stream that survives reload mid-response | `npx assistant-ui create my-app -e with-resumable-stream` |
|
|
75
|
-
| `with-chain-of-thought` | Chain-of-thought
|
|
75
|
+
| `with-chain-of-thought` | Chain-of-thought reasoning, tool calls, and source citations | `npx assistant-ui create my-app -e with-chain-of-thought` |
|
|
76
76
|
| `with-external-store` | External message store | `npx assistant-ui create my-app -e with-external-store` |
|
|
77
77
|
| `with-custom-thread-list` | Custom thread list UI | `npx assistant-ui create my-app -e with-custom-thread-list` |
|
|
78
78
|
| `with-react-hook-form` | React Hook Form integration | `npx assistant-ui create my-app -e with-react-hook-form` |
|
|
79
79
|
| `with-ffmpeg` | FFmpeg video processing tool | `npx assistant-ui create my-app -e with-ffmpeg` |
|
|
80
80
|
| `with-elevenlabs-scribe` | ElevenLabs voice transcription | `npx assistant-ui create my-app -e with-elevenlabs-scribe` |
|
|
81
|
-
| `with-parent-id-grouping` | Message part grouping | `npx assistant-ui create my-app -e with-parent-id-grouping` |
|
|
82
81
|
| `with-expo` | Expo / React Native | `npx assistant-ui create my-app -e with-expo` |
|
|
83
82
|
| `with-react-ink` | Terminal UI chat | `npx assistant-ui create my-app -e with-react-ink` |
|
|
84
83
|
| `with-react-router` | React Router v7 integration | `npx assistant-ui create my-app -e with-react-router` |
|
|
@@ -38,43 +38,51 @@ const ReadableComponent = makeAssistantVisible(MyComponent);
|
|
|
38
38
|
|
|
39
39
|
Tools are functions that the assistant can use to interact with your application. They can be provided through various mechanisms:
|
|
40
40
|
|
|
41
|
-
```tsx
|
|
41
|
+
```tsx title="app/form-toolkit.tsx"
|
|
42
|
+
"use generative";
|
|
43
|
+
|
|
44
|
+
import { defineToolkit } from "@assistant-ui/react";
|
|
45
|
+
import { z } from "zod";
|
|
46
|
+
|
|
47
|
+
export default defineToolkit({
|
|
48
|
+
submitForm: {
|
|
49
|
+
description: "Submit the form with the user's details.",
|
|
50
|
+
parameters: z.object({
|
|
51
|
+
email: z.string().email(),
|
|
52
|
+
name: z.string(),
|
|
53
|
+
}),
|
|
54
|
+
execute: async ({ email, name }) => {
|
|
55
|
+
"use client";
|
|
56
|
+
// Implementation
|
|
57
|
+
return { success: true };
|
|
58
|
+
},
|
|
59
|
+
renderText: { running: "Submitting…", complete: "Submitted" },
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```tsx title="app/Form.tsx"
|
|
42
65
|
import {
|
|
66
|
+
AuiProvider,
|
|
43
67
|
makeAssistantVisible,
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
Tools,
|
|
69
|
+
useAui,
|
|
46
70
|
} from "@assistant-ui/react";
|
|
47
|
-
import
|
|
71
|
+
import toolkit from "./form-toolkit";
|
|
48
72
|
|
|
49
73
|
// Via makeAssistantVisible's clickable option
|
|
50
74
|
const ClickableButton = makeAssistantVisible(Button, {
|
|
51
75
|
clickable: true, // Provides a click tool
|
|
52
76
|
});
|
|
53
77
|
|
|
54
|
-
// Via makeAssistantTool
|
|
55
|
-
const submitForm = tool({
|
|
56
|
-
parameters: z.object({
|
|
57
|
-
email: z.string().email(),
|
|
58
|
-
name: z.string(),
|
|
59
|
-
}),
|
|
60
|
-
execute: async ({ email, name }) => {
|
|
61
|
-
// Implementation
|
|
62
|
-
return { success: true };
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const SubmitFormTool = makeAssistantTool({
|
|
67
|
-
...submitForm,
|
|
68
|
-
toolName: "submitForm"
|
|
69
|
-
});
|
|
70
|
-
|
|
71
78
|
// Use in your component
|
|
72
79
|
function Form() {
|
|
80
|
+
const aui = useAui({ tools: Tools({ toolkit }) });
|
|
81
|
+
|
|
73
82
|
return (
|
|
74
|
-
<
|
|
83
|
+
<AuiProvider value={aui}>
|
|
75
84
|
<form>{/* form fields */}</form>
|
|
76
|
-
|
|
77
|
-
</div>
|
|
85
|
+
</AuiProvider>
|
|
78
86
|
);
|
|
79
87
|
}
|
|
80
88
|
```
|
|
@@ -134,8 +142,8 @@ Multiple providers can be registered, and their contexts will be composed:
|
|
|
134
142
|
|
|
135
143
|
2. **Tools**
|
|
136
144
|
|
|
137
|
-
- Use
|
|
138
|
-
- Prefer
|
|
145
|
+
- Use toolkit entries to define tool schemas and behavior
|
|
146
|
+
- Prefer `Tools({ toolkit })` for reusable tools
|
|
139
147
|
- Handle errors gracefully
|
|
140
148
|
- Consider async operations and loading states
|
|
141
149
|
- Use the built-in click tool when possible
|
|
@@ -98,44 +98,50 @@ function SmartTransactionHistory() {
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
### 3. Creating Tools
|
|
101
|
+
### 3. Creating Tools
|
|
102
102
|
|
|
103
103
|
Let's add transaction-specific tools for the assistant:
|
|
104
104
|
|
|
105
|
-
```tsx
|
|
106
|
-
|
|
105
|
+
```tsx title="app/transaction-toolkit.tsx"
|
|
106
|
+
"use generative";
|
|
107
|
+
|
|
108
|
+
import { defineToolkit } from "@assistant-ui/react";
|
|
107
109
|
import { z } from "zod";
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
export default defineToolkit({
|
|
112
|
+
analyzeTransaction: {
|
|
113
|
+
description: "Analyze a transaction's risk and refund eligibility.",
|
|
114
|
+
parameters: z.object({
|
|
115
|
+
transactionId: z.string(),
|
|
116
|
+
merchantName: z.string(),
|
|
117
|
+
}),
|
|
118
|
+
execute: async ({ transactionId, merchantName }) => {
|
|
119
|
+
"use client";
|
|
120
|
+
// Analyze transaction patterns, merchant reputation, etc.
|
|
121
|
+
return {
|
|
122
|
+
isSuspicious: false,
|
|
123
|
+
merchantRating: 4.5,
|
|
124
|
+
similarTransactions: 3,
|
|
125
|
+
refundEligible: true,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
renderText: { running: "Analyzing transaction…", complete: "Analysis ready" },
|
|
123
129
|
},
|
|
124
130
|
});
|
|
131
|
+
```
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
toolName: "analyzeTransaction",
|
|
130
|
-
});
|
|
133
|
+
```tsx title="app/SmartTransactionHistory.tsx"
|
|
134
|
+
import { AuiProvider, Tools, useAui } from "@assistant-ui/react";
|
|
135
|
+
import toolkit from "./transaction-toolkit";
|
|
131
136
|
|
|
132
137
|
function SmartTransactionHistory() {
|
|
138
|
+
const aui = useAui({ tools: Tools({ toolkit }) });
|
|
139
|
+
|
|
133
140
|
// Previous instructions...
|
|
134
141
|
return (
|
|
135
|
-
|
|
142
|
+
<AuiProvider value={aui}>
|
|
136
143
|
<TransactionHistory transactions={transactions} />
|
|
137
|
-
|
|
138
|
-
</>
|
|
144
|
+
</AuiProvider>
|
|
139
145
|
);
|
|
140
146
|
}
|
|
141
147
|
```
|
|
@@ -191,6 +197,6 @@ This creates a more intuitive and safer banking experience while maintaining the
|
|
|
191
197
|
Learn more about each API:
|
|
192
198
|
|
|
193
199
|
- [makeAssistantVisible](make-assistant-visible) for component understanding
|
|
194
|
-
- [
|
|
200
|
+
- [Tools](/docs/tools/defining-tools) for transaction analysis
|
|
195
201
|
- [useAssistantInstructions](use-assistant-instructions) for behavior guidance
|
|
196
202
|
- [Model Context](model-context) for dynamic context management
|
|
@@ -3,7 +3,7 @@ title: Persistence Adapters
|
|
|
3
3
|
description: Persistence adapters for saving assistant-ui message history, remote thread lists, and long-running chat sessions across browser reloads.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { GenericThreadHistoryAdapter, InMemoryThreadListAdapter, MessageFormatAdapter, RemoteThreadListAdapter, ThreadHistoryAdapter } from "@/generated/typeDocs";
|
|
6
|
+
import { ExportedMessageRepository, GenericThreadHistoryAdapter, InMemoryThreadListAdapter, MessageFormatAdapter, RemoteThreadListAdapter, ThreadHistoryAdapter } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -14,6 +14,10 @@ import { GenericThreadHistoryAdapter, InMemoryThreadListAdapter, MessageFormatAd
|
|
|
14
14
|
|
|
15
15
|
## API Reference
|
|
16
16
|
|
|
17
|
+
### ExportedMessageRepository
|
|
18
|
+
|
|
19
|
+
<ParametersTable {...ExportedMessageRepository} />
|
|
20
|
+
|
|
17
21
|
### GenericThreadHistoryAdapter
|
|
18
22
|
|
|
19
23
|
<ParametersTable {...GenericThreadHistoryAdapter} />
|