@assistant-ui/mcp-docs-server 0.1.33 → 0.1.34
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 +5 -5
- package/.docs/organized/code-examples/with-a2a.md +5 -5
- package/.docs/organized/code-examples/with-ag-ui.md +9 -9
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
- package/.docs/organized/code-examples/with-artifacts.md +37 -31
- package/.docs/organized/code-examples/with-assistant-transport.md +8 -8
- package/.docs/organized/code-examples/with-browser-extension.md +5 -5
- package/.docs/organized/code-examples/with-chain-of-thought.md +68 -47
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +7 -7
- package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +8 -8
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
- package/.docs/organized/code-examples/with-expo.md +33 -24
- package/.docs/organized/code-examples/with-external-store.md +5 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +10 -10
- package/.docs/organized/code-examples/with-generative-ui.md +70 -64
- package/.docs/organized/code-examples/with-google-adk.md +6 -6
- package/.docs/organized/code-examples/with-heat-graph.md +5 -5
- package/.docs/organized/code-examples/with-image-generation.md +7 -7
- package/.docs/organized/code-examples/with-interactables.md +7 -7
- package/.docs/organized/code-examples/with-langchain.md +7 -7
- package/.docs/organized/code-examples/with-langgraph.md +30 -26
- package/.docs/organized/code-examples/with-livekit.md +8 -8
- package/.docs/organized/code-examples/with-mcp.md +8 -8
- package/.docs/organized/code-examples/with-opencode.md +6 -6
- package/.docs/organized/code-examples/with-react-hook-form.md +7 -7
- package/.docs/organized/code-examples/with-react-ink.md +295 -100
- package/.docs/organized/code-examples/with-react-router.md +11 -11
- package/.docs/organized/code-examples/with-resumable-stream.md +8 -8
- package/.docs/organized/code-examples/with-store.md +64 -64
- package/.docs/organized/code-examples/with-tanstack.md +8 -8
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -5
- package/.docs/raw/docs/(docs)/architecture.mdx +52 -41
- 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/integrations/react-ai-sdk.mdx +14 -3
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +94 -3
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +5 -69
- package/.docs/raw/docs/ink/adapters.mdx +23 -1
- package/.docs/raw/docs/ink/hooks.mdx +20 -17
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +14 -8
- package/.docs/raw/docs/react-native/hooks.mdx +25 -17
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +41 -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/custom/assistant-transport.mdx +54 -12
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +62 -4
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +12 -0
- 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/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 +27 -27
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +4 -4
- package/.docs/raw/docs/ui/mermaid.mdx +16 -9
- package/.docs/raw/docs/ui/part-grouping.mdx +2 -2
- 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
|
@@ -774,16 +774,16 @@ export default withAui(nextConfig);
|
|
|
774
774
|
"@assistant-ui/react-o11y": "workspace:*",
|
|
775
775
|
"@assistant-ui/store": "workspace:*",
|
|
776
776
|
"@assistant-ui/tap": "workspace:*",
|
|
777
|
-
"next": "^16.2.
|
|
778
|
-
"react": "^19.2.
|
|
779
|
-
"react-dom": "^19.2.
|
|
777
|
+
"next": "^16.2.7",
|
|
778
|
+
"react": "^19.2.7",
|
|
779
|
+
"react-dom": "^19.2.7"
|
|
780
780
|
},
|
|
781
781
|
"devDependencies": {
|
|
782
782
|
"@assistant-ui/next": "workspace:*",
|
|
783
783
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
784
784
|
"@tailwindcss/postcss": "^4.3.0",
|
|
785
|
-
"@types/node": "^25.9.
|
|
786
|
-
"@types/react": "^19.2.
|
|
785
|
+
"@types/node": "^25.9.2",
|
|
786
|
+
"@types/react": "^19.2.17",
|
|
787
787
|
"@types/react-dom": "^19.2.3",
|
|
788
788
|
"postcss": "^8.5.15",
|
|
789
789
|
"tailwindcss": "^4.3.0",
|
|
@@ -556,17 +556,17 @@ export default withAui(nextConfig);
|
|
|
556
556
|
"class-variance-authority": "^0.7.1",
|
|
557
557
|
"clsx": "^2.1.1",
|
|
558
558
|
"lucide-react": "^1.17.0",
|
|
559
|
-
"next": "^16.2.
|
|
560
|
-
"react": "^19.2.
|
|
561
|
-
"react-dom": "^19.2.
|
|
559
|
+
"next": "^16.2.7",
|
|
560
|
+
"react": "^19.2.7",
|
|
561
|
+
"react-dom": "^19.2.7",
|
|
562
562
|
"tailwind-merge": "^3.6.0"
|
|
563
563
|
},
|
|
564
564
|
"devDependencies": {
|
|
565
565
|
"@assistant-ui/next": "workspace:*",
|
|
566
566
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
567
567
|
"@tailwindcss/postcss": "^4.3.0",
|
|
568
|
-
"@types/node": "^25.9.
|
|
569
|
-
"@types/react": "^19.2.
|
|
568
|
+
"@types/node": "^25.9.2",
|
|
569
|
+
"@types/react": "^19.2.17",
|
|
570
570
|
"@types/react-dom": "^19.2.3",
|
|
571
571
|
"postcss": "^8.5.15",
|
|
572
572
|
"tailwindcss": "^4.3.0",
|
|
@@ -263,16 +263,16 @@ export function MyRuntimeProvider({
|
|
|
263
263
|
"use client";
|
|
264
264
|
|
|
265
265
|
import {
|
|
266
|
+
defineToolkit,
|
|
266
267
|
useAui,
|
|
267
268
|
AuiProvider,
|
|
268
269
|
Suggestions,
|
|
269
270
|
Tools,
|
|
270
|
-
type Toolkit,
|
|
271
271
|
} from "@assistant-ui/react";
|
|
272
272
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
273
273
|
import { PlusIcon } from "lucide-react";
|
|
274
274
|
|
|
275
|
-
const toolkit = {
|
|
275
|
+
const toolkit = defineToolkit({
|
|
276
276
|
browser_alert: {
|
|
277
277
|
description: "Display a native browser alert dialog to the user.",
|
|
278
278
|
parameters: {
|
|
@@ -306,7 +306,7 @@ const toolkit = {
|
|
|
306
306
|
</div>
|
|
307
307
|
),
|
|
308
308
|
},
|
|
309
|
-
}
|
|
309
|
+
});
|
|
310
310
|
|
|
311
311
|
function NewThreadButton() {
|
|
312
312
|
const aui = useAui();
|
|
@@ -420,7 +420,7 @@ export default withAui(nextConfig);
|
|
|
420
420
|
"start": "next start"
|
|
421
421
|
},
|
|
422
422
|
"dependencies": {
|
|
423
|
-
"@ag-ui/client": "^0.0.
|
|
423
|
+
"@ag-ui/client": "^0.0.55",
|
|
424
424
|
"@assistant-ui/react": "workspace:*",
|
|
425
425
|
"@assistant-ui/react-ag-ui": "workspace:*",
|
|
426
426
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
@@ -428,17 +428,17 @@ export default withAui(nextConfig);
|
|
|
428
428
|
"class-variance-authority": "^0.7.1",
|
|
429
429
|
"clsx": "^2.1.1",
|
|
430
430
|
"lucide-react": "^1.17.0",
|
|
431
|
-
"next": "^16.2.
|
|
432
|
-
"react": "^19.2.
|
|
433
|
-
"react-dom": "^19.2.
|
|
431
|
+
"next": "^16.2.7",
|
|
432
|
+
"react": "^19.2.7",
|
|
433
|
+
"react-dom": "^19.2.7",
|
|
434
434
|
"tailwind-merge": "^3.6.0"
|
|
435
435
|
},
|
|
436
436
|
"devDependencies": {
|
|
437
437
|
"@assistant-ui/next": "workspace:*",
|
|
438
438
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
439
439
|
"@tailwindcss/postcss": "^4.3.0",
|
|
440
|
-
"@types/node": "^25.9.
|
|
441
|
-
"@types/react": "^19.2.
|
|
440
|
+
"@types/node": "^25.9.2",
|
|
441
|
+
"@types/react": "^19.2.17",
|
|
442
442
|
"@types/react-dom": "^19.2.3",
|
|
443
443
|
"postcss": "^8.5.15",
|
|
444
444
|
"tailwindcss": "^4.3.0",
|
|
@@ -316,18 +316,18 @@ export default withAui(nextConfig);
|
|
|
316
316
|
"start": "next start"
|
|
317
317
|
},
|
|
318
318
|
"dependencies": {
|
|
319
|
-
"@ai-sdk/openai": "^3.0.
|
|
319
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
320
320
|
"@assistant-ui/react": "workspace:*",
|
|
321
321
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
322
322
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
323
323
|
"@assistant-ui/ui": "workspace:*",
|
|
324
|
-
"ai": "^6.0.
|
|
324
|
+
"ai": "^6.0.197",
|
|
325
325
|
"class-variance-authority": "^0.7.1",
|
|
326
326
|
"clsx": "^2.1.1",
|
|
327
327
|
"lucide-react": "^1.17.0",
|
|
328
|
-
"next": "^16.2.
|
|
329
|
-
"react": "^19.2.
|
|
330
|
-
"react-dom": "^19.2.
|
|
328
|
+
"next": "^16.2.7",
|
|
329
|
+
"react": "^19.2.7",
|
|
330
|
+
"react-dom": "^19.2.7",
|
|
331
331
|
"tailwind-merge": "^3.6.0",
|
|
332
332
|
"zod": "^4.4.3"
|
|
333
333
|
},
|
|
@@ -335,8 +335,8 @@ export default withAui(nextConfig);
|
|
|
335
335
|
"@assistant-ui/next": "workspace:*",
|
|
336
336
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
337
337
|
"@tailwindcss/postcss": "^4.3.0",
|
|
338
|
-
"@types/node": "^25.9.
|
|
339
|
-
"@types/react": "^19.2.
|
|
338
|
+
"@types/node": "^25.9.2",
|
|
339
|
+
"@types/react": "^19.2.17",
|
|
340
340
|
"@types/react-dom": "^19.2.3",
|
|
341
341
|
"postcss": "^8.5.15",
|
|
342
342
|
"tailwindcss": "^4.3.0",
|
|
@@ -212,7 +212,6 @@ import { Thread } from "@/components/assistant-ui/thread";
|
|
|
212
212
|
import {
|
|
213
213
|
AssistantRuntimeProvider,
|
|
214
214
|
Tools,
|
|
215
|
-
type Toolkit,
|
|
216
215
|
useAui,
|
|
217
216
|
useAuiState,
|
|
218
217
|
AuiProvider,
|
|
@@ -220,30 +219,9 @@ import {
|
|
|
220
219
|
} from "@assistant-ui/react";
|
|
221
220
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
222
221
|
import type { ToolCallMessagePart } from "@assistant-ui/react";
|
|
223
|
-
import {
|
|
222
|
+
import { CodeIcon, EyeIcon } from "lucide-react";
|
|
224
223
|
import { useState } from "react";
|
|
225
|
-
import
|
|
226
|
-
|
|
227
|
-
const toolkit = {
|
|
228
|
-
render_html: {
|
|
229
|
-
description:
|
|
230
|
-
"Whenever the user asks for HTML code, call this function. The user will see the HTML code rendered in their browser.",
|
|
231
|
-
parameters: z.object({
|
|
232
|
-
code: z.string(),
|
|
233
|
-
}),
|
|
234
|
-
execute: async () => {
|
|
235
|
-
return {};
|
|
236
|
-
},
|
|
237
|
-
render: () => {
|
|
238
|
-
return (
|
|
239
|
-
<div className="bg-primary text-primary-foreground my-2 inline-flex items-center gap-2 rounded-full border px-4 py-2">
|
|
240
|
-
<TerminalIcon className="size-4" />
|
|
241
|
-
render_html({ code: "..." })
|
|
242
|
-
</div>
|
|
243
|
-
);
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
} satisfies Toolkit;
|
|
224
|
+
import toolkit from "./toolkit";
|
|
247
225
|
|
|
248
226
|
function ArtifactsView() {
|
|
249
227
|
const [tab, setTab] = useState<"source" | "preview">("source");
|
|
@@ -359,6 +337,34 @@ export default function Home() {
|
|
|
359
337
|
|
|
360
338
|
```
|
|
361
339
|
|
|
340
|
+
## app/toolkit.tsx
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
"use generative";
|
|
344
|
+
|
|
345
|
+
import { defineToolkit, externalTool } from "@assistant-ui/react";
|
|
346
|
+
import { TerminalIcon } from "lucide-react";
|
|
347
|
+
import { z } from "zod";
|
|
348
|
+
|
|
349
|
+
export default defineToolkit({
|
|
350
|
+
render_html: {
|
|
351
|
+
parameters: z.object({
|
|
352
|
+
code: z.string(),
|
|
353
|
+
}),
|
|
354
|
+
execute: externalTool(),
|
|
355
|
+
render: () => {
|
|
356
|
+
return (
|
|
357
|
+
<div className="bg-primary text-primary-foreground my-2 inline-flex items-center gap-2 rounded-full border px-4 py-2">
|
|
358
|
+
<TerminalIcon className="size-4" />
|
|
359
|
+
render_html({ code: "..." })
|
|
360
|
+
</div>
|
|
361
|
+
);
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
|
|
362
368
|
## components.json
|
|
363
369
|
|
|
364
370
|
```json
|
|
@@ -420,18 +426,18 @@ export default withAui(nextConfig);
|
|
|
420
426
|
"start": "next start"
|
|
421
427
|
},
|
|
422
428
|
"dependencies": {
|
|
423
|
-
"@ai-sdk/openai": "^3.0.
|
|
429
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
424
430
|
"@assistant-ui/react": "workspace:*",
|
|
425
431
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
426
432
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
427
433
|
"@assistant-ui/ui": "workspace:*",
|
|
428
|
-
"ai": "^6.0.
|
|
434
|
+
"ai": "^6.0.197",
|
|
429
435
|
"class-variance-authority": "^0.7.1",
|
|
430
436
|
"clsx": "^2.1.1",
|
|
431
437
|
"lucide-react": "^1.17.0",
|
|
432
|
-
"next": "^16.2.
|
|
433
|
-
"react": "^19.2.
|
|
434
|
-
"react-dom": "^19.2.
|
|
438
|
+
"next": "^16.2.7",
|
|
439
|
+
"react": "^19.2.7",
|
|
440
|
+
"react-dom": "^19.2.7",
|
|
435
441
|
"tailwind-merge": "^3.6.0",
|
|
436
442
|
"zod": "^4.4.3"
|
|
437
443
|
},
|
|
@@ -439,8 +445,8 @@ export default withAui(nextConfig);
|
|
|
439
445
|
"@assistant-ui/next": "workspace:*",
|
|
440
446
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
441
447
|
"@tailwindcss/postcss": "^4.3.0",
|
|
442
|
-
"@types/node": "^25.9.
|
|
443
|
-
"@types/react": "^19.2.
|
|
448
|
+
"@types/node": "^25.9.2",
|
|
449
|
+
"@types/react": "^19.2.17",
|
|
444
450
|
"@types/react-dom": "^19.2.3",
|
|
445
451
|
"postcss": "^8.5.15",
|
|
446
452
|
"tailwindcss": "^4.3.0",
|
|
@@ -170,9 +170,9 @@ export default function RootLayout({
|
|
|
170
170
|
|
|
171
171
|
import {
|
|
172
172
|
AssistantRuntimeProvider,
|
|
173
|
+
defineToolkit,
|
|
173
174
|
Tools,
|
|
174
175
|
type AssistantTransportConnectionMetadata,
|
|
175
|
-
type Toolkit,
|
|
176
176
|
unstable_createMessageConverter as createMessageConverter,
|
|
177
177
|
useAui,
|
|
178
178
|
useAssistantTransportRuntime,
|
|
@@ -184,7 +184,7 @@ import {
|
|
|
184
184
|
import type { ReactNode } from "react";
|
|
185
185
|
import { z } from "zod";
|
|
186
186
|
|
|
187
|
-
const toolkit = {
|
|
187
|
+
const toolkit = defineToolkit({
|
|
188
188
|
get_weather: {
|
|
189
189
|
type: "frontend",
|
|
190
190
|
description: "Get the current weather for a city",
|
|
@@ -232,7 +232,7 @@ const toolkit = {
|
|
|
232
232
|
: "Weather lookup complete",
|
|
233
233
|
},
|
|
234
234
|
},
|
|
235
|
-
}
|
|
235
|
+
});
|
|
236
236
|
|
|
237
237
|
type MyRuntimeProviderProps = {
|
|
238
238
|
children: ReactNode;
|
|
@@ -434,9 +434,9 @@ export default withAui(nextConfig);
|
|
|
434
434
|
"class-variance-authority": "^0.7.1",
|
|
435
435
|
"clsx": "^2.1.1",
|
|
436
436
|
"lucide-react": "^1.17.0",
|
|
437
|
-
"next": "^16.2.
|
|
438
|
-
"react": "^19.2.
|
|
439
|
-
"react-dom": "^19.2.
|
|
437
|
+
"next": "^16.2.7",
|
|
438
|
+
"react": "^19.2.7",
|
|
439
|
+
"react-dom": "^19.2.7",
|
|
440
440
|
"tailwind-merge": "^3.6.0",
|
|
441
441
|
"zod": "^4.4.3"
|
|
442
442
|
},
|
|
@@ -444,8 +444,8 @@ export default withAui(nextConfig);
|
|
|
444
444
|
"@assistant-ui/next": "workspace:*",
|
|
445
445
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
446
446
|
"@tailwindcss/postcss": "^4.3.0",
|
|
447
|
-
"@types/node": "^25.9.
|
|
448
|
-
"@types/react": "^19.2.
|
|
447
|
+
"@types/node": "^25.9.2",
|
|
448
|
+
"@types/react": "^19.2.17",
|
|
449
449
|
"@types/react-dom": "^19.2.3",
|
|
450
450
|
"postcss": "^8.5.15",
|
|
451
451
|
"tailwindcss": "^4.3.0",
|
|
@@ -230,15 +230,15 @@ export function MyThread() {
|
|
|
230
230
|
"class-variance-authority": "^0.7.1",
|
|
231
231
|
"clsx": "^2.1.1",
|
|
232
232
|
"lucide-react": "^1.17.0",
|
|
233
|
-
"react": "^19.2.
|
|
234
|
-
"react-dom": "^19.2.
|
|
233
|
+
"react": "^19.2.7",
|
|
234
|
+
"react-dom": "^19.2.7",
|
|
235
235
|
"tailwind-merge": "^3.6.0"
|
|
236
236
|
},
|
|
237
237
|
"devDependencies": {
|
|
238
238
|
"@tailwindcss/postcss": "^4.3.0",
|
|
239
|
-
"@types/chrome": "^0.1.
|
|
240
|
-
"@types/node": "^25.9.
|
|
241
|
-
"@types/react": "^19.2.
|
|
239
|
+
"@types/chrome": "^0.1.43",
|
|
240
|
+
"@types/node": "^25.9.2",
|
|
241
|
+
"@types/react": "^19.2.17",
|
|
242
242
|
"@types/react-dom": "^19.2.3",
|
|
243
243
|
"esbuild": "^0.28.0",
|
|
244
244
|
"postcss": "^8.5.15",
|
|
@@ -14,11 +14,14 @@ import {
|
|
|
14
14
|
JsonToSseTransformStream,
|
|
15
15
|
} from "ai";
|
|
16
16
|
import type { UIMessage, UIMessageStreamWriter } from "ai";
|
|
17
|
-
import {
|
|
17
|
+
import { AISDKToolkit } from "@assistant-ui/react-ai-sdk";
|
|
18
18
|
import { z } from "zod";
|
|
19
|
+
import toolkit from "../../toolkit";
|
|
19
20
|
|
|
20
21
|
export const maxDuration = 30;
|
|
21
22
|
|
|
23
|
+
const aiToolkit = new AISDKToolkit({ toolkit });
|
|
24
|
+
|
|
22
25
|
type SearchResult = { id: string; url: string; title: string };
|
|
23
26
|
|
|
24
27
|
const searchSources = (query: string): SearchResult[] => {
|
|
@@ -112,13 +115,15 @@ async function streamModel(
|
|
|
112
115
|
}),
|
|
113
116
|
});
|
|
114
117
|
|
|
118
|
+
const toolkitTools = await aiToolkit.tools({ frontend: frontendToolDefs });
|
|
119
|
+
|
|
115
120
|
const result = streamText({
|
|
116
121
|
// Reasoning model so the chain-of-thought group has real content.
|
|
117
122
|
model: openai("gpt-5.4-mini"),
|
|
118
123
|
messages: await convertToModelMessages(messages),
|
|
119
124
|
stopWhen: stepCountIs(10),
|
|
120
125
|
tools: {
|
|
121
|
-
...
|
|
126
|
+
...toolkitTools,
|
|
122
127
|
get_current_weather: tool({
|
|
123
128
|
description: "Get the current weather for a city",
|
|
124
129
|
inputSchema: zodSchema(z.object({ city: z.string() })),
|
|
@@ -682,51 +687,14 @@ const Composer: FC = () => {
|
|
|
682
687
|
import {
|
|
683
688
|
AssistantRuntimeProvider,
|
|
684
689
|
Tools,
|
|
685
|
-
type Toolkit,
|
|
686
690
|
useAui,
|
|
687
691
|
AuiProvider,
|
|
688
692
|
Suggestions,
|
|
689
693
|
} from "@assistant-ui/react";
|
|
690
694
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
691
|
-
import { z } from "zod";
|
|
692
695
|
import { MyThread } from "./MyThread";
|
|
693
696
|
import { lastAssistantMessageIsCompleteWithApprovalResponses } from "ai";
|
|
694
|
-
|
|
695
|
-
const toolkit = {
|
|
696
|
-
execute_js: {
|
|
697
|
-
type: "frontend",
|
|
698
|
-
description: "Execute JavaScript code and return the result",
|
|
699
|
-
parameters: z.object({
|
|
700
|
-
code: z.string().describe("The JavaScript code to execute"),
|
|
701
|
-
}),
|
|
702
|
-
execute: async ({ code }) => {
|
|
703
|
-
try {
|
|
704
|
-
const result = eval(code);
|
|
705
|
-
return { success: true, result: String(result) };
|
|
706
|
-
} catch (e) {
|
|
707
|
-
return { success: false, error: String(e) };
|
|
708
|
-
}
|
|
709
|
-
},
|
|
710
|
-
render: ({ args, result, status }) => (
|
|
711
|
-
<div className="bg-muted/30 my-2 rounded-lg border p-4 text-sm">
|
|
712
|
-
<p className="mb-1 font-semibold">execute_js</p>
|
|
713
|
-
<pre className="bg-background rounded p-2 font-mono text-xs whitespace-pre-wrap">
|
|
714
|
-
{args.code}
|
|
715
|
-
</pre>
|
|
716
|
-
{status.type !== "running" && result && (
|
|
717
|
-
<div className="mt-2 border-t pt-2">
|
|
718
|
-
<p className="text-muted-foreground font-semibold">
|
|
719
|
-
{result.success ? "Result:" : "Error:"}
|
|
720
|
-
</p>
|
|
721
|
-
<pre className="font-mono text-xs whitespace-pre-wrap">
|
|
722
|
-
{result.success ? result.result : result.error}
|
|
723
|
-
</pre>
|
|
724
|
-
</div>
|
|
725
|
-
)}
|
|
726
|
-
</div>
|
|
727
|
-
),
|
|
728
|
-
},
|
|
729
|
-
} satisfies Toolkit;
|
|
697
|
+
import toolkit from "./toolkit";
|
|
730
698
|
|
|
731
699
|
function MyThreadWithSuggestions() {
|
|
732
700
|
const aui = useAui({
|
|
@@ -771,6 +739,59 @@ export default function Home() {
|
|
|
771
739
|
|
|
772
740
|
```
|
|
773
741
|
|
|
742
|
+
## app/toolkit.tsx
|
|
743
|
+
|
|
744
|
+
```tsx
|
|
745
|
+
"use generative";
|
|
746
|
+
|
|
747
|
+
import { defineToolkit } from "@assistant-ui/react";
|
|
748
|
+
import { z } from "zod";
|
|
749
|
+
|
|
750
|
+
type ExecuteJsResult =
|
|
751
|
+
| { success: true; result: string }
|
|
752
|
+
| { success: false; error: string };
|
|
753
|
+
|
|
754
|
+
export default defineToolkit({
|
|
755
|
+
execute_js: {
|
|
756
|
+
description: "Execute JavaScript code and return the result",
|
|
757
|
+
parameters: z.object({
|
|
758
|
+
code: z.string().describe("The JavaScript code to execute"),
|
|
759
|
+
}),
|
|
760
|
+
execute: async ({ code }) => {
|
|
761
|
+
"use client";
|
|
762
|
+
try {
|
|
763
|
+
const result = eval(code);
|
|
764
|
+
return { success: true, result: String(result) };
|
|
765
|
+
} catch (e) {
|
|
766
|
+
return { success: false, error: String(e) };
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
render: ({ args, result, status }) => {
|
|
770
|
+
const output = result as ExecuteJsResult | undefined;
|
|
771
|
+
return (
|
|
772
|
+
<div className="bg-muted/30 my-2 rounded-lg border p-4 text-sm">
|
|
773
|
+
<p className="mb-1 font-semibold">execute_js</p>
|
|
774
|
+
<pre className="bg-background rounded p-2 font-mono text-xs whitespace-pre-wrap">
|
|
775
|
+
{args.code}
|
|
776
|
+
</pre>
|
|
777
|
+
{status.type !== "running" && output && (
|
|
778
|
+
<div className="mt-2 border-t pt-2">
|
|
779
|
+
<p className="text-muted-foreground font-semibold">
|
|
780
|
+
{output.success ? "Result:" : "Error:"}
|
|
781
|
+
</p>
|
|
782
|
+
<pre className="font-mono text-xs whitespace-pre-wrap">
|
|
783
|
+
{output.success ? output.result : output.error}
|
|
784
|
+
</pre>
|
|
785
|
+
</div>
|
|
786
|
+
)}
|
|
787
|
+
</div>
|
|
788
|
+
);
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
```
|
|
794
|
+
|
|
774
795
|
## components.json
|
|
775
796
|
|
|
776
797
|
```json
|
|
@@ -828,18 +849,18 @@ export default withAui(nextConfig);
|
|
|
828
849
|
"start": "next start"
|
|
829
850
|
},
|
|
830
851
|
"dependencies": {
|
|
831
|
-
"@ai-sdk/openai": "^3.0.
|
|
852
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
832
853
|
"@assistant-ui/react": "workspace:*",
|
|
833
854
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
834
855
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
835
856
|
"@assistant-ui/ui": "workspace:*",
|
|
836
|
-
"ai": "^6.0.
|
|
857
|
+
"ai": "^6.0.197",
|
|
837
858
|
"class-variance-authority": "^0.7.1",
|
|
838
859
|
"clsx": "^2.1.1",
|
|
839
860
|
"lucide-react": "^1.17.0",
|
|
840
|
-
"next": "^16.2.
|
|
841
|
-
"react": "^19.2.
|
|
842
|
-
"react-dom": "^19.2.
|
|
861
|
+
"next": "^16.2.7",
|
|
862
|
+
"react": "^19.2.7",
|
|
863
|
+
"react-dom": "^19.2.7",
|
|
843
864
|
"tailwind-merge": "^3.6.0",
|
|
844
865
|
"zod": "^4.4.3"
|
|
845
866
|
},
|
|
@@ -847,8 +868,8 @@ export default withAui(nextConfig);
|
|
|
847
868
|
"@assistant-ui/next": "workspace:*",
|
|
848
869
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
849
870
|
"@tailwindcss/postcss": "^4.3.0",
|
|
850
|
-
"@types/node": "^25.9.
|
|
851
|
-
"@types/react": "^19.2.
|
|
871
|
+
"@types/node": "^25.9.2",
|
|
872
|
+
"@types/react": "^19.2.17",
|
|
852
873
|
"@types/react-dom": "^19.2.3",
|
|
853
874
|
"postcss": "^8.5.15",
|
|
854
875
|
"tailwindcss": "^4.3.0",
|
|
@@ -568,23 +568,23 @@ export default withAui(nextConfig);
|
|
|
568
568
|
"start": "next start"
|
|
569
569
|
},
|
|
570
570
|
"dependencies": {
|
|
571
|
-
"@ai-sdk/openai": "^3.0.
|
|
571
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
572
572
|
"@assistant-ui/cloud-ai-sdk": "workspace:*",
|
|
573
|
-
"ai": "^6.0.
|
|
573
|
+
"ai": "^6.0.197",
|
|
574
574
|
"class-variance-authority": "^0.7.1",
|
|
575
575
|
"clsx": "^2.1.1",
|
|
576
576
|
"lucide-react": "^1.17.0",
|
|
577
|
-
"next": "^16.2.
|
|
578
|
-
"react": "^19.2.
|
|
579
|
-
"react-dom": "^19.2.
|
|
577
|
+
"next": "^16.2.7",
|
|
578
|
+
"react": "^19.2.7",
|
|
579
|
+
"react-dom": "^19.2.7",
|
|
580
580
|
"tailwind-merge": "^3.6.0"
|
|
581
581
|
},
|
|
582
582
|
"devDependencies": {
|
|
583
583
|
"@assistant-ui/next": "workspace:*",
|
|
584
584
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
585
585
|
"@tailwindcss/postcss": "^4.3.0",
|
|
586
|
-
"@types/node": "^25.9.
|
|
587
|
-
"@types/react": "^19.2.
|
|
586
|
+
"@types/node": "^25.9.2",
|
|
587
|
+
"@types/react": "^19.2.17",
|
|
588
588
|
"@types/react-dom": "^19.2.3",
|
|
589
589
|
"postcss": "^8.5.15",
|
|
590
590
|
"tailwindcss": "^4.3.0",
|
|
@@ -328,26 +328,26 @@ export default withAui(nextConfig);
|
|
|
328
328
|
"start": "next start"
|
|
329
329
|
},
|
|
330
330
|
"dependencies": {
|
|
331
|
-
"@ai-sdk/openai": "^3.0.
|
|
331
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
332
332
|
"@assistant-ui/react": "workspace:*",
|
|
333
333
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
334
334
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
335
335
|
"@assistant-ui/ui": "workspace:*",
|
|
336
|
-
"ai": "^6.0.
|
|
336
|
+
"ai": "^6.0.197",
|
|
337
337
|
"class-variance-authority": "^0.7.1",
|
|
338
338
|
"clsx": "^2.1.1",
|
|
339
339
|
"lucide-react": "^1.17.0",
|
|
340
|
-
"next": "^16.2.
|
|
341
|
-
"react": "^19.2.
|
|
342
|
-
"react-dom": "^19.2.
|
|
340
|
+
"next": "^16.2.7",
|
|
341
|
+
"react": "^19.2.7",
|
|
342
|
+
"react-dom": "^19.2.7",
|
|
343
343
|
"tailwind-merge": "^3.6.0"
|
|
344
344
|
},
|
|
345
345
|
"devDependencies": {
|
|
346
346
|
"@assistant-ui/next": "workspace:*",
|
|
347
347
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
348
348
|
"@tailwindcss/postcss": "^4.3.0",
|
|
349
|
-
"@types/node": "^25.9.
|
|
350
|
-
"@types/react": "^19.2.
|
|
349
|
+
"@types/node": "^25.9.2",
|
|
350
|
+
"@types/react": "^19.2.17",
|
|
351
351
|
"@types/react-dom": "^19.2.3",
|
|
352
352
|
"postcss": "^8.5.15",
|
|
353
353
|
"tailwindcss": "^4.3.0",
|
|
@@ -460,19 +460,19 @@ export default withAui(nextConfig);
|
|
|
460
460
|
"start": "next start"
|
|
461
461
|
},
|
|
462
462
|
"dependencies": {
|
|
463
|
-
"@ai-sdk/openai": "^3.0.
|
|
463
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
464
464
|
"@assistant-ui/react": "workspace:*",
|
|
465
465
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
466
466
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
467
467
|
"@assistant-ui/ui": "workspace:*",
|
|
468
|
-
"ai": "^6.0.
|
|
468
|
+
"ai": "^6.0.197",
|
|
469
469
|
"assistant-stream": "workspace:*",
|
|
470
470
|
"class-variance-authority": "^0.7.1",
|
|
471
471
|
"clsx": "^2.1.1",
|
|
472
472
|
"lucide-react": "^1.17.0",
|
|
473
|
-
"next": "^16.2.
|
|
474
|
-
"react": "^19.2.
|
|
475
|
-
"react-dom": "^19.2.
|
|
473
|
+
"next": "^16.2.7",
|
|
474
|
+
"react": "^19.2.7",
|
|
475
|
+
"react-dom": "^19.2.7",
|
|
476
476
|
"tailwind-merge": "^3.6.0",
|
|
477
477
|
"zod": "^4.4.3"
|
|
478
478
|
},
|
|
@@ -480,8 +480,8 @@ export default withAui(nextConfig);
|
|
|
480
480
|
"@assistant-ui/next": "workspace:*",
|
|
481
481
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
482
482
|
"@tailwindcss/postcss": "^4.3.0",
|
|
483
|
-
"@types/node": "^25.9.
|
|
484
|
-
"@types/react": "^19.2.
|
|
483
|
+
"@types/node": "^25.9.2",
|
|
484
|
+
"@types/react": "^19.2.17",
|
|
485
485
|
"@types/react-dom": "^19.2.3",
|
|
486
486
|
"postcss": "^8.5.15",
|
|
487
487
|
"tailwindcss": "^4.3.0",
|
|
@@ -439,23 +439,23 @@ export default withAui(nextConfig);
|
|
|
439
439
|
"version": "0.0.0",
|
|
440
440
|
"type": "module",
|
|
441
441
|
"dependencies": {
|
|
442
|
-
"@ai-sdk/openai": "^3.0.
|
|
443
|
-
"@ai-sdk/react": "^3.0.
|
|
442
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
443
|
+
"@ai-sdk/react": "^3.0.199",
|
|
444
444
|
"@assistant-ui/react": "workspace:^",
|
|
445
445
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
446
446
|
"@assistant-ui/react-markdown": "workspace:^",
|
|
447
447
|
"@assistant-ui/ui": "workspace:*",
|
|
448
448
|
"@elevenlabs/client": "^1.9.0",
|
|
449
449
|
"@tailwindcss/postcss": "^4.3.0",
|
|
450
|
-
"ai": "^6.0.
|
|
450
|
+
"ai": "^6.0.197",
|
|
451
451
|
"class-variance-authority": "^0.7.1",
|
|
452
452
|
"clsx": "^2.1.1",
|
|
453
453
|
"lucide-react": "^1.17.0",
|
|
454
454
|
"motion": "^12.40.0",
|
|
455
|
-
"next": "^16.2.
|
|
455
|
+
"next": "^16.2.7",
|
|
456
456
|
"postcss": "^8.5.15",
|
|
457
|
-
"react": "^19.2.
|
|
458
|
-
"react-dom": "^19.2.
|
|
457
|
+
"react": "^19.2.7",
|
|
458
|
+
"react-dom": "^19.2.7",
|
|
459
459
|
"tailwind-merge": "^3.6.0",
|
|
460
460
|
"tailwindcss": "^4.3.0",
|
|
461
461
|
"zod": "^4.4.3"
|
|
@@ -463,8 +463,8 @@ export default withAui(nextConfig);
|
|
|
463
463
|
"devDependencies": {
|
|
464
464
|
"@assistant-ui/next": "workspace:*",
|
|
465
465
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
466
|
-
"@types/node": "^25.9.
|
|
467
|
-
"@types/react": "^19.2.
|
|
466
|
+
"@types/node": "^25.9.2",
|
|
467
|
+
"@types/react": "^19.2.17",
|
|
468
468
|
"@types/react-dom": "^19.2.3",
|
|
469
469
|
"tw-animate-css": "^1.4.0",
|
|
470
470
|
"typescript": "^6.0.3"
|