@lukeashford/aurelius 3.7.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1 from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import { Config } from 'dompurify';
3
3
 
4
4
  type ButtonVariant = 'primary' | 'important' | 'elevated' | 'outlined' | 'featured' | 'ghost' | 'danger';
@@ -682,15 +682,15 @@ interface MessageActionsConfig {
682
682
  */
683
683
  showCopy?: boolean;
684
684
  }
685
- interface MessageProps extends React$1.HTMLAttributes<HTMLDivElement> {
685
+ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'content'> {
686
686
  /**
687
687
  * Whether the message is from the user or the assistant
688
688
  */
689
689
  variant?: MessageVariant;
690
690
  /**
691
- * The message content (supports Markdown)
691
+ * The message content (supports Markdown if string)
692
692
  */
693
- content: string;
693
+ content: string | React$1.ReactNode;
694
694
  /**
695
695
  * Whether the message is currently being streamed (shows cursor)
696
696
  */
@@ -1185,6 +1185,7 @@ interface ArtifactNode {
1185
1185
  * - Retry assistant responses (creating a new branch)
1186
1186
  * - Navigate between different conversation branches
1187
1187
  */
1188
+
1188
1189
  /**
1189
1190
  * A node in the conversation tree
1190
1191
  */
@@ -1198,9 +1199,9 @@ interface MessageNode {
1198
1199
  */
1199
1200
  role: 'user' | 'assistant';
1200
1201
  /**
1201
- * The message content (may include HTML/markdown)
1202
+ * The message content (may include HTML/markdown or React components)
1202
1203
  */
1203
- content: string;
1204
+ content: ReactNode;
1204
1205
  /**
1205
1206
  * ID of the parent message (null for root messages)
1206
1207
  */
@@ -1283,14 +1284,14 @@ declare function switchBranch(tree: ConversationTree, nodeId: string, direction:
1283
1284
  /**
1284
1285
  * Update a node's content (e.g., during streaming)
1285
1286
  */
1286
- declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: string, isStreaming?: boolean): ConversationTree;
1287
+ declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
1287
1288
  /**
1288
1289
  * Convert a flat message array to a conversation tree
1289
1290
  */
1290
1291
  declare function messagesToTree(messages: Array<{
1291
1292
  id: string;
1292
1293
  role: 'user' | 'assistant';
1293
- content: string;
1294
+ content: ReactNode;
1294
1295
  isStreaming?: boolean;
1295
1296
  }>): ConversationTree;
1296
1297
  /**
@@ -1298,24 +1299,6 @@ declare function messagesToTree(messages: Array<{
1298
1299
  */
1299
1300
  declare function isBranchPoint(tree: ConversationTree, nodeId: string): boolean;
1300
1301
 
1301
- interface ChatMessage {
1302
- /**
1303
- * Unique identifier for the message
1304
- */
1305
- id: string;
1306
- /**
1307
- * Whether the message is from the user or the assistant
1308
- */
1309
- variant: 'user' | 'assistant';
1310
- /**
1311
- * Message content (Markdown supported)
1312
- */
1313
- content: string;
1314
- /**
1315
- * Whether the message is currently streaming
1316
- */
1317
- isStreaming?: boolean;
1318
- }
1319
1302
  interface Conversation {
1320
1303
  /**
1321
1304
  * Unique identifier for the conversation
@@ -1345,7 +1328,7 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1345
1328
  * Array of messages in the conversation (flat mode)
1346
1329
  * Use this OR conversationTree, not both
1347
1330
  */
1348
- messages?: ChatMessage[];
1331
+ messages?: MessageNode[];
1349
1332
  /**
1350
1333
  * Conversation tree for branching support
1351
1334
  * Use this OR messages, not both
@@ -2042,4 +2025,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
2042
2025
 
2043
2026
  declare const version = "2.0.0";
2044
2027
 
2045
- export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, type ChatMessage, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
2028
+ export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1 from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import { Config } from 'dompurify';
3
3
 
4
4
  type ButtonVariant = 'primary' | 'important' | 'elevated' | 'outlined' | 'featured' | 'ghost' | 'danger';
@@ -682,15 +682,15 @@ interface MessageActionsConfig {
682
682
  */
683
683
  showCopy?: boolean;
684
684
  }
685
- interface MessageProps extends React$1.HTMLAttributes<HTMLDivElement> {
685
+ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'content'> {
686
686
  /**
687
687
  * Whether the message is from the user or the assistant
688
688
  */
689
689
  variant?: MessageVariant;
690
690
  /**
691
- * The message content (supports Markdown)
691
+ * The message content (supports Markdown if string)
692
692
  */
693
- content: string;
693
+ content: string | React$1.ReactNode;
694
694
  /**
695
695
  * Whether the message is currently being streamed (shows cursor)
696
696
  */
@@ -1185,6 +1185,7 @@ interface ArtifactNode {
1185
1185
  * - Retry assistant responses (creating a new branch)
1186
1186
  * - Navigate between different conversation branches
1187
1187
  */
1188
+
1188
1189
  /**
1189
1190
  * A node in the conversation tree
1190
1191
  */
@@ -1198,9 +1199,9 @@ interface MessageNode {
1198
1199
  */
1199
1200
  role: 'user' | 'assistant';
1200
1201
  /**
1201
- * The message content (may include HTML/markdown)
1202
+ * The message content (may include HTML/markdown or React components)
1202
1203
  */
1203
- content: string;
1204
+ content: ReactNode;
1204
1205
  /**
1205
1206
  * ID of the parent message (null for root messages)
1206
1207
  */
@@ -1283,14 +1284,14 @@ declare function switchBranch(tree: ConversationTree, nodeId: string, direction:
1283
1284
  /**
1284
1285
  * Update a node's content (e.g., during streaming)
1285
1286
  */
1286
- declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: string, isStreaming?: boolean): ConversationTree;
1287
+ declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
1287
1288
  /**
1288
1289
  * Convert a flat message array to a conversation tree
1289
1290
  */
1290
1291
  declare function messagesToTree(messages: Array<{
1291
1292
  id: string;
1292
1293
  role: 'user' | 'assistant';
1293
- content: string;
1294
+ content: ReactNode;
1294
1295
  isStreaming?: boolean;
1295
1296
  }>): ConversationTree;
1296
1297
  /**
@@ -1298,24 +1299,6 @@ declare function messagesToTree(messages: Array<{
1298
1299
  */
1299
1300
  declare function isBranchPoint(tree: ConversationTree, nodeId: string): boolean;
1300
1301
 
1301
- interface ChatMessage {
1302
- /**
1303
- * Unique identifier for the message
1304
- */
1305
- id: string;
1306
- /**
1307
- * Whether the message is from the user or the assistant
1308
- */
1309
- variant: 'user' | 'assistant';
1310
- /**
1311
- * Message content (Markdown supported)
1312
- */
1313
- content: string;
1314
- /**
1315
- * Whether the message is currently streaming
1316
- */
1317
- isStreaming?: boolean;
1318
- }
1319
1302
  interface Conversation {
1320
1303
  /**
1321
1304
  * Unique identifier for the conversation
@@ -1345,7 +1328,7 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1345
1328
  * Array of messages in the conversation (flat mode)
1346
1329
  * Use this OR conversationTree, not both
1347
1330
  */
1348
- messages?: ChatMessage[];
1331
+ messages?: MessageNode[];
1349
1332
  /**
1350
1333
  * Conversation tree for branching support
1351
1334
  * Use this OR messages, not both
@@ -2042,4 +2025,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
2042
2025
 
2043
2026
  declare const version = "2.0.0";
2044
2027
 
2045
- export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, type ChatMessage, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
2028
+ export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
package/dist/index.js CHANGED
@@ -4126,7 +4126,7 @@ var Message = import_react55.default.forwardRef(
4126
4126
  const isUser = variant === "user";
4127
4127
  const [copied, setCopied] = (0, import_react55.useState)(false);
4128
4128
  const [isEditing, setIsEditing] = (0, import_react55.useState)(false);
4129
- const [editValue, setEditValue] = (0, import_react55.useState)(content);
4129
+ const [editValue, setEditValue] = (0, import_react55.useState)(typeof content === "string" ? content : "");
4130
4130
  const textareaRef = (0, import_react55.useRef)(null);
4131
4131
  const showBranchNav = branchInfo && branchInfo.total > 1;
4132
4132
  const showActions = actions && !hideActions && !isStreaming;
@@ -4140,6 +4140,9 @@ var Message = import_react55.default.forwardRef(
4140
4140
  }
4141
4141
  }, [isEditing]);
4142
4142
  const handleCopy = async () => {
4143
+ if (typeof content !== "string") {
4144
+ return;
4145
+ }
4143
4146
  try {
4144
4147
  await navigator.clipboard.writeText(content);
4145
4148
  setCopied(true);
@@ -4156,16 +4159,20 @@ var Message = import_react55.default.forwardRef(
4156
4159
  }
4157
4160
  };
4158
4161
  const handleStartEdit = () => {
4159
- setEditValue(content);
4160
- setIsEditing(true);
4162
+ if (typeof content === "string") {
4163
+ setEditValue(content);
4164
+ setIsEditing(true);
4165
+ }
4161
4166
  };
4162
4167
  const handleCancelEdit = () => {
4163
4168
  setIsEditing(false);
4164
- setEditValue(content);
4169
+ if (typeof content === "string") {
4170
+ setEditValue(content);
4171
+ }
4165
4172
  };
4166
4173
  const handleSubmitEdit = () => {
4167
4174
  const trimmed = editValue.trim();
4168
- if (trimmed && trimmed !== content) {
4175
+ if (typeof content === "string" && trimmed && trimmed !== content) {
4169
4176
  actions?.onEdit?.(trimmed);
4170
4177
  }
4171
4178
  setIsEditing(false);
@@ -4232,7 +4239,7 @@ var Message = import_react55.default.forwardRef(
4232
4239
  variantStyles2[variant]
4233
4240
  )
4234
4241
  },
4235
- /* @__PURE__ */ import_react55.default.createElement(
4242
+ typeof content === "string" ? /* @__PURE__ */ import_react55.default.createElement(
4236
4243
  MarkdownContent,
4237
4244
  {
4238
4245
  content,
@@ -4240,7 +4247,7 @@ var Message = import_react55.default.forwardRef(
4240
4247
  isStreaming,
4241
4248
  cursorClassName: "ml-0.5"
4242
4249
  }
4243
- )
4250
+ ) : content
4244
4251
  ),
4245
4252
  showActions && !isEditing && /* @__PURE__ */ import_react55.default.createElement("div", { className: cx(
4246
4253
  "flex items-center gap-0.5 mt-1",
@@ -4252,7 +4259,7 @@ var Message = import_react55.default.forwardRef(
4252
4259
  label: copied ? "Copied!" : "Copy message"
4253
4260
  },
4254
4261
  copied ? /* @__PURE__ */ import_react55.default.createElement(CheckIcon, null) : /* @__PURE__ */ import_react55.default.createElement(CopyIcon, null)
4255
- ), isUser && actions.onEdit && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react55.default.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react55.default.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ import_react55.default.createElement(import_react55.default.Fragment, null, /* @__PURE__ */ import_react55.default.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ import_react55.default.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ import_react55.default.createElement(GitBranchIcon, null), /* @__PURE__ */ import_react55.default.createElement(
4262
+ ), isUser && actions.onEdit && typeof content === "string" && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react55.default.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react55.default.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ import_react55.default.createElement(import_react55.default.Fragment, null, /* @__PURE__ */ import_react55.default.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ import_react55.default.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ import_react55.default.createElement(GitBranchIcon, null), /* @__PURE__ */ import_react55.default.createElement(
4256
4263
  "button",
4257
4264
  {
4258
4265
  type: "button",
@@ -4651,14 +4658,13 @@ function addMessageToTree(tree, message, parentId = null) {
4651
4658
  } else if (!parentId) {
4652
4659
  branchIndex = newRootIds.length;
4653
4660
  }
4654
- const newNode = {
4661
+ newNodes[message.id] = {
4655
4662
  ...message,
4656
4663
  parentId,
4657
4664
  children: [],
4658
4665
  branchIndex,
4659
4666
  createdAt: message.createdAt ?? Date.now()
4660
4667
  };
4661
- newNodes[message.id] = newNode;
4662
4668
  if (parentId && newNodes[parentId]) {
4663
4669
  newNodes[parentId] = {
4664
4670
  ...newNodes[parentId],
@@ -4734,8 +4740,7 @@ function switchBranch(tree, nodeId, direction) {
4734
4740
  return tree;
4735
4741
  }
4736
4742
  const newIndex = direction === "next" ? (currentIndex + 1) % siblings.length : (currentIndex - 1 + siblings.length) % siblings.length;
4737
- const newNodeId = siblings[newIndex];
4738
- let leafId = newNodeId;
4743
+ let leafId = siblings[newIndex];
4739
4744
  let currentNode = tree.nodes[leafId];
4740
4745
  while (currentNode && currentNode.children.length > 0) {
4741
4746
  leafId = currentNode.children[0];
@@ -6935,19 +6940,13 @@ var ChatInterface = import_react78.default.forwardRef(
6935
6940
  const isTreeMode = !!conversationTree;
6936
6941
  const effectiveMessages = (0, import_react78.useMemo)(() => {
6937
6942
  if (isTreeMode && conversationTree) {
6938
- const pathNodes = getActivePathMessages(conversationTree);
6939
- return pathNodes.map((node) => ({
6940
- id: node.id,
6941
- variant: node.role,
6942
- content: node.content,
6943
- isStreaming: node.isStreaming
6944
- }));
6943
+ return getActivePathMessages(conversationTree);
6945
6944
  }
6946
- return messages;
6945
+ return messages || [];
6947
6946
  }, [isTreeMode, conversationTree, messages]);
6948
6947
  const latestUserMessageIndex = (0, import_react78.useMemo)(() => {
6949
6948
  for (let i = effectiveMessages.length - 1; i >= 0; i--) {
6950
- if (effectiveMessages[i].variant === "user") {
6949
+ if (effectiveMessages[i].role === "user") {
6951
6950
  return i;
6952
6951
  }
6953
6952
  }
@@ -7004,10 +7003,23 @@ var ChatInterface = import_react78.default.forwardRef(
7004
7003
  }
7005
7004
  const actions = enableMessageActions ? {
7006
7005
  showCopy: true,
7007
- onEdit: msg.variant === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
7008
- onRetry: msg.variant === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
7006
+ onEdit: msg.role === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
7007
+ onRetry: msg.role === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
7009
7008
  } : void 0;
7010
- return { ...msg, branchInfo, actions };
7009
+ const {
7010
+ role,
7011
+ parentId,
7012
+ children,
7013
+ branchIndex,
7014
+ createdAt,
7015
+ ...rest2
7016
+ } = msg;
7017
+ return {
7018
+ ...rest2,
7019
+ variant: role,
7020
+ branchInfo,
7021
+ actions
7022
+ };
7011
7023
  });
7012
7024
  }, [
7013
7025
  effectiveMessages,