@assistant-ui/mcp-docs-server 0.1.33 → 0.1.35
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 +7 -7
- package/.docs/organized/code-examples/with-a2a.md +8 -8
- package/.docs/organized/code-examples/with-ag-ui.md +12 -12
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
- package/.docs/organized/code-examples/with-artifacts.md +40 -34
- package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
- package/.docs/organized/code-examples/with-browser-extension.md +9 -9
- package/.docs/organized/code-examples/with-chain-of-thought.md +72 -51
- package/.docs/organized/code-examples/with-cloud-standalone.md +10 -10
- package/.docs/organized/code-examples/with-cloud.md +10 -10
- package/.docs/organized/code-examples/with-custom-thread-list.md +10 -10
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -12
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -12
- package/.docs/organized/code-examples/with-expo.md +66 -31
- package/.docs/organized/code-examples/with-external-store.md +8 -8
- package/.docs/organized/code-examples/with-ffmpeg.md +13 -13
- package/.docs/organized/code-examples/with-generative-ui.md +98 -368
- package/.docs/organized/code-examples/with-google-adk.md +9 -9
- package/.docs/organized/code-examples/with-heat-graph.md +7 -7
- package/.docs/organized/code-examples/with-image-generation.md +10 -10
- package/.docs/organized/code-examples/with-interactables.md +10 -10
- package/.docs/organized/code-examples/with-langchain.md +10 -10
- package/.docs/organized/code-examples/with-langgraph.md +33 -29
- package/.docs/organized/code-examples/with-livekit.md +12 -12
- package/.docs/organized/code-examples/with-mcp.md +11 -11
- package/.docs/organized/code-examples/with-opencode.md +109 -583
- package/.docs/organized/code-examples/with-pi.md +2044 -0
- package/.docs/organized/code-examples/with-react-hook-form.md +11 -11
- package/.docs/organized/code-examples/with-react-ink-web.md +691 -0
- package/.docs/organized/code-examples/with-react-ink.md +309 -102
- package/.docs/organized/code-examples/with-react-router.md +14 -14
- package/.docs/organized/code-examples/with-resumable-stream.md +11 -11
- package/.docs/organized/code-examples/with-store.md +70 -66
- package/.docs/organized/code-examples/with-tanstack.md +25 -11
- package/.docs/organized/code-examples/with-tap-runtime.md +8 -8
- package/.docs/organized/code-examples/with-virtualized-thread.md +656 -0
- package/.docs/raw/docs/(docs)/architecture.mdx +65 -53
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +3 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +44 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +14 -3
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +2 -23
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +93 -9
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +21 -86
- package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
- package/.docs/raw/docs/guides/index.mdx +3 -0
- package/.docs/raw/docs/guides/input-history.mdx +55 -0
- package/.docs/raw/docs/guides/virtualization.mdx +63 -0
- package/.docs/raw/docs/ink/adapters.mdx +23 -1
- package/.docs/raw/docs/ink/hooks.mdx +22 -19
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +14 -8
- package/.docs/raw/docs/react-native/hooks.mdx +26 -18
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +39 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +46 -4
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +54 -12
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +62 -4
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +120 -4
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -9
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +13 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +5 -5
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +3 -3
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +6 -6
- package/.docs/raw/docs/tools/backend.mdx +19 -11
- package/.docs/raw/docs/tools/defining-tools.mdx +177 -52
- package/.docs/raw/docs/tools/index.mdx +7 -12
- package/.docs/raw/docs/tools/mcp.mdx +83 -15
- package/.docs/raw/docs/tools/multi-agent.mdx +5 -5
- package/.docs/raw/docs/tools/tool-ui.mdx +64 -28
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +4 -4
- package/.docs/raw/docs/ui/dot-matrix.mdx +133 -0
- package/.docs/raw/docs/ui/mermaid.mdx +16 -9
- package/.docs/raw/docs/ui/model-selector.mdx +219 -52
- package/.docs/raw/docs/ui/number-roll.mdx +154 -0
- package/.docs/raw/docs/ui/part-grouping.mdx +2 -2
- package/.docs/raw/docs/ui/reasoning.mdx +3 -3
- package/.docs/raw/docs/ui/streamdown.mdx +2 -0
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread.mdx +52 -0
- package/.docs/raw/docs/ui/tool-fallback.mdx +16 -0
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/package.json +4 -4
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/assistant-frame.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/make-assistant-visible.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/model-context.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/motivation.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/use-assistant-instructions.mdx +0 -0
|
@@ -8,20 +8,26 @@ import {
|
|
|
8
8
|
streamText,
|
|
9
9
|
convertToModelMessages,
|
|
10
10
|
stepCountIs,
|
|
11
|
-
jsonSchema,
|
|
12
11
|
tool,
|
|
13
12
|
zodSchema,
|
|
14
13
|
} from "ai";
|
|
15
14
|
import type { UIMessage } from "ai";
|
|
16
15
|
import { z } from "zod";
|
|
16
|
+
import {
|
|
17
|
+
AISDKToolkit,
|
|
18
|
+
type AISDKToolkitToolsOptions,
|
|
19
|
+
} from "@assistant-ui/react-ai-sdk";
|
|
17
20
|
import {
|
|
18
21
|
renderGuiToolDescription,
|
|
19
22
|
renderGuiToolInputSchema,
|
|
20
23
|
} from "../../../lib/render-gui-tool";
|
|
24
|
+
import toolkit from "../../toolkit";
|
|
21
25
|
|
|
22
26
|
export const maxDuration = 30;
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
const aiToolkit = new AISDKToolkit({ toolkit });
|
|
29
|
+
|
|
30
|
+
type FrontendToolDefs = NonNullable<AISDKToolkitToolsOptions["frontend"]>;
|
|
25
31
|
|
|
26
32
|
export async function POST(req: Request) {
|
|
27
33
|
const {
|
|
@@ -31,21 +37,12 @@ export async function POST(req: Request) {
|
|
|
31
37
|
}: {
|
|
32
38
|
messages: UIMessage[];
|
|
33
39
|
system?: string;
|
|
34
|
-
tools?:
|
|
40
|
+
tools?: FrontendToolDefs;
|
|
35
41
|
} = await req.json();
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Object.entries(clientTools).map(([name, def]) => [
|
|
41
|
-
name,
|
|
42
|
-
{
|
|
43
|
-
description: def.description ?? "",
|
|
44
|
-
inputSchema: jsonSchema(def.parameters),
|
|
45
|
-
},
|
|
46
|
-
]),
|
|
47
|
-
)
|
|
48
|
-
: {};
|
|
43
|
+
const toolkitTools = await aiToolkit.tools({
|
|
44
|
+
...(clientTools && { frontend: clientTools }),
|
|
45
|
+
});
|
|
49
46
|
|
|
50
47
|
const result = streamText({
|
|
51
48
|
model: openai("gpt-5.4-nano"),
|
|
@@ -53,7 +50,7 @@ export async function POST(req: Request) {
|
|
|
53
50
|
stopWhen: stepCountIs(10),
|
|
54
51
|
...(system ? { system } : {}),
|
|
55
52
|
tools: {
|
|
56
|
-
...
|
|
53
|
+
...toolkitTools,
|
|
57
54
|
|
|
58
55
|
render_gui: tool({
|
|
59
56
|
description: renderGuiToolDescription,
|
|
@@ -249,7 +246,11 @@ export async function POST(req: Request) {
|
|
|
249
246
|
"use client";
|
|
250
247
|
|
|
251
248
|
import { ExampleNav } from "@/components/example-nav";
|
|
252
|
-
import {
|
|
249
|
+
import { AssistantMessageGui } from "@/components/assistant-message-gui";
|
|
250
|
+
import {
|
|
251
|
+
Thread,
|
|
252
|
+
type ThreadComponents,
|
|
253
|
+
} from "@/components/assistant-ui/thread";
|
|
253
254
|
import {
|
|
254
255
|
AssistantRuntimeProvider,
|
|
255
256
|
Suggestions,
|
|
@@ -265,6 +266,24 @@ const GuiChatInstructions = () => {
|
|
|
265
266
|
return null;
|
|
266
267
|
};
|
|
267
268
|
|
|
269
|
+
const GuiWelcome = () => {
|
|
270
|
+
return (
|
|
271
|
+
<div className="aui-thread-welcome-root mb-6 flex flex-col items-center gap-1 px-4 text-center">
|
|
272
|
+
<h1 className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-2xl font-semibold duration-200">
|
|
273
|
+
Compose UI from a spec
|
|
274
|
+
</h1>
|
|
275
|
+
<p className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200">
|
|
276
|
+
Ask the agent to call render_gui with Card, Button, and Stack.
|
|
277
|
+
</p>
|
|
278
|
+
</div>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const THREAD_COMPONENTS: ThreadComponents = {
|
|
283
|
+
AssistantMessage: AssistantMessageGui,
|
|
284
|
+
Welcome: GuiWelcome,
|
|
285
|
+
};
|
|
286
|
+
|
|
268
287
|
export default function GuiChatPage() {
|
|
269
288
|
const runtime = useChatRuntime({
|
|
270
289
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
@@ -293,7 +312,7 @@ export default function GuiChatPage() {
|
|
|
293
312
|
<div className="flex h-full flex-col">
|
|
294
313
|
<ExampleNav />
|
|
295
314
|
<main className="min-h-0 flex-1">
|
|
296
|
-
<
|
|
315
|
+
<Thread components={THREAD_COMPONENTS} />
|
|
297
316
|
</main>
|
|
298
317
|
</div>
|
|
299
318
|
</AssistantRuntimeProvider>
|
|
@@ -338,51 +357,12 @@ import {
|
|
|
338
357
|
AssistantRuntimeProvider,
|
|
339
358
|
Suggestions,
|
|
340
359
|
Tools,
|
|
341
|
-
type Toolkit,
|
|
342
360
|
useAui,
|
|
343
361
|
} from "@assistant-ui/react";
|
|
344
362
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
345
363
|
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
|
|
346
|
-
import { z } from "zod";
|
|
347
|
-
import { ChartToolUI } from "@/components/chart-tool-ui";
|
|
348
|
-
import { DatePickerToolUI } from "@/components/date-picker-tool-ui";
|
|
349
|
-
import { ContactFormToolUI } from "@/components/contact-form-tool-ui";
|
|
350
|
-
import { LocationToolUI } from "@/components/location-tool-ui";
|
|
351
364
|
import { ExampleNav } from "@/components/example-nav";
|
|
352
|
-
|
|
353
|
-
const toolkit = {
|
|
354
|
-
select_date: {
|
|
355
|
-
type: "human",
|
|
356
|
-
description:
|
|
357
|
-
"Ask the user to select a date. Use this when you need to collect a date (e.g. for scheduling, booking, deadlines).",
|
|
358
|
-
parameters: z.object({
|
|
359
|
-
prompt: z.string().describe("Message to display to the user"),
|
|
360
|
-
minDate: z.string().optional().describe("Minimum date (ISO string)"),
|
|
361
|
-
maxDate: z.string().optional().describe("Maximum date (ISO string)"),
|
|
362
|
-
}),
|
|
363
|
-
render: DatePickerToolUI,
|
|
364
|
-
},
|
|
365
|
-
collect_contact: {
|
|
366
|
-
type: "human",
|
|
367
|
-
description:
|
|
368
|
-
"Collect contact information from the user. Use this when you need the user's name, email, or phone number.",
|
|
369
|
-
parameters: z.object({
|
|
370
|
-
prompt: z.string().describe("Message to display to the user"),
|
|
371
|
-
fields: z
|
|
372
|
-
.array(z.enum(["name", "email", "phone"]))
|
|
373
|
-
.describe("Which fields to collect"),
|
|
374
|
-
}),
|
|
375
|
-
render: ContactFormToolUI,
|
|
376
|
-
},
|
|
377
|
-
generate_chart: {
|
|
378
|
-
type: "backend",
|
|
379
|
-
render: ChartToolUI,
|
|
380
|
-
},
|
|
381
|
-
show_location: {
|
|
382
|
-
type: "backend",
|
|
383
|
-
render: LocationToolUI,
|
|
384
|
-
},
|
|
385
|
-
} satisfies Toolkit;
|
|
365
|
+
import toolkit from "./toolkit";
|
|
386
366
|
|
|
387
367
|
export default function Home() {
|
|
388
368
|
const runtime = useChatRuntime({
|
|
@@ -532,6 +512,54 @@ export default function GenerativeUIPrimitivePage() {
|
|
|
532
512
|
|
|
533
513
|
```
|
|
534
514
|
|
|
515
|
+
## app/toolkit.tsx
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
"use generative";
|
|
519
|
+
|
|
520
|
+
import { defineToolkit, externalTool, humanTool } from "@assistant-ui/react";
|
|
521
|
+
import { ChartToolUI } from "@/components/chart-tool-ui";
|
|
522
|
+
import { DatePickerToolUI } from "@/components/date-picker-tool-ui";
|
|
523
|
+
import { ContactFormToolUI } from "@/components/contact-form-tool-ui";
|
|
524
|
+
import { LocationToolUI } from "@/components/location-tool-ui";
|
|
525
|
+
import { z } from "zod";
|
|
526
|
+
|
|
527
|
+
export default defineToolkit({
|
|
528
|
+
select_date: {
|
|
529
|
+
description:
|
|
530
|
+
"Ask the user to select a date. Use this when you need to collect a date (e.g. for scheduling, booking, deadlines).",
|
|
531
|
+
parameters: z.object({
|
|
532
|
+
prompt: z.string().describe("Message to display to the user"),
|
|
533
|
+
minDate: z.string().optional().describe("Minimum date (ISO string)"),
|
|
534
|
+
maxDate: z.string().optional().describe("Maximum date (ISO string)"),
|
|
535
|
+
}),
|
|
536
|
+
execute: humanTool(),
|
|
537
|
+
render: DatePickerToolUI,
|
|
538
|
+
},
|
|
539
|
+
collect_contact: {
|
|
540
|
+
description:
|
|
541
|
+
"Collect contact information from the user. Use this when you need the user's name, email, or phone number.",
|
|
542
|
+
parameters: z.object({
|
|
543
|
+
prompt: z.string().describe("Message to display to the user"),
|
|
544
|
+
fields: z
|
|
545
|
+
.array(z.enum(["name", "email", "phone"]))
|
|
546
|
+
.describe("Which fields to collect"),
|
|
547
|
+
}),
|
|
548
|
+
execute: humanTool(),
|
|
549
|
+
render: ContactFormToolUI,
|
|
550
|
+
},
|
|
551
|
+
generate_chart: {
|
|
552
|
+
execute: externalTool(),
|
|
553
|
+
render: ChartToolUI,
|
|
554
|
+
},
|
|
555
|
+
show_location: {
|
|
556
|
+
execute: externalTool(),
|
|
557
|
+
render: LocationToolUI,
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
```
|
|
562
|
+
|
|
535
563
|
## components.json
|
|
536
564
|
|
|
537
565
|
```json
|
|
@@ -707,7 +735,7 @@ export const AssistantMessageGui: FC<AssistantMessageGuiProps> = ({
|
|
|
707
735
|
case "group-reasoning": {
|
|
708
736
|
const running = part.status.type === "running";
|
|
709
737
|
return (
|
|
710
|
-
<ReasoningRoot
|
|
738
|
+
<ReasoningRoot streaming={running}>
|
|
711
739
|
<ReasoningTrigger active={running} />
|
|
712
740
|
<ReasoningContent aria-busy={running}>
|
|
713
741
|
<ReasoningText>{children}</ReasoningText>
|
|
@@ -1137,304 +1165,6 @@ export function ExampleNav() {
|
|
|
1137
1165
|
|
|
1138
1166
|
```
|
|
1139
1167
|
|
|
1140
|
-
## components/gui-thread.tsx
|
|
1141
|
-
|
|
1142
|
-
```tsx
|
|
1143
|
-
import {
|
|
1144
|
-
ComposerAddAttachment,
|
|
1145
|
-
ComposerAttachments,
|
|
1146
|
-
UserMessageAttachments,
|
|
1147
|
-
} from "@/components/assistant-ui/attachment";
|
|
1148
|
-
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
|
1149
|
-
import { Button } from "@/components/ui/button";
|
|
1150
|
-
import { cn } from "@/lib/utils";
|
|
1151
|
-
import {
|
|
1152
|
-
ActionBarPrimitive,
|
|
1153
|
-
AuiIf,
|
|
1154
|
-
BranchPickerPrimitive,
|
|
1155
|
-
ComposerPrimitive,
|
|
1156
|
-
MessagePrimitive,
|
|
1157
|
-
SuggestionPrimitive,
|
|
1158
|
-
ThreadPrimitive,
|
|
1159
|
-
useAuiState,
|
|
1160
|
-
} from "@assistant-ui/react";
|
|
1161
|
-
import {
|
|
1162
|
-
ArrowDownIcon,
|
|
1163
|
-
ArrowUpIcon,
|
|
1164
|
-
ChevronLeftIcon,
|
|
1165
|
-
ChevronRightIcon,
|
|
1166
|
-
PencilIcon,
|
|
1167
|
-
SquareIcon,
|
|
1168
|
-
} from "lucide-react";
|
|
1169
|
-
import type { FC } from "react";
|
|
1170
|
-
import { AssistantMessageGui } from "@/components/assistant-message-gui";
|
|
1171
|
-
|
|
1172
|
-
/** Thread fork: swaps the assistant message renderer for the generative-ui bridge. */
|
|
1173
|
-
export const GuiThread: FC = () => {
|
|
1174
|
-
return (
|
|
1175
|
-
<ThreadPrimitive.Root
|
|
1176
|
-
className="aui-root aui-thread-root bg-background @container flex h-full flex-col"
|
|
1177
|
-
style={{
|
|
1178
|
-
["--thread-max-width" as string]: "44rem",
|
|
1179
|
-
["--composer-radius" as string]: "24px",
|
|
1180
|
-
["--composer-padding" as string]: "10px",
|
|
1181
|
-
}}
|
|
1182
|
-
>
|
|
1183
|
-
<ThreadPrimitive.Viewport
|
|
1184
|
-
turnAnchor="top"
|
|
1185
|
-
data-slot="aui_thread-viewport"
|
|
1186
|
-
className="relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth"
|
|
1187
|
-
>
|
|
1188
|
-
<div className="mx-auto flex w-full max-w-(--thread-max-width) flex-1 flex-col px-4 pt-4">
|
|
1189
|
-
<AuiIf condition={(s) => s.thread.isEmpty}>
|
|
1190
|
-
<ThreadWelcome />
|
|
1191
|
-
</AuiIf>
|
|
1192
|
-
|
|
1193
|
-
<div
|
|
1194
|
-
data-slot="aui_message-group"
|
|
1195
|
-
className="mb-10 flex flex-col gap-y-8 empty:hidden"
|
|
1196
|
-
>
|
|
1197
|
-
<ThreadPrimitive.Messages>
|
|
1198
|
-
{() => <ThreadMessage />}
|
|
1199
|
-
</ThreadPrimitive.Messages>
|
|
1200
|
-
</div>
|
|
1201
|
-
|
|
1202
|
-
<ThreadPrimitive.ViewportFooter className="aui-thread-viewport-footer bg-background sticky bottom-0 mt-auto flex flex-col gap-4 overflow-visible rounded-t-(--composer-radius) pb-4 md:pb-6">
|
|
1203
|
-
<ThreadScrollToBottom />
|
|
1204
|
-
<Composer />
|
|
1205
|
-
</ThreadPrimitive.ViewportFooter>
|
|
1206
|
-
</div>
|
|
1207
|
-
</ThreadPrimitive.Viewport>
|
|
1208
|
-
</ThreadPrimitive.Root>
|
|
1209
|
-
);
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
const ThreadMessage: FC = () => {
|
|
1213
|
-
const role = useAuiState((s) => s.message.role);
|
|
1214
|
-
const isEditing = useAuiState((s) => s.message.composer.isEditing);
|
|
1215
|
-
|
|
1216
|
-
if (isEditing) return <EditComposer />;
|
|
1217
|
-
if (role === "user") return <UserMessage />;
|
|
1218
|
-
return <AssistantMessageGui />;
|
|
1219
|
-
};
|
|
1220
|
-
|
|
1221
|
-
const ThreadScrollToBottom: FC = () => {
|
|
1222
|
-
return (
|
|
1223
|
-
<ThreadPrimitive.ScrollToBottom asChild>
|
|
1224
|
-
<TooltipIconButton
|
|
1225
|
-
tooltip="Scroll to bottom"
|
|
1226
|
-
variant="outline"
|
|
1227
|
-
className="aui-thread-scroll-to-bottom dark:border-border dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible"
|
|
1228
|
-
>
|
|
1229
|
-
<ArrowDownIcon />
|
|
1230
|
-
</TooltipIconButton>
|
|
1231
|
-
</ThreadPrimitive.ScrollToBottom>
|
|
1232
|
-
);
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
const ThreadWelcome: FC = () => {
|
|
1236
|
-
return (
|
|
1237
|
-
<div className="aui-thread-welcome-root my-auto flex grow flex-col">
|
|
1238
|
-
<div className="aui-thread-welcome-center flex w-full grow flex-col items-center justify-center">
|
|
1239
|
-
<div className="aui-thread-welcome-message flex size-full flex-col justify-center px-4">
|
|
1240
|
-
<h1 className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-2xl font-semibold duration-200">
|
|
1241
|
-
Compose UI from a spec
|
|
1242
|
-
</h1>
|
|
1243
|
-
<p className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200">
|
|
1244
|
-
Ask the agent to call render_gui with Card, Button, and Stack.
|
|
1245
|
-
</p>
|
|
1246
|
-
</div>
|
|
1247
|
-
</div>
|
|
1248
|
-
<ThreadSuggestions />
|
|
1249
|
-
</div>
|
|
1250
|
-
);
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
const ThreadSuggestions: FC = () => {
|
|
1254
|
-
return (
|
|
1255
|
-
<div className="aui-thread-welcome-suggestions grid w-full gap-2 pb-4 @md:grid-cols-2">
|
|
1256
|
-
<ThreadPrimitive.Suggestions>
|
|
1257
|
-
{() => <ThreadSuggestionItem />}
|
|
1258
|
-
</ThreadPrimitive.Suggestions>
|
|
1259
|
-
</div>
|
|
1260
|
-
);
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
const ThreadSuggestionItem: FC = () => {
|
|
1264
|
-
return (
|
|
1265
|
-
<div className="aui-thread-welcome-suggestion-display fade-in slide-in-from-bottom-2 animate-in fill-mode-both duration-200 nth-[n+3]:hidden @md:nth-[n+3]:block">
|
|
1266
|
-
<SuggestionPrimitive.Trigger send asChild>
|
|
1267
|
-
<Button
|
|
1268
|
-
variant="ghost"
|
|
1269
|
-
className="aui-thread-welcome-suggestion bg-background hover:bg-muted h-auto w-full flex-wrap items-start justify-start gap-1 rounded-3xl border px-4 py-3 text-start text-sm transition-colors @md:flex-col"
|
|
1270
|
-
>
|
|
1271
|
-
<SuggestionPrimitive.Title className="aui-thread-welcome-suggestion-text-1 font-medium" />
|
|
1272
|
-
<SuggestionPrimitive.Description className="aui-thread-welcome-suggestion-text-2 text-muted-foreground empty:hidden" />
|
|
1273
|
-
</Button>
|
|
1274
|
-
</SuggestionPrimitive.Trigger>
|
|
1275
|
-
</div>
|
|
1276
|
-
);
|
|
1277
|
-
};
|
|
1278
|
-
|
|
1279
|
-
const Composer: FC = () => {
|
|
1280
|
-
return (
|
|
1281
|
-
<ComposerPrimitive.Root className="aui-composer-root relative flex w-full flex-col">
|
|
1282
|
-
<ComposerPrimitive.AttachmentDropzone asChild>
|
|
1283
|
-
<div
|
|
1284
|
-
data-slot="aui_composer-shell"
|
|
1285
|
-
className="bg-background focus-within:border-ring/75 focus-within:ring-ring/20 data-[dragging=true]:border-ring data-[dragging=true]:bg-accent/50 flex w-full flex-col gap-2 rounded-(--composer-radius) border p-(--composer-padding) transition-shadow focus-within:ring-2 data-[dragging=true]:border-dashed"
|
|
1286
|
-
>
|
|
1287
|
-
<ComposerAttachments />
|
|
1288
|
-
<ComposerPrimitive.Input
|
|
1289
|
-
placeholder="Send a message..."
|
|
1290
|
-
className="aui-composer-input placeholder:text-muted-foreground/80 max-h-32 min-h-10 w-full resize-none bg-transparent px-1.75 py-1 text-sm outline-none"
|
|
1291
|
-
rows={1}
|
|
1292
|
-
autoFocus
|
|
1293
|
-
aria-label="Message input"
|
|
1294
|
-
/>
|
|
1295
|
-
<ComposerAction />
|
|
1296
|
-
</div>
|
|
1297
|
-
</ComposerPrimitive.AttachmentDropzone>
|
|
1298
|
-
</ComposerPrimitive.Root>
|
|
1299
|
-
);
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
|
-
const ComposerAction: FC = () => {
|
|
1303
|
-
return (
|
|
1304
|
-
<div className="aui-composer-action-wrapper relative flex items-center justify-between">
|
|
1305
|
-
<ComposerAddAttachment />
|
|
1306
|
-
<AuiIf condition={(s) => !s.thread.isRunning}>
|
|
1307
|
-
<ComposerPrimitive.Send asChild>
|
|
1308
|
-
<TooltipIconButton
|
|
1309
|
-
tooltip="Send message"
|
|
1310
|
-
side="bottom"
|
|
1311
|
-
type="button"
|
|
1312
|
-
variant="default"
|
|
1313
|
-
size="icon"
|
|
1314
|
-
className="aui-composer-send size-8 rounded-full"
|
|
1315
|
-
aria-label="Send message"
|
|
1316
|
-
>
|
|
1317
|
-
<ArrowUpIcon className="aui-composer-send-icon size-4" />
|
|
1318
|
-
</TooltipIconButton>
|
|
1319
|
-
</ComposerPrimitive.Send>
|
|
1320
|
-
</AuiIf>
|
|
1321
|
-
<AuiIf condition={(s) => s.thread.isRunning}>
|
|
1322
|
-
<ComposerPrimitive.Cancel asChild>
|
|
1323
|
-
<Button
|
|
1324
|
-
type="button"
|
|
1325
|
-
variant="default"
|
|
1326
|
-
size="icon"
|
|
1327
|
-
className="aui-composer-cancel size-8 rounded-full"
|
|
1328
|
-
aria-label="Stop generating"
|
|
1329
|
-
>
|
|
1330
|
-
<SquareIcon className="aui-composer-cancel-icon size-3 fill-current" />
|
|
1331
|
-
</Button>
|
|
1332
|
-
</ComposerPrimitive.Cancel>
|
|
1333
|
-
</AuiIf>
|
|
1334
|
-
</div>
|
|
1335
|
-
);
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
const UserMessage: FC = () => {
|
|
1339
|
-
return (
|
|
1340
|
-
<MessagePrimitive.Root
|
|
1341
|
-
data-slot="aui_user-message-root"
|
|
1342
|
-
className="fade-in slide-in-from-bottom-1 animate-in grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-150 [contain-intrinsic-size:auto_60px] [content-visibility:auto] [&:where(>*)]:col-start-2"
|
|
1343
|
-
data-role="user"
|
|
1344
|
-
>
|
|
1345
|
-
<UserMessageAttachments />
|
|
1346
|
-
|
|
1347
|
-
<div className="aui-user-message-content-wrapper relative col-start-2 min-w-0">
|
|
1348
|
-
<div className="aui-user-message-content peer bg-muted text-foreground rounded-2xl px-4 py-2.5 wrap-break-word empty:hidden">
|
|
1349
|
-
<MessagePrimitive.Parts />
|
|
1350
|
-
</div>
|
|
1351
|
-
<div className="aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full">
|
|
1352
|
-
<UserActionBar />
|
|
1353
|
-
</div>
|
|
1354
|
-
</div>
|
|
1355
|
-
|
|
1356
|
-
<BranchPicker
|
|
1357
|
-
data-slot="aui_user-branch-picker"
|
|
1358
|
-
className="col-span-full col-start-1 row-start-3 -me-1 justify-end"
|
|
1359
|
-
/>
|
|
1360
|
-
</MessagePrimitive.Root>
|
|
1361
|
-
);
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
|
-
const UserActionBar: FC = () => {
|
|
1365
|
-
return (
|
|
1366
|
-
<ActionBarPrimitive.Root
|
|
1367
|
-
hideWhenRunning
|
|
1368
|
-
autohide="not-last"
|
|
1369
|
-
className="aui-user-action-bar-root flex flex-col items-end"
|
|
1370
|
-
>
|
|
1371
|
-
<ActionBarPrimitive.Edit asChild>
|
|
1372
|
-
<TooltipIconButton tooltip="Edit" className="aui-user-action-edit p-4">
|
|
1373
|
-
<PencilIcon />
|
|
1374
|
-
</TooltipIconButton>
|
|
1375
|
-
</ActionBarPrimitive.Edit>
|
|
1376
|
-
</ActionBarPrimitive.Root>
|
|
1377
|
-
);
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
const EditComposer: FC = () => {
|
|
1381
|
-
return (
|
|
1382
|
-
<MessagePrimitive.Root
|
|
1383
|
-
data-slot="aui_edit-composer-wrapper"
|
|
1384
|
-
className="flex flex-col px-2"
|
|
1385
|
-
>
|
|
1386
|
-
<ComposerPrimitive.Root className="aui-edit-composer-root bg-muted ms-auto flex w-full max-w-[85%] flex-col rounded-2xl">
|
|
1387
|
-
<ComposerPrimitive.Input
|
|
1388
|
-
className="aui-edit-composer-input text-foreground min-h-14 w-full resize-none bg-transparent p-4 text-sm outline-none"
|
|
1389
|
-
autoFocus
|
|
1390
|
-
/>
|
|
1391
|
-
<div className="aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end">
|
|
1392
|
-
<ComposerPrimitive.Cancel asChild>
|
|
1393
|
-
<Button variant="ghost" size="sm">
|
|
1394
|
-
Cancel
|
|
1395
|
-
</Button>
|
|
1396
|
-
</ComposerPrimitive.Cancel>
|
|
1397
|
-
<ComposerPrimitive.Send asChild>
|
|
1398
|
-
<Button size="sm">Update</Button>
|
|
1399
|
-
</ComposerPrimitive.Send>
|
|
1400
|
-
</div>
|
|
1401
|
-
</ComposerPrimitive.Root>
|
|
1402
|
-
</MessagePrimitive.Root>
|
|
1403
|
-
);
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
|
1407
|
-
className,
|
|
1408
|
-
...rest
|
|
1409
|
-
}) => {
|
|
1410
|
-
return (
|
|
1411
|
-
<BranchPickerPrimitive.Root
|
|
1412
|
-
hideWhenSingleBranch
|
|
1413
|
-
className={cn(
|
|
1414
|
-
"aui-branch-picker-root text-muted-foreground -ms-2 me-2 inline-flex items-center text-xs",
|
|
1415
|
-
className,
|
|
1416
|
-
)}
|
|
1417
|
-
{...rest}
|
|
1418
|
-
>
|
|
1419
|
-
<BranchPickerPrimitive.Previous asChild>
|
|
1420
|
-
<TooltipIconButton tooltip="Previous">
|
|
1421
|
-
<ChevronLeftIcon />
|
|
1422
|
-
</TooltipIconButton>
|
|
1423
|
-
</BranchPickerPrimitive.Previous>
|
|
1424
|
-
<span className="aui-branch-picker-state font-medium">
|
|
1425
|
-
<BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />
|
|
1426
|
-
</span>
|
|
1427
|
-
<BranchPickerPrimitive.Next asChild>
|
|
1428
|
-
<TooltipIconButton tooltip="Next">
|
|
1429
|
-
<ChevronRightIcon />
|
|
1430
|
-
</TooltipIconButton>
|
|
1431
|
-
</BranchPickerPrimitive.Next>
|
|
1432
|
-
</BranchPickerPrimitive.Root>
|
|
1433
|
-
);
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
```
|
|
1437
|
-
|
|
1438
1168
|
## components/gui/index.tsx
|
|
1439
1169
|
|
|
1440
1170
|
```tsx
|
|
@@ -1772,17 +1502,17 @@ export default withAui(nextConfig);
|
|
|
1772
1502
|
"test": "vitest run"
|
|
1773
1503
|
},
|
|
1774
1504
|
"dependencies": {
|
|
1775
|
-
"@ai-sdk/openai": "^3.0.
|
|
1505
|
+
"@ai-sdk/openai": "^3.0.71",
|
|
1776
1506
|
"@assistant-ui/react": "workspace:*",
|
|
1777
1507
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1778
1508
|
"@assistant-ui/ui": "workspace:*",
|
|
1779
|
-
"ai": "^6.0.
|
|
1509
|
+
"ai": "^6.0.204",
|
|
1780
1510
|
"class-variance-authority": "^0.7.1",
|
|
1781
1511
|
"clsx": "^2.1.1",
|
|
1782
|
-
"lucide-react": "^1.
|
|
1783
|
-
"next": "^16.2.
|
|
1784
|
-
"react": "^19.2.
|
|
1785
|
-
"react-dom": "^19.2.
|
|
1512
|
+
"lucide-react": "^1.18.0",
|
|
1513
|
+
"next": "^16.2.9",
|
|
1514
|
+
"react": "^19.2.7",
|
|
1515
|
+
"react-dom": "^19.2.7",
|
|
1786
1516
|
"recharts": "^3.8.1",
|
|
1787
1517
|
"tailwind-merge": "^3.6.0",
|
|
1788
1518
|
"zod": "^4.4.3"
|
|
@@ -1790,15 +1520,15 @@ export default withAui(nextConfig);
|
|
|
1790
1520
|
"devDependencies": {
|
|
1791
1521
|
"@assistant-ui/next": "workspace:*",
|
|
1792
1522
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1793
|
-
"@tailwindcss/postcss": "^4.3.
|
|
1794
|
-
"@types/node": "^25.9.
|
|
1795
|
-
"@types/react": "^19.2.
|
|
1523
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
1524
|
+
"@types/node": "^25.9.3",
|
|
1525
|
+
"@types/react": "^19.2.17",
|
|
1796
1526
|
"@types/react-dom": "^19.2.3",
|
|
1797
1527
|
"postcss": "^8.5.15",
|
|
1798
|
-
"tailwindcss": "^4.3.
|
|
1528
|
+
"tailwindcss": "^4.3.1",
|
|
1799
1529
|
"tw-animate-css": "^1.4.0",
|
|
1800
1530
|
"typescript": "^6.0.3",
|
|
1801
|
-
"vitest": "^4.1.
|
|
1531
|
+
"vitest": "^4.1.8"
|
|
1802
1532
|
}
|
|
1803
1533
|
}
|
|
1804
1534
|
|
|
@@ -305,25 +305,25 @@ export default withAui(nextConfig);
|
|
|
305
305
|
"@assistant-ui/react-google-adk": "workspace:*",
|
|
306
306
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
307
307
|
"@assistant-ui/ui": "workspace:*",
|
|
308
|
-
"@google/adk": "^1.
|
|
308
|
+
"@google/adk": "^1.2.0",
|
|
309
309
|
"class-variance-authority": "^0.7.1",
|
|
310
310
|
"clsx": "^2.1.1",
|
|
311
|
-
"lucide-react": "^1.
|
|
312
|
-
"next": "^16.2.
|
|
313
|
-
"react": "^19.2.
|
|
314
|
-
"react-dom": "^19.2.
|
|
311
|
+
"lucide-react": "^1.18.0",
|
|
312
|
+
"next": "^16.2.9",
|
|
313
|
+
"react": "^19.2.7",
|
|
314
|
+
"react-dom": "^19.2.7",
|
|
315
315
|
"tailwind-merge": "^3.6.0",
|
|
316
316
|
"zod": "^4.4.3"
|
|
317
317
|
},
|
|
318
318
|
"devDependencies": {
|
|
319
319
|
"@assistant-ui/next": "workspace:*",
|
|
320
320
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
321
|
-
"@tailwindcss/postcss": "^4.3.
|
|
322
|
-
"@types/node": "^25.9.
|
|
323
|
-
"@types/react": "^19.2.
|
|
321
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
322
|
+
"@types/node": "^25.9.3",
|
|
323
|
+
"@types/react": "^19.2.17",
|
|
324
324
|
"@types/react-dom": "^19.2.3",
|
|
325
325
|
"postcss": "^8.5.15",
|
|
326
|
-
"tailwindcss": "^4.3.
|
|
326
|
+
"tailwindcss": "^4.3.1",
|
|
327
327
|
"tw-animate-css": "^1.4.0",
|
|
328
328
|
"typescript": "^6.0.3"
|
|
329
329
|
}
|
|
@@ -271,19 +271,19 @@ export default withAui(nextConfig);
|
|
|
271
271
|
},
|
|
272
272
|
"dependencies": {
|
|
273
273
|
"heat-graph": "workspace:*",
|
|
274
|
-
"next": "^16.2.
|
|
275
|
-
"react": "^19.2.
|
|
276
|
-
"react-dom": "^19.2.
|
|
274
|
+
"next": "^16.2.9",
|
|
275
|
+
"react": "^19.2.7",
|
|
276
|
+
"react-dom": "^19.2.7"
|
|
277
277
|
},
|
|
278
278
|
"devDependencies": {
|
|
279
279
|
"@assistant-ui/next": "workspace:*",
|
|
280
280
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
281
|
-
"@tailwindcss/postcss": "^4.3.
|
|
282
|
-
"@types/node": "^25.9.
|
|
283
|
-
"@types/react": "^19.2.
|
|
281
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
282
|
+
"@types/node": "^25.9.3",
|
|
283
|
+
"@types/react": "^19.2.17",
|
|
284
284
|
"@types/react-dom": "^19.2.3",
|
|
285
285
|
"postcss": "^8.5.15",
|
|
286
|
-
"tailwindcss": "^4.3.
|
|
286
|
+
"tailwindcss": "^4.3.1",
|
|
287
287
|
"typescript": "^6.0.3"
|
|
288
288
|
}
|
|
289
289
|
}
|
|
@@ -380,27 +380,27 @@ export default withAui(nextConfig);
|
|
|
380
380
|
"start": "next start"
|
|
381
381
|
},
|
|
382
382
|
"dependencies": {
|
|
383
|
-
"@ai-sdk/openai": "^3.0.
|
|
383
|
+
"@ai-sdk/openai": "^3.0.71",
|
|
384
384
|
"@assistant-ui/react": "workspace:*",
|
|
385
385
|
"@assistant-ui/ui": "workspace:*",
|
|
386
|
-
"ai": "^6.0.
|
|
386
|
+
"ai": "^6.0.204",
|
|
387
387
|
"class-variance-authority": "^0.7.1",
|
|
388
388
|
"clsx": "^2.1.1",
|
|
389
|
-
"lucide-react": "^1.
|
|
390
|
-
"next": "^16.2.
|
|
391
|
-
"react": "^19.2.
|
|
392
|
-
"react-dom": "^19.2.
|
|
389
|
+
"lucide-react": "^1.18.0",
|
|
390
|
+
"next": "^16.2.9",
|
|
391
|
+
"react": "^19.2.7",
|
|
392
|
+
"react-dom": "^19.2.7",
|
|
393
393
|
"tailwind-merge": "^3.6.0"
|
|
394
394
|
},
|
|
395
395
|
"devDependencies": {
|
|
396
396
|
"@assistant-ui/next": "workspace:*",
|
|
397
397
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
398
|
-
"@tailwindcss/postcss": "^4.3.
|
|
399
|
-
"@types/node": "^25.9.
|
|
400
|
-
"@types/react": "^19.2.
|
|
398
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
399
|
+
"@types/node": "^25.9.3",
|
|
400
|
+
"@types/react": "^19.2.17",
|
|
401
401
|
"@types/react-dom": "^19.2.3",
|
|
402
402
|
"postcss": "^8.5.15",
|
|
403
|
-
"tailwindcss": "^4.3.
|
|
403
|
+
"tailwindcss": "^4.3.1",
|
|
404
404
|
"tw-animate-css": "^1.4.0",
|
|
405
405
|
"typescript": "^6.0.3"
|
|
406
406
|
}
|