@rodrigocoliveira/agno-react 1.3.1 → 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 (53) 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/components/conversation.d.ts +5 -2
  9. package/dist/ui/components/conversation.d.ts.map +1 -1
  10. package/dist/ui/composed/AgnoMessageItem.d.ts +12 -24
  11. package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
  12. package/dist/ui/composed/agno-chat/agno-chat.d.ts +23 -3
  13. package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
  14. package/dist/ui/composed/agno-chat/context.d.ts +4 -3
  15. package/dist/ui/composed/agno-chat/context.d.ts.map +1 -1
  16. package/dist/ui/composed/agno-chat/messages.d.ts +33 -16
  17. package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
  18. package/dist/ui/composed/agno-chat/render-tool.d.ts +11 -0
  19. package/dist/ui/composed/agno-chat/render-tool.d.ts.map +1 -0
  20. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +11 -0
  21. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -0
  22. package/dist/ui/composed/agno-message/content.d.ts +2 -0
  23. package/dist/ui/composed/agno-message/content.d.ts.map +1 -0
  24. package/dist/ui/composed/agno-message/context.d.ts +21 -0
  25. package/dist/ui/composed/agno-message/context.d.ts.map +1 -0
  26. package/dist/ui/composed/agno-message/footer.d.ts +6 -0
  27. package/dist/ui/composed/agno-message/footer.d.ts.map +1 -0
  28. package/dist/ui/composed/agno-message/index.d.ts +13 -0
  29. package/dist/ui/composed/agno-message/index.d.ts.map +1 -0
  30. package/dist/ui/composed/agno-message/media.d.ts +2 -0
  31. package/dist/ui/composed/agno-message/media.d.ts.map +1 -0
  32. package/dist/ui/composed/agno-message/message.d.ts +41 -0
  33. package/dist/ui/composed/agno-message/message.d.ts.map +1 -0
  34. package/dist/ui/composed/agno-message/reasoning.d.ts +2 -0
  35. package/dist/ui/composed/agno-message/reasoning.d.ts.map +1 -0
  36. package/dist/ui/composed/agno-message/references.d.ts +2 -0
  37. package/dist/ui/composed/agno-message/references.d.ts.map +1 -0
  38. package/dist/ui/composed/agno-message/tools.d.ts +7 -0
  39. package/dist/ui/composed/agno-message/tools.d.ts.map +1 -0
  40. package/dist/ui/composed/index.d.ts +6 -0
  41. package/dist/ui/composed/index.d.ts.map +1 -1
  42. package/dist/ui/index.d.ts +7 -1
  43. package/dist/ui/index.d.ts.map +1 -1
  44. package/dist/ui/primitives/badge.d.ts +1 -1
  45. package/dist/ui/primitives/button.d.ts +1 -1
  46. package/dist/ui/primitives/command.d.ts +1 -1
  47. package/dist/ui/types.d.ts +26 -0
  48. package/dist/ui/types.d.ts.map +1 -1
  49. package/dist/ui.js +1176 -647
  50. package/dist/ui.js.map +23 -8
  51. package/dist/ui.mjs +1170 -650
  52. package/dist/ui.mjs.map +23 -8
  53. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,3 +1,11 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
1
9
  // src/context/AgnoContext.tsx
2
10
  import { createContext, useContext, useMemo, useEffect } from "react";
3
11
  import { AgnoClient } from "@rodrigocoliveira/agno-client";
@@ -1065,14 +1073,1666 @@ function useAgnoActions() {
1065
1073
  error
1066
1074
  };
1067
1075
  }
1076
+ // src/ui/composed/agno-chat/render-tool.ts
1077
+ function byToolName(map, fallback) {
1078
+ return (tool, args) => {
1079
+ if (!Object.prototype.hasOwnProperty.call(map, tool.tool_name)) {
1080
+ return fallback ? fallback(tool, args) : args.defaultRender();
1081
+ }
1082
+ const entry = map[tool.tool_name];
1083
+ if (entry === false)
1084
+ return null;
1085
+ return entry(tool, args);
1086
+ };
1087
+ }
1088
+ // src/ui/primitives/badge.tsx
1089
+ import { cva } from "class-variance-authority";
1090
+
1091
+ // src/ui/lib/cn.ts
1092
+ import { clsx } from "clsx";
1093
+ import { twMerge } from "tailwind-merge";
1094
+ function cn(...inputs) {
1095
+ return twMerge(clsx(inputs));
1096
+ }
1097
+
1098
+ // src/ui/primitives/badge.tsx
1099
+ import { jsx as jsx4 } from "react/jsx-runtime";
1100
+ var badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
1101
+ variants: {
1102
+ variant: {
1103
+ default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
1104
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1105
+ destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
1106
+ outline: "text-foreground"
1107
+ }
1108
+ },
1109
+ defaultVariants: {
1110
+ variant: "default"
1111
+ }
1112
+ });
1113
+ function Badge({ className, variant, ...props }) {
1114
+ return /* @__PURE__ */ jsx4("div", {
1115
+ className: cn(badgeVariants({ variant }), className),
1116
+ ...props
1117
+ });
1118
+ }
1119
+
1120
+ // src/ui/primitives/collapsible.tsx
1121
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
1122
+ var Collapsible = CollapsiblePrimitive.Root;
1123
+ var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
1124
+ var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
1125
+
1126
+ // src/ui/components/tool.tsx
1127
+ import {
1128
+ CheckCircleIcon,
1129
+ ChevronDownIcon,
1130
+ CircleIcon,
1131
+ ClockIcon,
1132
+ WrenchIcon,
1133
+ XCircleIcon
1134
+ } from "lucide-react";
1135
+ import { isValidElement } from "react";
1136
+
1137
+ // src/ui/primitives/button.tsx
1138
+ import * as React4 from "react";
1139
+ import { Slot } from "@radix-ui/react-slot";
1140
+ import { cva as cva2 } from "class-variance-authority";
1141
+ import { jsx as jsx5 } from "react/jsx-runtime";
1142
+ var buttonVariants = cva2("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
1143
+ variants: {
1144
+ variant: {
1145
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
1146
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
1147
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
1148
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
1149
+ ghost: "hover:bg-accent hover:text-accent-foreground",
1150
+ link: "text-primary underline-offset-4 hover:underline"
1151
+ },
1152
+ size: {
1153
+ default: "h-9 px-4 py-2",
1154
+ sm: "h-8 rounded-md px-3 text-xs",
1155
+ lg: "h-10 rounded-md px-8",
1156
+ icon: "h-9 w-9"
1157
+ }
1158
+ },
1159
+ defaultVariants: {
1160
+ variant: "default",
1161
+ size: "default"
1162
+ }
1163
+ });
1164
+ var Button = React4.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
1165
+ const Comp = asChild ? Slot : "button";
1166
+ return /* @__PURE__ */ jsx5(Comp, {
1167
+ className: cn(buttonVariants({ variant, size, className })),
1168
+ ref,
1169
+ ...props
1170
+ });
1171
+ });
1172
+ Button.displayName = "Button";
1173
+
1174
+ // src/ui/components/code-block.tsx
1175
+ import { CheckIcon, CopyIcon } from "lucide-react";
1176
+ import {
1177
+ createContext as createContext3,
1178
+ useContext as useContext3,
1179
+ useEffect as useEffect5,
1180
+ useRef,
1181
+ useState as useState6
1182
+ } from "react";
1183
+ import { jsx as jsx6, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
1184
+ var CodeBlockContext = createContext3({
1185
+ code: ""
1186
+ });
1187
+ async function highlightCode(code, language, showLineNumbers = false) {
1188
+ try {
1189
+ const shiki = await import("shiki");
1190
+ const lineNumberTransformer = showLineNumbers ? [
1191
+ {
1192
+ name: "line-numbers",
1193
+ line(node, line) {
1194
+ node.children.unshift({
1195
+ type: "element",
1196
+ tagName: "span",
1197
+ properties: {
1198
+ className: ["inline-block", "min-w-10", "mr-4", "text-right", "select-none", "text-muted-foreground"]
1199
+ },
1200
+ children: [{ type: "text", value: String(line) }]
1201
+ });
1202
+ }
1203
+ }
1204
+ ] : [];
1205
+ const [light, dark] = await Promise.all([
1206
+ shiki.codeToHtml(code, { lang: language, theme: "one-light", transformers: lineNumberTransformer }),
1207
+ shiki.codeToHtml(code, { lang: language, theme: "one-dark-pro", transformers: lineNumberTransformer })
1208
+ ]);
1209
+ return [light, dark];
1210
+ } catch {
1211
+ return ["", ""];
1212
+ }
1213
+ }
1214
+ var CodeBlock = ({
1215
+ code,
1216
+ language,
1217
+ showLineNumbers = false,
1218
+ className,
1219
+ children,
1220
+ ...props
1221
+ }) => {
1222
+ const [html, setHtml] = useState6("");
1223
+ const [darkHtml, setDarkHtml] = useState6("");
1224
+ const effectIdRef = useRef(0);
1225
+ useEffect5(() => {
1226
+ const id = ++effectIdRef.current;
1227
+ highlightCode(code, language, showLineNumbers).then(([light, dark]) => {
1228
+ if (id === effectIdRef.current) {
1229
+ setHtml(light);
1230
+ setDarkHtml(dark);
1231
+ }
1232
+ });
1233
+ }, [code, language, showLineNumbers]);
1234
+ const useFallback = !html && !darkHtml;
1235
+ return /* @__PURE__ */ jsx6(CodeBlockContext.Provider, {
1236
+ value: { code },
1237
+ children: /* @__PURE__ */ jsx6("div", {
1238
+ className: cn("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", className),
1239
+ ...props,
1240
+ children: /* @__PURE__ */ jsxs2("div", {
1241
+ className: "relative",
1242
+ children: [
1243
+ useFallback ? /* @__PURE__ */ jsx6("pre", {
1244
+ className: "m-0 overflow-auto bg-background p-4 text-foreground text-sm",
1245
+ children: /* @__PURE__ */ jsx6("code", {
1246
+ className: "font-mono text-sm",
1247
+ children: code
1248
+ })
1249
+ }) : /* @__PURE__ */ jsxs2(Fragment, {
1250
+ children: [
1251
+ /* @__PURE__ */ jsx6("div", {
1252
+ className: "overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
1253
+ dangerouslySetInnerHTML: { __html: html }
1254
+ }),
1255
+ /* @__PURE__ */ jsx6("div", {
1256
+ className: "hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
1257
+ dangerouslySetInnerHTML: { __html: darkHtml }
1258
+ })
1259
+ ]
1260
+ }),
1261
+ children && /* @__PURE__ */ jsx6("div", {
1262
+ className: "absolute top-2 right-2 flex items-center gap-2",
1263
+ children
1264
+ })
1265
+ ]
1266
+ })
1267
+ })
1268
+ });
1269
+ };
1270
+
1271
+ // src/ui/components/tool.tsx
1272
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1273
+ var Tool = ({ className, ...props }) => /* @__PURE__ */ jsx7(Collapsible, {
1274
+ className: cn("not-prose mb-4 w-full rounded-md border", className),
1275
+ ...props
1276
+ });
1277
+ var getStatusBadge = (status) => {
1278
+ const labels = {
1279
+ "input-streaming": "Pending",
1280
+ "input-available": "Running",
1281
+ "approval-requested": "Awaiting Approval",
1282
+ "approval-responded": "Responded",
1283
+ "output-available": "Completed",
1284
+ "output-error": "Error",
1285
+ "output-denied": "Denied"
1286
+ };
1287
+ const icons = {
1288
+ "input-streaming": /* @__PURE__ */ jsx7(CircleIcon, {
1289
+ className: "size-4"
1290
+ }),
1291
+ "input-available": /* @__PURE__ */ jsx7(ClockIcon, {
1292
+ className: "size-4 animate-pulse"
1293
+ }),
1294
+ "approval-requested": /* @__PURE__ */ jsx7(ClockIcon, {
1295
+ className: "size-4 text-yellow-600"
1296
+ }),
1297
+ "approval-responded": /* @__PURE__ */ jsx7(CheckCircleIcon, {
1298
+ className: "size-4 text-blue-600"
1299
+ }),
1300
+ "output-available": /* @__PURE__ */ jsx7(CheckCircleIcon, {
1301
+ className: "size-4 text-green-600"
1302
+ }),
1303
+ "output-error": /* @__PURE__ */ jsx7(XCircleIcon, {
1304
+ className: "size-4 text-red-600"
1305
+ }),
1306
+ "output-denied": /* @__PURE__ */ jsx7(XCircleIcon, {
1307
+ className: "size-4 text-orange-600"
1308
+ })
1309
+ };
1310
+ return /* @__PURE__ */ jsxs3(Badge, {
1311
+ className: "gap-1.5 rounded-full text-xs",
1312
+ variant: "secondary",
1313
+ children: [
1314
+ icons[status],
1315
+ labels[status]
1316
+ ]
1317
+ });
1318
+ };
1319
+ var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */ jsxs3(CollapsibleTrigger2, {
1320
+ className: cn("group flex w-full items-center justify-between gap-4 p-3", className),
1321
+ ...props,
1322
+ children: [
1323
+ /* @__PURE__ */ jsxs3("div", {
1324
+ className: "flex items-center gap-2",
1325
+ children: [
1326
+ /* @__PURE__ */ jsx7(WrenchIcon, {
1327
+ className: "size-4 text-muted-foreground"
1328
+ }),
1329
+ /* @__PURE__ */ jsx7("span", {
1330
+ className: "font-medium text-sm",
1331
+ children: title ?? type?.split("-").slice(1).join("-") ?? "Tool"
1332
+ }),
1333
+ getStatusBadge(state)
1334
+ ]
1335
+ }),
1336
+ /* @__PURE__ */ jsx7(ChevronDownIcon, {
1337
+ className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
1338
+ })
1339
+ ]
1340
+ });
1341
+ var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsx7(CollapsibleContent2, {
1342
+ className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className),
1343
+ ...props
1344
+ });
1345
+ var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsxs3("div", {
1346
+ className: cn("space-y-2 overflow-hidden p-4", className),
1347
+ ...props,
1348
+ children: [
1349
+ /* @__PURE__ */ jsx7("h4", {
1350
+ className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
1351
+ children: "Parameters"
1352
+ }),
1353
+ /* @__PURE__ */ jsx7("div", {
1354
+ className: "rounded-md bg-muted/50",
1355
+ children: /* @__PURE__ */ jsx7(CodeBlock, {
1356
+ code: JSON.stringify(input, null, 2),
1357
+ language: "json"
1358
+ })
1359
+ })
1360
+ ]
1361
+ });
1362
+ var ToolOutput = ({ className, output, errorText, ...props }) => {
1363
+ if (!(output || errorText)) {
1364
+ return null;
1365
+ }
1366
+ let Output = /* @__PURE__ */ jsx7("div", {
1367
+ children: output
1368
+ });
1369
+ if (typeof output === "object" && !isValidElement(output)) {
1370
+ Output = /* @__PURE__ */ jsx7(CodeBlock, {
1371
+ code: JSON.stringify(output, null, 2),
1372
+ language: "json"
1373
+ });
1374
+ } else if (typeof output === "string") {
1375
+ Output = /* @__PURE__ */ jsx7(CodeBlock, {
1376
+ code: output,
1377
+ language: "json"
1378
+ });
1379
+ }
1380
+ return /* @__PURE__ */ jsxs3("div", {
1381
+ className: cn("space-y-2 p-4", className),
1382
+ ...props,
1383
+ children: [
1384
+ /* @__PURE__ */ jsx7("h4", {
1385
+ className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
1386
+ children: errorText ? "Error" : "Result"
1387
+ }),
1388
+ /* @__PURE__ */ jsxs3("div", {
1389
+ className: cn("overflow-x-auto rounded-md text-xs [&_table]:w-full", errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
1390
+ children: [
1391
+ errorText && /* @__PURE__ */ jsx7("div", {
1392
+ children: errorText
1393
+ }),
1394
+ Output
1395
+ ]
1396
+ })
1397
+ ]
1398
+ });
1399
+ };
1400
+
1401
+ // src/ui/primitives/tooltip.tsx
1402
+ import * as React5 from "react";
1403
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
1404
+ import { jsx as jsx8 } from "react/jsx-runtime";
1405
+ var TooltipProvider = TooltipPrimitive.Provider;
1406
+ var Tooltip = TooltipPrimitive.Root;
1407
+ var TooltipTrigger = TooltipPrimitive.Trigger;
1408
+ var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx8(TooltipPrimitive.Portal, {
1409
+ children: /* @__PURE__ */ jsx8(TooltipPrimitive.Content, {
1410
+ ref,
1411
+ sideOffset,
1412
+ className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className),
1413
+ ...props
1414
+ })
1415
+ }));
1416
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
1417
+
1418
+ // src/ui/components/artifact.tsx
1419
+ import { XIcon } from "lucide-react";
1420
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1421
+ var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx9("div", {
1422
+ className: cn("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm", className),
1423
+ ...props
1424
+ });
1425
+
1426
+ // src/ui/composed/agno-chat/tool-building-blocks.tsx
1427
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1428
+ var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
1429
+ function ToolDebugCard({ tool, defaultOpen }) {
1430
+ const output = tool.result ?? tool.content;
1431
+ return /* @__PURE__ */ jsxs5(Tool, {
1432
+ defaultOpen,
1433
+ children: [
1434
+ /* @__PURE__ */ jsx10(ToolHeader, {
1435
+ title: tool.tool_name,
1436
+ type: "tool-use",
1437
+ state: getToolState(tool)
1438
+ }),
1439
+ /* @__PURE__ */ jsxs5(ToolContent, {
1440
+ children: [
1441
+ /* @__PURE__ */ jsx10(ToolInput, {
1442
+ input: tool.tool_args
1443
+ }),
1444
+ output ? /* @__PURE__ */ jsx10(ToolOutput, {
1445
+ output,
1446
+ errorText: tool.tool_call_error ? "Tool execution failed" : undefined
1447
+ }) : null
1448
+ ]
1449
+ })
1450
+ ]
1451
+ });
1452
+ }
1453
+ function ToolGenerativeUI({ tool }) {
1454
+ const uiComponent = tool.ui_component;
1455
+ if (!uiComponent)
1456
+ return null;
1457
+ return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx10(Artifact, {
1458
+ children: /* @__PURE__ */ jsx10(GenerativeUIRenderer, {
1459
+ spec: uiComponent,
1460
+ className: "w-full p-2"
1461
+ })
1462
+ }) : /* @__PURE__ */ jsx10(GenerativeUIRenderer, {
1463
+ spec: uiComponent,
1464
+ className: "w-full"
1465
+ });
1466
+ }
1467
+ // src/ui/composed/agno-message/message.tsx
1468
+ import { useMemo as useMemo3, useState as useState8 } from "react";
1469
+ import { AlertCircle as AlertCircle2, FileIcon as FileIcon4, Music as Music2 } from "lucide-react";
1470
+
1471
+ // src/ui/lib/format-timestamp.ts
1472
+ function formatSmartTimestamp(date) {
1473
+ const now = new Date;
1474
+ const isToday = date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate();
1475
+ if (isToday) {
1476
+ return new Intl.DateTimeFormat(undefined, {
1477
+ hour: "numeric",
1478
+ minute: "2-digit",
1479
+ hour12: true
1480
+ }).format(date);
1481
+ }
1482
+ const isSameYear = date.getFullYear() === now.getFullYear();
1483
+ if (isSameYear) {
1484
+ return new Intl.DateTimeFormat(undefined, {
1485
+ month: "short",
1486
+ day: "numeric"
1487
+ }).format(date);
1488
+ }
1489
+ return new Intl.DateTimeFormat(undefined, {
1490
+ month: "short",
1491
+ day: "numeric",
1492
+ year: "numeric"
1493
+ }).format(date);
1494
+ }
1495
+ function formatFullTimestamp(date) {
1496
+ return new Intl.DateTimeFormat(undefined, {
1497
+ month: "short",
1498
+ day: "numeric",
1499
+ year: "numeric",
1500
+ hour: "numeric",
1501
+ minute: "2-digit",
1502
+ hour12: true
1503
+ }).format(date);
1504
+ }
1505
+
1506
+ // src/ui/components/smart-timestamp.tsx
1507
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1508
+ function SmartTimestamp({ date, formatShort, className }) {
1509
+ const shortText = formatShort ? formatShort(date) : formatSmartTimestamp(date);
1510
+ const fullText = formatFullTimestamp(date);
1511
+ return /* @__PURE__ */ jsx11(TooltipProvider, {
1512
+ children: /* @__PURE__ */ jsxs6(Tooltip, {
1513
+ children: [
1514
+ /* @__PURE__ */ jsx11(TooltipTrigger, {
1515
+ asChild: true,
1516
+ children: /* @__PURE__ */ jsx11("span", {
1517
+ className,
1518
+ children: shortText
1519
+ })
1520
+ }),
1521
+ /* @__PURE__ */ jsx11(TooltipContent, {
1522
+ children: /* @__PURE__ */ jsx11("p", {
1523
+ children: fullText
1524
+ })
1525
+ })
1526
+ ]
1527
+ })
1528
+ });
1529
+ }
1530
+
1531
+ // src/ui/lib/file-utils.ts
1532
+ function getFilePreviewType(mimeType) {
1533
+ if (!mimeType)
1534
+ return "none";
1535
+ if (mimeType.startsWith("image/"))
1536
+ return "image";
1537
+ if (mimeType === "application/pdf")
1538
+ return "pdf";
1539
+ if (mimeType.startsWith("text/"))
1540
+ return "text";
1541
+ if (mimeType.startsWith("video/"))
1542
+ return "video";
1543
+ if (mimeType.startsWith("audio/"))
1544
+ return "audio";
1545
+ return "none";
1546
+ }
1547
+ function formatFileSize(bytes) {
1548
+ if (bytes === 0)
1549
+ return "0 B";
1550
+ const units = ["B", "KB", "MB", "GB", "TB"];
1551
+ const k = 1024;
1552
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1553
+ const value = bytes / Math.pow(k, i);
1554
+ return `${value % 1 === 0 ? value : value.toFixed(1)} ${units[i]}`;
1555
+ }
1556
+ function getFileExtension(filename, mimeType) {
1557
+ const lastDot = filename.lastIndexOf(".");
1558
+ if (lastDot !== -1 && lastDot !== 0) {
1559
+ return filename.slice(lastDot + 1).toLowerCase();
1560
+ }
1561
+ if (mimeType) {
1562
+ return extensionFromMime(mimeType);
1563
+ }
1564
+ return "";
1565
+ }
1566
+ var mimeToExt = {
1567
+ "application/pdf": "pdf",
1568
+ "application/zip": "zip",
1569
+ "application/x-rar-compressed": "rar",
1570
+ "application/json": "json",
1571
+ "application/xml": "xml",
1572
+ "application/msword": "doc",
1573
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
1574
+ "application/vnd.ms-excel": "xls",
1575
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
1576
+ "application/vnd.ms-powerpoint": "ppt",
1577
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
1578
+ "text/csv": "csv",
1579
+ "text/plain": "txt",
1580
+ "text/html": "html",
1581
+ "text/css": "css",
1582
+ "text/javascript": "js"
1583
+ };
1584
+ function extensionFromMime(mimeType) {
1585
+ if (mimeToExt[mimeType])
1586
+ return mimeToExt[mimeType];
1587
+ const subtype = mimeType.split("/")[1];
1588
+ if (subtype && !subtype.includes(".") && !subtype.includes("+")) {
1589
+ return subtype.toLowerCase();
1590
+ }
1591
+ return "";
1592
+ }
1593
+ function isPreviewable(mimeType) {
1594
+ const type = getFilePreviewType(mimeType);
1595
+ return type === "image" || type === "pdf";
1596
+ }
1597
+
1598
+ // src/ui/components/file-preview-card.tsx
1599
+ import { FileIcon, Search } from "lucide-react";
1600
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1601
+ function ExtBadge({ ext }) {
1602
+ if (!ext)
1603
+ return null;
1604
+ return /* @__PURE__ */ jsx12("span", {
1605
+ className: "absolute bottom-1.5 left-1.5 rounded px-1 py-0.5 text-[9px] font-semibold uppercase leading-none bg-background/80 text-muted-foreground border border-border/50 backdrop-blur-sm",
1606
+ children: ext
1607
+ });
1608
+ }
1609
+ function FilePreviewCard({ file, onClick, className }) {
1610
+ const previewType = getFilePreviewType(file.type);
1611
+ const isClickable = !!onClick;
1612
+ const ext = getFileExtension(file.name, file.type);
1613
+ const cardBase = cn("group relative flex flex-col overflow-hidden rounded-xl border border-border bg-muted/20 w-28 h-28", isClickable && "cursor-pointer hover:border-foreground/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors", className);
1614
+ if (previewType === "image" && file.url) {
1615
+ return /* @__PURE__ */ jsxs7("button", {
1616
+ type: "button",
1617
+ onClick,
1618
+ disabled: !isClickable,
1619
+ className: cardBase,
1620
+ children: [
1621
+ /* @__PURE__ */ jsx12("img", {
1622
+ src: file.url,
1623
+ alt: file.name,
1624
+ className: "w-full h-full object-cover"
1625
+ }),
1626
+ /* @__PURE__ */ jsx12(ExtBadge, {
1627
+ ext
1628
+ }),
1629
+ isClickable && /* @__PURE__ */ jsx12("div", {
1630
+ className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/30 transition-colors",
1631
+ children: /* @__PURE__ */ jsx12(Search, {
1632
+ className: "h-5 w-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"
1633
+ })
1634
+ })
1635
+ ]
1636
+ });
1637
+ }
1638
+ if (previewType === "pdf" && file.url) {
1639
+ return /* @__PURE__ */ jsxs7("button", {
1640
+ type: "button",
1641
+ onClick,
1642
+ disabled: !isClickable,
1643
+ className: cardBase,
1644
+ children: [
1645
+ /* @__PURE__ */ jsx12("div", {
1646
+ className: "w-full h-full overflow-hidden pointer-events-none",
1647
+ children: /* @__PURE__ */ jsx12("object", {
1648
+ data: `${file.url}#page=1&view=FitH`,
1649
+ type: "application/pdf",
1650
+ className: "w-[200%] h-[200%] origin-top-left scale-50",
1651
+ "aria-label": file.name,
1652
+ children: /* @__PURE__ */ jsx12("div", {
1653
+ className: "flex items-center justify-center w-full h-full",
1654
+ children: /* @__PURE__ */ jsx12(FileIcon, {
1655
+ className: "h-8 w-8 text-muted-foreground/40"
1656
+ })
1657
+ })
1658
+ })
1659
+ }),
1660
+ /* @__PURE__ */ jsx12(ExtBadge, {
1661
+ ext
1662
+ }),
1663
+ isClickable && /* @__PURE__ */ jsx12("div", {
1664
+ className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/10 transition-colors",
1665
+ children: /* @__PURE__ */ jsx12(Search, {
1666
+ className: "h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"
1667
+ })
1668
+ })
1669
+ ]
1670
+ });
1671
+ }
1672
+ return /* @__PURE__ */ jsxs7("button", {
1673
+ type: "button",
1674
+ onClick,
1675
+ disabled: !isClickable,
1676
+ className: cardBase,
1677
+ children: [
1678
+ /* @__PURE__ */ jsx12("div", {
1679
+ className: "flex-1 flex items-center justify-center",
1680
+ children: /* @__PURE__ */ jsx12(FileIcon, {
1681
+ className: "h-8 w-8 text-muted-foreground/40"
1682
+ })
1683
+ }),
1684
+ /* @__PURE__ */ jsxs7("div", {
1685
+ className: "w-full text-center min-w-0 px-2 pb-2 space-y-0.5",
1686
+ children: [
1687
+ /* @__PURE__ */ jsx12("p", {
1688
+ className: "text-[10px] text-foreground truncate leading-tight",
1689
+ title: file.name,
1690
+ children: file.name
1691
+ }),
1692
+ file.size != null && file.size > 0 && /* @__PURE__ */ jsx12("p", {
1693
+ className: "text-[9px] text-muted-foreground leading-tight",
1694
+ children: formatFileSize(file.size)
1695
+ })
1696
+ ]
1697
+ }),
1698
+ /* @__PURE__ */ jsx12(ExtBadge, {
1699
+ ext
1700
+ })
1701
+ ]
1702
+ });
1703
+ }
1704
+
1705
+ // src/ui/primitives/dialog.tsx
1706
+ import * as React6 from "react";
1707
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
1708
+ import { cva as cva3 } from "class-variance-authority";
1709
+ import { X } from "lucide-react";
1710
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1711
+ var Dialog = DialogPrimitive.Root;
1712
+ var DialogPortal = DialogPrimitive.Portal;
1713
+ var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(DialogPrimitive.Overlay, {
1714
+ ref,
1715
+ className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
1716
+ ...props
1717
+ }));
1718
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1719
+ var dialogContentVariants = cva3("fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%] gap-4 border shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", {
1720
+ variants: {
1721
+ variant: {
1722
+ default: "w-full max-w-lg bg-background p-6",
1723
+ lightbox: "max-w-[90vw] max-h-[90vh] bg-background/95 backdrop-blur-sm p-2"
1724
+ }
1725
+ },
1726
+ defaultVariants: {
1727
+ variant: "default"
1728
+ }
1729
+ });
1730
+ var DialogContent = React6.forwardRef(({ className, variant, children, ...props }, ref) => /* @__PURE__ */ jsxs8(DialogPortal, {
1731
+ children: [
1732
+ /* @__PURE__ */ jsx13(DialogOverlay, {}),
1733
+ /* @__PURE__ */ jsxs8(DialogPrimitive.Content, {
1734
+ ref,
1735
+ className: cn(dialogContentVariants({ variant }), className),
1736
+ ...props,
1737
+ children: [
1738
+ children,
1739
+ /* @__PURE__ */ jsxs8(DialogPrimitive.Close, {
1740
+ className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
1741
+ children: [
1742
+ /* @__PURE__ */ jsx13(X, {
1743
+ className: "h-4 w-4"
1744
+ }),
1745
+ /* @__PURE__ */ jsx13("span", {
1746
+ className: "sr-only",
1747
+ children: "Close"
1748
+ })
1749
+ ]
1750
+ })
1751
+ ]
1752
+ })
1753
+ ]
1754
+ }));
1755
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
1756
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx13("div", {
1757
+ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
1758
+ ...props
1759
+ });
1760
+ DialogHeader.displayName = "DialogHeader";
1761
+ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx13("div", {
1762
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
1763
+ ...props
1764
+ });
1765
+ DialogFooter.displayName = "DialogFooter";
1766
+ var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(DialogPrimitive.Title, {
1767
+ ref,
1768
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
1769
+ ...props
1770
+ }));
1771
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
1772
+ var DialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(DialogPrimitive.Description, {
1773
+ ref,
1774
+ className: cn("text-sm text-muted-foreground", className),
1775
+ ...props
1776
+ }));
1777
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
1778
+
1779
+ // src/ui/components/file-preview-modal.tsx
1780
+ import { Download, FileIcon as FileIcon2 } from "lucide-react";
1781
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
1782
+ function FilePreviewModal({ open, onOpenChange, file }) {
1783
+ if (!file)
1784
+ return null;
1785
+ const previewType = getFilePreviewType(file.type);
1786
+ const canPreview = isPreviewable(file.type) && !!file.url;
1787
+ return /* @__PURE__ */ jsx14(Dialog, {
1788
+ open,
1789
+ onOpenChange,
1790
+ children: previewType === "image" && file.url ? /* @__PURE__ */ jsxs9(DialogContent, {
1791
+ variant: "lightbox",
1792
+ "aria-describedby": undefined,
1793
+ children: [
1794
+ /* @__PURE__ */ jsx14(DialogTitle, {
1795
+ className: "sr-only",
1796
+ children: file.name
1797
+ }),
1798
+ /* @__PURE__ */ jsx14("img", {
1799
+ src: file.url,
1800
+ alt: file.name,
1801
+ className: "max-h-[85vh] max-w-full object-contain rounded-md"
1802
+ })
1803
+ ]
1804
+ }) : previewType === "pdf" && file.url ? /* @__PURE__ */ jsxs9(DialogContent, {
1805
+ variant: "lightbox",
1806
+ className: "w-[80vw] h-[85vh]",
1807
+ "aria-describedby": undefined,
1808
+ children: [
1809
+ /* @__PURE__ */ jsx14(DialogTitle, {
1810
+ className: "sr-only",
1811
+ children: file.name
1812
+ }),
1813
+ /* @__PURE__ */ jsx14("object", {
1814
+ data: file.url,
1815
+ type: "application/pdf",
1816
+ className: "w-full h-full rounded-md",
1817
+ children: /* @__PURE__ */ jsxs9("div", {
1818
+ className: "flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",
1819
+ children: [
1820
+ /* @__PURE__ */ jsx14("p", {
1821
+ className: "text-sm",
1822
+ children: "Unable to display PDF"
1823
+ }),
1824
+ /* @__PURE__ */ jsxs9("a", {
1825
+ href: file.url,
1826
+ target: "_blank",
1827
+ rel: "noopener noreferrer",
1828
+ className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
1829
+ children: [
1830
+ /* @__PURE__ */ jsx14(Download, {
1831
+ className: "h-4 w-4"
1832
+ }),
1833
+ "Download ",
1834
+ file.name
1835
+ ]
1836
+ })
1837
+ ]
1838
+ })
1839
+ })
1840
+ ]
1841
+ }) : /* @__PURE__ */ jsxs9(DialogContent, {
1842
+ children: [
1843
+ /* @__PURE__ */ jsxs9(DialogHeader, {
1844
+ children: [
1845
+ /* @__PURE__ */ jsxs9(DialogTitle, {
1846
+ className: "flex items-center gap-2",
1847
+ children: [
1848
+ /* @__PURE__ */ jsx14(FileIcon2, {
1849
+ className: "h-5 w-5 text-muted-foreground"
1850
+ }),
1851
+ file.name
1852
+ ]
1853
+ }),
1854
+ /* @__PURE__ */ jsxs9(DialogDescription, {
1855
+ children: [
1856
+ file.size != null && file.size > 0 && /* @__PURE__ */ jsx14("span", {
1857
+ children: formatFileSize(file.size)
1858
+ }),
1859
+ !canPreview && /* @__PURE__ */ jsx14("span", {
1860
+ children: " · Preview not available for this file type"
1861
+ })
1862
+ ]
1863
+ })
1864
+ ]
1865
+ }),
1866
+ /* @__PURE__ */ jsxs9("div", {
1867
+ className: "flex flex-col items-center justify-center py-8 text-muted-foreground gap-3",
1868
+ children: [
1869
+ /* @__PURE__ */ jsx14(FileIcon2, {
1870
+ className: "h-12 w-12"
1871
+ }),
1872
+ /* @__PURE__ */ jsx14("p", {
1873
+ className: "text-sm",
1874
+ children: "Preview not available"
1875
+ }),
1876
+ file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsxs9("a", {
1877
+ href: file.url,
1878
+ target: "_blank",
1879
+ rel: "noopener noreferrer",
1880
+ className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
1881
+ children: [
1882
+ /* @__PURE__ */ jsx14(Download, {
1883
+ className: "h-4 w-4"
1884
+ }),
1885
+ "Download file"
1886
+ ]
1887
+ })
1888
+ ]
1889
+ })
1890
+ ]
1891
+ })
1892
+ });
1893
+ }
1894
+
1895
+ // src/ui/components/image-lightbox.tsx
1896
+ import { useState as useState7, useEffect as useEffect6, useCallback as useCallback6 } from "react";
1897
+ import { ChevronLeft, ChevronRight } from "lucide-react";
1898
+ import { jsx as jsx15, jsxs as jsxs10, Fragment as Fragment2 } from "react/jsx-runtime";
1899
+ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
1900
+ const [currentIndex, setCurrentIndex] = useState7(initialIndex);
1901
+ const hasMultiple = images.length > 1;
1902
+ useEffect6(() => {
1903
+ if (open)
1904
+ setCurrentIndex(initialIndex);
1905
+ }, [open, initialIndex]);
1906
+ const goNext = useCallback6(() => {
1907
+ setCurrentIndex((i) => (i + 1) % images.length);
1908
+ }, [images.length]);
1909
+ const goPrev = useCallback6(() => {
1910
+ setCurrentIndex((i) => (i - 1 + images.length) % images.length);
1911
+ }, [images.length]);
1912
+ useEffect6(() => {
1913
+ if (!open || !hasMultiple)
1914
+ return;
1915
+ const handler = (e) => {
1916
+ if (e.key === "ArrowRight")
1917
+ goNext();
1918
+ if (e.key === "ArrowLeft")
1919
+ goPrev();
1920
+ };
1921
+ window.addEventListener("keydown", handler);
1922
+ return () => window.removeEventListener("keydown", handler);
1923
+ }, [open, hasMultiple, goNext, goPrev]);
1924
+ if (images.length === 0)
1925
+ return null;
1926
+ const current = images[currentIndex];
1927
+ if (!current)
1928
+ return null;
1929
+ return /* @__PURE__ */ jsx15(Dialog, {
1930
+ open,
1931
+ onOpenChange,
1932
+ children: /* @__PURE__ */ jsxs10(DialogContent, {
1933
+ variant: "lightbox",
1934
+ "aria-describedby": undefined,
1935
+ children: [
1936
+ /* @__PURE__ */ jsx15(DialogTitle, {
1937
+ className: "sr-only",
1938
+ children: current.alt || `Image ${currentIndex + 1} of ${images.length}`
1939
+ }),
1940
+ /* @__PURE__ */ jsxs10("div", {
1941
+ className: "relative flex items-center justify-center",
1942
+ children: [
1943
+ /* @__PURE__ */ jsx15("img", {
1944
+ src: current.url,
1945
+ alt: current.alt || "Image preview",
1946
+ className: "max-h-[85vh] max-w-full object-contain rounded-md"
1947
+ }),
1948
+ hasMultiple && /* @__PURE__ */ jsxs10(Fragment2, {
1949
+ children: [
1950
+ /* @__PURE__ */ jsxs10("button", {
1951
+ type: "button",
1952
+ onClick: goPrev,
1953
+ className: cn("absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
1954
+ children: [
1955
+ /* @__PURE__ */ jsx15(ChevronLeft, {
1956
+ className: "h-5 w-5"
1957
+ }),
1958
+ /* @__PURE__ */ jsx15("span", {
1959
+ className: "sr-only",
1960
+ children: "Previous image"
1961
+ })
1962
+ ]
1963
+ }),
1964
+ /* @__PURE__ */ jsxs10("button", {
1965
+ type: "button",
1966
+ onClick: goNext,
1967
+ className: cn("absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
1968
+ children: [
1969
+ /* @__PURE__ */ jsx15(ChevronRight, {
1970
+ className: "h-5 w-5"
1971
+ }),
1972
+ /* @__PURE__ */ jsx15("span", {
1973
+ className: "sr-only",
1974
+ children: "Next image"
1975
+ })
1976
+ ]
1977
+ }),
1978
+ /* @__PURE__ */ jsxs10("div", {
1979
+ className: "absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-xs text-white",
1980
+ children: [
1981
+ currentIndex + 1,
1982
+ " / ",
1983
+ images.length
1984
+ ]
1985
+ })
1986
+ ]
1987
+ })
1988
+ ]
1989
+ })
1990
+ ]
1991
+ })
1992
+ });
1993
+ }
1994
+
1995
+ // src/ui/composed/agno-message/context.ts
1996
+ import { createContext as createContext4, useContext as useContext4 } from "react";
1997
+ var AgnoMessageContext = createContext4(null);
1998
+ function useAgnoMessageContext() {
1999
+ const ctx = useContext4(AgnoMessageContext);
2000
+ if (!ctx) {
2001
+ throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
2002
+ }
2003
+ return ctx;
2004
+ }
2005
+
2006
+ // src/ui/composed/agno-message/reasoning.tsx
2007
+ import { Lightbulb } from "lucide-react";
2008
+
2009
+ // src/ui/primitives/accordion.tsx
2010
+ import * as React7 from "react";
2011
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
2012
+ import { ChevronDown } from "lucide-react";
2013
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2014
+ var Accordion = AccordionPrimitive.Root;
2015
+ var AccordionItem = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(AccordionPrimitive.Item, {
2016
+ ref,
2017
+ className: cn("border-b", className),
2018
+ ...props
2019
+ }));
2020
+ AccordionItem.displayName = "AccordionItem";
2021
+ var AccordionTrigger = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx16(AccordionPrimitive.Header, {
2022
+ className: "flex",
2023
+ children: /* @__PURE__ */ jsxs11(AccordionPrimitive.Trigger, {
2024
+ ref,
2025
+ className: cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180", className),
2026
+ ...props,
2027
+ children: [
2028
+ children,
2029
+ /* @__PURE__ */ jsx16(ChevronDown, {
2030
+ className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
2031
+ })
2032
+ ]
2033
+ })
2034
+ }));
2035
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
2036
+ var AccordionContent = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx16(AccordionPrimitive.Content, {
2037
+ ref,
2038
+ className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
2039
+ ...props,
2040
+ children: /* @__PURE__ */ jsx16("div", {
2041
+ className: cn("pb-4 pt-0", className),
2042
+ children
2043
+ })
2044
+ }));
2045
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
2046
+
2047
+ // src/ui/composed/agno-message/reasoning.tsx
2048
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2049
+ function AgnoMessageReasoning() {
2050
+ const { message, classNames } = useAgnoMessageContext();
2051
+ const steps = message.extra_data?.reasoning_steps;
2052
+ if (!steps || steps.length === 0)
2053
+ return null;
2054
+ return /* @__PURE__ */ jsxs12("div", {
2055
+ className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
2056
+ children: [
2057
+ /* @__PURE__ */ jsxs12("div", {
2058
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2059
+ children: [
2060
+ /* @__PURE__ */ jsx17(Lightbulb, {
2061
+ className: "h-3.5 w-3.5"
2062
+ }),
2063
+ "Reasoning (",
2064
+ steps.length,
2065
+ " steps)"
2066
+ ]
2067
+ }),
2068
+ /* @__PURE__ */ jsx17(Accordion, {
2069
+ type: "multiple",
2070
+ className: "w-full",
2071
+ children: steps.map((step, idx) => /* @__PURE__ */ jsxs12(AccordionItem, {
2072
+ value: `reasoning-${idx}`,
2073
+ className: "border-muted",
2074
+ children: [
2075
+ /* @__PURE__ */ jsx17(AccordionTrigger, {
2076
+ className: "text-xs py-1.5 hover:no-underline",
2077
+ children: step.title || `Step ${idx + 1}`
2078
+ }),
2079
+ /* @__PURE__ */ jsxs12(AccordionContent, {
2080
+ className: "space-y-1.5 text-xs text-muted-foreground",
2081
+ children: [
2082
+ step.action && /* @__PURE__ */ jsxs12("div", {
2083
+ children: [
2084
+ /* @__PURE__ */ jsx17("span", {
2085
+ className: "font-medium text-foreground",
2086
+ children: "Action:"
2087
+ }),
2088
+ " ",
2089
+ step.action
2090
+ ]
2091
+ }),
2092
+ step.reasoning && /* @__PURE__ */ jsxs12("div", {
2093
+ children: [
2094
+ /* @__PURE__ */ jsx17("span", {
2095
+ className: "font-medium text-foreground",
2096
+ children: "Reasoning:"
2097
+ }),
2098
+ " ",
2099
+ step.reasoning
2100
+ ]
2101
+ }),
2102
+ step.result && /* @__PURE__ */ jsxs12("div", {
2103
+ children: [
2104
+ /* @__PURE__ */ jsx17("span", {
2105
+ className: "font-medium text-foreground",
2106
+ children: "Result:"
2107
+ }),
2108
+ " ",
2109
+ step.result
2110
+ ]
2111
+ }),
2112
+ step.confidence !== undefined && /* @__PURE__ */ jsxs12("div", {
2113
+ children: [
2114
+ /* @__PURE__ */ jsx17("span", {
2115
+ className: "font-medium text-foreground",
2116
+ children: "Confidence:"
2117
+ }),
2118
+ " ",
2119
+ (step.confidence * 100).toFixed(1),
2120
+ "%"
2121
+ ]
2122
+ })
2123
+ ]
2124
+ })
2125
+ ]
2126
+ }, idx))
2127
+ })
2128
+ ]
2129
+ });
2130
+ }
2131
+
2132
+ // src/ui/composed/agno-message/media.tsx
2133
+ import { FileIcon as FileIcon3, Image as ImageIcon, Music, Paperclip, Video } from "lucide-react";
2134
+ import { jsx as jsx18, jsxs as jsxs13, Fragment as Fragment3 } from "react/jsx-runtime";
2135
+ function AgnoMessageMedia() {
2136
+ const {
2137
+ message,
2138
+ classNames,
2139
+ showImageLightbox,
2140
+ showFilePreview,
2141
+ openImageLightbox,
2142
+ openFilePreview
2143
+ } = useAgnoMessageContext();
2144
+ const mediaClassName = classNames?.assistant?.media;
2145
+ const hasImages = !!message.images && message.images.length > 0;
2146
+ const hasVideos = !!message.videos && message.videos.length > 0;
2147
+ const hasAudio = !!message.audio && message.audio.length > 0;
2148
+ const hasFiles = !!message.files && message.files.length > 0;
2149
+ const hasResponseAudio = !!message.response_audio;
2150
+ if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
2151
+ return null;
2152
+ return /* @__PURE__ */ jsxs13(Fragment3, {
2153
+ children: [
2154
+ hasImages && /* @__PURE__ */ jsxs13("div", {
2155
+ className: cn("space-y-2 pt-1", mediaClassName),
2156
+ children: [
2157
+ /* @__PURE__ */ jsxs13("div", {
2158
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2159
+ children: [
2160
+ /* @__PURE__ */ jsx18(ImageIcon, {
2161
+ className: "h-3.5 w-3.5"
2162
+ }),
2163
+ "Images (",
2164
+ message.images.length,
2165
+ ")"
2166
+ ]
2167
+ }),
2168
+ /* @__PURE__ */ jsx18("div", {
2169
+ className: "grid grid-cols-2 gap-2",
2170
+ children: message.images.map((img, idx) => /* @__PURE__ */ jsxs13("div", {
2171
+ className: "space-y-1",
2172
+ children: [
2173
+ showImageLightbox ? /* @__PURE__ */ jsx18("button", {
2174
+ type: "button",
2175
+ onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
2176
+ 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",
2177
+ children: /* @__PURE__ */ jsx18("img", {
2178
+ src: img.url,
2179
+ alt: img.revised_prompt || "Generated image",
2180
+ className: "w-full rounded-lg"
2181
+ })
2182
+ }) : /* @__PURE__ */ jsx18("img", {
2183
+ src: img.url,
2184
+ alt: img.revised_prompt || "Generated image",
2185
+ className: "w-full rounded-lg border border-border"
2186
+ }),
2187
+ img.revised_prompt && /* @__PURE__ */ jsx18("p", {
2188
+ className: "text-[11px] text-muted-foreground italic px-0.5",
2189
+ children: img.revised_prompt
2190
+ })
2191
+ ]
2192
+ }, idx))
2193
+ })
2194
+ ]
2195
+ }),
2196
+ hasVideos && /* @__PURE__ */ jsxs13("div", {
2197
+ className: cn("space-y-2 pt-1", mediaClassName),
2198
+ children: [
2199
+ /* @__PURE__ */ jsxs13("div", {
2200
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2201
+ children: [
2202
+ /* @__PURE__ */ jsx18(Video, {
2203
+ className: "h-3.5 w-3.5"
2204
+ }),
2205
+ "Videos (",
2206
+ message.videos.length,
2207
+ ")"
2208
+ ]
2209
+ }),
2210
+ /* @__PURE__ */ jsx18("div", {
2211
+ className: "space-y-2",
2212
+ children: message.videos.map((video, idx) => /* @__PURE__ */ jsx18("div", {
2213
+ children: video.url ? /* @__PURE__ */ jsx18("video", {
2214
+ src: video.url,
2215
+ controls: true,
2216
+ className: "w-full rounded-lg border border-border"
2217
+ }) : /* @__PURE__ */ jsxs13("div", {
2218
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2219
+ children: [
2220
+ "Video ID: ",
2221
+ video.id,
2222
+ " (ETA: ",
2223
+ video.eta,
2224
+ "s)"
2225
+ ]
2226
+ })
2227
+ }, idx))
2228
+ })
2229
+ ]
2230
+ }),
2231
+ hasAudio && /* @__PURE__ */ jsxs13("div", {
2232
+ className: cn("space-y-2 pt-1", mediaClassName),
2233
+ children: [
2234
+ /* @__PURE__ */ jsxs13("div", {
2235
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2236
+ children: [
2237
+ /* @__PURE__ */ jsx18(Music, {
2238
+ className: "h-3.5 w-3.5"
2239
+ }),
2240
+ "Audio (",
2241
+ message.audio.length,
2242
+ ")"
2243
+ ]
2244
+ }),
2245
+ /* @__PURE__ */ jsx18("div", {
2246
+ className: "space-y-2",
2247
+ children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx18("div", {
2248
+ children: audio.url ? /* @__PURE__ */ jsx18("audio", {
2249
+ src: audio.url,
2250
+ controls: true,
2251
+ className: "w-full"
2252
+ }) : audio.base64_audio ? /* @__PURE__ */ jsx18("audio", {
2253
+ src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
2254
+ controls: true,
2255
+ className: "w-full"
2256
+ }) : /* @__PURE__ */ jsx18("div", {
2257
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2258
+ children: "Audio data unavailable"
2259
+ })
2260
+ }, idx))
2261
+ })
2262
+ ]
2263
+ }),
2264
+ hasFiles && /* @__PURE__ */ jsxs13("div", {
2265
+ className: cn("space-y-2 pt-1", mediaClassName),
2266
+ children: [
2267
+ /* @__PURE__ */ jsxs13("div", {
2268
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2269
+ children: [
2270
+ /* @__PURE__ */ jsx18(Paperclip, {
2271
+ className: "h-3.5 w-3.5"
2272
+ }),
2273
+ "Files (",
2274
+ message.files.length,
2275
+ ")"
2276
+ ]
2277
+ }),
2278
+ /* @__PURE__ */ jsx18("div", {
2279
+ className: "flex flex-wrap gap-2",
2280
+ children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx18(FilePreviewCard, {
2281
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
2282
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2283
+ }, idx) : /* @__PURE__ */ jsxs13("div", {
2284
+ 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",
2285
+ children: [
2286
+ /* @__PURE__ */ jsx18(FileIcon3, {
2287
+ className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
2288
+ }),
2289
+ /* @__PURE__ */ jsx18("span", {
2290
+ className: "truncate max-w-[180px]",
2291
+ children: file.name
2292
+ }),
2293
+ file.size && /* @__PURE__ */ jsxs13("span", {
2294
+ className: "text-muted-foreground/70",
2295
+ children: [
2296
+ "(",
2297
+ (file.size / 1024).toFixed(1),
2298
+ "KB)"
2299
+ ]
2300
+ }),
2301
+ file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx18("a", {
2302
+ href: file.url,
2303
+ target: "_blank",
2304
+ rel: "noopener noreferrer",
2305
+ className: "text-primary hover:underline font-medium",
2306
+ children: "View"
2307
+ })
2308
+ ]
2309
+ }, idx))
2310
+ })
2311
+ ]
2312
+ }),
2313
+ hasResponseAudio && message.response_audio && /* @__PURE__ */ jsxs13("div", {
2314
+ className: cn("space-y-2 pt-1", mediaClassName),
2315
+ children: [
2316
+ /* @__PURE__ */ jsxs13("div", {
2317
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2318
+ children: [
2319
+ /* @__PURE__ */ jsx18(Music, {
2320
+ className: "h-3.5 w-3.5"
2321
+ }),
2322
+ "Response Audio"
2323
+ ]
2324
+ }),
2325
+ message.response_audio.transcript && /* @__PURE__ */ jsxs13("div", {
2326
+ className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
2327
+ children: [
2328
+ '"',
2329
+ message.response_audio.transcript,
2330
+ '"'
2331
+ ]
2332
+ }),
2333
+ message.response_audio.content && /* @__PURE__ */ jsx18("audio", {
2334
+ src: `data:audio/wav;base64,${message.response_audio.content}`,
2335
+ controls: true,
2336
+ className: "w-full"
2337
+ })
2338
+ ]
2339
+ })
2340
+ ]
2341
+ });
2342
+ }
2343
+
2344
+ // src/ui/composed/agno-chat/context.ts
2345
+ import { createContext as createContext5, useContext as useContext5 } from "react";
2346
+ var AgnoChatContext = createContext5(null);
2347
+ function useAgnoChatContext() {
2348
+ const ctx = useContext5(AgnoChatContext);
2349
+ if (!ctx) {
2350
+ throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
2351
+ }
2352
+ return ctx;
2353
+ }
2354
+
2355
+ // src/ui/composed/agno-message/tools.tsx
2356
+ import { jsx as jsx19, jsxs as jsxs14, Fragment as Fragment4 } from "react/jsx-runtime";
2357
+ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
2358
+ const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
2359
+ const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
2360
+ const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
2361
+ if (!message.tool_calls || message.tool_calls.length === 0)
2362
+ return null;
2363
+ return /* @__PURE__ */ jsx19("div", {
2364
+ className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
2365
+ children: message.tool_calls.map((tool, idx) => {
2366
+ const defaultRender = () => /* @__PURE__ */ jsxs14(Fragment4, {
2367
+ children: [
2368
+ /* @__PURE__ */ jsx19(ToolGenerativeUI, {
2369
+ tool
2370
+ }),
2371
+ isDebug ? /* @__PURE__ */ jsx19(ToolDebugCard, {
2372
+ tool,
2373
+ defaultOpen: idx === 0
2374
+ }) : null
2375
+ ]
2376
+ });
2377
+ const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
2378
+ if (node === null || node === undefined)
2379
+ return null;
2380
+ return /* @__PURE__ */ jsx19("div", {
2381
+ children: node
2382
+ }, tool.tool_call_id || idx);
2383
+ })
2384
+ });
2385
+ }
2386
+
2387
+ // src/ui/components/response.tsx
2388
+ import { memo } from "react";
2389
+ import { Streamdown } from "streamdown";
2390
+ import { jsx as jsx20 } from "react/jsx-runtime";
2391
+ var Response = memo(({ className, ...props }) => /* @__PURE__ */ jsx20(Streamdown, {
2392
+ className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
2393
+ ...props
2394
+ }), (prevProps, nextProps) => prevProps.children === nextProps.children);
2395
+ Response.displayName = "Response";
2396
+
2397
+ // src/ui/composed/agno-message/content.tsx
2398
+ import { jsx as jsx21 } from "react/jsx-runtime";
2399
+ function AgnoMessageContent() {
2400
+ const { message } = useAgnoMessageContext();
2401
+ if (!message.content)
2402
+ return null;
2403
+ return /* @__PURE__ */ jsx21("div", {
2404
+ 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",
2405
+ children: /* @__PURE__ */ jsx21(Response, {
2406
+ children: message.content
2407
+ })
2408
+ });
2409
+ }
2410
+
2411
+ // src/ui/composed/agno-message/references.tsx
2412
+ import { FileText } from "lucide-react";
2413
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
2414
+ function AgnoMessageReferences() {
2415
+ const { message, classNames } = useAgnoMessageContext();
2416
+ const references = message.extra_data?.references;
2417
+ if (!references || references.length === 0)
2418
+ return null;
2419
+ return /* @__PURE__ */ jsxs15("div", {
2420
+ className: cn("space-y-2 pt-1", classNames?.assistant?.references),
2421
+ children: [
2422
+ /* @__PURE__ */ jsxs15("div", {
2423
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2424
+ children: [
2425
+ /* @__PURE__ */ jsx22(FileText, {
2426
+ className: "h-3.5 w-3.5"
2427
+ }),
2428
+ "References (",
2429
+ references.length,
2430
+ ")"
2431
+ ]
2432
+ }),
2433
+ /* @__PURE__ */ jsx22("div", {
2434
+ className: "space-y-2",
2435
+ children: references.map((refData, idx) => /* @__PURE__ */ jsxs15("div", {
2436
+ className: "text-xs space-y-1.5",
2437
+ children: [
2438
+ refData.query && /* @__PURE__ */ jsxs15("div", {
2439
+ className: "font-medium text-foreground",
2440
+ children: [
2441
+ "Query: ",
2442
+ refData.query
2443
+ ]
2444
+ }),
2445
+ refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs15("div", {
2446
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg",
2447
+ children: [
2448
+ /* @__PURE__ */ jsxs15("div", {
2449
+ className: "italic text-muted-foreground mb-1",
2450
+ children: [
2451
+ '"',
2452
+ ref.content,
2453
+ '"'
2454
+ ]
2455
+ }),
2456
+ /* @__PURE__ */ jsxs15("div", {
2457
+ className: "text-muted-foreground/70",
2458
+ children: [
2459
+ "Source: ",
2460
+ ref.name,
2461
+ " (chunk ",
2462
+ ref.meta_data.chunk,
2463
+ "/",
2464
+ ref.meta_data.chunk_size,
2465
+ ")"
2466
+ ]
2467
+ })
2468
+ ]
2469
+ }, refIdx))
2470
+ ]
2471
+ }, idx))
2472
+ })
2473
+ ]
2474
+ });
2475
+ }
2476
+
2477
+ // src/ui/composed/agno-message/footer.tsx
2478
+ import { AlertCircle } from "lucide-react";
2479
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
2480
+ function AgnoMessageFooter({ showTimestamp = true } = {}) {
2481
+ const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
2482
+ const hasError = message.streamingError;
2483
+ const isCustomTimestamp = !!formatTimestamp;
2484
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
2485
+ if (!actions?.assistant && !showTimestamp && !hasError)
2486
+ return null;
2487
+ return /* @__PURE__ */ jsxs16("div", {
2488
+ className: "flex items-center gap-2 pt-1",
2489
+ children: [
2490
+ actions?.assistant && (() => {
2491
+ const visibility = actions.visibility ?? "visible";
2492
+ if (visibility === "last-assistant" && !isLastAssistantMessage)
2493
+ return null;
2494
+ const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
2495
+ return /* @__PURE__ */ jsx23("div", {
2496
+ className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
2497
+ children: actions.assistant(message)
2498
+ });
2499
+ })(),
2500
+ hasError && /* @__PURE__ */ jsxs16("span", {
2501
+ className: "flex items-center gap-1 text-[11px] text-destructive",
2502
+ children: [
2503
+ /* @__PURE__ */ jsx23(AlertCircle, {
2504
+ className: "h-3 w-3"
2505
+ }),
2506
+ "Error"
2507
+ ]
2508
+ }),
2509
+ showTimestamp && /* @__PURE__ */ jsx23(SmartTimestamp, {
2510
+ date: new Date(message.created_at * 1000),
2511
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
2512
+ className: "text-[11px] text-muted-foreground"
2513
+ })
2514
+ ]
2515
+ });
2516
+ }
2517
+
2518
+ // src/ui/composed/agno-message/message.tsx
2519
+ import { jsx as jsx24, jsxs as jsxs17, Fragment as Fragment5 } from "react/jsx-runtime";
2520
+ function DefaultAssistantComposition({ showTimestamp }) {
2521
+ return /* @__PURE__ */ jsxs17(Fragment5, {
2522
+ children: [
2523
+ /* @__PURE__ */ jsx24(AgnoMessageReasoning, {}),
2524
+ /* @__PURE__ */ jsx24(AgnoMessageMedia, {}),
2525
+ /* @__PURE__ */ jsx24(AgnoMessageTools, {}),
2526
+ /* @__PURE__ */ jsx24(AgnoMessageContent, {}),
2527
+ /* @__PURE__ */ jsx24(AgnoMessageReferences, {}),
2528
+ /* @__PURE__ */ jsx24(AgnoMessageFooter, {
2529
+ showTimestamp
2530
+ })
2531
+ ]
2532
+ });
2533
+ }
2534
+ function AgnoMessage({
2535
+ message,
2536
+ className,
2537
+ classNames,
2538
+ avatars,
2539
+ actions,
2540
+ isLastAssistantMessage = false,
2541
+ showFilePreview = true,
2542
+ showImageLightbox = true,
2543
+ showTimestamp = true,
2544
+ formatTimestamp,
2545
+ renderTool,
2546
+ children
2547
+ }) {
2548
+ const isUser = message.role === "user";
2549
+ const hasError = message.streamingError;
2550
+ const [preview, setPreview] = useState8(null);
2551
+ const isCustomTimestamp = !!formatTimestamp;
2552
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
2553
+ const ctx = useMemo3(() => ({
2554
+ message,
2555
+ isLastAssistantMessage,
2556
+ classNames,
2557
+ actions,
2558
+ avatars,
2559
+ formatTimestamp,
2560
+ showFilePreview,
2561
+ showImageLightbox,
2562
+ openImageLightbox: (images, index) => {
2563
+ if (!showImageLightbox)
2564
+ return;
2565
+ setPreview({ type: "image", images, initialIndex: index });
2566
+ },
2567
+ openFilePreview: (file) => {
2568
+ if (!showFilePreview)
2569
+ return;
2570
+ setPreview({ type: "file", file });
2571
+ },
2572
+ renderTool
2573
+ }), [
2574
+ message,
2575
+ isLastAssistantMessage,
2576
+ classNames,
2577
+ actions,
2578
+ avatars,
2579
+ formatTimestamp,
2580
+ showFilePreview,
2581
+ showImageLightbox,
2582
+ renderTool
2583
+ ]);
2584
+ const closePreview = () => setPreview(null);
2585
+ return /* @__PURE__ */ jsx24(AgnoMessageContext.Provider, {
2586
+ value: ctx,
2587
+ children: /* @__PURE__ */ jsxs17("div", {
2588
+ className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
2589
+ children: [
2590
+ isUser ? /* @__PURE__ */ jsx24(UserMessageLayout, {
2591
+ message,
2592
+ classNames,
2593
+ avatars,
2594
+ actions,
2595
+ isCustomTimestamp,
2596
+ resolvedFormatTimestamp,
2597
+ showTimestamp,
2598
+ showImageLightbox,
2599
+ showFilePreview,
2600
+ openImageLightbox: ctx.openImageLightbox,
2601
+ openFilePreview: ctx.openFilePreview,
2602
+ hasError
2603
+ }) : /* @__PURE__ */ jsxs17("div", {
2604
+ className: "flex items-start gap-3 group/message",
2605
+ children: [
2606
+ avatars?.assistant,
2607
+ /* @__PURE__ */ jsx24("div", {
2608
+ className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
2609
+ children: children ?? /* @__PURE__ */ jsx24(DefaultAssistantComposition, {
2610
+ showTimestamp
2611
+ })
2612
+ })
2613
+ ]
2614
+ }),
2615
+ preview?.type === "image" && /* @__PURE__ */ jsx24(ImageLightbox, {
2616
+ open: true,
2617
+ onOpenChange: (open) => {
2618
+ if (!open)
2619
+ closePreview();
2620
+ },
2621
+ images: preview.images,
2622
+ initialIndex: preview.initialIndex
2623
+ }),
2624
+ preview?.type === "file" && /* @__PURE__ */ jsx24(FilePreviewModal, {
2625
+ open: true,
2626
+ onOpenChange: (open) => {
2627
+ if (!open)
2628
+ closePreview();
2629
+ },
2630
+ file: preview.file
2631
+ })
2632
+ ]
2633
+ })
2634
+ });
2635
+ }
2636
+ AgnoMessage.Reasoning = AgnoMessageReasoning;
2637
+ AgnoMessage.Media = AgnoMessageMedia;
2638
+ AgnoMessage.Tools = AgnoMessageTools;
2639
+ AgnoMessage.Content = AgnoMessageContent;
2640
+ AgnoMessage.References = AgnoMessageReferences;
2641
+ AgnoMessage.Footer = AgnoMessageFooter;
2642
+ function UserMessageLayout({
2643
+ message,
2644
+ classNames,
2645
+ avatars,
2646
+ actions,
2647
+ isCustomTimestamp,
2648
+ resolvedFormatTimestamp,
2649
+ showTimestamp,
2650
+ showImageLightbox,
2651
+ showFilePreview,
2652
+ openImageLightbox,
2653
+ openFilePreview,
2654
+ hasError
2655
+ }) {
2656
+ return /* @__PURE__ */ jsxs17("div", {
2657
+ className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
2658
+ children: [
2659
+ avatars?.user,
2660
+ /* @__PURE__ */ jsxs17("div", {
2661
+ className: "space-y-1.5 flex flex-col items-end min-w-0",
2662
+ children: [
2663
+ (message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsxs17("div", {
2664
+ className: "flex flex-wrap gap-2 justify-end",
2665
+ children: [
2666
+ message.images?.map((img, idx) => /* @__PURE__ */ jsx24(FilePreviewCard, {
2667
+ file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
2668
+ onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
2669
+ }, `img-${idx}`)),
2670
+ message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs17("div", {
2671
+ 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",
2672
+ children: [
2673
+ /* @__PURE__ */ jsx24(Music2, {
2674
+ className: "h-3.5 w-3.5 text-muted-foreground"
2675
+ }),
2676
+ /* @__PURE__ */ jsx24("span", {
2677
+ className: "truncate max-w-[150px]",
2678
+ children: audio.id || `Audio ${idx + 1}`
2679
+ })
2680
+ ]
2681
+ }, `audio-${idx}`)),
2682
+ message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx24(FilePreviewCard, {
2683
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
2684
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2685
+ }, `file-${idx}`) : /* @__PURE__ */ jsxs17("div", {
2686
+ 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",
2687
+ children: [
2688
+ /* @__PURE__ */ jsx24(FileIcon4, {
2689
+ className: "h-3.5 w-3.5 text-muted-foreground"
2690
+ }),
2691
+ /* @__PURE__ */ jsx24("span", {
2692
+ className: "truncate max-w-[150px]",
2693
+ children: file.name
2694
+ })
2695
+ ]
2696
+ }, `file-${idx}`))
2697
+ ]
2698
+ }),
2699
+ message.content && /* @__PURE__ */ jsx24("div", {
2700
+ className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
2701
+ children: /* @__PURE__ */ jsx24("p", {
2702
+ className: "text-sm whitespace-pre-wrap",
2703
+ children: message.content
2704
+ })
2705
+ }),
2706
+ (showTimestamp || actions?.user) && /* @__PURE__ */ jsxs17("div", {
2707
+ className: "flex items-center justify-end gap-1.5 px-1",
2708
+ children: [
2709
+ actions?.user && /* @__PURE__ */ jsx24("div", {
2710
+ className: "flex items-center gap-1",
2711
+ children: actions.user(message)
2712
+ }),
2713
+ /* @__PURE__ */ jsx24(SmartTimestamp, {
2714
+ date: new Date(message.created_at * 1000),
2715
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
2716
+ className: "text-[11px] text-muted-foreground"
2717
+ }),
2718
+ hasError && /* @__PURE__ */ jsx24(AlertCircle2, {
2719
+ className: "h-3 w-3 text-destructive"
2720
+ })
2721
+ ]
2722
+ })
2723
+ ]
2724
+ })
2725
+ ]
2726
+ });
2727
+ }
1068
2728
  // src/hooks/useAgnoCustomEvents.ts
1069
- import { useState as useState6, useEffect as useEffect5, useCallback as useCallback6, useRef } from "react";
2729
+ import { useState as useState9, useEffect as useEffect7, useCallback as useCallback7, useRef as useRef2 } from "react";
1070
2730
  function useAgnoCustomEvents(handler) {
1071
2731
  const client = useAgnoClient();
1072
- const [events, setEvents] = useState6([]);
1073
- const handlerRef = useRef(handler);
2732
+ const [events, setEvents] = useState9([]);
2733
+ const handlerRef = useRef2(handler);
1074
2734
  handlerRef.current = handler;
1075
- useEffect5(() => {
2735
+ useEffect7(() => {
1076
2736
  const handleCustomEvent = (event) => {
1077
2737
  setEvents((prev) => [...prev, event]);
1078
2738
  handlerRef.current?.(event);
@@ -1082,20 +2742,20 @@ function useAgnoCustomEvents(handler) {
1082
2742
  client.off("custom:event", handleCustomEvent);
1083
2743
  };
1084
2744
  }, [client]);
1085
- const clearEvents = useCallback6(() => {
2745
+ const clearEvents = useCallback7(() => {
1086
2746
  setEvents([]);
1087
2747
  }, []);
1088
2748
  return { events, clearEvents };
1089
2749
  }
1090
2750
  // src/hooks/useAgnoMemory.ts
1091
- import { useState as useState7, useEffect as useEffect6, useCallback as useCallback7 } from "react";
2751
+ import { useState as useState10, useEffect as useEffect8, useCallback as useCallback8 } from "react";
1092
2752
  function useAgnoMemory() {
1093
2753
  const client = useAgnoClient();
1094
- const [memories, setMemories] = useState7([]);
1095
- const [topics, setTopics] = useState7([]);
1096
- const [isLoading, setIsLoading] = useState7(false);
1097
- const [error, setError] = useState7();
1098
- useEffect6(() => {
2754
+ const [memories, setMemories] = useState10([]);
2755
+ const [topics, setTopics] = useState10([]);
2756
+ const [isLoading, setIsLoading] = useState10(false);
2757
+ const [error, setError] = useState10();
2758
+ useEffect8(() => {
1099
2759
  const handleMemoryCreated = (memory) => {
1100
2760
  setMemories((prev) => [memory, ...prev]);
1101
2761
  };
@@ -1130,7 +2790,7 @@ function useAgnoMemory() {
1130
2790
  client.off("state:change", handleStateChange);
1131
2791
  };
1132
2792
  }, [client]);
1133
- const fetchMemories = useCallback7(async (queryParams, options) => {
2793
+ const fetchMemories = useCallback8(async (queryParams, options) => {
1134
2794
  setIsLoading(true);
1135
2795
  setError(undefined);
1136
2796
  try {
@@ -1145,7 +2805,7 @@ function useAgnoMemory() {
1145
2805
  setIsLoading(false);
1146
2806
  }
1147
2807
  }, [client]);
1148
- const getMemoryById = useCallback7(async (memoryId, options) => {
2808
+ const getMemoryById = useCallback8(async (memoryId, options) => {
1149
2809
  setIsLoading(true);
1150
2810
  setError(undefined);
1151
2811
  try {
@@ -1158,7 +2818,7 @@ function useAgnoMemory() {
1158
2818
  setIsLoading(false);
1159
2819
  }
1160
2820
  }, [client]);
1161
- const getMemoryTopics = useCallback7(async (options) => {
2821
+ const getMemoryTopics = useCallback8(async (options) => {
1162
2822
  setIsLoading(true);
1163
2823
  setError(undefined);
1164
2824
  try {
@@ -1173,7 +2833,7 @@ function useAgnoMemory() {
1173
2833
  setIsLoading(false);
1174
2834
  }
1175
2835
  }, [client]);
1176
- const getUserMemoryStats = useCallback7(async (queryParams, options) => {
2836
+ const getUserMemoryStats = useCallback8(async (queryParams, options) => {
1177
2837
  setIsLoading(true);
1178
2838
  setError(undefined);
1179
2839
  try {
@@ -1186,7 +2846,7 @@ function useAgnoMemory() {
1186
2846
  setIsLoading(false);
1187
2847
  }
1188
2848
  }, [client]);
1189
- const createMemory = useCallback7(async (request, options) => {
2849
+ const createMemory = useCallback8(async (request, options) => {
1190
2850
  setIsLoading(true);
1191
2851
  setError(undefined);
1192
2852
  try {
@@ -1199,7 +2859,7 @@ function useAgnoMemory() {
1199
2859
  setIsLoading(false);
1200
2860
  }
1201
2861
  }, [client]);
1202
- const updateMemory = useCallback7(async (memoryId, request, options) => {
2862
+ const updateMemory = useCallback8(async (memoryId, request, options) => {
1203
2863
  setIsLoading(true);
1204
2864
  setError(undefined);
1205
2865
  try {
@@ -1212,7 +2872,7 @@ function useAgnoMemory() {
1212
2872
  setIsLoading(false);
1213
2873
  }
1214
2874
  }, [client]);
1215
- const deleteMemory = useCallback7(async (memoryId, options) => {
2875
+ const deleteMemory = useCallback8(async (memoryId, options) => {
1216
2876
  setIsLoading(true);
1217
2877
  setError(undefined);
1218
2878
  try {
@@ -1225,7 +2885,7 @@ function useAgnoMemory() {
1225
2885
  setIsLoading(false);
1226
2886
  }
1227
2887
  }, [client]);
1228
- const deleteMultipleMemories = useCallback7(async (memoryIds, options) => {
2888
+ const deleteMultipleMemories = useCallback8(async (memoryIds, options) => {
1229
2889
  setIsLoading(true);
1230
2890
  setError(undefined);
1231
2891
  try {
@@ -1254,12 +2914,12 @@ function useAgnoMemory() {
1254
2914
  };
1255
2915
  }
1256
2916
  // src/hooks/useAgnoSessionState.ts
1257
- import { useCallback as useCallback8, useEffect as useEffect7, useState as useState8 } from "react";
2917
+ import { useCallback as useCallback9, useEffect as useEffect9, useState as useState11 } from "react";
1258
2918
  function useAgnoSessionState() {
1259
2919
  const client = useAgnoClient();
1260
- const [sessionState, setLocalSessionState] = useState8(() => client.getSessionState());
1261
- const [isRefreshing, setIsRefreshing] = useState8(() => client.getState().isSessionStateRefreshing ?? false);
1262
- useEffect7(() => {
2920
+ const [sessionState, setLocalSessionState] = useState11(() => client.getSessionState());
2921
+ const [isRefreshing, setIsRefreshing] = useState11(() => client.getState().isSessionStateRefreshing ?? false);
2922
+ useEffect9(() => {
1263
2923
  const handleStateChange = (state) => {
1264
2924
  setLocalSessionState(state);
1265
2925
  };
@@ -1276,16 +2936,16 @@ function useAgnoSessionState() {
1276
2936
  client.off("session-state:refresh:end", handleRefreshEnd);
1277
2937
  };
1278
2938
  }, [client]);
1279
- const setSessionState = useCallback8(async (next) => {
2939
+ const setSessionState = useCallback9(async (next) => {
1280
2940
  const resolved = typeof next === "function" ? next(client.getSessionState()) : next;
1281
2941
  await client.setSessionState(resolved);
1282
2942
  }, [client]);
1283
- const mergeSessionState = useCallback8(async (partial) => {
2943
+ const mergeSessionState = useCallback9(async (partial) => {
1284
2944
  const current = client.getSessionState() ?? {};
1285
2945
  const merged = { ...current, ...partial };
1286
2946
  await client.setSessionState(merged);
1287
2947
  }, [client]);
1288
- const refreshSessionState = useCallback8(async () => {
2948
+ const refreshSessionState = useCallback9(async () => {
1289
2949
  const result = await client.refreshSessionState();
1290
2950
  return result ?? null;
1291
2951
  }, [client]);
@@ -1298,14 +2958,14 @@ function useAgnoSessionState() {
1298
2958
  };
1299
2959
  }
1300
2960
  // src/hooks/useAgnoKnowledge.ts
1301
- import { useState as useState9, useCallback as useCallback9 } from "react";
2961
+ import { useState as useState12, useCallback as useCallback10 } from "react";
1302
2962
  function useAgnoKnowledge() {
1303
2963
  const client = useAgnoClient();
1304
- const [isLoading, setIsLoading] = useState9(false);
1305
- const [error, setError] = useState9();
1306
- const [config, setConfig] = useState9();
1307
- const [content, setContent] = useState9([]);
1308
- const getConfig = useCallback9(async (options) => {
2964
+ const [isLoading, setIsLoading] = useState12(false);
2965
+ const [error, setError] = useState12();
2966
+ const [config, setConfig] = useState12();
2967
+ const [content, setContent] = useState12([]);
2968
+ const getConfig = useCallback10(async (options) => {
1309
2969
  setIsLoading(true);
1310
2970
  setError(undefined);
1311
2971
  try {
@@ -1320,7 +2980,7 @@ function useAgnoKnowledge() {
1320
2980
  setIsLoading(false);
1321
2981
  }
1322
2982
  }, [client]);
1323
- const listContent = useCallback9(async (listOptions, options) => {
2983
+ const listContent = useCallback10(async (listOptions, options) => {
1324
2984
  setIsLoading(true);
1325
2985
  setError(undefined);
1326
2986
  try {
@@ -1335,7 +2995,7 @@ function useAgnoKnowledge() {
1335
2995
  setIsLoading(false);
1336
2996
  }
1337
2997
  }, [client]);
1338
- const getContent = useCallback9(async (contentId, options) => {
2998
+ const getContent = useCallback10(async (contentId, options) => {
1339
2999
  setIsLoading(true);
1340
3000
  setError(undefined);
1341
3001
  try {
@@ -1348,7 +3008,7 @@ function useAgnoKnowledge() {
1348
3008
  setIsLoading(false);
1349
3009
  }
1350
3010
  }, [client]);
1351
- const getContentStatus = useCallback9(async (contentId, options) => {
3011
+ const getContentStatus = useCallback10(async (contentId, options) => {
1352
3012
  setIsLoading(true);
1353
3013
  setError(undefined);
1354
3014
  try {
@@ -1361,7 +3021,7 @@ function useAgnoKnowledge() {
1361
3021
  setIsLoading(false);
1362
3022
  }
1363
3023
  }, [client]);
1364
- const search = useCallback9(async (request, options) => {
3024
+ const search = useCallback10(async (request, options) => {
1365
3025
  setIsLoading(true);
1366
3026
  setError(undefined);
1367
3027
  try {
@@ -1374,7 +3034,7 @@ function useAgnoKnowledge() {
1374
3034
  setIsLoading(false);
1375
3035
  }
1376
3036
  }, [client]);
1377
- const uploadContent = useCallback9(async (data, options) => {
3037
+ const uploadContent = useCallback10(async (data, options) => {
1378
3038
  setIsLoading(true);
1379
3039
  setError(undefined);
1380
3040
  try {
@@ -1389,7 +3049,7 @@ function useAgnoKnowledge() {
1389
3049
  setIsLoading(false);
1390
3050
  }
1391
3051
  }, [client]);
1392
- const updateContent = useCallback9(async (contentId, request, options) => {
3052
+ const updateContent = useCallback10(async (contentId, request, options) => {
1393
3053
  setIsLoading(true);
1394
3054
  setError(undefined);
1395
3055
  try {
@@ -1404,7 +3064,7 @@ function useAgnoKnowledge() {
1404
3064
  setIsLoading(false);
1405
3065
  }
1406
3066
  }, [client]);
1407
- const deleteAllContent = useCallback9(async (options) => {
3067
+ const deleteAllContent = useCallback10(async (options) => {
1408
3068
  setIsLoading(true);
1409
3069
  setError(undefined);
1410
3070
  try {
@@ -1418,7 +3078,7 @@ function useAgnoKnowledge() {
1418
3078
  setIsLoading(false);
1419
3079
  }
1420
3080
  }, [client]);
1421
- const deleteContent = useCallback9(async (contentId, options) => {
3081
+ const deleteContent = useCallback10(async (contentId, options) => {
1422
3082
  setIsLoading(true);
1423
3083
  setError(undefined);
1424
3084
  try {
@@ -1450,14 +3110,14 @@ function useAgnoKnowledge() {
1450
3110
  };
1451
3111
  }
1452
3112
  // src/hooks/useAgnoMetrics.ts
1453
- import { useState as useState10, useCallback as useCallback10 } from "react";
3113
+ import { useState as useState13, useCallback as useCallback11 } from "react";
1454
3114
  function useAgnoMetrics() {
1455
3115
  const client = useAgnoClient();
1456
- const [isLoading, setIsLoading] = useState10(false);
1457
- const [isRefreshing, setIsRefreshing] = useState10(false);
1458
- const [error, setError] = useState10();
1459
- const [metrics, setMetrics] = useState10();
1460
- const fetchMetrics = useCallback10(async (options) => {
3116
+ const [isLoading, setIsLoading] = useState13(false);
3117
+ const [isRefreshing, setIsRefreshing] = useState13(false);
3118
+ const [error, setError] = useState13();
3119
+ const [metrics, setMetrics] = useState13();
3120
+ const fetchMetrics = useCallback11(async (options) => {
1461
3121
  setIsLoading(true);
1462
3122
  setError(undefined);
1463
3123
  try {
@@ -1472,7 +3132,7 @@ function useAgnoMetrics() {
1472
3132
  setIsLoading(false);
1473
3133
  }
1474
3134
  }, [client]);
1475
- const refreshMetrics = useCallback10(async (options) => {
3135
+ const refreshMetrics = useCallback11(async (options) => {
1476
3136
  setIsRefreshing(true);
1477
3137
  setError(undefined);
1478
3138
  try {
@@ -1486,7 +3146,7 @@ function useAgnoMetrics() {
1486
3146
  setIsRefreshing(false);
1487
3147
  }
1488
3148
  }, [client]);
1489
- const clearMetrics = useCallback10(() => {
3149
+ const clearMetrics = useCallback11(() => {
1490
3150
  setMetrics(undefined);
1491
3151
  setError(undefined);
1492
3152
  }, []);
@@ -1501,14 +3161,14 @@ function useAgnoMetrics() {
1501
3161
  };
1502
3162
  }
1503
3163
  // src/hooks/useAgnoEvals.ts
1504
- import { useState as useState11, useCallback as useCallback11 } from "react";
3164
+ import { useState as useState14, useCallback as useCallback12 } from "react";
1505
3165
  function useAgnoEvals() {
1506
3166
  const client = useAgnoClient();
1507
- const [evalRuns, setEvalRuns] = useState11([]);
1508
- const [pagination, setPagination] = useState11();
1509
- const [isLoading, setIsLoading] = useState11(false);
1510
- const [error, setError] = useState11();
1511
- const listEvalRuns = useCallback11(async (listParams = {}, options) => {
3167
+ const [evalRuns, setEvalRuns] = useState14([]);
3168
+ const [pagination, setPagination] = useState14();
3169
+ const [isLoading, setIsLoading] = useState14(false);
3170
+ const [error, setError] = useState14();
3171
+ const listEvalRuns = useCallback12(async (listParams = {}, options) => {
1512
3172
  setIsLoading(true);
1513
3173
  setError(undefined);
1514
3174
  try {
@@ -1524,7 +3184,7 @@ function useAgnoEvals() {
1524
3184
  setIsLoading(false);
1525
3185
  }
1526
3186
  }, [client]);
1527
- const getEvalRun = useCallback11(async (evalRunId, options) => {
3187
+ const getEvalRun = useCallback12(async (evalRunId, options) => {
1528
3188
  setIsLoading(true);
1529
3189
  setError(undefined);
1530
3190
  try {
@@ -1537,7 +3197,7 @@ function useAgnoEvals() {
1537
3197
  setIsLoading(false);
1538
3198
  }
1539
3199
  }, [client]);
1540
- const executeEval = useCallback11(async (request, options) => {
3200
+ const executeEval = useCallback12(async (request, options) => {
1541
3201
  setIsLoading(true);
1542
3202
  setError(undefined);
1543
3203
  try {
@@ -1552,7 +3212,7 @@ function useAgnoEvals() {
1552
3212
  setIsLoading(false);
1553
3213
  }
1554
3214
  }, [client]);
1555
- const updateEvalRun = useCallback11(async (evalRunId, request, options) => {
3215
+ const updateEvalRun = useCallback12(async (evalRunId, request, options) => {
1556
3216
  setIsLoading(true);
1557
3217
  setError(undefined);
1558
3218
  try {
@@ -1567,7 +3227,7 @@ function useAgnoEvals() {
1567
3227
  setIsLoading(false);
1568
3228
  }
1569
3229
  }, [client]);
1570
- const deleteEvalRuns = useCallback11(async (evalRunIds, options) => {
3230
+ const deleteEvalRuns = useCallback12(async (evalRunIds, options) => {
1571
3231
  setIsLoading(true);
1572
3232
  setError(undefined);
1573
3233
  try {
@@ -1582,7 +3242,7 @@ function useAgnoEvals() {
1582
3242
  setIsLoading(false);
1583
3243
  }
1584
3244
  }, [client]);
1585
- const renameEvalRun = useCallback11(async (evalRunId, newName, options) => {
3245
+ const renameEvalRun = useCallback12(async (evalRunId, newName, options) => {
1586
3246
  return updateEvalRun(evalRunId, { name: newName }, options);
1587
3247
  }, [updateEvalRun]);
1588
3248
  return {
@@ -1599,14 +3259,14 @@ function useAgnoEvals() {
1599
3259
  };
1600
3260
  }
1601
3261
  // src/hooks/useAgnoTraces.ts
1602
- import { useState as useState12, useEffect as useEffect8, useCallback as useCallback12 } from "react";
3262
+ import { useState as useState15, useEffect as useEffect10, useCallback as useCallback13 } from "react";
1603
3263
  function useAgnoTraces() {
1604
3264
  const client = useAgnoClient();
1605
- const [traces, setTraces] = useState12([]);
1606
- const [traceSessionStats, setTraceSessionStats] = useState12([]);
1607
- const [isLoading, setIsLoading] = useState12(false);
1608
- const [error, setError] = useState12();
1609
- useEffect8(() => {
3265
+ const [traces, setTraces] = useState15([]);
3266
+ const [traceSessionStats, setTraceSessionStats] = useState15([]);
3267
+ const [isLoading, setIsLoading] = useState15(false);
3268
+ const [error, setError] = useState15();
3269
+ useEffect10(() => {
1610
3270
  const handleStateChange = () => {
1611
3271
  const state2 = client.getState();
1612
3272
  setTraces(state2.traces);
@@ -1620,7 +3280,7 @@ function useAgnoTraces() {
1620
3280
  client.off("state:change", handleStateChange);
1621
3281
  };
1622
3282
  }, [client]);
1623
- const fetchTraces = useCallback12(async (options = {}, requestOptions) => {
3283
+ const fetchTraces = useCallback13(async (options = {}, requestOptions) => {
1624
3284
  setIsLoading(true);
1625
3285
  setError(undefined);
1626
3286
  try {
@@ -1635,7 +3295,7 @@ function useAgnoTraces() {
1635
3295
  setIsLoading(false);
1636
3296
  }
1637
3297
  }, [client]);
1638
- const getTraceDetail = useCallback12(async (traceId, options = {}, requestOptions) => {
3298
+ const getTraceDetail = useCallback13(async (traceId, options = {}, requestOptions) => {
1639
3299
  setIsLoading(true);
1640
3300
  setError(undefined);
1641
3301
  try {
@@ -1648,7 +3308,7 @@ function useAgnoTraces() {
1648
3308
  setIsLoading(false);
1649
3309
  }
1650
3310
  }, [client]);
1651
- const fetchTraceSessionStats = useCallback12(async (options = {}, requestOptions) => {
3311
+ const fetchTraceSessionStats = useCallback13(async (options = {}, requestOptions) => {
1652
3312
  setIsLoading(true);
1653
3313
  setError(undefined);
1654
3314
  try {
@@ -1674,13 +3334,13 @@ function useAgnoTraces() {
1674
3334
  };
1675
3335
  }
1676
3336
  // src/hooks/useAgnoComponents.ts
1677
- import { useState as useState13, useEffect as useEffect9, useCallback as useCallback13 } from "react";
3337
+ import { useState as useState16, useEffect as useEffect11, useCallback as useCallback14 } from "react";
1678
3338
  function useAgnoComponents() {
1679
3339
  const client = useAgnoClient();
1680
- const [components, setComponents] = useState13([]);
1681
- const [isLoading, setIsLoading] = useState13(false);
1682
- const [error, setError] = useState13();
1683
- useEffect9(() => {
3340
+ const [components, setComponents] = useState16([]);
3341
+ const [isLoading, setIsLoading] = useState16(false);
3342
+ const [error, setError] = useState16();
3343
+ useEffect11(() => {
1684
3344
  const handleComponentCreated = (component) => {
1685
3345
  setComponents((prev) => [component, ...prev]);
1686
3346
  };
@@ -1705,7 +3365,7 @@ function useAgnoComponents() {
1705
3365
  client.off("state:change", handleStateChange);
1706
3366
  };
1707
3367
  }, [client]);
1708
- const fetchComponents = useCallback13(async (queryParams, options) => {
3368
+ const fetchComponents = useCallback14(async (queryParams, options) => {
1709
3369
  setIsLoading(true);
1710
3370
  setError(undefined);
1711
3371
  try {
@@ -1720,7 +3380,7 @@ function useAgnoComponents() {
1720
3380
  setIsLoading(false);
1721
3381
  }
1722
3382
  }, [client]);
1723
- const getComponentById = useCallback13(async (componentId, options) => {
3383
+ const getComponentById = useCallback14(async (componentId, options) => {
1724
3384
  setIsLoading(true);
1725
3385
  setError(undefined);
1726
3386
  try {
@@ -1733,7 +3393,7 @@ function useAgnoComponents() {
1733
3393
  setIsLoading(false);
1734
3394
  }
1735
3395
  }, [client]);
1736
- const createComponent = useCallback13(async (request, options) => {
3396
+ const createComponent = useCallback14(async (request, options) => {
1737
3397
  setIsLoading(true);
1738
3398
  setError(undefined);
1739
3399
  try {
@@ -1746,7 +3406,7 @@ function useAgnoComponents() {
1746
3406
  setIsLoading(false);
1747
3407
  }
1748
3408
  }, [client]);
1749
- const updateComponent = useCallback13(async (componentId, request, options) => {
3409
+ const updateComponent = useCallback14(async (componentId, request, options) => {
1750
3410
  setIsLoading(true);
1751
3411
  setError(undefined);
1752
3412
  try {
@@ -1759,7 +3419,7 @@ function useAgnoComponents() {
1759
3419
  setIsLoading(false);
1760
3420
  }
1761
3421
  }, [client]);
1762
- const deleteComponent = useCallback13(async (componentId, options) => {
3422
+ const deleteComponent = useCallback14(async (componentId, options) => {
1763
3423
  setIsLoading(true);
1764
3424
  setError(undefined);
1765
3425
  try {
@@ -1772,7 +3432,7 @@ function useAgnoComponents() {
1772
3432
  setIsLoading(false);
1773
3433
  }
1774
3434
  }, [client]);
1775
- const fetchComponentConfigs = useCallback13(async (componentId, options) => {
3435
+ const fetchComponentConfigs = useCallback14(async (componentId, options) => {
1776
3436
  setIsLoading(true);
1777
3437
  setError(undefined);
1778
3438
  try {
@@ -1785,7 +3445,7 @@ function useAgnoComponents() {
1785
3445
  setIsLoading(false);
1786
3446
  }
1787
3447
  }, [client]);
1788
- const createComponentConfig = useCallback13(async (componentId, request, options) => {
3448
+ const createComponentConfig = useCallback14(async (componentId, request, options) => {
1789
3449
  setIsLoading(true);
1790
3450
  setError(undefined);
1791
3451
  try {
@@ -1798,7 +3458,7 @@ function useAgnoComponents() {
1798
3458
  setIsLoading(false);
1799
3459
  }
1800
3460
  }, [client]);
1801
- const getCurrentComponentConfig = useCallback13(async (componentId, options) => {
3461
+ const getCurrentComponentConfig = useCallback14(async (componentId, options) => {
1802
3462
  setIsLoading(true);
1803
3463
  setError(undefined);
1804
3464
  try {
@@ -1811,7 +3471,7 @@ function useAgnoComponents() {
1811
3471
  setIsLoading(false);
1812
3472
  }
1813
3473
  }, [client]);
1814
- const getComponentConfigByVersion = useCallback13(async (componentId, version, options) => {
3474
+ const getComponentConfigByVersion = useCallback14(async (componentId, version, options) => {
1815
3475
  setIsLoading(true);
1816
3476
  setError(undefined);
1817
3477
  try {
@@ -1824,7 +3484,7 @@ function useAgnoComponents() {
1824
3484
  setIsLoading(false);
1825
3485
  }
1826
3486
  }, [client]);
1827
- const updateComponentConfig = useCallback13(async (componentId, version, request, options) => {
3487
+ const updateComponentConfig = useCallback14(async (componentId, version, request, options) => {
1828
3488
  setIsLoading(true);
1829
3489
  setError(undefined);
1830
3490
  try {
@@ -1837,7 +3497,7 @@ function useAgnoComponents() {
1837
3497
  setIsLoading(false);
1838
3498
  }
1839
3499
  }, [client]);
1840
- const deleteComponentConfig = useCallback13(async (componentId, version, options) => {
3500
+ const deleteComponentConfig = useCallback14(async (componentId, version, options) => {
1841
3501
  setIsLoading(true);
1842
3502
  setError(undefined);
1843
3503
  try {
@@ -1850,7 +3510,7 @@ function useAgnoComponents() {
1850
3510
  setIsLoading(false);
1851
3511
  }
1852
3512
  }, [client]);
1853
- const setCurrentComponentConfig = useCallback13(async (componentId, version, options) => {
3513
+ const setCurrentComponentConfig = useCallback14(async (componentId, version, options) => {
1854
3514
  setIsLoading(true);
1855
3515
  setError(undefined);
1856
3516
  try {
@@ -1888,6 +3548,7 @@ export {
1888
3548
  useAgnoSessionState,
1889
3549
  useAgnoSession,
1890
3550
  useAgnoMetrics,
3551
+ useAgnoMessageContext,
1891
3552
  useAgnoMemory,
1892
3553
  useAgnoKnowledge,
1893
3554
  useAgnoEvals,
@@ -1916,10 +3577,21 @@ export {
1916
3577
  createBarChart,
1917
3578
  createArtifact,
1918
3579
  createAreaChart,
3580
+ byToolName,
1919
3581
  ToolHandlerProvider,
3582
+ ToolGenerativeUI,
3583
+ ToolDebugCard,
1920
3584
  GenerativeUIRenderer,
1921
3585
  ComponentRegistry,
1922
- AgnoProvider
3586
+ AgnoProvider,
3587
+ AgnoMessageTools,
3588
+ AgnoMessageReferences,
3589
+ AgnoMessageReasoning,
3590
+ AgnoMessageMedia,
3591
+ AgnoMessageFooter,
3592
+ AgnoMessageContext,
3593
+ AgnoMessageContent,
3594
+ AgnoMessage
1923
3595
  };
1924
3596
 
1925
- //# debugId=001BF048D0CD48E164756E2164756E21
3597
+ //# debugId=966D656003D9313664756E2164756E21