@assistant-ui/mcp-docs-server 0.1.19 → 0.1.21

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.
Files changed (108) hide show
  1. package/.docs/organized/code-examples/with-ag-ui.md +172 -1633
  2. package/.docs/organized/code-examples/with-ai-sdk-v6.md +42 -1640
  3. package/.docs/organized/code-examples/with-assistant-transport.md +40 -1743
  4. package/.docs/organized/code-examples/with-cloud.md +71 -1745
  5. package/.docs/organized/code-examples/with-custom-thread-list.md +87 -1723
  6. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +70 -1637
  7. package/.docs/organized/code-examples/with-external-store.md +67 -1624
  8. package/.docs/organized/code-examples/with-ffmpeg.md +71 -1629
  9. package/.docs/organized/code-examples/with-langgraph.md +95 -1893
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +57 -1654
  11. package/.docs/organized/code-examples/with-react-hook-form.md +220 -2163
  12. package/.docs/organized/code-examples/with-react-router.md +66 -1318
  13. package/.docs/organized/code-examples/with-store.md +31 -31
  14. package/.docs/organized/code-examples/with-tanstack.md +77 -861
  15. package/.docs/organized/code-examples/with-tap-runtime.md +812 -0
  16. package/.docs/raw/docs/(docs)/cli.mdx +66 -0
  17. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -1
  18. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -1
  19. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +4 -4
  20. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +3 -3
  21. package/.docs/raw/docs/(docs)/devtools.mdx +0 -1
  22. package/.docs/raw/docs/(docs)/guides/attachments.mdx +2 -3
  23. package/.docs/raw/docs/(docs)/guides/context-api.mdx +117 -117
  24. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +296 -0
  25. package/.docs/raw/docs/(docs)/guides/tools.mdx +336 -513
  26. package/.docs/raw/docs/(docs)/index.mdx +33 -410
  27. package/.docs/raw/docs/(docs)/installation.mdx +450 -0
  28. package/.docs/raw/docs/(docs)/llm.mdx +209 -0
  29. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -1
  30. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -1
  31. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +48 -3
  32. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -1
  33. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -1
  34. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +9 -3
  35. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +20 -52
  36. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +16 -39
  37. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +49 -50
  38. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +3 -11
  39. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -3
  40. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -1
  41. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +5 -16
  42. package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -1
  43. package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -1
  44. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +1 -2
  45. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -1
  46. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +152 -0
  47. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -1
  48. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +1 -2
  49. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +1 -2
  50. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +28 -40
  51. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -1
  52. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +1 -2
  53. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +2 -3
  54. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +1 -2
  55. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +1 -2
  56. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -1
  57. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -1
  58. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +1 -2
  59. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -1
  60. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +5 -5
  61. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -1
  62. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -1
  63. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +207 -33
  64. package/.docs/raw/docs/(reference)/react-compatibility.mdx +0 -1
  65. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -1
  66. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +0 -1
  67. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -1
  68. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +118 -0
  69. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +198 -0
  70. package/.docs/raw/docs/runtimes/assistant-transport.mdx +3 -3
  71. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +5 -6
  72. package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -11
  73. package/.docs/raw/docs/runtimes/custom/local.mdx +43 -36
  74. package/.docs/raw/docs/runtimes/data-stream.mdx +35 -3
  75. package/.docs/raw/docs/runtimes/langgraph/index.mdx +1 -2
  76. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -1
  77. package/.docs/raw/docs/runtimes/langserve.mdx +0 -1
  78. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -1
  79. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -1
  80. package/.docs/raw/docs/ui/accordion.mdx +259 -0
  81. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -3
  82. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -3
  83. package/.docs/raw/docs/ui/attachment.mdx +0 -2
  84. package/.docs/raw/docs/ui/badge.mdx +138 -0
  85. package/.docs/raw/docs/ui/diff-viewer.mdx +279 -0
  86. package/.docs/raw/docs/ui/file.mdx +152 -0
  87. package/.docs/raw/docs/ui/image.mdx +100 -0
  88. package/.docs/raw/docs/ui/markdown.mdx +0 -1
  89. package/.docs/raw/docs/ui/mermaid.mdx +0 -1
  90. package/.docs/raw/docs/ui/model-selector.mdx +224 -0
  91. package/.docs/raw/docs/ui/part-grouping.mdx +4 -5
  92. package/.docs/raw/docs/ui/reasoning.mdx +6 -5
  93. package/.docs/raw/docs/ui/scrollbar.mdx +26 -9
  94. package/.docs/raw/docs/ui/select.mdx +245 -0
  95. package/.docs/raw/docs/ui/sources.mdx +6 -5
  96. package/.docs/raw/docs/ui/streamdown.mdx +348 -0
  97. package/.docs/raw/docs/ui/syntax-highlighting.mdx +8 -63
  98. package/.docs/raw/docs/ui/tabs.mdx +259 -0
  99. package/.docs/raw/docs/ui/thread-list.mdx +98 -16
  100. package/.docs/raw/docs/ui/thread.mdx +57 -73
  101. package/.docs/raw/docs/ui/tool-fallback.mdx +0 -1
  102. package/.docs/raw/docs/ui/tool-group.mdx +1 -3
  103. package/README.md +3 -3
  104. package/package.json +4 -4
  105. package/src/tools/tests/examples.test.ts +1 -1
  106. package/.docs/raw/docs/(docs)/about-assistantui.mdx +0 -54
  107. package/.docs/raw/docs/(docs)/mcp-docs-server.mdx +0 -321
  108. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +0 -219
@@ -6,6 +6,8 @@
6
6
  @import "tailwindcss";
7
7
  @import "tw-animate-css";
8
8
 
9
+ @source "../../../packages/ui/src";
10
+
9
11
  @custom-variant dark (&:is(.dark *));
10
12
 
11
13
  @theme inline {
@@ -254,1621 +256,12 @@ export default function Home() {
254
256
  "lib": "@/lib",
255
257
  "hooks": "@/hooks"
256
258
  },
257
- "iconLibrary": "lucide"
258
- }
259
-
260
- ```
261
-
262
- ## components/assistant-ui/attachment.tsx
263
-
264
- ```tsx
265
- "use client";
266
-
267
- import { PropsWithChildren, useEffect, useState, type FC } from "react";
268
- import Image from "next/image";
269
- import { XIcon, PlusIcon, FileText } from "lucide-react";
270
- import {
271
- AttachmentPrimitive,
272
- ComposerPrimitive,
273
- MessagePrimitive,
274
- useAssistantState,
275
- useAssistantApi,
276
- } from "@assistant-ui/react";
277
- import { useShallow } from "zustand/shallow";
278
- import {
279
- Tooltip,
280
- TooltipContent,
281
- TooltipTrigger,
282
- } from "@/components/ui/tooltip";
283
- import {
284
- Dialog,
285
- DialogTitle,
286
- DialogContent,
287
- DialogTrigger,
288
- } from "@/components/ui/dialog";
289
- import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
290
- import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
291
- import { cn } from "@/lib/utils";
292
-
293
- const useFileSrc = (file: File | undefined) => {
294
- const [src, setSrc] = useState<string | undefined>(undefined);
295
-
296
- useEffect(() => {
297
- if (!file) {
298
- setSrc(undefined);
299
- return;
300
- }
301
-
302
- const objectUrl = URL.createObjectURL(file);
303
- setSrc(objectUrl);
304
-
305
- return () => {
306
- URL.revokeObjectURL(objectUrl);
307
- };
308
- }, [file]);
309
-
310
- return src;
311
- };
312
-
313
- const useAttachmentSrc = () => {
314
- const { file, src } = useAssistantState(
315
- useShallow(({ attachment }): { file?: File; src?: string } => {
316
- if (attachment.type !== "image") return {};
317
- if (attachment.file) return { file: attachment.file };
318
- const src = attachment.content?.filter((c) => c.type === "image")[0]
319
- ?.image;
320
- if (!src) return {};
321
- return { src };
322
- }),
323
- );
324
-
325
- return useFileSrc(file) ?? src;
326
- };
327
-
328
- type AttachmentPreviewProps = {
329
- src: string;
330
- };
331
-
332
- const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
333
- const [isLoaded, setIsLoaded] = useState(false);
334
- return (
335
- <Image
336
- src={src}
337
- alt="Image Preview"
338
- width={1}
339
- height={1}
340
- className={
341
- isLoaded
342
- ? "aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain"
343
- : "aui-attachment-preview-image-loading hidden"
344
- }
345
- onLoadingComplete={() => setIsLoaded(true)}
346
- priority={false}
347
- />
348
- );
349
- };
350
-
351
- const AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {
352
- const src = useAttachmentSrc();
353
-
354
- if (!src) return children;
355
-
356
- return (
357
- <Dialog>
358
- <DialogTrigger
359
- className="aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50"
360
- asChild
361
- >
362
- {children}
363
- </DialogTrigger>
364
- <DialogContent className="aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive">
365
- <DialogTitle className="aui-sr-only sr-only">
366
- Image Attachment Preview
367
- </DialogTitle>
368
- <div className="aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background">
369
- <AttachmentPreview src={src} />
370
- </div>
371
- </DialogContent>
372
- </Dialog>
373
- );
374
- };
375
-
376
- const AttachmentThumb: FC = () => {
377
- const isImage = useAssistantState(
378
- ({ attachment }) => attachment.type === "image",
379
- );
380
- const src = useAttachmentSrc();
381
-
382
- return (
383
- <Avatar className="aui-attachment-tile-avatar h-full w-full rounded-none">
384
- <AvatarImage
385
- src={src}
386
- alt="Attachment preview"
387
- className="aui-attachment-tile-image object-cover"
388
- />
389
- <AvatarFallback delayMs={isImage ? 200 : 0}>
390
- <FileText className="aui-attachment-tile-fallback-icon size-8 text-muted-foreground" />
391
- </AvatarFallback>
392
- </Avatar>
393
- );
394
- };
395
-
396
- const AttachmentUI: FC = () => {
397
- const api = useAssistantApi();
398
- const isComposer = api.attachment.source === "composer";
399
-
400
- const isImage = useAssistantState(
401
- ({ attachment }) => attachment.type === "image",
402
- );
403
- const typeLabel = useAssistantState(({ attachment }) => {
404
- const type = attachment.type;
405
- switch (type) {
406
- case "image":
407
- return "Image";
408
- case "document":
409
- return "Document";
410
- case "file":
411
- return "File";
412
- default:
413
- const _exhaustiveCheck: never = type;
414
- throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
415
- }
416
- });
417
-
418
- return (
419
- <Tooltip>
420
- <AttachmentPrimitive.Root
421
- className={cn(
422
- "aui-attachment-root relative",
423
- isImage &&
424
- "aui-attachment-root-composer only:[&>#attachment-tile]:size-24",
425
- )}
426
- >
427
- <AttachmentPreviewDialog>
428
- <TooltipTrigger asChild>
429
- <div
430
- className={cn(
431
- "aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75",
432
- isComposer &&
433
- "aui-attachment-tile-composer border-foreground/20",
434
- )}
435
- role="button"
436
- id="attachment-tile"
437
- aria-label={`${typeLabel} attachment`}
438
- >
439
- <AttachmentThumb />
440
- </div>
441
- </TooltipTrigger>
442
- </AttachmentPreviewDialog>
443
- {isComposer && <AttachmentRemove />}
444
- </AttachmentPrimitive.Root>
445
- <TooltipContent side="top">
446
- <AttachmentPrimitive.Name />
447
- </TooltipContent>
448
- </Tooltip>
449
- );
450
- };
451
-
452
- const AttachmentRemove: FC = () => {
453
- return (
454
- <AttachmentPrimitive.Remove asChild>
455
- <TooltipIconButton
456
- tooltip="Remove file"
457
- className="aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive"
458
- side="top"
459
- >
460
- <XIcon className="aui-attachment-remove-icon size-3 dark:stroke-[2.5px]" />
461
- </TooltipIconButton>
462
- </AttachmentPrimitive.Remove>
463
- );
464
- };
465
-
466
- export const UserMessageAttachments: FC = () => {
467
- return (
468
- <div className="aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2">
469
- <MessagePrimitive.Attachments components={{ Attachment: AttachmentUI }} />
470
- </div>
471
- );
472
- };
473
-
474
- export const ComposerAttachments: FC = () => {
475
- return (
476
- <div className="aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden">
477
- <ComposerPrimitive.Attachments
478
- components={{ Attachment: AttachmentUI }}
479
- />
480
- </div>
481
- );
482
- };
483
-
484
- export const ComposerAddAttachment: FC = () => {
485
- return (
486
- <ComposerPrimitive.AddAttachment asChild>
487
- <TooltipIconButton
488
- tooltip="Add Attachment"
489
- side="bottom"
490
- variant="ghost"
491
- size="icon"
492
- className="aui-composer-add-attachment size-8.5 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30"
493
- aria-label="Add Attachment"
494
- >
495
- <PlusIcon className="aui-attachment-add-icon size-5 stroke-[1.5px]" />
496
- </TooltipIconButton>
497
- </ComposerPrimitive.AddAttachment>
498
- );
499
- };
500
-
501
- ```
502
-
503
- ## components/assistant-ui/markdown-text.tsx
504
-
505
- ```tsx
506
- "use client";
507
-
508
- import "@assistant-ui/react-markdown/styles/dot.css";
509
-
510
- import {
511
- type CodeHeaderProps,
512
- MarkdownTextPrimitive,
513
- unstable_memoizeMarkdownComponents as memoizeMarkdownComponents,
514
- useIsMarkdownCodeBlock,
515
- } from "@assistant-ui/react-markdown";
516
- import remarkGfm from "remark-gfm";
517
- import { type FC, memo, useState } from "react";
518
- import { CheckIcon, CopyIcon } from "lucide-react";
519
-
520
- import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
521
- import { cn } from "@/lib/utils";
522
-
523
- const MarkdownTextImpl = () => {
524
- return (
525
- <MarkdownTextPrimitive
526
- remarkPlugins={[remarkGfm]}
527
- className="aui-md"
528
- components={defaultComponents}
529
- />
530
- );
531
- };
532
-
533
- export const MarkdownText = memo(MarkdownTextImpl);
534
-
535
- const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
536
- const { isCopied, copyToClipboard } = useCopyToClipboard();
537
- const onCopy = () => {
538
- if (!code || isCopied) return;
539
- copyToClipboard(code);
540
- };
541
-
542
- return (
543
- <div className="aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 font-semibold text-foreground text-sm dark:bg-muted-foreground/20">
544
- <span className="aui-code-header-language lowercase [&>span]:text-xs">
545
- {language}
546
- </span>
547
- <TooltipIconButton tooltip="Copy" onClick={onCopy}>
548
- {!isCopied && <CopyIcon />}
549
- {isCopied && <CheckIcon />}
550
- </TooltipIconButton>
551
- </div>
552
- );
553
- };
554
-
555
- const useCopyToClipboard = ({
556
- copiedDuration = 3000,
557
- }: {
558
- copiedDuration?: number;
559
- } = {}) => {
560
- const [isCopied, setIsCopied] = useState<boolean>(false);
561
-
562
- const copyToClipboard = (value: string) => {
563
- if (!value) return;
564
-
565
- navigator.clipboard.writeText(value).then(() => {
566
- setIsCopied(true);
567
- setTimeout(() => setIsCopied(false), copiedDuration);
568
- });
569
- };
570
-
571
- return { isCopied, copyToClipboard };
572
- };
573
-
574
- const defaultComponents = memoizeMarkdownComponents({
575
- h1: ({ className, ...props }) => (
576
- <h1
577
- className={cn(
578
- "aui-md-h1 mb-8 scroll-m-20 font-extrabold text-4xl tracking-tight last:mb-0",
579
- className,
580
- )}
581
- {...props}
582
- />
583
- ),
584
- h2: ({ className, ...props }) => (
585
- <h2
586
- className={cn(
587
- "aui-md-h2 mt-8 mb-4 scroll-m-20 font-semibold text-3xl tracking-tight first:mt-0 last:mb-0",
588
- className,
589
- )}
590
- {...props}
591
- />
592
- ),
593
- h3: ({ className, ...props }) => (
594
- <h3
595
- className={cn(
596
- "aui-md-h3 mt-6 mb-4 scroll-m-20 font-semibold text-2xl tracking-tight first:mt-0 last:mb-0",
597
- className,
598
- )}
599
- {...props}
600
- />
601
- ),
602
- h4: ({ className, ...props }) => (
603
- <h4
604
- className={cn(
605
- "aui-md-h4 mt-6 mb-4 scroll-m-20 font-semibold text-xl tracking-tight first:mt-0 last:mb-0",
606
- className,
607
- )}
608
- {...props}
609
- />
610
- ),
611
- h5: ({ className, ...props }) => (
612
- <h5
613
- className={cn(
614
- "aui-md-h5 my-4 font-semibold text-lg first:mt-0 last:mb-0",
615
- className,
616
- )}
617
- {...props}
618
- />
619
- ),
620
- h6: ({ className, ...props }) => (
621
- <h6
622
- className={cn(
623
- "aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",
624
- className,
625
- )}
626
- {...props}
627
- />
628
- ),
629
- p: ({ className, ...props }) => (
630
- <p
631
- className={cn(
632
- "aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",
633
- className,
634
- )}
635
- {...props}
636
- />
637
- ),
638
- a: ({ className, ...props }) => (
639
- <a
640
- className={cn(
641
- "aui-md-a font-medium text-primary underline underline-offset-4",
642
- className,
643
- )}
644
- {...props}
645
- />
646
- ),
647
- blockquote: ({ className, ...props }) => (
648
- <blockquote
649
- className={cn("aui-md-blockquote border-l-2 pl-6 italic", className)}
650
- {...props}
651
- />
652
- ),
653
- ul: ({ className, ...props }) => (
654
- <ul
655
- className={cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2", className)}
656
- {...props}
657
- />
658
- ),
659
- ol: ({ className, ...props }) => (
660
- <ol
661
- className={cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2", className)}
662
- {...props}
663
- />
664
- ),
665
- hr: ({ className, ...props }) => (
666
- <hr className={cn("aui-md-hr my-5 border-b", className)} {...props} />
667
- ),
668
- table: ({ className, ...props }) => (
669
- <table
670
- className={cn(
671
- "aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",
672
- className,
673
- )}
674
- {...props}
675
- />
676
- ),
677
- th: ({ className, ...props }) => (
678
- <th
679
- className={cn(
680
- "aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",
681
- className,
682
- )}
683
- {...props}
684
- />
685
- ),
686
- td: ({ className, ...props }) => (
687
- <td
688
- className={cn(
689
- "aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",
690
- className,
691
- )}
692
- {...props}
693
- />
694
- ),
695
- tr: ({ className, ...props }) => (
696
- <tr
697
- className={cn(
698
- "aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
699
- className,
700
- )}
701
- {...props}
702
- />
703
- ),
704
- sup: ({ className, ...props }) => (
705
- <sup
706
- className={cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className)}
707
- {...props}
708
- />
709
- ),
710
- pre: ({ className, ...props }) => (
711
- <pre
712
- className={cn(
713
- "aui-md-pre overflow-x-auto rounded-t-none! rounded-b-lg bg-black p-4 text-white",
714
- className,
715
- )}
716
- {...props}
717
- />
718
- ),
719
- code: function Code({ className, ...props }) {
720
- const isCodeBlock = useIsMarkdownCodeBlock();
721
- return (
722
- <code
723
- className={cn(
724
- !isCodeBlock &&
725
- "aui-md-inline-code rounded border bg-muted font-semibold",
726
- className,
727
- )}
728
- {...props}
729
- />
730
- );
731
- },
732
- CodeHeader,
733
- });
734
-
735
- ```
736
-
737
- ## components/assistant-ui/thread.tsx
738
-
739
- ```tsx
740
- import {
741
- ComposerAddAttachment,
742
- ComposerAttachments,
743
- UserMessageAttachments,
744
- } from "@/components/assistant-ui/attachment";
745
- import { MarkdownText } from "@/components/assistant-ui/markdown-text";
746
- import { ToolFallback } from "@/components/assistant-ui/tool-fallback";
747
- import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
748
- import { Button } from "@/components/ui/button";
749
- import { cn } from "@/lib/utils";
750
- import {
751
- ActionBarMorePrimitive,
752
- ActionBarPrimitive,
753
- AssistantIf,
754
- BranchPickerPrimitive,
755
- ComposerPrimitive,
756
- ErrorPrimitive,
757
- MessagePrimitive,
758
- ThreadPrimitive,
759
- } from "@assistant-ui/react";
760
- import {
761
- ArrowDownIcon,
762
- ArrowUpIcon,
763
- CheckIcon,
764
- ChevronLeftIcon,
765
- ChevronRightIcon,
766
- CopyIcon,
767
- DownloadIcon,
768
- MoreHorizontalIcon,
769
- PencilIcon,
770
- RefreshCwIcon,
771
- SquareIcon,
772
- } from "lucide-react";
773
- import type { FC } from "react";
774
-
775
- export const Thread: FC = () => {
776
- return (
777
- <ThreadPrimitive.Root
778
- className="aui-root aui-thread-root @container flex h-full flex-col bg-background"
779
- style={{
780
- ["--thread-max-width" as string]: "44rem",
781
- }}
782
- >
783
- <ThreadPrimitive.Viewport
784
- turnAnchor="top"
785
- className="aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4"
786
- >
787
- <AssistantIf condition={({ thread }) => thread.isEmpty}>
788
- <ThreadWelcome />
789
- </AssistantIf>
790
-
791
- <ThreadPrimitive.Messages
792
- components={{
793
- UserMessage,
794
- EditComposer,
795
- AssistantMessage,
796
- }}
797
- />
798
-
799
- <ThreadPrimitive.ViewportFooter className="aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6">
800
- <ThreadScrollToBottom />
801
- <Composer />
802
- </ThreadPrimitive.ViewportFooter>
803
- </ThreadPrimitive.Viewport>
804
- </ThreadPrimitive.Root>
805
- );
806
- };
807
-
808
- const ThreadScrollToBottom: FC = () => {
809
- return (
810
- <ThreadPrimitive.ScrollToBottom asChild>
811
- <TooltipIconButton
812
- tooltip="Scroll to bottom"
813
- variant="outline"
814
- className="aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent"
815
- >
816
- <ArrowDownIcon />
817
- </TooltipIconButton>
818
- </ThreadPrimitive.ScrollToBottom>
819
- );
820
- };
821
-
822
- const ThreadWelcome: FC = () => {
823
- return (
824
- <div className="aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col">
825
- <div className="aui-thread-welcome-center flex w-full grow flex-col items-center justify-center">
826
- <div className="aui-thread-welcome-message flex size-full flex-col justify-center px-4">
827
- <h1 className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in font-semibold text-2xl duration-200">
828
- Hello there!
829
- </h1>
830
- <p className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in text-muted-foreground text-xl delay-75 duration-200">
831
- How can I help you today?
832
- </p>
833
- </div>
834
- </div>
835
- <ThreadSuggestions />
836
- </div>
837
- );
838
- };
839
-
840
- const SUGGESTIONS = [
841
- {
842
- title: "What's the weather",
843
- label: "in San Francisco?",
844
- prompt: "What's the weather in San Francisco?",
845
- },
846
- {
847
- title: "Explain React hooks",
848
- label: "like useState and useEffect",
849
- prompt: "Explain React hooks like useState and useEffect",
850
- },
851
- ] as const;
852
-
853
- const ThreadSuggestions: FC = () => {
854
- return (
855
- <div className="aui-thread-welcome-suggestions grid w-full @md:grid-cols-2 gap-2 pb-4">
856
- {SUGGESTIONS.map((suggestion, index) => (
857
- <div
858
- key={suggestion.prompt}
859
- className="aui-thread-welcome-suggestion-display fade-in slide-in-from-bottom-2 @md:nth-[n+3]:block nth-[n+3]:hidden animate-in fill-mode-both duration-200"
860
- style={{ animationDelay: `${100 + index * 50}ms` }}
861
- >
862
- <ThreadPrimitive.Suggestion prompt={suggestion.prompt} send asChild>
863
- <Button
864
- variant="ghost"
865
- className="aui-thread-welcome-suggestion h-auto w-full @md:flex-col flex-wrap items-start justify-start gap-1 rounded-2xl border px-4 py-3 text-left text-sm transition-colors hover:bg-muted"
866
- aria-label={suggestion.prompt}
867
- >
868
- <span className="aui-thread-welcome-suggestion-text-1 font-medium">
869
- {suggestion.title}
870
- </span>
871
- <span className="aui-thread-welcome-suggestion-text-2 text-muted-foreground">
872
- {suggestion.label}
873
- </span>
874
- </Button>
875
- </ThreadPrimitive.Suggestion>
876
- </div>
877
- ))}
878
- </div>
879
- );
880
- };
881
-
882
- const Composer: FC = () => {
883
- return (
884
- <ComposerPrimitive.Root className="aui-composer-root relative flex w-full flex-col">
885
- <ComposerPrimitive.AttachmentDropzone className="aui-composer-attachment-dropzone flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-2 has-[textarea:focus-visible]:ring-ring/20 data-[dragging=true]:border-ring data-[dragging=true]:border-dashed data-[dragging=true]:bg-accent/50">
886
- <ComposerAttachments />
887
- <ComposerPrimitive.Input
888
- placeholder="Send a message..."
889
- className="aui-composer-input mb-1 max-h-32 min-h-14 w-full resize-none bg-transparent px-4 pt-2 pb-3 text-sm outline-none placeholder:text-muted-foreground focus-visible:ring-0"
890
- rows={1}
891
- autoFocus
892
- aria-label="Message input"
893
- />
894
- <ComposerAction />
895
- </ComposerPrimitive.AttachmentDropzone>
896
- </ComposerPrimitive.Root>
897
- );
898
- };
899
-
900
- const ComposerAction: FC = () => {
901
- return (
902
- <div className="aui-composer-action-wrapper relative mx-2 mb-2 flex items-center justify-between">
903
- <ComposerAddAttachment />
904
-
905
- <AssistantIf condition={({ thread }) => !thread.isRunning}>
906
- <ComposerPrimitive.Send asChild>
907
- <TooltipIconButton
908
- tooltip="Send message"
909
- side="bottom"
910
- type="submit"
911
- variant="default"
912
- size="icon"
913
- className="aui-composer-send size-8 rounded-full"
914
- aria-label="Send message"
915
- >
916
- <ArrowUpIcon className="aui-composer-send-icon size-4" />
917
- </TooltipIconButton>
918
- </ComposerPrimitive.Send>
919
- </AssistantIf>
920
-
921
- <AssistantIf condition={({ thread }) => thread.isRunning}>
922
- <ComposerPrimitive.Cancel asChild>
923
- <Button
924
- type="button"
925
- variant="default"
926
- size="icon"
927
- className="aui-composer-cancel size-8 rounded-full"
928
- aria-label="Stop generating"
929
- >
930
- <SquareIcon className="aui-composer-cancel-icon size-3 fill-current" />
931
- </Button>
932
- </ComposerPrimitive.Cancel>
933
- </AssistantIf>
934
- </div>
935
- );
936
- };
937
-
938
- const MessageError: FC = () => {
939
- return (
940
- <MessagePrimitive.Error>
941
- <ErrorPrimitive.Root className="aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200">
942
- <ErrorPrimitive.Message className="aui-message-error-message line-clamp-2" />
943
- </ErrorPrimitive.Root>
944
- </MessagePrimitive.Error>
945
- );
946
- };
947
-
948
- const AssistantMessage: FC = () => {
949
- return (
950
- <MessagePrimitive.Root
951
- className="aui-assistant-message-root fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in py-3 duration-150"
952
- data-role="assistant"
953
- >
954
- <div className="aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed">
955
- <MessagePrimitive.Parts
956
- components={{
957
- Text: MarkdownText,
958
- tools: { Fallback: ToolFallback },
959
- }}
960
- />
961
- <MessageError />
962
- </div>
963
-
964
- <div className="aui-assistant-message-footer mt-1 ml-2 flex">
965
- <BranchPicker />
966
- <AssistantActionBar />
967
- </div>
968
- </MessagePrimitive.Root>
969
- );
970
- };
971
-
972
- const AssistantActionBar: FC = () => {
973
- return (
974
- <ActionBarPrimitive.Root
975
- hideWhenRunning
976
- autohide="not-last"
977
- autohideFloat="single-branch"
978
- className="aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm"
979
- >
980
- <ActionBarPrimitive.Copy asChild>
981
- <TooltipIconButton tooltip="Copy">
982
- <AssistantIf condition={({ message }) => message.isCopied}>
983
- <CheckIcon />
984
- </AssistantIf>
985
- <AssistantIf condition={({ message }) => !message.isCopied}>
986
- <CopyIcon />
987
- </AssistantIf>
988
- </TooltipIconButton>
989
- </ActionBarPrimitive.Copy>
990
- <ActionBarPrimitive.Reload asChild>
991
- <TooltipIconButton tooltip="Refresh">
992
- <RefreshCwIcon />
993
- </TooltipIconButton>
994
- </ActionBarPrimitive.Reload>
995
- <ActionBarMorePrimitive.Root>
996
- <ActionBarMorePrimitive.Trigger asChild>
997
- <TooltipIconButton
998
- tooltip="More"
999
- className="data-[state=open]:bg-accent"
1000
- >
1001
- <MoreHorizontalIcon />
1002
- </TooltipIconButton>
1003
- </ActionBarMorePrimitive.Trigger>
1004
- <ActionBarMorePrimitive.Content
1005
- side="bottom"
1006
- align="start"
1007
- className="aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md"
1008
- >
1009
- <ActionBarPrimitive.ExportMarkdown asChild>
1010
- <ActionBarMorePrimitive.Item className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground">
1011
- <DownloadIcon className="size-4" />
1012
- Export as Markdown
1013
- </ActionBarMorePrimitive.Item>
1014
- </ActionBarPrimitive.ExportMarkdown>
1015
- </ActionBarMorePrimitive.Content>
1016
- </ActionBarMorePrimitive.Root>
1017
- </ActionBarPrimitive.Root>
1018
- );
1019
- };
1020
-
1021
- const UserMessage: FC = () => {
1022
- return (
1023
- <MessagePrimitive.Root
1024
- className="aui-user-message-root fade-in slide-in-from-bottom-1 mx-auto grid w-full max-w-(--thread-max-width) animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 py-3 duration-150 [&:where(>*)]:col-start-2"
1025
- data-role="user"
1026
- >
1027
- <UserMessageAttachments />
1028
-
1029
- <div className="aui-user-message-content-wrapper relative col-start-2 min-w-0">
1030
- <div className="aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground">
1031
- <MessagePrimitive.Parts />
1032
- </div>
1033
- <div className="aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2">
1034
- <UserActionBar />
1035
- </div>
1036
- </div>
1037
-
1038
- <BranchPicker className="aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end" />
1039
- </MessagePrimitive.Root>
1040
- );
1041
- };
1042
-
1043
- const UserActionBar: FC = () => {
1044
- return (
1045
- <ActionBarPrimitive.Root
1046
- hideWhenRunning
1047
- autohide="not-last"
1048
- className="aui-user-action-bar-root flex flex-col items-end"
1049
- >
1050
- <ActionBarPrimitive.Edit asChild>
1051
- <TooltipIconButton tooltip="Edit" className="aui-user-action-edit p-4">
1052
- <PencilIcon />
1053
- </TooltipIconButton>
1054
- </ActionBarPrimitive.Edit>
1055
- </ActionBarPrimitive.Root>
1056
- );
1057
- };
1058
-
1059
- const EditComposer: FC = () => {
1060
- return (
1061
- <MessagePrimitive.Root className="aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3">
1062
- <ComposerPrimitive.Root className="aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted">
1063
- <ComposerPrimitive.Input
1064
- className="aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none"
1065
- autoFocus
1066
- />
1067
- <div className="aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end">
1068
- <ComposerPrimitive.Cancel asChild>
1069
- <Button variant="ghost" size="sm">
1070
- Cancel
1071
- </Button>
1072
- </ComposerPrimitive.Cancel>
1073
- <ComposerPrimitive.Send asChild>
1074
- <Button size="sm">Update</Button>
1075
- </ComposerPrimitive.Send>
1076
- </div>
1077
- </ComposerPrimitive.Root>
1078
- </MessagePrimitive.Root>
1079
- );
1080
- };
1081
-
1082
- const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
1083
- className,
1084
- ...rest
1085
- }) => {
1086
- return (
1087
- <BranchPickerPrimitive.Root
1088
- hideWhenSingleBranch
1089
- className={cn(
1090
- "aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-muted-foreground text-xs",
1091
- className,
1092
- )}
1093
- {...rest}
1094
- >
1095
- <BranchPickerPrimitive.Previous asChild>
1096
- <TooltipIconButton tooltip="Previous">
1097
- <ChevronLeftIcon />
1098
- </TooltipIconButton>
1099
- </BranchPickerPrimitive.Previous>
1100
- <span className="aui-branch-picker-state font-medium">
1101
- <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />
1102
- </span>
1103
- <BranchPickerPrimitive.Next asChild>
1104
- <TooltipIconButton tooltip="Next">
1105
- <ChevronRightIcon />
1106
- </TooltipIconButton>
1107
- </BranchPickerPrimitive.Next>
1108
- </BranchPickerPrimitive.Root>
1109
- );
1110
- };
1111
-
1112
- ```
1113
-
1114
- ## components/assistant-ui/tool-fallback.tsx
1115
-
1116
- ```tsx
1117
- "use client";
1118
-
1119
- import { memo, useCallback, useRef, useState } from "react";
1120
- import {
1121
- AlertCircleIcon,
1122
- CheckIcon,
1123
- ChevronDownIcon,
1124
- LoaderIcon,
1125
- XCircleIcon,
1126
- } from "lucide-react";
1127
- import {
1128
- useScrollLock,
1129
- type ToolCallMessagePartStatus,
1130
- type ToolCallMessagePartComponent,
1131
- } from "@assistant-ui/react";
1132
- import {
1133
- Collapsible,
1134
- CollapsibleContent,
1135
- CollapsibleTrigger,
1136
- } from "@/components/ui/collapsible";
1137
- import { cn } from "@/lib/utils";
1138
-
1139
- const ANIMATION_DURATION = 200;
1140
-
1141
- export type ToolFallbackRootProps = Omit<
1142
- React.ComponentProps<typeof Collapsible>,
1143
- "open" | "onOpenChange"
1144
- > & {
1145
- open?: boolean;
1146
- onOpenChange?: (open: boolean) => void;
1147
- defaultOpen?: boolean;
1148
- };
1149
-
1150
- function ToolFallbackRoot({
1151
- className,
1152
- open: controlledOpen,
1153
- onOpenChange: controlledOnOpenChange,
1154
- defaultOpen = false,
1155
- children,
1156
- ...props
1157
- }: ToolFallbackRootProps) {
1158
- const collapsibleRef = useRef<HTMLDivElement>(null);
1159
- const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
1160
- const lockScroll = useScrollLock(collapsibleRef, ANIMATION_DURATION);
1161
-
1162
- const isControlled = controlledOpen !== undefined;
1163
- const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
1164
-
1165
- const handleOpenChange = useCallback(
1166
- (open: boolean) => {
1167
- if (!open) {
1168
- lockScroll();
1169
- }
1170
- if (!isControlled) {
1171
- setUncontrolledOpen(open);
1172
- }
1173
- controlledOnOpenChange?.(open);
1174
- },
1175
- [lockScroll, isControlled, controlledOnOpenChange],
1176
- );
1177
-
1178
- return (
1179
- <Collapsible
1180
- ref={collapsibleRef}
1181
- data-slot="tool-fallback-root"
1182
- open={isOpen}
1183
- onOpenChange={handleOpenChange}
1184
- className={cn(
1185
- "aui-tool-fallback-root group/tool-fallback-root w-full rounded-lg border py-3",
1186
- className,
1187
- )}
1188
- style={
1189
- {
1190
- "--animation-duration": `${ANIMATION_DURATION}ms`,
1191
- } as React.CSSProperties
1192
- }
1193
- {...props}
1194
- >
1195
- {children}
1196
- </Collapsible>
1197
- );
1198
- }
1199
-
1200
- type ToolStatus = ToolCallMessagePartStatus["type"];
1201
-
1202
- const statusIconMap: Record<ToolStatus, React.ElementType> = {
1203
- running: LoaderIcon,
1204
- complete: CheckIcon,
1205
- incomplete: XCircleIcon,
1206
- "requires-action": AlertCircleIcon,
1207
- };
1208
-
1209
- function ToolFallbackTrigger({
1210
- toolName,
1211
- status,
1212
- className,
1213
- ...props
1214
- }: React.ComponentProps<typeof CollapsibleTrigger> & {
1215
- toolName: string;
1216
- status?: ToolCallMessagePartStatus;
1217
- }) {
1218
- const statusType = status?.type ?? "complete";
1219
- const isRunning = statusType === "running";
1220
- const isCancelled =
1221
- status?.type === "incomplete" && status.reason === "cancelled";
1222
-
1223
- const Icon = statusIconMap[statusType];
1224
- const label = isCancelled ? "Cancelled tool" : "Used tool";
1225
-
1226
- return (
1227
- <CollapsibleTrigger
1228
- data-slot="tool-fallback-trigger"
1229
- className={cn(
1230
- "aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-4 text-sm transition-colors",
1231
- className,
1232
- )}
1233
- {...props}
1234
- >
1235
- <Icon
1236
- data-slot="tool-fallback-trigger-icon"
1237
- className={cn(
1238
- "aui-tool-fallback-trigger-icon size-4 shrink-0",
1239
- isCancelled && "text-muted-foreground",
1240
- isRunning && "animate-spin",
1241
- )}
1242
- />
1243
- <span
1244
- data-slot="tool-fallback-trigger-label"
1245
- className={cn(
1246
- "aui-tool-fallback-trigger-label-wrapper relative inline-block grow text-left leading-none",
1247
- isCancelled && "text-muted-foreground line-through",
1248
- )}
1249
- >
1250
- <span>
1251
- {label}: <b>{toolName}</b>
1252
- </span>
1253
- {isRunning && (
1254
- <span
1255
- aria-hidden
1256
- data-slot="tool-fallback-trigger-shimmer"
1257
- className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
1258
- >
1259
- {label}: <b>{toolName}</b>
1260
- </span>
1261
- )}
1262
- </span>
1263
- <ChevronDownIcon
1264
- data-slot="tool-fallback-trigger-chevron"
1265
- className={cn(
1266
- "aui-tool-fallback-trigger-chevron size-4 shrink-0",
1267
- "transition-transform duration-(--animation-duration) ease-out",
1268
- "group-data-[state=closed]/trigger:-rotate-90",
1269
- "group-data-[state=open]/trigger:rotate-0",
1270
- )}
1271
- />
1272
- </CollapsibleTrigger>
1273
- );
1274
- }
1275
-
1276
- function ToolFallbackContent({
1277
- className,
1278
- children,
1279
- ...props
1280
- }: React.ComponentProps<typeof CollapsibleContent>) {
1281
- return (
1282
- <CollapsibleContent
1283
- data-slot="tool-fallback-content"
1284
- className={cn(
1285
- "aui-tool-fallback-content relative overflow-hidden text-sm outline-none",
1286
- "group/collapsible-content ease-out",
1287
- "data-[state=closed]:animate-collapsible-up",
1288
- "data-[state=open]:animate-collapsible-down",
1289
- "data-[state=closed]:fill-mode-forwards",
1290
- "data-[state=closed]:pointer-events-none",
1291
- "data-[state=open]:duration-(--animation-duration)",
1292
- "data-[state=closed]:duration-(--animation-duration)",
1293
- className,
1294
- )}
1295
- {...props}
1296
- >
1297
- <div className="mt-3 flex flex-col gap-2 border-t pt-2">{children}</div>
1298
- </CollapsibleContent>
1299
- );
1300
- }
1301
-
1302
- function ToolFallbackArgs({
1303
- argsText,
1304
- className,
1305
- ...props
1306
- }: React.ComponentProps<"div"> & {
1307
- argsText?: string;
1308
- }) {
1309
- if (!argsText) return null;
1310
-
1311
- return (
1312
- <div
1313
- data-slot="tool-fallback-args"
1314
- className={cn("aui-tool-fallback-args px-4", className)}
1315
- {...props}
1316
- >
1317
- <pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
1318
- {argsText}
1319
- </pre>
1320
- </div>
1321
- );
1322
- }
1323
-
1324
- function ToolFallbackResult({
1325
- result,
1326
- className,
1327
- ...props
1328
- }: React.ComponentProps<"div"> & {
1329
- result?: unknown;
1330
- }) {
1331
- if (result === undefined) return null;
1332
-
1333
- return (
1334
- <div
1335
- data-slot="tool-fallback-result"
1336
- className={cn(
1337
- "aui-tool-fallback-result border-t border-dashed px-4 pt-2",
1338
- className,
1339
- )}
1340
- {...props}
1341
- >
1342
- <p className="aui-tool-fallback-result-header font-semibold">Result:</p>
1343
- <pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
1344
- {typeof result === "string" ? result : JSON.stringify(result, null, 2)}
1345
- </pre>
1346
- </div>
1347
- );
1348
- }
1349
-
1350
- function ToolFallbackError({
1351
- status,
1352
- className,
1353
- ...props
1354
- }: React.ComponentProps<"div"> & {
1355
- status?: ToolCallMessagePartStatus;
1356
- }) {
1357
- if (status?.type !== "incomplete") return null;
1358
-
1359
- const error = status.error;
1360
- const errorText = error
1361
- ? typeof error === "string"
1362
- ? error
1363
- : JSON.stringify(error)
1364
- : null;
1365
-
1366
- if (!errorText) return null;
1367
-
1368
- const isCancelled = status.reason === "cancelled";
1369
- const headerText = isCancelled ? "Cancelled reason:" : "Error:";
1370
-
1371
- return (
1372
- <div
1373
- data-slot="tool-fallback-error"
1374
- className={cn("aui-tool-fallback-error px-4", className)}
1375
- {...props}
1376
- >
1377
- <p className="aui-tool-fallback-error-header font-semibold text-muted-foreground">
1378
- {headerText}
1379
- </p>
1380
- <p className="aui-tool-fallback-error-reason text-muted-foreground">
1381
- {errorText}
1382
- </p>
1383
- </div>
1384
- );
1385
- }
1386
-
1387
- const ToolFallbackImpl: ToolCallMessagePartComponent = ({
1388
- toolName,
1389
- argsText,
1390
- result,
1391
- status,
1392
- }) => {
1393
- const isCancelled =
1394
- status?.type === "incomplete" && status.reason === "cancelled";
1395
-
1396
- return (
1397
- <ToolFallbackRoot
1398
- className={cn(isCancelled && "border-muted-foreground/30 bg-muted/30")}
1399
- >
1400
- <ToolFallbackTrigger toolName={toolName} status={status} />
1401
- <ToolFallbackContent>
1402
- <ToolFallbackError status={status} />
1403
- <ToolFallbackArgs
1404
- argsText={argsText}
1405
- className={cn(isCancelled && "opacity-60")}
1406
- />
1407
- {!isCancelled && <ToolFallbackResult result={result} />}
1408
- </ToolFallbackContent>
1409
- </ToolFallbackRoot>
1410
- );
1411
- };
1412
-
1413
- const ToolFallback = memo(
1414
- ToolFallbackImpl,
1415
- ) as unknown as ToolCallMessagePartComponent & {
1416
- Root: typeof ToolFallbackRoot;
1417
- Trigger: typeof ToolFallbackTrigger;
1418
- Content: typeof ToolFallbackContent;
1419
- Args: typeof ToolFallbackArgs;
1420
- Result: typeof ToolFallbackResult;
1421
- Error: typeof ToolFallbackError;
1422
- };
1423
-
1424
- ToolFallback.displayName = "ToolFallback";
1425
- ToolFallback.Root = ToolFallbackRoot;
1426
- ToolFallback.Trigger = ToolFallbackTrigger;
1427
- ToolFallback.Content = ToolFallbackContent;
1428
- ToolFallback.Args = ToolFallbackArgs;
1429
- ToolFallback.Result = ToolFallbackResult;
1430
- ToolFallback.Error = ToolFallbackError;
1431
-
1432
- export {
1433
- ToolFallback,
1434
- ToolFallbackRoot,
1435
- ToolFallbackTrigger,
1436
- ToolFallbackContent,
1437
- ToolFallbackArgs,
1438
- ToolFallbackResult,
1439
- ToolFallbackError,
1440
- };
1441
-
1442
- ```
1443
-
1444
- ## components/assistant-ui/tooltip-icon-button.tsx
1445
-
1446
- ```tsx
1447
- "use client";
1448
-
1449
- import { ComponentPropsWithRef, forwardRef } from "react";
1450
- import { Slottable } from "@radix-ui/react-slot";
1451
-
1452
- import {
1453
- Tooltip,
1454
- TooltipContent,
1455
- TooltipTrigger,
1456
- } from "@/components/ui/tooltip";
1457
- import { Button } from "@/components/ui/button";
1458
- import { cn } from "@/lib/utils";
1459
-
1460
- export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
1461
- tooltip: string;
1462
- side?: "top" | "bottom" | "left" | "right";
1463
- };
1464
-
1465
- export const TooltipIconButton = forwardRef<
1466
- HTMLButtonElement,
1467
- TooltipIconButtonProps
1468
- >(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
1469
- return (
1470
- <Tooltip>
1471
- <TooltipTrigger asChild>
1472
- <Button
1473
- variant="ghost"
1474
- size="icon"
1475
- {...rest}
1476
- className={cn("aui-button-icon size-6 p-1", className)}
1477
- ref={ref}
1478
- >
1479
- <Slottable>{children}</Slottable>
1480
- <span className="aui-sr-only sr-only">{tooltip}</span>
1481
- </Button>
1482
- </TooltipTrigger>
1483
- <TooltipContent side={side}>{tooltip}</TooltipContent>
1484
- </Tooltip>
1485
- );
1486
- });
1487
-
1488
- TooltipIconButton.displayName = "TooltipIconButton";
1489
-
1490
- ```
1491
-
1492
- ## components/ui/avatar.tsx
1493
-
1494
- ```tsx
1495
- "use client";
1496
-
1497
- import * as React from "react";
1498
- import * as AvatarPrimitive from "@radix-ui/react-avatar";
1499
-
1500
- import { cn } from "@/lib/utils";
1501
-
1502
- function Avatar({
1503
- className,
1504
- ...props
1505
- }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
1506
- return (
1507
- <AvatarPrimitive.Root
1508
- data-slot="avatar"
1509
- className={cn(
1510
- "relative flex size-8 shrink-0 overflow-hidden rounded-full",
1511
- className,
1512
- )}
1513
- {...props}
1514
- />
1515
- );
1516
- }
1517
-
1518
- function AvatarImage({
1519
- className,
1520
- ...props
1521
- }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
1522
- return (
1523
- <AvatarPrimitive.Image
1524
- data-slot="avatar-image"
1525
- className={cn("aspect-square size-full", className)}
1526
- {...props}
1527
- />
1528
- );
1529
- }
1530
-
1531
- function AvatarFallback({
1532
- className,
1533
- ...props
1534
- }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
1535
- return (
1536
- <AvatarPrimitive.Fallback
1537
- data-slot="avatar-fallback"
1538
- className={cn(
1539
- "flex size-full items-center justify-center rounded-full bg-muted",
1540
- className,
1541
- )}
1542
- {...props}
1543
- />
1544
- );
1545
- }
1546
-
1547
- export { Avatar, AvatarImage, AvatarFallback };
1548
-
1549
- ```
1550
-
1551
- ## components/ui/button.tsx
1552
-
1553
- ```tsx
1554
- import * as React from "react";
1555
- import { Slot } from "@radix-ui/react-slot";
1556
- import { cva, type VariantProps } from "class-variance-authority";
1557
-
1558
- import { cn } from "@/lib/utils";
1559
-
1560
- const buttonVariants = cva(
1561
- "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
1562
- {
1563
- variants: {
1564
- variant: {
1565
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
1566
- destructive:
1567
- "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
1568
- outline:
1569
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
1570
- secondary:
1571
- "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1572
- ghost:
1573
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
1574
- link: "text-primary underline-offset-4 hover:underline",
1575
- },
1576
- size: {
1577
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
1578
- sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
1579
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
1580
- icon: "size-9",
1581
- "icon-sm": "size-8",
1582
- "icon-lg": "size-10",
1583
- },
1584
- },
1585
- defaultVariants: {
1586
- variant: "default",
1587
- size: "default",
1588
- },
1589
- },
1590
- );
1591
-
1592
- function Button({
1593
- className,
1594
- variant = "default",
1595
- size = "default",
1596
- asChild = false,
1597
- ...props
1598
- }: React.ComponentProps<"button"> &
1599
- VariantProps<typeof buttonVariants> & {
1600
- asChild?: boolean;
1601
- }) {
1602
- const Comp = asChild ? Slot : "button";
1603
-
1604
- return (
1605
- <Comp
1606
- data-slot="button"
1607
- data-variant={variant}
1608
- data-size={size}
1609
- className={cn(buttonVariants({ variant, size, className }))}
1610
- {...props}
1611
- />
1612
- );
1613
- }
1614
-
1615
- export { Button, buttonVariants };
1616
-
1617
- ```
1618
-
1619
- ## components/ui/collapsible.tsx
1620
-
1621
- ```tsx
1622
- "use client";
1623
-
1624
- import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
1625
-
1626
- function Collapsible({
1627
- ...props
1628
- }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
1629
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
1630
- }
1631
-
1632
- function CollapsibleTrigger({
1633
- ...props
1634
- }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
1635
- return (
1636
- <CollapsiblePrimitive.CollapsibleTrigger
1637
- data-slot="collapsible-trigger"
1638
- {...props}
1639
- />
1640
- );
1641
- }
1642
-
1643
- function CollapsibleContent({
1644
- ...props
1645
- }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
1646
- return (
1647
- <CollapsiblePrimitive.CollapsibleContent
1648
- data-slot="collapsible-content"
1649
- {...props}
1650
- />
1651
- );
1652
- }
1653
-
1654
- export { Collapsible, CollapsibleTrigger, CollapsibleContent };
1655
-
1656
- ```
1657
-
1658
- ## components/ui/dialog.tsx
1659
-
1660
- ```tsx
1661
- "use client";
1662
-
1663
- import * as React from "react";
1664
- import * as DialogPrimitive from "@radix-ui/react-dialog";
1665
- import { XIcon } from "lucide-react";
1666
-
1667
- import { cn } from "@/lib/utils";
1668
-
1669
- function Dialog({
1670
- ...props
1671
- }: React.ComponentProps<typeof DialogPrimitive.Root>) {
1672
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
1673
- }
1674
-
1675
- function DialogTrigger({
1676
- ...props
1677
- }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
1678
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
1679
- }
1680
-
1681
- function DialogPortal({
1682
- ...props
1683
- }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
1684
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
1685
- }
1686
-
1687
- function DialogClose({
1688
- ...props
1689
- }: React.ComponentProps<typeof DialogPrimitive.Close>) {
1690
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
1691
- }
1692
-
1693
- function DialogOverlay({
1694
- className,
1695
- ...props
1696
- }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
1697
- return (
1698
- <DialogPrimitive.Overlay
1699
- data-slot="dialog-overlay"
1700
- className={cn(
1701
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
1702
- className,
1703
- )}
1704
- {...props}
1705
- />
1706
- );
1707
- }
1708
-
1709
- function DialogContent({
1710
- className,
1711
- children,
1712
- showCloseButton = true,
1713
- ...props
1714
- }: React.ComponentProps<typeof DialogPrimitive.Content> & {
1715
- showCloseButton?: boolean;
1716
- }) {
1717
- return (
1718
- <DialogPortal data-slot="dialog-portal">
1719
- <DialogOverlay />
1720
- <DialogPrimitive.Content
1721
- data-slot="dialog-content"
1722
- className={cn(
1723
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
1724
- className,
1725
- )}
1726
- {...props}
1727
- >
1728
- {children}
1729
- {showCloseButton && (
1730
- <DialogPrimitive.Close
1731
- data-slot="dialog-close"
1732
- className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0"
1733
- >
1734
- <XIcon />
1735
- <span className="sr-only">Close</span>
1736
- </DialogPrimitive.Close>
1737
- )}
1738
- </DialogPrimitive.Content>
1739
- </DialogPortal>
1740
- );
1741
- }
1742
-
1743
- function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
1744
- return (
1745
- <div
1746
- data-slot="dialog-header"
1747
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
1748
- {...props}
1749
- />
1750
- );
1751
- }
1752
-
1753
- function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
1754
- return (
1755
- <div
1756
- data-slot="dialog-footer"
1757
- className={cn(
1758
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
1759
- className,
1760
- )}
1761
- {...props}
1762
- />
1763
- );
1764
- }
1765
-
1766
- function DialogTitle({
1767
- className,
1768
- ...props
1769
- }: React.ComponentProps<typeof DialogPrimitive.Title>) {
1770
- return (
1771
- <DialogPrimitive.Title
1772
- data-slot="dialog-title"
1773
- className={cn("font-semibold text-lg leading-none", className)}
1774
- {...props}
1775
- />
1776
- );
1777
- }
1778
-
1779
- function DialogDescription({
1780
- className,
1781
- ...props
1782
- }: React.ComponentProps<typeof DialogPrimitive.Description>) {
1783
- return (
1784
- <DialogPrimitive.Description
1785
- data-slot="dialog-description"
1786
- className={cn("text-muted-foreground text-sm", className)}
1787
- {...props}
1788
- />
1789
- );
1790
- }
1791
-
1792
- export {
1793
- Dialog,
1794
- DialogClose,
1795
- DialogContent,
1796
- DialogDescription,
1797
- DialogFooter,
1798
- DialogHeader,
1799
- DialogOverlay,
1800
- DialogPortal,
1801
- DialogTitle,
1802
- DialogTrigger,
1803
- };
1804
-
1805
- ```
1806
-
1807
- ## components/ui/tooltip.tsx
1808
-
1809
- ```tsx
1810
- "use client";
1811
-
1812
- import * as React from "react";
1813
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
1814
-
1815
- import { cn } from "@/lib/utils";
1816
-
1817
- function TooltipProvider({
1818
- delayDuration = 0,
1819
- ...props
1820
- }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
1821
- return (
1822
- <TooltipPrimitive.Provider
1823
- data-slot="tooltip-provider"
1824
- delayDuration={delayDuration}
1825
- {...props}
1826
- />
1827
- );
1828
- }
1829
-
1830
- function Tooltip({
1831
- ...props
1832
- }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
1833
- return (
1834
- <TooltipProvider>
1835
- <TooltipPrimitive.Root data-slot="tooltip" {...props} />
1836
- </TooltipProvider>
1837
- );
1838
- }
1839
-
1840
- function TooltipTrigger({
1841
- ...props
1842
- }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
1843
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
1844
- }
1845
-
1846
- function TooltipContent({
1847
- className,
1848
- sideOffset = 0,
1849
- children,
1850
- ...props
1851
- }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
1852
- return (
1853
- <TooltipPrimitive.Portal>
1854
- <TooltipPrimitive.Content
1855
- data-slot="tooltip-content"
1856
- sideOffset={sideOffset}
1857
- className={cn(
1858
- "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out",
1859
- className,
1860
- )}
1861
- {...props}
1862
- >
1863
- {children}
1864
- <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
1865
- </TooltipPrimitive.Content>
1866
- </TooltipPrimitive.Portal>
1867
- );
259
+ "iconLibrary": "lucide",
260
+ "registries": {
261
+ "@assistant-ui": "https://r.assistant-ui.com/{name}.json"
262
+ }
1868
263
  }
1869
264
 
1870
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
1871
-
1872
265
  ```
1873
266
 
1874
267
  ## lib/utils.ts
@@ -1910,9 +303,10 @@ export default nextConfig;
1910
303
  "start": "next start"
1911
304
  },
1912
305
  "dependencies": {
1913
- "@ai-sdk/openai": "^3.0.13",
306
+ "@ai-sdk/openai": "^3.0.25",
1914
307
  "@assistant-ui/react": "workspace:*",
1915
308
  "@assistant-ui/react-markdown": "workspace:*",
309
+ "@assistant-ui/ui": "workspace:*",
1916
310
  "@radix-ui/react-avatar": "^1.1.11",
1917
311
  "@radix-ui/react-collapsible": "^1.1.12",
1918
312
  "@radix-ui/react-dialog": "^1.1.15",
@@ -1920,19 +314,17 @@ export default nextConfig;
1920
314
  "@radix-ui/react-tooltip": "^1.2.8",
1921
315
  "class-variance-authority": "^0.7.1",
1922
316
  "clsx": "^2.1.1",
1923
- "lucide-react": "^0.562.0",
1924
- "next": "^16.1.4",
1925
- "react": "^19.2.3",
1926
- "react-dom": "^19.2.3",
1927
- "remark-gfm": "^4.0.1",
1928
- "tailwind-merge": "^3.4.0",
1929
- "zustand": "^5.0.10"
317
+ "lucide-react": "^0.563.0",
318
+ "next": "^16.1.6",
319
+ "react": "^19.2.4",
320
+ "react-dom": "^19.2.4",
321
+ "tailwind-merge": "^3.4.0"
1930
322
  },
1931
323
  "devDependencies": {
1932
324
  "@assistant-ui/x-buildutils": "workspace:*",
1933
325
  "@tailwindcss/postcss": "^4.1.18",
1934
- "@types/node": "^25.0.9",
1935
- "@types/react": "^19.2.9",
326
+ "@types/node": "^25.2.0",
327
+ "@types/react": "^19.2.10",
1936
328
  "@types/react-dom": "^19.2.3",
1937
329
  "postcss": "^8.5.6",
1938
330
  "tailwindcss": "^4.1.18",
@@ -1943,13 +335,64 @@ export default nextConfig;
1943
335
 
1944
336
  ```
1945
337
 
338
+ ## README.md
339
+
340
+ ```markdown
341
+ # External Store Integration
342
+
343
+ This example demonstrates how to use assistant-ui with an external message store using `useExternalStoreRuntime`.
344
+
345
+ ## Quick Start
346
+
347
+ ### Using CLI (Recommended)
348
+
349
+ ```bash
350
+ npx assistant-ui@latest create my-app --example with-external-store
351
+ cd my-app
352
+ ```
353
+
354
+ ### Environment Variables
355
+
356
+ Create `.env.local`:
357
+
358
+ ```
359
+ OPENAI_API_KEY=sk-...
360
+ ```
361
+
362
+ ### Run
363
+
364
+ ```bash
365
+ npm run dev
366
+ ```
367
+
368
+ ## Features
369
+
370
+ - External store runtime via `useExternalStoreRuntime`
371
+ - Custom message state management
372
+ - React state-based message storage
373
+ - Message conversion utilities
374
+
375
+ ## Related Documentation
376
+
377
+ - [assistant-ui Documentation](https://www.assistant-ui.com/docs)
378
+ - [External Store Runtime Guide](https://www.assistant-ui.com/docs/runtimes/external-store)
379
+
380
+ ```
381
+
1946
382
  ## tsconfig.json
1947
383
 
1948
384
  ```json
1949
385
  {
1950
386
  "extends": "@assistant-ui/x-buildutils/ts/next",
1951
387
  "compilerOptions": {
1952
- "paths": { "@/*": ["./*"] }
388
+ "paths": {
389
+ "@/*": ["./*"],
390
+ "@/components/assistant-ui/*": [
391
+ "../../packages/ui/src/components/assistant-ui/*"
392
+ ],
393
+ "@/components/ui/*": ["../../packages/ui/src/components/ui/*"],
394
+ "@assistant-ui/ui/*": ["../../packages/ui/src/*"]
395
+ }
1953
396
  },
1954
397
  "include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
1955
398
  "exclude": ["node_modules"]