veryfront 0.0.58 → 0.0.60

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.
@@ -40,7 +40,7 @@ function cn(...classes) {
40
40
  }
41
41
 
42
42
  // src/ai/react/components/chat.tsx
43
- import * as React7 from "react";
43
+ import * as React8 from "react";
44
44
 
45
45
  // src/ai/react/primitives/chat-container.tsx
46
46
  import * as React from "react";
@@ -523,9 +523,185 @@ function getErrorMessage(error) {
523
523
  }
524
524
  }
525
525
 
526
+ // src/ai/react/components/markdown.tsx
527
+ import * as React7 from "react";
528
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
529
+ var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
530
+ var ReactMarkdown = null;
531
+ var remarkGfm = null;
532
+ var rehypeHighlight = null;
533
+ var mermaidPromise = null;
534
+ var mermaidModule = null;
535
+ async function loadMermaid() {
536
+ if (!isBrowser)
537
+ return null;
538
+ if (mermaidModule)
539
+ return mermaidModule;
540
+ if (!mermaidPromise) {
541
+ mermaidPromise = import("mermaid");
542
+ }
543
+ mermaidModule = await mermaidPromise;
544
+ mermaidModule.default.initialize({
545
+ startOnLoad: false,
546
+ theme: "neutral",
547
+ securityLevel: "loose"
548
+ });
549
+ return mermaidModule;
550
+ }
551
+ function MermaidDiagram({ code }) {
552
+ const [svg, setSvg] = React7.useState("");
553
+ const [error, setError] = React7.useState("");
554
+ React7.useEffect(() => {
555
+ if (!isBrowser)
556
+ return;
557
+ let cancelled = false;
558
+ async function render() {
559
+ try {
560
+ const mermaid = await loadMermaid();
561
+ if (!mermaid)
562
+ return;
563
+ const id = `mermaid-${Math.random().toString(36).slice(2, 9)}`;
564
+ const { svg: renderedSvg } = await mermaid.default.render(id, code);
565
+ if (!cancelled) {
566
+ setSvg(renderedSvg);
567
+ setError("");
568
+ }
569
+ } catch (err) {
570
+ if (!cancelled) {
571
+ setError(err instanceof Error ? err.message : "Failed to render diagram");
572
+ }
573
+ }
574
+ }
575
+ render();
576
+ return () => {
577
+ cancelled = true;
578
+ };
579
+ }, [code]);
580
+ if (!isBrowser) {
581
+ return /* @__PURE__ */ jsx6("pre", { className: "my-4 p-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg overflow-auto", children: /* @__PURE__ */ jsx6("code", { children: code }) });
582
+ }
583
+ if (error) {
584
+ return /* @__PURE__ */ jsxs3("div", { className: "my-4 p-4 bg-red-50 dark:bg-red-900/20 rounded-lg text-red-600 dark:text-red-400 text-sm", children: [
585
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: "Mermaid Error" }),
586
+ /* @__PURE__ */ jsx6("p", { children: error }),
587
+ /* @__PURE__ */ jsx6("pre", { className: "mt-2 text-xs overflow-auto", children: code })
588
+ ] });
589
+ }
590
+ if (!svg) {
591
+ return /* @__PURE__ */ jsx6("div", { className: "my-4 p-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg animate-pulse", children: /* @__PURE__ */ jsx6("div", { className: "h-32 flex items-center justify-center text-neutral-400", children: "Loading diagram..." }) });
592
+ }
593
+ return /* @__PURE__ */ jsx6(
594
+ "div",
595
+ {
596
+ className: "my-4 flex justify-center overflow-auto",
597
+ dangerouslySetInnerHTML: { __html: svg }
598
+ }
599
+ );
600
+ }
601
+ function CodeBlock({
602
+ language,
603
+ code,
604
+ inline,
605
+ enableMermaid,
606
+ renderCodeBlock
607
+ }) {
608
+ if (renderCodeBlock) {
609
+ return /* @__PURE__ */ jsx6(Fragment2, { children: renderCodeBlock({ language, code, inline }) });
610
+ }
611
+ if (inline) {
612
+ return /* @__PURE__ */ jsx6("code", { className: "bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 rounded text-sm font-mono", children: code });
613
+ }
614
+ if (enableMermaid && language === "mermaid") {
615
+ return /* @__PURE__ */ jsx6(MermaidDiagram, { code });
616
+ }
617
+ return /* @__PURE__ */ jsx6("pre", { className: "my-4 p-4 bg-neutral-900 dark:bg-neutral-950 rounded-lg overflow-auto", children: /* @__PURE__ */ jsx6("code", { className: language ? `language-${language} hljs` : "hljs", children: code }) });
618
+ }
619
+ function Markdown({
620
+ children,
621
+ className,
622
+ enableMermaid = true,
623
+ renderCodeBlock
624
+ }) {
625
+ const [isLoaded, setIsLoaded] = React7.useState(false);
626
+ const [, forceUpdate] = React7.useReducer((x) => x + 1, 0);
627
+ React7.useEffect(() => {
628
+ async function load() {
629
+ if (!ReactMarkdown) {
630
+ const [rmModule, gfmModule, highlightModule] = await Promise.all([
631
+ import("react-markdown"),
632
+ import("remark-gfm"),
633
+ import("rehype-highlight")
634
+ ]);
635
+ ReactMarkdown = rmModule.default;
636
+ remarkGfm = gfmModule.default;
637
+ rehypeHighlight = highlightModule.default;
638
+ }
639
+ setIsLoaded(true);
640
+ forceUpdate();
641
+ }
642
+ load();
643
+ }, []);
644
+ if (!isLoaded || !ReactMarkdown) {
645
+ return /* @__PURE__ */ jsx6("div", { className: cn("prose prose-sm dark:prose-invert max-w-none", className), children: /* @__PURE__ */ jsx6("p", { className: "whitespace-pre-wrap", children }) });
646
+ }
647
+ return /* @__PURE__ */ jsx6("div", { className: cn("prose prose-sm dark:prose-invert max-w-none", className), children: /* @__PURE__ */ jsx6(
648
+ ReactMarkdown,
649
+ {
650
+ remarkPlugins: remarkGfm ? [remarkGfm] : [],
651
+ rehypePlugins: rehypeHighlight ? [rehypeHighlight] : [],
652
+ components: {
653
+ // Custom code rendering
654
+ // deno-lint-ignore no-explicit-any
655
+ code(props) {
656
+ const { className: codeClassName, children: codeChildren, node } = props;
657
+ const match = /language-(\w+)/.exec(codeClassName || "");
658
+ const language = match ? match[1] : void 0;
659
+ const code = String(codeChildren).replace(/\n$/, "");
660
+ const isInline = !node?.position?.start?.line;
661
+ return /* @__PURE__ */ jsx6(
662
+ CodeBlock,
663
+ {
664
+ language,
665
+ code,
666
+ inline: isInline,
667
+ enableMermaid,
668
+ renderCodeBlock
669
+ }
670
+ );
671
+ },
672
+ // Style tables
673
+ // deno-lint-ignore no-explicit-any
674
+ table(props) {
675
+ return /* @__PURE__ */ jsx6("div", { className: "my-4 overflow-auto", children: /* @__PURE__ */ jsx6("table", { className: "min-w-full divide-y divide-neutral-200 dark:divide-neutral-700", children: props.children }) });
676
+ },
677
+ // Style links
678
+ // deno-lint-ignore no-explicit-any
679
+ a(props) {
680
+ return /* @__PURE__ */ jsx6(
681
+ "a",
682
+ {
683
+ href: props.href,
684
+ className: "text-blue-600 dark:text-blue-400 hover:underline",
685
+ target: "_blank",
686
+ rel: "noopener noreferrer",
687
+ children: props.children
688
+ }
689
+ );
690
+ },
691
+ // Style blockquotes
692
+ // deno-lint-ignore no-explicit-any
693
+ blockquote(props) {
694
+ return /* @__PURE__ */ jsx6("blockquote", { className: "border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 my-4 text-neutral-600 dark:text-neutral-400 italic", children: props.children });
695
+ }
696
+ },
697
+ children
698
+ }
699
+ ) });
700
+ }
701
+
526
702
  // src/ai/react/components/chat.tsx
527
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
528
- var Chat = React7.forwardRef(
703
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
704
+ var Chat = React8.forwardRef(
529
705
  ({
530
706
  messages,
531
707
  input,
@@ -548,7 +724,7 @@ var Chat = React7.forwardRef(
548
724
  multiline = false
549
725
  }, ref) => {
550
726
  const theme = mergeThemes(defaultChatTheme, userTheme);
551
- const messagesEndRef = React7.useRef(null);
727
+ const messagesEndRef = React8.useRef(null);
552
728
  const inputChangeHandler = onChange || handleInputChange || (() => {
553
729
  });
554
730
  const submitHandler = onSubmit || handleSubmit;
@@ -559,7 +735,7 @@ var Chat = React7.forwardRef(
559
735
  }
560
736
  }
561
737
  });
562
- const voiceHandler = React7.useMemo(() => {
738
+ const voiceHandler = React8.useMemo(() => {
563
739
  if (onVoice)
564
740
  return onVoice;
565
741
  if (enableVoice && voice.isSupported && setInput) {
@@ -567,19 +743,19 @@ var Chat = React7.forwardRef(
567
743
  }
568
744
  return void 0;
569
745
  }, [onVoice, enableVoice, voice.isSupported, voice.toggle, setInput]);
570
- React7.useEffect(() => {
746
+ React8.useEffect(() => {
571
747
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
572
748
  }, [messages]);
573
- return /* @__PURE__ */ jsxs3(
749
+ return /* @__PURE__ */ jsxs4(
574
750
  ChatContainer,
575
751
  {
576
752
  ref,
577
753
  className: cn(theme.container, className),
578
754
  style: { maxHeight },
579
755
  children: [
580
- /* @__PURE__ */ jsx6(MessageList, { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsxs3("div", { className: "max-w-2xl mx-auto px-4 py-4 space-y-2", children: [
756
+ /* @__PURE__ */ jsx7(MessageList, { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "max-w-2xl mx-auto px-4 py-4 space-y-2", children: [
581
757
  messages.map(
582
- (msg) => renderMessage ? /* @__PURE__ */ jsx6(React7.Fragment, { children: renderMessage(msg) }, msg.id) : /* @__PURE__ */ jsx6(
758
+ (msg) => renderMessage ? /* @__PURE__ */ jsx7(React8.Fragment, { children: renderMessage(msg) }, msg.id) : /* @__PURE__ */ jsx7(
583
759
  MessageItem,
584
760
  {
585
761
  role: msg.role,
@@ -587,26 +763,26 @@ var Chat = React7.forwardRef(
587
763
  "flex",
588
764
  msg.role === "user" ? "justify-end" : "justify-start"
589
765
  ),
590
- children: /* @__PURE__ */ jsx6("div", { className: theme.message?.[msg.role] || theme.message?.assistant, children: /* @__PURE__ */ jsx6("p", { className: "whitespace-pre-wrap text-[15px] leading-relaxed", children: msg.content }) })
766
+ children: /* @__PURE__ */ jsx7("div", { className: theme.message?.[msg.role] || theme.message?.assistant, children: msg.role === "user" ? /* @__PURE__ */ jsx7("p", { className: "whitespace-pre-wrap text-[15px] leading-relaxed", children: msg.content }) : /* @__PURE__ */ jsx7(Markdown, { className: "text-[15px] leading-relaxed", children: msg.content }) })
591
767
  },
592
768
  msg.id
593
769
  )
594
770
  ),
595
- isLoading && /* @__PURE__ */ jsx6("div", { className: "flex justify-start", children: /* @__PURE__ */ jsx6("div", { className: "bg-neutral-100 dark:bg-neutral-800 rounded-[20px] rounded-bl-[4px] px-4 py-3", children: /* @__PURE__ */ jsxs3("div", { className: "flex gap-1.5 items-center", children: [
596
- /* @__PURE__ */ jsx6("span", { className: cn(theme.loading) }),
597
- /* @__PURE__ */ jsx6("span", { className: cn(theme.loading), style: { animationDelay: "0.15s" } }),
598
- /* @__PURE__ */ jsx6("span", { className: cn(theme.loading), style: { animationDelay: "0.3s" } })
771
+ isLoading && /* @__PURE__ */ jsx7("div", { className: "flex justify-start", children: /* @__PURE__ */ jsx7("div", { className: "bg-neutral-100 dark:bg-neutral-800 rounded-[20px] rounded-bl-[4px] px-4 py-3", children: /* @__PURE__ */ jsxs4("div", { className: "flex gap-1.5 items-center", children: [
772
+ /* @__PURE__ */ jsx7("span", { className: cn(theme.loading) }),
773
+ /* @__PURE__ */ jsx7("span", { className: cn(theme.loading), style: { animationDelay: "0.15s" } }),
774
+ /* @__PURE__ */ jsx7("span", { className: cn(theme.loading), style: { animationDelay: "0.3s" } })
599
775
  ] }) }) }),
600
- /* @__PURE__ */ jsx6("div", { ref: messagesEndRef })
776
+ /* @__PURE__ */ jsx7("div", { ref: messagesEndRef })
601
777
  ] }) }),
602
- error && /* @__PURE__ */ jsx6("div", { className: "mx-4 mb-2 px-4 py-3 bg-red-50 dark:bg-red-900/20 rounded-2xl text-red-600 dark:text-red-400 text-sm", children: error.message }),
603
- /* @__PURE__ */ jsx6("div", { className: "flex-shrink-0 bg-white dark:bg-neutral-900 border-t border-neutral-200 dark:border-neutral-800", children: /* @__PURE__ */ jsx6(
778
+ error && /* @__PURE__ */ jsx7("div", { className: "mx-4 mb-2 px-4 py-3 bg-red-50 dark:bg-red-900/20 rounded-2xl text-red-600 dark:text-red-400 text-sm", children: error.message }),
779
+ /* @__PURE__ */ jsx7("div", { className: "flex-shrink-0 bg-white dark:bg-neutral-900 border-t border-neutral-200 dark:border-neutral-800", children: /* @__PURE__ */ jsx7(
604
780
  "form",
605
781
  {
606
782
  onSubmit: submitHandler,
607
783
  className: "max-w-2xl mx-auto px-4 py-3",
608
- children: /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
609
- /* @__PURE__ */ jsx6(
784
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
785
+ /* @__PURE__ */ jsx7(
610
786
  InputBox,
611
787
  {
612
788
  value: voice.isListening ? voice.transcript || input : input,
@@ -617,7 +793,7 @@ var Chat = React7.forwardRef(
617
793
  className: theme.input
618
794
  }
619
795
  ),
620
- /* @__PURE__ */ jsx6(
796
+ /* @__PURE__ */ jsx7(
621
797
  SubmitButton,
622
798
  {
623
799
  isLoading: isLoading || voice.isListening,
@@ -637,8 +813,8 @@ var Chat = React7.forwardRef(
637
813
  }
638
814
  );
639
815
  Chat.displayName = "Chat";
640
- var ChatHeader = React7.forwardRef(({ className, children, ...props }, ref) => {
641
- return /* @__PURE__ */ jsx6(
816
+ var ChatHeader = React8.forwardRef(({ className, children, ...props }, ref) => {
817
+ return /* @__PURE__ */ jsx7(
642
818
  "div",
643
819
  {
644
820
  ref,
@@ -654,8 +830,8 @@ var ChatHeader = React7.forwardRef(({ className, children, ...props }, ref) => {
654
830
  ChatHeader.displayName = "ChatHeader";
655
831
  var ChatMessages = MessageList;
656
832
  ChatMessages.displayName = "ChatMessages";
657
- var ChatInput = React7.forwardRef(({ className, ...props }, ref) => {
658
- return /* @__PURE__ */ jsx6("div", { className: "border-t border-gray-200 dark:border-gray-800 p-4", children: /* @__PURE__ */ jsx6("div", { className: "flex gap-2", children: /* @__PURE__ */ jsx6(
833
+ var ChatInput = React8.forwardRef(({ className, ...props }, ref) => {
834
+ return /* @__PURE__ */ jsx7("div", { className: "border-t border-gray-200 dark:border-gray-800 p-4", children: /* @__PURE__ */ jsx7("div", { className: "flex gap-2", children: /* @__PURE__ */ jsx7(
659
835
  InputBox,
660
836
  {
661
837
  ref,
@@ -665,8 +841,8 @@ var ChatInput = React7.forwardRef(({ className, ...props }, ref) => {
665
841
  ) }) });
666
842
  });
667
843
  ChatInput.displayName = "ChatInput";
668
- var ChatFooter = React7.forwardRef(({ className, children, ...props }, ref) => {
669
- return /* @__PURE__ */ jsx6(
844
+ var ChatFooter = React8.forwardRef(({ className, children, ...props }, ref) => {
845
+ return /* @__PURE__ */ jsx7(
670
846
  "div",
671
847
  {
672
848
  ref,
@@ -688,9 +864,9 @@ var ChatComponents = Object.assign(Chat, {
688
864
  });
689
865
 
690
866
  // src/ai/react/components/agent-card.tsx
691
- import * as React8 from "react";
692
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
693
- var AgentCard = React8.forwardRef(
867
+ import * as React9 from "react";
868
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
869
+ var AgentCard = React9.forwardRef(
694
870
  ({
695
871
  messages,
696
872
  toolCalls = [],
@@ -701,26 +877,26 @@ var AgentCard = React8.forwardRef(
701
877
  renderTool
702
878
  }, ref) => {
703
879
  const theme = mergeThemes(defaultAgentTheme, userTheme);
704
- return /* @__PURE__ */ jsxs4(AgentContainer, { ref, className: cn(theme.container, className), children: [
705
- /* @__PURE__ */ jsx7(
880
+ return /* @__PURE__ */ jsxs5(AgentContainer, { ref, className: cn(theme.container, className), children: [
881
+ /* @__PURE__ */ jsx8(
706
882
  AgentStatus,
707
883
  {
708
884
  status,
709
885
  className: cn(theme.status, getStatusColor(status))
710
886
  }
711
887
  ),
712
- thinking && /* @__PURE__ */ jsxs4(ThinkingIndicator, { className: theme.thinking, children: [
713
- /* @__PURE__ */ jsx7("span", { className: "font-semibold", children: "Thinking:" }),
888
+ thinking && /* @__PURE__ */ jsxs5(ThinkingIndicator, { className: theme.thinking, children: [
889
+ /* @__PURE__ */ jsx8("span", { className: "font-semibold", children: "Thinking:" }),
714
890
  thinking
715
891
  ] }),
716
- toolCalls.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
717
- /* @__PURE__ */ jsx7("h3", { className: "text-sm font-semibold text-neutral-700 dark:text-neutral-300", children: "Tool Calls" }),
718
- /* @__PURE__ */ jsx7(
892
+ toolCalls.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
893
+ /* @__PURE__ */ jsx8("h3", { className: "text-sm font-semibold text-neutral-700 dark:text-neutral-300", children: "Tool Calls" }),
894
+ /* @__PURE__ */ jsx8(
719
895
  ToolList,
720
896
  {
721
897
  toolCalls,
722
898
  className: "space-y-3",
723
- renderTool: renderTool || ((tool) => /* @__PURE__ */ jsxs4(
899
+ renderTool: renderTool || ((tool) => /* @__PURE__ */ jsxs5(
724
900
  ToolInvocation,
725
901
  {
726
902
  name: tool.name,
@@ -728,8 +904,8 @@ var AgentCard = React8.forwardRef(
728
904
  status: tool.status,
729
905
  className: theme.tool,
730
906
  children: [
731
- tool.result !== void 0 && /* @__PURE__ */ jsx7(ToolResult, { result: tool.result, className: theme.toolResult }),
732
- tool.error && /* @__PURE__ */ jsxs4("div", { className: "mt-2 p-3 bg-red-50 dark:bg-red-900/20 text-red-900 dark:text-red-100 rounded-xl text-sm border border-red-200 dark:border-red-800", children: [
907
+ tool.result !== void 0 && /* @__PURE__ */ jsx8(ToolResult, { result: tool.result, className: theme.toolResult }),
908
+ tool.error && /* @__PURE__ */ jsxs5("div", { className: "mt-2 p-3 bg-red-50 dark:bg-red-900/20 text-red-900 dark:text-red-100 rounded-xl text-sm border border-red-200 dark:border-red-800", children: [
733
909
  "Error: ",
734
910
  tool.error
735
911
  ] })
@@ -739,18 +915,18 @@ var AgentCard = React8.forwardRef(
739
915
  }
740
916
  )
741
917
  ] }),
742
- messages && messages.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
743
- /* @__PURE__ */ jsx7("h3", { className: "text-sm font-semibold text-neutral-700 dark:text-neutral-300", children: "Messages" }),
744
- /* @__PURE__ */ jsx7("div", { className: "space-y-2 max-h-96 overflow-y-auto", children: messages.map((msg) => /* @__PURE__ */ jsxs4(
918
+ messages && messages.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
919
+ /* @__PURE__ */ jsx8("h3", { className: "text-sm font-semibold text-neutral-700 dark:text-neutral-300", children: "Messages" }),
920
+ /* @__PURE__ */ jsx8("div", { className: "space-y-2 max-h-96 overflow-y-auto", children: messages.map((msg) => /* @__PURE__ */ jsxs5(
745
921
  "div",
746
922
  {
747
923
  className: "text-sm p-3 rounded-xl bg-neutral-50 dark:bg-neutral-800",
748
924
  children: [
749
- /* @__PURE__ */ jsxs4("span", { className: "font-semibold capitalize text-neutral-900 dark:text-neutral-100", children: [
925
+ /* @__PURE__ */ jsxs5("span", { className: "font-semibold capitalize text-neutral-900 dark:text-neutral-100", children: [
750
926
  msg.role,
751
927
  ":"
752
928
  ] }),
753
- /* @__PURE__ */ jsxs4("span", { className: "text-neutral-600 dark:text-neutral-400 ml-1", children: [
929
+ /* @__PURE__ */ jsxs5("span", { className: "text-neutral-600 dark:text-neutral-400 ml-1", children: [
754
930
  msg.content.substring(0, 200),
755
931
  "..."
756
932
  ] })
@@ -783,12 +959,12 @@ function getStatusColor(status) {
783
959
  }
784
960
 
785
961
  // src/ai/react/components/message.tsx
786
- import * as React9 from "react";
787
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
788
- var Message = React9.forwardRef(
962
+ import * as React10 from "react";
963
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
964
+ var Message = React10.forwardRef(
789
965
  ({ message, className, theme: userTheme, showRole = false, showTimestamp = false }, ref) => {
790
966
  const theme = mergeThemes(defaultChatTheme, userTheme);
791
- return /* @__PURE__ */ jsx8(
967
+ return /* @__PURE__ */ jsx9(
792
968
  MessageItem,
793
969
  {
794
970
  ref,
@@ -798,27 +974,27 @@ var Message = React9.forwardRef(
798
974
  message.role === "user" ? "justify-end" : "justify-start",
799
975
  className
800
976
  ),
801
- children: /* @__PURE__ */ jsxs5("div", { className: theme.message?.[message.role] || theme.message?.assistant, children: [
802
- showRole && /* @__PURE__ */ jsx8(MessageRole, { className: "block text-xs font-semibold mb-1 opacity-75 uppercase", children: message.role }),
803
- /* @__PURE__ */ jsx8(MessageContent, { children: message.content }),
804
- showTimestamp && message.timestamp && /* @__PURE__ */ jsx8("div", { className: "text-xs opacity-60 mt-1", children: new Date(message.timestamp).toLocaleTimeString() })
977
+ children: /* @__PURE__ */ jsxs6("div", { className: theme.message?.[message.role] || theme.message?.assistant, children: [
978
+ showRole && /* @__PURE__ */ jsx9(MessageRole, { className: "block text-xs font-semibold mb-1 opacity-75 uppercase", children: message.role }),
979
+ /* @__PURE__ */ jsx9(MessageContent, { children: message.content }),
980
+ showTimestamp && message.timestamp && /* @__PURE__ */ jsx9("div", { className: "text-xs opacity-60 mt-1", children: new Date(message.timestamp).toLocaleTimeString() })
805
981
  ] })
806
982
  }
807
983
  );
808
984
  }
809
985
  );
810
986
  Message.displayName = "Message";
811
- var StreamingMessage = React9.forwardRef(({ content, showCursor = true, className, theme: userTheme }, ref) => {
987
+ var StreamingMessage = React10.forwardRef(({ content, showCursor = true, className, theme: userTheme }, ref) => {
812
988
  const theme = mergeThemes(defaultChatTheme, userTheme);
813
- return /* @__PURE__ */ jsx8(
989
+ return /* @__PURE__ */ jsx9(
814
990
  MessageItem,
815
991
  {
816
992
  ref,
817
993
  role: "assistant",
818
994
  className: cn("flex justify-start", className),
819
- children: /* @__PURE__ */ jsx8("div", { className: theme.message?.assistant, children: /* @__PURE__ */ jsxs5(MessageContent, { children: [
995
+ children: /* @__PURE__ */ jsx9("div", { className: theme.message?.assistant, children: /* @__PURE__ */ jsxs6(MessageContent, { children: [
820
996
  content,
821
- showCursor && /* @__PURE__ */ jsx8("span", { className: "inline-block w-1 h-4 bg-current ml-1 animate-pulse" })
997
+ showCursor && /* @__PURE__ */ jsx9("span", { className: "inline-block w-1 h-4 bg-current ml-1 animate-pulse" })
822
998
  ] }) })
823
999
  }
824
1000
  );
@@ -826,9 +1002,9 @@ var StreamingMessage = React9.forwardRef(({ content, showCursor = true, classNam
826
1002
  StreamingMessage.displayName = "StreamingMessage";
827
1003
 
828
1004
  // src/ai/react/components/error-boundary.tsx
829
- import * as React10 from "react";
830
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
831
- var AIErrorBoundary = class extends React10.Component {
1005
+ import * as React11 from "react";
1006
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
1007
+ var AIErrorBoundary = class extends React11.Component {
832
1008
  constructor(props) {
833
1009
  super(props);
834
1010
  this.reset = () => {
@@ -853,20 +1029,20 @@ var AIErrorBoundary = class extends React10.Component {
853
1029
  }
854
1030
  return this.props.fallback;
855
1031
  }
856
- return /* @__PURE__ */ jsx9(
1032
+ return /* @__PURE__ */ jsx10(
857
1033
  "div",
858
1034
  {
859
1035
  className: "border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 rounded-2xl p-6",
860
1036
  role: "alert",
861
- children: /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-4", children: [
862
- /* @__PURE__ */ jsx9("div", { className: "w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/40 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx9(
1037
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-4", children: [
1038
+ /* @__PURE__ */ jsx10("div", { className: "w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/40 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx10(
863
1039
  "svg",
864
1040
  {
865
1041
  className: "w-5 h-5 text-red-600 dark:text-red-400",
866
1042
  fill: "none",
867
1043
  viewBox: "0 0 24 24",
868
1044
  stroke: "currentColor",
869
- children: /* @__PURE__ */ jsx9(
1045
+ children: /* @__PURE__ */ jsx10(
870
1046
  "path",
871
1047
  {
872
1048
  strokeLinecap: "round",
@@ -877,10 +1053,10 @@ var AIErrorBoundary = class extends React10.Component {
877
1053
  )
878
1054
  }
879
1055
  ) }),
880
- /* @__PURE__ */ jsxs6("div", { className: "flex-1 min-w-0", children: [
881
- /* @__PURE__ */ jsx9("h3", { className: "text-base font-semibold text-red-900 dark:text-red-100", children: this.props.errorMessage || "An error occurred in the AI component" }),
882
- /* @__PURE__ */ jsx9("p", { className: "mt-1.5 text-sm text-red-700 dark:text-red-300 leading-relaxed", children: this.state.error.message }),
883
- /* @__PURE__ */ jsx9(
1056
+ /* @__PURE__ */ jsxs7("div", { className: "flex-1 min-w-0", children: [
1057
+ /* @__PURE__ */ jsx10("h3", { className: "text-base font-semibold text-red-900 dark:text-red-100", children: this.props.errorMessage || "An error occurred in the AI component" }),
1058
+ /* @__PURE__ */ jsx10("p", { className: "mt-1.5 text-sm text-red-700 dark:text-red-300 leading-relaxed", children: this.state.error.message }),
1059
+ /* @__PURE__ */ jsx10(
884
1060
  "button",
885
1061
  {
886
1062
  type: "button",
@@ -898,12 +1074,12 @@ var AIErrorBoundary = class extends React10.Component {
898
1074
  }
899
1075
  };
900
1076
  function useAIErrorHandler() {
901
- const [error, setError] = React10.useState(null);
902
- const handleError = React10.useCallback((error2) => {
1077
+ const [error, setError] = React11.useState(null);
1078
+ const handleError = React11.useCallback((error2) => {
903
1079
  console.error("[useAIErrorHandler] Error:", error2);
904
1080
  setError(error2);
905
1081
  }, []);
906
- const clearError = React10.useCallback(() => {
1082
+ const clearError = React11.useCallback(() => {
907
1083
  setError(null);
908
1084
  }, []);
909
1085
  return {
@@ -918,6 +1094,7 @@ export {
918
1094
  AgentCard,
919
1095
  Chat,
920
1096
  ChatComponents,
1097
+ Markdown,
921
1098
  Message,
922
1099
  StreamingMessage,
923
1100
  cn,