@assistant-ui/mcp-docs-server 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +12 -13
- package/.docs/organized/code-examples/with-a2a.md +16 -11
- package/.docs/organized/code-examples/with-ag-ui.md +15 -13
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
- package/.docs/organized/code-examples/with-artifacts.md +14 -13
- package/.docs/organized/code-examples/with-assistant-transport.md +20 -28
- package/.docs/organized/code-examples/with-browser-extension.md +18 -11
- package/.docs/organized/code-examples/with-chain-of-thought.md +17 -15
- package/.docs/organized/code-examples/with-cloud-standalone.md +10 -11
- package/.docs/organized/code-examples/with-cloud.md +19 -14
- package/.docs/organized/code-examples/with-custom-thread-list.md +15 -14
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -14
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +19 -17
- package/.docs/organized/code-examples/with-eve.md +66 -12
- package/.docs/organized/code-examples/with-expo.md +26 -31
- package/.docs/organized/code-examples/with-external-store.md +17 -12
- package/.docs/organized/code-examples/with-ffmpeg.md +21 -15
- package/.docs/organized/code-examples/with-generative-ui.md +271 -36
- 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 +14 -13
- package/.docs/organized/code-examples/with-langchain.md +12 -13
- package/.docs/organized/code-examples/with-langgraph.md +19 -13
- package/.docs/organized/code-examples/with-livekit.md +13 -13
- package/.docs/organized/code-examples/with-mcp.md +14 -15
- package/.docs/organized/code-examples/with-nuxt.md +2428 -0
- package/.docs/organized/code-examples/with-opencode.md +23 -14
- package/.docs/organized/code-examples/with-openui.md +449 -0
- package/.docs/organized/code-examples/with-pi.md +59 -57
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -15
- package/.docs/organized/code-examples/with-react-ink-web.md +7 -8
- package/.docs/organized/code-examples/with-react-ink.md +6 -6
- package/.docs/organized/code-examples/with-react-router.md +17 -11
- package/.docs/organized/code-examples/with-resumable-stream.md +12 -13
- package/.docs/organized/code-examples/with-store.md +27 -16
- package/.docs/organized/code-examples/with-svelte.md +415 -0
- package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
- package/.docs/organized/code-examples/with-tanstack.md +19 -13
- 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 +7 -2
- package/.docs/raw/docs/(docs)/index.mdx +9 -76
- package/.docs/raw/docs/(docs)/installation.mdx +6 -20
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +47 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +29 -4
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +52 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +2 -2
- package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -4
- package/.docs/raw/docs/cloud/index.mdx +1 -1
- package/.docs/raw/docs/copilots/model-context.mdx +4 -3
- package/.docs/raw/docs/copilots/motivation.mdx +4 -4
- package/.docs/raw/docs/guides/attachments.mdx +2 -2
- package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +1 -1
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +74 -3
- package/.docs/raw/docs/guides/suggestions.mdx +15 -12
- package/.docs/raw/docs/ink/hooks.mdx +9 -4
- package/.docs/raw/docs/ink/primitives.mdx +5 -4
- 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/integrations/persistence/custom-adapter.mdx +146 -128
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +15 -13
- package/.docs/raw/docs/migrations/v0-15.mdx +118 -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 +4 -2
- package/.docs/raw/docs/primitives/thread.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/ag-ui/runtime-options.mdx +35 -5
- 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/claude-managed-agents.mdx +118 -0
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +106 -27
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +19 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +34 -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/langchain.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +5 -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/runtimes/pick-a-runtime.mdx +8 -1
- package/.docs/raw/docs/tools/backend.mdx +2 -2
- package/.docs/raw/docs/tools/defining-tools.mdx +28 -7
- package/.docs/raw/docs/tools/dynamic-tools.mdx +6 -4
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
- package/.docs/raw/docs/tools/index.mdx +2 -1
- package/.docs/raw/docs/tools/interactables.mdx +29 -17
- package/.docs/raw/docs/tools/mcp-apps.mdx +35 -6
- package/.docs/raw/docs/tools/mcp.mdx +9 -7
- package/.docs/raw/docs/tools/openui.mdx +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +27 -24
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +17 -8
- package/.docs/raw/docs/ui/attachment.mdx +27 -0
- package/.docs/raw/docs/ui/file.mdx +7 -2
- package/.docs/raw/docs/ui/image.mdx +1 -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
- package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -410
|
@@ -188,7 +188,12 @@ export default function RootLayout({
|
|
|
188
188
|
```tsx
|
|
189
189
|
"use client";
|
|
190
190
|
|
|
191
|
-
import {
|
|
191
|
+
import {
|
|
192
|
+
AssistantRuntimeProvider,
|
|
193
|
+
AuiConfig,
|
|
194
|
+
Tools,
|
|
195
|
+
useAui,
|
|
196
|
+
} from "@assistant-ui/react";
|
|
192
197
|
import {
|
|
193
198
|
SidebarInset,
|
|
194
199
|
SidebarProvider,
|
|
@@ -211,6 +216,12 @@ import { ToolGroup } from "@/components/tools/tool-group";
|
|
|
211
216
|
import toolkit from "@/components/tools/toolkit";
|
|
212
217
|
import { useEffect } from "react";
|
|
213
218
|
|
|
219
|
+
const SetFallbackDataUI = () => {
|
|
220
|
+
const aui = useAui();
|
|
221
|
+
useEffect(() => aui.dataRenderers.setFallbackDataUI(OpenCodeDataPart), [aui]);
|
|
222
|
+
return null;
|
|
223
|
+
};
|
|
224
|
+
|
|
214
225
|
const THREAD_COMPONENTS: ThreadComponents = {
|
|
215
226
|
ToolFallback: FallbackTool,
|
|
216
227
|
ToolGroup,
|
|
@@ -223,14 +234,13 @@ export default function Home() {
|
|
|
223
234
|
process.env.NEXT_PUBLIC_OPENCODE_BASE_URL ?? "http://localhost:4096",
|
|
224
235
|
});
|
|
225
236
|
|
|
226
|
-
const
|
|
237
|
+
const config = AuiConfig({
|
|
227
238
|
tools: Tools({ toolkit }),
|
|
228
239
|
});
|
|
229
240
|
|
|
230
|
-
useEffect(() => aui.dataRenderers.setFallbackDataUI(OpenCodeDataPart), [aui]);
|
|
231
|
-
|
|
232
241
|
return (
|
|
233
|
-
<AssistantRuntimeProvider
|
|
242
|
+
<AssistantRuntimeProvider config={config} runtime={runtime}>
|
|
243
|
+
<SetFallbackDataUI />
|
|
234
244
|
<SidebarProvider>
|
|
235
245
|
<div className="flex h-dvh w-full overflow-hidden pr-0.5">
|
|
236
246
|
<ThreadListSidebar />
|
|
@@ -1889,11 +1899,11 @@ export default withAui(nextConfig);
|
|
|
1889
1899
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1890
1900
|
"@assistant-ui/react-opencode": "workspace:*",
|
|
1891
1901
|
"@assistant-ui/ui": "workspace:*",
|
|
1892
|
-
"@pierre/diffs": "^1.
|
|
1902
|
+
"@pierre/diffs": "^1.3.5",
|
|
1893
1903
|
"class-variance-authority": "^0.7.1",
|
|
1894
1904
|
"clsx": "^2.1.1",
|
|
1895
|
-
"lucide-react": "^1.
|
|
1896
|
-
"next": "^16.
|
|
1905
|
+
"lucide-react": "^1.31.0",
|
|
1906
|
+
"next": "^16.3.0",
|
|
1897
1907
|
"react": "^19.2.8",
|
|
1898
1908
|
"react-dom": "^19.2.8",
|
|
1899
1909
|
"tailwind-merge": "^3.6.0",
|
|
@@ -1903,14 +1913,13 @@ export default withAui(nextConfig);
|
|
|
1903
1913
|
"@assistant-ui/next": "workspace:*",
|
|
1904
1914
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1905
1915
|
"@tailwindcss/postcss": "^4.3.3",
|
|
1906
|
-
"@types/node": "^26.
|
|
1907
|
-
"@types/react": "^19.2.
|
|
1908
|
-
"@types/react-dom": "^19.2.
|
|
1909
|
-
"postcss": "^8.5.
|
|
1916
|
+
"@types/node": "^26.2.0",
|
|
1917
|
+
"@types/react": "^19.2.18",
|
|
1918
|
+
"@types/react-dom": "^19.2.4",
|
|
1919
|
+
"postcss": "^8.5.26",
|
|
1910
1920
|
"tailwindcss": "^4.3.3",
|
|
1911
1921
|
"tw-animate-css": "^1.4.0",
|
|
1912
|
-
"typescript": "
|
|
1913
|
-
"typescript-7": "npm:typescript@^7.0.2"
|
|
1922
|
+
"typescript": "^7.0.2"
|
|
1914
1923
|
}
|
|
1915
1924
|
}
|
|
1916
1925
|
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
# Example: with-openui
|
|
2
|
+
|
|
3
|
+
## app/api/chat/route.ts
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { openai } from "@ai-sdk/openai";
|
|
7
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
8
|
+
import {
|
|
9
|
+
type JSONSchema7,
|
|
10
|
+
streamText,
|
|
11
|
+
convertToModelMessages,
|
|
12
|
+
type UIMessage,
|
|
13
|
+
createUIMessageStreamResponse,
|
|
14
|
+
toUIMessageStream,
|
|
15
|
+
} from "ai";
|
|
16
|
+
|
|
17
|
+
// Allow streaming responses up to 30 seconds
|
|
18
|
+
export const maxDuration = 30;
|
|
19
|
+
|
|
20
|
+
export async function POST(req: Request) {
|
|
21
|
+
const {
|
|
22
|
+
messages,
|
|
23
|
+
system,
|
|
24
|
+
tools,
|
|
25
|
+
}: {
|
|
26
|
+
messages: UIMessage[];
|
|
27
|
+
system?: string;
|
|
28
|
+
tools?: Record<string, { description?: string; parameters: JSONSchema7 }>;
|
|
29
|
+
} = await req.json();
|
|
30
|
+
|
|
31
|
+
const result = streamText({
|
|
32
|
+
model: openai("gpt-5.6-luna"),
|
|
33
|
+
messages: await convertToModelMessages(messages),
|
|
34
|
+
...(system ? { system } : {}),
|
|
35
|
+
tools: frontendTools(tools ?? {}),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return createUIMessageStreamResponse({
|
|
39
|
+
stream: toUIMessageStream({ stream: result.stream }),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## app/globals.css
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
@import "tailwindcss";
|
|
49
|
+
@import "tw-animate-css";
|
|
50
|
+
@import "@openuidev/react-ui/layered/styles/index.css";
|
|
51
|
+
|
|
52
|
+
@source "../../../packages/ui/src";
|
|
53
|
+
|
|
54
|
+
@custom-variant dark (&:is(.dark *));
|
|
55
|
+
|
|
56
|
+
@theme inline {
|
|
57
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
58
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
59
|
+
--radius-lg: var(--radius);
|
|
60
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
61
|
+
--color-background: var(--background);
|
|
62
|
+
--color-foreground: var(--foreground);
|
|
63
|
+
--color-card: var(--card);
|
|
64
|
+
--color-card-foreground: var(--card-foreground);
|
|
65
|
+
--color-popover: var(--popover);
|
|
66
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
67
|
+
--color-primary: var(--primary);
|
|
68
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
69
|
+
--color-secondary: var(--secondary);
|
|
70
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
71
|
+
--color-muted: var(--muted);
|
|
72
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
73
|
+
--color-accent: var(--accent);
|
|
74
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
75
|
+
--color-destructive: var(--destructive);
|
|
76
|
+
--color-border: var(--border);
|
|
77
|
+
--color-input: var(--input);
|
|
78
|
+
--color-ring: var(--ring);
|
|
79
|
+
--color-chart-1: var(--chart-1);
|
|
80
|
+
--color-chart-2: var(--chart-2);
|
|
81
|
+
--color-chart-3: var(--chart-3);
|
|
82
|
+
--color-chart-4: var(--chart-4);
|
|
83
|
+
--color-chart-5: var(--chart-5);
|
|
84
|
+
--color-sidebar: var(--sidebar);
|
|
85
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
86
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
87
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
88
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
89
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
90
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
91
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:root {
|
|
95
|
+
--radius: 0.625rem;
|
|
96
|
+
--background: oklch(1 0 0);
|
|
97
|
+
--foreground: oklch(0.141 0.005 285.823);
|
|
98
|
+
--card: oklch(1 0 0);
|
|
99
|
+
--card-foreground: oklch(0.141 0.005 285.823);
|
|
100
|
+
--popover: oklch(1 0 0);
|
|
101
|
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
|
102
|
+
--primary: oklch(0.21 0.006 285.885);
|
|
103
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
104
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
105
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
106
|
+
--muted: oklch(0.967 0.001 286.375);
|
|
107
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
108
|
+
--accent: oklch(0.967 0.001 286.375);
|
|
109
|
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
|
110
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
111
|
+
--border: oklch(0.92 0.004 286.32);
|
|
112
|
+
--input: oklch(0.92 0.004 286.32);
|
|
113
|
+
--ring: oklch(0.705 0.015 286.067);
|
|
114
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
115
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
116
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
117
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
118
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
119
|
+
--sidebar: oklch(0.985 0 0);
|
|
120
|
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
121
|
+
--sidebar-primary: oklch(0.21 0.006 285.885);
|
|
122
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
123
|
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
|
124
|
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
125
|
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
126
|
+
--sidebar-ring: oklch(0.705 0.015 286.067);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.dark {
|
|
130
|
+
--background: oklch(0.141 0.005 285.823);
|
|
131
|
+
--foreground: oklch(0.985 0 0);
|
|
132
|
+
--card: oklch(0.21 0.006 285.885);
|
|
133
|
+
--card-foreground: oklch(0.985 0 0);
|
|
134
|
+
--popover: oklch(0.21 0.006 285.885);
|
|
135
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
136
|
+
--primary: oklch(0.92 0.004 286.32);
|
|
137
|
+
--primary-foreground: oklch(0.21 0.006 285.885);
|
|
138
|
+
--secondary: oklch(0.274 0.006 286.033);
|
|
139
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
140
|
+
--muted: oklch(0.274 0.006 286.033);
|
|
141
|
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
|
142
|
+
--accent: oklch(0.274 0.006 286.033);
|
|
143
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
144
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
145
|
+
--border: oklch(1 0 0 / 10%);
|
|
146
|
+
--input: oklch(1 0 0 / 15%);
|
|
147
|
+
--ring: oklch(0.552 0.016 285.938);
|
|
148
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
149
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
150
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
151
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
152
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
153
|
+
--sidebar: oklch(0.21 0.006 285.885);
|
|
154
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
155
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
156
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
157
|
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
|
158
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
159
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
160
|
+
--sidebar-ring: oklch(0.552 0.016 285.938);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@layer base {
|
|
164
|
+
* {
|
|
165
|
+
@apply border-border outline-ring/50;
|
|
166
|
+
}
|
|
167
|
+
body {
|
|
168
|
+
@apply bg-background text-foreground;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## app/layout.tsx
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import type { Metadata } from "next";
|
|
178
|
+
import "./globals.css";
|
|
179
|
+
|
|
180
|
+
export const metadata: Metadata = {
|
|
181
|
+
title: "OpenUI Example",
|
|
182
|
+
description:
|
|
183
|
+
"Example using @assistant-ui/react with the OpenUI renderer via @openuidev/assistant-ui",
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default function RootLayout({
|
|
187
|
+
children,
|
|
188
|
+
}: Readonly<{
|
|
189
|
+
children: React.ReactNode;
|
|
190
|
+
}>) {
|
|
191
|
+
return (
|
|
192
|
+
<html lang="en">
|
|
193
|
+
<body className="h-dvh">{children}</body>
|
|
194
|
+
</html>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## app/page.tsx
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
"use client";
|
|
204
|
+
|
|
205
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
206
|
+
import {
|
|
207
|
+
AssistantRuntimeProvider,
|
|
208
|
+
AuiConfig,
|
|
209
|
+
Suggestions,
|
|
210
|
+
Tools,
|
|
211
|
+
} from "@assistant-ui/react";
|
|
212
|
+
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
213
|
+
import { OpenUIInstructions, openuiIntegration } from "@openuidev/assistant-ui";
|
|
214
|
+
import { shouldContinueAfterOpenUIPrompt } from "@openuidev/assistant-ui/ai-sdk";
|
|
215
|
+
|
|
216
|
+
export default function Home() {
|
|
217
|
+
const runtime = useChatRuntime({
|
|
218
|
+
sendAutomaticallyWhen: shouldContinueAfterOpenUIPrompt,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const config = AuiConfig({
|
|
222
|
+
tools: Tools({ toolkit: openuiIntegration.toolkit }),
|
|
223
|
+
suggestions: Suggestions([
|
|
224
|
+
{
|
|
225
|
+
title: "Trip summary",
|
|
226
|
+
label: "as a display-only card",
|
|
227
|
+
prompt:
|
|
228
|
+
"Show a trip summary for my Tokyo trip: flying March 14 to 21, staying at Park Hyatt Tokyo at $310 a night, total budget $4,200, with three confirmed activities: teamLab Planets, a Tsukiji food tour, and a Hakone day trip.",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
title: "Pick a slot",
|
|
232
|
+
label: "with an interactive choice",
|
|
233
|
+
prompt:
|
|
234
|
+
"Ask me to pick a meeting slot from Tuesday 10:00, Wednesday 14:30, or Friday 09:15.",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
title: "Registration form",
|
|
238
|
+
label: "collect structured input",
|
|
239
|
+
prompt:
|
|
240
|
+
"Collect my conference registration with a form: full name, email, company, and a t-shirt size choice of S, M, L, or XL.",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
title: "Sprint metrics",
|
|
244
|
+
label: "summarized visually",
|
|
245
|
+
prompt:
|
|
246
|
+
"Summarize our sprint: 34 of 41 planned issues closed, velocity 62 points versus 55 last sprint, 3 escaped bugs, and a median cycle time of 2.4 days.",
|
|
247
|
+
},
|
|
248
|
+
]),
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<AssistantRuntimeProvider config={config} runtime={runtime}>
|
|
253
|
+
<OpenUIInstructions />
|
|
254
|
+
<div className="h-full">
|
|
255
|
+
<Thread />
|
|
256
|
+
</div>
|
|
257
|
+
</AssistantRuntimeProvider>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## components.json
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
268
|
+
"style": "new-york",
|
|
269
|
+
"rsc": true,
|
|
270
|
+
"tsx": true,
|
|
271
|
+
"tailwind": {
|
|
272
|
+
"config": "",
|
|
273
|
+
"css": "app/globals.css",
|
|
274
|
+
"baseColor": "zinc",
|
|
275
|
+
"cssVariables": true,
|
|
276
|
+
"prefix": ""
|
|
277
|
+
},
|
|
278
|
+
"aliases": {
|
|
279
|
+
"components": "@/components",
|
|
280
|
+
"utils": "@/lib/utils",
|
|
281
|
+
"ui": "@/components/ui",
|
|
282
|
+
"lib": "@/lib",
|
|
283
|
+
"hooks": "@/hooks"
|
|
284
|
+
},
|
|
285
|
+
"iconLibrary": "lucide",
|
|
286
|
+
"registries": {
|
|
287
|
+
"@assistant-ui": "https://r.assistant-ui.com/{name}.json"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## next.config.js
|
|
294
|
+
|
|
295
|
+
```javascript
|
|
296
|
+
/** @type {import('next').NextConfig} */
|
|
297
|
+
const nextConfig = {
|
|
298
|
+
transpilePackages: ["@assistant-ui/react", "@assistant-ui/react-ai-sdk"],
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export default nextConfig;
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## package.json
|
|
306
|
+
|
|
307
|
+
```json
|
|
308
|
+
{
|
|
309
|
+
"name": "with-openui",
|
|
310
|
+
"version": "0.0.0",
|
|
311
|
+
"private": true,
|
|
312
|
+
"type": "module",
|
|
313
|
+
"scripts": {
|
|
314
|
+
"dev": "next dev",
|
|
315
|
+
"build": "next build",
|
|
316
|
+
"start": "next start"
|
|
317
|
+
},
|
|
318
|
+
"dependencies": {
|
|
319
|
+
"@ai-sdk/openai": "^4.0.40",
|
|
320
|
+
"@assistant-ui/react": "workspace:*",
|
|
321
|
+
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
322
|
+
"@assistant-ui/react-markdown": "workspace:*",
|
|
323
|
+
"@assistant-ui/ui": "workspace:*",
|
|
324
|
+
"@openuidev/assistant-ui": "^0.0.3",
|
|
325
|
+
"@openuidev/react-headless": "^0.9.8",
|
|
326
|
+
"@openuidev/react-lang": "^0.2.11",
|
|
327
|
+
"@openuidev/react-ui": "^0.13.6",
|
|
328
|
+
"ai": "^7.0.62",
|
|
329
|
+
"class-variance-authority": "^0.7.1",
|
|
330
|
+
"clsx": "^2.1.1",
|
|
331
|
+
"lucide-react": "^1.31.0",
|
|
332
|
+
"next": "^16.3.0",
|
|
333
|
+
"react": "^19.2.8",
|
|
334
|
+
"react-dom": "^19.2.8",
|
|
335
|
+
"tailwind-merge": "^3.6.0",
|
|
336
|
+
"zod": "^4.4.3",
|
|
337
|
+
"zustand": "^4.5.5"
|
|
338
|
+
},
|
|
339
|
+
"devDependencies": {
|
|
340
|
+
"@assistant-ui/x-buildutils": "workspace:*",
|
|
341
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
342
|
+
"@types/node": "^26.2.0",
|
|
343
|
+
"@types/react": "^19.2.18",
|
|
344
|
+
"@types/react-dom": "^19.2.4",
|
|
345
|
+
"postcss": "^8.5.26",
|
|
346
|
+
"tailwindcss": "^4.3.3",
|
|
347
|
+
"tw-animate-css": "^1.4.0",
|
|
348
|
+
"typescript": "^7.0.2"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## README.md
|
|
355
|
+
|
|
356
|
+
```markdown
|
|
357
|
+
# OpenUI Example
|
|
358
|
+
|
|
359
|
+
This example renders streaming [OpenUI Lang](https://www.openui.com) interfaces inside an assistant-ui conversation using [`@openuidev/assistant-ui`](https://www.npmjs.com/package/@openuidev/assistant-ui), the integration package published and maintained by OpenUI.
|
|
360
|
+
|
|
361
|
+
assistant-ui owns the chat shell, runtime, messages, streaming, and tool lifecycle. OpenUI renders the `ui` argument of two tool calls: `present_openui` for display-only interfaces and `prompt_openui` for forms and choices that wait for the user to submit.
|
|
362
|
+
|
|
363
|
+
## Quick Start
|
|
364
|
+
|
|
365
|
+
### Using CLI (Recommended)
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
npx assistant-ui@latest create my-app --example with-openui
|
|
369
|
+
cd my-app
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Environment Variables
|
|
373
|
+
|
|
374
|
+
Create `.env.local`:
|
|
375
|
+
|
|
376
|
+
```sh
|
|
377
|
+
OPENAI_API_KEY=your-api-key-here
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Run
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
pnpm install
|
|
384
|
+
pnpm dev
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Open [http://localhost:3000](http://localhost:3000) to see the result.
|
|
388
|
+
|
|
389
|
+
### Run inside the monorepo
|
|
390
|
+
|
|
391
|
+
To develop against the workspace packages directly, clone the repository and build the packages the example imports before starting the dev server. Create `examples/with-openui/.env.local` with your `OPENAI_API_KEY` first.
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
git clone https://github.com/assistant-ui/assistant-ui.git
|
|
395
|
+
cd assistant-ui
|
|
396
|
+
pnpm install
|
|
397
|
+
pnpm exec turbo build --filter='with-openui^...'
|
|
398
|
+
pnpm -C examples/with-openui dev
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## Key Features
|
|
402
|
+
|
|
403
|
+
- Registers `openuiIntegration.toolkit` so the model can call `present_openui` and `prompt_openui`
|
|
404
|
+
- Mounts `OpenUIInstructions` so the model learns the OpenUI component vocabulary through assistant instructions
|
|
405
|
+
- Uses `sendAutomaticallyWhen: shouldContinueAfterOpenUIPrompt` so a display-only call ends the turn while an interactive submission continues the conversation
|
|
406
|
+
- Forwards the instructions and both frontend tools to the backend through `AssistantChatTransport`, so the API route stays generic
|
|
407
|
+
- Loads the OpenUI layered stylesheet once in `app/globals.css`
|
|
408
|
+
|
|
409
|
+
## How it works
|
|
410
|
+
|
|
411
|
+
- `app/page.tsx` wires the runtime, toolkit, instructions, and suggestions
|
|
412
|
+
- `app/api/chat/route.ts` streams with the AI SDK and exposes the forwarded frontend tools with `frontendTools`
|
|
413
|
+
- Submitted form state is returned through `addResult` and hydrates again on replay
|
|
414
|
+
|
|
415
|
+
## Related Documentation
|
|
416
|
+
|
|
417
|
+
- [assistant-ui OpenUI guide](https://www.assistant-ui.com/docs/tools/openui)
|
|
418
|
+
- [OpenUI assistant-ui integration reference](https://www.openui.com/docs/api-reference/assistant-ui)
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## tsconfig.json
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
{
|
|
426
|
+
"extends": "@assistant-ui/x-buildutils/ts/next",
|
|
427
|
+
"compilerOptions": {
|
|
428
|
+
"paths": {
|
|
429
|
+
"@/*": ["./*"],
|
|
430
|
+
"@/components/assistant-ui/*": [
|
|
431
|
+
"../../packages/ui/src/components/assistant-ui/*"
|
|
432
|
+
],
|
|
433
|
+
"@/components/ui/*": [
|
|
434
|
+
"../../packages/ui/src/components/ui/base/*",
|
|
435
|
+
"../../packages/ui/src/components/ui/radix/*"
|
|
436
|
+
],
|
|
437
|
+
"@/components/ui/radix/*": [
|
|
438
|
+
"../../packages/ui/src/components/ui/radix/*"
|
|
439
|
+
],
|
|
440
|
+
"@/lib/utils": ["../../packages/ui/src/lib/utils"],
|
|
441
|
+
"@assistant-ui/ui/*": ["../../packages/ui/src/*"]
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
"include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
445
|
+
"exclude": ["node_modules"]
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
|
|
@@ -727,6 +727,7 @@ import { useModelSelectorEfforts } from "@/components/assistant-ui/model-selecto
|
|
|
727
727
|
import {
|
|
728
728
|
Tooltip,
|
|
729
729
|
TooltipContent,
|
|
730
|
+
TooltipProvider,
|
|
730
731
|
TooltipTrigger,
|
|
731
732
|
} from "@/components/ui/radix/tooltip";
|
|
732
733
|
import { cn } from "@/lib/utils";
|
|
@@ -764,54 +765,56 @@ export const ThinkingLevelSlider = ({
|
|
|
764
765
|
return (
|
|
765
766
|
<div className="flex items-center justify-between gap-3 border-t px-3 py-2">
|
|
766
767
|
<span className="text-muted-foreground text-xs">{label}</span>
|
|
767
|
-
<
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
<
|
|
788
|
-
<
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
{
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
768
|
+
<TooltipProvider>
|
|
769
|
+
<div
|
|
770
|
+
role="radiogroup"
|
|
771
|
+
aria-label={label}
|
|
772
|
+
className="flex items-end"
|
|
773
|
+
onKeyDown={(event) => {
|
|
774
|
+
if (event.key === "ArrowRight" || event.key === "ArrowUp") {
|
|
775
|
+
selectIndex(event, activeIndex + 1);
|
|
776
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowDown") {
|
|
777
|
+
selectIndex(event, activeIndex - 1);
|
|
778
|
+
} else if (event.key === "Home") {
|
|
779
|
+
selectIndex(event, 0);
|
|
780
|
+
} else if (event.key === "End") {
|
|
781
|
+
selectIndex(event, lastIndex);
|
|
782
|
+
}
|
|
783
|
+
}}
|
|
784
|
+
>
|
|
785
|
+
{efforts.map((option, index) => {
|
|
786
|
+
const isActive = index === activeIndex;
|
|
787
|
+
return (
|
|
788
|
+
<Tooltip key={option.id} disableHoverableContent>
|
|
789
|
+
<TooltipTrigger asChild>
|
|
790
|
+
<button
|
|
791
|
+
type="button"
|
|
792
|
+
role="radio"
|
|
793
|
+
aria-checked={isActive}
|
|
794
|
+
aria-label={option.name}
|
|
795
|
+
tabIndex={index === Math.max(activeIndex, 0) ? 0 : -1}
|
|
796
|
+
data-state={isActive ? "on" : "off"}
|
|
797
|
+
onClick={() => setEffort(option.id)}
|
|
798
|
+
className="group focus-visible:ring-ring/50 flex h-6 w-3.5 items-end justify-center rounded-sm outline-none focus-visible:ring-2"
|
|
799
|
+
>
|
|
800
|
+
<span
|
|
801
|
+
className={cn(
|
|
802
|
+
"rounded-full transition-all duration-150 ease-out",
|
|
803
|
+
isActive
|
|
804
|
+
? "bg-primary h-4.5 w-0.5"
|
|
805
|
+
: "bg-muted-foreground/40 group-hover:bg-foreground/70 h-2.5 w-0.5 group-hover:h-4 group-hover:w-[3px] group-focus-visible:h-4 group-focus-visible:w-[3px]",
|
|
806
|
+
)}
|
|
807
|
+
/>
|
|
808
|
+
</button>
|
|
809
|
+
</TooltipTrigger>
|
|
810
|
+
<TooltipContent side="top" sideOffset={2}>
|
|
811
|
+
{option.name}
|
|
812
|
+
</TooltipContent>
|
|
813
|
+
</Tooltip>
|
|
814
|
+
);
|
|
815
|
+
})}
|
|
816
|
+
</div>
|
|
817
|
+
</TooltipProvider>
|
|
815
818
|
<span className="text-foreground min-w-12 text-end text-xs">
|
|
816
819
|
{efforts[activeIndex]?.name}
|
|
817
820
|
</span>
|
|
@@ -1958,11 +1961,11 @@ export default withAui(nextConfig);
|
|
|
1958
1961
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1959
1962
|
"@assistant-ui/react-pi": "workspace:*",
|
|
1960
1963
|
"@assistant-ui/ui": "workspace:*",
|
|
1961
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
1964
|
+
"@earendil-works/pi-coding-agent": "^0.84.1",
|
|
1962
1965
|
"class-variance-authority": "^0.7.1",
|
|
1963
1966
|
"clsx": "^2.1.1",
|
|
1964
|
-
"lucide-react": "^1.
|
|
1965
|
-
"next": "^16.
|
|
1967
|
+
"lucide-react": "^1.31.0",
|
|
1968
|
+
"next": "^16.3.0",
|
|
1966
1969
|
"radix-ui": "^1.6.7",
|
|
1967
1970
|
"react": "^19.2.8",
|
|
1968
1971
|
"react-dom": "^19.2.8",
|
|
@@ -1972,14 +1975,13 @@ export default withAui(nextConfig);
|
|
|
1972
1975
|
"@assistant-ui/next": "workspace:*",
|
|
1973
1976
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1974
1977
|
"@tailwindcss/postcss": "^4.3.3",
|
|
1975
|
-
"@types/node": "^26.
|
|
1976
|
-
"@types/react": "^19.2.
|
|
1977
|
-
"@types/react-dom": "^19.2.
|
|
1978
|
-
"postcss": "^8.5.
|
|
1978
|
+
"@types/node": "^26.2.0",
|
|
1979
|
+
"@types/react": "^19.2.18",
|
|
1980
|
+
"@types/react-dom": "^19.2.4",
|
|
1981
|
+
"postcss": "^8.5.26",
|
|
1979
1982
|
"tailwindcss": "^4.3.3",
|
|
1980
1983
|
"tw-animate-css": "^1.4.0",
|
|
1981
|
-
"typescript": "
|
|
1982
|
-
"typescript-7": "npm:typescript@^7.0.2"
|
|
1984
|
+
"typescript": "^7.0.2"
|
|
1983
1985
|
}
|
|
1984
1986
|
}
|
|
1985
1987
|
|