@rodrigocoliveira/agno-react 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +32 -46
  2. package/dist/index.d.ts +6 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1738 -87
  5. package/dist/index.js.map +31 -3
  6. package/dist/index.mjs +1759 -87
  7. package/dist/index.mjs.map +31 -3
  8. package/dist/ui/composed/AgnoMessageItem.d.ts +12 -24
  9. package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
  10. package/dist/ui/composed/agno-chat/agno-chat.d.ts +23 -3
  11. package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
  12. package/dist/ui/composed/agno-chat/context.d.ts +4 -3
  13. package/dist/ui/composed/agno-chat/context.d.ts.map +1 -1
  14. package/dist/ui/composed/agno-chat/messages.d.ts +9 -15
  15. package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
  16. package/dist/ui/composed/agno-chat/render-tool.d.ts +11 -0
  17. package/dist/ui/composed/agno-chat/render-tool.d.ts.map +1 -0
  18. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +11 -0
  19. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -0
  20. package/dist/ui/composed/agno-message/content.d.ts +2 -0
  21. package/dist/ui/composed/agno-message/content.d.ts.map +1 -0
  22. package/dist/ui/composed/agno-message/context.d.ts +21 -0
  23. package/dist/ui/composed/agno-message/context.d.ts.map +1 -0
  24. package/dist/ui/composed/agno-message/footer.d.ts +6 -0
  25. package/dist/ui/composed/agno-message/footer.d.ts.map +1 -0
  26. package/dist/ui/composed/agno-message/index.d.ts +13 -0
  27. package/dist/ui/composed/agno-message/index.d.ts.map +1 -0
  28. package/dist/ui/composed/agno-message/media.d.ts +2 -0
  29. package/dist/ui/composed/agno-message/media.d.ts.map +1 -0
  30. package/dist/ui/composed/agno-message/message.d.ts +41 -0
  31. package/dist/ui/composed/agno-message/message.d.ts.map +1 -0
  32. package/dist/ui/composed/agno-message/reasoning.d.ts +2 -0
  33. package/dist/ui/composed/agno-message/reasoning.d.ts.map +1 -0
  34. package/dist/ui/composed/agno-message/references.d.ts +2 -0
  35. package/dist/ui/composed/agno-message/references.d.ts.map +1 -0
  36. package/dist/ui/composed/agno-message/tools.d.ts +7 -0
  37. package/dist/ui/composed/agno-message/tools.d.ts.map +1 -0
  38. package/dist/ui/composed/index.d.ts +6 -0
  39. package/dist/ui/composed/index.d.ts.map +1 -1
  40. package/dist/ui/index.d.ts +6 -0
  41. package/dist/ui/index.d.ts.map +1 -1
  42. package/dist/ui/primitives/badge.d.ts +1 -1
  43. package/dist/ui/primitives/button.d.ts +1 -1
  44. package/dist/ui/primitives/command.d.ts +1 -1
  45. package/dist/ui.js +1146 -643
  46. package/dist/ui.js.map +22 -7
  47. package/dist/ui.mjs +1139 -645
  48. package/dist/ui.mjs.map +22 -7
  49. package/package.json +3 -3
package/dist/ui.mjs CHANGED
@@ -2692,582 +2692,1066 @@ var PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ j
2692
2692
  className: cn(className),
2693
2693
  ...props
2694
2694
  });
2695
- // src/ui/composed/AgnoMessageItem.tsx
2696
- import { useState as useState8 } from "react";
2697
- import { GenerativeUIRenderer } from "@rodrigocoliveira/agno-react";
2698
- import {
2699
- AlertCircle,
2700
- FileIcon as FileIcon3,
2701
- FileText,
2702
- Image as ImageIcon2,
2703
- Lightbulb,
2704
- Music,
2705
- Paperclip,
2706
- Video
2707
- } from "lucide-react";
2708
- import { jsx as jsx35, jsxs as jsxs20, Fragment as Fragment5 } from "react/jsx-runtime";
2709
- var defaultFormatTimestamp = formatSmartTimestamp;
2710
- var getToolState = (tool) => {
2711
- return tool.tool_call_error ? "output-error" : "output-available";
2712
- };
2713
- function AgnoMessageItem({
2695
+ // src/ui/composed/agno-message/message.tsx
2696
+ import { useMemo as useMemo5, useState as useState10 } from "react";
2697
+ import { AlertCircle as AlertCircle2, FileIcon as FileIcon4, Music as Music2 } from "lucide-react";
2698
+
2699
+ // src/ui/composed/agno-message/context.ts
2700
+ import { createContext as createContext3, useContext as useContext3 } from "react";
2701
+ var AgnoMessageContext = createContext3(null);
2702
+ function useAgnoMessageContext() {
2703
+ const ctx = useContext3(AgnoMessageContext);
2704
+ if (!ctx) {
2705
+ throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
2706
+ }
2707
+ return ctx;
2708
+ }
2709
+
2710
+ // src/ui/composed/agno-message/reasoning.tsx
2711
+ import { Lightbulb } from "lucide-react";
2712
+ import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
2713
+ function AgnoMessageReasoning() {
2714
+ const { message, classNames } = useAgnoMessageContext();
2715
+ const steps = message.extra_data?.reasoning_steps;
2716
+ if (!steps || steps.length === 0)
2717
+ return null;
2718
+ return /* @__PURE__ */ jsxs20("div", {
2719
+ className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
2720
+ children: [
2721
+ /* @__PURE__ */ jsxs20("div", {
2722
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2723
+ children: [
2724
+ /* @__PURE__ */ jsx35(Lightbulb, {
2725
+ className: "h-3.5 w-3.5"
2726
+ }),
2727
+ "Reasoning (",
2728
+ steps.length,
2729
+ " steps)"
2730
+ ]
2731
+ }),
2732
+ /* @__PURE__ */ jsx35(Accordion, {
2733
+ type: "multiple",
2734
+ className: "w-full",
2735
+ children: steps.map((step, idx) => /* @__PURE__ */ jsxs20(AccordionItem, {
2736
+ value: `reasoning-${idx}`,
2737
+ className: "border-muted",
2738
+ children: [
2739
+ /* @__PURE__ */ jsx35(AccordionTrigger, {
2740
+ className: "text-xs py-1.5 hover:no-underline",
2741
+ children: step.title || `Step ${idx + 1}`
2742
+ }),
2743
+ /* @__PURE__ */ jsxs20(AccordionContent, {
2744
+ className: "space-y-1.5 text-xs text-muted-foreground",
2745
+ children: [
2746
+ step.action && /* @__PURE__ */ jsxs20("div", {
2747
+ children: [
2748
+ /* @__PURE__ */ jsx35("span", {
2749
+ className: "font-medium text-foreground",
2750
+ children: "Action:"
2751
+ }),
2752
+ " ",
2753
+ step.action
2754
+ ]
2755
+ }),
2756
+ step.reasoning && /* @__PURE__ */ jsxs20("div", {
2757
+ children: [
2758
+ /* @__PURE__ */ jsx35("span", {
2759
+ className: "font-medium text-foreground",
2760
+ children: "Reasoning:"
2761
+ }),
2762
+ " ",
2763
+ step.reasoning
2764
+ ]
2765
+ }),
2766
+ step.result && /* @__PURE__ */ jsxs20("div", {
2767
+ children: [
2768
+ /* @__PURE__ */ jsx35("span", {
2769
+ className: "font-medium text-foreground",
2770
+ children: "Result:"
2771
+ }),
2772
+ " ",
2773
+ step.result
2774
+ ]
2775
+ }),
2776
+ step.confidence !== undefined && /* @__PURE__ */ jsxs20("div", {
2777
+ children: [
2778
+ /* @__PURE__ */ jsx35("span", {
2779
+ className: "font-medium text-foreground",
2780
+ children: "Confidence:"
2781
+ }),
2782
+ " ",
2783
+ (step.confidence * 100).toFixed(1),
2784
+ "%"
2785
+ ]
2786
+ })
2787
+ ]
2788
+ })
2789
+ ]
2790
+ }, idx))
2791
+ })
2792
+ ]
2793
+ });
2794
+ }
2795
+
2796
+ // src/ui/composed/agno-message/media.tsx
2797
+ import { FileIcon as FileIcon3, Image as ImageIcon2, Music, Paperclip, Video } from "lucide-react";
2798
+ import { jsx as jsx36, jsxs as jsxs21, Fragment as Fragment5 } from "react/jsx-runtime";
2799
+ function AgnoMessageMedia() {
2800
+ const {
2801
+ message,
2802
+ classNames,
2803
+ showImageLightbox,
2804
+ showFilePreview,
2805
+ openImageLightbox,
2806
+ openFilePreview
2807
+ } = useAgnoMessageContext();
2808
+ const mediaClassName = classNames?.assistant?.media;
2809
+ const hasImages = !!message.images && message.images.length > 0;
2810
+ const hasVideos = !!message.videos && message.videos.length > 0;
2811
+ const hasAudio = !!message.audio && message.audio.length > 0;
2812
+ const hasFiles = !!message.files && message.files.length > 0;
2813
+ const hasResponseAudio = !!message.response_audio;
2814
+ if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
2815
+ return null;
2816
+ return /* @__PURE__ */ jsxs21(Fragment5, {
2817
+ children: [
2818
+ hasImages && /* @__PURE__ */ jsxs21("div", {
2819
+ className: cn("space-y-2 pt-1", mediaClassName),
2820
+ children: [
2821
+ /* @__PURE__ */ jsxs21("div", {
2822
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2823
+ children: [
2824
+ /* @__PURE__ */ jsx36(ImageIcon2, {
2825
+ className: "h-3.5 w-3.5"
2826
+ }),
2827
+ "Images (",
2828
+ message.images.length,
2829
+ ")"
2830
+ ]
2831
+ }),
2832
+ /* @__PURE__ */ jsx36("div", {
2833
+ className: "grid grid-cols-2 gap-2",
2834
+ children: message.images.map((img, idx) => /* @__PURE__ */ jsxs21("div", {
2835
+ className: "space-y-1",
2836
+ children: [
2837
+ showImageLightbox ? /* @__PURE__ */ jsx36("button", {
2838
+ type: "button",
2839
+ onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
2840
+ className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
2841
+ children: /* @__PURE__ */ jsx36("img", {
2842
+ src: img.url,
2843
+ alt: img.revised_prompt || "Generated image",
2844
+ className: "w-full rounded-lg"
2845
+ })
2846
+ }) : /* @__PURE__ */ jsx36("img", {
2847
+ src: img.url,
2848
+ alt: img.revised_prompt || "Generated image",
2849
+ className: "w-full rounded-lg border border-border"
2850
+ }),
2851
+ img.revised_prompt && /* @__PURE__ */ jsx36("p", {
2852
+ className: "text-[11px] text-muted-foreground italic px-0.5",
2853
+ children: img.revised_prompt
2854
+ })
2855
+ ]
2856
+ }, idx))
2857
+ })
2858
+ ]
2859
+ }),
2860
+ hasVideos && /* @__PURE__ */ jsxs21("div", {
2861
+ className: cn("space-y-2 pt-1", mediaClassName),
2862
+ children: [
2863
+ /* @__PURE__ */ jsxs21("div", {
2864
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2865
+ children: [
2866
+ /* @__PURE__ */ jsx36(Video, {
2867
+ className: "h-3.5 w-3.5"
2868
+ }),
2869
+ "Videos (",
2870
+ message.videos.length,
2871
+ ")"
2872
+ ]
2873
+ }),
2874
+ /* @__PURE__ */ jsx36("div", {
2875
+ className: "space-y-2",
2876
+ children: message.videos.map((video, idx) => /* @__PURE__ */ jsx36("div", {
2877
+ children: video.url ? /* @__PURE__ */ jsx36("video", {
2878
+ src: video.url,
2879
+ controls: true,
2880
+ className: "w-full rounded-lg border border-border"
2881
+ }) : /* @__PURE__ */ jsxs21("div", {
2882
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2883
+ children: [
2884
+ "Video ID: ",
2885
+ video.id,
2886
+ " (ETA: ",
2887
+ video.eta,
2888
+ "s)"
2889
+ ]
2890
+ })
2891
+ }, idx))
2892
+ })
2893
+ ]
2894
+ }),
2895
+ hasAudio && /* @__PURE__ */ jsxs21("div", {
2896
+ className: cn("space-y-2 pt-1", mediaClassName),
2897
+ children: [
2898
+ /* @__PURE__ */ jsxs21("div", {
2899
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2900
+ children: [
2901
+ /* @__PURE__ */ jsx36(Music, {
2902
+ className: "h-3.5 w-3.5"
2903
+ }),
2904
+ "Audio (",
2905
+ message.audio.length,
2906
+ ")"
2907
+ ]
2908
+ }),
2909
+ /* @__PURE__ */ jsx36("div", {
2910
+ className: "space-y-2",
2911
+ children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx36("div", {
2912
+ children: audio.url ? /* @__PURE__ */ jsx36("audio", {
2913
+ src: audio.url,
2914
+ controls: true,
2915
+ className: "w-full"
2916
+ }) : audio.base64_audio ? /* @__PURE__ */ jsx36("audio", {
2917
+ src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
2918
+ controls: true,
2919
+ className: "w-full"
2920
+ }) : /* @__PURE__ */ jsx36("div", {
2921
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2922
+ children: "Audio data unavailable"
2923
+ })
2924
+ }, idx))
2925
+ })
2926
+ ]
2927
+ }),
2928
+ hasFiles && /* @__PURE__ */ jsxs21("div", {
2929
+ className: cn("space-y-2 pt-1", mediaClassName),
2930
+ children: [
2931
+ /* @__PURE__ */ jsxs21("div", {
2932
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2933
+ children: [
2934
+ /* @__PURE__ */ jsx36(Paperclip, {
2935
+ className: "h-3.5 w-3.5"
2936
+ }),
2937
+ "Files (",
2938
+ message.files.length,
2939
+ ")"
2940
+ ]
2941
+ }),
2942
+ /* @__PURE__ */ jsx36("div", {
2943
+ className: "flex flex-wrap gap-2",
2944
+ children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx36(FilePreviewCard, {
2945
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
2946
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2947
+ }, idx) : /* @__PURE__ */ jsxs21("div", {
2948
+ className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
2949
+ children: [
2950
+ /* @__PURE__ */ jsx36(FileIcon3, {
2951
+ className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
2952
+ }),
2953
+ /* @__PURE__ */ jsx36("span", {
2954
+ className: "truncate max-w-[180px]",
2955
+ children: file.name
2956
+ }),
2957
+ file.size && /* @__PURE__ */ jsxs21("span", {
2958
+ className: "text-muted-foreground/70",
2959
+ children: [
2960
+ "(",
2961
+ (file.size / 1024).toFixed(1),
2962
+ "KB)"
2963
+ ]
2964
+ }),
2965
+ file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx36("a", {
2966
+ href: file.url,
2967
+ target: "_blank",
2968
+ rel: "noopener noreferrer",
2969
+ className: "text-primary hover:underline font-medium",
2970
+ children: "View"
2971
+ })
2972
+ ]
2973
+ }, idx))
2974
+ })
2975
+ ]
2976
+ }),
2977
+ hasResponseAudio && message.response_audio && /* @__PURE__ */ jsxs21("div", {
2978
+ className: cn("space-y-2 pt-1", mediaClassName),
2979
+ children: [
2980
+ /* @__PURE__ */ jsxs21("div", {
2981
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2982
+ children: [
2983
+ /* @__PURE__ */ jsx36(Music, {
2984
+ className: "h-3.5 w-3.5"
2985
+ }),
2986
+ "Response Audio"
2987
+ ]
2988
+ }),
2989
+ message.response_audio.transcript && /* @__PURE__ */ jsxs21("div", {
2990
+ className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
2991
+ children: [
2992
+ '"',
2993
+ message.response_audio.transcript,
2994
+ '"'
2995
+ ]
2996
+ }),
2997
+ message.response_audio.content && /* @__PURE__ */ jsx36("audio", {
2998
+ src: `data:audio/wav;base64,${message.response_audio.content}`,
2999
+ controls: true,
3000
+ className: "w-full"
3001
+ })
3002
+ ]
3003
+ })
3004
+ ]
3005
+ });
3006
+ }
3007
+
3008
+ // src/ui/composed/agno-chat/context.ts
3009
+ import { createContext as createContext4, useContext as useContext4 } from "react";
3010
+ var AgnoChatContext = createContext4(null);
3011
+ function useAgnoChatContext() {
3012
+ const ctx = useContext4(AgnoChatContext);
3013
+ if (!ctx) {
3014
+ throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
3015
+ }
3016
+ return ctx;
3017
+ }
3018
+
3019
+ // src/components/GenerativeUIRenderer.tsx
3020
+ import React13 from "react";
3021
+
3022
+ // src/utils/component-registry.ts
3023
+ class ComponentRegistry {
3024
+ static instance;
3025
+ components = new Map;
3026
+ constructor() {}
3027
+ static getInstance() {
3028
+ if (!ComponentRegistry.instance) {
3029
+ ComponentRegistry.instance = new ComponentRegistry;
3030
+ }
3031
+ return ComponentRegistry.instance;
3032
+ }
3033
+ register(type, renderer) {
3034
+ this.components.set(type, renderer);
3035
+ }
3036
+ registerBatch(components) {
3037
+ Object.entries(components).forEach(([type, renderer]) => {
3038
+ this.register(type, renderer);
3039
+ });
3040
+ }
3041
+ get(type) {
3042
+ return this.components.get(type);
3043
+ }
3044
+ has(type) {
3045
+ return this.components.has(type);
3046
+ }
3047
+ unregister(type) {
3048
+ this.components.delete(type);
3049
+ }
3050
+ getRegisteredTypes() {
3051
+ return Array.from(this.components.keys());
3052
+ }
3053
+ clear() {
3054
+ this.components.clear();
3055
+ }
3056
+ }
3057
+ function getComponentRegistry() {
3058
+ return ComponentRegistry.getInstance();
3059
+ }
3060
+
3061
+ // src/hooks/useAgnoToolExecution.ts
3062
+ import { useState as useState9, useEffect as useEffect7, useCallback as useCallback8, useMemo as useMemo4 } from "react";
3063
+
3064
+ // src/context/AgnoContext.tsx
3065
+ import { createContext as createContext5, useContext as useContext5, useMemo as useMemo3, useEffect as useEffect6 } from "react";
3066
+ import { AgnoClient } from "@rodrigocoliveira/agno-client";
3067
+ import { jsx as jsx37 } from "react/jsx-runtime";
3068
+ var AgnoContext = createContext5(null);
3069
+
3070
+ // src/context/ToolHandlerContext.tsx
3071
+ import { createContext as createContext6, useContext as useContext6, useState as useState8, useCallback as useCallback7 } from "react";
3072
+ import { jsx as jsx38 } from "react/jsx-runtime";
3073
+ var ToolHandlerContext = createContext6(null);
3074
+
3075
+ // src/hooks/useAgnoToolExecution.ts
3076
+ var customRenderRegistry = new Map;
3077
+ function getCustomRender(key) {
3078
+ return customRenderRegistry.get(key);
3079
+ }
3080
+
3081
+ // src/components/GenerativeUIRenderer.tsx
3082
+ import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
3083
+
3084
+ class UIErrorBoundary extends React13.Component {
3085
+ constructor(props) {
3086
+ super(props);
3087
+ this.state = { hasError: false };
3088
+ }
3089
+ static getDerivedStateFromError(error) {
3090
+ return { hasError: true, error };
3091
+ }
3092
+ componentDidCatch(error, errorInfo) {
3093
+ console.error("[GenerativeUIRenderer] Error rendering component:", error, errorInfo);
3094
+ this.props.onError?.(error);
3095
+ }
3096
+ render() {
3097
+ if (this.state.hasError) {
3098
+ return this.props.fallback || /* @__PURE__ */ jsxs22("div", {
3099
+ className: "p-4 border border-red-300 rounded-md bg-red-50 text-red-800",
3100
+ children: [
3101
+ /* @__PURE__ */ jsx39("p", {
3102
+ className: "font-semibold",
3103
+ children: "Failed to render UI component"
3104
+ }),
3105
+ /* @__PURE__ */ jsx39("p", {
3106
+ className: "text-sm mt-1",
3107
+ children: this.state.error?.message || "Unknown error"
3108
+ })
3109
+ ]
3110
+ });
3111
+ }
3112
+ return this.props.children;
3113
+ }
3114
+ }
3115
+ function GenerativeUIRenderer({
3116
+ spec,
3117
+ className,
3118
+ onError
3119
+ }) {
3120
+ const registry = getComponentRegistry();
3121
+ if (spec.type === "custom") {
3122
+ const customSpec = spec;
3123
+ if (customSpec.renderKey) {
3124
+ const renderFn = getCustomRender(customSpec.renderKey);
3125
+ if (renderFn) {
3126
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3127
+ onError,
3128
+ children: /* @__PURE__ */ jsx39("div", {
3129
+ className,
3130
+ children: renderFn(customSpec.props || {})
3131
+ })
3132
+ });
3133
+ }
3134
+ }
3135
+ return /* @__PURE__ */ jsxs22("div", {
3136
+ className: `p-4 border border-yellow-300 rounded-md bg-yellow-50 text-yellow-800 ${className || ""}`,
3137
+ children: [
3138
+ /* @__PURE__ */ jsx39("p", {
3139
+ className: "font-semibold",
3140
+ children: "Custom component not available"
3141
+ }),
3142
+ /* @__PURE__ */ jsx39("p", {
3143
+ className: "text-sm mt-1",
3144
+ children: "The custom render function for this component is not available."
3145
+ })
3146
+ ]
3147
+ });
3148
+ }
3149
+ if (spec.type === "chart") {
3150
+ const chartSpec = spec;
3151
+ const chartType = `chart:${chartSpec.component}`;
3152
+ if (registry.has(chartType)) {
3153
+ const ChartRenderer = registry.get(chartType);
3154
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3155
+ onError,
3156
+ children: /* @__PURE__ */ jsxs22("div", {
3157
+ className,
3158
+ children: [
3159
+ chartSpec.title && /* @__PURE__ */ jsx39("h3", {
3160
+ className: "font-semibold mb-2",
3161
+ children: chartSpec.title
3162
+ }),
3163
+ chartSpec.description && /* @__PURE__ */ jsx39("p", {
3164
+ className: "text-sm text-gray-600 mb-4",
3165
+ children: chartSpec.description
3166
+ }),
3167
+ /* @__PURE__ */ jsx39(ChartRenderer, {
3168
+ ...chartSpec.props
3169
+ })
3170
+ ]
3171
+ })
3172
+ });
3173
+ }
3174
+ return /* @__PURE__ */ jsxs22("div", {
3175
+ className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
3176
+ children: [
3177
+ /* @__PURE__ */ jsx39("p", {
3178
+ className: "font-semibold mb-2",
3179
+ children: chartSpec.title || "Chart Data"
3180
+ }),
3181
+ chartSpec.description && /* @__PURE__ */ jsx39("p", {
3182
+ className: "text-sm text-gray-600 mb-2",
3183
+ children: chartSpec.description
3184
+ }),
3185
+ /* @__PURE__ */ jsx39("pre", {
3186
+ className: "text-xs bg-gray-100 p-2 rounded overflow-auto",
3187
+ children: JSON.stringify(chartSpec.props.data, null, 2)
3188
+ })
3189
+ ]
3190
+ });
3191
+ }
3192
+ if (spec.type === "card-grid") {
3193
+ const cardGridSpec = spec;
3194
+ if (registry.has("card-grid")) {
3195
+ const CardGridRenderer = registry.get("card-grid");
3196
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3197
+ onError,
3198
+ children: /* @__PURE__ */ jsxs22("div", {
3199
+ className,
3200
+ children: [
3201
+ cardGridSpec.title && /* @__PURE__ */ jsx39("h3", {
3202
+ className: "font-semibold mb-2",
3203
+ children: cardGridSpec.title
3204
+ }),
3205
+ cardGridSpec.description && /* @__PURE__ */ jsx39("p", {
3206
+ className: "text-sm text-gray-600 mb-4",
3207
+ children: cardGridSpec.description
3208
+ }),
3209
+ /* @__PURE__ */ jsx39(CardGridRenderer, {
3210
+ ...cardGridSpec.props
3211
+ })
3212
+ ]
3213
+ })
3214
+ });
3215
+ }
3216
+ }
3217
+ if (spec.type === "table") {
3218
+ const tableSpec = spec;
3219
+ if (registry.has("table")) {
3220
+ const TableRenderer = registry.get("table");
3221
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3222
+ onError,
3223
+ children: /* @__PURE__ */ jsxs22("div", {
3224
+ className,
3225
+ children: [
3226
+ tableSpec.title && /* @__PURE__ */ jsx39("h3", {
3227
+ className: "font-semibold mb-2",
3228
+ children: tableSpec.title
3229
+ }),
3230
+ tableSpec.description && /* @__PURE__ */ jsx39("p", {
3231
+ className: "text-sm text-gray-600 mb-4",
3232
+ children: tableSpec.description
3233
+ }),
3234
+ /* @__PURE__ */ jsx39(TableRenderer, {
3235
+ ...tableSpec.props
3236
+ })
3237
+ ]
3238
+ })
3239
+ });
3240
+ }
3241
+ }
3242
+ if (spec.type === "markdown") {
3243
+ const markdownSpec = spec;
3244
+ if (registry.has("markdown")) {
3245
+ const MarkdownRenderer = registry.get("markdown");
3246
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3247
+ onError,
3248
+ children: /* @__PURE__ */ jsx39("div", {
3249
+ className,
3250
+ children: /* @__PURE__ */ jsx39(MarkdownRenderer, {
3251
+ ...markdownSpec.props
3252
+ })
3253
+ })
3254
+ });
3255
+ }
3256
+ return /* @__PURE__ */ jsx39("div", {
3257
+ className,
3258
+ children: markdownSpec.props.content
3259
+ });
3260
+ }
3261
+ if (spec.type === "artifact") {
3262
+ const artifactSpec = spec;
3263
+ return /* @__PURE__ */ jsx39(UIErrorBoundary, {
3264
+ onError,
3265
+ children: /* @__PURE__ */ jsxs22("div", {
3266
+ className: `p-4 border rounded-md ${className || ""}`,
3267
+ children: [
3268
+ artifactSpec.title && /* @__PURE__ */ jsx39("h3", {
3269
+ className: "font-semibold mb-4",
3270
+ children: artifactSpec.title
3271
+ }),
3272
+ artifactSpec.description && /* @__PURE__ */ jsx39("p", {
3273
+ className: "text-sm text-gray-600 mb-4",
3274
+ children: artifactSpec.description
3275
+ }),
3276
+ /* @__PURE__ */ jsx39("div", {
3277
+ className: "space-y-4",
3278
+ children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx39(GenerativeUIRenderer, {
3279
+ spec: childSpec,
3280
+ onError
3281
+ }, index))
3282
+ })
3283
+ ]
3284
+ })
3285
+ });
3286
+ }
3287
+ return /* @__PURE__ */ jsxs22("div", {
3288
+ className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
3289
+ children: [
3290
+ /* @__PURE__ */ jsx39("p", {
3291
+ className: "font-semibold",
3292
+ children: "Unsupported UI component"
3293
+ }),
3294
+ /* @__PURE__ */ jsxs22("p", {
3295
+ className: "text-sm text-gray-600 mt-1",
3296
+ children: [
3297
+ "Component type: ",
3298
+ spec.type
3299
+ ]
3300
+ })
3301
+ ]
3302
+ });
3303
+ }
3304
+
3305
+ // src/ui/composed/agno-chat/tool-building-blocks.tsx
3306
+ import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
3307
+ var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
3308
+ function ToolDebugCard({ tool, defaultOpen }) {
3309
+ const output = tool.result ?? tool.content;
3310
+ return /* @__PURE__ */ jsxs23(Tool, {
3311
+ defaultOpen,
3312
+ children: [
3313
+ /* @__PURE__ */ jsx40(ToolHeader, {
3314
+ title: tool.tool_name,
3315
+ type: "tool-use",
3316
+ state: getToolState(tool)
3317
+ }),
3318
+ /* @__PURE__ */ jsxs23(ToolContent, {
3319
+ children: [
3320
+ /* @__PURE__ */ jsx40(ToolInput, {
3321
+ input: tool.tool_args
3322
+ }),
3323
+ output ? /* @__PURE__ */ jsx40(ToolOutput, {
3324
+ output,
3325
+ errorText: tool.tool_call_error ? "Tool execution failed" : undefined
3326
+ }) : null
3327
+ ]
3328
+ })
3329
+ ]
3330
+ });
3331
+ }
3332
+ function ToolGenerativeUI({ tool }) {
3333
+ const uiComponent = tool.ui_component;
3334
+ if (!uiComponent)
3335
+ return null;
3336
+ return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx40(Artifact, {
3337
+ children: /* @__PURE__ */ jsx40(GenerativeUIRenderer, {
3338
+ spec: uiComponent,
3339
+ className: "w-full p-2"
3340
+ })
3341
+ }) : /* @__PURE__ */ jsx40(GenerativeUIRenderer, {
3342
+ spec: uiComponent,
3343
+ className: "w-full"
3344
+ });
3345
+ }
3346
+
3347
+ // src/ui/composed/agno-message/tools.tsx
3348
+ import { jsx as jsx41, jsxs as jsxs24, Fragment as Fragment6 } from "react/jsx-runtime";
3349
+ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
3350
+ const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
3351
+ const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
3352
+ const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
3353
+ if (!message.tool_calls || message.tool_calls.length === 0)
3354
+ return null;
3355
+ return /* @__PURE__ */ jsx41("div", {
3356
+ className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
3357
+ children: message.tool_calls.map((tool, idx) => {
3358
+ const defaultRender = () => /* @__PURE__ */ jsxs24(Fragment6, {
3359
+ children: [
3360
+ /* @__PURE__ */ jsx41(ToolGenerativeUI, {
3361
+ tool
3362
+ }),
3363
+ isDebug ? /* @__PURE__ */ jsx41(ToolDebugCard, {
3364
+ tool,
3365
+ defaultOpen: idx === 0
3366
+ }) : null
3367
+ ]
3368
+ });
3369
+ const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
3370
+ if (node === null || node === undefined)
3371
+ return null;
3372
+ return /* @__PURE__ */ jsx41("div", {
3373
+ children: node
3374
+ }, tool.tool_call_id || idx);
3375
+ })
3376
+ });
3377
+ }
3378
+
3379
+ // src/ui/composed/agno-message/content.tsx
3380
+ import { jsx as jsx42 } from "react/jsx-runtime";
3381
+ function AgnoMessageContent() {
3382
+ const { message } = useAgnoMessageContext();
3383
+ if (!message.content)
3384
+ return null;
3385
+ return /* @__PURE__ */ jsx42("div", {
3386
+ className: "prose prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-pre:bg-muted prose-pre:border prose-pre:border-border",
3387
+ children: /* @__PURE__ */ jsx42(Response, {
3388
+ children: message.content
3389
+ })
3390
+ });
3391
+ }
3392
+
3393
+ // src/ui/composed/agno-message/references.tsx
3394
+ import { FileText } from "lucide-react";
3395
+ import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
3396
+ function AgnoMessageReferences() {
3397
+ const { message, classNames } = useAgnoMessageContext();
3398
+ const references = message.extra_data?.references;
3399
+ if (!references || references.length === 0)
3400
+ return null;
3401
+ return /* @__PURE__ */ jsxs25("div", {
3402
+ className: cn("space-y-2 pt-1", classNames?.assistant?.references),
3403
+ children: [
3404
+ /* @__PURE__ */ jsxs25("div", {
3405
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
3406
+ children: [
3407
+ /* @__PURE__ */ jsx43(FileText, {
3408
+ className: "h-3.5 w-3.5"
3409
+ }),
3410
+ "References (",
3411
+ references.length,
3412
+ ")"
3413
+ ]
3414
+ }),
3415
+ /* @__PURE__ */ jsx43("div", {
3416
+ className: "space-y-2",
3417
+ children: references.map((refData, idx) => /* @__PURE__ */ jsxs25("div", {
3418
+ className: "text-xs space-y-1.5",
3419
+ children: [
3420
+ refData.query && /* @__PURE__ */ jsxs25("div", {
3421
+ className: "font-medium text-foreground",
3422
+ children: [
3423
+ "Query: ",
3424
+ refData.query
3425
+ ]
3426
+ }),
3427
+ refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs25("div", {
3428
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg",
3429
+ children: [
3430
+ /* @__PURE__ */ jsxs25("div", {
3431
+ className: "italic text-muted-foreground mb-1",
3432
+ children: [
3433
+ '"',
3434
+ ref.content,
3435
+ '"'
3436
+ ]
3437
+ }),
3438
+ /* @__PURE__ */ jsxs25("div", {
3439
+ className: "text-muted-foreground/70",
3440
+ children: [
3441
+ "Source: ",
3442
+ ref.name,
3443
+ " (chunk ",
3444
+ ref.meta_data.chunk,
3445
+ "/",
3446
+ ref.meta_data.chunk_size,
3447
+ ")"
3448
+ ]
3449
+ })
3450
+ ]
3451
+ }, refIdx))
3452
+ ]
3453
+ }, idx))
3454
+ })
3455
+ ]
3456
+ });
3457
+ }
3458
+
3459
+ // src/ui/composed/agno-message/footer.tsx
3460
+ import { AlertCircle } from "lucide-react";
3461
+ import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
3462
+ function AgnoMessageFooter({ showTimestamp = true } = {}) {
3463
+ const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
3464
+ const hasError = message.streamingError;
3465
+ const isCustomTimestamp = !!formatTimestamp;
3466
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
3467
+ if (!actions?.assistant && !showTimestamp && !hasError)
3468
+ return null;
3469
+ return /* @__PURE__ */ jsxs26("div", {
3470
+ className: "flex items-center gap-2 pt-1",
3471
+ children: [
3472
+ actions?.assistant && (() => {
3473
+ const visibility = actions.visibility ?? "visible";
3474
+ if (visibility === "last-assistant" && !isLastAssistantMessage)
3475
+ return null;
3476
+ const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
3477
+ return /* @__PURE__ */ jsx44("div", {
3478
+ className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
3479
+ children: actions.assistant(message)
3480
+ });
3481
+ })(),
3482
+ hasError && /* @__PURE__ */ jsxs26("span", {
3483
+ className: "flex items-center gap-1 text-[11px] text-destructive",
3484
+ children: [
3485
+ /* @__PURE__ */ jsx44(AlertCircle, {
3486
+ className: "h-3 w-3"
3487
+ }),
3488
+ "Error"
3489
+ ]
3490
+ }),
3491
+ showTimestamp && /* @__PURE__ */ jsx44(SmartTimestamp, {
3492
+ date: new Date(message.created_at * 1000),
3493
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
3494
+ className: "text-[11px] text-muted-foreground"
3495
+ })
3496
+ ]
3497
+ });
3498
+ }
3499
+
3500
+ // src/ui/composed/agno-message/message.tsx
3501
+ import { jsx as jsx45, jsxs as jsxs27, Fragment as Fragment7 } from "react/jsx-runtime";
3502
+ function DefaultAssistantComposition({ showTimestamp }) {
3503
+ return /* @__PURE__ */ jsxs27(Fragment7, {
3504
+ children: [
3505
+ /* @__PURE__ */ jsx45(AgnoMessageReasoning, {}),
3506
+ /* @__PURE__ */ jsx45(AgnoMessageMedia, {}),
3507
+ /* @__PURE__ */ jsx45(AgnoMessageTools, {}),
3508
+ /* @__PURE__ */ jsx45(AgnoMessageContent, {}),
3509
+ /* @__PURE__ */ jsx45(AgnoMessageReferences, {}),
3510
+ /* @__PURE__ */ jsx45(AgnoMessageFooter, {
3511
+ showTimestamp
3512
+ })
3513
+ ]
3514
+ });
3515
+ }
3516
+ function AgnoMessage({
2714
3517
  message,
2715
3518
  className,
2716
3519
  classNames,
2717
- renderContent,
2718
- renderToolCall,
2719
- renderMedia,
2720
3520
  avatars,
2721
3521
  actions,
2722
3522
  isLastAssistantMessage = false,
2723
- showReasoning = true,
2724
- showReferences = true,
2725
- showTimestamp = true,
2726
- showGenerativeUI = true,
2727
- showToolCalls = true,
2728
3523
  showFilePreview = true,
2729
3524
  showImageLightbox = true,
3525
+ showTimestamp = true,
2730
3526
  formatTimestamp,
2731
- toolResultRenderers
3527
+ renderTool,
3528
+ children
2732
3529
  }) {
2733
3530
  const isUser = message.role === "user";
2734
3531
  const hasError = message.streamingError;
2735
- const toolsWithUI = message.tool_calls?.filter((tool) => tool.ui_component) || [];
2736
- const [preview, setPreview] = useState8(null);
3532
+ const [preview, setPreview] = useState10(null);
2737
3533
  const isCustomTimestamp = !!formatTimestamp;
2738
- const resolvedFormatTimestamp = formatTimestamp ?? defaultFormatTimestamp;
2739
- const openImageLightbox = (images, index) => {
2740
- if (!showImageLightbox)
2741
- return;
2742
- setPreview({ type: "image", images, initialIndex: index });
2743
- };
2744
- const openFilePreview = (file) => {
2745
- if (!showFilePreview)
2746
- return;
2747
- setPreview({ type: "file", file });
2748
- };
3534
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
3535
+ const ctx = useMemo5(() => ({
3536
+ message,
3537
+ isLastAssistantMessage,
3538
+ classNames,
3539
+ actions,
3540
+ avatars,
3541
+ formatTimestamp,
3542
+ showFilePreview,
3543
+ showImageLightbox,
3544
+ openImageLightbox: (images, index) => {
3545
+ if (!showImageLightbox)
3546
+ return;
3547
+ setPreview({ type: "image", images, initialIndex: index });
3548
+ },
3549
+ openFilePreview: (file) => {
3550
+ if (!showFilePreview)
3551
+ return;
3552
+ setPreview({ type: "file", file });
3553
+ },
3554
+ renderTool
3555
+ }), [
3556
+ message,
3557
+ isLastAssistantMessage,
3558
+ classNames,
3559
+ actions,
3560
+ avatars,
3561
+ formatTimestamp,
3562
+ showFilePreview,
3563
+ showImageLightbox,
3564
+ renderTool
3565
+ ]);
2749
3566
  const closePreview = () => setPreview(null);
2750
- return /* @__PURE__ */ jsxs20("div", {
2751
- className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
3567
+ return /* @__PURE__ */ jsx45(AgnoMessageContext.Provider, {
3568
+ value: ctx,
3569
+ children: /* @__PURE__ */ jsxs27("div", {
3570
+ className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
3571
+ children: [
3572
+ isUser ? /* @__PURE__ */ jsx45(UserMessageLayout, {
3573
+ message,
3574
+ classNames,
3575
+ avatars,
3576
+ actions,
3577
+ isCustomTimestamp,
3578
+ resolvedFormatTimestamp,
3579
+ showTimestamp,
3580
+ showImageLightbox,
3581
+ showFilePreview,
3582
+ openImageLightbox: ctx.openImageLightbox,
3583
+ openFilePreview: ctx.openFilePreview,
3584
+ hasError
3585
+ }) : /* @__PURE__ */ jsxs27("div", {
3586
+ className: "flex items-start gap-3 group/message",
3587
+ children: [
3588
+ avatars?.assistant,
3589
+ /* @__PURE__ */ jsx45("div", {
3590
+ className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
3591
+ children: children ?? /* @__PURE__ */ jsx45(DefaultAssistantComposition, {
3592
+ showTimestamp
3593
+ })
3594
+ })
3595
+ ]
3596
+ }),
3597
+ preview?.type === "image" && /* @__PURE__ */ jsx45(ImageLightbox, {
3598
+ open: true,
3599
+ onOpenChange: (open) => {
3600
+ if (!open)
3601
+ closePreview();
3602
+ },
3603
+ images: preview.images,
3604
+ initialIndex: preview.initialIndex
3605
+ }),
3606
+ preview?.type === "file" && /* @__PURE__ */ jsx45(FilePreviewModal, {
3607
+ open: true,
3608
+ onOpenChange: (open) => {
3609
+ if (!open)
3610
+ closePreview();
3611
+ },
3612
+ file: preview.file
3613
+ })
3614
+ ]
3615
+ })
3616
+ });
3617
+ }
3618
+ AgnoMessage.Reasoning = AgnoMessageReasoning;
3619
+ AgnoMessage.Media = AgnoMessageMedia;
3620
+ AgnoMessage.Tools = AgnoMessageTools;
3621
+ AgnoMessage.Content = AgnoMessageContent;
3622
+ AgnoMessage.References = AgnoMessageReferences;
3623
+ AgnoMessage.Footer = AgnoMessageFooter;
3624
+ function UserMessageLayout({
3625
+ message,
3626
+ classNames,
3627
+ avatars,
3628
+ actions,
3629
+ isCustomTimestamp,
3630
+ resolvedFormatTimestamp,
3631
+ showTimestamp,
3632
+ showImageLightbox,
3633
+ showFilePreview,
3634
+ openImageLightbox,
3635
+ openFilePreview,
3636
+ hasError
3637
+ }) {
3638
+ return /* @__PURE__ */ jsxs27("div", {
3639
+ className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
2752
3640
  children: [
2753
- isUser ? /* @__PURE__ */ jsxs20("div", {
2754
- className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
3641
+ avatars?.user,
3642
+ /* @__PURE__ */ jsxs27("div", {
3643
+ className: "space-y-1.5 flex flex-col items-end min-w-0",
2755
3644
  children: [
2756
- avatars?.user,
2757
- /* @__PURE__ */ jsxs20("div", {
2758
- className: "space-y-1.5 flex flex-col items-end min-w-0",
3645
+ (message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsxs27("div", {
3646
+ className: "flex flex-wrap gap-2 justify-end",
2759
3647
  children: [
2760
- (message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsxs20("div", {
2761
- className: "flex flex-wrap gap-2 justify-end",
3648
+ message.images?.map((img, idx) => /* @__PURE__ */ jsx45(FilePreviewCard, {
3649
+ file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
3650
+ onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
3651
+ }, `img-${idx}`)),
3652
+ message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs27("div", {
3653
+ className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
2762
3654
  children: [
2763
- message.images?.map((img, idx) => /* @__PURE__ */ jsx35(FilePreviewCard, {
2764
- file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
2765
- onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
2766
- }, `img-${idx}`)),
2767
- message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs20("div", {
2768
- className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
2769
- children: [
2770
- /* @__PURE__ */ jsx35(Music, {
2771
- className: "h-3.5 w-3.5 text-muted-foreground"
2772
- }),
2773
- /* @__PURE__ */ jsx35("span", {
2774
- className: "truncate max-w-[150px]",
2775
- children: audio.id || `Audio ${idx + 1}`
2776
- })
2777
- ]
2778
- }, `audio-${idx}`)),
2779
- message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx35(FilePreviewCard, {
2780
- file: { name: file.name, type: file.type, url: file.url, size: file.size },
2781
- onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2782
- }, `file-${idx}`) : /* @__PURE__ */ jsxs20("div", {
2783
- className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
2784
- children: [
2785
- /* @__PURE__ */ jsx35(FileIcon3, {
2786
- className: "h-3.5 w-3.5 text-muted-foreground"
2787
- }),
2788
- /* @__PURE__ */ jsx35("span", {
2789
- className: "truncate max-w-[150px]",
2790
- children: file.name
2791
- })
2792
- ]
2793
- }, `file-${idx}`))
2794
- ]
2795
- }),
2796
- message.content && /* @__PURE__ */ jsx35("div", {
2797
- className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
2798
- children: /* @__PURE__ */ jsx35("p", {
2799
- className: "text-sm whitespace-pre-wrap",
2800
- children: message.content
2801
- })
2802
- }),
2803
- (showTimestamp || actions?.user) && /* @__PURE__ */ jsxs20("div", {
2804
- className: "flex items-center justify-end gap-1.5 px-1",
2805
- children: [
2806
- actions?.user && /* @__PURE__ */ jsx35("div", {
2807
- className: "flex items-center gap-1",
2808
- children: actions.user(message)
2809
- }),
2810
- /* @__PURE__ */ jsx35(SmartTimestamp, {
2811
- date: new Date(message.created_at * 1000),
2812
- formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
2813
- className: "text-[11px] text-muted-foreground"
3655
+ /* @__PURE__ */ jsx45(Music2, {
3656
+ className: "h-3.5 w-3.5 text-muted-foreground"
2814
3657
  }),
2815
- hasError && /* @__PURE__ */ jsx35(AlertCircle, {
2816
- className: "h-3 w-3 text-destructive"
3658
+ /* @__PURE__ */ jsx45("span", {
3659
+ className: "truncate max-w-[150px]",
3660
+ children: audio.id || `Audio ${idx + 1}`
2817
3661
  })
2818
3662
  ]
2819
- })
2820
- ]
2821
- })
2822
- ]
2823
- }) : /* @__PURE__ */ jsxs20("div", {
2824
- className: "flex items-start gap-3 group/message",
2825
- children: [
2826
- avatars?.assistant,
2827
- /* @__PURE__ */ jsxs20("div", {
2828
- className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
2829
- children: [
2830
- renderContent ? renderContent(message) : /* @__PURE__ */ jsxs20(Fragment5, {
3663
+ }, `audio-${idx}`)),
3664
+ message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx45(FilePreviewCard, {
3665
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
3666
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
3667
+ }, `file-${idx}`) : /* @__PURE__ */ jsxs27("div", {
3668
+ className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
2831
3669
  children: [
2832
- showReasoning && message.extra_data?.reasoning_steps && message.extra_data.reasoning_steps.length > 0 && /* @__PURE__ */ jsxs20("div", {
2833
- className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
2834
- children: [
2835
- /* @__PURE__ */ jsxs20("div", {
2836
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2837
- children: [
2838
- /* @__PURE__ */ jsx35(Lightbulb, {
2839
- className: "h-3.5 w-3.5"
2840
- }),
2841
- "Reasoning (",
2842
- message.extra_data.reasoning_steps.length,
2843
- " steps)"
2844
- ]
2845
- }),
2846
- /* @__PURE__ */ jsx35(Accordion, {
2847
- type: "multiple",
2848
- className: "w-full",
2849
- children: message.extra_data.reasoning_steps.map((step, idx) => /* @__PURE__ */ jsxs20(AccordionItem, {
2850
- value: `reasoning-${idx}`,
2851
- className: "border-muted",
2852
- children: [
2853
- /* @__PURE__ */ jsx35(AccordionTrigger, {
2854
- className: "text-xs py-1.5 hover:no-underline",
2855
- children: step.title || `Step ${idx + 1}`
2856
- }),
2857
- /* @__PURE__ */ jsxs20(AccordionContent, {
2858
- className: "space-y-1.5 text-xs text-muted-foreground",
2859
- children: [
2860
- step.action && /* @__PURE__ */ jsxs20("div", {
2861
- children: [
2862
- /* @__PURE__ */ jsx35("span", {
2863
- className: "font-medium text-foreground",
2864
- children: "Action:"
2865
- }),
2866
- " ",
2867
- step.action
2868
- ]
2869
- }),
2870
- step.reasoning && /* @__PURE__ */ jsxs20("div", {
2871
- children: [
2872
- /* @__PURE__ */ jsx35("span", {
2873
- className: "font-medium text-foreground",
2874
- children: "Reasoning:"
2875
- }),
2876
- " ",
2877
- step.reasoning
2878
- ]
2879
- }),
2880
- step.result && /* @__PURE__ */ jsxs20("div", {
2881
- children: [
2882
- /* @__PURE__ */ jsx35("span", {
2883
- className: "font-medium text-foreground",
2884
- children: "Result:"
2885
- }),
2886
- " ",
2887
- step.result
2888
- ]
2889
- }),
2890
- step.confidence !== undefined && /* @__PURE__ */ jsxs20("div", {
2891
- children: [
2892
- /* @__PURE__ */ jsx35("span", {
2893
- className: "font-medium text-foreground",
2894
- children: "Confidence:"
2895
- }),
2896
- " ",
2897
- (step.confidence * 100).toFixed(1),
2898
- "%"
2899
- ]
2900
- })
2901
- ]
2902
- })
2903
- ]
2904
- }, idx))
2905
- })
2906
- ]
2907
- }),
2908
- message.content && /* @__PURE__ */ jsx35("div", {
2909
- className: "prose prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-pre:bg-muted prose-pre:border prose-pre:border-border",
2910
- children: /* @__PURE__ */ jsx35(Response, {
2911
- children: message.content
2912
- })
2913
- }),
2914
- showGenerativeUI && toolsWithUI.length > 0 && /* @__PURE__ */ jsx35("div", {
2915
- className: "space-y-3",
2916
- children: toolsWithUI.map((tool) => {
2917
- const uiComponent = tool.ui_component;
2918
- return /* @__PURE__ */ jsx35("div", {
2919
- children: uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx35(Artifact, {
2920
- children: /* @__PURE__ */ jsx35(GenerativeUIRenderer, {
2921
- spec: uiComponent,
2922
- className: "w-full p-2"
2923
- })
2924
- }) : /* @__PURE__ */ jsx35(GenerativeUIRenderer, {
2925
- spec: uiComponent,
2926
- className: "w-full"
2927
- })
2928
- }, tool.tool_call_id);
2929
- })
3670
+ /* @__PURE__ */ jsx45(FileIcon4, {
3671
+ className: "h-3.5 w-3.5 text-muted-foreground"
2930
3672
  }),
2931
- toolResultRenderers && message.tool_calls?.map((tool) => {
2932
- const renderer = toolResultRenderers[tool.tool_name];
2933
- const content = tool.result ?? tool.content;
2934
- if (!renderer || !content)
2935
- return null;
2936
- return /* @__PURE__ */ jsx35("div", {
2937
- children: renderer(tool.tool_args, content)
2938
- }, `result-${tool.tool_call_id}`);
2939
- }),
2940
- renderMedia ? renderMedia(message) : (() => {
2941
- const mediaClassName = classNames?.assistant?.media;
2942
- return /* @__PURE__ */ jsxs20(Fragment5, {
2943
- children: [
2944
- message.images && message.images.length > 0 && /* @__PURE__ */ jsxs20("div", {
2945
- className: cn("space-y-2 pt-1", mediaClassName),
2946
- children: [
2947
- /* @__PURE__ */ jsxs20("div", {
2948
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2949
- children: [
2950
- /* @__PURE__ */ jsx35(ImageIcon2, {
2951
- className: "h-3.5 w-3.5"
2952
- }),
2953
- "Images (",
2954
- message.images.length,
2955
- ")"
2956
- ]
2957
- }),
2958
- /* @__PURE__ */ jsx35("div", {
2959
- className: "grid grid-cols-2 gap-2",
2960
- children: message.images.map((img, idx) => /* @__PURE__ */ jsxs20("div", {
2961
- className: "space-y-1",
2962
- children: [
2963
- showImageLightbox ? /* @__PURE__ */ jsx35("button", {
2964
- type: "button",
2965
- onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
2966
- className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
2967
- children: /* @__PURE__ */ jsx35("img", {
2968
- src: img.url,
2969
- alt: img.revised_prompt || "Generated image",
2970
- className: "w-full rounded-lg"
2971
- })
2972
- }) : /* @__PURE__ */ jsx35("img", {
2973
- src: img.url,
2974
- alt: img.revised_prompt || "Generated image",
2975
- className: "w-full rounded-lg border border-border"
2976
- }),
2977
- img.revised_prompt && /* @__PURE__ */ jsx35("p", {
2978
- className: "text-[11px] text-muted-foreground italic px-0.5",
2979
- children: img.revised_prompt
2980
- })
2981
- ]
2982
- }, idx))
2983
- })
2984
- ]
2985
- }),
2986
- message.videos && message.videos.length > 0 && /* @__PURE__ */ jsxs20("div", {
2987
- className: cn("space-y-2 pt-1", mediaClassName),
2988
- children: [
2989
- /* @__PURE__ */ jsxs20("div", {
2990
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2991
- children: [
2992
- /* @__PURE__ */ jsx35(Video, {
2993
- className: "h-3.5 w-3.5"
2994
- }),
2995
- "Videos (",
2996
- message.videos.length,
2997
- ")"
2998
- ]
2999
- }),
3000
- /* @__PURE__ */ jsx35("div", {
3001
- className: "space-y-2",
3002
- children: message.videos.map((video, idx) => /* @__PURE__ */ jsx35("div", {
3003
- children: video.url ? /* @__PURE__ */ jsx35("video", {
3004
- src: video.url,
3005
- controls: true,
3006
- className: "w-full rounded-lg border border-border"
3007
- }) : /* @__PURE__ */ jsxs20("div", {
3008
- className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
3009
- children: [
3010
- "Video ID: ",
3011
- video.id,
3012
- " (ETA: ",
3013
- video.eta,
3014
- "s)"
3015
- ]
3016
- })
3017
- }, idx))
3018
- })
3019
- ]
3020
- }),
3021
- message.audio && message.audio.length > 0 && /* @__PURE__ */ jsxs20("div", {
3022
- className: cn("space-y-2 pt-1", mediaClassName),
3023
- children: [
3024
- /* @__PURE__ */ jsxs20("div", {
3025
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
3026
- children: [
3027
- /* @__PURE__ */ jsx35(Music, {
3028
- className: "h-3.5 w-3.5"
3029
- }),
3030
- "Audio (",
3031
- message.audio.length,
3032
- ")"
3033
- ]
3034
- }),
3035
- /* @__PURE__ */ jsx35("div", {
3036
- className: "space-y-2",
3037
- children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx35("div", {
3038
- children: audio.url ? /* @__PURE__ */ jsx35("audio", {
3039
- src: audio.url,
3040
- controls: true,
3041
- className: "w-full"
3042
- }) : audio.base64_audio ? /* @__PURE__ */ jsx35("audio", {
3043
- src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
3044
- controls: true,
3045
- className: "w-full"
3046
- }) : /* @__PURE__ */ jsx35("div", {
3047
- className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
3048
- children: "Audio data unavailable"
3049
- })
3050
- }, idx))
3051
- })
3052
- ]
3053
- }),
3054
- message.files && message.files.length > 0 && /* @__PURE__ */ jsxs20("div", {
3055
- className: cn("space-y-2 pt-1", mediaClassName),
3056
- children: [
3057
- /* @__PURE__ */ jsxs20("div", {
3058
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
3059
- children: [
3060
- /* @__PURE__ */ jsx35(Paperclip, {
3061
- className: "h-3.5 w-3.5"
3062
- }),
3063
- "Files (",
3064
- message.files.length,
3065
- ")"
3066
- ]
3067
- }),
3068
- /* @__PURE__ */ jsx35("div", {
3069
- className: "flex flex-wrap gap-2",
3070
- children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx35(FilePreviewCard, {
3071
- file: { name: file.name, type: file.type, url: file.url, size: file.size },
3072
- onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
3073
- }, idx) : /* @__PURE__ */ jsxs20("div", {
3074
- className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
3075
- children: [
3076
- /* @__PURE__ */ jsx35(FileIcon3, {
3077
- className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
3078
- }),
3079
- /* @__PURE__ */ jsx35("span", {
3080
- className: "truncate max-w-[180px]",
3081
- children: file.name
3082
- }),
3083
- file.size && /* @__PURE__ */ jsxs20("span", {
3084
- className: "text-muted-foreground/70",
3085
- children: [
3086
- "(",
3087
- (file.size / 1024).toFixed(1),
3088
- "KB)"
3089
- ]
3090
- }),
3091
- file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx35("a", {
3092
- href: file.url,
3093
- target: "_blank",
3094
- rel: "noopener noreferrer",
3095
- className: "text-primary hover:underline font-medium",
3096
- children: "View"
3097
- })
3098
- ]
3099
- }, idx))
3100
- })
3101
- ]
3102
- }),
3103
- message.response_audio && /* @__PURE__ */ jsxs20("div", {
3104
- className: cn("space-y-2 pt-1", mediaClassName),
3105
- children: [
3106
- /* @__PURE__ */ jsxs20("div", {
3107
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
3108
- children: [
3109
- /* @__PURE__ */ jsx35(Music, {
3110
- className: "h-3.5 w-3.5"
3111
- }),
3112
- "Response Audio"
3113
- ]
3114
- }),
3115
- message.response_audio.transcript && /* @__PURE__ */ jsxs20("div", {
3116
- className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
3117
- children: [
3118
- '"',
3119
- message.response_audio.transcript,
3120
- '"'
3121
- ]
3122
- }),
3123
- message.response_audio.content && /* @__PURE__ */ jsx35("audio", {
3124
- src: `data:audio/wav;base64,${message.response_audio.content}`,
3125
- controls: true,
3126
- className: "w-full"
3127
- })
3128
- ]
3129
- })
3130
- ]
3131
- });
3132
- })(),
3133
- showToolCalls && message.tool_calls && message.tool_calls.length > 0 && /* @__PURE__ */ jsx35("div", {
3134
- className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
3135
- children: message.tool_calls.map((tool, idx) => renderToolCall ? renderToolCall(tool, idx) : /* @__PURE__ */ jsxs20(Tool, {
3136
- defaultOpen: idx === 0,
3137
- children: [
3138
- /* @__PURE__ */ jsx35(ToolHeader, {
3139
- title: tool.tool_name,
3140
- type: "tool-use",
3141
- state: getToolState(tool)
3142
- }),
3143
- /* @__PURE__ */ jsxs20(ToolContent, {
3144
- children: [
3145
- /* @__PURE__ */ jsx35(ToolInput, {
3146
- input: tool.tool_args
3147
- }),
3148
- tool.content && /* @__PURE__ */ jsx35(ToolOutput, {
3149
- output: tool.content,
3150
- errorText: tool.tool_call_error ? "Tool execution failed" : undefined
3151
- })
3152
- ]
3153
- })
3154
- ]
3155
- }, tool.tool_call_id || idx))
3156
- }),
3157
- showReferences && message.extra_data?.references && message.extra_data.references.length > 0 && /* @__PURE__ */ jsxs20("div", {
3158
- className: cn("space-y-2 pt-1", classNames?.assistant?.references),
3159
- children: [
3160
- /* @__PURE__ */ jsxs20("div", {
3161
- className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
3162
- children: [
3163
- /* @__PURE__ */ jsx35(FileText, {
3164
- className: "h-3.5 w-3.5"
3165
- }),
3166
- "References (",
3167
- message.extra_data.references.length,
3168
- ")"
3169
- ]
3170
- }),
3171
- /* @__PURE__ */ jsx35("div", {
3172
- className: "space-y-2",
3173
- children: message.extra_data.references.map((refData, idx) => /* @__PURE__ */ jsxs20("div", {
3174
- className: "text-xs space-y-1.5",
3175
- children: [
3176
- refData.query && /* @__PURE__ */ jsxs20("div", {
3177
- className: "font-medium text-foreground",
3178
- children: [
3179
- "Query: ",
3180
- refData.query
3181
- ]
3182
- }),
3183
- refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs20("div", {
3184
- className: "bg-muted/50 border border-border p-2.5 rounded-lg",
3185
- children: [
3186
- /* @__PURE__ */ jsxs20("div", {
3187
- className: "italic text-muted-foreground mb-1",
3188
- children: [
3189
- '"',
3190
- ref.content,
3191
- '"'
3192
- ]
3193
- }),
3194
- /* @__PURE__ */ jsxs20("div", {
3195
- className: "text-muted-foreground/70",
3196
- children: [
3197
- "Source: ",
3198
- ref.name,
3199
- " (chunk ",
3200
- ref.meta_data.chunk,
3201
- "/",
3202
- ref.meta_data.chunk_size,
3203
- ")"
3204
- ]
3205
- })
3206
- ]
3207
- }, refIdx))
3208
- ]
3209
- }, idx))
3210
- })
3211
- ]
3673
+ /* @__PURE__ */ jsx45("span", {
3674
+ className: "truncate max-w-[150px]",
3675
+ children: file.name
3212
3676
  })
3213
3677
  ]
3678
+ }, `file-${idx}`))
3679
+ ]
3680
+ }),
3681
+ message.content && /* @__PURE__ */ jsx45("div", {
3682
+ className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
3683
+ children: /* @__PURE__ */ jsx45("p", {
3684
+ className: "text-sm whitespace-pre-wrap",
3685
+ children: message.content
3686
+ })
3687
+ }),
3688
+ (showTimestamp || actions?.user) && /* @__PURE__ */ jsxs27("div", {
3689
+ className: "flex items-center justify-end gap-1.5 px-1",
3690
+ children: [
3691
+ actions?.user && /* @__PURE__ */ jsx45("div", {
3692
+ className: "flex items-center gap-1",
3693
+ children: actions.user(message)
3214
3694
  }),
3215
- (actions?.assistant || showTimestamp || hasError) && /* @__PURE__ */ jsxs20("div", {
3216
- className: "flex items-center gap-2 pt-1",
3217
- children: [
3218
- actions?.assistant && (() => {
3219
- const visibility = actions.visibility ?? "visible";
3220
- if (visibility === "last-assistant" && !isLastAssistantMessage)
3221
- return null;
3222
- const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
3223
- return /* @__PURE__ */ jsx35("div", {
3224
- className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
3225
- children: actions.assistant(message)
3226
- });
3227
- })(),
3228
- hasError && /* @__PURE__ */ jsxs20("span", {
3229
- className: "flex items-center gap-1 text-[11px] text-destructive",
3230
- children: [
3231
- /* @__PURE__ */ jsx35(AlertCircle, {
3232
- className: "h-3 w-3"
3233
- }),
3234
- "Error"
3235
- ]
3236
- }),
3237
- showTimestamp && /* @__PURE__ */ jsx35(SmartTimestamp, {
3238
- date: new Date(message.created_at * 1000),
3239
- formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
3240
- className: "text-[11px] text-muted-foreground"
3241
- })
3242
- ]
3695
+ /* @__PURE__ */ jsx45(SmartTimestamp, {
3696
+ date: new Date(message.created_at * 1000),
3697
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
3698
+ className: "text-[11px] text-muted-foreground"
3699
+ }),
3700
+ hasError && /* @__PURE__ */ jsx45(AlertCircle2, {
3701
+ className: "h-3 w-3 text-destructive"
3243
3702
  })
3244
3703
  ]
3245
3704
  })
3246
3705
  ]
3247
- }),
3248
- preview?.type === "image" && /* @__PURE__ */ jsx35(ImageLightbox, {
3249
- open: true,
3250
- onOpenChange: (open) => {
3251
- if (!open)
3252
- closePreview();
3253
- },
3254
- images: preview.images,
3255
- initialIndex: preview.initialIndex
3256
- }),
3257
- preview?.type === "file" && /* @__PURE__ */ jsx35(FilePreviewModal, {
3258
- open: true,
3259
- onOpenChange: (open) => {
3260
- if (!open)
3261
- closePreview();
3262
- },
3263
- file: preview.file
3706
+ })
3707
+ ]
3708
+ });
3709
+ }
3710
+
3711
+ // src/ui/composed/AgnoMessageItem.tsx
3712
+ import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
3713
+ function AgnoMessageItem({
3714
+ message,
3715
+ className,
3716
+ classNames,
3717
+ avatars,
3718
+ actions,
3719
+ isLastAssistantMessage = false,
3720
+ showReasoning = true,
3721
+ showReferences = true,
3722
+ showTimestamp = true,
3723
+ showFilePreview = true,
3724
+ showImageLightbox = true,
3725
+ formatTimestamp,
3726
+ renderTool
3727
+ }) {
3728
+ return /* @__PURE__ */ jsxs28(AgnoMessage, {
3729
+ message,
3730
+ className,
3731
+ classNames,
3732
+ avatars,
3733
+ actions,
3734
+ isLastAssistantMessage,
3735
+ showTimestamp,
3736
+ showFilePreview,
3737
+ showImageLightbox,
3738
+ formatTimestamp,
3739
+ renderTool,
3740
+ children: [
3741
+ showReasoning && /* @__PURE__ */ jsx46(AgnoMessage.Reasoning, {}),
3742
+ /* @__PURE__ */ jsx46(AgnoMessage.Media, {}),
3743
+ /* @__PURE__ */ jsx46(AgnoMessage.Tools, {}),
3744
+ /* @__PURE__ */ jsx46(AgnoMessage.Content, {}),
3745
+ showReferences && /* @__PURE__ */ jsx46(AgnoMessage.References, {}),
3746
+ /* @__PURE__ */ jsx46(AgnoMessage.Footer, {
3747
+ showTimestamp
3264
3748
  })
3265
3749
  ]
3266
3750
  });
3267
3751
  }
3268
3752
  // src/ui/composed/AgnoChatInput.tsx
3269
3753
  import { CircleStop } from "lucide-react";
3270
- import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
3754
+ import { jsx as jsx47, jsxs as jsxs29 } from "react/jsx-runtime";
3271
3755
  var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
3272
3756
  function normalizeAudio(audio) {
3273
3757
  if (audio === true)
@@ -3287,14 +3771,14 @@ function dataUrlToBlob(dataUrl) {
3287
3771
  return new Blob([buf], { type: mime });
3288
3772
  }
3289
3773
  function CancelButton({ onCancel }) {
3290
- return /* @__PURE__ */ jsx36(Button, {
3774
+ return /* @__PURE__ */ jsx47(Button, {
3291
3775
  type: "button",
3292
3776
  variant: "destructive",
3293
3777
  size: "icon",
3294
3778
  className: "h-8 w-8 rounded-lg",
3295
3779
  onClick: onCancel,
3296
3780
  "aria-label": "Stop",
3297
- children: /* @__PURE__ */ jsx36(CircleStop, {
3781
+ children: /* @__PURE__ */ jsx47(CircleStop, {
3298
3782
  className: "size-4"
3299
3783
  })
3300
3784
  });
@@ -3302,7 +3786,7 @@ function CancelButton({ onCancel }) {
3302
3786
  function SubmitButton({ disabled, status }) {
3303
3787
  const { textInput } = usePromptInputController();
3304
3788
  const hasText = textInput.value.trim().length > 0;
3305
- return /* @__PURE__ */ jsx36(PromptInputSubmit, {
3789
+ return /* @__PURE__ */ jsx47(PromptInputSubmit, {
3306
3790
  disabled: disabled || !hasText,
3307
3791
  status
3308
3792
  });
@@ -3311,9 +3795,9 @@ function AttachmentHeader() {
3311
3795
  const { files } = usePromptInputAttachments();
3312
3796
  if (files.length === 0)
3313
3797
  return null;
3314
- return /* @__PURE__ */ jsx36(PromptInputHeader, {
3315
- children: /* @__PURE__ */ jsx36(PromptInputAttachments, {
3316
- children: (attachment) => /* @__PURE__ */ jsx36(PromptInputAttachment, {
3798
+ return /* @__PURE__ */ jsx47(PromptInputHeader, {
3799
+ children: /* @__PURE__ */ jsx47(PromptInputAttachments, {
3800
+ children: (attachment) => /* @__PURE__ */ jsx47(PromptInputAttachment, {
3317
3801
  data: attachment
3318
3802
  })
3319
3803
  })
@@ -3328,7 +3812,7 @@ function TranscribeAudioRecorder({
3328
3812
  labels
3329
3813
  }) {
3330
3814
  const { textInput } = usePromptInputController();
3331
- return /* @__PURE__ */ jsx36(AudioRecorder, {
3815
+ return /* @__PURE__ */ jsx47(AudioRecorder, {
3332
3816
  mode: "transcribe",
3333
3817
  transcriptionEndpoint: endpoint,
3334
3818
  transcriptionHeaders: headers,
@@ -3392,8 +3876,8 @@ function AgnoChatInput({
3392
3876
  };
3393
3877
  const computedStatus = status ?? (disabled ? "submitted" : undefined);
3394
3878
  const showCancelButton = allowCancelRun && isStreaming && onCancel;
3395
- return /* @__PURE__ */ jsx36(PromptInputProvider, {
3396
- children: /* @__PURE__ */ jsxs21(PromptInput, {
3879
+ return /* @__PURE__ */ jsx47(PromptInputProvider, {
3880
+ children: /* @__PURE__ */ jsxs29(PromptInput, {
3397
3881
  onSubmit: handleSubmit,
3398
3882
  accept: fileUpload?.accept ?? DEFAULT_ACCEPTED_FILE_TYPES,
3399
3883
  multiple: fileUpload?.multiple ?? true,
@@ -3403,35 +3887,35 @@ function AgnoChatInput({
3403
3887
  dragListenerTarget: dropZoneContainerRef,
3404
3888
  className: cn("w-full", className),
3405
3889
  children: [
3406
- /* @__PURE__ */ jsx36(AttachmentHeader, {}),
3407
- /* @__PURE__ */ jsx36(PromptInputBody, {
3408
- children: /* @__PURE__ */ jsx36(PromptInputTextarea, {
3890
+ /* @__PURE__ */ jsx47(AttachmentHeader, {}),
3891
+ /* @__PURE__ */ jsx47(PromptInputBody, {
3892
+ children: /* @__PURE__ */ jsx47(PromptInputTextarea, {
3409
3893
  placeholder: placeholder || "Type your message... (Enter to send, Shift+Enter for new line)",
3410
3894
  disabled
3411
3895
  })
3412
3896
  }),
3413
- /* @__PURE__ */ jsxs21(PromptInputFooter, {
3897
+ /* @__PURE__ */ jsxs29(PromptInputFooter, {
3414
3898
  children: [
3415
- /* @__PURE__ */ jsxs21(PromptInputTools, {
3899
+ /* @__PURE__ */ jsxs29(PromptInputTools, {
3416
3900
  children: [
3417
- showAttachments && /* @__PURE__ */ jsxs21(PromptInputActionMenu, {
3901
+ showAttachments && /* @__PURE__ */ jsxs29(PromptInputActionMenu, {
3418
3902
  children: [
3419
- /* @__PURE__ */ jsx36(PromptInputActionMenuTrigger, {}),
3420
- /* @__PURE__ */ jsx36(PromptInputActionMenuContent, {
3421
- children: /* @__PURE__ */ jsx36(PromptInputActionAddAttachments, {
3903
+ /* @__PURE__ */ jsx47(PromptInputActionMenuTrigger, {}),
3904
+ /* @__PURE__ */ jsx47(PromptInputActionMenuContent, {
3905
+ children: /* @__PURE__ */ jsx47(PromptInputActionAddAttachments, {
3422
3906
  label: "Add files"
3423
3907
  })
3424
3908
  })
3425
3909
  ]
3426
3910
  }),
3427
- audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx36(TranscribeAudioRecorder, {
3911
+ audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx47(TranscribeAudioRecorder, {
3428
3912
  endpoint: resolvedAudio.endpoint,
3429
3913
  headers: resolvedAudio.headers,
3430
3914
  disabled,
3431
3915
  parseResponse: resolvedAudio.parseResponse,
3432
3916
  onRequestPermission: resolvedAudio.requestPermission,
3433
3917
  labels: resolvedAudio.labels
3434
- }) : /* @__PURE__ */ jsx36(AudioRecorder, {
3918
+ }) : /* @__PURE__ */ jsx47(AudioRecorder, {
3435
3919
  onRecordingComplete: handleAudioRecording,
3436
3920
  disabled,
3437
3921
  onRequestPermission: resolvedAudio?.requestPermission,
@@ -3440,15 +3924,15 @@ function AgnoChatInput({
3440
3924
  extraTools
3441
3925
  ]
3442
3926
  }),
3443
- showCancelButton ? /* @__PURE__ */ jsx36(CancelButton, {
3927
+ showCancelButton ? /* @__PURE__ */ jsx47(CancelButton, {
3444
3928
  onCancel
3445
- }) : /* @__PURE__ */ jsx36(SubmitButton, {
3929
+ }) : /* @__PURE__ */ jsx47(SubmitButton, {
3446
3930
  disabled,
3447
3931
  status: computedStatus
3448
3932
  })
3449
3933
  ]
3450
3934
  }),
3451
- showAttachments && /* @__PURE__ */ jsx36(PromptInputDropZone, {
3935
+ showAttachments && /* @__PURE__ */ jsx47(PromptInputDropZone, {
3452
3936
  ...dropZoneProps,
3453
3937
  container: dropZoneContainerRef
3454
3938
  })
@@ -3456,39 +3940,46 @@ function AgnoChatInput({
3456
3940
  })
3457
3941
  });
3458
3942
  }
3943
+ // src/ui/composed/agno-chat/render-tool.ts
3944
+ function byToolName(map, fallback) {
3945
+ return (tool, args) => {
3946
+ if (!Object.prototype.hasOwnProperty.call(map, tool.tool_name)) {
3947
+ return fallback ? fallback(tool, args) : args.defaultRender();
3948
+ }
3949
+ const entry = map[tool.tool_name];
3950
+ if (entry === false)
3951
+ return null;
3952
+ return entry(tool, args);
3953
+ };
3954
+ }
3459
3955
  // src/ui/composed/agno-chat/agno-chat.tsx
3460
- import { useCallback as useCallback7, useMemo as useMemo3, useRef as useRef6 } from "react";
3956
+ import { useCallback as useCallback9, useMemo as useMemo6, useRef as useRef6 } from "react";
3461
3957
  import { useAgnoChat, useAgnoToolExecution } from "@rodrigocoliveira/agno-react";
3462
-
3463
- // src/ui/composed/agno-chat/context.ts
3464
- import { createContext as createContext3, useContext as useContext3 } from "react";
3465
- var AgnoChatContext = createContext3(null);
3466
- function useAgnoChatContext() {
3467
- const ctx = useContext3(AgnoChatContext);
3468
- if (!ctx) {
3469
- throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
3470
- }
3471
- return ctx;
3958
+ import { jsx as jsx48 } from "react/jsx-runtime";
3959
+ function resolveDebug(debug) {
3960
+ if (typeof debug === "boolean")
3961
+ return debug;
3962
+ return typeof process !== "undefined" && process.env?.NODE_ENV === "development";
3472
3963
  }
3473
-
3474
- // src/ui/composed/agno-chat/agno-chat.tsx
3475
- import { jsx as jsx37 } from "react/jsx-runtime";
3476
3964
  function AgnoChatRoot({
3477
3965
  children,
3478
3966
  toolHandlers = {},
3479
3967
  autoExecuteTools = true,
3480
- toolResultRenderers,
3968
+ renderTool,
3969
+ debug,
3970
+ skipHydration,
3481
3971
  className,
3482
3972
  ...divProps
3483
3973
  }) {
3484
3974
  const chat = useAgnoChat();
3485
3975
  const toolExec = useAgnoToolExecution(toolHandlers, autoExecuteTools, {
3486
- skipHydration: toolResultRenderers ? Object.keys(toolResultRenderers) : undefined
3976
+ skipHydration
3487
3977
  });
3488
3978
  const containerRef = useRef6(null);
3979
+ const isDebug = resolveDebug(debug);
3489
3980
  const sendRef = useRef6(chat.sendMessage);
3490
3981
  sendRef.current = chat.sendMessage;
3491
- const handleSend = useCallback7(async (message) => {
3982
+ const handleSend = useCallback9(async (message) => {
3492
3983
  try {
3493
3984
  await sendRef.current(message);
3494
3985
  } catch {}
@@ -3514,7 +4005,7 @@ function AgnoChatRoot({
3514
4005
  continueWithResults,
3515
4006
  executionError
3516
4007
  } = toolExec;
3517
- const contextValue = useMemo3(() => ({
4008
+ const contextValue = useMemo6(() => ({
3518
4009
  messages,
3519
4010
  sendMessage,
3520
4011
  clearMessages,
@@ -3535,7 +4026,8 @@ function AgnoChatRoot({
3535
4026
  handleSend,
3536
4027
  inputDisabled: isStreaming || isPaused,
3537
4028
  dropZoneContainerRef: containerRef,
3538
- toolResultRenderers
4029
+ renderTool,
4030
+ isDebug
3539
4031
  }), [
3540
4032
  messages,
3541
4033
  sendMessage,
@@ -3555,11 +4047,12 @@ function AgnoChatRoot({
3555
4047
  continueWithResults,
3556
4048
  executionError,
3557
4049
  handleSend,
3558
- toolResultRenderers
4050
+ renderTool,
4051
+ isDebug
3559
4052
  ]);
3560
- return /* @__PURE__ */ jsx37(AgnoChatContext.Provider, {
4053
+ return /* @__PURE__ */ jsx48(AgnoChatContext.Provider, {
3561
4054
  value: contextValue,
3562
- children: /* @__PURE__ */ jsx37("div", {
4055
+ children: /* @__PURE__ */ jsx48("div", {
3563
4056
  ref: containerRef,
3564
4057
  className: cn("relative h-full flex flex-col", className),
3565
4058
  ...divProps,
@@ -3569,25 +4062,25 @@ function AgnoChatRoot({
3569
4062
  }
3570
4063
 
3571
4064
  // src/ui/composed/agno-chat/messages.tsx
3572
- import { isValidElement as isValidElement2, useEffect as useEffect6, useRef as useRef7 } from "react";
4065
+ import { isValidElement as isValidElement2, useEffect as useEffect8, useRef as useRef7 } from "react";
3573
4066
 
3574
4067
  // src/ui/composed/agno-chat/suggested-prompts.tsx
3575
- import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
4068
+ import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
3576
4069
  function AgnoChatSuggestedPrompts({ className, prompts }) {
3577
4070
  const { handleSend } = useAgnoChatContext();
3578
4071
  if (prompts.length === 0)
3579
4072
  return null;
3580
- return /* @__PURE__ */ jsx38("div", {
4073
+ return /* @__PURE__ */ jsx49("div", {
3581
4074
  className: cn("grid grid-cols-2 gap-2 w-full max-w-md", className),
3582
- children: prompts.map((prompt, idx) => /* @__PURE__ */ jsxs22("button", {
4075
+ children: prompts.map((prompt, idx) => /* @__PURE__ */ jsxs30("button", {
3583
4076
  onClick: () => handleSend(prompt.text),
3584
4077
  className: "flex items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-card hover:bg-accent/50 hover:border-primary/20 transition-all duration-200 text-left text-sm group",
3585
4078
  children: [
3586
- prompt.icon && /* @__PURE__ */ jsx38("span", {
4079
+ prompt.icon && /* @__PURE__ */ jsx49("span", {
3587
4080
  className: "text-muted-foreground group-hover:text-primary transition-colors",
3588
4081
  children: prompt.icon
3589
4082
  }),
3590
- /* @__PURE__ */ jsx38("span", {
4083
+ /* @__PURE__ */ jsx49("span", {
3591
4084
  className: "text-muted-foreground group-hover:text-foreground transition-colors text-xs leading-snug",
3592
4085
  children: prompt.text
3593
4086
  })
@@ -3598,11 +4091,11 @@ function AgnoChatSuggestedPrompts({ className, prompts }) {
3598
4091
 
3599
4092
  // src/ui/composed/agno-chat/messages.tsx
3600
4093
  import { Bot as Bot2 } from "lucide-react";
3601
- import { jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
4094
+ import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
3602
4095
  function ScrollOnNewUserMessage({ messageCount }) {
3603
4096
  const { scrollToBottom } = useStickToBottomContext2();
3604
4097
  const prevCount = useRef7(messageCount);
3605
- useEffect6(() => {
4098
+ useEffect8(() => {
3606
4099
  if (messageCount > prevCount.current) {
3607
4100
  scrollToBottom("smooth");
3608
4101
  }
@@ -3622,13 +4115,8 @@ function AgnoChatMessages({
3622
4115
  showReasoning,
3623
4116
  showReferences,
3624
4117
  showTimestamp,
3625
- showGenerativeUI,
3626
- showToolCalls,
3627
4118
  showFilePreview,
3628
4119
  showImageLightbox,
3629
- renderToolCall,
3630
- renderContent,
3631
- renderMedia,
3632
4120
  formatTimestamp,
3633
4121
  messageClassNames,
3634
4122
  emptyState,
@@ -3636,24 +4124,23 @@ function AgnoChatMessages({
3636
4124
  children,
3637
4125
  showThinkingIndicator = true,
3638
4126
  renderThinkingIndicator,
3639
- toolResultRenderers: propToolResultRenderers,
4127
+ renderTool: propRenderTool,
3640
4128
  scrollBehavior,
3641
4129
  scrollToBottomButton
3642
4130
  }) {
3643
- const { messages, isStreaming, toolResultRenderers: contextToolResultRenderers } = useAgnoChatContext();
3644
- const toolResultRenderers = propToolResultRenderers ?? contextToolResultRenderers;
4131
+ const { messages, isStreaming } = useAgnoChatContext();
3645
4132
  const lastMessage = messages[messages.length - 1];
3646
4133
  const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
3647
4134
  const resolvedScrollButton = (() => {
3648
4135
  if (scrollToBottomButton === false)
3649
4136
  return null;
3650
4137
  if (scrollToBottomButton === undefined || scrollToBottomButton === true) {
3651
- return /* @__PURE__ */ jsx39(ConversationScrollButton, {});
4138
+ return /* @__PURE__ */ jsx50(ConversationScrollButton, {});
3652
4139
  }
3653
4140
  if (isValidElement2(scrollToBottomButton))
3654
4141
  return scrollToBottomButton;
3655
4142
  if (typeof scrollToBottomButton === "object" && scrollToBottomButton !== null && "className" in scrollToBottomButton) {
3656
- return /* @__PURE__ */ jsx39(ConversationScrollButton, {
4143
+ return /* @__PURE__ */ jsx50(ConversationScrollButton, {
3657
4144
  className: scrollToBottomButton.className
3658
4145
  });
3659
4146
  }
@@ -3670,71 +4157,66 @@ function AgnoChatMessages({
3670
4157
  ...showReasoning !== undefined && { showReasoning },
3671
4158
  ...showReferences !== undefined && { showReferences },
3672
4159
  ...showTimestamp !== undefined && { showTimestamp },
3673
- ...showGenerativeUI !== undefined && { showGenerativeUI },
3674
- ...showToolCalls !== undefined && { showToolCalls },
3675
4160
  ...showFilePreview !== undefined && { showFilePreview },
3676
4161
  ...showImageLightbox !== undefined && { showImageLightbox },
3677
- ...renderToolCall !== undefined && { renderToolCall },
3678
- ...renderContent !== undefined && { renderContent },
3679
- ...renderMedia !== undefined && { renderMedia },
3680
4162
  ...formatTimestamp !== undefined && { formatTimestamp },
3681
4163
  ...messageClassNames !== undefined && { classNames: messageClassNames },
3682
- ...toolResultRenderers !== undefined && { toolResultRenderers }
4164
+ ...propRenderTool !== undefined && { renderTool: propRenderTool }
3683
4165
  };
3684
- const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsxs23("div", {
4166
+ const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsxs31("div", {
3685
4167
  className: "flex flex-col items-center gap-6",
3686
4168
  children: [
3687
- /* @__PURE__ */ jsxs23("div", {
4169
+ /* @__PURE__ */ jsxs31("div", {
3688
4170
  className: "relative",
3689
4171
  children: [
3690
- /* @__PURE__ */ jsx39("div", {
4172
+ /* @__PURE__ */ jsx50("div", {
3691
4173
  className: "h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",
3692
- children: /* @__PURE__ */ jsx39(Bot2, {
4174
+ children: /* @__PURE__ */ jsx50(Bot2, {
3693
4175
  className: "h-8 w-8 text-primary"
3694
4176
  })
3695
4177
  }),
3696
- /* @__PURE__ */ jsx39("div", {
4178
+ /* @__PURE__ */ jsx50("div", {
3697
4179
  className: "absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background flex items-center justify-center",
3698
- children: /* @__PURE__ */ jsx39("span", {
4180
+ children: /* @__PURE__ */ jsx50("span", {
3699
4181
  className: "h-2 w-2 rounded-full bg-white animate-pulse"
3700
4182
  })
3701
4183
  })
3702
4184
  ]
3703
4185
  }),
3704
- /* @__PURE__ */ jsxs23("div", {
4186
+ /* @__PURE__ */ jsxs31("div", {
3705
4187
  className: "space-y-2 text-center",
3706
4188
  children: [
3707
- /* @__PURE__ */ jsx39("h3", {
4189
+ /* @__PURE__ */ jsx50("h3", {
3708
4190
  className: "text-xl font-semibold tracking-tight",
3709
4191
  children: "Welcome to Agno Chat"
3710
4192
  }),
3711
- /* @__PURE__ */ jsx39("p", {
4193
+ /* @__PURE__ */ jsx50("p", {
3712
4194
  className: "text-muted-foreground text-sm max-w-sm",
3713
4195
  children: "Start a conversation with your AI agent. Ask questions, explore ideas, or run tools."
3714
4196
  })
3715
4197
  ]
3716
4198
  }),
3717
- suggestedPrompts.length > 0 && /* @__PURE__ */ jsx39(AgnoChatSuggestedPrompts, {
4199
+ suggestedPrompts.length > 0 && /* @__PURE__ */ jsx50(AgnoChatSuggestedPrompts, {
3718
4200
  prompts: suggestedPrompts
3719
4201
  })
3720
4202
  ]
3721
4203
  });
3722
- return /* @__PURE__ */ jsxs23(Conversation, {
4204
+ return /* @__PURE__ */ jsxs31(Conversation, {
3723
4205
  className: cn("relative flex-1 w-full", className),
3724
4206
  scrollBehavior,
3725
4207
  children: [
3726
- /* @__PURE__ */ jsx39(ScrollOnNewUserMessage, {
4208
+ /* @__PURE__ */ jsx50(ScrollOnNewUserMessage, {
3727
4209
  messageCount: messages.length
3728
4210
  }),
3729
- /* @__PURE__ */ jsxs23(ConversationContent, {
4211
+ /* @__PURE__ */ jsxs31(ConversationContent, {
3730
4212
  className: "max-w-3xl mx-auto",
3731
4213
  children: [
3732
- messages.length === 0 ? /* @__PURE__ */ jsx39(ConversationEmptyState, {
4214
+ messages.length === 0 ? /* @__PURE__ */ jsx50(ConversationEmptyState, {
3733
4215
  children: resolvedEmptyState
3734
4216
  }) : messages.map((message, index) => {
3735
4217
  if (isThinking && index === messages.length - 1 && message === lastMessage)
3736
4218
  return null;
3737
- return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx39(AgnoMessageItem, {
4219
+ return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx50(AgnoMessageItem, {
3738
4220
  message,
3739
4221
  avatars,
3740
4222
  actions,
@@ -3742,9 +4224,9 @@ function AgnoChatMessages({
3742
4224
  ...messageItemProps
3743
4225
  }, `msg-${index}-${message.created_at}`);
3744
4226
  }),
3745
- isThinking && /* @__PURE__ */ jsx39("div", {
4227
+ isThinking && /* @__PURE__ */ jsx50("div", {
3746
4228
  className: "py-2",
3747
- children: renderThinkingIndicator ?? /* @__PURE__ */ jsx39(StreamingIndicator, {
4229
+ children: renderThinkingIndicator ?? /* @__PURE__ */ jsx50(StreamingIndicator, {
3748
4230
  avatar: avatars?.assistant
3749
4231
  })
3750
4232
  })
@@ -3756,9 +4238,9 @@ function AgnoChatMessages({
3756
4238
  }
3757
4239
 
3758
4240
  // src/ui/composed/agno-chat/empty-state.tsx
3759
- import { jsx as jsx40 } from "react/jsx-runtime";
4241
+ import { jsx as jsx51 } from "react/jsx-runtime";
3760
4242
  function AgnoChatEmptyState({ children, className, ...props }) {
3761
- return /* @__PURE__ */ jsx40("div", {
4243
+ return /* @__PURE__ */ jsx51("div", {
3762
4244
  className: cn("flex flex-col items-center gap-6", className),
3763
4245
  ...props,
3764
4246
  children
@@ -3766,8 +4248,8 @@ function AgnoChatEmptyState({ children, className, ...props }) {
3766
4248
  }
3767
4249
 
3768
4250
  // src/ui/composed/agno-chat/error-bar.tsx
3769
- import { useState as useState9, useEffect as useEffect7, useRef as useRef8 } from "react";
3770
- import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
4251
+ import { useState as useState11, useEffect as useEffect9, useRef as useRef8 } from "react";
4252
+ import { jsx as jsx52, jsxs as jsxs32 } from "react/jsx-runtime";
3771
4253
  function AgnoChatErrorBar({
3772
4254
  className,
3773
4255
  text,
@@ -3777,10 +4259,10 @@ function AgnoChatErrorBar({
3777
4259
  children
3778
4260
  }) {
3779
4261
  const { error, executionError } = useAgnoChatContext();
3780
- const [hidden, setHidden] = useState9(false);
4262
+ const [hidden, setHidden] = useState11(false);
3781
4263
  const timerRef = useRef8(null);
3782
4264
  const rawMessage = error || executionError;
3783
- useEffect7(() => {
4265
+ useEffect9(() => {
3784
4266
  if (!rawMessage)
3785
4267
  return;
3786
4268
  setHidden(false);
@@ -3807,23 +4289,23 @@ function AgnoChatErrorBar({
3807
4289
  if (children) {
3808
4290
  return typeof children === "function" ? children(rawMessage) : children;
3809
4291
  }
3810
- return /* @__PURE__ */ jsxs24("div", {
4292
+ return /* @__PURE__ */ jsxs32("div", {
3811
4293
  className: "flex items-center gap-2 max-w-3xl mx-auto",
3812
4294
  children: [
3813
- icon && /* @__PURE__ */ jsx41("span", {
4295
+ icon && /* @__PURE__ */ jsx52("span", {
3814
4296
  className: "shrink-0",
3815
4297
  children: icon
3816
4298
  }),
3817
- /* @__PURE__ */ jsx41("p", {
4299
+ /* @__PURE__ */ jsx52("p", {
3818
4300
  className: "text-sm text-destructive flex-1",
3819
4301
  children: displayMessage
3820
4302
  }),
3821
- dismissible && /* @__PURE__ */ jsx41("button", {
4303
+ dismissible && /* @__PURE__ */ jsx52("button", {
3822
4304
  type: "button",
3823
4305
  onClick: () => setHidden(true),
3824
4306
  className: "shrink-0 text-destructive/60 hover:text-destructive transition-colors",
3825
4307
  "aria-label": "Dismiss error",
3826
- children: /* @__PURE__ */ jsxs24("svg", {
4308
+ children: /* @__PURE__ */ jsxs32("svg", {
3827
4309
  xmlns: "http://www.w3.org/2000/svg",
3828
4310
  width: "16",
3829
4311
  height: "16",
@@ -3834,10 +4316,10 @@ function AgnoChatErrorBar({
3834
4316
  strokeLinecap: "round",
3835
4317
  strokeLinejoin: "round",
3836
4318
  children: [
3837
- /* @__PURE__ */ jsx41("path", {
4319
+ /* @__PURE__ */ jsx52("path", {
3838
4320
  d: "M18 6 6 18"
3839
4321
  }),
3840
- /* @__PURE__ */ jsx41("path", {
4322
+ /* @__PURE__ */ jsx52("path", {
3841
4323
  d: "m6 6 12 12"
3842
4324
  })
3843
4325
  ]
@@ -3846,14 +4328,14 @@ function AgnoChatErrorBar({
3846
4328
  ]
3847
4329
  });
3848
4330
  };
3849
- return /* @__PURE__ */ jsx41("div", {
4331
+ return /* @__PURE__ */ jsx52("div", {
3850
4332
  className: cn("px-4 py-2.5 bg-destructive/5 border-t border-destructive/20", className),
3851
4333
  children: renderContent()
3852
4334
  });
3853
4335
  }
3854
4336
 
3855
4337
  // src/ui/composed/agno-chat/input.tsx
3856
- import { jsx as jsx42 } from "react/jsx-runtime";
4338
+ import { jsx as jsx53 } from "react/jsx-runtime";
3857
4339
  function AgnoChatInputArea({
3858
4340
  className,
3859
4341
  children,
@@ -3866,11 +4348,11 @@ function AgnoChatInputArea({
3866
4348
  dropZoneProps
3867
4349
  }) {
3868
4350
  const { handleSend, inputDisabled, isStreaming, isPaused, cancelRun, dropZoneContainerRef } = useAgnoChatContext();
3869
- return /* @__PURE__ */ jsx42("div", {
4351
+ return /* @__PURE__ */ jsx53("div", {
3870
4352
  className: cn("border-t border-border bg-background/80 backdrop-blur-sm", className),
3871
- children: /* @__PURE__ */ jsx42("div", {
4353
+ children: /* @__PURE__ */ jsx53("div", {
3872
4354
  className: "mx-auto px-4 py-2",
3873
- children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */ jsx42(AgnoChatInput, {
4355
+ children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */ jsx53(AgnoChatInput, {
3874
4356
  onSend: handleSend,
3875
4357
  disabled: inputDisabled,
3876
4358
  isStreaming,
@@ -3901,6 +4383,7 @@ export {
3901
4383
  usePromptInputDropZone,
3902
4384
  usePromptInputController,
3903
4385
  usePromptInputAttachments,
4386
+ useAgnoMessageContext,
3904
4387
  useAgnoChatContext,
3905
4388
  isPreviewable,
3906
4389
  getFilePreviewType,
@@ -3909,6 +4392,7 @@ export {
3909
4392
  formatFullTimestamp,
3910
4393
  formatFileSize,
3911
4394
  cn,
4395
+ byToolName,
3912
4396
  buttonVariants,
3913
4397
  badgeVariants,
3914
4398
  TooltipTrigger,
@@ -3918,6 +4402,8 @@ export {
3918
4402
  ToolOutput,
3919
4403
  ToolInput,
3920
4404
  ToolHeader,
4405
+ ToolGenerativeUI,
4406
+ ToolDebugCard,
3921
4407
  ToolContent,
3922
4408
  Tool,
3923
4409
  StreamingIndicator,
@@ -4039,7 +4525,15 @@ export {
4039
4525
  ArtifactActions,
4040
4526
  ArtifactAction,
4041
4527
  Artifact,
4528
+ AgnoMessageTools,
4529
+ AgnoMessageReferences,
4530
+ AgnoMessageReasoning,
4531
+ AgnoMessageMedia,
4042
4532
  AgnoMessageItem,
4533
+ AgnoMessageFooter,
4534
+ AgnoMessageContext,
4535
+ AgnoMessageContent,
4536
+ AgnoMessage,
4043
4537
  AgnoChatSuggestedPrompts,
4044
4538
  AgnoChatRoot,
4045
4539
  AgnoChatMessages,
@@ -4054,4 +4548,4 @@ export {
4054
4548
  Accordion
4055
4549
  };
4056
4550
 
4057
- //# debugId=42C13B1D6AF75F5E64756E2164756E21
4551
+ //# debugId=849670CE2678388A64756E2164756E21