@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/index.js CHANGED
@@ -48,6 +48,7 @@ __export(exports_src, {
48
48
  useAgnoSessionState: () => useAgnoSessionState,
49
49
  useAgnoSession: () => useAgnoSession,
50
50
  useAgnoMetrics: () => useAgnoMetrics,
51
+ useAgnoMessageContext: () => useAgnoMessageContext,
51
52
  useAgnoMemory: () => useAgnoMemory,
52
53
  useAgnoKnowledge: () => useAgnoKnowledge,
53
54
  useAgnoEvals: () => useAgnoEvals,
@@ -76,10 +77,21 @@ __export(exports_src, {
76
77
  createBarChart: () => createBarChart,
77
78
  createArtifact: () => createArtifact,
78
79
  createAreaChart: () => createAreaChart,
80
+ byToolName: () => byToolName,
79
81
  ToolHandlerProvider: () => ToolHandlerProvider,
82
+ ToolGenerativeUI: () => ToolGenerativeUI,
83
+ ToolDebugCard: () => ToolDebugCard,
80
84
  GenerativeUIRenderer: () => GenerativeUIRenderer,
81
85
  ComponentRegistry: () => ComponentRegistry,
82
- AgnoProvider: () => AgnoProvider
86
+ AgnoProvider: () => AgnoProvider,
87
+ AgnoMessageTools: () => AgnoMessageTools,
88
+ AgnoMessageReferences: () => AgnoMessageReferences,
89
+ AgnoMessageReasoning: () => AgnoMessageReasoning,
90
+ AgnoMessageMedia: () => AgnoMessageMedia,
91
+ AgnoMessageFooter: () => AgnoMessageFooter,
92
+ AgnoMessageContext: () => AgnoMessageContext,
93
+ AgnoMessageContent: () => AgnoMessageContent,
94
+ AgnoMessage: () => AgnoMessage
83
95
  });
84
96
  module.exports = __toCommonJS(exports_src);
85
97
 
@@ -1150,14 +1162,1653 @@ function useAgnoActions() {
1150
1162
  error
1151
1163
  };
1152
1164
  }
1153
- // src/hooks/useAgnoCustomEvents.ts
1165
+ // src/ui/composed/agno-chat/render-tool.ts
1166
+ function byToolName(map, fallback) {
1167
+ return (tool, args) => {
1168
+ if (!Object.prototype.hasOwnProperty.call(map, tool.tool_name)) {
1169
+ return fallback ? fallback(tool, args) : args.defaultRender();
1170
+ }
1171
+ const entry = map[tool.tool_name];
1172
+ if (entry === false)
1173
+ return null;
1174
+ return entry(tool, args);
1175
+ };
1176
+ }
1177
+ // src/ui/primitives/badge.tsx
1178
+ var import_class_variance_authority = require("class-variance-authority");
1179
+
1180
+ // src/ui/lib/cn.ts
1181
+ var import_clsx = require("clsx");
1182
+ var import_tailwind_merge = require("tailwind-merge");
1183
+ function cn(...inputs) {
1184
+ return import_tailwind_merge.twMerge(import_clsx.clsx(inputs));
1185
+ }
1186
+
1187
+ // src/ui/primitives/badge.tsx
1188
+ var jsx_runtime4 = require("react/jsx-runtime");
1189
+ var badgeVariants = import_class_variance_authority.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", {
1190
+ variants: {
1191
+ variant: {
1192
+ default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
1193
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1194
+ destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
1195
+ outline: "text-foreground"
1196
+ }
1197
+ },
1198
+ defaultVariants: {
1199
+ variant: "default"
1200
+ }
1201
+ });
1202
+ function Badge({ className, variant, ...props }) {
1203
+ return /* @__PURE__ */ jsx_runtime4.jsx("div", {
1204
+ className: cn(badgeVariants({ variant }), className),
1205
+ ...props
1206
+ });
1207
+ }
1208
+
1209
+ // src/ui/primitives/collapsible.tsx
1210
+ var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
1211
+ var Collapsible = CollapsiblePrimitive.Root;
1212
+ var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
1213
+ var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
1214
+
1215
+ // src/ui/components/tool.tsx
1216
+ var import_lucide_react2 = require("lucide-react");
1217
+ var import_react9 = require("react");
1218
+
1219
+ // src/ui/primitives/button.tsx
1220
+ var React4 = __toESM(require("react"));
1221
+ var import_react_slot = require("@radix-ui/react-slot");
1222
+ var import_class_variance_authority2 = require("class-variance-authority");
1223
+ var jsx_runtime5 = require("react/jsx-runtime");
1224
+ var buttonVariants = import_class_variance_authority2.cva("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", {
1225
+ variants: {
1226
+ variant: {
1227
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
1228
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
1229
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
1230
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
1231
+ ghost: "hover:bg-accent hover:text-accent-foreground",
1232
+ link: "text-primary underline-offset-4 hover:underline"
1233
+ },
1234
+ size: {
1235
+ default: "h-9 px-4 py-2",
1236
+ sm: "h-8 rounded-md px-3 text-xs",
1237
+ lg: "h-10 rounded-md px-8",
1238
+ icon: "h-9 w-9"
1239
+ }
1240
+ },
1241
+ defaultVariants: {
1242
+ variant: "default",
1243
+ size: "default"
1244
+ }
1245
+ });
1246
+ var Button = React4.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
1247
+ const Comp = asChild ? import_react_slot.Slot : "button";
1248
+ return /* @__PURE__ */ jsx_runtime5.jsx(Comp, {
1249
+ className: cn(buttonVariants({ variant, size, className })),
1250
+ ref,
1251
+ ...props
1252
+ });
1253
+ });
1254
+ Button.displayName = "Button";
1255
+
1256
+ // src/ui/components/code-block.tsx
1257
+ var import_lucide_react = require("lucide-react");
1154
1258
  var import_react8 = require("react");
1259
+ var jsx_runtime6 = require("react/jsx-runtime");
1260
+ var CodeBlockContext = import_react8.createContext({
1261
+ code: ""
1262
+ });
1263
+ async function highlightCode(code, language, showLineNumbers = false) {
1264
+ try {
1265
+ const shiki = await import("shiki");
1266
+ const lineNumberTransformer = showLineNumbers ? [
1267
+ {
1268
+ name: "line-numbers",
1269
+ line(node, line) {
1270
+ node.children.unshift({
1271
+ type: "element",
1272
+ tagName: "span",
1273
+ properties: {
1274
+ className: ["inline-block", "min-w-10", "mr-4", "text-right", "select-none", "text-muted-foreground"]
1275
+ },
1276
+ children: [{ type: "text", value: String(line) }]
1277
+ });
1278
+ }
1279
+ }
1280
+ ] : [];
1281
+ const [light, dark] = await Promise.all([
1282
+ shiki.codeToHtml(code, { lang: language, theme: "one-light", transformers: lineNumberTransformer }),
1283
+ shiki.codeToHtml(code, { lang: language, theme: "one-dark-pro", transformers: lineNumberTransformer })
1284
+ ]);
1285
+ return [light, dark];
1286
+ } catch {
1287
+ return ["", ""];
1288
+ }
1289
+ }
1290
+ var CodeBlock = ({
1291
+ code,
1292
+ language,
1293
+ showLineNumbers = false,
1294
+ className,
1295
+ children,
1296
+ ...props
1297
+ }) => {
1298
+ const [html, setHtml] = import_react8.useState("");
1299
+ const [darkHtml, setDarkHtml] = import_react8.useState("");
1300
+ const effectIdRef = import_react8.useRef(0);
1301
+ import_react8.useEffect(() => {
1302
+ const id = ++effectIdRef.current;
1303
+ highlightCode(code, language, showLineNumbers).then(([light, dark]) => {
1304
+ if (id === effectIdRef.current) {
1305
+ setHtml(light);
1306
+ setDarkHtml(dark);
1307
+ }
1308
+ });
1309
+ }, [code, language, showLineNumbers]);
1310
+ const useFallback = !html && !darkHtml;
1311
+ return /* @__PURE__ */ jsx_runtime6.jsx(CodeBlockContext.Provider, {
1312
+ value: { code },
1313
+ children: /* @__PURE__ */ jsx_runtime6.jsx("div", {
1314
+ className: cn("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", className),
1315
+ ...props,
1316
+ children: /* @__PURE__ */ jsx_runtime6.jsxs("div", {
1317
+ className: "relative",
1318
+ children: [
1319
+ useFallback ? /* @__PURE__ */ jsx_runtime6.jsx("pre", {
1320
+ className: "m-0 overflow-auto bg-background p-4 text-foreground text-sm",
1321
+ children: /* @__PURE__ */ jsx_runtime6.jsx("code", {
1322
+ className: "font-mono text-sm",
1323
+ children: code
1324
+ })
1325
+ }) : /* @__PURE__ */ jsx_runtime6.jsxs(jsx_runtime6.Fragment, {
1326
+ children: [
1327
+ /* @__PURE__ */ jsx_runtime6.jsx("div", {
1328
+ 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",
1329
+ dangerouslySetInnerHTML: { __html: html }
1330
+ }),
1331
+ /* @__PURE__ */ jsx_runtime6.jsx("div", {
1332
+ 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",
1333
+ dangerouslySetInnerHTML: { __html: darkHtml }
1334
+ })
1335
+ ]
1336
+ }),
1337
+ children && /* @__PURE__ */ jsx_runtime6.jsx("div", {
1338
+ className: "absolute top-2 right-2 flex items-center gap-2",
1339
+ children
1340
+ })
1341
+ ]
1342
+ })
1343
+ })
1344
+ });
1345
+ };
1346
+
1347
+ // src/ui/components/tool.tsx
1348
+ var jsx_runtime7 = require("react/jsx-runtime");
1349
+ var Tool = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime7.jsx(Collapsible, {
1350
+ className: cn("not-prose mb-4 w-full rounded-md border", className),
1351
+ ...props
1352
+ });
1353
+ var getStatusBadge = (status) => {
1354
+ const labels = {
1355
+ "input-streaming": "Pending",
1356
+ "input-available": "Running",
1357
+ "approval-requested": "Awaiting Approval",
1358
+ "approval-responded": "Responded",
1359
+ "output-available": "Completed",
1360
+ "output-error": "Error",
1361
+ "output-denied": "Denied"
1362
+ };
1363
+ const icons = {
1364
+ "input-streaming": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.CircleIcon, {
1365
+ className: "size-4"
1366
+ }),
1367
+ "input-available": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.ClockIcon, {
1368
+ className: "size-4 animate-pulse"
1369
+ }),
1370
+ "approval-requested": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.ClockIcon, {
1371
+ className: "size-4 text-yellow-600"
1372
+ }),
1373
+ "approval-responded": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.CheckCircleIcon, {
1374
+ className: "size-4 text-blue-600"
1375
+ }),
1376
+ "output-available": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.CheckCircleIcon, {
1377
+ className: "size-4 text-green-600"
1378
+ }),
1379
+ "output-error": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.XCircleIcon, {
1380
+ className: "size-4 text-red-600"
1381
+ }),
1382
+ "output-denied": /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.XCircleIcon, {
1383
+ className: "size-4 text-orange-600"
1384
+ })
1385
+ };
1386
+ return /* @__PURE__ */ jsx_runtime7.jsxs(Badge, {
1387
+ className: "gap-1.5 rounded-full text-xs",
1388
+ variant: "secondary",
1389
+ children: [
1390
+ icons[status],
1391
+ labels[status]
1392
+ ]
1393
+ });
1394
+ };
1395
+ var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */ jsx_runtime7.jsxs(CollapsibleTrigger2, {
1396
+ className: cn("group flex w-full items-center justify-between gap-4 p-3", className),
1397
+ ...props,
1398
+ children: [
1399
+ /* @__PURE__ */ jsx_runtime7.jsxs("div", {
1400
+ className: "flex items-center gap-2",
1401
+ children: [
1402
+ /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.WrenchIcon, {
1403
+ className: "size-4 text-muted-foreground"
1404
+ }),
1405
+ /* @__PURE__ */ jsx_runtime7.jsx("span", {
1406
+ className: "font-medium text-sm",
1407
+ children: title ?? type?.split("-").slice(1).join("-") ?? "Tool"
1408
+ }),
1409
+ getStatusBadge(state)
1410
+ ]
1411
+ }),
1412
+ /* @__PURE__ */ jsx_runtime7.jsx(import_lucide_react2.ChevronDownIcon, {
1413
+ className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
1414
+ })
1415
+ ]
1416
+ });
1417
+ var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime7.jsx(CollapsibleContent2, {
1418
+ 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),
1419
+ ...props
1420
+ });
1421
+ var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsx_runtime7.jsxs("div", {
1422
+ className: cn("space-y-2 overflow-hidden p-4", className),
1423
+ ...props,
1424
+ children: [
1425
+ /* @__PURE__ */ jsx_runtime7.jsx("h4", {
1426
+ className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
1427
+ children: "Parameters"
1428
+ }),
1429
+ /* @__PURE__ */ jsx_runtime7.jsx("div", {
1430
+ className: "rounded-md bg-muted/50",
1431
+ children: /* @__PURE__ */ jsx_runtime7.jsx(CodeBlock, {
1432
+ code: JSON.stringify(input, null, 2),
1433
+ language: "json"
1434
+ })
1435
+ })
1436
+ ]
1437
+ });
1438
+ var ToolOutput = ({ className, output, errorText, ...props }) => {
1439
+ if (!(output || errorText)) {
1440
+ return null;
1441
+ }
1442
+ let Output = /* @__PURE__ */ jsx_runtime7.jsx("div", {
1443
+ children: output
1444
+ });
1445
+ if (typeof output === "object" && !import_react9.isValidElement(output)) {
1446
+ Output = /* @__PURE__ */ jsx_runtime7.jsx(CodeBlock, {
1447
+ code: JSON.stringify(output, null, 2),
1448
+ language: "json"
1449
+ });
1450
+ } else if (typeof output === "string") {
1451
+ Output = /* @__PURE__ */ jsx_runtime7.jsx(CodeBlock, {
1452
+ code: output,
1453
+ language: "json"
1454
+ });
1455
+ }
1456
+ return /* @__PURE__ */ jsx_runtime7.jsxs("div", {
1457
+ className: cn("space-y-2 p-4", className),
1458
+ ...props,
1459
+ children: [
1460
+ /* @__PURE__ */ jsx_runtime7.jsx("h4", {
1461
+ className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
1462
+ children: errorText ? "Error" : "Result"
1463
+ }),
1464
+ /* @__PURE__ */ jsx_runtime7.jsxs("div", {
1465
+ className: cn("overflow-x-auto rounded-md text-xs [&_table]:w-full", errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
1466
+ children: [
1467
+ errorText && /* @__PURE__ */ jsx_runtime7.jsx("div", {
1468
+ children: errorText
1469
+ }),
1470
+ Output
1471
+ ]
1472
+ })
1473
+ ]
1474
+ });
1475
+ };
1476
+
1477
+ // src/ui/primitives/tooltip.tsx
1478
+ var React5 = __toESM(require("react"));
1479
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
1480
+ var jsx_runtime8 = require("react/jsx-runtime");
1481
+ var TooltipProvider = TooltipPrimitive.Provider;
1482
+ var Tooltip = TooltipPrimitive.Root;
1483
+ var TooltipTrigger = TooltipPrimitive.Trigger;
1484
+ var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Portal, {
1485
+ children: /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Content, {
1486
+ ref,
1487
+ sideOffset,
1488
+ 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),
1489
+ ...props
1490
+ })
1491
+ }));
1492
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
1493
+
1494
+ // src/ui/components/artifact.tsx
1495
+ var import_lucide_react3 = require("lucide-react");
1496
+ var jsx_runtime9 = require("react/jsx-runtime");
1497
+ var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime9.jsx("div", {
1498
+ className: cn("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm", className),
1499
+ ...props
1500
+ });
1501
+
1502
+ // src/ui/composed/agno-chat/tool-building-blocks.tsx
1503
+ var jsx_runtime10 = require("react/jsx-runtime");
1504
+ var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
1505
+ function ToolDebugCard({ tool, defaultOpen }) {
1506
+ const output = tool.result ?? tool.content;
1507
+ return /* @__PURE__ */ jsx_runtime10.jsxs(Tool, {
1508
+ defaultOpen,
1509
+ children: [
1510
+ /* @__PURE__ */ jsx_runtime10.jsx(ToolHeader, {
1511
+ title: tool.tool_name,
1512
+ type: "tool-use",
1513
+ state: getToolState(tool)
1514
+ }),
1515
+ /* @__PURE__ */ jsx_runtime10.jsxs(ToolContent, {
1516
+ children: [
1517
+ /* @__PURE__ */ jsx_runtime10.jsx(ToolInput, {
1518
+ input: tool.tool_args
1519
+ }),
1520
+ output ? /* @__PURE__ */ jsx_runtime10.jsx(ToolOutput, {
1521
+ output,
1522
+ errorText: tool.tool_call_error ? "Tool execution failed" : undefined
1523
+ }) : null
1524
+ ]
1525
+ })
1526
+ ]
1527
+ });
1528
+ }
1529
+ function ToolGenerativeUI({ tool }) {
1530
+ const uiComponent = tool.ui_component;
1531
+ if (!uiComponent)
1532
+ return null;
1533
+ return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx_runtime10.jsx(Artifact, {
1534
+ children: /* @__PURE__ */ jsx_runtime10.jsx(GenerativeUIRenderer, {
1535
+ spec: uiComponent,
1536
+ className: "w-full p-2"
1537
+ })
1538
+ }) : /* @__PURE__ */ jsx_runtime10.jsx(GenerativeUIRenderer, {
1539
+ spec: uiComponent,
1540
+ className: "w-full"
1541
+ });
1542
+ }
1543
+ // src/ui/composed/agno-message/message.tsx
1544
+ var import_react14 = require("react");
1545
+ var import_lucide_react13 = require("lucide-react");
1546
+
1547
+ // src/ui/lib/format-timestamp.ts
1548
+ function formatSmartTimestamp(date) {
1549
+ const now = new Date;
1550
+ const isToday = date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate();
1551
+ if (isToday) {
1552
+ return new Intl.DateTimeFormat(undefined, {
1553
+ hour: "numeric",
1554
+ minute: "2-digit",
1555
+ hour12: true
1556
+ }).format(date);
1557
+ }
1558
+ const isSameYear = date.getFullYear() === now.getFullYear();
1559
+ if (isSameYear) {
1560
+ return new Intl.DateTimeFormat(undefined, {
1561
+ month: "short",
1562
+ day: "numeric"
1563
+ }).format(date);
1564
+ }
1565
+ return new Intl.DateTimeFormat(undefined, {
1566
+ month: "short",
1567
+ day: "numeric",
1568
+ year: "numeric"
1569
+ }).format(date);
1570
+ }
1571
+ function formatFullTimestamp(date) {
1572
+ return new Intl.DateTimeFormat(undefined, {
1573
+ month: "short",
1574
+ day: "numeric",
1575
+ year: "numeric",
1576
+ hour: "numeric",
1577
+ minute: "2-digit",
1578
+ hour12: true
1579
+ }).format(date);
1580
+ }
1581
+
1582
+ // src/ui/components/smart-timestamp.tsx
1583
+ var jsx_runtime11 = require("react/jsx-runtime");
1584
+ function SmartTimestamp({ date, formatShort, className }) {
1585
+ const shortText = formatShort ? formatShort(date) : formatSmartTimestamp(date);
1586
+ const fullText = formatFullTimestamp(date);
1587
+ return /* @__PURE__ */ jsx_runtime11.jsx(TooltipProvider, {
1588
+ children: /* @__PURE__ */ jsx_runtime11.jsxs(Tooltip, {
1589
+ children: [
1590
+ /* @__PURE__ */ jsx_runtime11.jsx(TooltipTrigger, {
1591
+ asChild: true,
1592
+ children: /* @__PURE__ */ jsx_runtime11.jsx("span", {
1593
+ className,
1594
+ children: shortText
1595
+ })
1596
+ }),
1597
+ /* @__PURE__ */ jsx_runtime11.jsx(TooltipContent, {
1598
+ children: /* @__PURE__ */ jsx_runtime11.jsx("p", {
1599
+ children: fullText
1600
+ })
1601
+ })
1602
+ ]
1603
+ })
1604
+ });
1605
+ }
1606
+
1607
+ // src/ui/lib/file-utils.ts
1608
+ function getFilePreviewType(mimeType) {
1609
+ if (!mimeType)
1610
+ return "none";
1611
+ if (mimeType.startsWith("image/"))
1612
+ return "image";
1613
+ if (mimeType === "application/pdf")
1614
+ return "pdf";
1615
+ if (mimeType.startsWith("text/"))
1616
+ return "text";
1617
+ if (mimeType.startsWith("video/"))
1618
+ return "video";
1619
+ if (mimeType.startsWith("audio/"))
1620
+ return "audio";
1621
+ return "none";
1622
+ }
1623
+ function formatFileSize(bytes) {
1624
+ if (bytes === 0)
1625
+ return "0 B";
1626
+ const units = ["B", "KB", "MB", "GB", "TB"];
1627
+ const k = 1024;
1628
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1629
+ const value = bytes / Math.pow(k, i);
1630
+ return `${value % 1 === 0 ? value : value.toFixed(1)} ${units[i]}`;
1631
+ }
1632
+ function getFileExtension(filename, mimeType) {
1633
+ const lastDot = filename.lastIndexOf(".");
1634
+ if (lastDot !== -1 && lastDot !== 0) {
1635
+ return filename.slice(lastDot + 1).toLowerCase();
1636
+ }
1637
+ if (mimeType) {
1638
+ return extensionFromMime(mimeType);
1639
+ }
1640
+ return "";
1641
+ }
1642
+ var mimeToExt = {
1643
+ "application/pdf": "pdf",
1644
+ "application/zip": "zip",
1645
+ "application/x-rar-compressed": "rar",
1646
+ "application/json": "json",
1647
+ "application/xml": "xml",
1648
+ "application/msword": "doc",
1649
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
1650
+ "application/vnd.ms-excel": "xls",
1651
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
1652
+ "application/vnd.ms-powerpoint": "ppt",
1653
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
1654
+ "text/csv": "csv",
1655
+ "text/plain": "txt",
1656
+ "text/html": "html",
1657
+ "text/css": "css",
1658
+ "text/javascript": "js"
1659
+ };
1660
+ function extensionFromMime(mimeType) {
1661
+ if (mimeToExt[mimeType])
1662
+ return mimeToExt[mimeType];
1663
+ const subtype = mimeType.split("/")[1];
1664
+ if (subtype && !subtype.includes(".") && !subtype.includes("+")) {
1665
+ return subtype.toLowerCase();
1666
+ }
1667
+ return "";
1668
+ }
1669
+ function isPreviewable(mimeType) {
1670
+ const type = getFilePreviewType(mimeType);
1671
+ return type === "image" || type === "pdf";
1672
+ }
1673
+
1674
+ // src/ui/components/file-preview-card.tsx
1675
+ var import_lucide_react4 = require("lucide-react");
1676
+ var jsx_runtime12 = require("react/jsx-runtime");
1677
+ function ExtBadge({ ext }) {
1678
+ if (!ext)
1679
+ return null;
1680
+ return /* @__PURE__ */ jsx_runtime12.jsx("span", {
1681
+ 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",
1682
+ children: ext
1683
+ });
1684
+ }
1685
+ function FilePreviewCard({ file, onClick, className }) {
1686
+ const previewType = getFilePreviewType(file.type);
1687
+ const isClickable = !!onClick;
1688
+ const ext = getFileExtension(file.name, file.type);
1689
+ 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);
1690
+ if (previewType === "image" && file.url) {
1691
+ return /* @__PURE__ */ jsx_runtime12.jsxs("button", {
1692
+ type: "button",
1693
+ onClick,
1694
+ disabled: !isClickable,
1695
+ className: cardBase,
1696
+ children: [
1697
+ /* @__PURE__ */ jsx_runtime12.jsx("img", {
1698
+ src: file.url,
1699
+ alt: file.name,
1700
+ className: "w-full h-full object-cover"
1701
+ }),
1702
+ /* @__PURE__ */ jsx_runtime12.jsx(ExtBadge, {
1703
+ ext
1704
+ }),
1705
+ isClickable && /* @__PURE__ */ jsx_runtime12.jsx("div", {
1706
+ className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/30 transition-colors",
1707
+ children: /* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react4.Search, {
1708
+ className: "h-5 w-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"
1709
+ })
1710
+ })
1711
+ ]
1712
+ });
1713
+ }
1714
+ if (previewType === "pdf" && file.url) {
1715
+ return /* @__PURE__ */ jsx_runtime12.jsxs("button", {
1716
+ type: "button",
1717
+ onClick,
1718
+ disabled: !isClickable,
1719
+ className: cardBase,
1720
+ children: [
1721
+ /* @__PURE__ */ jsx_runtime12.jsx("div", {
1722
+ className: "w-full h-full overflow-hidden pointer-events-none",
1723
+ children: /* @__PURE__ */ jsx_runtime12.jsx("object", {
1724
+ data: `${file.url}#page=1&view=FitH`,
1725
+ type: "application/pdf",
1726
+ className: "w-[200%] h-[200%] origin-top-left scale-50",
1727
+ "aria-label": file.name,
1728
+ children: /* @__PURE__ */ jsx_runtime12.jsx("div", {
1729
+ className: "flex items-center justify-center w-full h-full",
1730
+ children: /* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react4.FileIcon, {
1731
+ className: "h-8 w-8 text-muted-foreground/40"
1732
+ })
1733
+ })
1734
+ })
1735
+ }),
1736
+ /* @__PURE__ */ jsx_runtime12.jsx(ExtBadge, {
1737
+ ext
1738
+ }),
1739
+ isClickable && /* @__PURE__ */ jsx_runtime12.jsx("div", {
1740
+ className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/10 transition-colors",
1741
+ children: /* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react4.Search, {
1742
+ className: "h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"
1743
+ })
1744
+ })
1745
+ ]
1746
+ });
1747
+ }
1748
+ return /* @__PURE__ */ jsx_runtime12.jsxs("button", {
1749
+ type: "button",
1750
+ onClick,
1751
+ disabled: !isClickable,
1752
+ className: cardBase,
1753
+ children: [
1754
+ /* @__PURE__ */ jsx_runtime12.jsx("div", {
1755
+ className: "flex-1 flex items-center justify-center",
1756
+ children: /* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react4.FileIcon, {
1757
+ className: "h-8 w-8 text-muted-foreground/40"
1758
+ })
1759
+ }),
1760
+ /* @__PURE__ */ jsx_runtime12.jsxs("div", {
1761
+ className: "w-full text-center min-w-0 px-2 pb-2 space-y-0.5",
1762
+ children: [
1763
+ /* @__PURE__ */ jsx_runtime12.jsx("p", {
1764
+ className: "text-[10px] text-foreground truncate leading-tight",
1765
+ title: file.name,
1766
+ children: file.name
1767
+ }),
1768
+ file.size != null && file.size > 0 && /* @__PURE__ */ jsx_runtime12.jsx("p", {
1769
+ className: "text-[9px] text-muted-foreground leading-tight",
1770
+ children: formatFileSize(file.size)
1771
+ })
1772
+ ]
1773
+ }),
1774
+ /* @__PURE__ */ jsx_runtime12.jsx(ExtBadge, {
1775
+ ext
1776
+ })
1777
+ ]
1778
+ });
1779
+ }
1780
+
1781
+ // src/ui/primitives/dialog.tsx
1782
+ var React6 = __toESM(require("react"));
1783
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
1784
+ var import_class_variance_authority3 = require("class-variance-authority");
1785
+ var import_lucide_react5 = require("lucide-react");
1786
+ var jsx_runtime13 = require("react/jsx-runtime");
1787
+ var Dialog = DialogPrimitive.Root;
1788
+ var DialogPortal = DialogPrimitive.Portal;
1789
+ var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime13.jsx(DialogPrimitive.Overlay, {
1790
+ ref,
1791
+ 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),
1792
+ ...props
1793
+ }));
1794
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1795
+ var dialogContentVariants = import_class_variance_authority3.cva("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", {
1796
+ variants: {
1797
+ variant: {
1798
+ default: "w-full max-w-lg bg-background p-6",
1799
+ lightbox: "max-w-[90vw] max-h-[90vh] bg-background/95 backdrop-blur-sm p-2"
1800
+ }
1801
+ },
1802
+ defaultVariants: {
1803
+ variant: "default"
1804
+ }
1805
+ });
1806
+ var DialogContent = React6.forwardRef(({ className, variant, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime13.jsxs(DialogPortal, {
1807
+ children: [
1808
+ /* @__PURE__ */ jsx_runtime13.jsx(DialogOverlay, {}),
1809
+ /* @__PURE__ */ jsx_runtime13.jsxs(DialogPrimitive.Content, {
1810
+ ref,
1811
+ className: cn(dialogContentVariants({ variant }), className),
1812
+ ...props,
1813
+ children: [
1814
+ children,
1815
+ /* @__PURE__ */ jsx_runtime13.jsxs(DialogPrimitive.Close, {
1816
+ 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",
1817
+ children: [
1818
+ /* @__PURE__ */ jsx_runtime13.jsx(import_lucide_react5.X, {
1819
+ className: "h-4 w-4"
1820
+ }),
1821
+ /* @__PURE__ */ jsx_runtime13.jsx("span", {
1822
+ className: "sr-only",
1823
+ children: "Close"
1824
+ })
1825
+ ]
1826
+ })
1827
+ ]
1828
+ })
1829
+ ]
1830
+ }));
1831
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
1832
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime13.jsx("div", {
1833
+ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
1834
+ ...props
1835
+ });
1836
+ DialogHeader.displayName = "DialogHeader";
1837
+ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime13.jsx("div", {
1838
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
1839
+ ...props
1840
+ });
1841
+ DialogFooter.displayName = "DialogFooter";
1842
+ var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime13.jsx(DialogPrimitive.Title, {
1843
+ ref,
1844
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
1845
+ ...props
1846
+ }));
1847
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
1848
+ var DialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime13.jsx(DialogPrimitive.Description, {
1849
+ ref,
1850
+ className: cn("text-sm text-muted-foreground", className),
1851
+ ...props
1852
+ }));
1853
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
1854
+
1855
+ // src/ui/components/file-preview-modal.tsx
1856
+ var import_lucide_react6 = require("lucide-react");
1857
+ var jsx_runtime14 = require("react/jsx-runtime");
1858
+ function FilePreviewModal({ open, onOpenChange, file }) {
1859
+ if (!file)
1860
+ return null;
1861
+ const previewType = getFilePreviewType(file.type);
1862
+ const canPreview = isPreviewable(file.type) && !!file.url;
1863
+ return /* @__PURE__ */ jsx_runtime14.jsx(Dialog, {
1864
+ open,
1865
+ onOpenChange,
1866
+ children: previewType === "image" && file.url ? /* @__PURE__ */ jsx_runtime14.jsxs(DialogContent, {
1867
+ variant: "lightbox",
1868
+ "aria-describedby": undefined,
1869
+ children: [
1870
+ /* @__PURE__ */ jsx_runtime14.jsx(DialogTitle, {
1871
+ className: "sr-only",
1872
+ children: file.name
1873
+ }),
1874
+ /* @__PURE__ */ jsx_runtime14.jsx("img", {
1875
+ src: file.url,
1876
+ alt: file.name,
1877
+ className: "max-h-[85vh] max-w-full object-contain rounded-md"
1878
+ })
1879
+ ]
1880
+ }) : previewType === "pdf" && file.url ? /* @__PURE__ */ jsx_runtime14.jsxs(DialogContent, {
1881
+ variant: "lightbox",
1882
+ className: "w-[80vw] h-[85vh]",
1883
+ "aria-describedby": undefined,
1884
+ children: [
1885
+ /* @__PURE__ */ jsx_runtime14.jsx(DialogTitle, {
1886
+ className: "sr-only",
1887
+ children: file.name
1888
+ }),
1889
+ /* @__PURE__ */ jsx_runtime14.jsx("object", {
1890
+ data: file.url,
1891
+ type: "application/pdf",
1892
+ className: "w-full h-full rounded-md",
1893
+ children: /* @__PURE__ */ jsx_runtime14.jsxs("div", {
1894
+ className: "flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",
1895
+ children: [
1896
+ /* @__PURE__ */ jsx_runtime14.jsx("p", {
1897
+ className: "text-sm",
1898
+ children: "Unable to display PDF"
1899
+ }),
1900
+ /* @__PURE__ */ jsx_runtime14.jsxs("a", {
1901
+ href: file.url,
1902
+ target: "_blank",
1903
+ rel: "noopener noreferrer",
1904
+ className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
1905
+ children: [
1906
+ /* @__PURE__ */ jsx_runtime14.jsx(import_lucide_react6.Download, {
1907
+ className: "h-4 w-4"
1908
+ }),
1909
+ "Download ",
1910
+ file.name
1911
+ ]
1912
+ })
1913
+ ]
1914
+ })
1915
+ })
1916
+ ]
1917
+ }) : /* @__PURE__ */ jsx_runtime14.jsxs(DialogContent, {
1918
+ children: [
1919
+ /* @__PURE__ */ jsx_runtime14.jsxs(DialogHeader, {
1920
+ children: [
1921
+ /* @__PURE__ */ jsx_runtime14.jsxs(DialogTitle, {
1922
+ className: "flex items-center gap-2",
1923
+ children: [
1924
+ /* @__PURE__ */ jsx_runtime14.jsx(import_lucide_react6.FileIcon, {
1925
+ className: "h-5 w-5 text-muted-foreground"
1926
+ }),
1927
+ file.name
1928
+ ]
1929
+ }),
1930
+ /* @__PURE__ */ jsx_runtime14.jsxs(DialogDescription, {
1931
+ children: [
1932
+ file.size != null && file.size > 0 && /* @__PURE__ */ jsx_runtime14.jsx("span", {
1933
+ children: formatFileSize(file.size)
1934
+ }),
1935
+ !canPreview && /* @__PURE__ */ jsx_runtime14.jsx("span", {
1936
+ children: " · Preview not available for this file type"
1937
+ })
1938
+ ]
1939
+ })
1940
+ ]
1941
+ }),
1942
+ /* @__PURE__ */ jsx_runtime14.jsxs("div", {
1943
+ className: "flex flex-col items-center justify-center py-8 text-muted-foreground gap-3",
1944
+ children: [
1945
+ /* @__PURE__ */ jsx_runtime14.jsx(import_lucide_react6.FileIcon, {
1946
+ className: "h-12 w-12"
1947
+ }),
1948
+ /* @__PURE__ */ jsx_runtime14.jsx("p", {
1949
+ className: "text-sm",
1950
+ children: "Preview not available"
1951
+ }),
1952
+ file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime14.jsxs("a", {
1953
+ href: file.url,
1954
+ target: "_blank",
1955
+ rel: "noopener noreferrer",
1956
+ className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
1957
+ children: [
1958
+ /* @__PURE__ */ jsx_runtime14.jsx(import_lucide_react6.Download, {
1959
+ className: "h-4 w-4"
1960
+ }),
1961
+ "Download file"
1962
+ ]
1963
+ })
1964
+ ]
1965
+ })
1966
+ ]
1967
+ })
1968
+ });
1969
+ }
1970
+
1971
+ // src/ui/components/image-lightbox.tsx
1972
+ var import_react10 = require("react");
1973
+ var import_lucide_react7 = require("lucide-react");
1974
+ var jsx_runtime15 = require("react/jsx-runtime");
1975
+ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
1976
+ const [currentIndex, setCurrentIndex] = import_react10.useState(initialIndex);
1977
+ const hasMultiple = images.length > 1;
1978
+ import_react10.useEffect(() => {
1979
+ if (open)
1980
+ setCurrentIndex(initialIndex);
1981
+ }, [open, initialIndex]);
1982
+ const goNext = import_react10.useCallback(() => {
1983
+ setCurrentIndex((i) => (i + 1) % images.length);
1984
+ }, [images.length]);
1985
+ const goPrev = import_react10.useCallback(() => {
1986
+ setCurrentIndex((i) => (i - 1 + images.length) % images.length);
1987
+ }, [images.length]);
1988
+ import_react10.useEffect(() => {
1989
+ if (!open || !hasMultiple)
1990
+ return;
1991
+ const handler = (e) => {
1992
+ if (e.key === "ArrowRight")
1993
+ goNext();
1994
+ if (e.key === "ArrowLeft")
1995
+ goPrev();
1996
+ };
1997
+ window.addEventListener("keydown", handler);
1998
+ return () => window.removeEventListener("keydown", handler);
1999
+ }, [open, hasMultiple, goNext, goPrev]);
2000
+ if (images.length === 0)
2001
+ return null;
2002
+ const current = images[currentIndex];
2003
+ if (!current)
2004
+ return null;
2005
+ return /* @__PURE__ */ jsx_runtime15.jsx(Dialog, {
2006
+ open,
2007
+ onOpenChange,
2008
+ children: /* @__PURE__ */ jsx_runtime15.jsxs(DialogContent, {
2009
+ variant: "lightbox",
2010
+ "aria-describedby": undefined,
2011
+ children: [
2012
+ /* @__PURE__ */ jsx_runtime15.jsx(DialogTitle, {
2013
+ className: "sr-only",
2014
+ children: current.alt || `Image ${currentIndex + 1} of ${images.length}`
2015
+ }),
2016
+ /* @__PURE__ */ jsx_runtime15.jsxs("div", {
2017
+ className: "relative flex items-center justify-center",
2018
+ children: [
2019
+ /* @__PURE__ */ jsx_runtime15.jsx("img", {
2020
+ src: current.url,
2021
+ alt: current.alt || "Image preview",
2022
+ className: "max-h-[85vh] max-w-full object-contain rounded-md"
2023
+ }),
2024
+ hasMultiple && /* @__PURE__ */ jsx_runtime15.jsxs(jsx_runtime15.Fragment, {
2025
+ children: [
2026
+ /* @__PURE__ */ jsx_runtime15.jsxs("button", {
2027
+ type: "button",
2028
+ onClick: goPrev,
2029
+ 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"),
2030
+ children: [
2031
+ /* @__PURE__ */ jsx_runtime15.jsx(import_lucide_react7.ChevronLeft, {
2032
+ className: "h-5 w-5"
2033
+ }),
2034
+ /* @__PURE__ */ jsx_runtime15.jsx("span", {
2035
+ className: "sr-only",
2036
+ children: "Previous image"
2037
+ })
2038
+ ]
2039
+ }),
2040
+ /* @__PURE__ */ jsx_runtime15.jsxs("button", {
2041
+ type: "button",
2042
+ onClick: goNext,
2043
+ 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"),
2044
+ children: [
2045
+ /* @__PURE__ */ jsx_runtime15.jsx(import_lucide_react7.ChevronRight, {
2046
+ className: "h-5 w-5"
2047
+ }),
2048
+ /* @__PURE__ */ jsx_runtime15.jsx("span", {
2049
+ className: "sr-only",
2050
+ children: "Next image"
2051
+ })
2052
+ ]
2053
+ }),
2054
+ /* @__PURE__ */ jsx_runtime15.jsxs("div", {
2055
+ className: "absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-xs text-white",
2056
+ children: [
2057
+ currentIndex + 1,
2058
+ " / ",
2059
+ images.length
2060
+ ]
2061
+ })
2062
+ ]
2063
+ })
2064
+ ]
2065
+ })
2066
+ ]
2067
+ })
2068
+ });
2069
+ }
2070
+
2071
+ // src/ui/composed/agno-message/context.ts
2072
+ var import_react11 = require("react");
2073
+ var AgnoMessageContext = import_react11.createContext(null);
2074
+ function useAgnoMessageContext() {
2075
+ const ctx = import_react11.useContext(AgnoMessageContext);
2076
+ if (!ctx) {
2077
+ throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
2078
+ }
2079
+ return ctx;
2080
+ }
2081
+
2082
+ // src/ui/composed/agno-message/reasoning.tsx
2083
+ var import_lucide_react9 = require("lucide-react");
2084
+
2085
+ // src/ui/primitives/accordion.tsx
2086
+ var React7 = __toESM(require("react"));
2087
+ var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
2088
+ var import_lucide_react8 = require("lucide-react");
2089
+ var jsx_runtime16 = require("react/jsx-runtime");
2090
+ var Accordion = AccordionPrimitive.Root;
2091
+ var AccordionItem = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime16.jsx(AccordionPrimitive.Item, {
2092
+ ref,
2093
+ className: cn("border-b", className),
2094
+ ...props
2095
+ }));
2096
+ AccordionItem.displayName = "AccordionItem";
2097
+ var AccordionTrigger = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime16.jsx(AccordionPrimitive.Header, {
2098
+ className: "flex",
2099
+ children: /* @__PURE__ */ jsx_runtime16.jsxs(AccordionPrimitive.Trigger, {
2100
+ ref,
2101
+ 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),
2102
+ ...props,
2103
+ children: [
2104
+ children,
2105
+ /* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react8.ChevronDown, {
2106
+ className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
2107
+ })
2108
+ ]
2109
+ })
2110
+ }));
2111
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
2112
+ var AccordionContent = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime16.jsx(AccordionPrimitive.Content, {
2113
+ ref,
2114
+ className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
2115
+ ...props,
2116
+ children: /* @__PURE__ */ jsx_runtime16.jsx("div", {
2117
+ className: cn("pb-4 pt-0", className),
2118
+ children
2119
+ })
2120
+ }));
2121
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
2122
+
2123
+ // src/ui/composed/agno-message/reasoning.tsx
2124
+ var jsx_runtime17 = require("react/jsx-runtime");
2125
+ function AgnoMessageReasoning() {
2126
+ const { message, classNames } = useAgnoMessageContext();
2127
+ const steps = message.extra_data?.reasoning_steps;
2128
+ if (!steps || steps.length === 0)
2129
+ return null;
2130
+ return /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2131
+ className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
2132
+ children: [
2133
+ /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2134
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2135
+ children: [
2136
+ /* @__PURE__ */ jsx_runtime17.jsx(import_lucide_react9.Lightbulb, {
2137
+ className: "h-3.5 w-3.5"
2138
+ }),
2139
+ "Reasoning (",
2140
+ steps.length,
2141
+ " steps)"
2142
+ ]
2143
+ }),
2144
+ /* @__PURE__ */ jsx_runtime17.jsx(Accordion, {
2145
+ type: "multiple",
2146
+ className: "w-full",
2147
+ children: steps.map((step, idx) => /* @__PURE__ */ jsx_runtime17.jsxs(AccordionItem, {
2148
+ value: `reasoning-${idx}`,
2149
+ className: "border-muted",
2150
+ children: [
2151
+ /* @__PURE__ */ jsx_runtime17.jsx(AccordionTrigger, {
2152
+ className: "text-xs py-1.5 hover:no-underline",
2153
+ children: step.title || `Step ${idx + 1}`
2154
+ }),
2155
+ /* @__PURE__ */ jsx_runtime17.jsxs(AccordionContent, {
2156
+ className: "space-y-1.5 text-xs text-muted-foreground",
2157
+ children: [
2158
+ step.action && /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2159
+ children: [
2160
+ /* @__PURE__ */ jsx_runtime17.jsx("span", {
2161
+ className: "font-medium text-foreground",
2162
+ children: "Action:"
2163
+ }),
2164
+ " ",
2165
+ step.action
2166
+ ]
2167
+ }),
2168
+ step.reasoning && /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2169
+ children: [
2170
+ /* @__PURE__ */ jsx_runtime17.jsx("span", {
2171
+ className: "font-medium text-foreground",
2172
+ children: "Reasoning:"
2173
+ }),
2174
+ " ",
2175
+ step.reasoning
2176
+ ]
2177
+ }),
2178
+ step.result && /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2179
+ children: [
2180
+ /* @__PURE__ */ jsx_runtime17.jsx("span", {
2181
+ className: "font-medium text-foreground",
2182
+ children: "Result:"
2183
+ }),
2184
+ " ",
2185
+ step.result
2186
+ ]
2187
+ }),
2188
+ step.confidence !== undefined && /* @__PURE__ */ jsx_runtime17.jsxs("div", {
2189
+ children: [
2190
+ /* @__PURE__ */ jsx_runtime17.jsx("span", {
2191
+ className: "font-medium text-foreground",
2192
+ children: "Confidence:"
2193
+ }),
2194
+ " ",
2195
+ (step.confidence * 100).toFixed(1),
2196
+ "%"
2197
+ ]
2198
+ })
2199
+ ]
2200
+ })
2201
+ ]
2202
+ }, idx))
2203
+ })
2204
+ ]
2205
+ });
2206
+ }
2207
+
2208
+ // src/ui/composed/agno-message/media.tsx
2209
+ var import_lucide_react10 = require("lucide-react");
2210
+ var jsx_runtime18 = require("react/jsx-runtime");
2211
+ function AgnoMessageMedia() {
2212
+ const {
2213
+ message,
2214
+ classNames,
2215
+ showImageLightbox,
2216
+ showFilePreview,
2217
+ openImageLightbox,
2218
+ openFilePreview
2219
+ } = useAgnoMessageContext();
2220
+ const mediaClassName = classNames?.assistant?.media;
2221
+ const hasImages = !!message.images && message.images.length > 0;
2222
+ const hasVideos = !!message.videos && message.videos.length > 0;
2223
+ const hasAudio = !!message.audio && message.audio.length > 0;
2224
+ const hasFiles = !!message.files && message.files.length > 0;
2225
+ const hasResponseAudio = !!message.response_audio;
2226
+ if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
2227
+ return null;
2228
+ return /* @__PURE__ */ jsx_runtime18.jsxs(jsx_runtime18.Fragment, {
2229
+ children: [
2230
+ hasImages && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2231
+ className: cn("space-y-2 pt-1", mediaClassName),
2232
+ children: [
2233
+ /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2234
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2235
+ children: [
2236
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.Image, {
2237
+ className: "h-3.5 w-3.5"
2238
+ }),
2239
+ "Images (",
2240
+ message.images.length,
2241
+ ")"
2242
+ ]
2243
+ }),
2244
+ /* @__PURE__ */ jsx_runtime18.jsx("div", {
2245
+ className: "grid grid-cols-2 gap-2",
2246
+ children: message.images.map((img, idx) => /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2247
+ className: "space-y-1",
2248
+ children: [
2249
+ showImageLightbox ? /* @__PURE__ */ jsx_runtime18.jsx("button", {
2250
+ type: "button",
2251
+ onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
2252
+ 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",
2253
+ children: /* @__PURE__ */ jsx_runtime18.jsx("img", {
2254
+ src: img.url,
2255
+ alt: img.revised_prompt || "Generated image",
2256
+ className: "w-full rounded-lg"
2257
+ })
2258
+ }) : /* @__PURE__ */ jsx_runtime18.jsx("img", {
2259
+ src: img.url,
2260
+ alt: img.revised_prompt || "Generated image",
2261
+ className: "w-full rounded-lg border border-border"
2262
+ }),
2263
+ img.revised_prompt && /* @__PURE__ */ jsx_runtime18.jsx("p", {
2264
+ className: "text-[11px] text-muted-foreground italic px-0.5",
2265
+ children: img.revised_prompt
2266
+ })
2267
+ ]
2268
+ }, idx))
2269
+ })
2270
+ ]
2271
+ }),
2272
+ hasVideos && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2273
+ className: cn("space-y-2 pt-1", mediaClassName),
2274
+ children: [
2275
+ /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2276
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2277
+ children: [
2278
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.Video, {
2279
+ className: "h-3.5 w-3.5"
2280
+ }),
2281
+ "Videos (",
2282
+ message.videos.length,
2283
+ ")"
2284
+ ]
2285
+ }),
2286
+ /* @__PURE__ */ jsx_runtime18.jsx("div", {
2287
+ className: "space-y-2",
2288
+ children: message.videos.map((video, idx) => /* @__PURE__ */ jsx_runtime18.jsx("div", {
2289
+ children: video.url ? /* @__PURE__ */ jsx_runtime18.jsx("video", {
2290
+ src: video.url,
2291
+ controls: true,
2292
+ className: "w-full rounded-lg border border-border"
2293
+ }) : /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2294
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2295
+ children: [
2296
+ "Video ID: ",
2297
+ video.id,
2298
+ " (ETA: ",
2299
+ video.eta,
2300
+ "s)"
2301
+ ]
2302
+ })
2303
+ }, idx))
2304
+ })
2305
+ ]
2306
+ }),
2307
+ hasAudio && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2308
+ className: cn("space-y-2 pt-1", mediaClassName),
2309
+ children: [
2310
+ /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2311
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2312
+ children: [
2313
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.Music, {
2314
+ className: "h-3.5 w-3.5"
2315
+ }),
2316
+ "Audio (",
2317
+ message.audio.length,
2318
+ ")"
2319
+ ]
2320
+ }),
2321
+ /* @__PURE__ */ jsx_runtime18.jsx("div", {
2322
+ className: "space-y-2",
2323
+ children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx_runtime18.jsx("div", {
2324
+ children: audio.url ? /* @__PURE__ */ jsx_runtime18.jsx("audio", {
2325
+ src: audio.url,
2326
+ controls: true,
2327
+ className: "w-full"
2328
+ }) : audio.base64_audio ? /* @__PURE__ */ jsx_runtime18.jsx("audio", {
2329
+ src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
2330
+ controls: true,
2331
+ className: "w-full"
2332
+ }) : /* @__PURE__ */ jsx_runtime18.jsx("div", {
2333
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
2334
+ children: "Audio data unavailable"
2335
+ })
2336
+ }, idx))
2337
+ })
2338
+ ]
2339
+ }),
2340
+ hasFiles && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2341
+ className: cn("space-y-2 pt-1", mediaClassName),
2342
+ children: [
2343
+ /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2344
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2345
+ children: [
2346
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.Paperclip, {
2347
+ className: "h-3.5 w-3.5"
2348
+ }),
2349
+ "Files (",
2350
+ message.files.length,
2351
+ ")"
2352
+ ]
2353
+ }),
2354
+ /* @__PURE__ */ jsx_runtime18.jsx("div", {
2355
+ className: "flex flex-wrap gap-2",
2356
+ children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime18.jsx(FilePreviewCard, {
2357
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
2358
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2359
+ }, idx) : /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2360
+ 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",
2361
+ children: [
2362
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.FileIcon, {
2363
+ className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
2364
+ }),
2365
+ /* @__PURE__ */ jsx_runtime18.jsx("span", {
2366
+ className: "truncate max-w-[180px]",
2367
+ children: file.name
2368
+ }),
2369
+ file.size && /* @__PURE__ */ jsx_runtime18.jsxs("span", {
2370
+ className: "text-muted-foreground/70",
2371
+ children: [
2372
+ "(",
2373
+ (file.size / 1024).toFixed(1),
2374
+ "KB)"
2375
+ ]
2376
+ }),
2377
+ file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime18.jsx("a", {
2378
+ href: file.url,
2379
+ target: "_blank",
2380
+ rel: "noopener noreferrer",
2381
+ className: "text-primary hover:underline font-medium",
2382
+ children: "View"
2383
+ })
2384
+ ]
2385
+ }, idx))
2386
+ })
2387
+ ]
2388
+ }),
2389
+ hasResponseAudio && message.response_audio && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2390
+ className: cn("space-y-2 pt-1", mediaClassName),
2391
+ children: [
2392
+ /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2393
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2394
+ children: [
2395
+ /* @__PURE__ */ jsx_runtime18.jsx(import_lucide_react10.Music, {
2396
+ className: "h-3.5 w-3.5"
2397
+ }),
2398
+ "Response Audio"
2399
+ ]
2400
+ }),
2401
+ message.response_audio.transcript && /* @__PURE__ */ jsx_runtime18.jsxs("div", {
2402
+ className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
2403
+ children: [
2404
+ '"',
2405
+ message.response_audio.transcript,
2406
+ '"'
2407
+ ]
2408
+ }),
2409
+ message.response_audio.content && /* @__PURE__ */ jsx_runtime18.jsx("audio", {
2410
+ src: `data:audio/wav;base64,${message.response_audio.content}`,
2411
+ controls: true,
2412
+ className: "w-full"
2413
+ })
2414
+ ]
2415
+ })
2416
+ ]
2417
+ });
2418
+ }
2419
+
2420
+ // src/ui/composed/agno-chat/context.ts
2421
+ var import_react12 = require("react");
2422
+ var AgnoChatContext = import_react12.createContext(null);
2423
+ function useAgnoChatContext() {
2424
+ const ctx = import_react12.useContext(AgnoChatContext);
2425
+ if (!ctx) {
2426
+ throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
2427
+ }
2428
+ return ctx;
2429
+ }
2430
+
2431
+ // src/ui/composed/agno-message/tools.tsx
2432
+ var jsx_runtime19 = require("react/jsx-runtime");
2433
+ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
2434
+ const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
2435
+ const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
2436
+ const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
2437
+ if (!message.tool_calls || message.tool_calls.length === 0)
2438
+ return null;
2439
+ return /* @__PURE__ */ jsx_runtime19.jsx("div", {
2440
+ className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
2441
+ children: message.tool_calls.map((tool, idx) => {
2442
+ const defaultRender = () => /* @__PURE__ */ jsx_runtime19.jsxs(jsx_runtime19.Fragment, {
2443
+ children: [
2444
+ /* @__PURE__ */ jsx_runtime19.jsx(ToolGenerativeUI, {
2445
+ tool
2446
+ }),
2447
+ isDebug ? /* @__PURE__ */ jsx_runtime19.jsx(ToolDebugCard, {
2448
+ tool,
2449
+ defaultOpen: idx === 0
2450
+ }) : null
2451
+ ]
2452
+ });
2453
+ const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
2454
+ if (node === null || node === undefined)
2455
+ return null;
2456
+ return /* @__PURE__ */ jsx_runtime19.jsx("div", {
2457
+ children: node
2458
+ }, tool.tool_call_id || idx);
2459
+ })
2460
+ });
2461
+ }
2462
+
2463
+ // src/ui/components/response.tsx
2464
+ var import_react13 = require("react");
2465
+ var import_streamdown = require("streamdown");
2466
+ var jsx_runtime20 = require("react/jsx-runtime");
2467
+ var Response = import_react13.memo(({ className, ...props }) => /* @__PURE__ */ jsx_runtime20.jsx(import_streamdown.Streamdown, {
2468
+ className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
2469
+ ...props
2470
+ }), (prevProps, nextProps) => prevProps.children === nextProps.children);
2471
+ Response.displayName = "Response";
2472
+
2473
+ // src/ui/composed/agno-message/content.tsx
2474
+ var jsx_runtime21 = require("react/jsx-runtime");
2475
+ function AgnoMessageContent() {
2476
+ const { message } = useAgnoMessageContext();
2477
+ if (!message.content)
2478
+ return null;
2479
+ return /* @__PURE__ */ jsx_runtime21.jsx("div", {
2480
+ 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",
2481
+ children: /* @__PURE__ */ jsx_runtime21.jsx(Response, {
2482
+ children: message.content
2483
+ })
2484
+ });
2485
+ }
2486
+
2487
+ // src/ui/composed/agno-message/references.tsx
2488
+ var import_lucide_react11 = require("lucide-react");
2489
+ var jsx_runtime22 = require("react/jsx-runtime");
2490
+ function AgnoMessageReferences() {
2491
+ const { message, classNames } = useAgnoMessageContext();
2492
+ const references = message.extra_data?.references;
2493
+ if (!references || references.length === 0)
2494
+ return null;
2495
+ return /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2496
+ className: cn("space-y-2 pt-1", classNames?.assistant?.references),
2497
+ children: [
2498
+ /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2499
+ className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
2500
+ children: [
2501
+ /* @__PURE__ */ jsx_runtime22.jsx(import_lucide_react11.FileText, {
2502
+ className: "h-3.5 w-3.5"
2503
+ }),
2504
+ "References (",
2505
+ references.length,
2506
+ ")"
2507
+ ]
2508
+ }),
2509
+ /* @__PURE__ */ jsx_runtime22.jsx("div", {
2510
+ className: "space-y-2",
2511
+ children: references.map((refData, idx) => /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2512
+ className: "text-xs space-y-1.5",
2513
+ children: [
2514
+ refData.query && /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2515
+ className: "font-medium text-foreground",
2516
+ children: [
2517
+ "Query: ",
2518
+ refData.query
2519
+ ]
2520
+ }),
2521
+ refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2522
+ className: "bg-muted/50 border border-border p-2.5 rounded-lg",
2523
+ children: [
2524
+ /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2525
+ className: "italic text-muted-foreground mb-1",
2526
+ children: [
2527
+ '"',
2528
+ ref.content,
2529
+ '"'
2530
+ ]
2531
+ }),
2532
+ /* @__PURE__ */ jsx_runtime22.jsxs("div", {
2533
+ className: "text-muted-foreground/70",
2534
+ children: [
2535
+ "Source: ",
2536
+ ref.name,
2537
+ " (chunk ",
2538
+ ref.meta_data.chunk,
2539
+ "/",
2540
+ ref.meta_data.chunk_size,
2541
+ ")"
2542
+ ]
2543
+ })
2544
+ ]
2545
+ }, refIdx))
2546
+ ]
2547
+ }, idx))
2548
+ })
2549
+ ]
2550
+ });
2551
+ }
2552
+
2553
+ // src/ui/composed/agno-message/footer.tsx
2554
+ var import_lucide_react12 = require("lucide-react");
2555
+ var jsx_runtime23 = require("react/jsx-runtime");
2556
+ function AgnoMessageFooter({ showTimestamp = true } = {}) {
2557
+ const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
2558
+ const hasError = message.streamingError;
2559
+ const isCustomTimestamp = !!formatTimestamp;
2560
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
2561
+ if (!actions?.assistant && !showTimestamp && !hasError)
2562
+ return null;
2563
+ return /* @__PURE__ */ jsx_runtime23.jsxs("div", {
2564
+ className: "flex items-center gap-2 pt-1",
2565
+ children: [
2566
+ actions?.assistant && (() => {
2567
+ const visibility = actions.visibility ?? "visible";
2568
+ if (visibility === "last-assistant" && !isLastAssistantMessage)
2569
+ return null;
2570
+ const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
2571
+ return /* @__PURE__ */ jsx_runtime23.jsx("div", {
2572
+ className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
2573
+ children: actions.assistant(message)
2574
+ });
2575
+ })(),
2576
+ hasError && /* @__PURE__ */ jsx_runtime23.jsxs("span", {
2577
+ className: "flex items-center gap-1 text-[11px] text-destructive",
2578
+ children: [
2579
+ /* @__PURE__ */ jsx_runtime23.jsx(import_lucide_react12.AlertCircle, {
2580
+ className: "h-3 w-3"
2581
+ }),
2582
+ "Error"
2583
+ ]
2584
+ }),
2585
+ showTimestamp && /* @__PURE__ */ jsx_runtime23.jsx(SmartTimestamp, {
2586
+ date: new Date(message.created_at * 1000),
2587
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
2588
+ className: "text-[11px] text-muted-foreground"
2589
+ })
2590
+ ]
2591
+ });
2592
+ }
2593
+
2594
+ // src/ui/composed/agno-message/message.tsx
2595
+ var jsx_runtime24 = require("react/jsx-runtime");
2596
+ function DefaultAssistantComposition({ showTimestamp }) {
2597
+ return /* @__PURE__ */ jsx_runtime24.jsxs(jsx_runtime24.Fragment, {
2598
+ children: [
2599
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageReasoning, {}),
2600
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageMedia, {}),
2601
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageTools, {}),
2602
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageContent, {}),
2603
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageReferences, {}),
2604
+ /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageFooter, {
2605
+ showTimestamp
2606
+ })
2607
+ ]
2608
+ });
2609
+ }
2610
+ function AgnoMessage({
2611
+ message,
2612
+ className,
2613
+ classNames,
2614
+ avatars,
2615
+ actions,
2616
+ isLastAssistantMessage = false,
2617
+ showFilePreview = true,
2618
+ showImageLightbox = true,
2619
+ showTimestamp = true,
2620
+ formatTimestamp,
2621
+ renderTool,
2622
+ children
2623
+ }) {
2624
+ const isUser = message.role === "user";
2625
+ const hasError = message.streamingError;
2626
+ const [preview, setPreview] = import_react14.useState(null);
2627
+ const isCustomTimestamp = !!formatTimestamp;
2628
+ const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
2629
+ const ctx = import_react14.useMemo(() => ({
2630
+ message,
2631
+ isLastAssistantMessage,
2632
+ classNames,
2633
+ actions,
2634
+ avatars,
2635
+ formatTimestamp,
2636
+ showFilePreview,
2637
+ showImageLightbox,
2638
+ openImageLightbox: (images, index) => {
2639
+ if (!showImageLightbox)
2640
+ return;
2641
+ setPreview({ type: "image", images, initialIndex: index });
2642
+ },
2643
+ openFilePreview: (file) => {
2644
+ if (!showFilePreview)
2645
+ return;
2646
+ setPreview({ type: "file", file });
2647
+ },
2648
+ renderTool
2649
+ }), [
2650
+ message,
2651
+ isLastAssistantMessage,
2652
+ classNames,
2653
+ actions,
2654
+ avatars,
2655
+ formatTimestamp,
2656
+ showFilePreview,
2657
+ showImageLightbox,
2658
+ renderTool
2659
+ ]);
2660
+ const closePreview = () => setPreview(null);
2661
+ return /* @__PURE__ */ jsx_runtime24.jsx(AgnoMessageContext.Provider, {
2662
+ value: ctx,
2663
+ children: /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2664
+ className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
2665
+ children: [
2666
+ isUser ? /* @__PURE__ */ jsx_runtime24.jsx(UserMessageLayout, {
2667
+ message,
2668
+ classNames,
2669
+ avatars,
2670
+ actions,
2671
+ isCustomTimestamp,
2672
+ resolvedFormatTimestamp,
2673
+ showTimestamp,
2674
+ showImageLightbox,
2675
+ showFilePreview,
2676
+ openImageLightbox: ctx.openImageLightbox,
2677
+ openFilePreview: ctx.openFilePreview,
2678
+ hasError
2679
+ }) : /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2680
+ className: "flex items-start gap-3 group/message",
2681
+ children: [
2682
+ avatars?.assistant,
2683
+ /* @__PURE__ */ jsx_runtime24.jsx("div", {
2684
+ className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
2685
+ children: children ?? /* @__PURE__ */ jsx_runtime24.jsx(DefaultAssistantComposition, {
2686
+ showTimestamp
2687
+ })
2688
+ })
2689
+ ]
2690
+ }),
2691
+ preview?.type === "image" && /* @__PURE__ */ jsx_runtime24.jsx(ImageLightbox, {
2692
+ open: true,
2693
+ onOpenChange: (open) => {
2694
+ if (!open)
2695
+ closePreview();
2696
+ },
2697
+ images: preview.images,
2698
+ initialIndex: preview.initialIndex
2699
+ }),
2700
+ preview?.type === "file" && /* @__PURE__ */ jsx_runtime24.jsx(FilePreviewModal, {
2701
+ open: true,
2702
+ onOpenChange: (open) => {
2703
+ if (!open)
2704
+ closePreview();
2705
+ },
2706
+ file: preview.file
2707
+ })
2708
+ ]
2709
+ })
2710
+ });
2711
+ }
2712
+ AgnoMessage.Reasoning = AgnoMessageReasoning;
2713
+ AgnoMessage.Media = AgnoMessageMedia;
2714
+ AgnoMessage.Tools = AgnoMessageTools;
2715
+ AgnoMessage.Content = AgnoMessageContent;
2716
+ AgnoMessage.References = AgnoMessageReferences;
2717
+ AgnoMessage.Footer = AgnoMessageFooter;
2718
+ function UserMessageLayout({
2719
+ message,
2720
+ classNames,
2721
+ avatars,
2722
+ actions,
2723
+ isCustomTimestamp,
2724
+ resolvedFormatTimestamp,
2725
+ showTimestamp,
2726
+ showImageLightbox,
2727
+ showFilePreview,
2728
+ openImageLightbox,
2729
+ openFilePreview,
2730
+ hasError
2731
+ }) {
2732
+ return /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2733
+ className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
2734
+ children: [
2735
+ avatars?.user,
2736
+ /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2737
+ className: "space-y-1.5 flex flex-col items-end min-w-0",
2738
+ children: [
2739
+ (message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2740
+ className: "flex flex-wrap gap-2 justify-end",
2741
+ children: [
2742
+ message.images?.map((img, idx) => /* @__PURE__ */ jsx_runtime24.jsx(FilePreviewCard, {
2743
+ file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
2744
+ onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
2745
+ }, `img-${idx}`)),
2746
+ message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2747
+ 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",
2748
+ children: [
2749
+ /* @__PURE__ */ jsx_runtime24.jsx(import_lucide_react13.Music, {
2750
+ className: "h-3.5 w-3.5 text-muted-foreground"
2751
+ }),
2752
+ /* @__PURE__ */ jsx_runtime24.jsx("span", {
2753
+ className: "truncate max-w-[150px]",
2754
+ children: audio.id || `Audio ${idx + 1}`
2755
+ })
2756
+ ]
2757
+ }, `audio-${idx}`)),
2758
+ message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime24.jsx(FilePreviewCard, {
2759
+ file: { name: file.name, type: file.type, url: file.url, size: file.size },
2760
+ onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
2761
+ }, `file-${idx}`) : /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2762
+ 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",
2763
+ children: [
2764
+ /* @__PURE__ */ jsx_runtime24.jsx(import_lucide_react13.FileIcon, {
2765
+ className: "h-3.5 w-3.5 text-muted-foreground"
2766
+ }),
2767
+ /* @__PURE__ */ jsx_runtime24.jsx("span", {
2768
+ className: "truncate max-w-[150px]",
2769
+ children: file.name
2770
+ })
2771
+ ]
2772
+ }, `file-${idx}`))
2773
+ ]
2774
+ }),
2775
+ message.content && /* @__PURE__ */ jsx_runtime24.jsx("div", {
2776
+ className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
2777
+ children: /* @__PURE__ */ jsx_runtime24.jsx("p", {
2778
+ className: "text-sm whitespace-pre-wrap",
2779
+ children: message.content
2780
+ })
2781
+ }),
2782
+ (showTimestamp || actions?.user) && /* @__PURE__ */ jsx_runtime24.jsxs("div", {
2783
+ className: "flex items-center justify-end gap-1.5 px-1",
2784
+ children: [
2785
+ actions?.user && /* @__PURE__ */ jsx_runtime24.jsx("div", {
2786
+ className: "flex items-center gap-1",
2787
+ children: actions.user(message)
2788
+ }),
2789
+ /* @__PURE__ */ jsx_runtime24.jsx(SmartTimestamp, {
2790
+ date: new Date(message.created_at * 1000),
2791
+ formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
2792
+ className: "text-[11px] text-muted-foreground"
2793
+ }),
2794
+ hasError && /* @__PURE__ */ jsx_runtime24.jsx(import_lucide_react13.AlertCircle, {
2795
+ className: "h-3 w-3 text-destructive"
2796
+ })
2797
+ ]
2798
+ })
2799
+ ]
2800
+ })
2801
+ ]
2802
+ });
2803
+ }
2804
+ // src/hooks/useAgnoCustomEvents.ts
2805
+ var import_react15 = require("react");
1155
2806
  function useAgnoCustomEvents(handler) {
1156
2807
  const client = useAgnoClient();
1157
- const [events, setEvents] = import_react8.useState([]);
1158
- const handlerRef = import_react8.useRef(handler);
2808
+ const [events, setEvents] = import_react15.useState([]);
2809
+ const handlerRef = import_react15.useRef(handler);
1159
2810
  handlerRef.current = handler;
1160
- import_react8.useEffect(() => {
2811
+ import_react15.useEffect(() => {
1161
2812
  const handleCustomEvent = (event) => {
1162
2813
  setEvents((prev) => [...prev, event]);
1163
2814
  handlerRef.current?.(event);
@@ -1167,20 +2818,20 @@ function useAgnoCustomEvents(handler) {
1167
2818
  client.off("custom:event", handleCustomEvent);
1168
2819
  };
1169
2820
  }, [client]);
1170
- const clearEvents = import_react8.useCallback(() => {
2821
+ const clearEvents = import_react15.useCallback(() => {
1171
2822
  setEvents([]);
1172
2823
  }, []);
1173
2824
  return { events, clearEvents };
1174
2825
  }
1175
2826
  // src/hooks/useAgnoMemory.ts
1176
- var import_react9 = require("react");
2827
+ var import_react16 = require("react");
1177
2828
  function useAgnoMemory() {
1178
2829
  const client = useAgnoClient();
1179
- const [memories, setMemories] = import_react9.useState([]);
1180
- const [topics, setTopics] = import_react9.useState([]);
1181
- const [isLoading, setIsLoading] = import_react9.useState(false);
1182
- const [error, setError] = import_react9.useState();
1183
- import_react9.useEffect(() => {
2830
+ const [memories, setMemories] = import_react16.useState([]);
2831
+ const [topics, setTopics] = import_react16.useState([]);
2832
+ const [isLoading, setIsLoading] = import_react16.useState(false);
2833
+ const [error, setError] = import_react16.useState();
2834
+ import_react16.useEffect(() => {
1184
2835
  const handleMemoryCreated = (memory) => {
1185
2836
  setMemories((prev) => [memory, ...prev]);
1186
2837
  };
@@ -1215,7 +2866,7 @@ function useAgnoMemory() {
1215
2866
  client.off("state:change", handleStateChange);
1216
2867
  };
1217
2868
  }, [client]);
1218
- const fetchMemories = import_react9.useCallback(async (queryParams, options) => {
2869
+ const fetchMemories = import_react16.useCallback(async (queryParams, options) => {
1219
2870
  setIsLoading(true);
1220
2871
  setError(undefined);
1221
2872
  try {
@@ -1230,7 +2881,7 @@ function useAgnoMemory() {
1230
2881
  setIsLoading(false);
1231
2882
  }
1232
2883
  }, [client]);
1233
- const getMemoryById = import_react9.useCallback(async (memoryId, options) => {
2884
+ const getMemoryById = import_react16.useCallback(async (memoryId, options) => {
1234
2885
  setIsLoading(true);
1235
2886
  setError(undefined);
1236
2887
  try {
@@ -1243,7 +2894,7 @@ function useAgnoMemory() {
1243
2894
  setIsLoading(false);
1244
2895
  }
1245
2896
  }, [client]);
1246
- const getMemoryTopics = import_react9.useCallback(async (options) => {
2897
+ const getMemoryTopics = import_react16.useCallback(async (options) => {
1247
2898
  setIsLoading(true);
1248
2899
  setError(undefined);
1249
2900
  try {
@@ -1258,7 +2909,7 @@ function useAgnoMemory() {
1258
2909
  setIsLoading(false);
1259
2910
  }
1260
2911
  }, [client]);
1261
- const getUserMemoryStats = import_react9.useCallback(async (queryParams, options) => {
2912
+ const getUserMemoryStats = import_react16.useCallback(async (queryParams, options) => {
1262
2913
  setIsLoading(true);
1263
2914
  setError(undefined);
1264
2915
  try {
@@ -1271,7 +2922,7 @@ function useAgnoMemory() {
1271
2922
  setIsLoading(false);
1272
2923
  }
1273
2924
  }, [client]);
1274
- const createMemory = import_react9.useCallback(async (request, options) => {
2925
+ const createMemory = import_react16.useCallback(async (request, options) => {
1275
2926
  setIsLoading(true);
1276
2927
  setError(undefined);
1277
2928
  try {
@@ -1284,7 +2935,7 @@ function useAgnoMemory() {
1284
2935
  setIsLoading(false);
1285
2936
  }
1286
2937
  }, [client]);
1287
- const updateMemory = import_react9.useCallback(async (memoryId, request, options) => {
2938
+ const updateMemory = import_react16.useCallback(async (memoryId, request, options) => {
1288
2939
  setIsLoading(true);
1289
2940
  setError(undefined);
1290
2941
  try {
@@ -1297,7 +2948,7 @@ function useAgnoMemory() {
1297
2948
  setIsLoading(false);
1298
2949
  }
1299
2950
  }, [client]);
1300
- const deleteMemory = import_react9.useCallback(async (memoryId, options) => {
2951
+ const deleteMemory = import_react16.useCallback(async (memoryId, options) => {
1301
2952
  setIsLoading(true);
1302
2953
  setError(undefined);
1303
2954
  try {
@@ -1310,7 +2961,7 @@ function useAgnoMemory() {
1310
2961
  setIsLoading(false);
1311
2962
  }
1312
2963
  }, [client]);
1313
- const deleteMultipleMemories = import_react9.useCallback(async (memoryIds, options) => {
2964
+ const deleteMultipleMemories = import_react16.useCallback(async (memoryIds, options) => {
1314
2965
  setIsLoading(true);
1315
2966
  setError(undefined);
1316
2967
  try {
@@ -1339,12 +2990,12 @@ function useAgnoMemory() {
1339
2990
  };
1340
2991
  }
1341
2992
  // src/hooks/useAgnoSessionState.ts
1342
- var import_react10 = require("react");
2993
+ var import_react17 = require("react");
1343
2994
  function useAgnoSessionState() {
1344
2995
  const client = useAgnoClient();
1345
- const [sessionState, setLocalSessionState] = import_react10.useState(() => client.getSessionState());
1346
- const [isRefreshing, setIsRefreshing] = import_react10.useState(() => client.getState().isSessionStateRefreshing ?? false);
1347
- import_react10.useEffect(() => {
2996
+ const [sessionState, setLocalSessionState] = import_react17.useState(() => client.getSessionState());
2997
+ const [isRefreshing, setIsRefreshing] = import_react17.useState(() => client.getState().isSessionStateRefreshing ?? false);
2998
+ import_react17.useEffect(() => {
1348
2999
  const handleStateChange = (state) => {
1349
3000
  setLocalSessionState(state);
1350
3001
  };
@@ -1361,16 +3012,16 @@ function useAgnoSessionState() {
1361
3012
  client.off("session-state:refresh:end", handleRefreshEnd);
1362
3013
  };
1363
3014
  }, [client]);
1364
- const setSessionState = import_react10.useCallback(async (next) => {
3015
+ const setSessionState = import_react17.useCallback(async (next) => {
1365
3016
  const resolved = typeof next === "function" ? next(client.getSessionState()) : next;
1366
3017
  await client.setSessionState(resolved);
1367
3018
  }, [client]);
1368
- const mergeSessionState = import_react10.useCallback(async (partial) => {
3019
+ const mergeSessionState = import_react17.useCallback(async (partial) => {
1369
3020
  const current = client.getSessionState() ?? {};
1370
3021
  const merged = { ...current, ...partial };
1371
3022
  await client.setSessionState(merged);
1372
3023
  }, [client]);
1373
- const refreshSessionState = import_react10.useCallback(async () => {
3024
+ const refreshSessionState = import_react17.useCallback(async () => {
1374
3025
  const result = await client.refreshSessionState();
1375
3026
  return result ?? null;
1376
3027
  }, [client]);
@@ -1383,14 +3034,14 @@ function useAgnoSessionState() {
1383
3034
  };
1384
3035
  }
1385
3036
  // src/hooks/useAgnoKnowledge.ts
1386
- var import_react11 = require("react");
3037
+ var import_react18 = require("react");
1387
3038
  function useAgnoKnowledge() {
1388
3039
  const client = useAgnoClient();
1389
- const [isLoading, setIsLoading] = import_react11.useState(false);
1390
- const [error, setError] = import_react11.useState();
1391
- const [config, setConfig] = import_react11.useState();
1392
- const [content, setContent] = import_react11.useState([]);
1393
- const getConfig = import_react11.useCallback(async (options) => {
3040
+ const [isLoading, setIsLoading] = import_react18.useState(false);
3041
+ const [error, setError] = import_react18.useState();
3042
+ const [config, setConfig] = import_react18.useState();
3043
+ const [content, setContent] = import_react18.useState([]);
3044
+ const getConfig = import_react18.useCallback(async (options) => {
1394
3045
  setIsLoading(true);
1395
3046
  setError(undefined);
1396
3047
  try {
@@ -1405,7 +3056,7 @@ function useAgnoKnowledge() {
1405
3056
  setIsLoading(false);
1406
3057
  }
1407
3058
  }, [client]);
1408
- const listContent = import_react11.useCallback(async (listOptions, options) => {
3059
+ const listContent = import_react18.useCallback(async (listOptions, options) => {
1409
3060
  setIsLoading(true);
1410
3061
  setError(undefined);
1411
3062
  try {
@@ -1420,7 +3071,7 @@ function useAgnoKnowledge() {
1420
3071
  setIsLoading(false);
1421
3072
  }
1422
3073
  }, [client]);
1423
- const getContent = import_react11.useCallback(async (contentId, options) => {
3074
+ const getContent = import_react18.useCallback(async (contentId, options) => {
1424
3075
  setIsLoading(true);
1425
3076
  setError(undefined);
1426
3077
  try {
@@ -1433,7 +3084,7 @@ function useAgnoKnowledge() {
1433
3084
  setIsLoading(false);
1434
3085
  }
1435
3086
  }, [client]);
1436
- const getContentStatus = import_react11.useCallback(async (contentId, options) => {
3087
+ const getContentStatus = import_react18.useCallback(async (contentId, options) => {
1437
3088
  setIsLoading(true);
1438
3089
  setError(undefined);
1439
3090
  try {
@@ -1446,7 +3097,7 @@ function useAgnoKnowledge() {
1446
3097
  setIsLoading(false);
1447
3098
  }
1448
3099
  }, [client]);
1449
- const search = import_react11.useCallback(async (request, options) => {
3100
+ const search = import_react18.useCallback(async (request, options) => {
1450
3101
  setIsLoading(true);
1451
3102
  setError(undefined);
1452
3103
  try {
@@ -1459,7 +3110,7 @@ function useAgnoKnowledge() {
1459
3110
  setIsLoading(false);
1460
3111
  }
1461
3112
  }, [client]);
1462
- const uploadContent = import_react11.useCallback(async (data, options) => {
3113
+ const uploadContent = import_react18.useCallback(async (data, options) => {
1463
3114
  setIsLoading(true);
1464
3115
  setError(undefined);
1465
3116
  try {
@@ -1474,7 +3125,7 @@ function useAgnoKnowledge() {
1474
3125
  setIsLoading(false);
1475
3126
  }
1476
3127
  }, [client]);
1477
- const updateContent = import_react11.useCallback(async (contentId, request, options) => {
3128
+ const updateContent = import_react18.useCallback(async (contentId, request, options) => {
1478
3129
  setIsLoading(true);
1479
3130
  setError(undefined);
1480
3131
  try {
@@ -1489,7 +3140,7 @@ function useAgnoKnowledge() {
1489
3140
  setIsLoading(false);
1490
3141
  }
1491
3142
  }, [client]);
1492
- const deleteAllContent = import_react11.useCallback(async (options) => {
3143
+ const deleteAllContent = import_react18.useCallback(async (options) => {
1493
3144
  setIsLoading(true);
1494
3145
  setError(undefined);
1495
3146
  try {
@@ -1503,7 +3154,7 @@ function useAgnoKnowledge() {
1503
3154
  setIsLoading(false);
1504
3155
  }
1505
3156
  }, [client]);
1506
- const deleteContent = import_react11.useCallback(async (contentId, options) => {
3157
+ const deleteContent = import_react18.useCallback(async (contentId, options) => {
1507
3158
  setIsLoading(true);
1508
3159
  setError(undefined);
1509
3160
  try {
@@ -1535,14 +3186,14 @@ function useAgnoKnowledge() {
1535
3186
  };
1536
3187
  }
1537
3188
  // src/hooks/useAgnoMetrics.ts
1538
- var import_react12 = require("react");
3189
+ var import_react19 = require("react");
1539
3190
  function useAgnoMetrics() {
1540
3191
  const client = useAgnoClient();
1541
- const [isLoading, setIsLoading] = import_react12.useState(false);
1542
- const [isRefreshing, setIsRefreshing] = import_react12.useState(false);
1543
- const [error, setError] = import_react12.useState();
1544
- const [metrics, setMetrics] = import_react12.useState();
1545
- const fetchMetrics = import_react12.useCallback(async (options) => {
3192
+ const [isLoading, setIsLoading] = import_react19.useState(false);
3193
+ const [isRefreshing, setIsRefreshing] = import_react19.useState(false);
3194
+ const [error, setError] = import_react19.useState();
3195
+ const [metrics, setMetrics] = import_react19.useState();
3196
+ const fetchMetrics = import_react19.useCallback(async (options) => {
1546
3197
  setIsLoading(true);
1547
3198
  setError(undefined);
1548
3199
  try {
@@ -1557,7 +3208,7 @@ function useAgnoMetrics() {
1557
3208
  setIsLoading(false);
1558
3209
  }
1559
3210
  }, [client]);
1560
- const refreshMetrics = import_react12.useCallback(async (options) => {
3211
+ const refreshMetrics = import_react19.useCallback(async (options) => {
1561
3212
  setIsRefreshing(true);
1562
3213
  setError(undefined);
1563
3214
  try {
@@ -1571,7 +3222,7 @@ function useAgnoMetrics() {
1571
3222
  setIsRefreshing(false);
1572
3223
  }
1573
3224
  }, [client]);
1574
- const clearMetrics = import_react12.useCallback(() => {
3225
+ const clearMetrics = import_react19.useCallback(() => {
1575
3226
  setMetrics(undefined);
1576
3227
  setError(undefined);
1577
3228
  }, []);
@@ -1586,14 +3237,14 @@ function useAgnoMetrics() {
1586
3237
  };
1587
3238
  }
1588
3239
  // src/hooks/useAgnoEvals.ts
1589
- var import_react13 = require("react");
3240
+ var import_react20 = require("react");
1590
3241
  function useAgnoEvals() {
1591
3242
  const client = useAgnoClient();
1592
- const [evalRuns, setEvalRuns] = import_react13.useState([]);
1593
- const [pagination, setPagination] = import_react13.useState();
1594
- const [isLoading, setIsLoading] = import_react13.useState(false);
1595
- const [error, setError] = import_react13.useState();
1596
- const listEvalRuns = import_react13.useCallback(async (listParams = {}, options) => {
3243
+ const [evalRuns, setEvalRuns] = import_react20.useState([]);
3244
+ const [pagination, setPagination] = import_react20.useState();
3245
+ const [isLoading, setIsLoading] = import_react20.useState(false);
3246
+ const [error, setError] = import_react20.useState();
3247
+ const listEvalRuns = import_react20.useCallback(async (listParams = {}, options) => {
1597
3248
  setIsLoading(true);
1598
3249
  setError(undefined);
1599
3250
  try {
@@ -1609,7 +3260,7 @@ function useAgnoEvals() {
1609
3260
  setIsLoading(false);
1610
3261
  }
1611
3262
  }, [client]);
1612
- const getEvalRun = import_react13.useCallback(async (evalRunId, options) => {
3263
+ const getEvalRun = import_react20.useCallback(async (evalRunId, options) => {
1613
3264
  setIsLoading(true);
1614
3265
  setError(undefined);
1615
3266
  try {
@@ -1622,7 +3273,7 @@ function useAgnoEvals() {
1622
3273
  setIsLoading(false);
1623
3274
  }
1624
3275
  }, [client]);
1625
- const executeEval = import_react13.useCallback(async (request, options) => {
3276
+ const executeEval = import_react20.useCallback(async (request, options) => {
1626
3277
  setIsLoading(true);
1627
3278
  setError(undefined);
1628
3279
  try {
@@ -1637,7 +3288,7 @@ function useAgnoEvals() {
1637
3288
  setIsLoading(false);
1638
3289
  }
1639
3290
  }, [client]);
1640
- const updateEvalRun = import_react13.useCallback(async (evalRunId, request, options) => {
3291
+ const updateEvalRun = import_react20.useCallback(async (evalRunId, request, options) => {
1641
3292
  setIsLoading(true);
1642
3293
  setError(undefined);
1643
3294
  try {
@@ -1652,7 +3303,7 @@ function useAgnoEvals() {
1652
3303
  setIsLoading(false);
1653
3304
  }
1654
3305
  }, [client]);
1655
- const deleteEvalRuns = import_react13.useCallback(async (evalRunIds, options) => {
3306
+ const deleteEvalRuns = import_react20.useCallback(async (evalRunIds, options) => {
1656
3307
  setIsLoading(true);
1657
3308
  setError(undefined);
1658
3309
  try {
@@ -1667,7 +3318,7 @@ function useAgnoEvals() {
1667
3318
  setIsLoading(false);
1668
3319
  }
1669
3320
  }, [client]);
1670
- const renameEvalRun = import_react13.useCallback(async (evalRunId, newName, options) => {
3321
+ const renameEvalRun = import_react20.useCallback(async (evalRunId, newName, options) => {
1671
3322
  return updateEvalRun(evalRunId, { name: newName }, options);
1672
3323
  }, [updateEvalRun]);
1673
3324
  return {
@@ -1684,14 +3335,14 @@ function useAgnoEvals() {
1684
3335
  };
1685
3336
  }
1686
3337
  // src/hooks/useAgnoTraces.ts
1687
- var import_react14 = require("react");
3338
+ var import_react21 = require("react");
1688
3339
  function useAgnoTraces() {
1689
3340
  const client = useAgnoClient();
1690
- const [traces, setTraces] = import_react14.useState([]);
1691
- const [traceSessionStats, setTraceSessionStats] = import_react14.useState([]);
1692
- const [isLoading, setIsLoading] = import_react14.useState(false);
1693
- const [error, setError] = import_react14.useState();
1694
- import_react14.useEffect(() => {
3341
+ const [traces, setTraces] = import_react21.useState([]);
3342
+ const [traceSessionStats, setTraceSessionStats] = import_react21.useState([]);
3343
+ const [isLoading, setIsLoading] = import_react21.useState(false);
3344
+ const [error, setError] = import_react21.useState();
3345
+ import_react21.useEffect(() => {
1695
3346
  const handleStateChange = () => {
1696
3347
  const state2 = client.getState();
1697
3348
  setTraces(state2.traces);
@@ -1705,7 +3356,7 @@ function useAgnoTraces() {
1705
3356
  client.off("state:change", handleStateChange);
1706
3357
  };
1707
3358
  }, [client]);
1708
- const fetchTraces = import_react14.useCallback(async (options = {}, requestOptions) => {
3359
+ const fetchTraces = import_react21.useCallback(async (options = {}, requestOptions) => {
1709
3360
  setIsLoading(true);
1710
3361
  setError(undefined);
1711
3362
  try {
@@ -1720,7 +3371,7 @@ function useAgnoTraces() {
1720
3371
  setIsLoading(false);
1721
3372
  }
1722
3373
  }, [client]);
1723
- const getTraceDetail = import_react14.useCallback(async (traceId, options = {}, requestOptions) => {
3374
+ const getTraceDetail = import_react21.useCallback(async (traceId, options = {}, requestOptions) => {
1724
3375
  setIsLoading(true);
1725
3376
  setError(undefined);
1726
3377
  try {
@@ -1733,7 +3384,7 @@ function useAgnoTraces() {
1733
3384
  setIsLoading(false);
1734
3385
  }
1735
3386
  }, [client]);
1736
- const fetchTraceSessionStats = import_react14.useCallback(async (options = {}, requestOptions) => {
3387
+ const fetchTraceSessionStats = import_react21.useCallback(async (options = {}, requestOptions) => {
1737
3388
  setIsLoading(true);
1738
3389
  setError(undefined);
1739
3390
  try {
@@ -1759,13 +3410,13 @@ function useAgnoTraces() {
1759
3410
  };
1760
3411
  }
1761
3412
  // src/hooks/useAgnoComponents.ts
1762
- var import_react15 = require("react");
3413
+ var import_react22 = require("react");
1763
3414
  function useAgnoComponents() {
1764
3415
  const client = useAgnoClient();
1765
- const [components, setComponents] = import_react15.useState([]);
1766
- const [isLoading, setIsLoading] = import_react15.useState(false);
1767
- const [error, setError] = import_react15.useState();
1768
- import_react15.useEffect(() => {
3416
+ const [components, setComponents] = import_react22.useState([]);
3417
+ const [isLoading, setIsLoading] = import_react22.useState(false);
3418
+ const [error, setError] = import_react22.useState();
3419
+ import_react22.useEffect(() => {
1769
3420
  const handleComponentCreated = (component) => {
1770
3421
  setComponents((prev) => [component, ...prev]);
1771
3422
  };
@@ -1790,7 +3441,7 @@ function useAgnoComponents() {
1790
3441
  client.off("state:change", handleStateChange);
1791
3442
  };
1792
3443
  }, [client]);
1793
- const fetchComponents = import_react15.useCallback(async (queryParams, options) => {
3444
+ const fetchComponents = import_react22.useCallback(async (queryParams, options) => {
1794
3445
  setIsLoading(true);
1795
3446
  setError(undefined);
1796
3447
  try {
@@ -1805,7 +3456,7 @@ function useAgnoComponents() {
1805
3456
  setIsLoading(false);
1806
3457
  }
1807
3458
  }, [client]);
1808
- const getComponentById = import_react15.useCallback(async (componentId, options) => {
3459
+ const getComponentById = import_react22.useCallback(async (componentId, options) => {
1809
3460
  setIsLoading(true);
1810
3461
  setError(undefined);
1811
3462
  try {
@@ -1818,7 +3469,7 @@ function useAgnoComponents() {
1818
3469
  setIsLoading(false);
1819
3470
  }
1820
3471
  }, [client]);
1821
- const createComponent = import_react15.useCallback(async (request, options) => {
3472
+ const createComponent = import_react22.useCallback(async (request, options) => {
1822
3473
  setIsLoading(true);
1823
3474
  setError(undefined);
1824
3475
  try {
@@ -1831,7 +3482,7 @@ function useAgnoComponents() {
1831
3482
  setIsLoading(false);
1832
3483
  }
1833
3484
  }, [client]);
1834
- const updateComponent = import_react15.useCallback(async (componentId, request, options) => {
3485
+ const updateComponent = import_react22.useCallback(async (componentId, request, options) => {
1835
3486
  setIsLoading(true);
1836
3487
  setError(undefined);
1837
3488
  try {
@@ -1844,7 +3495,7 @@ function useAgnoComponents() {
1844
3495
  setIsLoading(false);
1845
3496
  }
1846
3497
  }, [client]);
1847
- const deleteComponent = import_react15.useCallback(async (componentId, options) => {
3498
+ const deleteComponent = import_react22.useCallback(async (componentId, options) => {
1848
3499
  setIsLoading(true);
1849
3500
  setError(undefined);
1850
3501
  try {
@@ -1857,7 +3508,7 @@ function useAgnoComponents() {
1857
3508
  setIsLoading(false);
1858
3509
  }
1859
3510
  }, [client]);
1860
- const fetchComponentConfigs = import_react15.useCallback(async (componentId, options) => {
3511
+ const fetchComponentConfigs = import_react22.useCallback(async (componentId, options) => {
1861
3512
  setIsLoading(true);
1862
3513
  setError(undefined);
1863
3514
  try {
@@ -1870,7 +3521,7 @@ function useAgnoComponents() {
1870
3521
  setIsLoading(false);
1871
3522
  }
1872
3523
  }, [client]);
1873
- const createComponentConfig = import_react15.useCallback(async (componentId, request, options) => {
3524
+ const createComponentConfig = import_react22.useCallback(async (componentId, request, options) => {
1874
3525
  setIsLoading(true);
1875
3526
  setError(undefined);
1876
3527
  try {
@@ -1883,7 +3534,7 @@ function useAgnoComponents() {
1883
3534
  setIsLoading(false);
1884
3535
  }
1885
3536
  }, [client]);
1886
- const getCurrentComponentConfig = import_react15.useCallback(async (componentId, options) => {
3537
+ const getCurrentComponentConfig = import_react22.useCallback(async (componentId, options) => {
1887
3538
  setIsLoading(true);
1888
3539
  setError(undefined);
1889
3540
  try {
@@ -1896,7 +3547,7 @@ function useAgnoComponents() {
1896
3547
  setIsLoading(false);
1897
3548
  }
1898
3549
  }, [client]);
1899
- const getComponentConfigByVersion = import_react15.useCallback(async (componentId, version, options) => {
3550
+ const getComponentConfigByVersion = import_react22.useCallback(async (componentId, version, options) => {
1900
3551
  setIsLoading(true);
1901
3552
  setError(undefined);
1902
3553
  try {
@@ -1909,7 +3560,7 @@ function useAgnoComponents() {
1909
3560
  setIsLoading(false);
1910
3561
  }
1911
3562
  }, [client]);
1912
- const updateComponentConfig = import_react15.useCallback(async (componentId, version, request, options) => {
3563
+ const updateComponentConfig = import_react22.useCallback(async (componentId, version, request, options) => {
1913
3564
  setIsLoading(true);
1914
3565
  setError(undefined);
1915
3566
  try {
@@ -1922,7 +3573,7 @@ function useAgnoComponents() {
1922
3573
  setIsLoading(false);
1923
3574
  }
1924
3575
  }, [client]);
1925
- const deleteComponentConfig = import_react15.useCallback(async (componentId, version, options) => {
3576
+ const deleteComponentConfig = import_react22.useCallback(async (componentId, version, options) => {
1926
3577
  setIsLoading(true);
1927
3578
  setError(undefined);
1928
3579
  try {
@@ -1935,7 +3586,7 @@ function useAgnoComponents() {
1935
3586
  setIsLoading(false);
1936
3587
  }
1937
3588
  }, [client]);
1938
- const setCurrentComponentConfig = import_react15.useCallback(async (componentId, version, options) => {
3589
+ const setCurrentComponentConfig = import_react22.useCallback(async (componentId, version, options) => {
1939
3590
  setIsLoading(true);
1940
3591
  setError(undefined);
1941
3592
  try {
@@ -1967,4 +3618,4 @@ function useAgnoComponents() {
1967
3618
  };
1968
3619
  }
1969
3620
 
1970
- //# debugId=D27FED2F9BD03ABF64756E2164756E21
3621
+ //# debugId=0C208D91FC5F482E64756E2164756E21