@agents24/chat-react 0.1.7 → 0.1.8
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/README.md +25 -12
- package/dist/chunk-E3TJ3I6G.js +358 -0
- package/dist/chunk-E3TJ3I6G.js.map +1 -0
- package/dist/chunk-EWZO4QJI.js +140 -0
- package/dist/chunk-EWZO4QJI.js.map +1 -0
- package/dist/chunk-UU7OXHL3.js +11 -0
- package/dist/chunk-UU7OXHL3.js.map +1 -0
- package/dist/context-window.d.ts +38 -0
- package/dist/controller.d.ts +22 -0
- package/dist/index.cjs +392 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -530
- package/dist/index.js +41 -439
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +54 -0
- package/dist/model.d.ts +29 -0
- package/dist/renderers.d.ts +10 -0
- package/dist/sse.d.ts +3 -0
- package/dist/streaming-text.d.ts +24 -0
- package/dist/templates/agent-chat-shell.d.ts +25 -0
- package/dist/templates/index.cjs +523 -0
- package/dist/templates/index.cjs.map +1 -0
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.js +140 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/transport.d.ts +29 -0
- package/dist/types.d.ts +312 -0
- package/dist/ui/adapters.d.ts +36 -0
- package/dist/ui/attachment.d.ts +23 -0
- package/dist/ui/bubble.d.ts +17 -0
- package/dist/ui/index.cjs +943 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.ts +7 -0
- package/dist/ui/index.js +734 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/marker.d.ts +11 -0
- package/dist/ui/message-response.d.ts +7 -0
- package/dist/ui/message.d.ts +10 -0
- package/dist/ui/utils.d.ts +2 -0
- package/dist/viewport.d.ts +2 -0
- package/package.json +22 -4
- package/dist/index.d.cts +0 -530
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/adapters.ts","../../src/ui/attachment.tsx","../../src/ui/bubble.tsx","../../src/ui/message.tsx","../../src/ui/marker.tsx","../../src/ui/message-response.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n ChatAttachment as Agents24ChatAttachment,\n ChatMessage as Agents24ChatMessage,\n} from \"../types\";\nimport {\n Attachment,\n AttachmentContent,\n AttachmentDescription,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentTitle,\n} from \"./attachment\";\nimport { BubbleContent } from \"./bubble\";\nimport { Message } from \"./message\";\nimport { cn } from \"./utils\";\n\nexport type ChatMessageRole = Agents24ChatMessage[\"role\"] | \"system\" | \"data\";\n\nexport type ChatMessageProps = Omit<\n React.ComponentProps<typeof Message>,\n \"align\"\n> & {\n from: ChatMessageRole;\n align?: \"start\" | \"end\";\n};\n\ntype ShadcnMessageProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\";\n};\n\nexport function ChatMessage(input: ChatMessageProps): React.ReactElement {\n const { className, from, align, ...props } = input;\n const isUser = from === \"user\";\n const isRtl = props.dir === \"rtl\";\n const resolvedAlign = align || \"start\";\n const messageProps: ShadcnMessageProps = Object.assign({}, props);\n messageProps.align = resolvedAlign;\n messageProps.className = cn(\n \"group flex w-full flex-col gap-2 overflow-visible\",\n isUser\n ? cn(\"is-user max-w-[80%] justify-end\", isRtl ? \"mr-auto\" : \"ml-auto\")\n : \"is-assistant max-w-full\",\n className\n );\n return React.createElement(Message, messageProps);\n}\n\nexport type ChatMessageContentProps = React.ComponentProps<typeof BubbleContent> & {\n from?: ChatMessageRole;\n};\n\nexport function ChatMessageContent({\n className,\n ...props\n}: ChatMessageContentProps): React.ReactElement {\n return React.createElement(BubbleContent, {\n className: cn(\n \"flex w-full max-w-full min-w-0 flex-col gap-2 text-sm\",\n \"group-[.is-user]:w-fit group-[.is-user]:overflow-visible group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground\",\n \"group-[.is-assistant]:w-full group-[.is-assistant]:max-w-full group-[.is-assistant]:overflow-hidden group-[.is-assistant]:text-foreground\",\n props.dir === \"rtl\" ? \"group-[.is-assistant]:pr-0\" : \"group-[.is-assistant]:pl-0\",\n props.dir === \"rtl\" ? \"group-[.is-user]:mr-auto\" : \"group-[.is-user]:ml-auto\",\n className\n ),\n ...props,\n });\n}\n\nexport type ChatMessageActionsProps = React.ComponentProps<\"div\">;\n\nexport function ChatMessageActions({\n className,\n ...props\n}: ChatMessageActionsProps): React.ReactElement {\n return React.createElement(\"div\", {\n className: cn(\"flex items-center gap-1\", className),\n \"data-slot\": \"message-actions\",\n ...props,\n });\n}\n\nexport type ChatMessageActionProps = React.ComponentProps<\"button\"> & {\n label?: string;\n tooltip?: React.ReactNode;\n};\n\nexport function ChatMessageAction({\n children,\n className,\n label,\n tooltip,\n type = \"button\",\n ...props\n}: ChatMessageActionProps): React.ReactElement {\n const tooltipLabel = typeof tooltip === \"string\" ? tooltip : undefined;\n return React.createElement(\n \"button\",\n {\n \"aria-label\": label || tooltipLabel,\n className: cn(\n \"inline-flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n className\n ),\n title: tooltipLabel,\n type,\n ...props,\n },\n children,\n React.createElement(\n \"span\",\n { className: \"sr-only\" },\n label || tooltipLabel\n )\n );\n}\n\nexport type ChatAttachmentData = Agents24ChatAttachment & {\n type?: string;\n name?: string;\n mediaType?: string;\n contentType?: string;\n};\n\nexport type ChatAttachmentProps = React.ComponentProps<typeof Attachment> & {\n data: ChatAttachmentData;\n onRemove?: () => void;\n};\n\nexport function ChatAttachment({\n data,\n onRemove,\n orientation,\n ...props\n}: ChatAttachmentProps): React.ReactElement {\n const mediaType =\n data.mediaType || data.contentType || String(data.type || \"application/octet-stream\");\n const filename = data.filename || data.name || \"Attachment\";\n const isImage = mediaType.startsWith(\"image/\") && Boolean(data.url);\n return React.createElement(\n Attachment,\n {\n orientation: orientation || (isImage ? \"vertical\" : \"horizontal\"),\n ...props,\n },\n React.createElement(\n AttachmentMedia,\n { variant: isImage ? \"image\" : \"icon\" },\n isImage\n ? React.createElement(\"img\", {\n alt: filename,\n className: \"size-full object-cover\",\n src: data.url,\n })\n : React.createElement(\n \"span\",\n { \"aria-hidden\": \"true\", className: \"text-sm\" },\n filename.slice(0, 1).toUpperCase()\n )\n ),\n React.createElement(\n AttachmentContent,\n null,\n React.createElement(AttachmentTitle, null, filename),\n React.createElement(AttachmentDescription, null, mediaType)\n ),\n onRemove\n ? React.createElement(\n \"button\",\n {\n \"aria-label\": \"Remove attachment\",\n className:\n \"relative z-20 mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground\",\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n onRemove();\n },\n type: \"button\",\n },\n React.createElement(\"span\", { \"aria-hidden\": \"true\" }, \"x\")\n )\n : null\n );\n}\n\nexport type ChatAttachmentsProps = React.ComponentProps<typeof AttachmentGroup>;\n\nexport function ChatAttachments({\n children,\n className,\n ...props\n}: ChatAttachmentsProps): React.ReactElement | null {\n if (!children) return null;\n return React.createElement(\n AttachmentGroup,\n {\n className: cn(\n props.dir === \"rtl\" ? \"mr-auto\" : \"ml-auto\",\n \"w-fit flex-wrap overflow-visible\",\n className\n ),\n ...props,\n },\n children\n );\n}\n\nexport {\n ChatAttachment as MessageAttachment,\n ChatAttachments as MessageAttachments,\n ChatMessage as Message,\n ChatMessageAction as MessageAction,\n ChatMessageActions as MessageActions,\n ChatMessageContent as MessageContent,\n};\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { cn } from \"./utils\";\n\nconst attachmentVariants = cva(\n \"group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed\",\n {\n variants: {\n size: {\n default:\n \"gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2\",\n sm: \"gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5\",\n xs: \"gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1\",\n },\n orientation: {\n horizontal: \"min-w-40 items-center\",\n vertical: \"w-24 flex-col has-data-[slot=attachment-content]:w-30\",\n },\n },\n }\n);\n\nfunction Attachment({\n className,\n state = \"done\",\n size = \"default\",\n orientation = \"horizontal\",\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof attachmentVariants> & {\n state?: \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\";\n }) {\n return (\n <div\n data-slot=\"attachment\"\n data-state={state}\n data-size={size}\n data-orientation={orientation}\n className={cn(attachmentVariants({ size, orientation }), className)}\n {...props}\n />\n );\n}\n\nconst attachmentMediaVariants = cva(\n \"relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5\",\n {\n variants: {\n variant: {\n icon: \"\",\n image:\n \"opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover\",\n },\n },\n defaultVariants: {\n variant: \"icon\",\n },\n }\n);\n\nfunction AttachmentMedia({\n className,\n variant = \"icon\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof attachmentMediaVariants>) {\n return (\n <div\n data-slot=\"attachment-media\"\n data-variant={variant}\n className={cn(attachmentMediaVariants({ variant }), className)}\n {...props}\n />\n );\n}\n\nfunction AttachmentContent({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"attachment-content\"\n className={cn(\n \"max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AttachmentTitle({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"attachment-title\"\n className={cn(\n \"block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AttachmentDescription({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"attachment-description\"\n className={cn(\n \"mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80\",\n \"max-w-full\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AttachmentActions({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"attachment-actions\"\n className={cn(\n \"relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AttachmentAction({\n className,\n type = \"button\",\n ...props\n}: React.ComponentProps<\"button\">) {\n return (\n <button\n data-slot=\"attachment-action\"\n type={type}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AttachmentTrigger({\n className,\n asChild = false,\n type,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"attachment-trigger\"\n type={asChild ? undefined : (type ?? \"button\")}\n className={cn(\"absolute inset-0 z-10 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction AttachmentGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"attachment-group\"\n className={cn(\n \"flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n Attachment,\n AttachmentGroup,\n AttachmentMedia,\n AttachmentContent,\n AttachmentTitle,\n AttachmentDescription,\n AttachmentActions,\n AttachmentAction,\n AttachmentTrigger,\n attachmentVariants,\n attachmentMediaVariants,\n};\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { cn } from \"./utils\";\n\nfunction BubbleGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"bubble-group\"\n className={cn(\"flex min-w-0 flex-col gap-2\", className)}\n {...props}\n />\n );\n}\n\nconst bubbleVariants = cva(\n \"group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full\",\n {\n variants: {\n variant: {\n default:\n \"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80\",\n secondary:\n \"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]\",\n muted:\n \"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]\",\n tinted:\n \"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]\",\n outline:\n \"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30\",\n ghost:\n \"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50\",\n destructive:\n \"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n);\n\nfunction Bubble({\n variant = \"default\",\n align = \"start\",\n className,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof bubbleVariants> & {\n align?: \"start\" | \"end\";\n }) {\n return (\n <div\n data-slot=\"bubble\"\n data-variant={variant}\n data-align={align}\n className={cn(bubbleVariants({ variant }), className)}\n {...props}\n />\n );\n}\n\nfunction BubbleContent({\n asChild = false,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean;\n}) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n data-slot=\"bubble-content\"\n className={cn(\n \"w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst bubbleReactionsVariants = cva(\n \"absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0\",\n {\n variants: {\n side: {\n top: \"top-0 -translate-y-3/4\",\n bottom: \"bottom-0 translate-y-3/4\",\n },\n align: {\n start: \"left-3\",\n end: \"right-3\",\n },\n },\n defaultVariants: {\n side: \"bottom\",\n align: \"end\",\n },\n }\n);\n\nfunction BubbleReactions({\n side = \"bottom\",\n align = \"end\",\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\";\n side?: \"top\" | \"bottom\";\n}) {\n return (\n <div\n data-slot=\"bubble-reactions\"\n data-align={align}\n data-side={side}\n className={cn(bubbleReactionsVariants({ side, align }), className)}\n {...props}\n />\n );\n}\n\nexport { BubbleGroup, Bubble, BubbleContent, BubbleReactions, bubbleVariants };\n","import * as React from \"react\";\n\nimport { cn } from \"./utils\";\n\nfunction MessageGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"message-group\"\n className={cn(\"flex min-w-0 flex-col gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction Message({\n className,\n align = \"start\",\n ...props\n}: React.ComponentProps<\"div\"> & { align?: \"start\" | \"end\" }) {\n return (\n <div\n data-slot=\"message\"\n data-align={align}\n className={cn(\n \"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction MessageAvatar({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"message-avatar\"\n className={cn(\n \"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction MessageContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"message-content\"\n className={cn(\n \"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction MessageHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"message-header\"\n className={cn(\n \"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction MessageFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"message-footer\"\n className={cn(\n \"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n MessageGroup,\n Message,\n MessageAvatar,\n MessageContent,\n MessageFooter,\n MessageHeader,\n};\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { cn } from \"./utils\";\n\nconst markerVariants = cva(\n \"group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground\",\n {\n variants: {\n variant: {\n default: \"\",\n separator:\n \"before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border\",\n border: \"border-b border-border pb-2\",\n },\n },\n }\n);\n\nfunction Marker({\n className,\n variant = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof markerVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n data-slot=\"marker\"\n data-variant={variant}\n className={cn(markerVariants({ variant, className }))}\n {...props}\n />\n );\n}\n\nfunction MarkerIcon({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"marker-icon\"\n aria-hidden=\"true\"\n className={cn(\n \"size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction MarkerContent({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"marker-content\"\n className={cn(\n \"min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Marker, MarkerIcon, MarkerContent, markerVariants };\n","import * as React from \"react\";\nimport { defaultRehypePlugins, Streamdown } from \"streamdown\";\n\nimport { useStreamingText } from \"../streaming-text\";\nimport { cn } from \"./utils\";\n\nexport type MessageResponseProps = React.ComponentProps<typeof Streamdown> & {\n streaming?: boolean;\n streamingId?: string;\n};\n\ntype MarkdownNode = {\n tagName?: string;\n position?: {\n start?: { line?: number };\n end?: { line?: number };\n };\n};\n\ntype MarkdownElementProps = {\n children?: React.ReactNode;\n node?: MarkdownNode;\n};\n\nconst BLOCK_MARKDOWN_TAGS = new Set([\n \"blockquote\",\n \"div\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"hr\",\n \"ol\",\n \"pre\",\n \"table\",\n \"ul\",\n]);\n\nfunction isMultilineCodeNode(node?: MarkdownNode) {\n return (\n node?.tagName === \"code\" &&\n node.position?.start?.line !== undefined &&\n node.position?.end?.line !== undefined &&\n node.position.start.line !== node.position.end.line\n );\n}\n\nfunction hasBlockMarkdownChild(child: React.ReactNode): boolean {\n if (!React.isValidElement(child)) {\n return false;\n }\n\n if (typeof child.type === \"string\" && BLOCK_MARKDOWN_TAGS.has(child.type)) {\n return true;\n }\n\n const props = child.props as MarkdownElementProps;\n if (BLOCK_MARKDOWN_TAGS.has(props.node?.tagName || \"\") || isMultilineCodeNode(props.node)) {\n return true;\n }\n\n return React.Children.toArray(props.children).some(hasBlockMarkdownChild);\n}\n\nfunction MessageMarkdownParagraph({\n children,\n ...props\n}: React.ComponentProps<\"p\"> & MarkdownElementProps) {\n const domProps = { ...props };\n delete domProps.node;\n const childArray = React.Children.toArray(children).filter(\n (child) => child !== null && child !== \"\"\n );\n const isImageOnly =\n childArray.length === 1 &&\n React.isValidElement(childArray[0]) &&\n (childArray[0].props as MarkdownElementProps).node?.tagName === \"img\";\n\n if (isImageOnly) {\n return <>{children}</>;\n }\n\n if (childArray.some(hasBlockMarkdownChild)) {\n return <div {...domProps}>{children}</div>;\n }\n\n return <p {...domProps}>{children}</p>;\n}\n\nconst MESSAGE_RESPONSE_COMPONENTS = {\n p: MessageMarkdownParagraph,\n} satisfies NonNullable<React.ComponentProps<typeof Streamdown>[\"components\"]>;\n\ntype StreamdownRehypePlugins = NonNullable<\n React.ComponentProps<typeof Streamdown>[\"rehypePlugins\"]\n>;\n\nconst streamdownDefaultRehypePlugins = (defaultRehypePlugins || {}) as Record<\n string,\n unknown\n>;\nconst streamdownHardenPlugin = Array.isArray(\n streamdownDefaultRehypePlugins.harden\n)\n ? streamdownDefaultRehypePlugins.harden[0]\n : streamdownDefaultRehypePlugins.harden;\n\nconst MESSAGE_RESPONSE_REHYPE_PLUGINS = [\n ...Object.entries(streamdownDefaultRehypePlugins)\n .filter(([key]) => key !== \"harden\")\n .map(([, plugin]) => plugin),\n ...(streamdownHardenPlugin\n ? [\n [\n streamdownHardenPlugin,\n {\n allowDataImages: true,\n allowedImagePrefixes: [\"*\"],\n allowedLinkPrefixes: [\"*\"],\n allowedProtocols: [\"*\", \"reshet:\", \"source:\"],\n defaultOrigin: undefined,\n },\n ],\n ]\n : []),\n] as StreamdownRehypePlugins;\n\nexport const MessageResponse = React.memo(\n ({\n children,\n className,\n components,\n rehypePlugins,\n streaming = false,\n streamingId,\n ...props\n }: MessageResponseProps) => {\n const text =\n typeof children === \"string\" || typeof children === \"number\"\n ? String(children)\n : \"\";\n const streamingText = useStreamingText({\n charsPerSecond: 120,\n id: streamingId || text,\n isStreaming: streaming && text.length > 0,\n maxCatchupChars: 32,\n text,\n });\n const streamdownComponents = React.useMemo(\n () => ({ ...MESSAGE_RESPONSE_COMPONENTS, ...components }),\n [components]\n );\n\n return (\n <Streamdown\n className={cn(\"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0\", className)}\n components={streamdownComponents}\n rehypePlugins={rehypePlugins || MESSAGE_RESPONSE_REHYPE_PLUGINS}\n {...props}\n >\n {text ? streamingText.displayedText : children}\n </Streamdown>\n );\n },\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children &&\n prevProps.className === nextProps.className &&\n prevProps.streaming === nextProps.streaming &&\n prevProps.streamingId === nextProps.streamingId &&\n prevProps.components === nextProps.components\n);\n\nMessageResponse.displayName = \"MessageResponse\";\n"],"mappings":";;;;;;;;AAAA,YAAY,WAAW;;;ACCvB,SAAS,WAA8B;AACvC,SAAS,YAAY;AAiCjB;AA7BJ,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,SACE;AAAA,QACF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ACxC,iBAAiB;AAAA,MACjB;AAAA,IACF,CAAC;AACD,UAAM,uBAA6B;AAAA,MACjC,OAAO,EAAE,GAAG,6BAA6B,GAAG,WAAW;AAAA,MACvD,CAAC,UAAU;AAAA,IACb;AAEA,WACE,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,0DAA0D,SAAS;AAAA,QACjF,YAAY;AAAA,QACZ,eAAe,iBAAiB;AAAA,QAC/B,GAAG;AAAA,QAEH,iBAAO,cAAc,gBAAgB;AAAA;AAAA,IACxC;AAAA,EAEJ;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YACjC,UAAU,cAAc,UAAU,aAClC,UAAU,cAAc,UAAU,aAClC,UAAU,gBAAgB,UAAU,eACpC,UAAU,eAAe,UAAU;AACvC;AAEA,gBAAgB,cAAc;","names":["cva","Slot","jsx","cva","Slot","jsx","cva","Slot","jsx","cva","Slot","React","jsx"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const markerVariants: (props?: ({
|
|
4
|
+
variant?: "separator" | "default" | "border" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Marker({ className, variant, asChild, ...props }: React.ComponentProps<"div"> & VariantProps<typeof markerVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function MarkerIcon({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
10
|
+
declare function MarkerContent({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
11
|
+
export { Marker, MarkerIcon, MarkerContent, markerVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Streamdown } from "streamdown";
|
|
3
|
+
export type MessageResponseProps = React.ComponentProps<typeof Streamdown> & {
|
|
4
|
+
streaming?: boolean;
|
|
5
|
+
streamingId?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const MessageResponse: React.MemoExoticComponent<({ children, className, components, rehypePlugins, streaming, streamingId, ...props }: MessageResponseProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function MessageGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function Message({ className, align, ...props }: React.ComponentProps<"div"> & {
|
|
4
|
+
align?: "start" | "end";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function MessageAvatar({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function MessageHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function MessageFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
export { MessageGroup, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { MessageScroller, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, } from "@shadcn/react/message-scroller";
|
|
2
|
+
export type { MessageScrollerDefaultScrollPosition, MessageScrollerScrollAlign, MessageScrollerScrollable, MessageScrollerScrollOptions, MessageScrollerVisibilityState, } from "@shadcn/react/message-scroller";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents24/chat-react",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Headless React controller and
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "Headless React controller and MessageScroller primitives for Agents24 chat surfaces.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./ui": {
|
|
17
|
+
"types": "./dist/ui/index.d.ts",
|
|
18
|
+
"import": "./dist/ui/index.js",
|
|
19
|
+
"require": "./dist/ui/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./templates": {
|
|
22
|
+
"types": "./dist/templates/index.d.ts",
|
|
23
|
+
"import": "./dist/templates/index.js",
|
|
24
|
+
"require": "./dist/templates/index.cjs"
|
|
15
25
|
}
|
|
16
26
|
},
|
|
17
27
|
"files": [
|
|
@@ -22,11 +32,19 @@
|
|
|
22
32
|
"access": "public"
|
|
23
33
|
},
|
|
24
34
|
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
35
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
26
36
|
"test": "tsx --test tests/*.test.ts"
|
|
27
37
|
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
40
|
+
"@shadcn/react": "0.1.0",
|
|
41
|
+
"class-variance-authority": "^0.7.1",
|
|
42
|
+
"clsx": "^2.1.1",
|
|
43
|
+
"streamdown": "^1.5.1",
|
|
44
|
+
"tailwind-merge": "^3.6.0"
|
|
45
|
+
},
|
|
28
46
|
"peerDependencies": {
|
|
29
|
-
"react": ">=
|
|
47
|
+
"react": ">=19.0.0"
|
|
30
48
|
},
|
|
31
49
|
"devDependencies": {
|
|
32
50
|
"@types/react": "^19.2.3",
|