@apteva/apteva-kit 0.1.105 → 0.1.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,13 +4,13 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
 
6
6
  // src/components/Chat/Chat.tsx
7
- import { useState as useState6, useEffect as useEffect6, useRef as useRef7, useMemo as useMemo2, forwardRef, useImperativeHandle } from "react";
7
+ import { useState as useState9, useEffect as useEffect7, useRef as useRef9, useMemo as useMemo2, useCallback as useCallback2, forwardRef, useImperativeHandle } from "react";
8
8
 
9
9
  // src/components/Chat/MessageList.tsx
10
- import { useEffect as useEffect5, useRef as useRef4 } from "react";
10
+ import { useEffect as useEffect6, useRef as useRef6 } from "react";
11
11
 
12
12
  // src/components/Chat/Message.tsx
13
- import { useEffect as useEffect4, useRef as useRef3, useMemo } from "react";
13
+ import { useEffect as useEffect5, useRef as useRef5, useMemo } from "react";
14
14
 
15
15
  // src/utils/cn.ts
16
16
  import { clsx } from "clsx";
@@ -1139,7 +1139,7 @@ function convertApiMessages(apiMessages) {
1139
1139
  }
1140
1140
 
1141
1141
  // src/components/Widgets/Widgets.tsx
1142
- import { useEffect as useEffect3 } from "react";
1142
+ import { useEffect as useEffect4 } from "react";
1143
1143
 
1144
1144
  // src/components/Widgets/widget-library/Card.tsx
1145
1145
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1438,14 +1438,19 @@ function Table({ widget, onAction }) {
1438
1438
  }
1439
1439
 
1440
1440
  // src/components/Widgets/widget-library/Form.tsx
1441
- import { useState as useState3 } from "react";
1441
+ import { useState as useState3, useRef as useRef3 } from "react";
1442
1442
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1443
1443
  function Form({ widget, onAction }) {
1444
1444
  const { title, fields } = widget.props;
1445
+ const fileInputRefs = useRef3({});
1445
1446
  const [formData, setFormData] = useState3(() => {
1446
1447
  const initial = {};
1447
1448
  fields.forEach((field) => {
1448
- initial[field.name] = field.defaultValue ?? (field.type === "checkbox" ? false : "");
1449
+ if (field.type === "file") {
1450
+ initial[field.name] = [];
1451
+ } else {
1452
+ initial[field.name] = field.defaultValue ?? (field.type === "checkbox" ? false : "");
1453
+ }
1449
1454
  });
1450
1455
  return initial;
1451
1456
  });
@@ -1524,6 +1529,70 @@ function Form({ widget, onAction }) {
1524
1529
  ),
1525
1530
  /* @__PURE__ */ jsx6("span", { className: "!text-neutral-700 dark:!text-neutral-300", children: field.label })
1526
1531
  ] });
1532
+ case "file": {
1533
+ const files = formData[field.name] || [];
1534
+ return /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
1535
+ /* @__PURE__ */ jsx6(
1536
+ "input",
1537
+ {
1538
+ ref: (el) => {
1539
+ fileInputRefs.current[field.name] = el;
1540
+ },
1541
+ type: "file",
1542
+ name: field.name,
1543
+ multiple: field.multiple ?? true,
1544
+ accept: field.accept,
1545
+ onChange: (e) => {
1546
+ const newFiles = Array.from(e.target.files || []);
1547
+ if (field.multiple !== false) {
1548
+ handleChange(field.name, [...files, ...newFiles]);
1549
+ } else {
1550
+ handleChange(field.name, newFiles);
1551
+ }
1552
+ if (fileInputRefs.current[field.name]) {
1553
+ fileInputRefs.current[field.name].value = "";
1554
+ }
1555
+ },
1556
+ className: "hidden"
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ jsx6(
1560
+ "button",
1561
+ {
1562
+ type: "button",
1563
+ onClick: () => fileInputRefs.current[field.name]?.click(),
1564
+ className: "w-full px-3 py-3 rounded-lg border-2 border-dashed transition-colors cursor-pointer border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800 !text-neutral-500 dark:!text-neutral-400 hover:border-blue-400 hover:!text-blue-500 !text-sm",
1565
+ children: field.placeholder || "Click to add files"
1566
+ }
1567
+ ),
1568
+ files.length > 0 && /* @__PURE__ */ jsx6("ul", { className: "space-y-1", children: files.map((file, idx) => /* @__PURE__ */ jsxs4(
1569
+ "li",
1570
+ {
1571
+ className: "flex items-center justify-between px-2 py-1.5 rounded-lg bg-neutral-50 dark:bg-neutral-800 !text-sm",
1572
+ children: [
1573
+ /* @__PURE__ */ jsxs4("span", { className: "!text-neutral-700 dark:!text-neutral-300 truncate mr-2", children: [
1574
+ file.name,
1575
+ /* @__PURE__ */ jsxs4("span", { className: "!text-neutral-400 ml-1", children: [
1576
+ "(",
1577
+ (file.size / 1024).toFixed(0),
1578
+ " KB)"
1579
+ ] })
1580
+ ] }),
1581
+ /* @__PURE__ */ jsx6(
1582
+ "button",
1583
+ {
1584
+ type: "button",
1585
+ onClick: () => handleChange(field.name, files.filter((_, i) => i !== idx)),
1586
+ className: "!text-neutral-400 hover:!text-red-500 transition-colors flex-shrink-0",
1587
+ children: "\u2715"
1588
+ }
1589
+ )
1590
+ ]
1591
+ },
1592
+ `${file.name}-${idx}`
1593
+ )) })
1594
+ ] });
1595
+ }
1527
1596
  default:
1528
1597
  return null;
1529
1598
  }
@@ -1785,9 +1854,10 @@ var trendIcons = {
1785
1854
  flat: { symbol: "\u2192", color: "text-neutral-400" }
1786
1855
  };
1787
1856
  function Kpi({ widget, onAction }) {
1788
- const { label = "", value = "", change, trend } = widget.props || {};
1857
+ const { title, label = "", value = "", change, trend } = widget.props || {};
1789
1858
  const trendInfo = trend ? trendIcons[trend] : null;
1790
1859
  return /* @__PURE__ */ jsxs7("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 p-5", children: [
1860
+ title && /* @__PURE__ */ jsx9("h3", { className: "!text-base font-semibold !text-neutral-900 dark:!text-white mb-3", children: title }),
1791
1861
  /* @__PURE__ */ jsx9("div", { className: "!text-sm font-medium !text-neutral-500 dark:!text-neutral-400 mb-1", children: label }),
1792
1862
  /* @__PURE__ */ jsxs7("div", { className: "flex items-end gap-2", children: [
1793
1863
  /* @__PURE__ */ jsx9("div", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white", children: value }),
@@ -1912,48 +1982,165 @@ function Spacer({ widget }) {
1912
1982
  return /* @__PURE__ */ jsx11("div", { className: heightClasses[height] || heightClasses.md });
1913
1983
  }
1914
1984
 
1915
- // src/components/Widgets/WidgetRenderer.tsx
1985
+ // src/components/Widgets/widget-library/LiveView.tsx
1986
+ import { useState as useState4, useCallback, useRef as useRef4, useEffect as useEffect3 } from "react";
1916
1987
  import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1988
+ function LiveView({ widget }) {
1989
+ const { src, title, height, aspectRatio = "16/9", allowFullscreen = true, sandbox, allow, refreshInterval, showToolbar = true } = widget.props;
1990
+ const iframeRef = useRef4(null);
1991
+ const [isLoading, setIsLoading] = useState4(true);
1992
+ const [hasError, setHasError] = useState4(false);
1993
+ const [refreshKey, setRefreshKey] = useState4(0);
1994
+ const handleRefresh = useCallback(() => {
1995
+ setIsLoading(true);
1996
+ setHasError(false);
1997
+ setRefreshKey((k) => k + 1);
1998
+ }, []);
1999
+ const handleFullscreen = useCallback(() => {
2000
+ iframeRef.current?.requestFullscreen?.();
2001
+ }, []);
2002
+ const handleOpenExternal = useCallback(() => {
2003
+ window.open(src, "_blank", "noopener,noreferrer");
2004
+ }, [src]);
2005
+ useEffect3(() => {
2006
+ if (!refreshInterval || refreshInterval <= 0) return;
2007
+ const interval = setInterval(handleRefresh, refreshInterval * 1e3);
2008
+ return () => clearInterval(interval);
2009
+ }, [refreshInterval, handleRefresh]);
2010
+ const aspectMap = { "16/9": "56.25%", "4/3": "75%", "1/1": "100%" };
2011
+ const useFixedHeight = !!height;
2012
+ return /* @__PURE__ */ jsxs8("div", { className: "rounded-xl overflow-hidden border border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900", children: [
2013
+ showToolbar && /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-3 py-2 bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
2014
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 min-w-0", children: [
2015
+ /* @__PURE__ */ jsx12("div", { className: cn(
2016
+ "w-2 h-2 rounded-full flex-shrink-0",
2017
+ hasError ? "bg-red-500" : isLoading ? "bg-amber-500 animate-pulse" : "bg-emerald-500"
2018
+ ) }),
2019
+ /* @__PURE__ */ jsx12("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300 truncate", children: title || "Live View" })
2020
+ ] }),
2021
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
2022
+ /* @__PURE__ */ jsx12(
2023
+ "button",
2024
+ {
2025
+ onClick: handleRefresh,
2026
+ className: "p-1.5 rounded-md text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
2027
+ title: "Refresh",
2028
+ children: /* @__PURE__ */ jsx12("svg", { className: "w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) })
2029
+ }
2030
+ ),
2031
+ /* @__PURE__ */ jsx12(
2032
+ "button",
2033
+ {
2034
+ onClick: handleOpenExternal,
2035
+ className: "p-1.5 rounded-md text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
2036
+ title: "Open in new tab",
2037
+ children: /* @__PURE__ */ jsx12("svg", { className: "w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })
2038
+ }
2039
+ ),
2040
+ allowFullscreen && /* @__PURE__ */ jsx12(
2041
+ "button",
2042
+ {
2043
+ onClick: handleFullscreen,
2044
+ className: "p-1.5 rounded-md text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
2045
+ title: "Fullscreen",
2046
+ children: /* @__PURE__ */ jsx12("svg", { className: "w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5" }) })
2047
+ }
2048
+ )
2049
+ ] })
2050
+ ] }),
2051
+ /* @__PURE__ */ jsxs8(
2052
+ "div",
2053
+ {
2054
+ className: "relative bg-white dark:bg-neutral-950",
2055
+ style: useFixedHeight ? { height } : { paddingBottom: aspectMap[aspectRatio] || aspectMap["16/9"] },
2056
+ children: [
2057
+ isLoading && /* @__PURE__ */ jsx12("div", { className: "absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-900 z-10", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-2", children: [
2058
+ /* @__PURE__ */ jsx12("div", { className: "w-6 h-6 border-2 border-neutral-300 dark:border-neutral-600 border-t-blue-500 rounded-full animate-spin" }),
2059
+ /* @__PURE__ */ jsx12("span", { className: "text-xs text-neutral-500", children: "Loading..." })
2060
+ ] }) }),
2061
+ hasError && /* @__PURE__ */ jsx12("div", { className: "absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-900 z-10", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center gap-2 text-center px-4", children: [
2062
+ /* @__PURE__ */ jsx12("svg", { className: "w-8 h-8 text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 1.5, children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z" }) }),
2063
+ /* @__PURE__ */ jsx12("span", { className: "text-sm text-neutral-500", children: "Failed to load" }),
2064
+ /* @__PURE__ */ jsx12(
2065
+ "button",
2066
+ {
2067
+ onClick: handleRefresh,
2068
+ className: "text-xs text-blue-500 hover:text-blue-600 underline",
2069
+ children: "Try again"
2070
+ }
2071
+ )
2072
+ ] }) }),
2073
+ /* @__PURE__ */ jsx12(
2074
+ "iframe",
2075
+ {
2076
+ ref: iframeRef,
2077
+ src,
2078
+ title: title || "Live View",
2079
+ className: cn(
2080
+ "border-0 bg-white dark:bg-neutral-950",
2081
+ useFixedHeight ? "w-full h-full" : "absolute inset-0 w-full h-full"
2082
+ ),
2083
+ allowFullScreen: allowFullscreen,
2084
+ sandbox,
2085
+ allow,
2086
+ onLoad: () => setIsLoading(false),
2087
+ onError: () => {
2088
+ setIsLoading(false);
2089
+ setHasError(true);
2090
+ }
2091
+ },
2092
+ refreshKey
2093
+ )
2094
+ ]
2095
+ }
2096
+ )
2097
+ ] });
2098
+ }
2099
+
2100
+ // src/components/Widgets/WidgetRenderer.tsx
2101
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1917
2102
  function WidgetRenderer({ widget, onAction }) {
1918
2103
  const renderWidget = () => {
1919
2104
  switch (widget.type) {
1920
2105
  case "card":
1921
- return /* @__PURE__ */ jsx12(Card, { widget, onAction });
2106
+ return /* @__PURE__ */ jsx13(Card, { widget, onAction });
1922
2107
  case "list":
1923
- return /* @__PURE__ */ jsx12(List, { widget, onAction });
2108
+ return /* @__PURE__ */ jsx13(List, { widget, onAction });
1924
2109
  case "button":
1925
- return /* @__PURE__ */ jsx12(Button, { widget, onAction });
2110
+ return /* @__PURE__ */ jsx13(Button, { widget, onAction });
1926
2111
  case "button_group":
1927
- return /* @__PURE__ */ jsx12(ButtonGroup, { widget, onAction });
2112
+ return /* @__PURE__ */ jsx13(ButtonGroup, { widget, onAction });
1928
2113
  case "table":
1929
- return /* @__PURE__ */ jsx12(Table, { widget, onAction });
2114
+ return /* @__PURE__ */ jsx13(Table, { widget, onAction });
1930
2115
  case "form":
1931
- return /* @__PURE__ */ jsx12(Form, { widget, onAction });
2116
+ return /* @__PURE__ */ jsx13(Form, { widget, onAction });
1932
2117
  case "image":
1933
- return /* @__PURE__ */ jsx12(Image, { widget });
2118
+ return /* @__PURE__ */ jsx13(Image, { widget });
1934
2119
  case "flow":
1935
- return /* @__PURE__ */ jsx12(Flow, { widget });
2120
+ return /* @__PURE__ */ jsx13(Flow, { widget });
1936
2121
  case "kpi":
1937
- return /* @__PURE__ */ jsx12(Kpi, { widget, onAction });
2122
+ return /* @__PURE__ */ jsx13(Kpi, { widget, onAction });
1938
2123
  case "text_block":
1939
- return /* @__PURE__ */ jsx12(TextBlock, { widget });
2124
+ return /* @__PURE__ */ jsx13(TextBlock, { widget });
1940
2125
  case "spacer":
1941
- return /* @__PURE__ */ jsx12(Spacer, { widget });
2126
+ return /* @__PURE__ */ jsx13(Spacer, { widget });
2127
+ case "live_view":
2128
+ return /* @__PURE__ */ jsx13(LiveView, { widget });
1942
2129
  default:
1943
- return /* @__PURE__ */ jsxs8("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
1944
- /* @__PURE__ */ jsxs8("p", { className: "text-sm text-yellow-800", children: [
2130
+ return /* @__PURE__ */ jsxs9("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
2131
+ /* @__PURE__ */ jsxs9("p", { className: "text-sm text-yellow-800", children: [
1945
2132
  "Unknown widget type: ",
1946
2133
  widget.type
1947
2134
  ] }),
1948
- /* @__PURE__ */ jsx12("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
2135
+ /* @__PURE__ */ jsx13("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
1949
2136
  ] });
1950
2137
  }
1951
2138
  };
1952
- return /* @__PURE__ */ jsx12("div", { className: "apteva-widget", children: renderWidget() });
2139
+ return /* @__PURE__ */ jsx13("div", { className: "apteva-widget", children: renderWidget() });
1953
2140
  }
1954
2141
 
1955
2142
  // src/components/Widgets/Widgets.tsx
1956
- import { jsx as jsx13 } from "react/jsx-runtime";
2143
+ import { jsx as jsx14 } from "react/jsx-runtime";
1957
2144
  function Widgets({
1958
2145
  widgets,
1959
2146
  onAction,
@@ -1963,7 +2150,7 @@ function Widgets({
1963
2150
  columns = 3,
1964
2151
  className
1965
2152
  }) {
1966
- useEffect3(() => {
2153
+ useEffect4(() => {
1967
2154
  widgets.forEach((widget) => {
1968
2155
  onWidgetMount?.(widget.id);
1969
2156
  });
@@ -1978,85 +2165,85 @@ function Widgets({
1978
2165
  normal: "gap-4",
1979
2166
  loose: "gap-6"
1980
2167
  };
1981
- return /* @__PURE__ */ jsx13("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx13(WidgetRenderer, { widget, onAction }, widget.id)) });
2168
+ return /* @__PURE__ */ jsx14("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx14(WidgetRenderer, { widget, onAction }, widget.id)) });
1982
2169
  }
1983
2170
 
1984
2171
  // src/components/Widgets/WidgetSkeleton.tsx
1985
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2172
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
1986
2173
  function WidgetSkeleton({ type, className }) {
1987
2174
  switch (type) {
1988
2175
  case "card":
1989
- return /* @__PURE__ */ jsx14("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ jsxs9("div", { className: "p-4 space-y-3", children: [
1990
- /* @__PURE__ */ jsx14("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" }),
1991
- /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" }),
1992
- /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6" })
2176
+ return /* @__PURE__ */ jsx15("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ jsxs10("div", { className: "p-4 space-y-3", children: [
2177
+ /* @__PURE__ */ jsx15("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" }),
2178
+ /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" }),
2179
+ /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6" })
1993
2180
  ] }) });
1994
2181
  case "list":
1995
- return /* @__PURE__ */ jsx14("div", { className: cn("apteva-widget-skeleton animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
1996
- /* @__PURE__ */ jsx14("div", { className: "w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0" }),
1997
- /* @__PURE__ */ jsxs9("div", { className: "flex-1 space-y-2", children: [
1998
- /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
1999
- /* @__PURE__ */ jsx14("div", { className: "h-2 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" })
2182
+ return /* @__PURE__ */ jsx15("div", { className: cn("apteva-widget-skeleton animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
2183
+ /* @__PURE__ */ jsx15("div", { className: "w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0" }),
2184
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 space-y-2", children: [
2185
+ /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
2186
+ /* @__PURE__ */ jsx15("div", { className: "h-2 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" })
2000
2187
  ] })
2001
2188
  ] }, i)) });
2002
2189
  case "button_group":
2003
- return /* @__PURE__ */ jsxs9("div", { className: cn("apteva-widget-skeleton animate-pulse flex gap-2", className), children: [
2004
- /* @__PURE__ */ jsx14("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
2005
- /* @__PURE__ */ jsx14("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
2006
- /* @__PURE__ */ jsx14("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" })
2190
+ return /* @__PURE__ */ jsxs10("div", { className: cn("apteva-widget-skeleton animate-pulse flex gap-2", className), children: [
2191
+ /* @__PURE__ */ jsx15("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
2192
+ /* @__PURE__ */ jsx15("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
2193
+ /* @__PURE__ */ jsx15("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" })
2007
2194
  ] });
2008
2195
  case "form":
2009
- return /* @__PURE__ */ jsxs9("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4", className), children: [
2010
- /* @__PURE__ */ jsx14("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
2011
- /* @__PURE__ */ jsxs9("div", { className: "space-y-3", children: [
2012
- /* @__PURE__ */ jsx14("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }),
2013
- /* @__PURE__ */ jsx14("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" })
2196
+ return /* @__PURE__ */ jsxs10("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4", className), children: [
2197
+ /* @__PURE__ */ jsx15("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
2198
+ /* @__PURE__ */ jsxs10("div", { className: "space-y-3", children: [
2199
+ /* @__PURE__ */ jsx15("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }),
2200
+ /* @__PURE__ */ jsx15("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" })
2014
2201
  ] }),
2015
- /* @__PURE__ */ jsx14("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
2202
+ /* @__PURE__ */ jsx15("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
2016
2203
  ] });
2017
2204
  case "chart":
2018
- return /* @__PURE__ */ jsxs9("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
2019
- /* @__PURE__ */ jsx14("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4" }),
2020
- /* @__PURE__ */ jsxs9("div", { className: "flex items-end gap-2 h-32", children: [
2021
- /* @__PURE__ */ jsx14("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2" }),
2022
- /* @__PURE__ */ jsx14("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-3/4" }),
2023
- /* @__PURE__ */ jsx14("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/3" }),
2024
- /* @__PURE__ */ jsx14("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-full" }),
2025
- /* @__PURE__ */ jsx14("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-2/3" })
2205
+ return /* @__PURE__ */ jsxs10("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
2206
+ /* @__PURE__ */ jsx15("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4" }),
2207
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-end gap-2 h-32", children: [
2208
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2" }),
2209
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-3/4" }),
2210
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/3" }),
2211
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-full" }),
2212
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-2/3" })
2026
2213
  ] })
2027
2214
  ] });
2028
2215
  case "image":
2029
- return /* @__PURE__ */ jsx14("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx14("div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
2216
+ return /* @__PURE__ */ jsx15("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx15("div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
2030
2217
  case "gallery":
2031
- return /* @__PURE__ */ jsx14("div", { className: cn("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx14("div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
2218
+ return /* @__PURE__ */ jsx15("div", { className: cn("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx15("div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
2032
2219
  case "map":
2033
- return /* @__PURE__ */ jsx14("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx14("div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsxs9("svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2034
- /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" }),
2035
- /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
2220
+ return /* @__PURE__ */ jsx15("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx15("div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsxs10("svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2221
+ /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" }),
2222
+ /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
2036
2223
  ] }) }) });
2037
2224
  case "table":
2038
- return /* @__PURE__ */ jsxs9("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
2039
- /* @__PURE__ */ jsxs9("div", { className: "flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
2040
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16" }) }),
2041
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20" }) }),
2042
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-14" }) })
2225
+ return /* @__PURE__ */ jsxs10("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
2226
+ /* @__PURE__ */ jsxs10("div", { className: "flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
2227
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16" }) }),
2228
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20" }) }),
2229
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-14" }) })
2043
2230
  ] }),
2044
- [1, 2, 3].map((i) => /* @__PURE__ */ jsxs9("div", { className: "flex border-b border-neutral-200 dark:border-neutral-800 last:border-b-0", children: [
2045
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-24" }) }),
2046
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16" }) }),
2047
- /* @__PURE__ */ jsx14("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20" }) })
2231
+ [1, 2, 3].map((i) => /* @__PURE__ */ jsxs10("div", { className: "flex border-b border-neutral-200 dark:border-neutral-800 last:border-b-0", children: [
2232
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-24" }) }),
2233
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16" }) }),
2234
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20" }) })
2048
2235
  ] }, i))
2049
2236
  ] });
2050
2237
  default:
2051
- return /* @__PURE__ */ jsxs9("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
2052
- /* @__PURE__ */ jsx14("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2" }),
2053
- /* @__PURE__ */ jsx14("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" })
2238
+ return /* @__PURE__ */ jsxs10("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
2239
+ /* @__PURE__ */ jsx15("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2" }),
2240
+ /* @__PURE__ */ jsx15("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" })
2054
2241
  ] });
2055
2242
  }
2056
2243
  }
2057
2244
 
2058
2245
  // src/components/Chat/MarkdownContent.tsx
2059
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2246
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2060
2247
  function isImageUrl(url) {
2061
2248
  const imageExtensions = /\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)(\?.*)?$/i;
2062
2249
  return imageExtensions.test(url);
@@ -2075,7 +2262,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
2075
2262
  const alt = match[1] || "";
2076
2263
  const src = match[2];
2077
2264
  result.push(
2078
- /* @__PURE__ */ jsx15(
2265
+ /* @__PURE__ */ jsx16(
2079
2266
  "img",
2080
2267
  {
2081
2268
  src,
@@ -2090,7 +2277,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
2090
2277
  const href = match[4];
2091
2278
  if (isImageUrl(href)) {
2092
2279
  result.push(
2093
- /* @__PURE__ */ jsx15(
2280
+ /* @__PURE__ */ jsx16(
2094
2281
  "img",
2095
2282
  {
2096
2283
  src: href,
@@ -2102,7 +2289,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
2102
2289
  );
2103
2290
  } else {
2104
2291
  result.push(
2105
- /* @__PURE__ */ jsx15(
2292
+ /* @__PURE__ */ jsx16(
2106
2293
  "a",
2107
2294
  {
2108
2295
  href,
@@ -2116,10 +2303,10 @@ function parseInlineMarkdown(text, keyPrefix = "") {
2116
2303
  );
2117
2304
  }
2118
2305
  } else if (match[5] !== void 0) {
2119
- result.push(/* @__PURE__ */ jsx15("strong", { children: match[6] }, `${keyPrefix}b${key++}`));
2306
+ result.push(/* @__PURE__ */ jsx16("strong", { children: match[6] }, `${keyPrefix}b${key++}`));
2120
2307
  } else if (match[7] !== void 0) {
2121
2308
  result.push(
2122
- /* @__PURE__ */ jsx15("code", { className: "apteva-md-inline-code", children: match[7] }, `${keyPrefix}code${key++}`)
2309
+ /* @__PURE__ */ jsx16("code", { className: "apteva-md-inline-code", children: match[7] }, `${keyPrefix}code${key++}`)
2123
2310
  );
2124
2311
  }
2125
2312
  lastIndex = match.index + match[0].length;
@@ -2139,7 +2326,7 @@ function parseMarkdown(content) {
2139
2326
  const h2Match = line.match(/^##\s+(.*)$/);
2140
2327
  if (h2Match) {
2141
2328
  result.push(
2142
- /* @__PURE__ */ jsx15("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
2329
+ /* @__PURE__ */ jsx16("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
2143
2330
  );
2144
2331
  i++;
2145
2332
  continue;
@@ -2147,7 +2334,7 @@ function parseMarkdown(content) {
2147
2334
  const h3Match = line.match(/^###\s+(.*)$/);
2148
2335
  if (h3Match) {
2149
2336
  result.push(
2150
- /* @__PURE__ */ jsx15("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
2337
+ /* @__PURE__ */ jsx16("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
2151
2338
  );
2152
2339
  i++;
2153
2340
  continue;
@@ -2160,7 +2347,7 @@ function parseMarkdown(content) {
2160
2347
  const itemMatch = lines[i].match(/^(\s*)([-*+])\s+(.*)$/);
2161
2348
  if (itemMatch && itemMatch[1].length === indent) {
2162
2349
  listItems.push(
2163
- /* @__PURE__ */ jsx15("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2350
+ /* @__PURE__ */ jsx16("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2164
2351
  );
2165
2352
  i++;
2166
2353
  } else {
@@ -2168,7 +2355,7 @@ function parseMarkdown(content) {
2168
2355
  }
2169
2356
  }
2170
2357
  result.push(
2171
- /* @__PURE__ */ jsx15("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
2358
+ /* @__PURE__ */ jsx16("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
2172
2359
  );
2173
2360
  continue;
2174
2361
  }
@@ -2180,7 +2367,7 @@ function parseMarkdown(content) {
2180
2367
  const itemMatch = lines[i].match(/^(\s*)(\d+)\.\s+(.*)$/);
2181
2368
  if (itemMatch && itemMatch[1].length === indent) {
2182
2369
  listItems.push(
2183
- /* @__PURE__ */ jsx15("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2370
+ /* @__PURE__ */ jsx16("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2184
2371
  );
2185
2372
  i++;
2186
2373
  } else {
@@ -2188,7 +2375,7 @@ function parseMarkdown(content) {
2188
2375
  }
2189
2376
  }
2190
2377
  result.push(
2191
- /* @__PURE__ */ jsx15("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
2378
+ /* @__PURE__ */ jsx16("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
2192
2379
  );
2193
2380
  continue;
2194
2381
  }
@@ -2211,19 +2398,19 @@ function parseMarkdown(content) {
2211
2398
  }
2212
2399
  }
2213
2400
  result.push(
2214
- /* @__PURE__ */ jsx15("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs10("table", { className: "apteva-md-table", children: [
2215
- /* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx15("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
2216
- /* @__PURE__ */ jsx15("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx15("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx15("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
2401
+ /* @__PURE__ */ jsx16("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs11("table", { className: "apteva-md-table", children: [
2402
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx16("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
2403
+ /* @__PURE__ */ jsx16("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx16("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx16("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
2217
2404
  ] }) }, `table-wrapper${key++}`)
2218
2405
  );
2219
2406
  continue;
2220
2407
  }
2221
2408
  }
2222
2409
  if (line === "") {
2223
- result.push(/* @__PURE__ */ jsx15("br", {}, `br${key++}`));
2410
+ result.push(/* @__PURE__ */ jsx16("br", {}, `br${key++}`));
2224
2411
  } else {
2225
2412
  result.push(
2226
- /* @__PURE__ */ jsxs10("span", { children: [
2413
+ /* @__PURE__ */ jsxs11("span", { children: [
2227
2414
  parseInlineMarkdown(line, `${key}`),
2228
2415
  i < lines.length - 1 ? "\n" : ""
2229
2416
  ] }, `p${key++}`)
@@ -2234,67 +2421,151 @@ function parseMarkdown(content) {
2234
2421
  return result;
2235
2422
  }
2236
2423
  function MarkdownContent({ content, className = "" }) {
2237
- return /* @__PURE__ */ jsx15("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
2424
+ return /* @__PURE__ */ jsx16("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
2238
2425
  }
2239
2426
 
2240
2427
  // src/components/Chat/ToolCall.tsx
2241
- import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2242
- function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOutput }) {
2428
+ import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2429
+ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOutput, variant = "card" }) {
2430
+ if (variant === "inline") {
2431
+ const statusText = status === "preparing" ? `${name} preparing...` : status === "running" ? streamOutput ? `${name} \xB7 ${streamOutput}` : `${name}...` : status === "error" ? `${name} failed` : name;
2432
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-inline", children: [
2433
+ /* @__PURE__ */ jsx17("div", { className: "apteva-tool-inline-line" }),
2434
+ /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-inline-content", children: [
2435
+ status === "running" || status === "preparing" ? /* @__PURE__ */ jsxs12("svg", { className: "apteva-tool-inline-icon apteva-tool-icon-spin", width: "14", height: "14", fill: "none", viewBox: "0 0 24 24", children: [
2436
+ /* @__PURE__ */ jsx17("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2437
+ /* @__PURE__ */ jsx17("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2438
+ ] }) : /* @__PURE__ */ jsx17("svg", { className: "apteva-tool-inline-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx17("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z", fill: "currentColor" }) }),
2439
+ /* @__PURE__ */ jsx17("span", { className: "apteva-tool-inline-text", children: statusText })
2440
+ ] }),
2441
+ /* @__PURE__ */ jsx17("div", { className: "apteva-tool-inline-line" })
2442
+ ] });
2443
+ }
2243
2444
  if (status === "preparing") {
2244
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
2245
- /* @__PURE__ */ jsxs11("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
2246
- /* @__PURE__ */ jsx16("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2247
- /* @__PURE__ */ jsx16("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2445
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
2446
+ /* @__PURE__ */ jsxs12("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
2447
+ /* @__PURE__ */ jsx17("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2448
+ /* @__PURE__ */ jsx17("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2248
2449
  ] }),
2249
- /* @__PURE__ */ jsxs11("span", { className: "apteva-tool-label", children: [
2250
- /* @__PURE__ */ jsx16("strong", { children: name }),
2251
- /* @__PURE__ */ jsx16("span", { className: "apteva-tool-status-text", children: " preparing..." })
2450
+ /* @__PURE__ */ jsxs12("span", { className: "apteva-tool-label", children: [
2451
+ /* @__PURE__ */ jsx17("strong", { children: name }),
2452
+ /* @__PURE__ */ jsx17("span", { className: "apteva-tool-status-text", children: " preparing..." })
2252
2453
  ] })
2253
2454
  ] });
2254
2455
  }
2255
2456
  if (status === "running") {
2256
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-tool-card apteva-tool-card-running", children: [
2257
- /* @__PURE__ */ jsxs11("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
2258
- /* @__PURE__ */ jsx16("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2259
- /* @__PURE__ */ jsx16("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2457
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-card apteva-tool-card-running", children: [
2458
+ /* @__PURE__ */ jsxs12("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
2459
+ /* @__PURE__ */ jsx17("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2460
+ /* @__PURE__ */ jsx17("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2260
2461
  ] }),
2261
- /* @__PURE__ */ jsxs11("span", { className: "apteva-tool-label", children: [
2262
- /* @__PURE__ */ jsx16("strong", { children: name }),
2263
- streamOutput ? /* @__PURE__ */ jsx16("span", { className: "apteva-tool-stream-separator", children: " \xB7 " }) : null,
2264
- streamOutput ? /* @__PURE__ */ jsx16("span", { className: "apteva-tool-stream-output", children: streamOutput }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
2265
- /* @__PURE__ */ jsx16("span", { className: "apteva-tool-status-text", children: " running" }),
2266
- /* @__PURE__ */ jsxs11("span", { className: "apteva-tool-dots", children: [
2267
- /* @__PURE__ */ jsx16("span", { children: "." }),
2268
- /* @__PURE__ */ jsx16("span", { children: "." }),
2269
- /* @__PURE__ */ jsx16("span", { children: "." })
2462
+ /* @__PURE__ */ jsxs12("span", { className: "apteva-tool-label", children: [
2463
+ /* @__PURE__ */ jsx17("strong", { children: name }),
2464
+ streamOutput ? /* @__PURE__ */ jsx17("span", { className: "apteva-tool-stream-separator", children: " \xB7 " }) : null,
2465
+ streamOutput ? /* @__PURE__ */ jsx17("span", { className: "apteva-tool-stream-output", children: streamOutput }) : /* @__PURE__ */ jsxs12(Fragment2, { children: [
2466
+ /* @__PURE__ */ jsx17("span", { className: "apteva-tool-status-text", children: " running" }),
2467
+ /* @__PURE__ */ jsxs12("span", { className: "apteva-tool-dots", children: [
2468
+ /* @__PURE__ */ jsx17("span", { children: "." }),
2469
+ /* @__PURE__ */ jsx17("span", { children: "." }),
2470
+ /* @__PURE__ */ jsx17("span", { children: "." })
2270
2471
  ] })
2271
2472
  ] })
2272
2473
  ] })
2273
2474
  ] });
2274
2475
  }
2275
2476
  if (status === "completed") {
2276
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
2277
- /* @__PURE__ */ jsx16("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
2278
- /* @__PURE__ */ jsx16("span", { className: "apteva-tool-label", children: name })
2477
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
2478
+ /* @__PURE__ */ jsx17("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
2479
+ /* @__PURE__ */ jsx17("span", { className: "apteva-tool-label", children: name })
2279
2480
  ] });
2280
2481
  }
2281
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
2282
- /* @__PURE__ */ jsx16("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }),
2283
- /* @__PURE__ */ jsxs11("span", { className: "apteva-tool-label", children: [
2482
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
2483
+ /* @__PURE__ */ jsx17("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }),
2484
+ /* @__PURE__ */ jsxs12("span", { className: "apteva-tool-label", children: [
2284
2485
  name,
2285
2486
  " failed"
2286
2487
  ] })
2287
2488
  ] });
2288
2489
  }
2289
2490
 
2491
+ // src/components/Chat/ToolCallGroup.tsx
2492
+ import { useState as useState5 } from "react";
2493
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
2494
+ function ToolCallGroup({ tools }) {
2495
+ const completed = tools.filter((t) => t.status === "completed").length;
2496
+ const errored = tools.filter((t) => t.status === "error").length;
2497
+ const running = tools.filter((t) => t.status === "running").length;
2498
+ const preparing = tools.filter((t) => t.status === "preparing").length;
2499
+ const total = tools.length;
2500
+ const allDone = completed + errored === total;
2501
+ const [expanded, setExpanded] = useState5(false);
2502
+ const isExpanded = allDone ? expanded : true;
2503
+ const activeStreamTool = tools.find((t) => t.status === "running" && t.streamOutput);
2504
+ const statusText = allDone ? `Used ${total} tools` : `Using ${total} tools${completed > 0 ? ` \xB7 ${completed}/${total} done` : ""}`;
2505
+ const cardClass = allDone ? errored > 0 ? "apteva-tool-group apteva-tool-group-error" : "apteva-tool-group apteva-tool-group-completed" : "apteva-tool-group apteva-tool-group-running";
2506
+ return /* @__PURE__ */ jsxs13("div", { className: cardClass, children: [
2507
+ /* @__PURE__ */ jsxs13(
2508
+ "button",
2509
+ {
2510
+ className: "apteva-tool-group-header",
2511
+ onClick: () => setExpanded(!expanded),
2512
+ children: [
2513
+ /* @__PURE__ */ jsxs13("div", { className: "apteva-tool-group-header-left", children: [
2514
+ allDone ? /* @__PURE__ */ jsx18("svg", { className: "apteva-tool-group-icon", width: "14", height: "14", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) : /* @__PURE__ */ jsxs13("svg", { className: "apteva-tool-group-icon apteva-tool-icon-spin", width: "14", height: "14", fill: "none", viewBox: "0 0 24 24", children: [
2515
+ /* @__PURE__ */ jsx18("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2516
+ /* @__PURE__ */ jsx18("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
2517
+ ] }),
2518
+ /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-status", children: statusText })
2519
+ ] }),
2520
+ /* @__PURE__ */ jsx18(
2521
+ "svg",
2522
+ {
2523
+ className: `apteva-tool-group-chevron ${isExpanded ? "apteva-tool-group-chevron-open" : ""}`,
2524
+ width: "14",
2525
+ height: "14",
2526
+ fill: "none",
2527
+ stroke: "currentColor",
2528
+ viewBox: "0 0 24 24",
2529
+ children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
2530
+ }
2531
+ )
2532
+ ]
2533
+ }
2534
+ ),
2535
+ !isExpanded && activeStreamTool && /* @__PURE__ */ jsxs13("div", { className: "apteva-tool-group-stream", children: [
2536
+ /* @__PURE__ */ jsxs13("span", { className: "apteva-tool-group-stream-name", children: [
2537
+ activeStreamTool.name,
2538
+ ":"
2539
+ ] }),
2540
+ /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-stream-text", children: activeStreamTool.streamOutput })
2541
+ ] }),
2542
+ isExpanded && /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-list", children: tools.map((tool) => /* @__PURE__ */ jsxs13("div", { className: "apteva-tool-group-item", children: [
2543
+ tool.status === "completed" ? /* @__PURE__ */ jsx18("svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-done", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) : tool.status === "error" ? /* @__PURE__ */ jsx18("svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-error", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-item-icon apteva-tool-group-item-spinner" }),
2544
+ /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-item-name", children: tool.name }),
2545
+ tool.streamOutput && tool.status === "running" && /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-item-stream", children: tool.streamOutput })
2546
+ ] }, tool.id)) })
2547
+ ] });
2548
+ }
2549
+
2550
+ // src/components/Chat/PersistentWidgetRef.tsx
2551
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
2552
+ function PersistentWidgetRef({ widget }) {
2553
+ const title = widget.props.title || widget.type.replace(/_/g, " ");
2554
+ return /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 px-3 py-2 rounded-lg bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 text-sm", children: [
2555
+ /* @__PURE__ */ jsx19("div", { className: "w-2 h-2 rounded-full bg-emerald-500 animate-pulse flex-shrink-0" }),
2556
+ /* @__PURE__ */ jsx19("span", { className: "text-neutral-600 dark:text-neutral-400 capitalize", children: title }),
2557
+ /* @__PURE__ */ jsx19("span", { className: "text-neutral-400 dark:text-neutral-500 text-xs ml-auto", children: "pinned above" })
2558
+ ] });
2559
+ }
2560
+
2290
2561
  // src/components/Chat/Message.tsx
2291
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2292
- function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2562
+ import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
2563
+ function Message({ message, onAction, enableWidgets, onWidgetRender, persistentWidgetIds, toolCallStyle = "card" }) {
2293
2564
  const isUser = message.role === "user";
2294
2565
  const contentSegments = message.metadata?.content_segments;
2295
2566
  const isStreaming = message.metadata?.isStreaming === true;
2296
2567
  const hasContent = message.content || contentSegments && contentSegments.length > 0;
2297
- const reportedWidgetsRef = useRef3(/* @__PURE__ */ new Set());
2568
+ const reportedWidgetsRef = useRef5(/* @__PURE__ */ new Set());
2298
2569
  const parsedWidgets = useMemo(() => {
2299
2570
  if (!enableWidgets || isUser || !message.content) {
2300
2571
  return [];
@@ -2302,7 +2573,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2302
2573
  const parsed = parseWidgetsFromText(message.content);
2303
2574
  return parsed.segments.filter((seg) => seg.type === "widget" && !!seg.widget).map((seg) => seg.widget);
2304
2575
  }, [enableWidgets, isUser, message.content]);
2305
- useEffect4(() => {
2576
+ useEffect5(() => {
2306
2577
  if (onWidgetRender && message.widgets) {
2307
2578
  for (const widget of message.widgets) {
2308
2579
  if (!reportedWidgetsRef.current.has(widget.id)) {
@@ -2312,7 +2583,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2312
2583
  }
2313
2584
  }
2314
2585
  }, [message.widgets, onWidgetRender]);
2315
- useEffect4(() => {
2586
+ useEffect5(() => {
2316
2587
  if (onWidgetRender && parsedWidgets.length > 0) {
2317
2588
  for (const widget of parsedWidgets) {
2318
2589
  if (!reportedWidgetsRef.current.has(widget.id)) {
@@ -2324,14 +2595,14 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2324
2595
  }, [parsedWidgets, onWidgetRender]);
2325
2596
  const renderTextContent = (text) => {
2326
2597
  if (!enableWidgets || isUser) {
2327
- return /* @__PURE__ */ jsx17(MarkdownContent, { content: text });
2598
+ return /* @__PURE__ */ jsx20(MarkdownContent, { content: text });
2328
2599
  }
2329
2600
  const parsed = parseWidgetsFromText(text);
2330
2601
  const cleanedText = parsed.segments.filter((seg) => seg.type === "text" && seg.content).map((seg) => seg.content).join("");
2331
2602
  if (!cleanedText.trim()) {
2332
2603
  return null;
2333
2604
  }
2334
- return /* @__PURE__ */ jsx17(MarkdownContent, { content: cleanedText });
2605
+ return /* @__PURE__ */ jsx20(MarkdownContent, { content: cleanedText });
2335
2606
  };
2336
2607
  const renderContentWithWidgets = () => {
2337
2608
  if (!enableWidgets || isUser || !message.content) {
@@ -2346,28 +2617,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2346
2617
  } else if (segment.type === "widget" && segment.widget) {
2347
2618
  if (textBuffer.trim()) {
2348
2619
  elements.push(
2349
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
2620
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
2350
2621
  );
2351
2622
  textBuffer = "";
2352
2623
  }
2353
2624
  elements.push(
2354
- /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
2625
+ /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
2355
2626
  );
2356
2627
  } else if (segment.type === "widget_pending" && segment.pendingType) {
2357
2628
  if (textBuffer.trim()) {
2358
2629
  elements.push(
2359
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
2630
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
2360
2631
  );
2361
2632
  textBuffer = "";
2362
2633
  }
2363
2634
  elements.push(
2364
- /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
2635
+ /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
2365
2636
  );
2366
2637
  }
2367
2638
  });
2368
2639
  if (textBuffer.trim()) {
2369
2640
  elements.push(
2370
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, "text-final")
2641
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, "text-final")
2371
2642
  );
2372
2643
  }
2373
2644
  return elements.length > 0 ? elements : null;
@@ -2376,11 +2647,11 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2376
2647
  const hasAttachments = attachments.length > 0;
2377
2648
  const renderAttachments = () => {
2378
2649
  if (!hasAttachments) return null;
2379
- return /* @__PURE__ */ jsx17("div", { className: "apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end", children: attachments.map((att, index) => {
2650
+ return /* @__PURE__ */ jsx20("div", { className: "apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end", children: attachments.map((att, index) => {
2380
2651
  const isImage = att.type.startsWith("image/");
2381
2652
  const isPdf = att.type === "application/pdf";
2382
2653
  if (isImage && att.preview) {
2383
- return /* @__PURE__ */ jsx17("div", { className: "apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm", children: /* @__PURE__ */ jsx17(
2654
+ return /* @__PURE__ */ jsx20("div", { className: "apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm", children: /* @__PURE__ */ jsx20(
2384
2655
  "img",
2385
2656
  {
2386
2657
  src: att.preview,
@@ -2389,15 +2660,15 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2389
2660
  }
2390
2661
  ) }, index);
2391
2662
  }
2392
- return /* @__PURE__ */ jsxs12(
2663
+ return /* @__PURE__ */ jsxs15(
2393
2664
  "div",
2394
2665
  {
2395
2666
  className: "apteva-attachment-doc flex items-center gap-3 px-4 py-3 bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-xl shadow-sm",
2396
2667
  children: [
2397
- /* @__PURE__ */ jsx17("div", { className: "w-10 h-10 flex items-center justify-center bg-red-100 dark:bg-red-900/30 rounded-lg text-red-600 dark:text-red-400", children: isPdf ? /* @__PURE__ */ jsx17("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }) : /* @__PURE__ */ jsx17("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }),
2398
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col min-w-0", children: [
2399
- /* @__PURE__ */ jsx17("span", { className: "text-sm font-medium text-neutral-800 dark:text-neutral-200 truncate max-w-[180px]", children: att.name }),
2400
- /* @__PURE__ */ jsxs12("span", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: [
2668
+ /* @__PURE__ */ jsx20("div", { className: "w-10 h-10 flex items-center justify-center bg-red-100 dark:bg-red-900/30 rounded-lg text-red-600 dark:text-red-400", children: isPdf ? /* @__PURE__ */ jsx20("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }) : /* @__PURE__ */ jsx20("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }),
2669
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-w-0", children: [
2670
+ /* @__PURE__ */ jsx20("span", { className: "text-sm font-medium text-neutral-800 dark:text-neutral-200 truncate max-w-[180px]", children: att.name }),
2671
+ /* @__PURE__ */ jsxs15("span", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: [
2401
2672
  isPdf ? "PDF" : "Document",
2402
2673
  " \xB7 ",
2403
2674
  formatFileSize(att.size)
@@ -2411,13 +2682,13 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2411
2682
  };
2412
2683
  const renderContent = () => {
2413
2684
  if (isUser) {
2414
- return /* @__PURE__ */ jsx17("div", { className: "apteva-message-text", children: message.content });
2685
+ return /* @__PURE__ */ jsx20("div", { className: "apteva-message-text", children: message.content });
2415
2686
  }
2416
2687
  if (isStreaming && !hasContent) {
2417
- return /* @__PURE__ */ jsxs12("div", { className: "apteva-typing-indicator", children: [
2418
- /* @__PURE__ */ jsx17("span", {}),
2419
- /* @__PURE__ */ jsx17("span", {}),
2420
- /* @__PURE__ */ jsx17("span", {})
2688
+ return /* @__PURE__ */ jsxs15("div", { className: "apteva-typing-indicator", children: [
2689
+ /* @__PURE__ */ jsx20("span", {}),
2690
+ /* @__PURE__ */ jsx20("span", {}),
2691
+ /* @__PURE__ */ jsx20("span", {})
2421
2692
  ] });
2422
2693
  }
2423
2694
  if (contentSegments && contentSegments.length > 0) {
@@ -2427,7 +2698,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2427
2698
  };
2428
2699
  const renderTextSegmentWithWidgets = (text, keyPrefix) => {
2429
2700
  if (!enableWidgets) {
2430
- return /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: text }) }) }, keyPrefix);
2701
+ return /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: text }) }) }, keyPrefix);
2431
2702
  }
2432
2703
  const parsed = parseWidgetsFromText(text);
2433
2704
  const elements = [];
@@ -2438,28 +2709,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2438
2709
  } else if (seg.type === "widget" && seg.widget) {
2439
2710
  if (textBuffer.trim()) {
2440
2711
  elements.push(
2441
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
2712
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
2442
2713
  );
2443
2714
  textBuffer = "";
2444
2715
  }
2445
2716
  elements.push(
2446
- /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetRenderer, { widget: seg.widget, onAction }) }, `${keyPrefix}-widget-${idx}`)
2717
+ /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(WidgetRenderer, { widget: seg.widget, onAction }) }, `${keyPrefix}-widget-${idx}`)
2447
2718
  );
2448
2719
  } else if (seg.type === "widget_pending" && seg.pendingType) {
2449
2720
  if (textBuffer.trim()) {
2450
2721
  elements.push(
2451
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
2722
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
2452
2723
  );
2453
2724
  textBuffer = "";
2454
2725
  }
2455
2726
  elements.push(
2456
- /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetSkeleton, { type: seg.pendingType }) }, `${keyPrefix}-pending-${idx}`)
2727
+ /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(WidgetSkeleton, { type: seg.pendingType }) }, `${keyPrefix}-pending-${idx}`)
2457
2728
  );
2458
2729
  }
2459
2730
  });
2460
2731
  if (textBuffer.trim()) {
2461
2732
  elements.push(
2462
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx17(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-final`)
2733
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx20(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-final`)
2463
2734
  );
2464
2735
  }
2465
2736
  return elements;
@@ -2468,55 +2739,121 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2468
2739
  if (!contentSegments || contentSegments.length === 0) {
2469
2740
  return null;
2470
2741
  }
2471
- const elements = [];
2742
+ const groups = [];
2743
+ let currentToolRun = [];
2744
+ const flushToolRun = () => {
2745
+ if (currentToolRun.length > 0) {
2746
+ groups.push({ type: "tools", tools: [...currentToolRun] });
2747
+ currentToolRun = [];
2748
+ }
2749
+ };
2472
2750
  contentSegments.forEach((segment, index) => {
2473
- if (segment.type === "text" && segment.content) {
2474
- const textElements = renderTextSegmentWithWidgets(segment.content, `seg-${index}`);
2751
+ if (segment.type === "tool") {
2752
+ currentToolRun.push(segment);
2753
+ } else {
2754
+ flushToolRun();
2755
+ if (segment.type === "text" && segment.content) {
2756
+ groups.push({ type: "text", content: segment.content, index });
2757
+ }
2758
+ }
2759
+ });
2760
+ flushToolRun();
2761
+ const elements = [];
2762
+ groups.forEach((group, groupIndex) => {
2763
+ if (group.type === "text") {
2764
+ const textElements = renderTextSegmentWithWidgets(group.content, `seg-${group.index}`);
2475
2765
  if (Array.isArray(textElements)) {
2476
2766
  elements.push(...textElements);
2477
2767
  } else {
2478
2768
  elements.push(textElements);
2479
2769
  }
2480
- } else if (segment.type === "tool") {
2481
- elements.push(
2482
- /* @__PURE__ */ jsx17("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx17(
2483
- ToolCall,
2484
- {
2485
- name: segment.name,
2486
- status: segment.status || (segment.result !== void 0 ? "completed" : "running"),
2487
- isReceiving: segment.isReceiving,
2488
- inputLength: segment.inputLength,
2489
- streamOutput: segment.streamOutput
2770
+ } else if (group.type === "tools") {
2771
+ if (toolCallStyle === "inline") {
2772
+ group.tools.forEach((segment) => {
2773
+ if (segment.type === "tool") {
2774
+ elements.push(
2775
+ /* @__PURE__ */ jsx20("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx20(
2776
+ ToolCall,
2777
+ {
2778
+ name: segment.name,
2779
+ status: segment.status || (segment.result !== void 0 ? "completed" : "running"),
2780
+ isReceiving: segment.isReceiving,
2781
+ inputLength: segment.inputLength,
2782
+ streamOutput: segment.streamOutput,
2783
+ variant: "inline"
2784
+ }
2785
+ ) }, segment.id)
2786
+ );
2490
2787
  }
2491
- ) }, segment.id)
2492
- );
2788
+ });
2789
+ } else if (group.tools.length >= 3) {
2790
+ const toolData = group.tools.map((t) => {
2791
+ const tool = t;
2792
+ return {
2793
+ id: tool.id,
2794
+ name: tool.name,
2795
+ status: tool.status || (tool.result !== void 0 ? "completed" : "running"),
2796
+ isReceiving: tool.isReceiving,
2797
+ streamOutput: tool.streamOutput
2798
+ };
2799
+ });
2800
+ elements.push(
2801
+ /* @__PURE__ */ jsx20("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx20(ToolCallGroup, { tools: toolData }) }, `tool-group-${groupIndex}`)
2802
+ );
2803
+ } else {
2804
+ group.tools.forEach((segment) => {
2805
+ if (segment.type === "tool") {
2806
+ elements.push(
2807
+ /* @__PURE__ */ jsx20("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx20(
2808
+ ToolCall,
2809
+ {
2810
+ name: segment.name,
2811
+ status: segment.status || (segment.result !== void 0 ? "completed" : "running"),
2812
+ isReceiving: segment.isReceiving,
2813
+ inputLength: segment.inputLength,
2814
+ streamOutput: segment.streamOutput
2815
+ }
2816
+ ) }, segment.id)
2817
+ );
2818
+ }
2819
+ });
2820
+ }
2493
2821
  }
2494
2822
  });
2495
2823
  return elements;
2496
2824
  };
2825
+ const renderMessageWidgets = () => {
2826
+ if (!message.widgets || message.widgets.length === 0) return null;
2827
+ const inlineWidgets = message.widgets.filter((w) => !persistentWidgetIds?.has(w.id));
2828
+ const persistentRefs = message.widgets.filter((w) => persistentWidgetIds?.has(w.id));
2829
+ return /* @__PURE__ */ jsxs15(Fragment3, { children: [
2830
+ persistentRefs.map((w) => /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(PersistentWidgetRef, { widget: w }) }, `ref-${w.id}`)),
2831
+ inlineWidgets.length > 0 && /* @__PURE__ */ jsx20("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx20(Widgets, { widgets: inlineWidgets, onAction, layout: "stack" }) })
2832
+ ] });
2833
+ };
2497
2834
  if (!isUser && (contentSegments && contentSegments.length > 0)) {
2498
- return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented", children: [
2835
+ return /* @__PURE__ */ jsxs15("div", { className: "apteva-message-segmented", children: [
2499
2836
  renderSegmentedContent(),
2500
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2501
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2837
+ renderMessageWidgets(),
2838
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2502
2839
  ] });
2503
2840
  }
2504
2841
  const widgetContent = renderContentWithWidgets();
2505
2842
  if (!isUser && enableWidgets && widgetContent) {
2506
- return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented", children: [
2843
+ return /* @__PURE__ */ jsxs15("div", { className: "apteva-message-segmented", children: [
2507
2844
  widgetContent,
2508
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2509
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2845
+ renderMessageWidgets(),
2846
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2510
2847
  ] });
2511
2848
  }
2512
2849
  if (isUser && hasAttachments) {
2513
- return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end", children: [
2850
+ return /* @__PURE__ */ jsxs15("div", { className: "apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end", children: [
2514
2851
  renderAttachments(),
2515
- message.content && /* @__PURE__ */ jsx17("div", { className: "apteva-message-bubble apteva-message-user", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-content-user", children: /* @__PURE__ */ jsx17("div", { className: "apteva-message-text", children: message.content }) }) }),
2516
- /* @__PURE__ */ jsx17("div", { className: "apteva-message-timestamp apteva-message-timestamp-user", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2852
+ message.content && /* @__PURE__ */ jsx20("div", { className: "apteva-message-bubble apteva-message-user", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-content-user", children: /* @__PURE__ */ jsx20("div", { className: "apteva-message-text", children: message.content }) }) }),
2853
+ /* @__PURE__ */ jsx20("div", { className: "apteva-message-timestamp apteva-message-timestamp-user", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2517
2854
  ] });
2518
2855
  }
2519
- return /* @__PURE__ */ jsxs12(
2856
+ return /* @__PURE__ */ jsxs15(
2520
2857
  "div",
2521
2858
  {
2522
2859
  className: cn(
@@ -2524,17 +2861,17 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2524
2861
  isUser ? "apteva-message-user" : "apteva-message-assistant"
2525
2862
  ),
2526
2863
  children: [
2527
- /* @__PURE__ */ jsx17("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
2528
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2529
- /* @__PURE__ */ jsx17("div", { className: cn("apteva-message-timestamp", isUser ? "apteva-message-timestamp-user" : "apteva-message-timestamp-assistant"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2864
+ /* @__PURE__ */ jsx20("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
2865
+ renderMessageWidgets(),
2866
+ /* @__PURE__ */ jsx20("div", { className: cn("apteva-message-timestamp", isUser ? "apteva-message-timestamp-user" : "apteva-message-timestamp-assistant"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
2530
2867
  ]
2531
2868
  }
2532
2869
  );
2533
2870
  }
2534
2871
 
2535
2872
  // src/components/Chat/WelcomeScreen.tsx
2536
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
2537
- var DefaultIcon = () => /* @__PURE__ */ jsx18("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18(
2873
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
2874
+ var DefaultIcon = () => /* @__PURE__ */ jsx21("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21(
2538
2875
  "path",
2539
2876
  {
2540
2877
  strokeLinecap: "round",
@@ -2543,7 +2880,7 @@ var DefaultIcon = () => /* @__PURE__ */ jsx18("svg", { className: "w-12 h-12 sm:
2543
2880
  d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
2544
2881
  }
2545
2882
  ) });
2546
- var ArrowIcon = () => /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
2883
+ var ArrowIcon = () => /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
2547
2884
  function WelcomeScreen({
2548
2885
  title,
2549
2886
  subtitle,
@@ -2559,18 +2896,18 @@ function WelcomeScreen({
2559
2896
  const hasPrompts = normalizedPrompts.length > 0;
2560
2897
  const hasHeader = title || subtitle || icon;
2561
2898
  if (!hasHeader && !hasPrompts) {
2562
- return /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center h-full !text-neutral-500 dark:!text-neutral-400", children: /* @__PURE__ */ jsxs13("div", { className: "text-center space-y-2", children: [
2563
- /* @__PURE__ */ jsx18("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx18(DefaultIcon, {}) }),
2564
- /* @__PURE__ */ jsx18("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
2899
+ return /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center h-full !text-neutral-500 dark:!text-neutral-400", children: /* @__PURE__ */ jsxs16("div", { className: "text-center space-y-2", children: [
2900
+ /* @__PURE__ */ jsx21("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx21(DefaultIcon, {}) }),
2901
+ /* @__PURE__ */ jsx21("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
2565
2902
  ] }) });
2566
2903
  }
2567
2904
  if (variant === "minimal") {
2568
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col h-full px-4 py-4", children: [
2569
- hasHeader && /* @__PURE__ */ jsxs13("div", { className: "mb-4", children: [
2570
- title && /* @__PURE__ */ jsx18("h2", { className: "text-lg font-semibold !text-neutral-900 dark:!text-white", children: title }),
2571
- subtitle && /* @__PURE__ */ jsx18("p", { className: "text-sm !text-neutral-500 dark:!text-neutral-400 mt-1", children: subtitle })
2905
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col h-full px-4 py-4", children: [
2906
+ hasHeader && /* @__PURE__ */ jsxs16("div", { className: "mb-4", children: [
2907
+ title && /* @__PURE__ */ jsx21("h2", { className: "text-lg font-semibold !text-neutral-900 dark:!text-white", children: title }),
2908
+ subtitle && /* @__PURE__ */ jsx21("p", { className: "text-sm !text-neutral-500 dark:!text-neutral-400 mt-1", children: subtitle })
2572
2909
  ] }),
2573
- hasPrompts && /* @__PURE__ */ jsx18("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx18(
2910
+ hasPrompts && /* @__PURE__ */ jsx21("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx21(
2574
2911
  "button",
2575
2912
  {
2576
2913
  onClick: () => onPromptClick(prompt.text),
@@ -2583,11 +2920,11 @@ function WelcomeScreen({
2583
2920
  "transition-all duration-200",
2584
2921
  "group"
2585
2922
  ),
2586
- children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2587
- /* @__PURE__ */ jsx18("div", { className: "flex-shrink-0 !text-neutral-400 dark:!text-neutral-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx18(ArrowIcon, {}) }),
2588
- /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
2589
- /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white truncate", children: prompt.text }),
2590
- prompt.description && /* @__PURE__ */ jsx18("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 truncate", children: prompt.description })
2923
+ children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3", children: [
2924
+ /* @__PURE__ */ jsx21("div", { className: "flex-shrink-0 !text-neutral-400 dark:!text-neutral-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx21(ArrowIcon, {}) }),
2925
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
2926
+ /* @__PURE__ */ jsx21("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white truncate", children: prompt.text }),
2927
+ prompt.description && /* @__PURE__ */ jsx21("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 truncate", children: prompt.description })
2591
2928
  ] })
2592
2929
  ] })
2593
2930
  },
@@ -2595,14 +2932,14 @@ function WelcomeScreen({
2595
2932
  )) })
2596
2933
  ] });
2597
2934
  }
2598
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
2599
- /* @__PURE__ */ jsxs13("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
2600
- /* @__PURE__ */ jsx18("div", { className: "mb-4 !text-neutral-400 dark:!text-neutral-500 flex justify-center", children: icon || /* @__PURE__ */ jsx18(DefaultIcon, {}) }),
2601
- title && /* @__PURE__ */ jsx18("h1", { className: "text-xl sm:text-2xl font-semibold !text-neutral-900 dark:!text-white mb-2", children: title }),
2602
- subtitle && /* @__PURE__ */ jsx18("p", { className: "text-sm sm:text-base !text-neutral-500 dark:!text-neutral-400", children: subtitle })
2935
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
2936
+ /* @__PURE__ */ jsxs16("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
2937
+ /* @__PURE__ */ jsx21("div", { className: "mb-4 !text-neutral-400 dark:!text-neutral-500 flex justify-center", children: icon || /* @__PURE__ */ jsx21(DefaultIcon, {}) }),
2938
+ title && /* @__PURE__ */ jsx21("h1", { className: "text-xl sm:text-2xl font-semibold !text-neutral-900 dark:!text-white mb-2", children: title }),
2939
+ subtitle && /* @__PURE__ */ jsx21("p", { className: "text-sm sm:text-base !text-neutral-500 dark:!text-neutral-400", children: subtitle })
2603
2940
  ] }),
2604
- hasPrompts && /* @__PURE__ */ jsxs13("div", { className: "w-full max-w-2xl", children: [
2605
- /* @__PURE__ */ jsx18("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx18(
2941
+ hasPrompts && /* @__PURE__ */ jsxs16("div", { className: "w-full max-w-2xl", children: [
2942
+ /* @__PURE__ */ jsx21("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx21(
2606
2943
  "button",
2607
2944
  {
2608
2945
  onClick: () => onPromptClick(prompt.text),
@@ -2617,20 +2954,20 @@ function WelcomeScreen({
2617
2954
  "shadow-sm hover:shadow",
2618
2955
  "group"
2619
2956
  ),
2620
- children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2621
- /* @__PURE__ */ jsx18("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx18(ArrowIcon, {}) }),
2622
- /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
2623
- /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white", children: prompt.text }),
2624
- prompt.description && /* @__PURE__ */ jsx18("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 line-clamp-1", children: prompt.description })
2957
+ children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3", children: [
2958
+ /* @__PURE__ */ jsx21("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx21(ArrowIcon, {}) }),
2959
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
2960
+ /* @__PURE__ */ jsx21("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white", children: prompt.text }),
2961
+ prompt.description && /* @__PURE__ */ jsx21("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 line-clamp-1", children: prompt.description })
2625
2962
  ] }),
2626
- /* @__PURE__ */ jsx18(
2963
+ /* @__PURE__ */ jsx21(
2627
2964
  "svg",
2628
2965
  {
2629
2966
  className: "w-4 h-4 !text-neutral-400 group-hover:!text-blue-500 transition-colors flex-shrink-0",
2630
2967
  fill: "none",
2631
2968
  stroke: "currentColor",
2632
2969
  viewBox: "0 0 24 24",
2633
- children: /* @__PURE__ */ jsx18(
2970
+ children: /* @__PURE__ */ jsx21(
2634
2971
  "path",
2635
2972
  {
2636
2973
  strokeLinecap: "round",
@@ -2645,7 +2982,7 @@ function WelcomeScreen({
2645
2982
  },
2646
2983
  index
2647
2984
  )) }),
2648
- /* @__PURE__ */ jsx18("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx18(
2985
+ /* @__PURE__ */ jsx21("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx21(
2649
2986
  "button",
2650
2987
  {
2651
2988
  onClick: () => onPromptClick(prompt.text),
@@ -2660,11 +2997,11 @@ function WelcomeScreen({
2660
2997
  "transition-all duration-200",
2661
2998
  "group"
2662
2999
  ),
2663
- children: /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3", children: [
2664
- /* @__PURE__ */ jsx18("div", { className: "flex-shrink-0 w-9 h-9 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx18(ArrowIcon, {}) }),
2665
- /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
2666
- /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white leading-snug", children: prompt.text }),
2667
- prompt.description && /* @__PURE__ */ jsx18("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-1 line-clamp-2", children: prompt.description })
3000
+ children: /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3", children: [
3001
+ /* @__PURE__ */ jsx21("div", { className: "flex-shrink-0 w-9 h-9 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx21(ArrowIcon, {}) }),
3002
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
3003
+ /* @__PURE__ */ jsx21("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white leading-snug", children: prompt.text }),
3004
+ prompt.description && /* @__PURE__ */ jsx21("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-1 line-clamp-2", children: prompt.description })
2668
3005
  ] })
2669
3006
  ] })
2670
3007
  },
@@ -2675,7 +3012,7 @@ function WelcomeScreen({
2675
3012
  }
2676
3013
 
2677
3014
  // src/components/Chat/MessageList.tsx
2678
- import { jsx as jsx19 } from "react/jsx-runtime";
3015
+ import { jsx as jsx22 } from "react/jsx-runtime";
2679
3016
  function MessageList({
2680
3017
  messages,
2681
3018
  onAction,
@@ -2687,18 +3024,20 @@ function MessageList({
2687
3024
  chatVariant,
2688
3025
  onPromptClick,
2689
3026
  enableWidgets,
2690
- onWidgetRender
3027
+ onWidgetRender,
3028
+ persistentWidgetIds,
3029
+ toolCallStyle
2691
3030
  }) {
2692
- const listRef = useRef4(null);
2693
- const isNearBottomRef = useRef4(true);
2694
- const lastScrollHeightRef = useRef4(0);
3031
+ const listRef = useRef6(null);
3032
+ const isNearBottomRef = useRef6(true);
3033
+ const lastScrollHeightRef = useRef6(0);
2695
3034
  const handleScroll = () => {
2696
3035
  if (listRef.current) {
2697
3036
  const { scrollTop, scrollHeight, clientHeight } = listRef.current;
2698
3037
  isNearBottomRef.current = scrollHeight - scrollTop - clientHeight < 100;
2699
3038
  }
2700
3039
  };
2701
- useEffect5(() => {
3040
+ useEffect6(() => {
2702
3041
  if (listRef.current && isNearBottomRef.current) {
2703
3042
  const currentScrollHeight = listRef.current.scrollHeight;
2704
3043
  if (currentScrollHeight !== lastScrollHeightRef.current) {
@@ -2707,7 +3046,7 @@ function MessageList({
2707
3046
  }
2708
3047
  }
2709
3048
  }, [messages]);
2710
- return /* @__PURE__ */ jsx19("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ jsx19(
3049
+ return /* @__PURE__ */ jsx22("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ jsx22(
2711
3050
  WelcomeScreen,
2712
3051
  {
2713
3052
  title: welcomeTitle,
@@ -2719,21 +3058,21 @@ function MessageList({
2719
3058
  onPromptClick: onPromptClick || (() => {
2720
3059
  })
2721
3060
  }
2722
- ) : messages.map((message) => /* @__PURE__ */ jsx19("div", { className: message.role === "user" ? "apteva-message-row-user" : "apteva-message-row-assistant", children: /* @__PURE__ */ jsx19(Message, { message, onAction, enableWidgets, onWidgetRender }) }, message.id)) });
3061
+ ) : messages.map((message) => /* @__PURE__ */ jsx22("div", { className: message.role === "user" ? "apteva-message-row-user" : "apteva-message-row-assistant", children: /* @__PURE__ */ jsx22(Message, { message, onAction, enableWidgets, onWidgetRender, persistentWidgetIds, toolCallStyle }) }, message.id)) });
2723
3062
  }
2724
3063
 
2725
3064
  // src/components/Chat/Composer.tsx
2726
- import { useState as useState4, useRef as useRef5 } from "react";
2727
- import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
3065
+ import { useState as useState6, useRef as useRef7 } from "react";
3066
+ import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
2728
3067
  function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
2729
- const [text, setText] = useState4("");
2730
- const [showMenu, setShowMenu] = useState4(false);
2731
- const [pendingFiles, setPendingFiles] = useState4([]);
2732
- const [fileError, setFileError] = useState4(null);
2733
- const [isMultiLine, setIsMultiLine] = useState4(false);
2734
- const textareaRef = useRef5(null);
2735
- const fileInputRef = useRef5(null);
2736
- const menuButtonRef = useRef5(null);
3068
+ const [text, setText] = useState6("");
3069
+ const [showMenu, setShowMenu] = useState6(false);
3070
+ const [pendingFiles, setPendingFiles] = useState6([]);
3071
+ const [fileError, setFileError] = useState6(null);
3072
+ const [isMultiLine, setIsMultiLine] = useState6(false);
3073
+ const textareaRef = useRef7(null);
3074
+ const fileInputRef = useRef7(null);
3075
+ const menuButtonRef = useRef7(null);
2737
3076
  const handleKeyDown = (e) => {
2738
3077
  if (e.key === "Enter" && !e.shiftKey) {
2739
3078
  e.preventDefault();
@@ -2809,35 +3148,35 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2809
3148
  };
2810
3149
  const getFileIcon = (mimeType) => {
2811
3150
  if (mimeType.startsWith("image/")) {
2812
- return /* @__PURE__ */ jsx20("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
3151
+ return /* @__PURE__ */ jsx23("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
2813
3152
  }
2814
3153
  if (mimeType === "application/pdf") {
2815
- return /* @__PURE__ */ jsx20("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
3154
+ return /* @__PURE__ */ jsx23("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
2816
3155
  }
2817
- return /* @__PURE__ */ jsx20("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
3156
+ return /* @__PURE__ */ jsx23("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
2818
3157
  };
2819
- return /* @__PURE__ */ jsxs14("div", { className: "px-4 py-3 relative", children: [
2820
- fileError && /* @__PURE__ */ jsx20("div", { className: "apteva-file-error", children: /* @__PURE__ */ jsxs14("div", { className: "apteva-file-error-content", children: [
2821
- /* @__PURE__ */ jsx20("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
2822
- /* @__PURE__ */ jsx20("span", { children: fileError })
3158
+ return /* @__PURE__ */ jsxs17("div", { className: "px-4 py-3 relative", children: [
3159
+ fileError && /* @__PURE__ */ jsx23("div", { className: "apteva-file-error", children: /* @__PURE__ */ jsxs17("div", { className: "apteva-file-error-content", children: [
3160
+ /* @__PURE__ */ jsx23("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3161
+ /* @__PURE__ */ jsx23("span", { children: fileError })
2823
3162
  ] }) }),
2824
- pendingFiles.length > 0 && /* @__PURE__ */ jsx20("div", { className: "apteva-file-preview", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs14("div", { className: "apteva-file-item", children: [
2825
- pf.preview ? /* @__PURE__ */ jsx20("img", { src: pf.preview, alt: pf.file.name, className: "apteva-file-thumb" }) : /* @__PURE__ */ jsx20("div", { className: "apteva-file-icon", children: getFileIcon(pf.file.type) }),
2826
- /* @__PURE__ */ jsxs14("div", { className: "apteva-file-info", children: [
2827
- /* @__PURE__ */ jsx20("span", { className: "apteva-file-name", children: pf.file.name }),
2828
- /* @__PURE__ */ jsx20("span", { className: "apteva-file-size", children: formatFileSize(pf.file.size) })
3163
+ pendingFiles.length > 0 && /* @__PURE__ */ jsx23("div", { className: "apteva-file-preview", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs17("div", { className: "apteva-file-item", children: [
3164
+ pf.preview ? /* @__PURE__ */ jsx23("img", { src: pf.preview, alt: pf.file.name, className: "apteva-file-thumb" }) : /* @__PURE__ */ jsx23("div", { className: "apteva-file-icon", children: getFileIcon(pf.file.type) }),
3165
+ /* @__PURE__ */ jsxs17("div", { className: "apteva-file-info", children: [
3166
+ /* @__PURE__ */ jsx23("span", { className: "apteva-file-name", children: pf.file.name }),
3167
+ /* @__PURE__ */ jsx23("span", { className: "apteva-file-size", children: formatFileSize(pf.file.size) })
2829
3168
  ] }),
2830
- /* @__PURE__ */ jsx20(
3169
+ /* @__PURE__ */ jsx23(
2831
3170
  "button",
2832
3171
  {
2833
3172
  onClick: () => removeFile(index),
2834
3173
  className: "apteva-file-remove",
2835
3174
  title: "Remove file",
2836
- children: /* @__PURE__ */ jsx20("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3175
+ children: /* @__PURE__ */ jsx23("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
2837
3176
  }
2838
3177
  )
2839
3178
  ] }, index)) }),
2840
- /* @__PURE__ */ jsxs14(
3179
+ /* @__PURE__ */ jsxs17(
2841
3180
  "div",
2842
3181
  {
2843
3182
  className: "apteva-composer",
@@ -2847,20 +3186,20 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2847
3186
  alignItems: "end"
2848
3187
  },
2849
3188
  children: [
2850
- /* @__PURE__ */ jsxs14("div", { className: "relative flex-shrink-0 self-end", style: { gridArea: "plus" }, children: [
2851
- /* @__PURE__ */ jsx20(
3189
+ /* @__PURE__ */ jsxs17("div", { className: "relative flex-shrink-0 self-end", style: { gridArea: "plus" }, children: [
3190
+ /* @__PURE__ */ jsx23(
2852
3191
  "button",
2853
3192
  {
2854
3193
  ref: menuButtonRef,
2855
3194
  onClick: () => setShowMenu(!showMenu),
2856
3195
  className: "apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800",
2857
3196
  title: "More options",
2858
- children: /* @__PURE__ */ jsx20("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx20("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3197
+ children: /* @__PURE__ */ jsx23("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx23("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
2859
3198
  }
2860
3199
  ),
2861
- showMenu && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2862
- /* @__PURE__ */ jsx20("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2863
- /* @__PURE__ */ jsxs14(
3200
+ showMenu && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3201
+ /* @__PURE__ */ jsx23("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
3202
+ /* @__PURE__ */ jsxs17(
2864
3203
  "div",
2865
3204
  {
2866
3205
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -2869,7 +3208,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2869
3208
  bottom: window.innerHeight - (menuButtonRef.current?.getBoundingClientRect().top ?? 0) + 8
2870
3209
  },
2871
3210
  children: [
2872
- /* @__PURE__ */ jsxs14(
3211
+ /* @__PURE__ */ jsxs17(
2873
3212
  "button",
2874
3213
  {
2875
3214
  onClick: () => {
@@ -2878,12 +3217,12 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2878
3217
  },
2879
3218
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
2880
3219
  children: [
2881
- /* @__PURE__ */ jsx20("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx20("path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
2882
- /* @__PURE__ */ jsx20("span", { className: "!text-sm font-medium", children: "Add photos & files" })
3220
+ /* @__PURE__ */ jsx23("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx23("path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
3221
+ /* @__PURE__ */ jsx23("span", { className: "!text-sm font-medium", children: "Add photos & files" })
2883
3222
  ]
2884
3223
  }
2885
3224
  ),
2886
- onSwitchMode && /* @__PURE__ */ jsxs14(
3225
+ onSwitchMode && /* @__PURE__ */ jsxs17(
2887
3226
  "button",
2888
3227
  {
2889
3228
  onClick: () => {
@@ -2892,8 +3231,8 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2892
3231
  },
2893
3232
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",
2894
3233
  children: [
2895
- /* @__PURE__ */ jsx20("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
2896
- /* @__PURE__ */ jsx20("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
3234
+ /* @__PURE__ */ jsx23("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
3235
+ /* @__PURE__ */ jsx23("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
2897
3236
  ]
2898
3237
  }
2899
3238
  )
@@ -2902,7 +3241,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2902
3241
  )
2903
3242
  ] })
2904
3243
  ] }),
2905
- /* @__PURE__ */ jsx20(
3244
+ /* @__PURE__ */ jsx23(
2906
3245
  "textarea",
2907
3246
  {
2908
3247
  ref: textareaRef,
@@ -2916,28 +3255,28 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2916
3255
  rows: 1
2917
3256
  }
2918
3257
  ),
2919
- /* @__PURE__ */ jsx20("div", { className: "self-end", style: { gridArea: "send" }, children: isLoading && onStop ? /* @__PURE__ */ jsx20(
3258
+ /* @__PURE__ */ jsx23("div", { className: "self-end", style: { gridArea: "send" }, children: isLoading && onStop ? /* @__PURE__ */ jsx23(
2920
3259
  "button",
2921
3260
  {
2922
3261
  onClick: onStop,
2923
3262
  className: "apteva-composer-stop-btn",
2924
3263
  title: "Stop generation",
2925
- children: /* @__PURE__ */ jsx20("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx20("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
3264
+ children: /* @__PURE__ */ jsx23("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx23("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
2926
3265
  }
2927
- ) : /* @__PURE__ */ jsx20(
3266
+ ) : /* @__PURE__ */ jsx23(
2928
3267
  "button",
2929
3268
  {
2930
3269
  onClick: handleSend,
2931
3270
  disabled: !text.trim() && pendingFiles.length === 0 || disabled,
2932
3271
  className: "apteva-composer-send-btn w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",
2933
3272
  title: "Send message",
2934
- children: /* @__PURE__ */ jsx20("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx20("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3273
+ children: /* @__PURE__ */ jsx23("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx23("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
2935
3274
  }
2936
3275
  ) })
2937
3276
  ]
2938
3277
  }
2939
3278
  ),
2940
- /* @__PURE__ */ jsx20(
3279
+ /* @__PURE__ */ jsx23(
2941
3280
  "input",
2942
3281
  {
2943
3282
  ref: fileInputRef,
@@ -2952,8 +3291,8 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2952
3291
  }
2953
3292
 
2954
3293
  // src/components/Chat/CommandComposer.tsx
2955
- import { useState as useState5, useRef as useRef6 } from "react";
2956
- import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
3294
+ import { useState as useState7, useRef as useRef8 } from "react";
3295
+ import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
2957
3296
  function CommandComposer({
2958
3297
  onExecute,
2959
3298
  state,
@@ -2970,13 +3309,13 @@ function CommandComposer({
2970
3309
  placeholder = "Enter your command...",
2971
3310
  disabled = false
2972
3311
  }) {
2973
- const [input, setInput] = useState5("");
2974
- const [pendingFiles, setPendingFiles] = useState5([]);
2975
- const [fileError, setFileError] = useState5(null);
2976
- const [showMenu, setShowMenu] = useState5(false);
2977
- const inputRef = useRef6(null);
2978
- const fileInputRef = useRef6(null);
2979
- const menuButtonRef = useRef6(null);
3312
+ const [input, setInput] = useState7("");
3313
+ const [pendingFiles, setPendingFiles] = useState7([]);
3314
+ const [fileError, setFileError] = useState7(null);
3315
+ const [showMenu, setShowMenu] = useState7(false);
3316
+ const inputRef = useRef8(null);
3317
+ const fileInputRef = useRef8(null);
3318
+ const menuButtonRef = useRef8(null);
2980
3319
  const handleSubmit = () => {
2981
3320
  const hasText = input.trim();
2982
3321
  const hasFiles = pendingFiles.length > 0;
@@ -3043,12 +3382,12 @@ function CommandComposer({
3043
3382
  };
3044
3383
  const getFileIcon = (mimeType) => {
3045
3384
  if (mimeType.startsWith("image/")) {
3046
- return /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
3385
+ return /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) });
3047
3386
  }
3048
3387
  if (mimeType === "application/pdf") {
3049
- return /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
3388
+ return /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) });
3050
3389
  }
3051
- return /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
3390
+ return /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) });
3052
3391
  };
3053
3392
  const getDisplayContent = () => {
3054
3393
  if (state === "loading") {
@@ -3073,12 +3412,12 @@ function CommandComposer({
3073
3412
  };
3074
3413
  const isShowingResult = state !== "idle";
3075
3414
  const { text: displayContent, isToolCall } = getDisplayContent();
3076
- return /* @__PURE__ */ jsxs15("div", { className: "w-full relative", children: [
3077
- fileError && /* @__PURE__ */ jsx21("div", { className: "apteva-file-error", style: { top: "-3rem", bottom: "auto" }, children: /* @__PURE__ */ jsxs15("div", { className: "apteva-file-error-content", children: [
3078
- /* @__PURE__ */ jsx21("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3079
- /* @__PURE__ */ jsx21("span", { children: fileError })
3415
+ return /* @__PURE__ */ jsxs18("div", { className: "w-full relative", children: [
3416
+ fileError && /* @__PURE__ */ jsx24("div", { className: "apteva-file-error", style: { top: "-3rem", bottom: "auto" }, children: /* @__PURE__ */ jsxs18("div", { className: "apteva-file-error-content", children: [
3417
+ /* @__PURE__ */ jsx24("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3418
+ /* @__PURE__ */ jsx24("span", { children: fileError })
3080
3419
  ] }) }),
3081
- /* @__PURE__ */ jsxs15(
3420
+ /* @__PURE__ */ jsxs18(
3082
3421
  "div",
3083
3422
  {
3084
3423
  className: cn(
@@ -3090,21 +3429,21 @@ function CommandComposer({
3090
3429
  state === "error" && "border-red-400 dark:border-red-500"
3091
3430
  ),
3092
3431
  children: [
3093
- /* @__PURE__ */ jsxs15("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
3094
- state === "idle" && /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
3095
- /* @__PURE__ */ jsx21(
3432
+ /* @__PURE__ */ jsxs18("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
3433
+ state === "idle" && /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
3434
+ /* @__PURE__ */ jsx24(
3096
3435
  "button",
3097
3436
  {
3098
3437
  ref: menuButtonRef,
3099
3438
  onClick: () => setShowMenu(!showMenu),
3100
3439
  className: "apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-500 dark:!text-neutral-400 hover:!text-neutral-700 dark:hover:!text-neutral-200 hover:bg-neutral-100 dark:hover:bg-neutral-800",
3101
3440
  title: "More options",
3102
- children: /* @__PURE__ */ jsx21("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3441
+ children: /* @__PURE__ */ jsx24("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3103
3442
  }
3104
3443
  ),
3105
- showMenu && /* @__PURE__ */ jsxs15(Fragment4, { children: [
3106
- /* @__PURE__ */ jsx21("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
3107
- /* @__PURE__ */ jsxs15(
3444
+ showMenu && /* @__PURE__ */ jsxs18(Fragment5, { children: [
3445
+ /* @__PURE__ */ jsx24("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
3446
+ /* @__PURE__ */ jsxs18(
3108
3447
  "div",
3109
3448
  {
3110
3449
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -3113,7 +3452,7 @@ function CommandComposer({
3113
3452
  top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
3114
3453
  },
3115
3454
  children: [
3116
- /* @__PURE__ */ jsxs15(
3455
+ /* @__PURE__ */ jsxs18(
3117
3456
  "button",
3118
3457
  {
3119
3458
  onClick: () => {
@@ -3122,12 +3461,12 @@ function CommandComposer({
3122
3461
  },
3123
3462
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
3124
3463
  children: [
3125
- /* @__PURE__ */ jsx21("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
3126
- /* @__PURE__ */ jsx21("span", { className: "!text-sm font-medium", children: "Add photos & files" })
3464
+ /* @__PURE__ */ jsx24("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
3465
+ /* @__PURE__ */ jsx24("span", { className: "!text-sm font-medium", children: "Add photos & files" })
3127
3466
  ]
3128
3467
  }
3129
3468
  ),
3130
- onExpand && /* @__PURE__ */ jsxs15(
3469
+ onExpand && /* @__PURE__ */ jsxs18(
3131
3470
  "button",
3132
3471
  {
3133
3472
  onClick: () => {
@@ -3136,8 +3475,8 @@ function CommandComposer({
3136
3475
  },
3137
3476
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",
3138
3477
  children: [
3139
- /* @__PURE__ */ jsx21("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
3140
- /* @__PURE__ */ jsx21("span", { className: "!text-sm font-medium", children: "Expand to chat" })
3478
+ /* @__PURE__ */ jsx24("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
3479
+ /* @__PURE__ */ jsx24("span", { className: "!text-sm font-medium", children: "Expand to chat" })
3141
3480
  ]
3142
3481
  }
3143
3482
  )
@@ -3146,22 +3485,22 @@ function CommandComposer({
3146
3485
  )
3147
3486
  ] })
3148
3487
  ] }),
3149
- state === "loading" && !toolName && /* @__PURE__ */ jsx21("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
3150
- state === "loading" && toolName && /* @__PURE__ */ jsx21("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
3488
+ state === "loading" && !toolName && /* @__PURE__ */ jsx24("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
3489
+ state === "loading" && toolName && /* @__PURE__ */ jsx24("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
3151
3490
  ] }),
3152
- pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx21("div", { className: "apteva-file-badges", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs15("div", { className: "apteva-file-badge", title: pf.file.name, children: [
3153
- pf.preview ? /* @__PURE__ */ jsx21("img", { src: pf.preview, alt: pf.file.name, className: "apteva-file-badge-img" }) : /* @__PURE__ */ jsx21("span", { className: "apteva-file-badge-icon", children: getFileIcon(pf.file.type) }),
3154
- /* @__PURE__ */ jsx21(
3491
+ pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx24("div", { className: "apteva-file-badges", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs18("div", { className: "apteva-file-badge", title: pf.file.name, children: [
3492
+ pf.preview ? /* @__PURE__ */ jsx24("img", { src: pf.preview, alt: pf.file.name, className: "apteva-file-badge-img" }) : /* @__PURE__ */ jsx24("span", { className: "apteva-file-badge-icon", children: getFileIcon(pf.file.type) }),
3493
+ /* @__PURE__ */ jsx24(
3155
3494
  "button",
3156
3495
  {
3157
3496
  onClick: () => removeFile(index),
3158
3497
  className: "apteva-file-badge-remove",
3159
3498
  title: "Remove",
3160
- children: /* @__PURE__ */ jsx21("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3499
+ children: /* @__PURE__ */ jsx24("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3161
3500
  }
3162
3501
  )
3163
3502
  ] }, index)) }),
3164
- state === "idle" ? /* @__PURE__ */ jsx21(
3503
+ state === "idle" ? /* @__PURE__ */ jsx24(
3165
3504
  "textarea",
3166
3505
  {
3167
3506
  ref: inputRef,
@@ -3179,7 +3518,7 @@ function CommandComposer({
3179
3518
  ),
3180
3519
  style: { minHeight: "24px", maxHeight: "120px" }
3181
3520
  }
3182
- ) : /* @__PURE__ */ jsx21(
3521
+ ) : /* @__PURE__ */ jsx24(
3183
3522
  "div",
3184
3523
  {
3185
3524
  className: cn(
@@ -3190,14 +3529,14 @@ function CommandComposer({
3190
3529
  state === "error" && "!text-red-600 dark:!text-red-400",
3191
3530
  state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
3192
3531
  ),
3193
- children: isToolCall ? /* @__PURE__ */ jsxs15(Fragment4, { children: [
3194
- /* @__PURE__ */ jsx21("span", { className: "font-mono", children: displayContent }),
3195
- /* @__PURE__ */ jsx21("span", { className: "text-neutral-400 dark:text-neutral-500", children: "Running..." })
3532
+ children: isToolCall ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
3533
+ /* @__PURE__ */ jsx24("span", { className: "font-mono", children: displayContent }),
3534
+ /* @__PURE__ */ jsx24("span", { className: "text-neutral-400 dark:text-neutral-500", children: "Running..." })
3196
3535
  ] }) : displayContent
3197
3536
  }
3198
3537
  ),
3199
- /* @__PURE__ */ jsx21("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
3200
- /* @__PURE__ */ jsx21(
3538
+ /* @__PURE__ */ jsx24("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
3539
+ /* @__PURE__ */ jsx24(
3201
3540
  "button",
3202
3541
  {
3203
3542
  onClick: onApprove,
@@ -3205,7 +3544,7 @@ function CommandComposer({
3205
3544
  children: "Approve"
3206
3545
  }
3207
3546
  ),
3208
- /* @__PURE__ */ jsx21(
3547
+ /* @__PURE__ */ jsx24(
3209
3548
  "button",
3210
3549
  {
3211
3550
  onClick: onReject,
@@ -3213,26 +3552,26 @@ function CommandComposer({
3213
3552
  children: "Modify"
3214
3553
  }
3215
3554
  )
3216
- ] }) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
3217
- state === "loading" && onStop && /* @__PURE__ */ jsx21(
3555
+ ] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
3556
+ state === "loading" && onStop && /* @__PURE__ */ jsx24(
3218
3557
  "button",
3219
3558
  {
3220
3559
  onClick: onStop,
3221
3560
  className: "apteva-composer-stop-btn",
3222
3561
  title: "Stop generation",
3223
- children: /* @__PURE__ */ jsx21("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
3562
+ children: /* @__PURE__ */ jsx24("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
3224
3563
  }
3225
3564
  ),
3226
- (state === "success" || state === "error") && /* @__PURE__ */ jsx21(
3565
+ (state === "success" || state === "error") && /* @__PURE__ */ jsx24(
3227
3566
  "button",
3228
3567
  {
3229
3568
  onClick: handleNewCommand,
3230
3569
  className: "w-8 h-8 rounded-lg flex items-center justify-center !text-neutral-400 hover:!text-neutral-600 dark:hover:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",
3231
3570
  title: "New command",
3232
- children: /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3571
+ children: /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3233
3572
  }
3234
3573
  ),
3235
- state === "idle" && /* @__PURE__ */ jsx21(
3574
+ state === "idle" && /* @__PURE__ */ jsx24(
3236
3575
  "button",
3237
3576
  {
3238
3577
  onClick: handleSubmit,
@@ -3244,14 +3583,14 @@ function CommandComposer({
3244
3583
  input.trim() || pendingFiles.length > 0 ? "bg-neutral-900 dark:bg-white !text-white dark:!text-neutral-900 border-neutral-900 dark:border-white" : "bg-white dark:bg-neutral-800 !text-neutral-400"
3245
3584
  ),
3246
3585
  title: "Execute command",
3247
- children: /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
3586
+ children: /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
3248
3587
  }
3249
3588
  )
3250
3589
  ] }) })
3251
3590
  ]
3252
3591
  }
3253
3592
  ),
3254
- /* @__PURE__ */ jsx21(
3593
+ /* @__PURE__ */ jsx24(
3255
3594
  "input",
3256
3595
  {
3257
3596
  ref: fileInputRef,
@@ -3448,8 +3787,43 @@ var AptevaClient = class {
3448
3787
  };
3449
3788
  var aptevaClient = new AptevaClient();
3450
3789
 
3790
+ // src/components/Chat/PersistentWidgetPanel.tsx
3791
+ import { useState as useState8 } from "react";
3792
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
3793
+ function PersistentWidgetPanel({ widgets, onAction }) {
3794
+ const [collapsed, setCollapsed] = useState8(false);
3795
+ if (widgets.length === 0) return null;
3796
+ return /* @__PURE__ */ jsxs19("div", { className: "apteva-persistent-panel border-b border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900", children: [
3797
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between px-3 py-1.5", children: [
3798
+ /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
3799
+ /* @__PURE__ */ jsx25("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse" }),
3800
+ /* @__PURE__ */ jsx25("span", { className: "text-xs font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wider", children: "Live" })
3801
+ ] }),
3802
+ /* @__PURE__ */ jsx25(
3803
+ "button",
3804
+ {
3805
+ onClick: () => setCollapsed((c) => !c),
3806
+ className: "p-1 rounded text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
3807
+ children: /* @__PURE__ */ jsx25(
3808
+ "svg",
3809
+ {
3810
+ className: cn("w-3.5 h-3.5 transition-transform", collapsed && "rotate-180"),
3811
+ fill: "none",
3812
+ viewBox: "0 0 24 24",
3813
+ stroke: "currentColor",
3814
+ strokeWidth: 2,
3815
+ children: /* @__PURE__ */ jsx25("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
3816
+ }
3817
+ )
3818
+ }
3819
+ )
3820
+ ] }),
3821
+ !collapsed && /* @__PURE__ */ jsx25("div", { className: "px-3 pb-3 flex flex-col gap-3", children: widgets.map((widget) => /* @__PURE__ */ jsx25(WidgetRenderer, { widget, onAction }, widget.id)) })
3822
+ ] });
3823
+ }
3824
+
3451
3825
  // src/components/Chat/Chat.tsx
3452
- import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
3826
+ import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
3453
3827
  var Chat = forwardRef(function Chat2({
3454
3828
  agentId,
3455
3829
  threadId,
@@ -3490,6 +3864,8 @@ var Chat = forwardRef(function Chat2({
3490
3864
  showHeader = true,
3491
3865
  headerTitle = "Chat",
3492
3866
  onHeaderBack,
3867
+ // Tool call display
3868
+ toolCallStyle = "card",
3493
3869
  // Widget detection
3494
3870
  enableWidgets = false,
3495
3871
  availableWidgets,
@@ -3497,25 +3873,49 @@ var Chat = forwardRef(function Chat2({
3497
3873
  onWidgetRender,
3498
3874
  className
3499
3875
  }, ref) {
3500
- const [messages, setMessages] = useState6(initialMessages);
3501
- const [isLoading, setIsLoading] = useState6(false);
3502
- const [currentThreadId, setCurrentThreadId] = useState6(threadId || null);
3503
- const [mode, setMode] = useState6(initialMode);
3504
- const [chatToolName, setChatToolName] = useState6(null);
3505
- const [commandState, setCommandState] = useState6("idle");
3506
- const [commandResult, setCommandResult] = useState6(null);
3507
- const [commandError, setCommandError] = useState6(null);
3508
- const [progress, setProgress] = useState6(0);
3509
- const [commandInput, setCommandInput] = useState6("");
3510
- const [streamedContent, setStreamedContent] = useState6("");
3511
- const [currentToolName, setCurrentToolName] = useState6(null);
3512
- const [currentRequestId, setCurrentRequestId] = useState6(null);
3513
- const [plan, setPlan] = useState6("");
3514
- const [pendingCommand, setPendingCommand] = useState6("");
3515
- const [internalPlanMode, setInternalPlanMode] = useState6(planMode);
3516
- const [showSettingsMenu, setShowSettingsMenu] = useState6(false);
3517
- const fileInputRef = useRef7(null);
3518
- const handleSendMessageRef = useRef7(null);
3876
+ const [messages, setMessages] = useState9(initialMessages);
3877
+ const [isLoading, setIsLoading] = useState9(false);
3878
+ const [currentThreadId, setCurrentThreadId] = useState9(threadId || null);
3879
+ const [mode, setMode] = useState9(initialMode);
3880
+ const [chatToolName, setChatToolName] = useState9(null);
3881
+ const [commandState, setCommandState] = useState9("idle");
3882
+ const [commandResult, setCommandResult] = useState9(null);
3883
+ const [commandError, setCommandError] = useState9(null);
3884
+ const [progress, setProgress] = useState9(0);
3885
+ const [commandInput, setCommandInput] = useState9("");
3886
+ const [streamedContent, setStreamedContent] = useState9("");
3887
+ const [currentToolName, setCurrentToolName] = useState9(null);
3888
+ const [currentRequestId, setCurrentRequestId] = useState9(null);
3889
+ const [plan, setPlan] = useState9("");
3890
+ const [pendingCommand, setPendingCommand] = useState9("");
3891
+ const [internalPlanMode, setInternalPlanMode] = useState9(planMode);
3892
+ const [showSettingsMenu, setShowSettingsMenu] = useState9(false);
3893
+ const fileInputRef = useRef9(null);
3894
+ const [persistentWidgets, setPersistentWidgets] = useState9(/* @__PURE__ */ new Map());
3895
+ const updatePersistentWidgets = useCallback2((msgs) => {
3896
+ setPersistentWidgets((prev) => {
3897
+ const next = new Map(prev);
3898
+ let changed = false;
3899
+ for (const msg of msgs) {
3900
+ if (!msg.widgets) continue;
3901
+ for (const w of msg.widgets) {
3902
+ if (!w.persistent) continue;
3903
+ const existing = next.get(w.id);
3904
+ if (!existing || existing !== w) {
3905
+ next.set(w.id, w);
3906
+ changed = true;
3907
+ }
3908
+ }
3909
+ }
3910
+ return changed ? next : prev;
3911
+ });
3912
+ }, []);
3913
+ useEffect7(() => {
3914
+ updatePersistentWidgets(messages);
3915
+ }, [messages, updatePersistentWidgets]);
3916
+ const persistentWidgetList = useMemo2(() => Array.from(persistentWidgets.values()), [persistentWidgets]);
3917
+ const persistentWidgetIds = useMemo2(() => new Set(persistentWidgets.keys()), [persistentWidgets]);
3918
+ const handleSendMessageRef = useRef9(null);
3519
3919
  useImperativeHandle(ref, () => ({
3520
3920
  sendMessage: async (text) => {
3521
3921
  if (handleSendMessageRef.current) {
@@ -3536,7 +3936,7 @@ var Chat = forwardRef(function Chat2({
3536
3936
  return context ? `${context}
3537
3937
  ${widgetContext}` : widgetContext;
3538
3938
  }, [context, enableWidgets, availableWidgets, compactWidgetContext]);
3539
- useEffect6(() => {
3939
+ useEffect7(() => {
3540
3940
  if (apiUrl || apiKey) {
3541
3941
  aptevaClient.configure({
3542
3942
  ...apiUrl && { apiUrl },
@@ -3544,15 +3944,15 @@ ${widgetContext}` : widgetContext;
3544
3944
  });
3545
3945
  }
3546
3946
  }, [apiUrl, apiKey]);
3547
- useEffect6(() => {
3947
+ useEffect7(() => {
3548
3948
  if (threadId) {
3549
3949
  onThreadChange?.(threadId);
3550
3950
  }
3551
3951
  }, [threadId, onThreadChange]);
3552
- useEffect6(() => {
3952
+ useEffect7(() => {
3553
3953
  setInternalPlanMode(planMode);
3554
3954
  }, [planMode]);
3555
- useEffect6(() => {
3955
+ useEffect7(() => {
3556
3956
  const handleClickOutside = (event) => {
3557
3957
  const target = event.target;
3558
3958
  if (showSettingsMenu && !target.closest(".settings-menu-container")) {
@@ -4062,19 +4462,20 @@ ${planToExecute}`;
4062
4462
  setCurrentRequestId(null);
4063
4463
  };
4064
4464
  const isCompact = commandVariant === "compact";
4065
- return /* @__PURE__ */ jsxs16("div", { className: cn("apteva-chat flex flex-col h-full", variant !== "default" && `apteva-chat-${variant}`, className), children: [
4066
- showHeader && mode === "chat" && /* @__PURE__ */ jsx22("div", { className: "apteva-chat-header px-4 py-3", children: /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
4067
- onHeaderBack && /* @__PURE__ */ jsx22("button", { onClick: onHeaderBack, className: "apteva-chat-back", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx22("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx22("path", { d: "M10 12L6 8l4-4" }) }) }),
4068
- /* @__PURE__ */ jsxs16("div", { children: [
4069
- /* @__PURE__ */ jsx22("div", { className: "apteva-chat-title", children: headerTitle }),
4070
- /* @__PURE__ */ jsx22("div", { className: cn(
4465
+ return /* @__PURE__ */ jsxs20("div", { className: cn("apteva-chat flex flex-col h-full", variant !== "default" && `apteva-chat-${variant}`, className), children: [
4466
+ showHeader && mode === "chat" && /* @__PURE__ */ jsx26("div", { className: "apteva-chat-header px-4 py-3", children: /* @__PURE__ */ jsxs20("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
4467
+ onHeaderBack && /* @__PURE__ */ jsx26("button", { onClick: onHeaderBack, className: "apteva-chat-back", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx26("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx26("path", { d: "M10 12L6 8l4-4" }) }) }),
4468
+ /* @__PURE__ */ jsxs20("div", { children: [
4469
+ /* @__PURE__ */ jsx26("div", { className: "apteva-chat-title", children: headerTitle }),
4470
+ /* @__PURE__ */ jsx26("div", { className: cn(
4071
4471
  "apteva-chat-status",
4072
4472
  isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
4073
4473
  ), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
4074
4474
  ] })
4075
4475
  ] }) }),
4076
- mode === "chat" && /* @__PURE__ */ jsxs16(Fragment5, { children: [
4077
- /* @__PURE__ */ jsx22(
4476
+ mode === "chat" && /* @__PURE__ */ jsxs20(Fragment6, { children: [
4477
+ persistentWidgetList.length > 0 && /* @__PURE__ */ jsx26(PersistentWidgetPanel, { widgets: persistentWidgetList, onAction }),
4478
+ /* @__PURE__ */ jsx26(
4078
4479
  MessageList,
4079
4480
  {
4080
4481
  messages,
@@ -4087,10 +4488,12 @@ ${planToExecute}`;
4087
4488
  chatVariant: variant,
4088
4489
  onPromptClick: (prompt) => handleSendMessage(prompt),
4089
4490
  enableWidgets,
4090
- onWidgetRender
4491
+ onWidgetRender,
4492
+ persistentWidgetIds,
4493
+ toolCallStyle
4091
4494
  }
4092
4495
  ),
4093
- /* @__PURE__ */ jsx22(
4496
+ /* @__PURE__ */ jsx26(
4094
4497
  Composer,
4095
4498
  {
4096
4499
  onSendMessage: handleSendMessage,
@@ -4103,7 +4506,7 @@ ${planToExecute}`;
4103
4506
  }
4104
4507
  )
4105
4508
  ] }),
4106
- mode === "command" && /* @__PURE__ */ jsx22("div", { className: "w-full", children: /* @__PURE__ */ jsx22(
4509
+ mode === "command" && /* @__PURE__ */ jsx26("div", { className: "w-full", children: /* @__PURE__ */ jsx26(
4107
4510
  CommandComposer,
4108
4511
  {
4109
4512
  onExecute: (text, files) => {
@@ -4124,7 +4527,7 @@ ${planToExecute}`;
4124
4527
  placeholder: placeholder || "Enter your command..."
4125
4528
  }
4126
4529
  ) }),
4127
- /* @__PURE__ */ jsx22("style", { dangerouslySetInnerHTML: {
4530
+ /* @__PURE__ */ jsx26("style", { dangerouslySetInnerHTML: {
4128
4531
  __html: `
4129
4532
  @keyframes pulse-border {
4130
4533
  0%, 100% { border-color: rgb(59, 130, 246); }
@@ -4142,12 +4545,12 @@ ${planToExecute}`;
4142
4545
  });
4143
4546
 
4144
4547
  // src/components/Chat/CommandOutput.tsx
4145
- import { useState as useState7 } from "react";
4146
- import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
4548
+ import { useState as useState10 } from "react";
4549
+ import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
4147
4550
 
4148
4551
  // src/components/Command/Command.tsx
4149
- import React, { useState as useState8, useEffect as useEffect7 } from "react";
4150
- import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
4552
+ import React, { useState as useState11, useEffect as useEffect8 } from "react";
4553
+ import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
4151
4554
  function Command({
4152
4555
  agentId,
4153
4556
  command: initialCommand,
@@ -4174,28 +4577,28 @@ function Command({
4174
4577
  resultRenderer,
4175
4578
  className
4176
4579
  }) {
4177
- const [state, setState] = useState8("idle");
4178
- const [result, setResult] = useState8(null);
4179
- const [error, setError] = useState8(null);
4180
- const [progress, setProgress] = useState8(0);
4181
- const [command, setCommand] = useState8(initialCommand || "");
4182
- const [streamedContent, setStreamedContent] = useState8("");
4183
- const [plan, setPlan] = useState8("");
4184
- const [pendingCommand, setPendingCommand] = useState8("");
4185
- const [showPlanDetails, setShowPlanDetails] = useState8(false);
4186
- const [uploadedFiles, setUploadedFiles] = useState8([]);
4187
- const [showSettingsMenu, setShowSettingsMenu] = useState8(false);
4188
- const [internalPlanMode, setInternalPlanMode] = useState8(planMode);
4580
+ const [state, setState] = useState11("idle");
4581
+ const [result, setResult] = useState11(null);
4582
+ const [error, setError] = useState11(null);
4583
+ const [progress, setProgress] = useState11(0);
4584
+ const [command, setCommand] = useState11(initialCommand || "");
4585
+ const [streamedContent, setStreamedContent] = useState11("");
4586
+ const [plan, setPlan] = useState11("");
4587
+ const [pendingCommand, setPendingCommand] = useState11("");
4588
+ const [showPlanDetails, setShowPlanDetails] = useState11(false);
4589
+ const [uploadedFiles, setUploadedFiles] = useState11([]);
4590
+ const [showSettingsMenu, setShowSettingsMenu] = useState11(false);
4591
+ const [internalPlanMode, setInternalPlanMode] = useState11(planMode);
4189
4592
  const fileInputRef = React.useRef(null);
4190
- useEffect7(() => {
4593
+ useEffect8(() => {
4191
4594
  if (autoExecute && state === "idle" && command) {
4192
4595
  executeCommand();
4193
4596
  }
4194
4597
  }, [autoExecute]);
4195
- useEffect7(() => {
4598
+ useEffect8(() => {
4196
4599
  setInternalPlanMode(planMode);
4197
4600
  }, [planMode]);
4198
- useEffect7(() => {
4601
+ useEffect8(() => {
4199
4602
  const handleClickOutside = (event) => {
4200
4603
  const target = event.target;
4201
4604
  if (showSettingsMenu && !target.closest(".settings-menu-container")) {
@@ -4597,7 +5000,7 @@ ${planToExecute}`;
4597
5000
  setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
4598
5001
  };
4599
5002
  const isCompact = variant === "compact";
4600
- return /* @__PURE__ */ jsxs18(
5003
+ return /* @__PURE__ */ jsxs22(
4601
5004
  "div",
4602
5005
  {
4603
5006
  className: cn(
@@ -4612,9 +5015,9 @@ ${planToExecute}`;
4612
5015
  ),
4613
5016
  style: { minHeight: isCompact ? "auto" : "180px" },
4614
5017
  children: [
4615
- /* @__PURE__ */ jsxs18("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
4616
- state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4617
- /* @__PURE__ */ jsx24(
5018
+ /* @__PURE__ */ jsxs22("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
5019
+ state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5020
+ /* @__PURE__ */ jsx28(
4618
5021
  "textarea",
4619
5022
  {
4620
5023
  value: command,
@@ -4630,42 +5033,42 @@ ${planToExecute}`;
4630
5033
  rows: 6
4631
5034
  }
4632
5035
  ),
4633
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs18("div", { className: "relative group", children: [
4634
- file.type === "image" ? /* @__PURE__ */ jsx24(
5036
+ uploadedFiles.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs22("div", { className: "relative group", children: [
5037
+ file.type === "image" ? /* @__PURE__ */ jsx28(
4635
5038
  "img",
4636
5039
  {
4637
5040
  src: file.preview,
4638
5041
  alt: file.name,
4639
5042
  className: "w-20 h-20 object-cover rounded-lg border-2 border-neutral-300 dark:border-neutral-600"
4640
5043
  }
4641
- ) : /* @__PURE__ */ jsxs18("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", children: [
4642
- /* @__PURE__ */ jsx24("svg", { className: "w-8 h-8 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx24("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }),
4643
- /* @__PURE__ */ jsx24("span", { className: "text-[8px] text-neutral-500 dark:text-neutral-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
5044
+ ) : /* @__PURE__ */ jsxs22("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", children: [
5045
+ /* @__PURE__ */ jsx28("svg", { className: "w-8 h-8 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx28("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }),
5046
+ /* @__PURE__ */ jsx28("span", { className: "text-[8px] text-neutral-500 dark:text-neutral-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
4644
5047
  ] }),
4645
- /* @__PURE__ */ jsx24(
5048
+ /* @__PURE__ */ jsx28(
4646
5049
  "button",
4647
5050
  {
4648
5051
  onClick: () => removeFile(index),
4649
5052
  className: "absolute -top-2 -right-2 w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
4650
5053
  title: `Remove ${file.type}`,
4651
- children: /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
5054
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
4652
5055
  }
4653
5056
  )
4654
5057
  ] }, index)) })
4655
5058
  ] }),
4656
- state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4657
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
4658
- enableFileUpload && /* @__PURE__ */ jsx24(
5059
+ state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5060
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
5061
+ enableFileUpload && /* @__PURE__ */ jsx28(
4659
5062
  "button",
4660
5063
  {
4661
5064
  onClick: () => fileInputRef.current?.click(),
4662
5065
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
4663
5066
  title: "Attach file",
4664
- children: /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
5067
+ children: /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
4665
5068
  }
4666
5069
  ),
4667
- planMode && /* @__PURE__ */ jsxs18("div", { className: "relative settings-menu-container", children: [
4668
- /* @__PURE__ */ jsx24(
5070
+ planMode && /* @__PURE__ */ jsxs22("div", { className: "relative settings-menu-container", children: [
5071
+ /* @__PURE__ */ jsx28(
4669
5072
  "button",
4670
5073
  {
4671
5074
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -4674,28 +5077,28 @@ ${planToExecute}`;
4674
5077
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
4675
5078
  ),
4676
5079
  title: "Settings",
4677
- children: /* @__PURE__ */ jsxs18("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4678
- /* @__PURE__ */ jsx24("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
4679
- /* @__PURE__ */ jsx24("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
4680
- /* @__PURE__ */ jsx24("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
4681
- /* @__PURE__ */ jsx24("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
4682
- /* @__PURE__ */ jsx24("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
4683
- /* @__PURE__ */ jsx24("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
4684
- /* @__PURE__ */ jsx24("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
4685
- /* @__PURE__ */ jsx24("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
4686
- /* @__PURE__ */ jsx24("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
5080
+ children: /* @__PURE__ */ jsxs22("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
5081
+ /* @__PURE__ */ jsx28("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
5082
+ /* @__PURE__ */ jsx28("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
5083
+ /* @__PURE__ */ jsx28("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
5084
+ /* @__PURE__ */ jsx28("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
5085
+ /* @__PURE__ */ jsx28("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
5086
+ /* @__PURE__ */ jsx28("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
5087
+ /* @__PURE__ */ jsx28("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
5088
+ /* @__PURE__ */ jsx28("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
5089
+ /* @__PURE__ */ jsx28("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
4687
5090
  ] })
4688
5091
  }
4689
5092
  ),
4690
- showSettingsMenu && /* @__PURE__ */ jsx24("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs18("label", { className: "flex items-center justify-between cursor-pointer group", children: [
4691
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4692
- /* @__PURE__ */ jsx24("svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
4693
- /* @__PURE__ */ jsxs18("div", { children: [
4694
- /* @__PURE__ */ jsx24("div", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
4695
- /* @__PURE__ */ jsx24("div", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: "Review first" })
5093
+ showSettingsMenu && /* @__PURE__ */ jsx28("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs22("label", { className: "flex items-center justify-between cursor-pointer group", children: [
5094
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
5095
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5096
+ /* @__PURE__ */ jsxs22("div", { children: [
5097
+ /* @__PURE__ */ jsx28("div", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
5098
+ /* @__PURE__ */ jsx28("div", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: "Review first" })
4696
5099
  ] })
4697
5100
  ] }),
4698
- /* @__PURE__ */ jsx24(
5101
+ /* @__PURE__ */ jsx28(
4699
5102
  "button",
4700
5103
  {
4701
5104
  onClick: (e) => {
@@ -4707,7 +5110,7 @@ ${planToExecute}`;
4707
5110
  internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
4708
5111
  ),
4709
5112
  type: "button",
4710
- children: /* @__PURE__ */ jsx24(
5113
+ children: /* @__PURE__ */ jsx28(
4711
5114
  "span",
4712
5115
  {
4713
5116
  className: cn(
@@ -4721,26 +5124,26 @@ ${planToExecute}`;
4721
5124
  ] }) })
4722
5125
  ] })
4723
5126
  ] }),
4724
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx24("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs18("div", { className: "relative group", children: [
4725
- file.type === "image" ? /* @__PURE__ */ jsx24(
5127
+ uploadedFiles.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs22("div", { className: "relative group", children: [
5128
+ file.type === "image" ? /* @__PURE__ */ jsx28(
4726
5129
  "img",
4727
5130
  {
4728
5131
  src: file.preview,
4729
5132
  alt: file.name,
4730
5133
  className: "w-8 h-8 object-cover rounded border border-neutral-300 dark:border-neutral-600"
4731
5134
  }
4732
- ) : /* @__PURE__ */ jsx24("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", title: file.name, children: /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx24("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }) }),
4733
- /* @__PURE__ */ jsx24(
5135
+ ) : /* @__PURE__ */ jsx28("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", title: file.name, children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx28("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }) }),
5136
+ /* @__PURE__ */ jsx28(
4734
5137
  "button",
4735
5138
  {
4736
5139
  onClick: () => removeFile(index),
4737
5140
  className: "absolute -top-1 -right-1 w-4 h-4 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
4738
5141
  title: "Remove",
4739
- children: /* @__PURE__ */ jsx24("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
5142
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
4740
5143
  }
4741
5144
  )
4742
5145
  ] }, index)) }),
4743
- /* @__PURE__ */ jsx24(
5146
+ /* @__PURE__ */ jsx28(
4744
5147
  "input",
4745
5148
  {
4746
5149
  type: "text",
@@ -4756,7 +5159,7 @@ ${planToExecute}`;
4756
5159
  className: "flex-1 bg-transparent border-none focus:outline-none !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 py-1"
4757
5160
  }
4758
5161
  ),
4759
- /* @__PURE__ */ jsx24(
5162
+ /* @__PURE__ */ jsx28(
4760
5163
  "button",
4761
5164
  {
4762
5165
  onClick: () => executeCommand(),
@@ -4772,33 +5175,33 @@ ${planToExecute}`;
4772
5175
  !command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
4773
5176
  ),
4774
5177
  title: "Execute",
4775
- children: /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
5178
+ children: /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
4776
5179
  }
4777
5180
  )
4778
5181
  ] }),
4779
- state === "loading" && !isCompact && /* @__PURE__ */ jsxs18("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
4780
- /* @__PURE__ */ jsx24("div", { className: "w-6 h-6 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
4781
- /* @__PURE__ */ jsx24("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
4782
- showProgress && /* @__PURE__ */ jsxs18("div", { className: "w-full max-w-sm", children: [
4783
- /* @__PURE__ */ jsx24("div", { className: "w-full bg-neutral-200 dark:bg-neutral-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx24(
5182
+ state === "loading" && !isCompact && /* @__PURE__ */ jsxs22("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
5183
+ /* @__PURE__ */ jsx28("div", { className: "w-6 h-6 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
5184
+ /* @__PURE__ */ jsx28("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
5185
+ showProgress && /* @__PURE__ */ jsxs22("div", { className: "w-full max-w-sm", children: [
5186
+ /* @__PURE__ */ jsx28("div", { className: "w-full bg-neutral-200 dark:bg-neutral-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx28(
4784
5187
  "div",
4785
5188
  {
4786
5189
  className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
4787
5190
  style: { width: `${progress}%` }
4788
5191
  }
4789
5192
  ) }),
4790
- /* @__PURE__ */ jsxs18("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
5193
+ /* @__PURE__ */ jsxs22("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
4791
5194
  progress,
4792
5195
  "%"
4793
5196
  ] })
4794
5197
  ] })
4795
5198
  ] }),
4796
- state === "loading" && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4797
- /* @__PURE__ */ jsxs18("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
4798
- /* @__PURE__ */ jsx24("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
4799
- /* @__PURE__ */ jsx24("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
5199
+ state === "loading" && isCompact && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5200
+ /* @__PURE__ */ jsxs22("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
5201
+ /* @__PURE__ */ jsx28("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
5202
+ /* @__PURE__ */ jsx28("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
4800
5203
  ] }),
4801
- /* @__PURE__ */ jsx24(
5204
+ /* @__PURE__ */ jsx28(
4802
5205
  "button",
4803
5206
  {
4804
5207
  disabled: true,
@@ -4810,20 +5213,20 @@ ${planToExecute}`;
4810
5213
  "!text-lg",
4811
5214
  "opacity-30 cursor-not-allowed"
4812
5215
  ),
4813
- children: /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
5216
+ children: /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
4814
5217
  }
4815
5218
  )
4816
5219
  ] }),
4817
- state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx24("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs18("div", { className: "mb-4 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg", children: [
4818
- /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 mb-3", children: [
4819
- /* @__PURE__ */ jsx24("svg", { className: "w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
4820
- /* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
4821
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
4822
- /* @__PURE__ */ jsx24("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
5220
+ state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx28("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs22("div", { className: "mb-4 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg", children: [
5221
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-start gap-2 mb-3", children: [
5222
+ /* @__PURE__ */ jsx28("svg", { className: "w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5223
+ /* @__PURE__ */ jsxs22("div", { className: "flex-1", children: [
5224
+ /* @__PURE__ */ jsx28("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
5225
+ /* @__PURE__ */ jsx28("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
4823
5226
  ] })
4824
5227
  ] }),
4825
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 mt-4", children: [
4826
- /* @__PURE__ */ jsx24(
5228
+ /* @__PURE__ */ jsxs22("div", { className: "flex gap-2 mt-4", children: [
5229
+ /* @__PURE__ */ jsx28(
4827
5230
  "button",
4828
5231
  {
4829
5232
  onClick: approvePlan,
@@ -4831,7 +5234,7 @@ ${planToExecute}`;
4831
5234
  children: "Approve & Execute"
4832
5235
  }
4833
5236
  ),
4834
- /* @__PURE__ */ jsx24(
5237
+ /* @__PURE__ */ jsx28(
4835
5238
  "button",
4836
5239
  {
4837
5240
  onClick: rejectPlan,
@@ -4841,20 +5244,20 @@ ${planToExecute}`;
4841
5244
  )
4842
5245
  ] })
4843
5246
  ] }) }),
4844
- state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4845
- /* @__PURE__ */ jsxs18(
5247
+ state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5248
+ /* @__PURE__ */ jsxs22(
4846
5249
  "button",
4847
5250
  {
4848
5251
  onClick: () => setShowPlanDetails(true),
4849
5252
  className: "flex-1 flex items-center gap-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/40 border border-blue-200 dark:border-blue-800 rounded-lg transition-colors",
4850
5253
  children: [
4851
- /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
4852
- /* @__PURE__ */ jsx24("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
5254
+ /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5255
+ /* @__PURE__ */ jsx28("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
4853
5256
  ]
4854
5257
  }
4855
5258
  ),
4856
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 flex-shrink-0", children: [
4857
- /* @__PURE__ */ jsx24(
5259
+ /* @__PURE__ */ jsxs22("div", { className: "flex gap-2 flex-shrink-0", children: [
5260
+ /* @__PURE__ */ jsx28(
4858
5261
  "button",
4859
5262
  {
4860
5263
  onClick: approvePlan,
@@ -4862,7 +5265,7 @@ ${planToExecute}`;
4862
5265
  children: "Approve"
4863
5266
  }
4864
5267
  ),
4865
- /* @__PURE__ */ jsx24(
5268
+ /* @__PURE__ */ jsx28(
4866
5269
  "button",
4867
5270
  {
4868
5271
  onClick: rejectPlan,
@@ -4872,15 +5275,15 @@ ${planToExecute}`;
4872
5275
  )
4873
5276
  ] })
4874
5277
  ] }),
4875
- state === "error" && /* @__PURE__ */ jsxs18("div", { className: "flex-1 flex flex-col", children: [
4876
- /* @__PURE__ */ jsx24("div", { className: "mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2", children: [
4877
- /* @__PURE__ */ jsx24("svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4878
- /* @__PURE__ */ jsxs18("div", { children: [
4879
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
4880
- /* @__PURE__ */ jsx24("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
5278
+ state === "error" && /* @__PURE__ */ jsxs22("div", { className: "flex-1 flex flex-col", children: [
5279
+ /* @__PURE__ */ jsx28("div", { className: "mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsxs22("div", { className: "flex items-start gap-2", children: [
5280
+ /* @__PURE__ */ jsx28("svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
5281
+ /* @__PURE__ */ jsxs22("div", { children: [
5282
+ /* @__PURE__ */ jsx28("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
5283
+ /* @__PURE__ */ jsx28("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
4881
5284
  ] })
4882
5285
  ] }) }),
4883
- allowInput && /* @__PURE__ */ jsx24(
5286
+ allowInput && /* @__PURE__ */ jsx28(
4884
5287
  "textarea",
4885
5288
  {
4886
5289
  value: command,
@@ -4897,16 +5300,16 @@ ${planToExecute}`;
4897
5300
  }
4898
5301
  )
4899
5302
  ] }),
4900
- state === "success" && result && !isCompact && /* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
4901
- /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
4902
- /* @__PURE__ */ jsx24("svg", { className: "w-5 h-5 text-green-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4903
- /* @__PURE__ */ jsxs18("div", { className: "flex-1", children: [
4904
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
4905
- /* @__PURE__ */ jsx24("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
5303
+ state === "success" && result && !isCompact && /* @__PURE__ */ jsx28("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
5304
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
5305
+ /* @__PURE__ */ jsx28("svg", { className: "w-5 h-5 text-green-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
5306
+ /* @__PURE__ */ jsxs22("div", { className: "flex-1", children: [
5307
+ /* @__PURE__ */ jsx28("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
5308
+ /* @__PURE__ */ jsx28("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
4906
5309
  ] })
4907
5310
  ] }),
4908
- result.data?.summary && /* @__PURE__ */ jsx24("div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
4909
- result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx24("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx24(
5311
+ result.data?.summary && /* @__PURE__ */ jsx28("div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
5312
+ result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx28("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx28(
4910
5313
  WidgetRenderer,
4911
5314
  {
4912
5315
  widget,
@@ -4915,8 +5318,8 @@ ${planToExecute}`;
4915
5318
  widget.id
4916
5319
  )) })
4917
5320
  ] }) }),
4918
- state === "success" && result && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4919
- /* @__PURE__ */ jsxs18(
5321
+ state === "success" && result && isCompact && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5322
+ /* @__PURE__ */ jsxs22(
4920
5323
  "div",
4921
5324
  {
4922
5325
  className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
@@ -4925,12 +5328,12 @@ ${planToExecute}`;
4925
5328
  setResult(null);
4926
5329
  },
4927
5330
  children: [
4928
- /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4929
- /* @__PURE__ */ jsx24("div", { className: "text-green-700 dark:text-green-300 text-sm truncate flex-1 min-w-0", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
5331
+ /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
5332
+ /* @__PURE__ */ jsx28("div", { className: "text-green-700 dark:text-green-300 text-sm truncate flex-1 min-w-0", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
4930
5333
  ]
4931
5334
  }
4932
5335
  ),
4933
- /* @__PURE__ */ jsx24(
5336
+ /* @__PURE__ */ jsx28(
4934
5337
  "button",
4935
5338
  {
4936
5339
  onClick: () => {
@@ -4946,24 +5349,24 @@ ${planToExecute}`;
4946
5349
  "!text-lg"
4947
5350
  ),
4948
5351
  title: "New command",
4949
- children: /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
5352
+ children: /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
4950
5353
  }
4951
5354
  )
4952
5355
  ] })
4953
5356
  ] }),
4954
- !isCompact && /* @__PURE__ */ jsxs18("div", { className: "p-3 flex items-center justify-between gap-2", children: [
4955
- /* @__PURE__ */ jsx24("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4956
- enableFileUpload && /* @__PURE__ */ jsx24(
5357
+ !isCompact && /* @__PURE__ */ jsxs22("div", { className: "p-3 flex items-center justify-between gap-2", children: [
5358
+ /* @__PURE__ */ jsx28("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs22(Fragment7, { children: [
5359
+ enableFileUpload && /* @__PURE__ */ jsx28(
4957
5360
  "button",
4958
5361
  {
4959
5362
  onClick: () => fileInputRef.current?.click(),
4960
5363
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
4961
5364
  title: "Attach file",
4962
- children: /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
5365
+ children: /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
4963
5366
  }
4964
5367
  ),
4965
- planMode && /* @__PURE__ */ jsxs18("div", { className: "relative settings-menu-container", children: [
4966
- /* @__PURE__ */ jsx24(
5368
+ planMode && /* @__PURE__ */ jsxs22("div", { className: "relative settings-menu-container", children: [
5369
+ /* @__PURE__ */ jsx28(
4967
5370
  "button",
4968
5371
  {
4969
5372
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -4972,28 +5375,28 @@ ${planToExecute}`;
4972
5375
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
4973
5376
  ),
4974
5377
  title: "Settings",
4975
- children: /* @__PURE__ */ jsxs18("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4976
- /* @__PURE__ */ jsx24("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
4977
- /* @__PURE__ */ jsx24("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
4978
- /* @__PURE__ */ jsx24("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
4979
- /* @__PURE__ */ jsx24("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
4980
- /* @__PURE__ */ jsx24("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
4981
- /* @__PURE__ */ jsx24("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
4982
- /* @__PURE__ */ jsx24("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
4983
- /* @__PURE__ */ jsx24("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
4984
- /* @__PURE__ */ jsx24("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
5378
+ children: /* @__PURE__ */ jsxs22("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
5379
+ /* @__PURE__ */ jsx28("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
5380
+ /* @__PURE__ */ jsx28("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
5381
+ /* @__PURE__ */ jsx28("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
5382
+ /* @__PURE__ */ jsx28("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
5383
+ /* @__PURE__ */ jsx28("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
5384
+ /* @__PURE__ */ jsx28("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
5385
+ /* @__PURE__ */ jsx28("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
5386
+ /* @__PURE__ */ jsx28("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
5387
+ /* @__PURE__ */ jsx28("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
4985
5388
  ] })
4986
5389
  }
4987
5390
  ),
4988
- showSettingsMenu && /* @__PURE__ */ jsx24("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs18("label", { className: "flex items-center justify-between cursor-pointer group", children: [
4989
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4990
- /* @__PURE__ */ jsx24("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
4991
- /* @__PURE__ */ jsxs18("div", { children: [
4992
- /* @__PURE__ */ jsx24("div", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
4993
- /* @__PURE__ */ jsx24("div", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "Review before executing" })
5391
+ showSettingsMenu && /* @__PURE__ */ jsx28("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs22("label", { className: "flex items-center justify-between cursor-pointer group", children: [
5392
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
5393
+ /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5394
+ /* @__PURE__ */ jsxs22("div", { children: [
5395
+ /* @__PURE__ */ jsx28("div", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
5396
+ /* @__PURE__ */ jsx28("div", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "Review before executing" })
4994
5397
  ] })
4995
5398
  ] }),
4996
- /* @__PURE__ */ jsx24(
5399
+ /* @__PURE__ */ jsx28(
4997
5400
  "button",
4998
5401
  {
4999
5402
  onClick: (e) => {
@@ -5005,7 +5408,7 @@ ${planToExecute}`;
5005
5408
  internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
5006
5409
  ),
5007
5410
  type: "button",
5008
- children: /* @__PURE__ */ jsx24(
5411
+ children: /* @__PURE__ */ jsx28(
5009
5412
  "span",
5010
5413
  {
5011
5414
  className: cn(
@@ -5019,9 +5422,9 @@ ${planToExecute}`;
5019
5422
  ] }) })
5020
5423
  ] })
5021
5424
  ] }) }),
5022
- !(state === "idle" && allowInput) && /* @__PURE__ */ jsx24("div", {}),
5023
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
5024
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx24(
5425
+ !(state === "idle" && allowInput) && /* @__PURE__ */ jsx28("div", {}),
5426
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
5427
+ (state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx28(
5025
5428
  "button",
5026
5429
  {
5027
5430
  onClick: resetCommand,
@@ -5029,7 +5432,7 @@ ${planToExecute}`;
5029
5432
  children: "Reset"
5030
5433
  }
5031
5434
  ),
5032
- (state === "idle" || state === "error") && /* @__PURE__ */ jsx24(
5435
+ (state === "idle" || state === "error") && /* @__PURE__ */ jsx28(
5033
5436
  "button",
5034
5437
  {
5035
5438
  onClick: () => executeCommand(),
@@ -5045,29 +5448,29 @@ ${planToExecute}`;
5045
5448
  !command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
5046
5449
  ),
5047
5450
  title: state === "error" ? "Retry" : "Execute",
5048
- children: state === "error" ? /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx24("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx24("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
5451
+ children: state === "error" ? /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx28("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx28("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
5049
5452
  }
5050
5453
  )
5051
5454
  ] })
5052
5455
  ] }),
5053
- showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx24("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs18("div", { className: "bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
5054
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between p-6 border-b border-neutral-200 dark:border-neutral-700", children: [
5055
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-3", children: [
5056
- /* @__PURE__ */ jsx24("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5057
- /* @__PURE__ */ jsx24("h2", { className: "text-xl font-semibold text-neutral-900 dark:text-white", children: "Proposed Execution Plan" })
5456
+ showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx28("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs22("div", { className: "bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
5457
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between p-6 border-b border-neutral-200 dark:border-neutral-700", children: [
5458
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-3", children: [
5459
+ /* @__PURE__ */ jsx28("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
5460
+ /* @__PURE__ */ jsx28("h2", { className: "text-xl font-semibold text-neutral-900 dark:text-white", children: "Proposed Execution Plan" })
5058
5461
  ] }),
5059
- /* @__PURE__ */ jsx24(
5462
+ /* @__PURE__ */ jsx28(
5060
5463
  "button",
5061
5464
  {
5062
5465
  onClick: () => setShowPlanDetails(false),
5063
5466
  className: "text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors",
5064
- children: /* @__PURE__ */ jsx24("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx24("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
5467
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
5065
5468
  }
5066
5469
  )
5067
5470
  ] }),
5068
- /* @__PURE__ */ jsx24("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx24("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx24("div", { className: "text-neutral-700 dark:text-neutral-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
5069
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800/50", children: [
5070
- /* @__PURE__ */ jsx24(
5471
+ /* @__PURE__ */ jsx28("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx28("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx28("div", { className: "text-neutral-700 dark:text-neutral-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
5472
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800/50", children: [
5473
+ /* @__PURE__ */ jsx28(
5071
5474
  "button",
5072
5475
  {
5073
5476
  onClick: rejectPlan,
@@ -5075,7 +5478,7 @@ ${planToExecute}`;
5075
5478
  children: "Modify Command"
5076
5479
  }
5077
5480
  ),
5078
- /* @__PURE__ */ jsx24(
5481
+ /* @__PURE__ */ jsx28(
5079
5482
  "button",
5080
5483
  {
5081
5484
  onClick: approvePlan,
@@ -5085,7 +5488,7 @@ ${planToExecute}`;
5085
5488
  )
5086
5489
  ] })
5087
5490
  ] }) }),
5088
- /* @__PURE__ */ jsx24(
5491
+ /* @__PURE__ */ jsx28(
5089
5492
  "input",
5090
5493
  {
5091
5494
  ref: fileInputRef,
@@ -5096,7 +5499,7 @@ ${planToExecute}`;
5096
5499
  accept: "image/*,application/pdf,.doc,.docx,.txt"
5097
5500
  }
5098
5501
  ),
5099
- /* @__PURE__ */ jsx24("style", { dangerouslySetInnerHTML: {
5502
+ /* @__PURE__ */ jsx28("style", { dangerouslySetInnerHTML: {
5100
5503
  __html: `
5101
5504
  @keyframes pulse-border {
5102
5505
  0%, 100% {
@@ -5117,8 +5520,8 @@ ${planToExecute}`;
5117
5520
  }
5118
5521
 
5119
5522
  // src/components/Prompt/Prompt.tsx
5120
- import { useState as useState9 } from "react";
5121
- import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
5523
+ import { useState as useState12 } from "react";
5524
+ import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
5122
5525
  function Prompt({
5123
5526
  agentId,
5124
5527
  placeholder = "Enter your prompt...",
@@ -5135,9 +5538,9 @@ function Prompt({
5135
5538
  showSuggestions = false,
5136
5539
  className
5137
5540
  }) {
5138
- const [value, setValue] = useState9(initialValue);
5139
- const [isLoading, setIsLoading] = useState9(false);
5140
- const [suggestions] = useState9(["Plan a trip", "Write a description", "Analyze data"]);
5541
+ const [value, setValue] = useState12(initialValue);
5542
+ const [isLoading, setIsLoading] = useState12(false);
5543
+ const [suggestions] = useState12(["Plan a trip", "Write a description", "Analyze data"]);
5141
5544
  const handleChange = (e) => {
5142
5545
  const newValue = e.target.value;
5143
5546
  if (!maxLength || newValue.length <= maxLength) {
@@ -5180,9 +5583,9 @@ function Prompt({
5180
5583
  handleSubmit();
5181
5584
  }
5182
5585
  };
5183
- return /* @__PURE__ */ jsxs19("div", { className: cn("space-y-2", className), children: [
5184
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
5185
- /* @__PURE__ */ jsx25(
5586
+ return /* @__PURE__ */ jsxs23("div", { className: cn("space-y-2", className), children: [
5587
+ /* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
5588
+ /* @__PURE__ */ jsx29(
5186
5589
  "input",
5187
5590
  {
5188
5591
  type: "text",
@@ -5195,7 +5598,7 @@ function Prompt({
5195
5598
  className: "flex-1 px-4 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
5196
5599
  }
5197
5600
  ),
5198
- submitOn === "button" && /* @__PURE__ */ jsx25(
5601
+ submitOn === "button" && /* @__PURE__ */ jsx29(
5199
5602
  "button",
5200
5603
  {
5201
5604
  onClick: handleSubmit,
@@ -5205,13 +5608,13 @@ function Prompt({
5205
5608
  }
5206
5609
  )
5207
5610
  ] }),
5208
- maxLength && /* @__PURE__ */ jsxs19("p", { className: "text-xs text-neutral-500", children: [
5611
+ maxLength && /* @__PURE__ */ jsxs23("p", { className: "text-xs text-neutral-500", children: [
5209
5612
  value.length,
5210
5613
  " / ",
5211
5614
  maxLength,
5212
5615
  " characters"
5213
5616
  ] }),
5214
- showSuggestions && !value && /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx25(
5617
+ showSuggestions && !value && /* @__PURE__ */ jsx29("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx29(
5215
5618
  "button",
5216
5619
  {
5217
5620
  onClick: () => setValue(suggestion),
@@ -5220,16 +5623,16 @@ function Prompt({
5220
5623
  },
5221
5624
  idx
5222
5625
  )) }),
5223
- isLoading && /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 text-sm text-neutral-500", children: [
5224
- /* @__PURE__ */ jsx25("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
5225
- /* @__PURE__ */ jsx25("span", { children: "AI is processing your request..." })
5626
+ isLoading && /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 text-sm text-neutral-500", children: [
5627
+ /* @__PURE__ */ jsx29("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
5628
+ /* @__PURE__ */ jsx29("span", { children: "AI is processing your request..." })
5226
5629
  ] })
5227
5630
  ] });
5228
5631
  }
5229
5632
 
5230
5633
  // src/components/Stream/Stream.tsx
5231
- import { useState as useState10, useEffect as useEffect8 } from "react";
5232
- import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
5634
+ import { useState as useState13, useEffect as useEffect9 } from "react";
5635
+ import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
5233
5636
  function Stream({
5234
5637
  agentId,
5235
5638
  prompt,
@@ -5245,10 +5648,10 @@ function Stream({
5245
5648
  typingSpeed = 30,
5246
5649
  className
5247
5650
  }) {
5248
- const [text, setText] = useState10("");
5249
- const [isStreaming, setIsStreaming] = useState10(false);
5250
- const [isComplete, setIsComplete] = useState10(false);
5251
- useEffect8(() => {
5651
+ const [text, setText] = useState13("");
5652
+ const [isStreaming, setIsStreaming] = useState13(false);
5653
+ const [isComplete, setIsComplete] = useState13(false);
5654
+ useEffect9(() => {
5252
5655
  if (autoStart && !isStreaming && !isComplete) {
5253
5656
  startStreaming();
5254
5657
  }
@@ -5309,7 +5712,7 @@ function Stream({
5309
5712
  plain: "text-neutral-900 dark:text-neutral-100"
5310
5713
  };
5311
5714
  if (!isStreaming && !isComplete) {
5312
- return /* @__PURE__ */ jsx26("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx26(
5715
+ return /* @__PURE__ */ jsx30("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx30(
5313
5716
  "button",
5314
5717
  {
5315
5718
  onClick: startStreaming,
@@ -5318,19 +5721,19 @@ function Stream({
5318
5721
  }
5319
5722
  ) });
5320
5723
  }
5321
- return /* @__PURE__ */ jsxs20("div", { className: cn(variantClasses[variant], className), children: [
5724
+ return /* @__PURE__ */ jsxs24("div", { className: cn(variantClasses[variant], className), children: [
5322
5725
  text,
5323
- isStreaming && showCursor && /* @__PURE__ */ jsx26("span", { className: "apteva-stream-cursor" })
5726
+ isStreaming && showCursor && /* @__PURE__ */ jsx30("span", { className: "apteva-stream-cursor" })
5324
5727
  ] });
5325
5728
  }
5326
5729
 
5327
5730
  // src/components/Threads/ThreadList.tsx
5328
- import { useState as useState11 } from "react";
5731
+ import { useState as useState14 } from "react";
5329
5732
 
5330
5733
  // src/components/Threads/ThreadItem.tsx
5331
- import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
5734
+ import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
5332
5735
  function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
5333
- return /* @__PURE__ */ jsxs21(
5736
+ return /* @__PURE__ */ jsxs25(
5334
5737
  "div",
5335
5738
  {
5336
5739
  className: cn("apteva-thread-item", {
@@ -5338,19 +5741,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
5338
5741
  }),
5339
5742
  onClick: onSelect,
5340
5743
  children: [
5341
- /* @__PURE__ */ jsxs21("div", { className: "flex-1 min-w-0", children: [
5342
- /* @__PURE__ */ jsx27("h4", { className: "font-semibold text-neutral-900 dark:text-white truncate", children: thread.title }),
5343
- thread.preview && /* @__PURE__ */ jsx27("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 truncate", children: thread.preview }),
5344
- /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 mt-1 text-xs text-neutral-500", children: [
5345
- /* @__PURE__ */ jsxs21("span", { children: [
5744
+ /* @__PURE__ */ jsxs25("div", { className: "flex-1 min-w-0", children: [
5745
+ /* @__PURE__ */ jsx31("h4", { className: "font-semibold text-neutral-900 dark:text-white truncate", children: thread.title }),
5746
+ thread.preview && /* @__PURE__ */ jsx31("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 truncate", children: thread.preview }),
5747
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 mt-1 text-xs text-neutral-500", children: [
5748
+ /* @__PURE__ */ jsxs25("span", { children: [
5346
5749
  thread.messageCount,
5347
5750
  " messages"
5348
5751
  ] }),
5349
- /* @__PURE__ */ jsx27("span", { children: "\u2022" }),
5350
- /* @__PURE__ */ jsx27("span", { children: formatRelativeTime(thread.updatedAt) })
5752
+ /* @__PURE__ */ jsx31("span", { children: "\u2022" }),
5753
+ /* @__PURE__ */ jsx31("span", { children: formatRelativeTime(thread.updatedAt) })
5351
5754
  ] })
5352
5755
  ] }),
5353
- onDelete && /* @__PURE__ */ jsx27(
5756
+ onDelete && /* @__PURE__ */ jsx31(
5354
5757
  "button",
5355
5758
  {
5356
5759
  onClick: (e) => {
@@ -5380,7 +5783,7 @@ function formatRelativeTime(date) {
5380
5783
  }
5381
5784
 
5382
5785
  // src/components/Threads/ThreadList.tsx
5383
- import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
5786
+ import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
5384
5787
  function ThreadList({
5385
5788
  threads,
5386
5789
  currentThreadId,
@@ -5389,13 +5792,13 @@ function ThreadList({
5389
5792
  showSearch = false,
5390
5793
  groupBy = "none"
5391
5794
  }) {
5392
- const [searchQuery, setSearchQuery] = useState11("");
5795
+ const [searchQuery, setSearchQuery] = useState14("");
5393
5796
  const filteredThreads = threads.filter(
5394
5797
  (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
5395
5798
  );
5396
5799
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
5397
- return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col h-full", children: [
5398
- showSearch && /* @__PURE__ */ jsx28("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx28(
5800
+ return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col h-full", children: [
5801
+ showSearch && /* @__PURE__ */ jsx32("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx32(
5399
5802
  "input",
5400
5803
  {
5401
5804
  type: "text",
@@ -5405,10 +5808,10 @@ function ThreadList({
5405
5808
  className: "w-full px-3 py-2 text-sm border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
5406
5809
  }
5407
5810
  ) }),
5408
- /* @__PURE__ */ jsxs22("div", { className: "flex-1 overflow-y-auto", children: [
5409
- Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs22("div", { children: [
5410
- groupBy !== "none" && /* @__PURE__ */ jsx28("div", { className: "px-3 py-2 text-xs font-semibold text-neutral-500 uppercase", children: group }),
5411
- groupThreads.map((thread) => /* @__PURE__ */ jsx28(
5811
+ /* @__PURE__ */ jsxs26("div", { className: "flex-1 overflow-y-auto", children: [
5812
+ Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs26("div", { children: [
5813
+ groupBy !== "none" && /* @__PURE__ */ jsx32("div", { className: "px-3 py-2 text-xs font-semibold text-neutral-500 uppercase", children: group }),
5814
+ groupThreads.map((thread) => /* @__PURE__ */ jsx32(
5412
5815
  ThreadItem,
5413
5816
  {
5414
5817
  thread,
@@ -5419,9 +5822,9 @@ function ThreadList({
5419
5822
  thread.id
5420
5823
  ))
5421
5824
  ] }, group)),
5422
- filteredThreads.length === 0 && /* @__PURE__ */ jsxs22("div", { className: "p-8 text-center text-neutral-500", children: [
5423
- /* @__PURE__ */ jsx28("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
5424
- /* @__PURE__ */ jsx28("p", { children: "No conversations found" })
5825
+ filteredThreads.length === 0 && /* @__PURE__ */ jsxs26("div", { className: "p-8 text-center text-neutral-500", children: [
5826
+ /* @__PURE__ */ jsx32("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
5827
+ /* @__PURE__ */ jsx32("p", { children: "No conversations found" })
5425
5828
  ] })
5426
5829
  ] })
5427
5830
  ] });
@@ -5453,7 +5856,7 @@ function groupThreadsByDate(threads) {
5453
5856
  }
5454
5857
 
5455
5858
  // src/components/Threads/Threads.tsx
5456
- import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
5859
+ import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
5457
5860
  function Threads({
5458
5861
  threads,
5459
5862
  currentThreadId,
@@ -5472,8 +5875,8 @@ function Threads({
5472
5875
  tabs: "flex gap-2 border-b border-neutral-200 dark:border-neutral-700 overflow-x-auto"
5473
5876
  };
5474
5877
  if (variant === "tabs") {
5475
- return /* @__PURE__ */ jsxs23("div", { className: cn(variantClasses[variant], className), children: [
5476
- threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx29(
5878
+ return /* @__PURE__ */ jsxs27("div", { className: cn(variantClasses[variant], className), children: [
5879
+ threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx33(
5477
5880
  "button",
5478
5881
  {
5479
5882
  onClick: () => onThreadSelect?.(thread.id),
@@ -5485,7 +5888,7 @@ function Threads({
5485
5888
  },
5486
5889
  thread.id
5487
5890
  )),
5488
- showNewButton && onNewThread && /* @__PURE__ */ jsx29(
5891
+ showNewButton && onNewThread && /* @__PURE__ */ jsx33(
5489
5892
  "button",
5490
5893
  {
5491
5894
  onClick: onNewThread,
@@ -5495,8 +5898,8 @@ function Threads({
5495
5898
  )
5496
5899
  ] });
5497
5900
  }
5498
- return /* @__PURE__ */ jsxs23("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
5499
- showNewButton && onNewThread && /* @__PURE__ */ jsx29("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx29(
5901
+ return /* @__PURE__ */ jsxs27("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
5902
+ showNewButton && onNewThread && /* @__PURE__ */ jsx33("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx33(
5500
5903
  "button",
5501
5904
  {
5502
5905
  onClick: onNewThread,
@@ -5504,7 +5907,7 @@ function Threads({
5504
5907
  children: "+ New Conversation"
5505
5908
  }
5506
5909
  ) }),
5507
- /* @__PURE__ */ jsx29(
5910
+ /* @__PURE__ */ jsx33(
5508
5911
  ThreadList,
5509
5912
  {
5510
5913
  threads,
@@ -5519,11 +5922,11 @@ function Threads({
5519
5922
  }
5520
5923
 
5521
5924
  // src/components/AutoInterface/AutoInterface.tsx
5522
- import { useState as useState13, useRef as useRef8, useCallback, useEffect as useEffect9 } from "react";
5925
+ import { useState as useState16, useRef as useRef10, useCallback as useCallback3, useEffect as useEffect10 } from "react";
5523
5926
 
5524
5927
  // src/components/AutoInterface/LayoutRenderer.tsx
5525
- import { useState as useState12 } from "react";
5526
- import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
5928
+ import { useState as useState15 } from "react";
5929
+ import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
5527
5930
  var gapClasses = {
5528
5931
  none: "gap-0",
5529
5932
  sm: "gap-2",
@@ -5547,27 +5950,27 @@ function LayoutRenderer({ node, onAction, renderNode }) {
5547
5950
  const children = node.children || [];
5548
5951
  switch (node.layout) {
5549
5952
  case "page":
5550
- return /* @__PURE__ */ jsx30(PageLayout, { node, renderNode });
5953
+ return /* @__PURE__ */ jsx34(PageLayout, { node, renderNode });
5551
5954
  case "row":
5552
- return /* @__PURE__ */ jsx30(RowLayout, { node, renderNode });
5955
+ return /* @__PURE__ */ jsx34(RowLayout, { node, renderNode });
5553
5956
  case "columns":
5554
- return /* @__PURE__ */ jsx30(ColumnsLayout, { node, renderNode });
5957
+ return /* @__PURE__ */ jsx34(ColumnsLayout, { node, renderNode });
5555
5958
  case "stack":
5556
- return /* @__PURE__ */ jsx30(StackLayout, { node, renderNode });
5959
+ return /* @__PURE__ */ jsx34(StackLayout, { node, renderNode });
5557
5960
  case "sidebar":
5558
- return /* @__PURE__ */ jsx30(SidebarLayout, { node, renderNode });
5961
+ return /* @__PURE__ */ jsx34(SidebarLayout, { node, renderNode });
5559
5962
  case "tabs":
5560
- return /* @__PURE__ */ jsx30(TabsLayout, { node, renderNode });
5963
+ return /* @__PURE__ */ jsx34(TabsLayout, { node, renderNode });
5561
5964
  default:
5562
- return /* @__PURE__ */ jsx30("div", { className: "space-y-4", children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id)) });
5965
+ return /* @__PURE__ */ jsx34("div", { className: "space-y-4", children: children.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id)) });
5563
5966
  }
5564
5967
  }
5565
5968
  function PageLayout({ node, renderNode }) {
5566
5969
  const { title, padding = "md", maxWidth = "xl" } = node.props || {};
5567
5970
  const children = node.children || [];
5568
- return /* @__PURE__ */ jsxs24("div", { className: cn("w-full mx-auto", paddingClasses[padding], maxWidthClasses[maxWidth]), children: [
5569
- title && /* @__PURE__ */ jsx30("h1", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white mb-6", children: title }),
5570
- /* @__PURE__ */ jsx30("div", { className: "space-y-6", children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id)) })
5971
+ return /* @__PURE__ */ jsxs28("div", { className: cn("w-full mx-auto", paddingClasses[padding], maxWidthClasses[maxWidth]), children: [
5972
+ title && /* @__PURE__ */ jsx34("h1", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white mb-6", children: title }),
5973
+ /* @__PURE__ */ jsx34("div", { className: "space-y-6", children: children.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id)) })
5571
5974
  ] });
5572
5975
  }
5573
5976
  function RowLayout({ node, renderNode }) {
@@ -5580,12 +5983,12 @@ function RowLayout({ node, renderNode }) {
5580
5983
  end: "items-end",
5581
5984
  stretch: "items-stretch"
5582
5985
  };
5583
- return /* @__PURE__ */ jsx30(
5986
+ return /* @__PURE__ */ jsx34(
5584
5987
  "div",
5585
5988
  {
5586
5989
  className: cn("grid", gapClasses[gap], alignClasses[align]),
5587
5990
  style: { gridTemplateColumns: templateColumns },
5588
- children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id))
5991
+ children: children.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id))
5589
5992
  }
5590
5993
  );
5591
5994
  }
@@ -5593,12 +5996,12 @@ function ColumnsLayout({ node, renderNode }) {
5593
5996
  const { count, gap = "md" } = node.props || {};
5594
5997
  const children = node.children || [];
5595
5998
  const colCount = count || children.length;
5596
- return /* @__PURE__ */ jsx30(
5999
+ return /* @__PURE__ */ jsx34(
5597
6000
  "div",
5598
6001
  {
5599
6002
  className: cn("grid", gapClasses[gap]),
5600
6003
  style: { gridTemplateColumns: `repeat(${colCount}, 1fr)` },
5601
- children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id))
6004
+ children: children.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id))
5602
6005
  }
5603
6006
  );
5604
6007
  }
@@ -5611,14 +6014,14 @@ function StackLayout({ node, renderNode }) {
5611
6014
  right: "items-end",
5612
6015
  stretch: "items-stretch"
5613
6016
  };
5614
- return /* @__PURE__ */ jsx30("div", { className: cn("flex flex-col", gapClasses[gap], alignClasses[align]), children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id)) });
6017
+ return /* @__PURE__ */ jsx34("div", { className: cn("flex flex-col", gapClasses[gap], alignClasses[align]), children: children.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id)) });
5615
6018
  }
5616
6019
  function SidebarLayout({ node, renderNode }) {
5617
6020
  const { side = "left", width = "280px" } = node.props || {};
5618
6021
  const children = node.children || [];
5619
6022
  const [sidebarChild, ...mainChildren] = side === "left" ? children : [...children].reverse();
5620
6023
  if (!sidebarChild) return null;
5621
- const sidebar = /* @__PURE__ */ jsx30(
6024
+ const sidebar = /* @__PURE__ */ jsx34(
5622
6025
  "div",
5623
6026
  {
5624
6027
  className: "flex-shrink-0 overflow-y-auto border-neutral-200 dark:border-neutral-700",
@@ -5626,11 +6029,11 @@ function SidebarLayout({ node, renderNode }) {
5626
6029
  children: renderNode(sidebarChild)
5627
6030
  }
5628
6031
  );
5629
- const main = /* @__PURE__ */ jsx30("div", { className: "flex-1 overflow-y-auto min-w-0", children: mainChildren.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id)) });
5630
- return /* @__PURE__ */ jsx30("div", { className: "flex h-full gap-4", children: side === "left" ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
6032
+ const main = /* @__PURE__ */ jsx34("div", { className: "flex-1 overflow-y-auto min-w-0", children: mainChildren.map((child) => /* @__PURE__ */ jsx34("div", { children: renderNode(child) }, child.id)) });
6033
+ return /* @__PURE__ */ jsx34("div", { className: "flex h-full gap-4", children: side === "left" ? /* @__PURE__ */ jsxs28(Fragment8, { children: [
5631
6034
  sidebar,
5632
6035
  main
5633
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
6036
+ ] }) : /* @__PURE__ */ jsxs28(Fragment8, { children: [
5634
6037
  main,
5635
6038
  sidebar
5636
6039
  ] }) });
@@ -5638,9 +6041,9 @@ function SidebarLayout({ node, renderNode }) {
5638
6041
  function TabsLayout({ node, renderNode }) {
5639
6042
  const { labels = [], defaultTab = 0 } = node.props || {};
5640
6043
  const children = node.children || [];
5641
- const [activeTab, setActiveTab] = useState12(defaultTab);
5642
- return /* @__PURE__ */ jsxs24("div", { children: [
5643
- /* @__PURE__ */ jsx30("div", { className: "flex border-b border-neutral-200 dark:border-neutral-700 mb-4", children: labels.map((label, idx) => /* @__PURE__ */ jsx30(
6044
+ const [activeTab, setActiveTab] = useState15(defaultTab);
6045
+ return /* @__PURE__ */ jsxs28("div", { children: [
6046
+ /* @__PURE__ */ jsx34("div", { className: "flex border-b border-neutral-200 dark:border-neutral-700 mb-4", children: labels.map((label, idx) => /* @__PURE__ */ jsx34(
5644
6047
  "button",
5645
6048
  {
5646
6049
  onClick: () => setActiveTab(idx),
@@ -5657,7 +6060,7 @@ function TabsLayout({ node, renderNode }) {
5657
6060
  }
5658
6061
 
5659
6062
  // src/components/AutoInterface/InterfaceRenderer.tsx
5660
- import { Fragment as Fragment8, jsx as jsx31 } from "react/jsx-runtime";
6063
+ import { Fragment as Fragment9, jsx as jsx35 } from "react/jsx-runtime";
5661
6064
  var STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["type", "id", "layout", "props", "children", "actions", "metadata", "isStreaming"]);
5662
6065
  function normalizeNode(n) {
5663
6066
  let node = { ...n };
@@ -5687,7 +6090,7 @@ function InterfaceRenderer({ node, onAction }) {
5687
6090
  const renderNode = (rawNode) => {
5688
6091
  const n = normalizeNode(rawNode);
5689
6092
  if (n.type === "layout" && n.layout) {
5690
- return /* @__PURE__ */ jsx31(
6093
+ return /* @__PURE__ */ jsx35(
5691
6094
  LayoutRenderer,
5692
6095
  {
5693
6096
  node: n,
@@ -5697,7 +6100,7 @@ function InterfaceRenderer({ node, onAction }) {
5697
6100
  n.id
5698
6101
  );
5699
6102
  }
5700
- return /* @__PURE__ */ jsx31(
6103
+ return /* @__PURE__ */ jsx35(
5701
6104
  WidgetRenderer,
5702
6105
  {
5703
6106
  widget: {
@@ -5713,33 +6116,33 @@ function InterfaceRenderer({ node, onAction }) {
5713
6116
  n.id
5714
6117
  );
5715
6118
  };
5716
- return /* @__PURE__ */ jsx31(Fragment8, { children: renderNode(node) });
6119
+ return /* @__PURE__ */ jsx35(Fragment9, { children: renderNode(node) });
5717
6120
  }
5718
6121
 
5719
6122
  // src/components/AutoInterface/InterfaceSkeleton.tsx
5720
- import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
6123
+ import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
5721
6124
  function InterfaceSkeleton({ className }) {
5722
- return /* @__PURE__ */ jsxs25("div", { className: cn("animate-pulse space-y-6 p-6", className), children: [
5723
- /* @__PURE__ */ jsx32("div", { className: "h-7 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
5724
- /* @__PURE__ */ jsx32("div", { className: "grid grid-cols-4 gap-4", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs25("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-2", children: [
5725
- /* @__PURE__ */ jsx32("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-2/3" }),
5726
- /* @__PURE__ */ jsx32("div", { className: "h-8 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" })
6125
+ return /* @__PURE__ */ jsxs29("div", { className: cn("animate-pulse space-y-6 p-6", className), children: [
6126
+ /* @__PURE__ */ jsx36("div", { className: "h-7 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
6127
+ /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-4 gap-4", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs29("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-2", children: [
6128
+ /* @__PURE__ */ jsx36("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-2/3" }),
6129
+ /* @__PURE__ */ jsx36("div", { className: "h-8 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" })
5727
6130
  ] }, i)) }),
5728
- /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-3 gap-4", children: [
5729
- /* @__PURE__ */ jsxs25("div", { className: "col-span-2 border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
5730
- /* @__PURE__ */ jsx32("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4" }),
5731
- /* @__PURE__ */ jsx32("div", { className: "h-40 bg-neutral-200 dark:bg-neutral-700 rounded" })
6131
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4", children: [
6132
+ /* @__PURE__ */ jsxs29("div", { className: "col-span-2 border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
6133
+ /* @__PURE__ */ jsx36("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4" }),
6134
+ /* @__PURE__ */ jsx36("div", { className: "h-40 bg-neutral-200 dark:bg-neutral-700 rounded" })
5732
6135
  ] }),
5733
- /* @__PURE__ */ jsxs25("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
5734
- /* @__PURE__ */ jsx32("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
5735
- [1, 2, 3].map((i) => /* @__PURE__ */ jsx32("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }, i))
6136
+ /* @__PURE__ */ jsxs29("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
6137
+ /* @__PURE__ */ jsx36("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
6138
+ [1, 2, 3].map((i) => /* @__PURE__ */ jsx36("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }, i))
5736
6139
  ] })
5737
6140
  ] })
5738
6141
  ] });
5739
6142
  }
5740
6143
 
5741
6144
  // src/components/AutoInterface/AutoInterface.tsx
5742
- import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
6145
+ import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
5743
6146
  async function generateInitialInterface(apiUrl, apiKey, agentId, prompt) {
5744
6147
  const systemContext = generateCompactInterfaceContext();
5745
6148
  const message = `${systemContext}
@@ -5789,19 +6192,19 @@ function AutoInterface({
5789
6192
  theme,
5790
6193
  className
5791
6194
  }) {
5792
- const [interfaceSpec, setInterfaceSpec] = useState13(initialInterface || null);
5793
- const [isGenerating, setIsGenerating] = useState13(false);
5794
- const [chatCollapsed, setChatCollapsed] = useState13(false);
5795
- const chatRef = useRef8(null);
6195
+ const [interfaceSpec, setInterfaceSpec] = useState16(initialInterface || null);
6196
+ const [isGenerating, setIsGenerating] = useState16(false);
6197
+ const [chatCollapsed, setChatCollapsed] = useState16(false);
6198
+ const chatRef = useRef10(null);
5796
6199
  const systemContext = [
5797
6200
  generateInterfaceContext(),
5798
6201
  context || ""
5799
6202
  ].filter(Boolean).join("\n\n");
5800
- const updateInterface = useCallback((newSpec) => {
6203
+ const updateInterface = useCallback3((newSpec) => {
5801
6204
  setInterfaceSpec(newSpec);
5802
6205
  onInterfaceChange?.(newSpec);
5803
6206
  }, [onInterfaceChange]);
5804
- const handleAction = useCallback((action) => {
6207
+ const handleAction = useCallback3((action) => {
5805
6208
  onAction?.(action);
5806
6209
  if (chatRef.current) {
5807
6210
  chatRef.current.sendMessage(
@@ -5809,7 +6212,7 @@ function AutoInterface({
5809
6212
  );
5810
6213
  }
5811
6214
  }, [onAction]);
5812
- const handleMessageComplete = useCallback((result) => {
6215
+ const handleMessageComplete = useCallback3((result) => {
5813
6216
  if (!result?.data) return;
5814
6217
  const text = typeof result.data === "string" ? result.data : result.data.message || "";
5815
6218
  console.log("[AutoInterface] Chat message complete, text (" + text.length + " chars):", text.substring(0, 300));
@@ -5830,7 +6233,7 @@ function AutoInterface({
5830
6233
  }
5831
6234
  setIsGenerating(false);
5832
6235
  }, [interfaceSpec, updateInterface]);
5833
- useEffect9(() => {
6236
+ useEffect10(() => {
5834
6237
  if (!initialPrompt || initialInterface || useMock) return;
5835
6238
  if (!apiUrl) return;
5836
6239
  let cancelled = false;
@@ -5859,17 +6262,17 @@ function AutoInterface({
5859
6262
  }, [initialPrompt]);
5860
6263
  const hasInterface = interfaceSpec !== null;
5861
6264
  const showSkeleton = isGenerating && !hasInterface;
5862
- return /* @__PURE__ */ jsxs26("div", { className: cn(
6265
+ return /* @__PURE__ */ jsxs30("div", { className: cn(
5863
6266
  "flex h-full bg-neutral-50 dark:bg-black",
5864
6267
  chatPosition === "bottom" ? "flex-col" : "flex-row",
5865
6268
  className
5866
6269
  ), children: [
5867
- /* @__PURE__ */ jsxs26("div", { className: cn(
6270
+ /* @__PURE__ */ jsxs30("div", { className: cn(
5868
6271
  "flex-1 overflow-y-auto min-w-0",
5869
6272
  hasInterface || showSkeleton ? "" : "hidden"
5870
6273
  ), children: [
5871
- showSkeleton && /* @__PURE__ */ jsx33(InterfaceSkeleton, {}),
5872
- hasInterface && interfaceSpec && /* @__PURE__ */ jsx33("div", { className: "p-4", children: /* @__PURE__ */ jsx33(
6274
+ showSkeleton && /* @__PURE__ */ jsx37(InterfaceSkeleton, {}),
6275
+ hasInterface && interfaceSpec && /* @__PURE__ */ jsx37("div", { className: "p-4", children: /* @__PURE__ */ jsx37(
5873
6276
  InterfaceRenderer,
5874
6277
  {
5875
6278
  node: interfaceSpec.root,
@@ -5877,16 +6280,16 @@ function AutoInterface({
5877
6280
  }
5878
6281
  ) })
5879
6282
  ] }),
5880
- chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */ jsx33(
6283
+ chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */ jsx37(
5881
6284
  "button",
5882
6285
  {
5883
6286
  onClick: () => setChatCollapsed(!chatCollapsed),
5884
6287
  className: "flex-shrink-0 w-6 flex items-center justify-center border-l border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
5885
6288
  title: chatCollapsed ? "Show chat" : "Hide chat",
5886
- children: /* @__PURE__ */ jsx33("span", { className: "!text-xs !text-neutral-500 dark:!text-neutral-400", children: chatCollapsed ? "\u25C0" : "\u25B6" })
6289
+ children: /* @__PURE__ */ jsx37("span", { className: "!text-xs !text-neutral-500 dark:!text-neutral-400", children: chatCollapsed ? "\u25C0" : "\u25B6" })
5887
6290
  }
5888
6291
  ),
5889
- /* @__PURE__ */ jsx33(
6292
+ /* @__PURE__ */ jsx37(
5890
6293
  "div",
5891
6294
  {
5892
6295
  className: cn(
@@ -5897,7 +6300,7 @@ function AutoInterface({
5897
6300
  !hasInterface && !showSkeleton && "flex-1"
5898
6301
  ),
5899
6302
  style: hasInterface || showSkeleton ? chatPosition === "right" ? { width: chatWidth } : { height: "300px" } : void 0,
5900
- children: /* @__PURE__ */ jsx33(
6303
+ children: /* @__PURE__ */ jsx37(
5901
6304
  Chat,
5902
6305
  {
5903
6306
  ref: chatRef,
@@ -5955,29 +6358,29 @@ function getThemeScript() {
5955
6358
  }
5956
6359
 
5957
6360
  // src/hooks/useInterfaceState.ts
5958
- import { useState as useState14, useCallback as useCallback2 } from "react";
6361
+ import { useState as useState17, useCallback as useCallback4 } from "react";
5959
6362
  function useInterfaceState(initialSpec) {
5960
- const [spec, setSpec] = useState14(initialSpec || null);
5961
- const [isStreaming, setIsStreaming] = useState14(false);
5962
- const setInterface = useCallback2((newSpec) => {
6363
+ const [spec, setSpec] = useState17(initialSpec || null);
6364
+ const [isStreaming, setIsStreaming] = useState17(false);
6365
+ const setInterface = useCallback4((newSpec) => {
5963
6366
  setSpec(newSpec);
5964
6367
  }, []);
5965
- const clearInterface = useCallback2(() => {
6368
+ const clearInterface = useCallback4(() => {
5966
6369
  setSpec(null);
5967
6370
  }, []);
5968
- const applyInterfaceUpdate = useCallback2((update) => {
6371
+ const applyInterfaceUpdate = useCallback4((update) => {
5969
6372
  setSpec((prev) => {
5970
6373
  if (!prev) return prev;
5971
6374
  return applyUpdate(prev, update);
5972
6375
  });
5973
6376
  }, []);
5974
- const applyInterfaceUpdates = useCallback2((updates) => {
6377
+ const applyInterfaceUpdates = useCallback4((updates) => {
5975
6378
  setSpec((prev) => {
5976
6379
  if (!prev) return prev;
5977
6380
  return applyUpdates(prev, updates);
5978
6381
  });
5979
6382
  }, []);
5980
- const getNode = useCallback2((id) => {
6383
+ const getNode = useCallback4((id) => {
5981
6384
  if (!spec) return null;
5982
6385
  return findNode(spec.root, id);
5983
6386
  }, [spec]);
@@ -5994,7 +6397,7 @@ function useInterfaceState(initialSpec) {
5994
6397
  }
5995
6398
 
5996
6399
  // src/hooks/useInterfaceAI.ts
5997
- import { useCallback as useCallback3, useRef as useRef9 } from "react";
6400
+ import { useCallback as useCallback5, useRef as useRef11 } from "react";
5998
6401
  function useInterfaceAI({
5999
6402
  agentId,
6000
6403
  apiUrl,
@@ -6006,15 +6409,15 @@ function useInterfaceAI({
6006
6409
  onStreamStart,
6007
6410
  onStreamEnd
6008
6411
  }) {
6009
- const threadIdRef = useRef9(null);
6010
- const accumulatedTextRef = useRef9("");
6412
+ const threadIdRef = useRef11(null);
6413
+ const accumulatedTextRef = useRef11("");
6011
6414
  if (apiUrl || apiKey) {
6012
6415
  aptevaClient.configure({
6013
6416
  ...apiUrl && { apiUrl },
6014
6417
  ...apiKey && { apiKey }
6015
6418
  });
6016
6419
  }
6017
- const sendMessage = useCallback3(async (message) => {
6420
+ const sendMessage = useCallback5(async (message) => {
6018
6421
  accumulatedTextRef.current = "";
6019
6422
  onStreamStart?.();
6020
6423
  const systemPrompt = [
@@ -6079,6 +6482,8 @@ export {
6079
6482
  Kpi,
6080
6483
  LayoutRenderer,
6081
6484
  List,
6485
+ LiveView,
6486
+ PersistentWidgetPanel,
6082
6487
  Prompt,
6083
6488
  Spacer,
6084
6489
  Stream,