@assistant-ui/mcp-docs-server 0.2.0 → 0.2.1
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 +12 -13
- package/.docs/organized/code-examples/with-a2a.md +16 -11
- package/.docs/organized/code-examples/with-ag-ui.md +14 -12
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +13 -12
- package/.docs/organized/code-examples/with-artifacts.md +13 -12
- package/.docs/organized/code-examples/with-assistant-transport.md +19 -27
- package/.docs/organized/code-examples/with-browser-extension.md +17 -10
- package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +9 -10
- package/.docs/organized/code-examples/with-cloud.md +18 -13
- package/.docs/organized/code-examples/with-custom-thread-list.md +13 -12
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +13 -13
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +17 -15
- package/.docs/organized/code-examples/with-eve.md +65 -11
- package/.docs/organized/code-examples/with-expo.md +20 -19
- package/.docs/organized/code-examples/with-external-store.md +16 -11
- package/.docs/organized/code-examples/with-ffmpeg.md +20 -14
- package/.docs/organized/code-examples/with-generative-ui.md +16 -17
- package/.docs/organized/code-examples/with-google-adk.md +17 -12
- package/.docs/organized/code-examples/with-heat-graph.md +6 -7
- package/.docs/organized/code-examples/with-image-generation.md +9 -10
- package/.docs/organized/code-examples/with-interactables.md +13 -12
- package/.docs/organized/code-examples/with-langchain.md +7 -8
- package/.docs/organized/code-examples/with-langgraph.md +17 -11
- package/.docs/organized/code-examples/with-livekit.md +12 -12
- package/.docs/organized/code-examples/with-mcp.md +13 -14
- package/.docs/organized/code-examples/with-nuxt.md +2492 -0
- package/.docs/organized/code-examples/with-opencode.md +23 -14
- package/.docs/organized/code-examples/with-pi.md +59 -57
- package/.docs/organized/code-examples/with-react-hook-form.md +14 -13
- package/.docs/organized/code-examples/with-react-ink-web.md +7 -8
- package/.docs/organized/code-examples/with-react-ink.md +5 -5
- package/.docs/organized/code-examples/with-react-router.md +15 -9
- package/.docs/organized/code-examples/with-resumable-stream.md +11 -12
- package/.docs/organized/code-examples/with-store.md +27 -16
- package/.docs/organized/code-examples/with-tanstack.md +18 -12
- package/.docs/organized/code-examples/with-tap-runtime.md +15 -15
- package/.docs/organized/code-examples/with-virtualized-thread.md +8 -9
- package/.docs/organized/code-examples/with-vue.md +408 -0
- package/.docs/raw/docs/(docs)/cli.mdx +1 -1
- package/.docs/raw/docs/(docs)/index.mdx +9 -76
- package/.docs/raw/docs/(docs)/installation.mdx +4 -18
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +8 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +24 -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/copilots/model-context.mdx +4 -3
- package/.docs/raw/docs/copilots/motivation.mdx +4 -4
- package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +74 -3
- package/.docs/raw/docs/guides/suggestions.mdx +9 -9
- package/.docs/raw/docs/ink/hooks.mdx +9 -4
- package/.docs/raw/docs/ink/primitives.mdx +4 -3
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +16 -0
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/clerk.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/gateways/index.mdx +2 -2
- package/.docs/raw/docs/integrations/observability/helicone.mdx +2 -2
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +1 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +2 -2
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +15 -13
- package/.docs/raw/docs/migrations/v0-15.mdx +84 -4
- package/.docs/raw/docs/primitives/attachment.mdx +2 -2
- package/.docs/raw/docs/primitives/composer.mdx +2 -2
- package/.docs/raw/docs/primitives/message.mdx +33 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +1 -1
- package/.docs/raw/docs/react-native/hooks.mdx +14 -4
- package/.docs/raw/docs/react-native/index.mdx +1 -1
- package/.docs/raw/docs/react-native/primitives.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v6-legacy.mdx +9 -10
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +9 -10
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +40 -1
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +18 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +30 -1
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +36 -9
- package/.docs/raw/docs/runtimes/eve/overview.mdx +51 -0
- package/.docs/raw/docs/runtimes/eve/quickstart.mdx +51 -2
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -12
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -7
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +4 -4
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +1 -0
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +10 -0
- package/.docs/raw/docs/tools/backend.mdx +2 -2
- package/.docs/raw/docs/tools/defining-tools.mdx +9 -7
- package/.docs/raw/docs/tools/dynamic-tools.mdx +6 -4
- package/.docs/raw/docs/tools/interactables-legacy.mdx +24 -11
- package/.docs/raw/docs/tools/interactables.mdx +24 -13
- package/.docs/raw/docs/tools/mcp-apps.mdx +35 -6
- package/.docs/raw/docs/tools/mcp.mdx +9 -7
- package/.docs/raw/docs/tools/tool-ui.mdx +26 -22
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +12 -7
- package/.docs/raw/docs/ui/file.mdx +6 -1
- package/.docs/raw/docs/ui/mcp-config.mdx +8 -3
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/thread.mdx +24 -5
- package/.docs/raw/docs/utilities/react-o11y.mdx +7 -9
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/tools/docs.js +4 -2
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.js +2 -1
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/resources.js +2 -1
- package/dist/tools/resources.js.map +1 -1
- package/dist/tools/tests/test-setup.js +2 -1
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/tools/xulux-templates.js +4 -2
- package/dist/tools/xulux-templates.js.map +1 -1
- package/dist/utils/mdx.js +2 -1
- package/dist/utils/mdx.js.map +1 -1
- package/dist/xulux/catalog-client.js +1 -1
- package/dist/xulux/catalog-client.js.map +1 -1
- package/package.json +4 -4
- package/src/tools/tests/docs.test.ts +2 -2
|
@@ -165,8 +165,8 @@ export default function RootLayout({
|
|
|
165
165
|
|
|
166
166
|
import { useState } from "react";
|
|
167
167
|
import {
|
|
168
|
-
useAui,
|
|
169
168
|
AuiProvider,
|
|
169
|
+
AuiConfig,
|
|
170
170
|
useAuiState,
|
|
171
171
|
ExternalThread,
|
|
172
172
|
InMemoryThreadList,
|
|
@@ -214,7 +214,7 @@ const SIMPLE_MESSAGES: SimpleMessage[] = [
|
|
|
214
214
|
id: "4",
|
|
215
215
|
role: "assistant",
|
|
216
216
|
content:
|
|
217
|
-
'Sure! Here\'s how to use the tap-native runtime:\n\n```typescript\nconst messages = [\n { id: "1", role: "user", content: [{ type: "text", text: "Hello!" }] }\n];\n\nconst
|
|
217
|
+
'Sure! Here\'s how to use the tap-native runtime:\n\n```typescript\nconst messages = [\n { id: "1", role: "user", content: [{ type: "text", text: "Hello!" }] }\n];\n\nconst config = AuiConfig({\n threads: InMemoryThreadList({\n thread: (threadId) => ExternalThread({ messages, isRunning: false })\n })\n});\n\n<AuiProvider config={config}>{children}</AuiProvider>\n```\n\nTry using the thread list on the left to create and switch between threads!',
|
|
218
218
|
status: { type: "complete", reason: "stop" },
|
|
219
219
|
},
|
|
220
220
|
];
|
|
@@ -255,7 +255,7 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
255
255
|
isRunning,
|
|
256
256
|
}) as ExternalThreadMessage[];
|
|
257
257
|
|
|
258
|
-
const
|
|
258
|
+
const config = AuiConfig({
|
|
259
259
|
threads: InMemoryThreadList({
|
|
260
260
|
thread: (threadId) =>
|
|
261
261
|
ExternalThread({
|
|
@@ -353,7 +353,7 @@ export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
|
353
353
|
});
|
|
354
354
|
|
|
355
355
|
return (
|
|
356
|
-
<AuiProvider
|
|
356
|
+
<AuiProvider config={config}>
|
|
357
357
|
<div className="flex h-full">
|
|
358
358
|
{/* Thread List Sidebar */}
|
|
359
359
|
<ThreadListSidebar />
|
|
@@ -600,8 +600,8 @@ 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.
|
|
604
|
-
"next": "^16.
|
|
603
|
+
"lucide-react": "^1.29.0",
|
|
604
|
+
"next": "^16.3.0",
|
|
605
605
|
"react": "^19.2.8",
|
|
606
606
|
"react-dom": "^19.2.8",
|
|
607
607
|
"tailwind-merge": "^3.6.0"
|
|
@@ -610,14 +610,13 @@ 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.1.
|
|
614
|
-
"@types/react": "^19.2.
|
|
615
|
-
"@types/react-dom": "^19.2.
|
|
616
|
-
"postcss": "^8.5.
|
|
613
|
+
"@types/node": "^26.1.2",
|
|
614
|
+
"@types/react": "^19.2.18",
|
|
615
|
+
"@types/react-dom": "^19.2.4",
|
|
616
|
+
"postcss": "^8.5.26",
|
|
617
617
|
"tailwindcss": "^4.3.3",
|
|
618
618
|
"tw-animate-css": "^1.4.0",
|
|
619
|
-
"typescript": "
|
|
620
|
-
"typescript-7": "npm:typescript@^7.0.2"
|
|
619
|
+
"typescript": "^7.0.2"
|
|
621
620
|
}
|
|
622
621
|
}
|
|
623
622
|
|
|
@@ -672,10 +671,10 @@ const messages: ExternalThreadMessage[] = [
|
|
|
672
671
|
];
|
|
673
672
|
```
|
|
674
673
|
|
|
675
|
-
### 2. Create
|
|
674
|
+
### 2. Create Config
|
|
676
675
|
|
|
677
676
|
```typescript
|
|
678
|
-
const
|
|
677
|
+
const config = AuiConfig({
|
|
679
678
|
threads: InMemoryThreadList({
|
|
680
679
|
thread: () => ExternalThread({ messages, isRunning: false }),
|
|
681
680
|
}),
|
|
@@ -685,7 +684,7 @@ const aui = useAui({
|
|
|
685
684
|
### 3. Provide to App
|
|
686
685
|
|
|
687
686
|
```typescript
|
|
688
|
-
<AuiProvider
|
|
687
|
+
<AuiProvider config={config}>
|
|
689
688
|
<Thread.Root>
|
|
690
689
|
<Thread.Messages />
|
|
691
690
|
</Thread.Root>
|
|
@@ -795,6 +794,7 @@ You can extend this example to:
|
|
|
795
794
|
],
|
|
796
795
|
"@/lib/utils": ["../../packages/ui/src/lib/utils"],
|
|
797
796
|
"@assistant-ui/ui/*": ["../../packages/ui/src/*"],
|
|
797
|
+
"@assistant-ui/store/client": ["../../packages/store/src/client"],
|
|
798
798
|
"@assistant-ui/*": ["../../packages/*/src"],
|
|
799
799
|
"@assistant-ui/core/*": ["../../packages/core/src/*"],
|
|
800
800
|
"@assistant-ui/react/*": ["../../packages/react/src/*"],
|
|
@@ -597,11 +597,11 @@ export default withAui(nextConfig);
|
|
|
597
597
|
"@assistant-ui/react": "workspace:*",
|
|
598
598
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
599
599
|
"@assistant-ui/ui": "workspace:*",
|
|
600
|
-
"@tanstack/react-virtual": "^3.14.
|
|
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.
|
|
604
|
-
"next": "^16.
|
|
603
|
+
"lucide-react": "^1.29.0",
|
|
604
|
+
"next": "^16.3.0",
|
|
605
605
|
"react": "^19.2.8",
|
|
606
606
|
"react-dom": "^19.2.8",
|
|
607
607
|
"tailwind-merge": "^3.6.0"
|
|
@@ -610,14 +610,13 @@ 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.1.
|
|
614
|
-
"@types/react": "^19.2.
|
|
615
|
-
"@types/react-dom": "^19.2.
|
|
616
|
-
"postcss": "^8.5.
|
|
613
|
+
"@types/node": "^26.1.2",
|
|
614
|
+
"@types/react": "^19.2.18",
|
|
615
|
+
"@types/react-dom": "^19.2.4",
|
|
616
|
+
"postcss": "^8.5.26",
|
|
617
617
|
"tailwindcss": "^4.3.3",
|
|
618
618
|
"tw-animate-css": "^1.4.0",
|
|
619
|
-
"typescript": "
|
|
620
|
-
"typescript-7": "npm:typescript@^7.0.2"
|
|
619
|
+
"typescript": "^7.0.2"
|
|
621
620
|
}
|
|
622
621
|
}
|
|
623
622
|
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# Example: with-vue
|
|
2
|
+
|
|
3
|
+
## package.json
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"name": "with-vue",
|
|
8
|
+
"version": "0.0.0",
|
|
9
|
+
"private": true,
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite dev --port 3000",
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"serve": "vite preview"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@assistant-ui/core": "workspace:*",
|
|
18
|
+
"@assistant-ui/store": "workspace:*",
|
|
19
|
+
"@assistant-ui/tap": "workspace:*",
|
|
20
|
+
"@assistant-ui/vue": "workspace:*",
|
|
21
|
+
"@lucide/vue": "^1.29.0",
|
|
22
|
+
"vue": "^3.5.41"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
26
|
+
"@types/react": "^19.2.18",
|
|
27
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
28
|
+
"tailwindcss": "^4.3.3",
|
|
29
|
+
"typescript": "^7.0.2",
|
|
30
|
+
"vite": "^8.2.1"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## src/env.d.ts
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
declare module "*.vue" {
|
|
40
|
+
import type { DefineComponent } from "vue";
|
|
41
|
+
const component: DefineComponent<
|
|
42
|
+
Record<string, never>,
|
|
43
|
+
Record<string, never>,
|
|
44
|
+
unknown
|
|
45
|
+
>;
|
|
46
|
+
export default component;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## src/main.ts
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { createApp } from "vue";
|
|
55
|
+
import "./styles.css";
|
|
56
|
+
import Root from "./Root.vue";
|
|
57
|
+
|
|
58
|
+
createApp(Root).mount("#app");
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## src/runtime.ts
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import type { AppendMessage, ExternalStoreAdapter } from "@assistant-ui/core";
|
|
66
|
+
import {
|
|
67
|
+
AssistantRuntimeImpl,
|
|
68
|
+
ExternalStoreRuntimeCore,
|
|
69
|
+
} from "@assistant-ui/core/internal";
|
|
70
|
+
|
|
71
|
+
export type EchoMessage = {
|
|
72
|
+
id: string;
|
|
73
|
+
role: "user" | "assistant";
|
|
74
|
+
text: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type EchoThread = {
|
|
78
|
+
id: string;
|
|
79
|
+
title: string;
|
|
80
|
+
messages: EchoMessage[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
let nextId = 0;
|
|
84
|
+
const freshId = (prefix: string) => `${prefix}-${nextId++}`;
|
|
85
|
+
|
|
86
|
+
const messageText = (message: AppendMessage) =>
|
|
87
|
+
message.content
|
|
88
|
+
.map((part) => (part.type === "text" ? part.text : ""))
|
|
89
|
+
.join("");
|
|
90
|
+
|
|
91
|
+
const convertEchoMessage = (message: EchoMessage) => ({
|
|
92
|
+
id: message.id,
|
|
93
|
+
role: message.role,
|
|
94
|
+
content: [{ type: "text" as const, text: message.text }],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const createEchoRuntime = () => {
|
|
98
|
+
let threads: EchoThread[] = [
|
|
99
|
+
{ id: freshId("thread"), title: "", messages: [] },
|
|
100
|
+
];
|
|
101
|
+
let currentId = threads[0]!.id;
|
|
102
|
+
let isRunning = false;
|
|
103
|
+
let replyTimer: ReturnType<typeof setTimeout> | undefined;
|
|
104
|
+
|
|
105
|
+
const current = () => threads.find((thread) => thread.id === currentId)!;
|
|
106
|
+
const updateCurrent = (updater: (thread: EchoThread) => EchoThread) => {
|
|
107
|
+
threads = threads.map((thread) =>
|
|
108
|
+
thread.id === currentId ? updater(thread) : thread,
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const reply = (text: string) => {
|
|
113
|
+
const replyTo = currentId;
|
|
114
|
+
isRunning = true;
|
|
115
|
+
sync();
|
|
116
|
+
replyTimer = setTimeout(() => {
|
|
117
|
+
if (currentId !== replyTo) return;
|
|
118
|
+
updateCurrent((thread) => ({
|
|
119
|
+
...thread,
|
|
120
|
+
messages: [
|
|
121
|
+
...thread.messages,
|
|
122
|
+
{
|
|
123
|
+
id: freshId("assistant"),
|
|
124
|
+
role: "assistant",
|
|
125
|
+
text: `Echo: ${text}`,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
}));
|
|
129
|
+
isRunning = false;
|
|
130
|
+
sync();
|
|
131
|
+
}, 600);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const appendUser = (text: string) => {
|
|
135
|
+
updateCurrent((thread) => ({
|
|
136
|
+
...thread,
|
|
137
|
+
title: thread.title || text.slice(0, 40),
|
|
138
|
+
messages: [
|
|
139
|
+
...thread.messages,
|
|
140
|
+
{ id: freshId("user"), role: "user", text },
|
|
141
|
+
],
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const makeAdapter = (): ExternalStoreAdapter<EchoMessage> => ({
|
|
146
|
+
messages: current().messages,
|
|
147
|
+
isRunning,
|
|
148
|
+
convertMessage: convertEchoMessage,
|
|
149
|
+
setMessages: (next) => {
|
|
150
|
+
updateCurrent((thread) => ({ ...thread, messages: next }));
|
|
151
|
+
sync();
|
|
152
|
+
},
|
|
153
|
+
onNew: async (message) => {
|
|
154
|
+
const text = messageText(message);
|
|
155
|
+
appendUser(text);
|
|
156
|
+
reply(text);
|
|
157
|
+
},
|
|
158
|
+
onEdit: async (message) => {
|
|
159
|
+
const text = messageText(message);
|
|
160
|
+
const parentIndex = message.parentId
|
|
161
|
+
? current().messages.findIndex(
|
|
162
|
+
(entry) => entry.id === message.parentId,
|
|
163
|
+
) + 1
|
|
164
|
+
: 0;
|
|
165
|
+
updateCurrent((thread) => ({
|
|
166
|
+
...thread,
|
|
167
|
+
messages: thread.messages.slice(0, parentIndex),
|
|
168
|
+
}));
|
|
169
|
+
appendUser(text);
|
|
170
|
+
reply(text);
|
|
171
|
+
},
|
|
172
|
+
onReload: async (parentId) => {
|
|
173
|
+
let parentIndex = 0;
|
|
174
|
+
if (parentId) {
|
|
175
|
+
const index = current().messages.findIndex(
|
|
176
|
+
(entry) => entry.id === parentId,
|
|
177
|
+
);
|
|
178
|
+
if (index === -1) return;
|
|
179
|
+
parentIndex = index + 1;
|
|
180
|
+
}
|
|
181
|
+
const sliced = current().messages.slice(0, parentIndex);
|
|
182
|
+
const lastUser = [...sliced]
|
|
183
|
+
.reverse()
|
|
184
|
+
.find((entry) => entry.role === "user");
|
|
185
|
+
updateCurrent((thread) => ({ ...thread, messages: sliced }));
|
|
186
|
+
reply(`${lastUser?.text ?? ""} (again)`);
|
|
187
|
+
},
|
|
188
|
+
onCancel: async () => {
|
|
189
|
+
clearTimeout(replyTimer);
|
|
190
|
+
if (isRunning && current().messages.at(-1)?.role === "user") {
|
|
191
|
+
updateCurrent((thread) => ({
|
|
192
|
+
...thread,
|
|
193
|
+
messages: thread.messages.slice(0, -1),
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
isRunning = false;
|
|
197
|
+
// cancelRun restores the trailing user message into the composer
|
|
198
|
+
// synchronously after onCancel returns; an eager sync would delete it
|
|
199
|
+
// before that restore reads it.
|
|
200
|
+
queueMicrotask(sync);
|
|
201
|
+
},
|
|
202
|
+
adapters: {
|
|
203
|
+
threadList: {
|
|
204
|
+
threadId: currentId,
|
|
205
|
+
threads: threads.map((thread) => ({
|
|
206
|
+
status: "regular" as const,
|
|
207
|
+
id: thread.id,
|
|
208
|
+
title: thread.title,
|
|
209
|
+
})),
|
|
210
|
+
onSwitchToThread: (threadId) => {
|
|
211
|
+
clearTimeout(replyTimer);
|
|
212
|
+
isRunning = false;
|
|
213
|
+
currentId = threadId;
|
|
214
|
+
sync();
|
|
215
|
+
},
|
|
216
|
+
onSwitchToNewThread: () => {
|
|
217
|
+
clearTimeout(replyTimer);
|
|
218
|
+
isRunning = false;
|
|
219
|
+
const id = freshId("thread");
|
|
220
|
+
threads = [...threads, { id, title: "", messages: [] }];
|
|
221
|
+
currentId = id;
|
|
222
|
+
sync();
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const core = new ExternalStoreRuntimeCore(makeAdapter());
|
|
229
|
+
const sync = () => core.setAdapter(makeAdapter());
|
|
230
|
+
return new AssistantRuntimeImpl(core);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## src/styles.css
|
|
236
|
+
|
|
237
|
+
```css
|
|
238
|
+
@import "tailwindcss";
|
|
239
|
+
|
|
240
|
+
@custom-variant dark (&:is(.dark *));
|
|
241
|
+
|
|
242
|
+
@theme inline {
|
|
243
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
244
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
245
|
+
--radius-lg: var(--radius);
|
|
246
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
247
|
+
--color-background: var(--background);
|
|
248
|
+
--color-foreground: var(--foreground);
|
|
249
|
+
--color-card: var(--card);
|
|
250
|
+
--color-card-foreground: var(--card-foreground);
|
|
251
|
+
--color-popover: var(--popover);
|
|
252
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
253
|
+
--color-primary: var(--primary);
|
|
254
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
255
|
+
--color-secondary: var(--secondary);
|
|
256
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
257
|
+
--color-muted: var(--muted);
|
|
258
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
259
|
+
--color-accent: var(--accent);
|
|
260
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
261
|
+
--color-destructive: var(--destructive);
|
|
262
|
+
--color-border: var(--border);
|
|
263
|
+
--color-input: var(--input);
|
|
264
|
+
--color-ring: var(--ring);
|
|
265
|
+
--color-chart-1: var(--chart-1);
|
|
266
|
+
--color-chart-2: var(--chart-2);
|
|
267
|
+
--color-chart-3: var(--chart-3);
|
|
268
|
+
--color-chart-4: var(--chart-4);
|
|
269
|
+
--color-chart-5: var(--chart-5);
|
|
270
|
+
--color-sidebar: var(--sidebar);
|
|
271
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
272
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
273
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
274
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
275
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
276
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
277
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:root {
|
|
281
|
+
--radius: 0.625rem;
|
|
282
|
+
--background: oklch(1 0 0);
|
|
283
|
+
--foreground: oklch(0.141 0.005 285.823);
|
|
284
|
+
--card: oklch(1 0 0);
|
|
285
|
+
--card-foreground: oklch(0.141 0.005 285.823);
|
|
286
|
+
--popover: oklch(1 0 0);
|
|
287
|
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
|
288
|
+
--primary: oklch(0.21 0.006 285.885);
|
|
289
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
290
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
291
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
292
|
+
--muted: oklch(0.967 0.001 286.375);
|
|
293
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
294
|
+
--accent: oklch(0.967 0.001 286.375);
|
|
295
|
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
|
296
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
297
|
+
--border: oklch(0.92 0.004 286.32);
|
|
298
|
+
--input: oklch(0.92 0.004 286.32);
|
|
299
|
+
--ring: oklch(0.705 0.015 286.067);
|
|
300
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
301
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
302
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
303
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
304
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
305
|
+
--sidebar: oklch(0.985 0 0);
|
|
306
|
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
307
|
+
--sidebar-primary: oklch(0.21 0.006 285.885);
|
|
308
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
309
|
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
|
310
|
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
311
|
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
312
|
+
--sidebar-ring: oklch(0.705 0.015 286.067);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.dark {
|
|
316
|
+
--background: oklch(0.141 0.005 285.823);
|
|
317
|
+
--foreground: oklch(0.985 0 0);
|
|
318
|
+
--card: oklch(0.21 0.006 285.885);
|
|
319
|
+
--card-foreground: oklch(0.985 0 0);
|
|
320
|
+
--popover: oklch(0.21 0.006 285.885);
|
|
321
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
322
|
+
--primary: oklch(0.92 0.004 286.32);
|
|
323
|
+
--primary-foreground: oklch(0.21 0.006 285.885);
|
|
324
|
+
--secondary: oklch(0.274 0.006 286.033);
|
|
325
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
326
|
+
--muted: oklch(0.274 0.006 286.033);
|
|
327
|
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
|
328
|
+
--accent: oklch(0.274 0.006 286.033);
|
|
329
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
330
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
331
|
+
--border: oklch(1 0 0 / 10%);
|
|
332
|
+
--input: oklch(1 0 0 / 15%);
|
|
333
|
+
--ring: oklch(0.552 0.016 285.938);
|
|
334
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
335
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
336
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
337
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
338
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
339
|
+
--sidebar: oklch(0.21 0.006 285.885);
|
|
340
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
341
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
342
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
343
|
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
|
344
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
345
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
346
|
+
--sidebar-ring: oklch(0.552 0.016 285.938);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@layer base {
|
|
350
|
+
* {
|
|
351
|
+
@apply border-border outline-ring/50;
|
|
352
|
+
}
|
|
353
|
+
body {
|
|
354
|
+
@apply bg-background text-foreground;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
html,
|
|
359
|
+
body,
|
|
360
|
+
#app {
|
|
361
|
+
height: 100%;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## tsconfig.json
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"compilerOptions": {
|
|
371
|
+
"target": "ES2022",
|
|
372
|
+
"module": "ESNext",
|
|
373
|
+
"moduleResolution": "bundler",
|
|
374
|
+
"strict": true,
|
|
375
|
+
"noEmit": true,
|
|
376
|
+
"skipLibCheck": true,
|
|
377
|
+
"types": ["vite/client"]
|
|
378
|
+
},
|
|
379
|
+
"include": ["src", "vite.config.ts"]
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## vite.config.ts
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
import { defineConfig } from "vite";
|
|
388
|
+
import vue from "@vitejs/plugin-vue";
|
|
389
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
390
|
+
|
|
391
|
+
// The assistant-ui runtime is written against react hook imports but runs on
|
|
392
|
+
// @assistant-ui/tap; aliasing react to the standalone shim resolves it with
|
|
393
|
+
// no React installed.
|
|
394
|
+
export default defineConfig({
|
|
395
|
+
plugins: [vue(), tailwindcss()],
|
|
396
|
+
resolve: {
|
|
397
|
+
alias: [
|
|
398
|
+
{
|
|
399
|
+
find: /^react\/compiler-runtime$/,
|
|
400
|
+
replacement: "@assistant-ui/tap/standalone-shim/compiler-runtime",
|
|
401
|
+
},
|
|
402
|
+
{ find: /^react$/, replacement: "@assistant-ui/tap/standalone-shim" },
|
|
403
|
+
],
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
|
|
@@ -57,7 +57,7 @@ This command scaffolds a project from assistant-ui starter templates or examples
|
|
|
57
57
|
| `cloud` | Cloud-backed persistence starter | `npx assistant-ui create -t cloud` |
|
|
58
58
|
| `cloud-clerk` | Cloud-backed starter with Clerk auth | `npx assistant-ui create -t cloud-clerk` |
|
|
59
59
|
| `langchain` | LangGraph starter with the react-langchain adapter | `npx assistant-ui create -t langchain` |
|
|
60
|
-
| `mcp` | MCP starter
|
|
60
|
+
| `mcp` | MCP tools + MCP Apps renderer starter | `npx assistant-ui create -t mcp` |
|
|
61
61
|
| `eve` | Eve agent + Next.js starter | `npx assistant-ui create -t eve` |
|
|
62
62
|
|
|
63
63
|
**Available Examples**
|
|
@@ -1,88 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Documentation
|
|
3
|
-
description:
|
|
3
|
+
description: Components, runtimes, and primitives for building AI chat interfaces in React, React Native, and the terminal.
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<Quickstart />
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## One library, any interface
|
|
10
10
|
|
|
11
|
-
<
|
|
12
|
-
Already using the AI SDK with your own UI? Add [cloud persistence with just one hook](/docs/cloud/ai-sdk), no UI library required.
|
|
13
|
-
</Callout>
|
|
11
|
+
<DemoShowcase />
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Bring your own backend
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
<Card icon={<PanelsTopLeft className="text-purple-300" />} title="Instant Chat UI">
|
|
19
|
-
Pre-built beautiful, customizable chat interfaces out of the box. Easy to quickly iterate on your idea.
|
|
20
|
-
</Card>
|
|
15
|
+
A runtime connects these components to your AI backend. Pick the one that matches your stack.
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
Powerful state management for chat interactions, optimized for streaming responses and efficient rendering.
|
|
24
|
-
</Card>
|
|
17
|
+
<RuntimeGrid />
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
Optimized for speed and efficiency with minimal bundle size, ensuring your AI chat interfaces remain responsive.
|
|
28
|
-
</Card>
|
|
19
|
+
## Everything else
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
Easily integrate with any backend system, whether using Vercel AI SDK, direct LLM connections, or custom solutions. Works with any React-based framework.
|
|
32
|
-
</Card>
|
|
33
|
-
</Cards>
|
|
34
|
-
|
|
35
|
-
## Quick Try
|
|
36
|
-
|
|
37
|
-
The fastest way to get started:
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
npx assistant-ui@latest create
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
This creates a new project with everything configured. Or choose a template:
|
|
44
|
-
|
|
45
|
-
```sh
|
|
46
|
-
# Minimal starter
|
|
47
|
-
npx assistant-ui@latest create -t minimal
|
|
48
|
-
|
|
49
|
-
# Assistant Cloud - with persistence and thread management
|
|
50
|
-
npx assistant-ui@latest create -t cloud
|
|
51
|
-
|
|
52
|
-
# Assistant Cloud + Clerk authentication
|
|
53
|
-
npx assistant-ui@latest create -t cloud-clerk
|
|
54
|
-
|
|
55
|
-
# LangGraph starter (react-langchain adapter)
|
|
56
|
-
npx assistant-ui@latest create -t langchain
|
|
57
|
-
|
|
58
|
-
# MCP starter template
|
|
59
|
-
npx assistant-ui@latest create -t mcp
|
|
60
|
-
|
|
61
|
-
# Eve agent starter template
|
|
62
|
-
npx assistant-ui@latest create -t eve
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## What's Next?
|
|
66
|
-
|
|
67
|
-
<Cards>
|
|
68
|
-
<Card
|
|
69
|
-
title="Installation"
|
|
70
|
-
description="Full installation guide with CLI and manual setup options"
|
|
71
|
-
href="/docs/installation"
|
|
72
|
-
/>
|
|
73
|
-
<Card
|
|
74
|
-
title="Agent Skills"
|
|
75
|
-
description="Use AI tools to build with assistant-ui faster"
|
|
76
|
-
href="/docs/llm"
|
|
77
|
-
/>
|
|
78
|
-
<Card
|
|
79
|
-
title="Pick a Runtime"
|
|
80
|
-
description="Choose the right runtime for your needs"
|
|
81
|
-
href="/docs/runtimes/pick-a-runtime"
|
|
82
|
-
/>
|
|
83
|
-
<Card
|
|
84
|
-
title="Examples"
|
|
85
|
-
description="Explore full implementations and demos"
|
|
86
|
-
href="/examples"
|
|
87
|
-
/>
|
|
88
|
-
</Cards>
|
|
21
|
+
<QuickLinks />
|
|
@@ -22,28 +22,14 @@ The fastest way to get started with assistant-ui.
|
|
|
22
22
|
npx assistant-ui@latest create
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Or
|
|
25
|
+
Or start from a template:
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
# Minimal starter
|
|
29
|
-
npx assistant-ui@latest create -t minimal
|
|
30
|
-
|
|
31
|
-
# Assistant Cloud - with persistence and thread management
|
|
32
28
|
npx assistant-ui@latest create -t cloud
|
|
33
|
-
|
|
34
|
-
# Assistant Cloud + Clerk authentication
|
|
35
|
-
npx assistant-ui@latest create -t cloud-clerk
|
|
36
|
-
|
|
37
|
-
# LangGraph starter (react-langchain adapter)
|
|
38
|
-
npx assistant-ui@latest create -t langchain
|
|
39
|
-
|
|
40
|
-
# MCP starter template
|
|
41
|
-
npx assistant-ui@latest create -t mcp
|
|
42
|
-
|
|
43
|
-
# Eve agent starter template
|
|
44
|
-
npx assistant-ui@latest create -t eve
|
|
45
29
|
```
|
|
46
30
|
|
|
31
|
+
The [CLI reference](/docs/cli#create) lists every template and example, and what each one includes.
|
|
32
|
+
|
|
47
33
|
**Add to an existing project:**
|
|
48
34
|
|
|
49
35
|
```sh
|
|
@@ -154,7 +140,7 @@ export const maxDuration = 30;
|
|
|
154
140
|
export async function POST(req: Request) {
|
|
155
141
|
const { messages, system, tools } = await req.json();
|
|
156
142
|
const result = streamText({
|
|
157
|
-
model: openai("gpt-5.
|
|
143
|
+
model: openai("gpt-5.6-luna"),
|
|
158
144
|
system,
|
|
159
145
|
messages: await convertToModelMessages(messages),
|
|
160
146
|
tools: frontendTools(tools),
|