@apteva/apteva-kit 0.1.102 → 0.1.105

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
@@ -797,6 +797,347 @@ Widgets: @ui:type[{json}] - MUST use square brackets []. Example: @ui:list[{"ite
797
797
  `;
798
798
  }
799
799
 
800
+ // src/utils/interface-parser.ts
801
+ function findMatchingBracket2(text, startIndex) {
802
+ const openChar = text[startIndex];
803
+ const closeChar = openChar === "[" ? "]" : "}";
804
+ let depth = 0;
805
+ let inString = false;
806
+ let escapeNext = false;
807
+ for (let i = startIndex; i < text.length; i++) {
808
+ const char = text[i];
809
+ if (escapeNext) {
810
+ escapeNext = false;
811
+ continue;
812
+ }
813
+ if (char === "\\" && inString) {
814
+ escapeNext = true;
815
+ continue;
816
+ }
817
+ if (char === '"') {
818
+ inString = !inString;
819
+ continue;
820
+ }
821
+ if (inString) continue;
822
+ if (char === openChar || char === (openChar === "[" ? "{" : "[")) {
823
+ if (char === openChar) depth++;
824
+ } else if (char === closeChar || char === (closeChar === "]" ? "}" : "]")) {
825
+ if (char === closeChar) {
826
+ depth--;
827
+ if (depth === 0) return i;
828
+ }
829
+ }
830
+ }
831
+ return -1;
832
+ }
833
+ function parseInterfaceFromText(text) {
834
+ const marker = "@interface[";
835
+ const idx = text.indexOf(marker);
836
+ if (idx === -1) return null;
837
+ const bracketStart = idx + marker.length - 1;
838
+ const bracketEnd = findMatchingBracket2(text, bracketStart);
839
+ if (bracketEnd === -1) return null;
840
+ const jsonContent = text.slice(bracketStart + 1, bracketEnd);
841
+ try {
842
+ const parsed = JSON.parse(jsonContent);
843
+ if (!parsed.root || !parsed.root.id) return null;
844
+ return {
845
+ version: parsed.version || 1,
846
+ root: parsed.root
847
+ };
848
+ } catch {
849
+ return null;
850
+ }
851
+ }
852
+ function parseUpdatesFromText(text) {
853
+ const updates = [];
854
+ const marker = "@update[";
855
+ let searchFrom = 0;
856
+ while (true) {
857
+ const idx = text.indexOf(marker, searchFrom);
858
+ if (idx === -1) break;
859
+ const bracketStart = idx + marker.length - 1;
860
+ const bracketEnd = findMatchingBracket2(text, bracketStart);
861
+ if (bracketEnd === -1) break;
862
+ const jsonContent = text.slice(bracketStart + 1, bracketEnd);
863
+ try {
864
+ const parsed = JSON.parse(jsonContent);
865
+ if (Array.isArray(parsed)) {
866
+ updates.push(...parsed);
867
+ } else if (parsed.op && parsed.target) {
868
+ updates.push(parsed);
869
+ }
870
+ } catch {
871
+ }
872
+ searchFrom = bracketEnd + 1;
873
+ }
874
+ return updates;
875
+ }
876
+ function containsInterface(text) {
877
+ return text.includes("@interface[") || text.includes("@update[");
878
+ }
879
+ function stripInterface(text) {
880
+ let result = text;
881
+ const ifacePattern = /@interface\[/g;
882
+ let match;
883
+ while ((match = ifacePattern.exec(result)) !== null) {
884
+ const bracketStart = match.index + match[0].length - 1;
885
+ const bracketEnd = findMatchingBracket2(result, bracketStart);
886
+ if (bracketEnd === -1) break;
887
+ result = result.slice(0, match.index) + result.slice(bracketEnd + 1);
888
+ ifacePattern.lastIndex = match.index;
889
+ }
890
+ const updatePattern = /@update\[/g;
891
+ while ((match = updatePattern.exec(result)) !== null) {
892
+ const bracketStart = match.index + match[0].length - 1;
893
+ const bracketEnd = findMatchingBracket2(result, bracketStart);
894
+ if (bracketEnd === -1) break;
895
+ result = result.slice(0, match.index) + result.slice(bracketEnd + 1);
896
+ updatePattern.lastIndex = match.index;
897
+ }
898
+ return result.replace(/\s+/g, " ").trim();
899
+ }
900
+
901
+ // src/utils/interface-context.ts
902
+ function generateInterfaceContext() {
903
+ return `## Auto Interface Mode
904
+
905
+ You generate full page interfaces as JSON. When asked for a dashboard, form, or any UI, respond with an @interface block.
906
+
907
+ ### CRITICAL FORMAT RULES
908
+ 1. Wrap your JSON in: @interface[{...}]
909
+ 2. Every node MUST have: "type", "id", and "props" (an object)
910
+ 3. Widget properties go INSIDE "props", NOT at the top level
911
+ 4. The "type" field is the ACTUAL widget name (e.g. "form", "kpi", "table") \u2014 NEVER use "widget" as a type
912
+ 5. Layout nodes use type: "layout" with a "layout" field for the layout kind
913
+
914
+ ### Node structure
915
+
916
+ Layout node:
917
+ {"type": "layout", "id": "unique-id", "layout": "page|row|stack|columns|sidebar|tabs", "props": {...}, "children": [...]}
918
+
919
+ Widget node:
920
+ {"type": "kpi|text_block|form|table|chart|list|card|spacer|button_group|image", "id": "unique-id", "props": {...}}
921
+
922
+ ### Layout types and their props
923
+ - page: { title?, padding?: "none"|"sm"|"md"|"lg", maxWidth?: "sm"|"md"|"lg"|"xl"|"full" }
924
+ - row: { columns?: number[] (e.g. [1,2] for 1/3+2/3), gap?: "none"|"sm"|"md"|"lg" }
925
+ - stack: { gap?: "none"|"sm"|"md"|"lg", align?: "left"|"center"|"right"|"stretch" }
926
+ - columns: { count?: number, gap?: "none"|"sm"|"md"|"lg" }
927
+ - sidebar: { side?: "left"|"right", width?: string }
928
+ - tabs: { labels: string[], defaultTab?: number }
929
+
930
+ ### Widget types and their props
931
+ - kpi: { label: string, value: string, change?: string, trend?: "up"|"down"|"flat" }
932
+ - text_block: { content: string (markdown), variant?: "heading"|"body"|"caption" }
933
+ - spacer: { height?: "sm"|"md"|"lg", variant?: "line"|"space" }
934
+ - card: { title: string, description?: string, image?: string, footer?: string }
935
+ - list: { items: [{ id: string, title: string, subtitle?: string }] }
936
+ - table: { columns: [{ key: string, label: string }], rows: [{ key: value, ... }], striped?: boolean, compact?: boolean }
937
+ - chart: { chartType: "line"|"bar"|"pie", title?: string, data: { labels: string[], datasets: [{ label: string, data: number[] }] } }
938
+ - form: { title?: string, fields: [{ name: string, type: "text"|"email"|"select"|"textarea"|"checkbox", label: string, required?: boolean, placeholder?: string, options?: [{ label: string, value: string }] }] }
939
+ - button_group: { buttons: [{ id: string, label: string, variant?: string }] }
940
+ - image: { src: string, alt: string, caption?: string }
941
+
942
+ ### CORRECT example
943
+
944
+ @interface[{"version":1,"root":{"type":"layout","id":"root","layout":"page","props":{"title":"My Form"},"children":[{"type":"text_block","id":"t1","props":{"content":"Fill out the form below","variant":"body"}},{"type":"form","id":"f1","props":{"fields":[{"name":"name","type":"text","label":"Name","required":true},{"name":"email","type":"email","label":"Email"}]}},{"type":"button_group","id":"b1","props":{"buttons":[{"id":"submit","label":"Submit"}]}}]}}]
945
+
946
+ ### WRONG (do NOT do these)
947
+ - {"type": "widget", "props": {"widget": "form"}} \u2014 WRONG, type must be "form" directly
948
+ - {"type": "text_block", "content": "hello"} \u2014 WRONG, content must be inside props
949
+ - {"type": "text_block", "props": {"style": "heading"}} \u2014 WRONG, use "variant" not "style"
950
+
951
+ ### Guidelines
952
+ - Always use unique IDs for every node
953
+ - Organize content logically: KPIs in a row, charts with supporting lists, etc.
954
+ - Use text_block for descriptions and headings within layouts
955
+ - Use spacer with variant "line" to separate sections
956
+ - You can include normal text before/after the @interface block
957
+ - For updates use: @update[{"op": "update", "target": "widget-id", "props": {"key": "new-value"}}]`;
958
+ }
959
+ function generateCompactInterfaceContext() {
960
+ return `Generate a UI interface as JSON wrapped in @interface[{...}].
961
+
962
+ STRICT FORMAT \u2014 every node needs "type", "id", and "props" (object):
963
+ - Layout: {"type":"layout","id":"x","layout":"page|row|stack|tabs","props":{...},"children":[...]}
964
+ - Widget: {"type":"kpi|text_block|form|table|chart|list|card|spacer|button_group|image","id":"x","props":{...}}
965
+
966
+ NEVER use type:"widget". The type IS the widget name. All widget properties go INSIDE "props".
967
+
968
+ Widget props:
969
+ - kpi: {label,value,change?,trend?}
970
+ - text_block: {content,variant?:"heading"|"body"|"caption"}
971
+ - form: {fields:[{name,type,label,required?,placeholder?}]}
972
+ - table: {columns:[{key,label}],rows:[{...}]}
973
+ - chart: {chartType:"line"|"bar"|"pie",data:{labels,datasets:[{label,data}]}}
974
+ - list: {items:[{id,title,subtitle?}]}
975
+ - button_group: {buttons:[{id,label}]}
976
+
977
+ Row props: {columns:[1,2]} means 1/3+2/3. Page props: {title:"..."}.
978
+
979
+ Example: @interface[{"version":1,"root":{"type":"layout","id":"root","layout":"page","props":{"title":"Form"},"children":[{"type":"form","id":"f1","props":{"fields":[{"name":"name","type":"text","label":"Name"}]}}]}}]`;
980
+ }
981
+
982
+ // src/utils/interface-operations.ts
983
+ function findNode(root, id) {
984
+ if (root.id === id) return root;
985
+ if (root.children) {
986
+ for (const child of root.children) {
987
+ const found = findNode(child, id);
988
+ if (found) return found;
989
+ }
990
+ }
991
+ return null;
992
+ }
993
+ function replaceNode(root, targetId, newNode) {
994
+ if (root.id === targetId) return newNode;
995
+ if (!root.children) return root;
996
+ const newChildren = root.children.map((child) => replaceNode(child, targetId, newNode));
997
+ if (newChildren.every((child, i) => child === root.children[i])) return root;
998
+ return { ...root, children: newChildren };
999
+ }
1000
+ function updateNodeProps(root, targetId, props) {
1001
+ if (root.id === targetId) {
1002
+ return { ...root, props: { ...root.props, ...props } };
1003
+ }
1004
+ if (!root.children) return root;
1005
+ const newChildren = root.children.map((child) => updateNodeProps(child, targetId, props));
1006
+ if (newChildren.every((child, i) => child === root.children[i])) return root;
1007
+ return { ...root, children: newChildren };
1008
+ }
1009
+ function removeNode(root, targetId) {
1010
+ if (root.id === targetId) return null;
1011
+ if (!root.children) return root;
1012
+ const newChildren = root.children.map((child) => removeNode(child, targetId)).filter((child) => child !== null);
1013
+ if (newChildren.length === root.children.length && newChildren.every((child, i) => child === root.children[i])) return root;
1014
+ return { ...root, children: newChildren };
1015
+ }
1016
+ function appendNode(root, targetId, newNode) {
1017
+ if (root.id === targetId) {
1018
+ return { ...root, children: [...root.children || [], newNode] };
1019
+ }
1020
+ if (!root.children) return root;
1021
+ const newChildren = root.children.map((child) => appendNode(child, targetId, newNode));
1022
+ if (newChildren.every((child, i) => child === root.children[i])) return root;
1023
+ return { ...root, children: newChildren };
1024
+ }
1025
+ function prependNode(root, targetId, newNode) {
1026
+ if (root.id === targetId) {
1027
+ return { ...root, children: [newNode, ...root.children || []] };
1028
+ }
1029
+ if (!root.children) return root;
1030
+ const newChildren = root.children.map((child) => prependNode(child, targetId, newNode));
1031
+ if (newChildren.every((child, i) => child === root.children[i])) return root;
1032
+ return { ...root, children: newChildren };
1033
+ }
1034
+ function applyUpdate(spec, update) {
1035
+ let newRoot = spec.root;
1036
+ switch (update.op) {
1037
+ case "replace":
1038
+ if (!update.node) return spec;
1039
+ newRoot = replaceNode(spec.root, update.target, update.node);
1040
+ break;
1041
+ case "update":
1042
+ if (!update.props) return spec;
1043
+ newRoot = updateNodeProps(spec.root, update.target, update.props);
1044
+ break;
1045
+ case "remove":
1046
+ newRoot = removeNode(spec.root, update.target);
1047
+ if (!newRoot) return spec;
1048
+ break;
1049
+ case "append":
1050
+ if (!update.node) return spec;
1051
+ newRoot = appendNode(spec.root, update.target, update.node);
1052
+ break;
1053
+ case "prepend":
1054
+ if (!update.node) return spec;
1055
+ newRoot = prependNode(spec.root, update.target, update.node);
1056
+ break;
1057
+ default:
1058
+ return spec;
1059
+ }
1060
+ if (newRoot === spec.root) return spec;
1061
+ return { ...spec, root: newRoot };
1062
+ }
1063
+ function applyUpdates(spec, updates) {
1064
+ return updates.reduce((s, update) => applyUpdate(s, update), spec);
1065
+ }
1066
+
1067
+ // src/utils/message-converter.ts
1068
+ function convertApiMessages(apiMessages) {
1069
+ const result = [];
1070
+ let lastAssistantSegments = null;
1071
+ for (let i = 0; i < apiMessages.length; i++) {
1072
+ const msg = apiMessages[i];
1073
+ const timestamp = msg.created_at || msg.timestamp ? new Date(msg.created_at || msg.timestamp) : /* @__PURE__ */ new Date();
1074
+ if (typeof msg.content === "string") {
1075
+ const message = {
1076
+ id: msg.id || `thread-msg-${i}`,
1077
+ role: msg.role,
1078
+ content: msg.content,
1079
+ timestamp
1080
+ };
1081
+ result.push(message);
1082
+ lastAssistantSegments = null;
1083
+ } else if (Array.isArray(msg.content)) {
1084
+ if (msg.role === "assistant") {
1085
+ const segments = [];
1086
+ let textContent = "";
1087
+ for (const block of msg.content) {
1088
+ if (block.type === "text" && block.text) {
1089
+ segments.push({ type: "text", content: block.text });
1090
+ textContent += block.text;
1091
+ } else if (block.type === "tool_use") {
1092
+ segments.push({
1093
+ type: "tool",
1094
+ id: block.id || `tool-${i}-${segments.length}`,
1095
+ name: block.name || "unknown",
1096
+ status: "completed"
1097
+ });
1098
+ }
1099
+ }
1100
+ const message = {
1101
+ id: msg.id || `thread-msg-${i}`,
1102
+ role: "assistant",
1103
+ content: textContent,
1104
+ timestamp,
1105
+ metadata: segments.length > 0 ? { content_segments: segments } : void 0
1106
+ };
1107
+ result.push(message);
1108
+ lastAssistantSegments = segments;
1109
+ } else if (msg.role === "user") {
1110
+ const hasToolResults = msg.content.some((b) => b.type === "tool_result");
1111
+ if (hasToolResults && lastAssistantSegments) {
1112
+ for (const block of msg.content) {
1113
+ if (block.type === "tool_result" && block.tool_use_id) {
1114
+ const toolSegment = lastAssistantSegments.find(
1115
+ (s) => s.type === "tool" && s.id === block.tool_use_id
1116
+ );
1117
+ if (toolSegment && toolSegment.type === "tool") {
1118
+ toolSegment.result = typeof block.content === "string" ? block.content : Array.isArray(block.content) ? block.content.map((c) => c.text || "").join("") : void 0;
1119
+ toolSegment.status = block.is_error ? "error" : "completed";
1120
+ }
1121
+ }
1122
+ }
1123
+ } else {
1124
+ const textContent = msg.content.filter((b) => b.type === "text").map((b) => b.text || "").join("");
1125
+ if (textContent) {
1126
+ result.push({
1127
+ id: msg.id || `thread-msg-${i}`,
1128
+ role: "user",
1129
+ content: textContent,
1130
+ timestamp
1131
+ });
1132
+ }
1133
+ lastAssistantSegments = null;
1134
+ }
1135
+ }
1136
+ }
1137
+ }
1138
+ return result;
1139
+ }
1140
+
800
1141
  // src/components/Widgets/Widgets.tsx
801
1142
  import { useEffect as useEffect3 } from "react";
802
1143
 
@@ -1436,42 +1777,183 @@ function Flow({ widget }) {
1436
1777
  ] });
1437
1778
  }
1438
1779
 
1439
- // src/components/Widgets/WidgetRenderer.tsx
1780
+ // src/components/Widgets/widget-library/Kpi.tsx
1440
1781
  import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1782
+ var trendIcons = {
1783
+ up: { symbol: "\u2191", color: "text-emerald-500" },
1784
+ down: { symbol: "\u2193", color: "text-red-500" },
1785
+ flat: { symbol: "\u2192", color: "text-neutral-400" }
1786
+ };
1787
+ function Kpi({ widget, onAction }) {
1788
+ const { label = "", value = "", change, trend } = widget.props || {};
1789
+ const trendInfo = trend ? trendIcons[trend] : null;
1790
+ return /* @__PURE__ */ jsxs7("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 p-5", children: [
1791
+ /* @__PURE__ */ jsx9("div", { className: "!text-sm font-medium !text-neutral-500 dark:!text-neutral-400 mb-1", children: label }),
1792
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-end gap-2", children: [
1793
+ /* @__PURE__ */ jsx9("div", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white", children: value }),
1794
+ change && trendInfo && /* @__PURE__ */ jsxs7("div", { className: `flex items-center gap-0.5 !text-sm font-medium ${trendInfo.color} mb-0.5`, children: [
1795
+ /* @__PURE__ */ jsx9("span", { children: trendInfo.symbol }),
1796
+ /* @__PURE__ */ jsx9("span", { children: change })
1797
+ ] }),
1798
+ change && !trendInfo && /* @__PURE__ */ jsx9("div", { className: "!text-sm font-medium !text-neutral-400 mb-0.5", children: change })
1799
+ ] }),
1800
+ widget.actions && widget.actions.length > 0 && /* @__PURE__ */ jsx9("div", { className: "flex gap-2 mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700", children: widget.actions.map((action, idx) => /* @__PURE__ */ jsx9(
1801
+ "button",
1802
+ {
1803
+ onClick: () => onAction?.({
1804
+ type: action.type,
1805
+ payload: action.payload,
1806
+ widgetId: widget.id,
1807
+ timestamp: /* @__PURE__ */ new Date()
1808
+ }),
1809
+ className: "px-2 py-1 !text-xs rounded font-medium transition-colors bg-neutral-100 dark:bg-neutral-800 !text-neutral-600 dark:!text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700",
1810
+ children: action.label
1811
+ },
1812
+ idx
1813
+ )) })
1814
+ ] });
1815
+ }
1816
+
1817
+ // src/components/Widgets/widget-library/TextBlock.tsx
1818
+ import { Fragment, jsx as jsx10 } from "react/jsx-runtime";
1819
+ function TextBlock({ widget }) {
1820
+ const { content = "", variant = "body" } = widget.props || {};
1821
+ const variantClasses = {
1822
+ heading: "!text-xl font-bold !text-neutral-900 dark:!text-white",
1823
+ body: "!text-sm !text-neutral-700 dark:!text-neutral-300 leading-relaxed",
1824
+ caption: "!text-xs !text-neutral-500 dark:!text-neutral-400"
1825
+ };
1826
+ const renderMarkdown = (text) => {
1827
+ const lines = text.split("\n");
1828
+ const elements = [];
1829
+ let i = 0;
1830
+ while (i < lines.length) {
1831
+ const line = lines[i];
1832
+ if (line.startsWith("### ")) {
1833
+ elements.push(
1834
+ /* @__PURE__ */ jsx10("h3", { className: "!text-base font-semibold !text-neutral-900 dark:!text-white mt-3 mb-1", children: renderInline(line.slice(4)) }, i)
1835
+ );
1836
+ } else if (line.startsWith("## ")) {
1837
+ elements.push(
1838
+ /* @__PURE__ */ jsx10("h2", { className: "!text-lg font-bold !text-neutral-900 dark:!text-white mt-4 mb-1", children: renderInline(line.slice(3)) }, i)
1839
+ );
1840
+ } else if (/^[-*+]\s/.test(line)) {
1841
+ const listItems = [];
1842
+ while (i < lines.length && /^[-*+]\s/.test(lines[i])) {
1843
+ listItems.push(
1844
+ /* @__PURE__ */ jsx10("li", { className: "ml-4 list-disc", children: renderInline(lines[i].slice(2)) }, i)
1845
+ );
1846
+ i++;
1847
+ }
1848
+ elements.push(/* @__PURE__ */ jsx10("ul", { className: "my-1 space-y-0.5", children: listItems }, `list-${i}`));
1849
+ continue;
1850
+ } else if (line.trim() === "") {
1851
+ elements.push(/* @__PURE__ */ jsx10("div", { className: "h-2" }, i));
1852
+ } else {
1853
+ elements.push(/* @__PURE__ */ jsx10("p", { className: "my-0.5", children: renderInline(line) }, i));
1854
+ }
1855
+ i++;
1856
+ }
1857
+ return elements;
1858
+ };
1859
+ const renderInline = (text) => {
1860
+ const parts = [];
1861
+ let remaining = text;
1862
+ let key = 0;
1863
+ while (remaining.length > 0) {
1864
+ const boldMatch = remaining.match(/\*\*(.+?)\*\*/);
1865
+ const codeMatch = remaining.match(/`(.+?)`/);
1866
+ const linkMatch = remaining.match(/\[(.+?)\]\((.+?)\)/);
1867
+ const matches = [
1868
+ boldMatch ? { type: "bold", index: boldMatch.index, match: boldMatch } : null,
1869
+ codeMatch ? { type: "code", index: codeMatch.index, match: codeMatch } : null,
1870
+ linkMatch ? { type: "link", index: linkMatch.index, match: linkMatch } : null
1871
+ ].filter(Boolean).sort((a, b) => a.index - b.index);
1872
+ if (matches.length === 0) {
1873
+ parts.push(remaining);
1874
+ break;
1875
+ }
1876
+ const first = matches[0];
1877
+ if (first.index > 0) {
1878
+ parts.push(remaining.slice(0, first.index));
1879
+ }
1880
+ if (first.type === "bold") {
1881
+ parts.push(/* @__PURE__ */ jsx10("strong", { className: "font-semibold", children: first.match[1] }, key++));
1882
+ remaining = remaining.slice(first.index + first.match[0].length);
1883
+ } else if (first.type === "code") {
1884
+ parts.push(
1885
+ /* @__PURE__ */ jsx10("code", { className: "px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded text-xs font-mono", children: first.match[1] }, key++)
1886
+ );
1887
+ remaining = remaining.slice(first.index + first.match[0].length);
1888
+ } else if (first.type === "link") {
1889
+ parts.push(
1890
+ /* @__PURE__ */ jsx10("a", { href: first.match[2], className: "text-blue-500 hover:underline", target: "_blank", rel: "noopener noreferrer", children: first.match[1] }, key++)
1891
+ );
1892
+ remaining = remaining.slice(first.index + first.match[0].length);
1893
+ }
1894
+ }
1895
+ return parts.length === 1 ? parts[0] : /* @__PURE__ */ jsx10(Fragment, { children: parts });
1896
+ };
1897
+ return /* @__PURE__ */ jsx10("div", { className: variantClasses[variant] || variantClasses.body, children: renderMarkdown(content) });
1898
+ }
1899
+
1900
+ // src/components/Widgets/widget-library/Spacer.tsx
1901
+ import { jsx as jsx11 } from "react/jsx-runtime";
1902
+ var heightClasses = {
1903
+ sm: "h-2",
1904
+ md: "h-4",
1905
+ lg: "h-8"
1906
+ };
1907
+ function Spacer({ widget }) {
1908
+ const { height = "md", variant = "space" } = widget.props || {};
1909
+ if (variant === "line") {
1910
+ return /* @__PURE__ */ jsx11("div", { className: heightClasses[height] || heightClasses.md + " flex items-center", children: /* @__PURE__ */ jsx11("hr", { className: "w-full border-neutral-200 dark:border-neutral-700" }) });
1911
+ }
1912
+ return /* @__PURE__ */ jsx11("div", { className: heightClasses[height] || heightClasses.md });
1913
+ }
1914
+
1915
+ // src/components/Widgets/WidgetRenderer.tsx
1916
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1441
1917
  function WidgetRenderer({ widget, onAction }) {
1442
1918
  const renderWidget = () => {
1443
1919
  switch (widget.type) {
1444
1920
  case "card":
1445
- return /* @__PURE__ */ jsx9(Card, { widget, onAction });
1921
+ return /* @__PURE__ */ jsx12(Card, { widget, onAction });
1446
1922
  case "list":
1447
- return /* @__PURE__ */ jsx9(List, { widget, onAction });
1923
+ return /* @__PURE__ */ jsx12(List, { widget, onAction });
1448
1924
  case "button":
1449
- return /* @__PURE__ */ jsx9(Button, { widget, onAction });
1925
+ return /* @__PURE__ */ jsx12(Button, { widget, onAction });
1450
1926
  case "button_group":
1451
- return /* @__PURE__ */ jsx9(ButtonGroup, { widget, onAction });
1927
+ return /* @__PURE__ */ jsx12(ButtonGroup, { widget, onAction });
1452
1928
  case "table":
1453
- return /* @__PURE__ */ jsx9(Table, { widget, onAction });
1929
+ return /* @__PURE__ */ jsx12(Table, { widget, onAction });
1454
1930
  case "form":
1455
- return /* @__PURE__ */ jsx9(Form, { widget, onAction });
1931
+ return /* @__PURE__ */ jsx12(Form, { widget, onAction });
1456
1932
  case "image":
1457
- return /* @__PURE__ */ jsx9(Image, { widget });
1933
+ return /* @__PURE__ */ jsx12(Image, { widget });
1458
1934
  case "flow":
1459
- return /* @__PURE__ */ jsx9(Flow, { widget });
1935
+ return /* @__PURE__ */ jsx12(Flow, { widget });
1936
+ case "kpi":
1937
+ return /* @__PURE__ */ jsx12(Kpi, { widget, onAction });
1938
+ case "text_block":
1939
+ return /* @__PURE__ */ jsx12(TextBlock, { widget });
1940
+ case "spacer":
1941
+ return /* @__PURE__ */ jsx12(Spacer, { widget });
1460
1942
  default:
1461
- return /* @__PURE__ */ jsxs7("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
1462
- /* @__PURE__ */ jsxs7("p", { className: "text-sm text-yellow-800", children: [
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: [
1463
1945
  "Unknown widget type: ",
1464
1946
  widget.type
1465
1947
  ] }),
1466
- /* @__PURE__ */ jsx9("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
1948
+ /* @__PURE__ */ jsx12("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
1467
1949
  ] });
1468
1950
  }
1469
1951
  };
1470
- return /* @__PURE__ */ jsx9("div", { className: "apteva-widget", children: renderWidget() });
1952
+ return /* @__PURE__ */ jsx12("div", { className: "apteva-widget", children: renderWidget() });
1471
1953
  }
1472
1954
 
1473
1955
  // src/components/Widgets/Widgets.tsx
1474
- import { jsx as jsx10 } from "react/jsx-runtime";
1956
+ import { jsx as jsx13 } from "react/jsx-runtime";
1475
1957
  function Widgets({
1476
1958
  widgets,
1477
1959
  onAction,
@@ -1496,85 +1978,85 @@ function Widgets({
1496
1978
  normal: "gap-4",
1497
1979
  loose: "gap-6"
1498
1980
  };
1499
- return /* @__PURE__ */ jsx10("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx10(WidgetRenderer, { widget, onAction }, widget.id)) });
1981
+ return /* @__PURE__ */ jsx13("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx13(WidgetRenderer, { widget, onAction }, widget.id)) });
1500
1982
  }
1501
1983
 
1502
1984
  // src/components/Widgets/WidgetSkeleton.tsx
1503
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1985
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
1504
1986
  function WidgetSkeleton({ type, className }) {
1505
1987
  switch (type) {
1506
1988
  case "card":
1507
- return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: /* @__PURE__ */ jsxs8("div", { className: "p-4 space-y-3", children: [
1508
- /* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" }),
1509
- /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" }),
1510
- /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6" })
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" })
1511
1993
  ] }) });
1512
1994
  case "list":
1513
- return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800", children: [
1514
- /* @__PURE__ */ jsx11("div", { className: "w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0" }),
1515
- /* @__PURE__ */ jsxs8("div", { className: "flex-1 space-y-2", children: [
1516
- /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
1517
- /* @__PURE__ */ jsx11("div", { className: "h-2 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4" })
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" })
1518
2000
  ] })
1519
2001
  ] }, i)) });
1520
2002
  case "button_group":
1521
- return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse flex gap-2", className), children: [
1522
- /* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
1523
- /* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" }),
1524
- /* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20" })
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" })
1525
2007
  ] });
1526
2008
  case "form":
1527
- return /* @__PURE__ */ jsxs8("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: [
1528
- /* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
1529
- /* @__PURE__ */ jsxs8("div", { className: "space-y-3", children: [
1530
- /* @__PURE__ */ jsx11("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }),
1531
- /* @__PURE__ */ jsx11("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" })
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" })
1532
2014
  ] }),
1533
- /* @__PURE__ */ jsx11("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
2015
+ /* @__PURE__ */ jsx14("div", { className: "h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24" })
1534
2016
  ] });
1535
2017
  case "chart":
1536
- return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
1537
- /* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4" }),
1538
- /* @__PURE__ */ jsxs8("div", { className: "flex items-end gap-2 h-32", children: [
1539
- /* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2" }),
1540
- /* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-3/4" }),
1541
- /* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/3" }),
1542
- /* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-full" }),
1543
- /* @__PURE__ */ jsx11("div", { className: "flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-2/3" })
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" })
1544
2026
  ] })
1545
2027
  ] });
1546
2028
  case "image":
1547
- return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx11("div", { className: "aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg" }) });
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" }) });
1548
2030
  case "gallery":
1549
- return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx11("div", { className: "aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg" }, i)) });
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)) });
1550
2032
  case "map":
1551
- return /* @__PURE__ */ jsx11("div", { className: cn("apteva-widget-skeleton animate-pulse", className), children: /* @__PURE__ */ jsx11("div", { className: "h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsxs8("svg", { className: "w-8 h-8 text-neutral-400 dark:text-neutral-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1552
- /* @__PURE__ */ jsx11("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" }),
1553
- /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
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" })
1554
2036
  ] }) }) });
1555
2037
  case "table":
1556
- return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden", className), children: [
1557
- /* @__PURE__ */ jsxs8("div", { className: "flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700", children: [
1558
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16" }) }),
1559
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20" }) }),
1560
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-14" }) })
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" }) })
1561
2043
  ] }),
1562
- [1, 2, 3].map((i) => /* @__PURE__ */ jsxs8("div", { className: "flex border-b border-neutral-200 dark:border-neutral-800 last:border-b-0", children: [
1563
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-24" }) }),
1564
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16" }) }),
1565
- /* @__PURE__ */ jsx11("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20" }) })
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" }) })
1566
2048
  ] }, i))
1567
2049
  ] });
1568
2050
  default:
1569
- return /* @__PURE__ */ jsxs8("div", { className: cn("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4", className), children: [
1570
- /* @__PURE__ */ jsx11("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2" }),
1571
- /* @__PURE__ */ jsx11("div", { className: "h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full" })
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" })
1572
2054
  ] });
1573
2055
  }
1574
2056
  }
1575
2057
 
1576
2058
  // src/components/Chat/MarkdownContent.tsx
1577
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2059
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
1578
2060
  function isImageUrl(url) {
1579
2061
  const imageExtensions = /\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)(\?.*)?$/i;
1580
2062
  return imageExtensions.test(url);
@@ -1593,7 +2075,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
1593
2075
  const alt = match[1] || "";
1594
2076
  const src = match[2];
1595
2077
  result.push(
1596
- /* @__PURE__ */ jsx12(
2078
+ /* @__PURE__ */ jsx15(
1597
2079
  "img",
1598
2080
  {
1599
2081
  src,
@@ -1608,7 +2090,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
1608
2090
  const href = match[4];
1609
2091
  if (isImageUrl(href)) {
1610
2092
  result.push(
1611
- /* @__PURE__ */ jsx12(
2093
+ /* @__PURE__ */ jsx15(
1612
2094
  "img",
1613
2095
  {
1614
2096
  src: href,
@@ -1620,7 +2102,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
1620
2102
  );
1621
2103
  } else {
1622
2104
  result.push(
1623
- /* @__PURE__ */ jsx12(
2105
+ /* @__PURE__ */ jsx15(
1624
2106
  "a",
1625
2107
  {
1626
2108
  href,
@@ -1634,10 +2116,10 @@ function parseInlineMarkdown(text, keyPrefix = "") {
1634
2116
  );
1635
2117
  }
1636
2118
  } else if (match[5] !== void 0) {
1637
- result.push(/* @__PURE__ */ jsx12("strong", { children: match[6] }, `${keyPrefix}b${key++}`));
2119
+ result.push(/* @__PURE__ */ jsx15("strong", { children: match[6] }, `${keyPrefix}b${key++}`));
1638
2120
  } else if (match[7] !== void 0) {
1639
2121
  result.push(
1640
- /* @__PURE__ */ jsx12("code", { className: "apteva-md-inline-code", children: match[7] }, `${keyPrefix}code${key++}`)
2122
+ /* @__PURE__ */ jsx15("code", { className: "apteva-md-inline-code", children: match[7] }, `${keyPrefix}code${key++}`)
1641
2123
  );
1642
2124
  }
1643
2125
  lastIndex = match.index + match[0].length;
@@ -1657,7 +2139,7 @@ function parseMarkdown(content) {
1657
2139
  const h2Match = line.match(/^##\s+(.*)$/);
1658
2140
  if (h2Match) {
1659
2141
  result.push(
1660
- /* @__PURE__ */ jsx12("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
2142
+ /* @__PURE__ */ jsx15("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
1661
2143
  );
1662
2144
  i++;
1663
2145
  continue;
@@ -1665,7 +2147,7 @@ function parseMarkdown(content) {
1665
2147
  const h3Match = line.match(/^###\s+(.*)$/);
1666
2148
  if (h3Match) {
1667
2149
  result.push(
1668
- /* @__PURE__ */ jsx12("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
2150
+ /* @__PURE__ */ jsx15("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
1669
2151
  );
1670
2152
  i++;
1671
2153
  continue;
@@ -1678,7 +2160,7 @@ function parseMarkdown(content) {
1678
2160
  const itemMatch = lines[i].match(/^(\s*)([-*+])\s+(.*)$/);
1679
2161
  if (itemMatch && itemMatch[1].length === indent) {
1680
2162
  listItems.push(
1681
- /* @__PURE__ */ jsx12("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2163
+ /* @__PURE__ */ jsx15("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
1682
2164
  );
1683
2165
  i++;
1684
2166
  } else {
@@ -1686,7 +2168,7 @@ function parseMarkdown(content) {
1686
2168
  }
1687
2169
  }
1688
2170
  result.push(
1689
- /* @__PURE__ */ jsx12("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
2171
+ /* @__PURE__ */ jsx15("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
1690
2172
  );
1691
2173
  continue;
1692
2174
  }
@@ -1698,7 +2180,7 @@ function parseMarkdown(content) {
1698
2180
  const itemMatch = lines[i].match(/^(\s*)(\d+)\.\s+(.*)$/);
1699
2181
  if (itemMatch && itemMatch[1].length === indent) {
1700
2182
  listItems.push(
1701
- /* @__PURE__ */ jsx12("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
2183
+ /* @__PURE__ */ jsx15("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
1702
2184
  );
1703
2185
  i++;
1704
2186
  } else {
@@ -1706,7 +2188,7 @@ function parseMarkdown(content) {
1706
2188
  }
1707
2189
  }
1708
2190
  result.push(
1709
- /* @__PURE__ */ jsx12("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
2191
+ /* @__PURE__ */ jsx15("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
1710
2192
  );
1711
2193
  continue;
1712
2194
  }
@@ -1729,19 +2211,19 @@ function parseMarkdown(content) {
1729
2211
  }
1730
2212
  }
1731
2213
  result.push(
1732
- /* @__PURE__ */ jsx12("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs9("table", { className: "apteva-md-table", children: [
1733
- /* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsx12("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx12("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
1734
- /* @__PURE__ */ jsx12("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx12("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx12("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
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}`)) })
1735
2217
  ] }) }, `table-wrapper${key++}`)
1736
2218
  );
1737
2219
  continue;
1738
2220
  }
1739
2221
  }
1740
2222
  if (line === "") {
1741
- result.push(/* @__PURE__ */ jsx12("br", {}, `br${key++}`));
2223
+ result.push(/* @__PURE__ */ jsx15("br", {}, `br${key++}`));
1742
2224
  } else {
1743
2225
  result.push(
1744
- /* @__PURE__ */ jsxs9("span", { children: [
2226
+ /* @__PURE__ */ jsxs10("span", { children: [
1745
2227
  parseInlineMarkdown(line, `${key}`),
1746
2228
  i < lines.length - 1 ? "\n" : ""
1747
2229
  ] }, `p${key++}`)
@@ -1752,53 +2234,53 @@ function parseMarkdown(content) {
1752
2234
  return result;
1753
2235
  }
1754
2236
  function MarkdownContent({ content, className = "" }) {
1755
- return /* @__PURE__ */ jsx12("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
2237
+ return /* @__PURE__ */ jsx15("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
1756
2238
  }
1757
2239
 
1758
2240
  // src/components/Chat/ToolCall.tsx
1759
- import { Fragment, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
2241
+ import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
1760
2242
  function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOutput }) {
1761
2243
  if (status === "preparing") {
1762
- return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
1763
- /* @__PURE__ */ jsxs10("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
1764
- /* @__PURE__ */ jsx13("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1765
- /* @__PURE__ */ jsx13("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
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" })
1766
2248
  ] }),
1767
- /* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
1768
- /* @__PURE__ */ jsx13("strong", { children: name }),
1769
- /* @__PURE__ */ jsx13("span", { className: "apteva-tool-status-text", children: " preparing..." })
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..." })
1770
2252
  ] })
1771
2253
  ] });
1772
2254
  }
1773
2255
  if (status === "running") {
1774
- return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-running", children: [
1775
- /* @__PURE__ */ jsxs10("svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
1776
- /* @__PURE__ */ jsx13("circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1777
- /* @__PURE__ */ jsx13("path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
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" })
1778
2260
  ] }),
1779
- /* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
1780
- /* @__PURE__ */ jsx13("strong", { children: name }),
1781
- streamOutput ? /* @__PURE__ */ jsx13("span", { className: "apteva-tool-stream-separator", children: " \xB7 " }) : null,
1782
- streamOutput ? /* @__PURE__ */ jsx13("span", { className: "apteva-tool-stream-output", children: streamOutput }) : /* @__PURE__ */ jsxs10(Fragment, { children: [
1783
- /* @__PURE__ */ jsx13("span", { className: "apteva-tool-status-text", children: " running" }),
1784
- /* @__PURE__ */ jsxs10("span", { className: "apteva-tool-dots", children: [
1785
- /* @__PURE__ */ jsx13("span", { children: "." }),
1786
- /* @__PURE__ */ jsx13("span", { children: "." }),
1787
- /* @__PURE__ */ jsx13("span", { children: "." })
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: "." })
1788
2270
  ] })
1789
2271
  ] })
1790
2272
  ] })
1791
2273
  ] });
1792
2274
  }
1793
2275
  if (status === "completed") {
1794
- return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-completed", children: [
1795
- /* @__PURE__ */ jsx13("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
1796
- /* @__PURE__ */ jsx13("span", { className: "apteva-tool-label", children: name })
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 })
1797
2279
  ] });
1798
2280
  }
1799
- return /* @__PURE__ */ jsxs10("div", { className: "apteva-tool-card apteva-tool-card-error", children: [
1800
- /* @__PURE__ */ jsx13("svg", { className: "apteva-tool-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }),
1801
- /* @__PURE__ */ jsxs10("span", { className: "apteva-tool-label", children: [
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: [
1802
2284
  name,
1803
2285
  " failed"
1804
2286
  ] })
@@ -1806,7 +2288,7 @@ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOu
1806
2288
  }
1807
2289
 
1808
2290
  // src/components/Chat/Message.tsx
1809
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2291
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
1810
2292
  function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1811
2293
  const isUser = message.role === "user";
1812
2294
  const contentSegments = message.metadata?.content_segments;
@@ -1842,14 +2324,14 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1842
2324
  }, [parsedWidgets, onWidgetRender]);
1843
2325
  const renderTextContent = (text) => {
1844
2326
  if (!enableWidgets || isUser) {
1845
- return /* @__PURE__ */ jsx14(MarkdownContent, { content: text });
2327
+ return /* @__PURE__ */ jsx17(MarkdownContent, { content: text });
1846
2328
  }
1847
2329
  const parsed = parseWidgetsFromText(text);
1848
2330
  const cleanedText = parsed.segments.filter((seg) => seg.type === "text" && seg.content).map((seg) => seg.content).join("");
1849
2331
  if (!cleanedText.trim()) {
1850
2332
  return null;
1851
2333
  }
1852
- return /* @__PURE__ */ jsx14(MarkdownContent, { content: cleanedText });
2334
+ return /* @__PURE__ */ jsx17(MarkdownContent, { content: cleanedText });
1853
2335
  };
1854
2336
  const renderContentWithWidgets = () => {
1855
2337
  if (!enableWidgets || isUser || !message.content) {
@@ -1864,28 +2346,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1864
2346
  } else if (segment.type === "widget" && segment.widget) {
1865
2347
  if (textBuffer.trim()) {
1866
2348
  elements.push(
1867
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
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}`)
1868
2350
  );
1869
2351
  textBuffer = "";
1870
2352
  }
1871
2353
  elements.push(
1872
- /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
2354
+ /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`)
1873
2355
  );
1874
2356
  } else if (segment.type === "widget_pending" && segment.pendingType) {
1875
2357
  if (textBuffer.trim()) {
1876
2358
  elements.push(
1877
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `text-${index}`)
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}`)
1878
2360
  );
1879
2361
  textBuffer = "";
1880
2362
  }
1881
2363
  elements.push(
1882
- /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
2364
+ /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`)
1883
2365
  );
1884
2366
  }
1885
2367
  });
1886
2368
  if (textBuffer.trim()) {
1887
2369
  elements.push(
1888
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, "text-final")
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")
1889
2371
  );
1890
2372
  }
1891
2373
  return elements.length > 0 ? elements : null;
@@ -1894,11 +2376,11 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1894
2376
  const hasAttachments = attachments.length > 0;
1895
2377
  const renderAttachments = () => {
1896
2378
  if (!hasAttachments) return null;
1897
- return /* @__PURE__ */ jsx14("div", { className: "apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end", children: attachments.map((att, index) => {
2379
+ return /* @__PURE__ */ jsx17("div", { className: "apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end", children: attachments.map((att, index) => {
1898
2380
  const isImage = att.type.startsWith("image/");
1899
2381
  const isPdf = att.type === "application/pdf";
1900
2382
  if (isImage && att.preview) {
1901
- return /* @__PURE__ */ jsx14("div", { className: "apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm", children: /* @__PURE__ */ jsx14(
2383
+ return /* @__PURE__ */ jsx17("div", { className: "apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm", children: /* @__PURE__ */ jsx17(
1902
2384
  "img",
1903
2385
  {
1904
2386
  src: att.preview,
@@ -1907,15 +2389,15 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1907
2389
  }
1908
2390
  ) }, index);
1909
2391
  }
1910
- return /* @__PURE__ */ jsxs11(
2392
+ return /* @__PURE__ */ jsxs12(
1911
2393
  "div",
1912
2394
  {
1913
2395
  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",
1914
2396
  children: [
1915
- /* @__PURE__ */ jsx14("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__ */ jsx14("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("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__ */ jsx14("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("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" }) }) }),
1916
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col min-w-0", children: [
1917
- /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium text-neutral-800 dark:text-neutral-200 truncate max-w-[180px]", children: att.name }),
1918
- /* @__PURE__ */ jsxs11("span", { className: "text-xs text-neutral-500 dark:text-neutral-400", 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: [
1919
2401
  isPdf ? "PDF" : "Document",
1920
2402
  " \xB7 ",
1921
2403
  formatFileSize(att.size)
@@ -1929,13 +2411,13 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1929
2411
  };
1930
2412
  const renderContent = () => {
1931
2413
  if (isUser) {
1932
- return /* @__PURE__ */ jsx14("div", { className: "apteva-message-text", children: message.content });
2414
+ return /* @__PURE__ */ jsx17("div", { className: "apteva-message-text", children: message.content });
1933
2415
  }
1934
2416
  if (isStreaming && !hasContent) {
1935
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-typing-indicator", children: [
1936
- /* @__PURE__ */ jsx14("span", {}),
1937
- /* @__PURE__ */ jsx14("span", {}),
1938
- /* @__PURE__ */ jsx14("span", {})
2417
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-typing-indicator", children: [
2418
+ /* @__PURE__ */ jsx17("span", {}),
2419
+ /* @__PURE__ */ jsx17("span", {}),
2420
+ /* @__PURE__ */ jsx17("span", {})
1939
2421
  ] });
1940
2422
  }
1941
2423
  if (contentSegments && contentSegments.length > 0) {
@@ -1945,7 +2427,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1945
2427
  };
1946
2428
  const renderTextSegmentWithWidgets = (text, keyPrefix) => {
1947
2429
  if (!enableWidgets) {
1948
- return /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: text }) }) }, keyPrefix);
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);
1949
2431
  }
1950
2432
  const parsed = parseWidgetsFromText(text);
1951
2433
  const elements = [];
@@ -1956,28 +2438,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1956
2438
  } else if (seg.type === "widget" && seg.widget) {
1957
2439
  if (textBuffer.trim()) {
1958
2440
  elements.push(
1959
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
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}`)
1960
2442
  );
1961
2443
  textBuffer = "";
1962
2444
  }
1963
2445
  elements.push(
1964
- /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetRenderer, { widget: seg.widget, onAction }) }, `${keyPrefix}-widget-${idx}`)
2446
+ /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetRenderer, { widget: seg.widget, onAction }) }, `${keyPrefix}-widget-${idx}`)
1965
2447
  );
1966
2448
  } else if (seg.type === "widget_pending" && seg.pendingType) {
1967
2449
  if (textBuffer.trim()) {
1968
2450
  elements.push(
1969
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-${idx}`)
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}`)
1970
2452
  );
1971
2453
  textBuffer = "";
1972
2454
  }
1973
2455
  elements.push(
1974
- /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(WidgetSkeleton, { type: seg.pendingType }) }, `${keyPrefix}-pending-${idx}`)
2456
+ /* @__PURE__ */ jsx17("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx17(WidgetSkeleton, { type: seg.pendingType }) }, `${keyPrefix}-pending-${idx}`)
1975
2457
  );
1976
2458
  }
1977
2459
  });
1978
2460
  if (textBuffer.trim()) {
1979
2461
  elements.push(
1980
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-assistant", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-assistant", children: /* @__PURE__ */ jsx14(MarkdownContent, { content: textBuffer }) }) }, `${keyPrefix}-text-final`)
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`)
1981
2463
  );
1982
2464
  }
1983
2465
  return elements;
@@ -1997,7 +2479,7 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1997
2479
  }
1998
2480
  } else if (segment.type === "tool") {
1999
2481
  elements.push(
2000
- /* @__PURE__ */ jsx14("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx14(
2482
+ /* @__PURE__ */ jsx17("div", { className: "apteva-tool-call-standalone", children: /* @__PURE__ */ jsx17(
2001
2483
  ToolCall,
2002
2484
  {
2003
2485
  name: segment.name,
@@ -2013,28 +2495,28 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2013
2495
  return elements;
2014
2496
  };
2015
2497
  if (!isUser && (contentSegments && contentSegments.length > 0)) {
2016
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented", children: [
2498
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented", children: [
2017
2499
  renderSegmentedContent(),
2018
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2019
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
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" }) })
2020
2502
  ] });
2021
2503
  }
2022
2504
  const widgetContent = renderContentWithWidgets();
2023
2505
  if (!isUser && enableWidgets && widgetContent) {
2024
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented", children: [
2506
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented", children: [
2025
2507
  widgetContent,
2026
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2027
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-assistant", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
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" }) })
2028
2510
  ] });
2029
2511
  }
2030
2512
  if (isUser && hasAttachments) {
2031
- return /* @__PURE__ */ jsxs11("div", { className: "apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end", children: [
2513
+ return /* @__PURE__ */ jsxs12("div", { className: "apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end", children: [
2032
2514
  renderAttachments(),
2033
- message.content && /* @__PURE__ */ jsx14("div", { className: "apteva-message-bubble apteva-message-user", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-content-user", children: /* @__PURE__ */ jsx14("div", { className: "apteva-message-text", children: message.content }) }) }),
2034
- /* @__PURE__ */ jsx14("div", { className: "apteva-message-timestamp apteva-message-timestamp-user", suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
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" }) })
2035
2517
  ] });
2036
2518
  }
2037
- return /* @__PURE__ */ jsxs11(
2519
+ return /* @__PURE__ */ jsxs12(
2038
2520
  "div",
2039
2521
  {
2040
2522
  className: cn(
@@ -2042,17 +2524,17 @@ function Message({ message, onAction, enableWidgets, onWidgetRender }) {
2042
2524
  isUser ? "apteva-message-user" : "apteva-message-assistant"
2043
2525
  ),
2044
2526
  children: [
2045
- /* @__PURE__ */ jsx14("div", { className: isUser ? "apteva-message-content-user" : "apteva-message-content-assistant", children: renderContent() }),
2046
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx14("div", { className: "apteva-widget-standalone", children: /* @__PURE__ */ jsx14(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
2047
- /* @__PURE__ */ jsx14("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" }) })
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" }) })
2048
2530
  ]
2049
2531
  }
2050
2532
  );
2051
2533
  }
2052
2534
 
2053
2535
  // src/components/Chat/WelcomeScreen.tsx
2054
- import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2055
- var DefaultIcon = () => /* @__PURE__ */ jsx15("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15(
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(
2056
2538
  "path",
2057
2539
  {
2058
2540
  strokeLinecap: "round",
@@ -2061,7 +2543,7 @@ var DefaultIcon = () => /* @__PURE__ */ jsx15("svg", { className: "w-12 h-12 sm:
2061
2543
  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"
2062
2544
  }
2063
2545
  ) });
2064
- var ArrowIcon = () => /* @__PURE__ */ jsx15("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
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" }) });
2065
2547
  function WelcomeScreen({
2066
2548
  title,
2067
2549
  subtitle,
@@ -2077,18 +2559,18 @@ function WelcomeScreen({
2077
2559
  const hasPrompts = normalizedPrompts.length > 0;
2078
2560
  const hasHeader = title || subtitle || icon;
2079
2561
  if (!hasHeader && !hasPrompts) {
2080
- return /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-full !text-neutral-500 dark:!text-neutral-400", children: /* @__PURE__ */ jsxs12("div", { className: "text-center space-y-2", children: [
2081
- /* @__PURE__ */ jsx15("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx15(DefaultIcon, {}) }),
2082
- /* @__PURE__ */ jsx15("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
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!" })
2083
2565
  ] }) });
2084
2566
  }
2085
2567
  if (variant === "minimal") {
2086
- return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col h-full px-4 py-4", children: [
2087
- hasHeader && /* @__PURE__ */ jsxs12("div", { className: "mb-4", children: [
2088
- title && /* @__PURE__ */ jsx15("h2", { className: "text-lg font-semibold !text-neutral-900 dark:!text-white", children: title }),
2089
- subtitle && /* @__PURE__ */ jsx15("p", { className: "text-sm !text-neutral-500 dark:!text-neutral-400 mt-1", children: subtitle })
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 })
2090
2572
  ] }),
2091
- hasPrompts && /* @__PURE__ */ jsx15("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
2573
+ hasPrompts && /* @__PURE__ */ jsx18("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx18(
2092
2574
  "button",
2093
2575
  {
2094
2576
  onClick: () => onPromptClick(prompt.text),
@@ -2101,11 +2583,11 @@ function WelcomeScreen({
2101
2583
  "transition-all duration-200",
2102
2584
  "group"
2103
2585
  ),
2104
- children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
2105
- /* @__PURE__ */ jsx15("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__ */ jsx15(ArrowIcon, {}) }),
2106
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
2107
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white truncate", children: prompt.text }),
2108
- prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 truncate", children: prompt.description })
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 })
2109
2591
  ] })
2110
2592
  ] })
2111
2593
  },
@@ -2113,14 +2595,14 @@ function WelcomeScreen({
2113
2595
  )) })
2114
2596
  ] });
2115
2597
  }
2116
- return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
2117
- /* @__PURE__ */ jsxs12("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
2118
- /* @__PURE__ */ jsx15("div", { className: "mb-4 !text-neutral-400 dark:!text-neutral-500 flex justify-center", children: icon || /* @__PURE__ */ jsx15(DefaultIcon, {}) }),
2119
- title && /* @__PURE__ */ jsx15("h1", { className: "text-xl sm:text-2xl font-semibold !text-neutral-900 dark:!text-white mb-2", children: title }),
2120
- subtitle && /* @__PURE__ */ jsx15("p", { className: "text-sm sm:text-base !text-neutral-500 dark:!text-neutral-400", children: subtitle })
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 })
2121
2603
  ] }),
2122
- hasPrompts && /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-2xl", children: [
2123
- /* @__PURE__ */ jsx15("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
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(
2124
2606
  "button",
2125
2607
  {
2126
2608
  onClick: () => onPromptClick(prompt.text),
@@ -2135,20 +2617,20 @@ function WelcomeScreen({
2135
2617
  "shadow-sm hover:shadow",
2136
2618
  "group"
2137
2619
  ),
2138
- children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
2139
- /* @__PURE__ */ jsx15("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__ */ jsx15(ArrowIcon, {}) }),
2140
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
2141
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white", children: prompt.text }),
2142
- prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 line-clamp-1", children: prompt.description })
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 })
2143
2625
  ] }),
2144
- /* @__PURE__ */ jsx15(
2626
+ /* @__PURE__ */ jsx18(
2145
2627
  "svg",
2146
2628
  {
2147
2629
  className: "w-4 h-4 !text-neutral-400 group-hover:!text-blue-500 transition-colors flex-shrink-0",
2148
2630
  fill: "none",
2149
2631
  stroke: "currentColor",
2150
2632
  viewBox: "0 0 24 24",
2151
- children: /* @__PURE__ */ jsx15(
2633
+ children: /* @__PURE__ */ jsx18(
2152
2634
  "path",
2153
2635
  {
2154
2636
  strokeLinecap: "round",
@@ -2163,7 +2645,7 @@ function WelcomeScreen({
2163
2645
  },
2164
2646
  index
2165
2647
  )) }),
2166
- /* @__PURE__ */ jsx15("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx15(
2648
+ /* @__PURE__ */ jsx18("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx18(
2167
2649
  "button",
2168
2650
  {
2169
2651
  onClick: () => onPromptClick(prompt.text),
@@ -2178,11 +2660,11 @@ function WelcomeScreen({
2178
2660
  "transition-all duration-200",
2179
2661
  "group"
2180
2662
  ),
2181
- children: /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3", children: [
2182
- /* @__PURE__ */ jsx15("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__ */ jsx15(ArrowIcon, {}) }),
2183
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
2184
- /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium !text-neutral-900 dark:!text-white leading-snug", children: prompt.text }),
2185
- prompt.description && /* @__PURE__ */ jsx15("p", { className: "text-xs !text-neutral-500 dark:!text-neutral-400 mt-1 line-clamp-2", children: prompt.description })
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 })
2186
2668
  ] })
2187
2669
  ] })
2188
2670
  },
@@ -2193,7 +2675,7 @@ function WelcomeScreen({
2193
2675
  }
2194
2676
 
2195
2677
  // src/components/Chat/MessageList.tsx
2196
- import { jsx as jsx16 } from "react/jsx-runtime";
2678
+ import { jsx as jsx19 } from "react/jsx-runtime";
2197
2679
  function MessageList({
2198
2680
  messages,
2199
2681
  onAction,
@@ -2225,7 +2707,7 @@ function MessageList({
2225
2707
  }
2226
2708
  }
2227
2709
  }, [messages]);
2228
- return /* @__PURE__ */ jsx16("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ jsx16(
2710
+ return /* @__PURE__ */ jsx19("div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ jsx19(
2229
2711
  WelcomeScreen,
2230
2712
  {
2231
2713
  title: welcomeTitle,
@@ -2237,12 +2719,12 @@ function MessageList({
2237
2719
  onPromptClick: onPromptClick || (() => {
2238
2720
  })
2239
2721
  }
2240
- ) : messages.map((message) => /* @__PURE__ */ jsx16("div", { className: message.role === "user" ? "apteva-message-row-user" : "apteva-message-row-assistant", children: /* @__PURE__ */ jsx16(Message, { message, onAction, enableWidgets, onWidgetRender }) }, message.id)) });
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)) });
2241
2723
  }
2242
2724
 
2243
2725
  // src/components/Chat/Composer.tsx
2244
2726
  import { useState as useState4, useRef as useRef5 } from "react";
2245
- import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
2727
+ import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
2246
2728
  function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
2247
2729
  const [text, setText] = useState4("");
2248
2730
  const [showMenu, setShowMenu] = useState4(false);
@@ -2327,42 +2809,35 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2327
2809
  };
2328
2810
  const getFileIcon = (mimeType) => {
2329
2811
  if (mimeType.startsWith("image/")) {
2330
- return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("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" }) });
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" }) });
2331
2813
  }
2332
2814
  if (mimeType === "application/pdf") {
2333
- return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", 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" }) });
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" }) });
2334
2816
  }
2335
- return /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4", 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" }) });
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" }) });
2336
2818
  };
2337
- return /* @__PURE__ */ jsxs13("div", { className: "px-4 py-3 relative", children: [
2338
- fileError && /* @__PURE__ */ jsx17("div", { className: "absolute bottom-full left-4 right-4 mb-2 p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg z-20", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-sm", children: [
2339
- /* @__PURE__ */ jsx17("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
2340
- /* @__PURE__ */ jsx17("span", { children: fileError })
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 })
2341
2823
  ] }) }),
2342
- pendingFiles.length > 0 && /* @__PURE__ */ jsx17("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs13(
2343
- "div",
2344
- {
2345
- className: "relative group flex items-center gap-2 px-3 py-2 bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg",
2346
- children: [
2347
- pf.preview ? /* @__PURE__ */ jsx17("img", { src: pf.preview, alt: pf.file.name, className: "w-8 h-8 object-cover rounded" }) : /* @__PURE__ */ jsx17("div", { className: "w-8 h-8 flex items-center justify-center bg-neutral-200 dark:bg-neutral-700 rounded !text-neutral-500 dark:!text-neutral-400", children: getFileIcon(pf.file.type) }),
2348
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-col min-w-0", children: [
2349
- /* @__PURE__ */ jsx17("span", { className: "text-xs font-medium !text-neutral-700 dark:!text-neutral-300 truncate max-w-[120px]", children: pf.file.name }),
2350
- /* @__PURE__ */ jsx17("span", { className: "text-xs !text-neutral-500 dark:!text-neutral-400", children: formatFileSize(pf.file.size) })
2351
- ] }),
2352
- /* @__PURE__ */ jsx17(
2353
- "button",
2354
- {
2355
- onClick: () => removeFile(index),
2356
- className: "absolute -top-1.5 -right-1.5 w-5 h-5 bg-neutral-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
2357
- title: "Remove file",
2358
- children: /* @__PURE__ */ jsx17("svg", { className: "w-3 h-3", 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" }) })
2359
- }
2360
- )
2361
- ]
2362
- },
2363
- index
2364
- )) }),
2365
- /* @__PURE__ */ jsxs13(
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) })
2829
+ ] }),
2830
+ /* @__PURE__ */ jsx20(
2831
+ "button",
2832
+ {
2833
+ onClick: () => removeFile(index),
2834
+ className: "apteva-file-remove",
2835
+ 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" }) })
2837
+ }
2838
+ )
2839
+ ] }, index)) }),
2840
+ /* @__PURE__ */ jsxs14(
2366
2841
  "div",
2367
2842
  {
2368
2843
  className: "apteva-composer",
@@ -2372,20 +2847,20 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2372
2847
  alignItems: "end"
2373
2848
  },
2374
2849
  children: [
2375
- /* @__PURE__ */ jsxs13("div", { className: "relative flex-shrink-0 self-end", style: { gridArea: "plus" }, children: [
2376
- /* @__PURE__ */ jsx17(
2850
+ /* @__PURE__ */ jsxs14("div", { className: "relative flex-shrink-0 self-end", style: { gridArea: "plus" }, children: [
2851
+ /* @__PURE__ */ jsx20(
2377
2852
  "button",
2378
2853
  {
2379
2854
  ref: menuButtonRef,
2380
2855
  onClick: () => setShowMenu(!showMenu),
2381
2856
  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",
2382
2857
  title: "More options",
2383
- children: /* @__PURE__ */ jsx17("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
2384
2859
  }
2385
2860
  ),
2386
- showMenu && /* @__PURE__ */ jsxs13(Fragment2, { children: [
2387
- /* @__PURE__ */ jsx17("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2388
- /* @__PURE__ */ jsxs13(
2861
+ showMenu && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2862
+ /* @__PURE__ */ jsx20("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2863
+ /* @__PURE__ */ jsxs14(
2389
2864
  "div",
2390
2865
  {
2391
2866
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -2394,7 +2869,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2394
2869
  bottom: window.innerHeight - (menuButtonRef.current?.getBoundingClientRect().top ?? 0) + 8
2395
2870
  },
2396
2871
  children: [
2397
- /* @__PURE__ */ jsxs13(
2872
+ /* @__PURE__ */ jsxs14(
2398
2873
  "button",
2399
2874
  {
2400
2875
  onClick: () => {
@@ -2403,12 +2878,12 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2403
2878
  },
2404
2879
  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",
2405
2880
  children: [
2406
- /* @__PURE__ */ jsx17("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("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)" }) }),
2407
- /* @__PURE__ */ jsx17("span", { className: "!text-sm font-medium", children: "Add photos & files" })
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" })
2408
2883
  ]
2409
2884
  }
2410
2885
  ),
2411
- onSwitchMode && /* @__PURE__ */ jsxs13(
2886
+ onSwitchMode && /* @__PURE__ */ jsxs14(
2412
2887
  "button",
2413
2888
  {
2414
2889
  onClick: () => {
@@ -2417,8 +2892,8 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2417
2892
  },
2418
2893
  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",
2419
2894
  children: [
2420
- /* @__PURE__ */ jsx17("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
2421
- /* @__PURE__ */ jsx17("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
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" })
2422
2897
  ]
2423
2898
  }
2424
2899
  )
@@ -2427,7 +2902,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2427
2902
  )
2428
2903
  ] })
2429
2904
  ] }),
2430
- /* @__PURE__ */ jsx17(
2905
+ /* @__PURE__ */ jsx20(
2431
2906
  "textarea",
2432
2907
  {
2433
2908
  ref: textareaRef,
@@ -2441,28 +2916,28 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2441
2916
  rows: 1
2442
2917
  }
2443
2918
  ),
2444
- /* @__PURE__ */ jsx17("div", { className: "self-end", style: { gridArea: "send" }, children: isLoading && onStop ? /* @__PURE__ */ jsx17(
2919
+ /* @__PURE__ */ jsx20("div", { className: "self-end", style: { gridArea: "send" }, children: isLoading && onStop ? /* @__PURE__ */ jsx20(
2445
2920
  "button",
2446
2921
  {
2447
2922
  onClick: onStop,
2448
2923
  className: "apteva-composer-stop-btn",
2449
2924
  title: "Stop generation",
2450
- children: /* @__PURE__ */ jsx17("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
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" }) })
2451
2926
  }
2452
- ) : /* @__PURE__ */ jsx17(
2927
+ ) : /* @__PURE__ */ jsx20(
2453
2928
  "button",
2454
2929
  {
2455
2930
  onClick: handleSend,
2456
2931
  disabled: !text.trim() && pendingFiles.length === 0 || disabled,
2457
2932
  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",
2458
2933
  title: "Send message",
2459
- children: /* @__PURE__ */ jsx17("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
2460
2935
  }
2461
2936
  ) })
2462
2937
  ]
2463
2938
  }
2464
2939
  ),
2465
- /* @__PURE__ */ jsx17(
2940
+ /* @__PURE__ */ jsx20(
2466
2941
  "input",
2467
2942
  {
2468
2943
  ref: fileInputRef,
@@ -2478,7 +2953,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
2478
2953
 
2479
2954
  // src/components/Chat/CommandComposer.tsx
2480
2955
  import { useState as useState5, useRef as useRef6 } from "react";
2481
- import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
2956
+ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2482
2957
  function CommandComposer({
2483
2958
  onExecute,
2484
2959
  state,
@@ -2568,12 +3043,12 @@ function CommandComposer({
2568
3043
  };
2569
3044
  const getFileIcon = (mimeType) => {
2570
3045
  if (mimeType.startsWith("image/")) {
2571
- return /* @__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: "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" }) });
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" }) });
2572
3047
  }
2573
3048
  if (mimeType === "application/pdf") {
2574
- return /* @__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: "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" }) });
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" }) });
2575
3050
  }
2576
- return /* @__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: "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" }) });
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" }) });
2577
3052
  };
2578
3053
  const getDisplayContent = () => {
2579
3054
  if (state === "loading") {
@@ -2598,12 +3073,12 @@ function CommandComposer({
2598
3073
  };
2599
3074
  const isShowingResult = state !== "idle";
2600
3075
  const { text: displayContent, isToolCall } = getDisplayContent();
2601
- return /* @__PURE__ */ jsxs14("div", { className: "w-full relative", children: [
2602
- fileError && /* @__PURE__ */ jsx18("div", { className: "absolute -top-12 left-0 right-0 mx-3 p-2 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg z-30", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-xs", children: [
2603
- /* @__PURE__ */ jsx18("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
2604
- /* @__PURE__ */ jsx18("span", { children: fileError })
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 })
2605
3080
  ] }) }),
2606
- /* @__PURE__ */ jsxs14(
3081
+ /* @__PURE__ */ jsxs15(
2607
3082
  "div",
2608
3083
  {
2609
3084
  className: cn(
@@ -2615,21 +3090,21 @@ function CommandComposer({
2615
3090
  state === "error" && "border-red-400 dark:border-red-500"
2616
3091
  ),
2617
3092
  children: [
2618
- /* @__PURE__ */ jsxs14("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
2619
- state === "idle" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
2620
- /* @__PURE__ */ jsx18(
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(
2621
3096
  "button",
2622
3097
  {
2623
3098
  ref: menuButtonRef,
2624
3099
  onClick: () => setShowMenu(!showMenu),
2625
3100
  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",
2626
3101
  title: "More options",
2627
- children: /* @__PURE__ */ jsx18("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
2628
3103
  }
2629
3104
  ),
2630
- showMenu && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2631
- /* @__PURE__ */ jsx18("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
2632
- /* @__PURE__ */ jsxs14(
3105
+ showMenu && /* @__PURE__ */ jsxs15(Fragment4, { children: [
3106
+ /* @__PURE__ */ jsx21("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
3107
+ /* @__PURE__ */ jsxs15(
2633
3108
  "div",
2634
3109
  {
2635
3110
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -2638,7 +3113,7 @@ function CommandComposer({
2638
3113
  top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
2639
3114
  },
2640
3115
  children: [
2641
- /* @__PURE__ */ jsxs14(
3116
+ /* @__PURE__ */ jsxs15(
2642
3117
  "button",
2643
3118
  {
2644
3119
  onClick: () => {
@@ -2647,12 +3122,12 @@ function CommandComposer({
2647
3122
  },
2648
3123
  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",
2649
3124
  children: [
2650
- /* @__PURE__ */ jsx18("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("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)" }) }),
2651
- /* @__PURE__ */ jsx18("span", { className: "!text-sm font-medium", children: "Add photos & files" })
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" })
2652
3127
  ]
2653
3128
  }
2654
3129
  ),
2655
- onExpand && /* @__PURE__ */ jsxs14(
3130
+ onExpand && /* @__PURE__ */ jsxs15(
2656
3131
  "button",
2657
3132
  {
2658
3133
  onClick: () => {
@@ -2661,8 +3136,8 @@ function CommandComposer({
2661
3136
  },
2662
3137
  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",
2663
3138
  children: [
2664
- /* @__PURE__ */ jsx18("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("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" }) }),
2665
- /* @__PURE__ */ jsx18("span", { className: "!text-sm font-medium", children: "Expand to chat" })
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" })
2666
3141
  ]
2667
3142
  }
2668
3143
  )
@@ -2671,30 +3146,22 @@ function CommandComposer({
2671
3146
  )
2672
3147
  ] })
2673
3148
  ] }),
2674
- state === "loading" && !toolName && /* @__PURE__ */ jsx18("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
2675
- state === "loading" && toolName && /* @__PURE__ */ jsx18("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
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" })
2676
3151
  ] }),
2677
- pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs14(
2678
- "div",
2679
- {
2680
- className: "relative group flex items-center justify-center w-6 h-6 bg-neutral-100 dark:bg-neutral-800 rounded overflow-hidden",
2681
- title: pf.file.name,
2682
- children: [
2683
- pf.preview ? /* @__PURE__ */ jsx18("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ jsx18("span", { className: "text-xs !text-neutral-500 dark:!text-neutral-400", children: getFileIcon(pf.file.type) }),
2684
- /* @__PURE__ */ jsx18(
2685
- "button",
2686
- {
2687
- onClick: () => removeFile(index),
2688
- className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
2689
- title: "Remove",
2690
- children: /* @__PURE__ */ jsx18("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
2691
- }
2692
- )
2693
- ]
2694
- },
2695
- index
2696
- )) }),
2697
- state === "idle" ? /* @__PURE__ */ jsx18(
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(
3155
+ "button",
3156
+ {
3157
+ onClick: () => removeFile(index),
3158
+ className: "apteva-file-badge-remove",
3159
+ 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" }) })
3161
+ }
3162
+ )
3163
+ ] }, index)) }),
3164
+ state === "idle" ? /* @__PURE__ */ jsx21(
2698
3165
  "textarea",
2699
3166
  {
2700
3167
  ref: inputRef,
@@ -2712,7 +3179,7 @@ function CommandComposer({
2712
3179
  ),
2713
3180
  style: { minHeight: "24px", maxHeight: "120px" }
2714
3181
  }
2715
- ) : /* @__PURE__ */ jsx18(
3182
+ ) : /* @__PURE__ */ jsx21(
2716
3183
  "div",
2717
3184
  {
2718
3185
  className: cn(
@@ -2723,14 +3190,14 @@ function CommandComposer({
2723
3190
  state === "error" && "!text-red-600 dark:!text-red-400",
2724
3191
  state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
2725
3192
  ),
2726
- children: isToolCall ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
2727
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: displayContent }),
2728
- /* @__PURE__ */ jsx18("span", { className: "text-neutral-400 dark:text-neutral-500", children: "Running..." })
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..." })
2729
3196
  ] }) : displayContent
2730
3197
  }
2731
3198
  ),
2732
- /* @__PURE__ */ jsx18("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
2733
- /* @__PURE__ */ jsx18(
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(
2734
3201
  "button",
2735
3202
  {
2736
3203
  onClick: onApprove,
@@ -2738,7 +3205,7 @@ function CommandComposer({
2738
3205
  children: "Approve"
2739
3206
  }
2740
3207
  ),
2741
- /* @__PURE__ */ jsx18(
3208
+ /* @__PURE__ */ jsx21(
2742
3209
  "button",
2743
3210
  {
2744
3211
  onClick: onReject,
@@ -2746,26 +3213,26 @@ function CommandComposer({
2746
3213
  children: "Modify"
2747
3214
  }
2748
3215
  )
2749
- ] }) : /* @__PURE__ */ jsxs14(Fragment3, { children: [
2750
- state === "loading" && onStop && /* @__PURE__ */ jsx18(
3216
+ ] }) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
3217
+ state === "loading" && onStop && /* @__PURE__ */ jsx21(
2751
3218
  "button",
2752
3219
  {
2753
3220
  onClick: onStop,
2754
3221
  className: "apteva-composer-stop-btn",
2755
3222
  title: "Stop generation",
2756
- children: /* @__PURE__ */ jsx18("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
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" }) })
2757
3224
  }
2758
3225
  ),
2759
- (state === "success" || state === "error") && /* @__PURE__ */ jsx18(
3226
+ (state === "success" || state === "error") && /* @__PURE__ */ jsx21(
2760
3227
  "button",
2761
3228
  {
2762
3229
  onClick: handleNewCommand,
2763
3230
  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",
2764
3231
  title: "New command",
2765
- children: /* @__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: "M6 18L18 6M6 6l12 12" }) })
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" }) })
2766
3233
  }
2767
3234
  ),
2768
- state === "idle" && /* @__PURE__ */ jsx18(
3235
+ state === "idle" && /* @__PURE__ */ jsx21(
2769
3236
  "button",
2770
3237
  {
2771
3238
  onClick: handleSubmit,
@@ -2777,14 +3244,14 @@ function CommandComposer({
2777
3244
  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"
2778
3245
  ),
2779
3246
  title: "Execute command",
2780
- children: /* @__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: "M5 12h14M12 5l7 7-7 7" }) })
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" }) })
2781
3248
  }
2782
3249
  )
2783
3250
  ] }) })
2784
3251
  ]
2785
3252
  }
2786
3253
  ),
2787
- /* @__PURE__ */ jsx18(
3254
+ /* @__PURE__ */ jsx21(
2788
3255
  "input",
2789
3256
  {
2790
3257
  ref: fileInputRef,
@@ -2799,22 +3266,20 @@ function CommandComposer({
2799
3266
  }
2800
3267
 
2801
3268
  // src/lib/apteva-client.ts
2802
- var DEFAULT_API_URL = "http://91.99.200.48:3000/agents";
2803
- var DEFAULT_API_KEY = "agt_894abd5966bc9f1e9f8f17f2a6f6b5e0";
2804
3269
  var AptevaClient = class {
2805
- constructor() {
3270
+ constructor(config) {
2806
3271
  __publicField(this, "config");
2807
3272
  this.config = {
2808
- apiUrl: DEFAULT_API_URL,
2809
- apiKey: DEFAULT_API_KEY
3273
+ apiUrl: config?.apiUrl ?? "",
3274
+ apiKey: config?.apiKey ?? ""
2810
3275
  };
2811
3276
  }
2812
3277
  /**
2813
3278
  * Update client configuration (optional - users can override defaults)
2814
3279
  */
2815
3280
  configure(config) {
2816
- if (config.apiUrl) this.config.apiUrl = config.apiUrl;
2817
- if (config.apiKey) this.config.apiKey = config.apiKey;
3281
+ if (config.apiUrl !== void 0) this.config.apiUrl = config.apiUrl;
3282
+ if (config.apiKey !== void 0) this.config.apiKey = config.apiKey;
2818
3283
  }
2819
3284
  /**
2820
3285
  * Get current configuration
@@ -2984,7 +3449,7 @@ var AptevaClient = class {
2984
3449
  var aptevaClient = new AptevaClient();
2985
3450
 
2986
3451
  // src/components/Chat/Chat.tsx
2987
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3452
+ import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2988
3453
  var Chat = forwardRef(function Chat2({
2989
3454
  agentId,
2990
3455
  threadId,
@@ -3024,6 +3489,7 @@ var Chat = forwardRef(function Chat2({
3024
3489
  placeholder,
3025
3490
  showHeader = true,
3026
3491
  headerTitle = "Chat",
3492
+ onHeaderBack,
3027
3493
  // Widget detection
3028
3494
  enableWidgets = false,
3029
3495
  availableWidgets,
@@ -3138,7 +3604,7 @@ ${widgetContext}` : widgetContext;
3138
3604
  let responseThreadId = currentThreadId;
3139
3605
  const toolInputBuffers = {};
3140
3606
  const receivingTimeouts = {};
3141
- const streamingMessageId = `msg-${Date.now()}`;
3607
+ const streamingMessageId = `msg-${Date.now()}-res`;
3142
3608
  const updateMessage = () => {
3143
3609
  const segments = [...contentSegments];
3144
3610
  if (currentTextBuffer) {
@@ -3203,15 +3669,21 @@ ${widgetContext}` : widgetContext;
3203
3669
  case "content":
3204
3670
  case "token":
3205
3671
  if (chunk.content) {
3206
- currentTextBuffer += chunk.content;
3207
- updateMessage();
3672
+ if (!currentTextBuffer) {
3673
+ currentTextBuffer = chunk.content.trimStart();
3674
+ } else {
3675
+ currentTextBuffer += chunk.content;
3676
+ }
3677
+ if (currentTextBuffer) {
3678
+ updateMessage();
3679
+ }
3208
3680
  }
3209
3681
  break;
3210
3682
  case "tool_call":
3211
3683
  if (chunk.tool_id && chunk.tool_name) {
3212
3684
  const displayName = chunk.tool_display_name || chunk.tool_name;
3213
3685
  if (currentTextBuffer) {
3214
- contentSegments.push({ type: "text", content: currentTextBuffer });
3686
+ contentSegments.push({ type: "text", content: currentTextBuffer.trimEnd() });
3215
3687
  currentTextBuffer = "";
3216
3688
  }
3217
3689
  contentSegments.push({ type: "tool", id: chunk.tool_id, name: displayName, status: "preparing" });
@@ -3294,6 +3766,7 @@ ${widgetContext}` : widgetContext;
3294
3766
  }
3295
3767
  },
3296
3768
  (threadId2) => {
3769
+ currentTextBuffer = currentTextBuffer.trimEnd();
3297
3770
  if (currentTextBuffer) {
3298
3771
  const lastSegment = contentSegments[contentSegments.length - 1];
3299
3772
  if (lastSegment && lastSegment.type === "text") {
@@ -3589,16 +4062,19 @@ ${planToExecute}`;
3589
4062
  setCurrentRequestId(null);
3590
4063
  };
3591
4064
  const isCompact = commandVariant === "compact";
3592
- return /* @__PURE__ */ jsxs15("div", { className: cn("apteva-chat flex flex-col h-full", variant !== "default" && `apteva-chat-${variant}`, className), children: [
3593
- showHeader && mode === "chat" && /* @__PURE__ */ jsx19("div", { className: "apteva-chat-header px-4 py-3 flex items-center justify-between", children: /* @__PURE__ */ jsxs15("div", { children: [
3594
- /* @__PURE__ */ jsx19("div", { className: "apteva-chat-title", children: headerTitle }),
3595
- /* @__PURE__ */ jsx19("div", { className: cn(
3596
- "apteva-chat-status",
3597
- isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
3598
- ), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
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(
4071
+ "apteva-chat-status",
4072
+ isLoading ? chatToolName ? "apteva-chat-status-tool" : "apteva-chat-status-thinking" : "apteva-chat-status-ready"
4073
+ ), children: isLoading ? chatToolName ? `Using ${chatToolName}...` : "Thinking..." : "Ready" })
4074
+ ] })
3599
4075
  ] }) }),
3600
- mode === "chat" && /* @__PURE__ */ jsxs15(Fragment4, { children: [
3601
- /* @__PURE__ */ jsx19(
4076
+ mode === "chat" && /* @__PURE__ */ jsxs16(Fragment5, { children: [
4077
+ /* @__PURE__ */ jsx22(
3602
4078
  MessageList,
3603
4079
  {
3604
4080
  messages,
@@ -3614,7 +4090,7 @@ ${planToExecute}`;
3614
4090
  onWidgetRender
3615
4091
  }
3616
4092
  ),
3617
- /* @__PURE__ */ jsx19(
4093
+ /* @__PURE__ */ jsx22(
3618
4094
  Composer,
3619
4095
  {
3620
4096
  onSendMessage: handleSendMessage,
@@ -3627,7 +4103,7 @@ ${planToExecute}`;
3627
4103
  }
3628
4104
  )
3629
4105
  ] }),
3630
- mode === "command" && /* @__PURE__ */ jsx19("div", { className: "w-full", children: /* @__PURE__ */ jsx19(
4106
+ mode === "command" && /* @__PURE__ */ jsx22("div", { className: "w-full", children: /* @__PURE__ */ jsx22(
3631
4107
  CommandComposer,
3632
4108
  {
3633
4109
  onExecute: (text, files) => {
@@ -3648,7 +4124,7 @@ ${planToExecute}`;
3648
4124
  placeholder: placeholder || "Enter your command..."
3649
4125
  }
3650
4126
  ) }),
3651
- /* @__PURE__ */ jsx19("style", { dangerouslySetInnerHTML: {
4127
+ /* @__PURE__ */ jsx22("style", { dangerouslySetInnerHTML: {
3652
4128
  __html: `
3653
4129
  @keyframes pulse-border {
3654
4130
  0%, 100% { border-color: rgb(59, 130, 246); }
@@ -3667,11 +4143,11 @@ ${planToExecute}`;
3667
4143
 
3668
4144
  // src/components/Chat/CommandOutput.tsx
3669
4145
  import { useState as useState7 } from "react";
3670
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4146
+ import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
3671
4147
 
3672
4148
  // src/components/Command/Command.tsx
3673
4149
  import React, { useState as useState8, useEffect as useEffect7 } from "react";
3674
- import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
4150
+ import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
3675
4151
  function Command({
3676
4152
  agentId,
3677
4153
  command: initialCommand,
@@ -4121,7 +4597,7 @@ ${planToExecute}`;
4121
4597
  setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
4122
4598
  };
4123
4599
  const isCompact = variant === "compact";
4124
- return /* @__PURE__ */ jsxs17(
4600
+ return /* @__PURE__ */ jsxs18(
4125
4601
  "div",
4126
4602
  {
4127
4603
  className: cn(
@@ -4136,9 +4612,9 @@ ${planToExecute}`;
4136
4612
  ),
4137
4613
  style: { minHeight: isCompact ? "auto" : "180px" },
4138
4614
  children: [
4139
- /* @__PURE__ */ jsxs17("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
4140
- state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4141
- /* @__PURE__ */ jsx21(
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(
4142
4618
  "textarea",
4143
4619
  {
4144
4620
  value: command,
@@ -4154,42 +4630,42 @@ ${planToExecute}`;
4154
4630
  rows: 6
4155
4631
  }
4156
4632
  ),
4157
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs17("div", { className: "relative group", children: [
4158
- file.type === "image" ? /* @__PURE__ */ jsx21(
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(
4159
4635
  "img",
4160
4636
  {
4161
4637
  src: file.preview,
4162
4638
  alt: file.name,
4163
4639
  className: "w-20 h-20 object-cover rounded-lg border-2 border-neutral-300 dark:border-neutral-600"
4164
4640
  }
4165
- ) : /* @__PURE__ */ jsxs17("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: [
4166
- /* @__PURE__ */ jsx21("svg", { className: "w-8 h-8 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx21("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" }) }),
4167
- /* @__PURE__ */ jsx21("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 })
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 })
4168
4644
  ] }),
4169
- /* @__PURE__ */ jsx21(
4645
+ /* @__PURE__ */ jsx24(
4170
4646
  "button",
4171
4647
  {
4172
4648
  onClick: () => removeFile(index),
4173
4649
  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",
4174
4650
  title: `Remove ${file.type}`,
4175
- children: /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
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" }) })
4176
4652
  }
4177
4653
  )
4178
4654
  ] }, index)) })
4179
4655
  ] }),
4180
- state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4181
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
4182
- enableFileUpload && /* @__PURE__ */ jsx21(
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(
4183
4659
  "button",
4184
4660
  {
4185
4661
  onClick: () => fileInputRef.current?.click(),
4186
4662
  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",
4187
4663
  title: "Attach file",
4188
- children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("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)" }) })
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)" }) })
4189
4665
  }
4190
4666
  ),
4191
- planMode && /* @__PURE__ */ jsxs17("div", { className: "relative settings-menu-container", children: [
4192
- /* @__PURE__ */ jsx21(
4667
+ planMode && /* @__PURE__ */ jsxs18("div", { className: "relative settings-menu-container", children: [
4668
+ /* @__PURE__ */ jsx24(
4193
4669
  "button",
4194
4670
  {
4195
4671
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -4198,28 +4674,28 @@ ${planToExecute}`;
4198
4674
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
4199
4675
  ),
4200
4676
  title: "Settings",
4201
- children: /* @__PURE__ */ jsxs17("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4202
- /* @__PURE__ */ jsx21("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
4203
- /* @__PURE__ */ jsx21("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
4204
- /* @__PURE__ */ jsx21("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
4205
- /* @__PURE__ */ jsx21("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
4206
- /* @__PURE__ */ jsx21("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
4207
- /* @__PURE__ */ jsx21("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
4208
- /* @__PURE__ */ jsx21("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
4209
- /* @__PURE__ */ jsx21("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
4210
- /* @__PURE__ */ jsx21("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
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" })
4211
4687
  ] })
4212
4688
  }
4213
4689
  ),
4214
- showSettingsMenu && /* @__PURE__ */ jsx21("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__ */ jsxs17("label", { className: "flex items-center justify-between cursor-pointer group", children: [
4215
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4216
- /* @__PURE__ */ jsx21("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__ */ jsx21("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" }) }),
4217
- /* @__PURE__ */ jsxs17("div", { children: [
4218
- /* @__PURE__ */ jsx21("div", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
4219
- /* @__PURE__ */ jsx21("div", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: "Review first" })
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" })
4220
4696
  ] })
4221
4697
  ] }),
4222
- /* @__PURE__ */ jsx21(
4698
+ /* @__PURE__ */ jsx24(
4223
4699
  "button",
4224
4700
  {
4225
4701
  onClick: (e) => {
@@ -4231,7 +4707,7 @@ ${planToExecute}`;
4231
4707
  internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
4232
4708
  ),
4233
4709
  type: "button",
4234
- children: /* @__PURE__ */ jsx21(
4710
+ children: /* @__PURE__ */ jsx24(
4235
4711
  "span",
4236
4712
  {
4237
4713
  className: cn(
@@ -4245,26 +4721,26 @@ ${planToExecute}`;
4245
4721
  ] }) })
4246
4722
  ] })
4247
4723
  ] }),
4248
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs17("div", { className: "relative group", children: [
4249
- file.type === "image" ? /* @__PURE__ */ jsx21(
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(
4250
4726
  "img",
4251
4727
  {
4252
4728
  src: file.preview,
4253
4729
  alt: file.name,
4254
4730
  className: "w-8 h-8 object-cover rounded border border-neutral-300 dark:border-neutral-600"
4255
4731
  }
4256
- ) : /* @__PURE__ */ jsx21("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__ */ jsx21("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx21("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" }) }) }),
4257
- /* @__PURE__ */ jsx21(
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(
4258
4734
  "button",
4259
4735
  {
4260
4736
  onClick: () => removeFile(index),
4261
4737
  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",
4262
4738
  title: "Remove",
4263
- children: /* @__PURE__ */ jsx21("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
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" }) })
4264
4740
  }
4265
4741
  )
4266
4742
  ] }, index)) }),
4267
- /* @__PURE__ */ jsx21(
4743
+ /* @__PURE__ */ jsx24(
4268
4744
  "input",
4269
4745
  {
4270
4746
  type: "text",
@@ -4280,7 +4756,7 @@ ${planToExecute}`;
4280
4756
  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"
4281
4757
  }
4282
4758
  ),
4283
- /* @__PURE__ */ jsx21(
4759
+ /* @__PURE__ */ jsx24(
4284
4760
  "button",
4285
4761
  {
4286
4762
  onClick: () => executeCommand(),
@@ -4296,33 +4772,33 @@ ${planToExecute}`;
4296
4772
  !command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
4297
4773
  ),
4298
4774
  title: "Execute",
4299
- children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
4300
4776
  }
4301
4777
  )
4302
4778
  ] }),
4303
- state === "loading" && !isCompact && /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
4304
- /* @__PURE__ */ jsx21("div", { className: "w-6 h-6 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
4305
- /* @__PURE__ */ jsx21("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
4306
- showProgress && /* @__PURE__ */ jsxs17("div", { className: "w-full max-w-sm", children: [
4307
- /* @__PURE__ */ jsx21("div", { className: "w-full bg-neutral-200 dark:bg-neutral-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx21(
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(
4308
4784
  "div",
4309
4785
  {
4310
4786
  className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
4311
4787
  style: { width: `${progress}%` }
4312
4788
  }
4313
4789
  ) }),
4314
- /* @__PURE__ */ jsxs17("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
4790
+ /* @__PURE__ */ jsxs18("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
4315
4791
  progress,
4316
4792
  "%"
4317
4793
  ] })
4318
4794
  ] })
4319
4795
  ] }),
4320
- state === "loading" && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4321
- /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
4322
- /* @__PURE__ */ jsx21("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
4323
- /* @__PURE__ */ jsx21("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
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 })
4324
4800
  ] }),
4325
- /* @__PURE__ */ jsx21(
4801
+ /* @__PURE__ */ jsx24(
4326
4802
  "button",
4327
4803
  {
4328
4804
  disabled: true,
@@ -4334,20 +4810,20 @@ ${planToExecute}`;
4334
4810
  "!text-lg",
4335
4811
  "opacity-30 cursor-not-allowed"
4336
4812
  ),
4337
- children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
4338
4814
  }
4339
4815
  )
4340
4816
  ] }),
4341
- state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx21("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs17("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: [
4342
- /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-2 mb-3", children: [
4343
- /* @__PURE__ */ jsx21("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__ */ jsx21("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" }) }),
4344
- /* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
4345
- /* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
4346
- /* @__PURE__ */ jsx21("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
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 })
4347
4823
  ] })
4348
4824
  ] }),
4349
- /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 mt-4", children: [
4350
- /* @__PURE__ */ jsx21(
4825
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 mt-4", children: [
4826
+ /* @__PURE__ */ jsx24(
4351
4827
  "button",
4352
4828
  {
4353
4829
  onClick: approvePlan,
@@ -4355,7 +4831,7 @@ ${planToExecute}`;
4355
4831
  children: "Approve & Execute"
4356
4832
  }
4357
4833
  ),
4358
- /* @__PURE__ */ jsx21(
4834
+ /* @__PURE__ */ jsx24(
4359
4835
  "button",
4360
4836
  {
4361
4837
  onClick: rejectPlan,
@@ -4365,20 +4841,20 @@ ${planToExecute}`;
4365
4841
  )
4366
4842
  ] })
4367
4843
  ] }) }),
4368
- state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4369
- /* @__PURE__ */ jsxs17(
4844
+ state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4845
+ /* @__PURE__ */ jsxs18(
4370
4846
  "button",
4371
4847
  {
4372
4848
  onClick: () => setShowPlanDetails(true),
4373
4849
  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",
4374
4850
  children: [
4375
- /* @__PURE__ */ jsx21("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__ */ jsx21("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" }) }),
4376
- /* @__PURE__ */ jsx21("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
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" })
4377
4853
  ]
4378
4854
  }
4379
4855
  ),
4380
- /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 flex-shrink-0", children: [
4381
- /* @__PURE__ */ jsx21(
4856
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 flex-shrink-0", children: [
4857
+ /* @__PURE__ */ jsx24(
4382
4858
  "button",
4383
4859
  {
4384
4860
  onClick: approvePlan,
@@ -4386,7 +4862,7 @@ ${planToExecute}`;
4386
4862
  children: "Approve"
4387
4863
  }
4388
4864
  ),
4389
- /* @__PURE__ */ jsx21(
4865
+ /* @__PURE__ */ jsx24(
4390
4866
  "button",
4391
4867
  {
4392
4868
  onClick: rejectPlan,
@@ -4396,15 +4872,15 @@ ${planToExecute}`;
4396
4872
  )
4397
4873
  ] })
4398
4874
  ] }),
4399
- state === "error" && /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col", children: [
4400
- /* @__PURE__ */ jsx21("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__ */ jsxs17("div", { className: "flex items-start gap-2", children: [
4401
- /* @__PURE__ */ jsx21("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__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4402
- /* @__PURE__ */ jsxs17("div", { children: [
4403
- /* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
4404
- /* @__PURE__ */ jsx21("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
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 })
4405
4881
  ] })
4406
4882
  ] }) }),
4407
- allowInput && /* @__PURE__ */ jsx21(
4883
+ allowInput && /* @__PURE__ */ jsx24(
4408
4884
  "textarea",
4409
4885
  {
4410
4886
  value: command,
@@ -4421,16 +4897,16 @@ ${planToExecute}`;
4421
4897
  }
4422
4898
  )
4423
4899
  ] }),
4424
- state === "success" && result && !isCompact && /* @__PURE__ */ jsx21("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
4425
- /* @__PURE__ */ jsxs17("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: [
4426
- /* @__PURE__ */ jsx21("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__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4427
- /* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
4428
- /* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
4429
- /* @__PURE__ */ jsx21("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
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" })
4430
4906
  ] })
4431
4907
  ] }),
4432
- result.data?.summary && /* @__PURE__ */ jsx21("div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
4433
- result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx21(
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(
4434
4910
  WidgetRenderer,
4435
4911
  {
4436
4912
  widget,
@@ -4439,8 +4915,8 @@ ${planToExecute}`;
4439
4915
  widget.id
4440
4916
  )) })
4441
4917
  ] }) }),
4442
- state === "success" && result && isCompact && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4443
- /* @__PURE__ */ jsxs17(
4918
+ state === "success" && result && isCompact && /* @__PURE__ */ jsxs18(Fragment6, { children: [
4919
+ /* @__PURE__ */ jsxs18(
4444
4920
  "div",
4445
4921
  {
4446
4922
  className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
@@ -4449,12 +4925,12 @@ ${planToExecute}`;
4449
4925
  setResult(null);
4450
4926
  },
4451
4927
  children: [
4452
- /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
4453
- /* @__PURE__ */ jsx21("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" })
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" })
4454
4930
  ]
4455
4931
  }
4456
4932
  ),
4457
- /* @__PURE__ */ jsx21(
4933
+ /* @__PURE__ */ jsx24(
4458
4934
  "button",
4459
4935
  {
4460
4936
  onClick: () => {
@@ -4470,24 +4946,24 @@ ${planToExecute}`;
4470
4946
  "!text-lg"
4471
4947
  ),
4472
4948
  title: "New command",
4473
- children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
4474
4950
  }
4475
4951
  )
4476
4952
  ] })
4477
4953
  ] }),
4478
- !isCompact && /* @__PURE__ */ jsxs17("div", { className: "p-3 flex items-center justify-between gap-2", children: [
4479
- /* @__PURE__ */ jsx21("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4480
- enableFileUpload && /* @__PURE__ */ jsx21(
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(
4481
4957
  "button",
4482
4958
  {
4483
4959
  onClick: () => fileInputRef.current?.click(),
4484
4960
  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",
4485
4961
  title: "Attach file",
4486
- children: /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("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)" }) })
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)" }) })
4487
4963
  }
4488
4964
  ),
4489
- planMode && /* @__PURE__ */ jsxs17("div", { className: "relative settings-menu-container", children: [
4490
- /* @__PURE__ */ jsx21(
4965
+ planMode && /* @__PURE__ */ jsxs18("div", { className: "relative settings-menu-container", children: [
4966
+ /* @__PURE__ */ jsx24(
4491
4967
  "button",
4492
4968
  {
4493
4969
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -4496,28 +4972,28 @@ ${planToExecute}`;
4496
4972
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
4497
4973
  ),
4498
4974
  title: "Settings",
4499
- children: /* @__PURE__ */ jsxs17("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4500
- /* @__PURE__ */ jsx21("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
4501
- /* @__PURE__ */ jsx21("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
4502
- /* @__PURE__ */ jsx21("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
4503
- /* @__PURE__ */ jsx21("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
4504
- /* @__PURE__ */ jsx21("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
4505
- /* @__PURE__ */ jsx21("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
4506
- /* @__PURE__ */ jsx21("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
4507
- /* @__PURE__ */ jsx21("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
4508
- /* @__PURE__ */ jsx21("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
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" })
4509
4985
  ] })
4510
4986
  }
4511
4987
  ),
4512
- showSettingsMenu && /* @__PURE__ */ jsx21("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__ */ jsxs17("label", { className: "flex items-center justify-between cursor-pointer group", children: [
4513
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4514
- /* @__PURE__ */ jsx21("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("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" }) }),
4515
- /* @__PURE__ */ jsxs17("div", { children: [
4516
- /* @__PURE__ */ jsx21("div", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
4517
- /* @__PURE__ */ jsx21("div", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "Review before executing" })
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" })
4518
4994
  ] })
4519
4995
  ] }),
4520
- /* @__PURE__ */ jsx21(
4996
+ /* @__PURE__ */ jsx24(
4521
4997
  "button",
4522
4998
  {
4523
4999
  onClick: (e) => {
@@ -4529,7 +5005,7 @@ ${planToExecute}`;
4529
5005
  internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
4530
5006
  ),
4531
5007
  type: "button",
4532
- children: /* @__PURE__ */ jsx21(
5008
+ children: /* @__PURE__ */ jsx24(
4533
5009
  "span",
4534
5010
  {
4535
5011
  className: cn(
@@ -4543,9 +5019,9 @@ ${planToExecute}`;
4543
5019
  ] }) })
4544
5020
  ] })
4545
5021
  ] }) }),
4546
- !(state === "idle" && allowInput) && /* @__PURE__ */ jsx21("div", {}),
4547
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4548
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx21(
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(
4549
5025
  "button",
4550
5026
  {
4551
5027
  onClick: resetCommand,
@@ -4553,7 +5029,7 @@ ${planToExecute}`;
4553
5029
  children: "Reset"
4554
5030
  }
4555
5031
  ),
4556
- (state === "idle" || state === "error") && /* @__PURE__ */ jsx21(
5032
+ (state === "idle" || state === "error") && /* @__PURE__ */ jsx24(
4557
5033
  "button",
4558
5034
  {
4559
5035
  onClick: () => executeCommand(),
@@ -4569,29 +5045,29 @@ ${planToExecute}`;
4569
5045
  !command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
4570
5046
  ),
4571
5047
  title: state === "error" ? "Retry" : "Execute",
4572
- children: state === "error" ? /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("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__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
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" }) })
4573
5049
  }
4574
5050
  )
4575
5051
  ] })
4576
5052
  ] }),
4577
- showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx21("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs17("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: [
4578
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between p-6 border-b border-neutral-200 dark:border-neutral-700", children: [
4579
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3", children: [
4580
- /* @__PURE__ */ jsx21("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("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" }) }),
4581
- /* @__PURE__ */ jsx21("h2", { className: "text-xl font-semibold text-neutral-900 dark:text-white", children: "Proposed Execution Plan" })
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" })
4582
5058
  ] }),
4583
- /* @__PURE__ */ jsx21(
5059
+ /* @__PURE__ */ jsx24(
4584
5060
  "button",
4585
5061
  {
4586
5062
  onClick: () => setShowPlanDetails(false),
4587
5063
  className: "text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors",
4588
- children: /* @__PURE__ */ jsx21("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
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" }) })
4589
5065
  }
4590
5066
  )
4591
5067
  ] }),
4592
- /* @__PURE__ */ jsx21("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx21("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx21("div", { className: "text-neutral-700 dark:text-neutral-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
4593
- /* @__PURE__ */ jsxs17("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: [
4594
- /* @__PURE__ */ jsx21(
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(
4595
5071
  "button",
4596
5072
  {
4597
5073
  onClick: rejectPlan,
@@ -4599,7 +5075,7 @@ ${planToExecute}`;
4599
5075
  children: "Modify Command"
4600
5076
  }
4601
5077
  ),
4602
- /* @__PURE__ */ jsx21(
5078
+ /* @__PURE__ */ jsx24(
4603
5079
  "button",
4604
5080
  {
4605
5081
  onClick: approvePlan,
@@ -4609,7 +5085,7 @@ ${planToExecute}`;
4609
5085
  )
4610
5086
  ] })
4611
5087
  ] }) }),
4612
- /* @__PURE__ */ jsx21(
5088
+ /* @__PURE__ */ jsx24(
4613
5089
  "input",
4614
5090
  {
4615
5091
  ref: fileInputRef,
@@ -4620,7 +5096,7 @@ ${planToExecute}`;
4620
5096
  accept: "image/*,application/pdf,.doc,.docx,.txt"
4621
5097
  }
4622
5098
  ),
4623
- /* @__PURE__ */ jsx21("style", { dangerouslySetInnerHTML: {
5099
+ /* @__PURE__ */ jsx24("style", { dangerouslySetInnerHTML: {
4624
5100
  __html: `
4625
5101
  @keyframes pulse-border {
4626
5102
  0%, 100% {
@@ -4642,7 +5118,7 @@ ${planToExecute}`;
4642
5118
 
4643
5119
  // src/components/Prompt/Prompt.tsx
4644
5120
  import { useState as useState9 } from "react";
4645
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5121
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
4646
5122
  function Prompt({
4647
5123
  agentId,
4648
5124
  placeholder = "Enter your prompt...",
@@ -4704,9 +5180,9 @@ function Prompt({
4704
5180
  handleSubmit();
4705
5181
  }
4706
5182
  };
4707
- return /* @__PURE__ */ jsxs18("div", { className: cn("space-y-2", className), children: [
4708
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-2", children: [
4709
- /* @__PURE__ */ jsx22(
5183
+ return /* @__PURE__ */ jsxs19("div", { className: cn("space-y-2", className), children: [
5184
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
5185
+ /* @__PURE__ */ jsx25(
4710
5186
  "input",
4711
5187
  {
4712
5188
  type: "text",
@@ -4719,7 +5195,7 @@ function Prompt({
4719
5195
  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"
4720
5196
  }
4721
5197
  ),
4722
- submitOn === "button" && /* @__PURE__ */ jsx22(
5198
+ submitOn === "button" && /* @__PURE__ */ jsx25(
4723
5199
  "button",
4724
5200
  {
4725
5201
  onClick: handleSubmit,
@@ -4729,13 +5205,13 @@ function Prompt({
4729
5205
  }
4730
5206
  )
4731
5207
  ] }),
4732
- maxLength && /* @__PURE__ */ jsxs18("p", { className: "text-xs text-neutral-500", children: [
5208
+ maxLength && /* @__PURE__ */ jsxs19("p", { className: "text-xs text-neutral-500", children: [
4733
5209
  value.length,
4734
5210
  " / ",
4735
5211
  maxLength,
4736
5212
  " characters"
4737
5213
  ] }),
4738
- showSuggestions && !value && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx22(
5214
+ showSuggestions && !value && /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx25(
4739
5215
  "button",
4740
5216
  {
4741
5217
  onClick: () => setValue(suggestion),
@@ -4744,16 +5220,16 @@ function Prompt({
4744
5220
  },
4745
5221
  idx
4746
5222
  )) }),
4747
- isLoading && /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-sm text-neutral-500", children: [
4748
- /* @__PURE__ */ jsx22("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
4749
- /* @__PURE__ */ jsx22("span", { children: "AI is processing your request..." })
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..." })
4750
5226
  ] })
4751
5227
  ] });
4752
5228
  }
4753
5229
 
4754
5230
  // src/components/Stream/Stream.tsx
4755
5231
  import { useState as useState10, useEffect as useEffect8 } from "react";
4756
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
5232
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
4757
5233
  function Stream({
4758
5234
  agentId,
4759
5235
  prompt,
@@ -4833,7 +5309,7 @@ function Stream({
4833
5309
  plain: "text-neutral-900 dark:text-neutral-100"
4834
5310
  };
4835
5311
  if (!isStreaming && !isComplete) {
4836
- return /* @__PURE__ */ jsx23("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx23(
5312
+ return /* @__PURE__ */ jsx26("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx26(
4837
5313
  "button",
4838
5314
  {
4839
5315
  onClick: startStreaming,
@@ -4842,9 +5318,9 @@ function Stream({
4842
5318
  }
4843
5319
  ) });
4844
5320
  }
4845
- return /* @__PURE__ */ jsxs19("div", { className: cn(variantClasses[variant], className), children: [
5321
+ return /* @__PURE__ */ jsxs20("div", { className: cn(variantClasses[variant], className), children: [
4846
5322
  text,
4847
- isStreaming && showCursor && /* @__PURE__ */ jsx23("span", { className: "apteva-stream-cursor" })
5323
+ isStreaming && showCursor && /* @__PURE__ */ jsx26("span", { className: "apteva-stream-cursor" })
4848
5324
  ] });
4849
5325
  }
4850
5326
 
@@ -4852,9 +5328,9 @@ function Stream({
4852
5328
  import { useState as useState11 } from "react";
4853
5329
 
4854
5330
  // src/components/Threads/ThreadItem.tsx
4855
- import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
5331
+ import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
4856
5332
  function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
4857
- return /* @__PURE__ */ jsxs20(
5333
+ return /* @__PURE__ */ jsxs21(
4858
5334
  "div",
4859
5335
  {
4860
5336
  className: cn("apteva-thread-item", {
@@ -4862,19 +5338,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
4862
5338
  }),
4863
5339
  onClick: onSelect,
4864
5340
  children: [
4865
- /* @__PURE__ */ jsxs20("div", { className: "flex-1 min-w-0", children: [
4866
- /* @__PURE__ */ jsx24("h4", { className: "font-semibold text-neutral-900 dark:text-white truncate", children: thread.title }),
4867
- thread.preview && /* @__PURE__ */ jsx24("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 truncate", children: thread.preview }),
4868
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 mt-1 text-xs text-neutral-500", children: [
4869
- /* @__PURE__ */ jsxs20("span", { 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: [
4870
5346
  thread.messageCount,
4871
5347
  " messages"
4872
5348
  ] }),
4873
- /* @__PURE__ */ jsx24("span", { children: "\u2022" }),
4874
- /* @__PURE__ */ jsx24("span", { children: formatRelativeTime(thread.updatedAt) })
5349
+ /* @__PURE__ */ jsx27("span", { children: "\u2022" }),
5350
+ /* @__PURE__ */ jsx27("span", { children: formatRelativeTime(thread.updatedAt) })
4875
5351
  ] })
4876
5352
  ] }),
4877
- onDelete && /* @__PURE__ */ jsx24(
5353
+ onDelete && /* @__PURE__ */ jsx27(
4878
5354
  "button",
4879
5355
  {
4880
5356
  onClick: (e) => {
@@ -4904,7 +5380,7 @@ function formatRelativeTime(date) {
4904
5380
  }
4905
5381
 
4906
5382
  // src/components/Threads/ThreadList.tsx
4907
- import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5383
+ import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
4908
5384
  function ThreadList({
4909
5385
  threads,
4910
5386
  currentThreadId,
@@ -4918,8 +5394,8 @@ function ThreadList({
4918
5394
  (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
4919
5395
  );
4920
5396
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
4921
- return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col h-full", children: [
4922
- showSearch && /* @__PURE__ */ jsx25("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx25(
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(
4923
5399
  "input",
4924
5400
  {
4925
5401
  type: "text",
@@ -4929,10 +5405,10 @@ function ThreadList({
4929
5405
  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"
4930
5406
  }
4931
5407
  ) }),
4932
- /* @__PURE__ */ jsxs21("div", { className: "flex-1 overflow-y-auto", children: [
4933
- Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs21("div", { children: [
4934
- groupBy !== "none" && /* @__PURE__ */ jsx25("div", { className: "px-3 py-2 text-xs font-semibold text-neutral-500 uppercase", children: group }),
4935
- groupThreads.map((thread) => /* @__PURE__ */ jsx25(
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(
4936
5412
  ThreadItem,
4937
5413
  {
4938
5414
  thread,
@@ -4943,9 +5419,9 @@ function ThreadList({
4943
5419
  thread.id
4944
5420
  ))
4945
5421
  ] }, group)),
4946
- filteredThreads.length === 0 && /* @__PURE__ */ jsxs21("div", { className: "p-8 text-center text-neutral-500", children: [
4947
- /* @__PURE__ */ jsx25("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx25("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" }) }),
4948
- /* @__PURE__ */ jsx25("p", { children: "No conversations found" })
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" })
4949
5425
  ] })
4950
5426
  ] })
4951
5427
  ] });
@@ -4977,7 +5453,7 @@ function groupThreadsByDate(threads) {
4977
5453
  }
4978
5454
 
4979
5455
  // src/components/Threads/Threads.tsx
4980
- import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
5456
+ import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
4981
5457
  function Threads({
4982
5458
  threads,
4983
5459
  currentThreadId,
@@ -4996,8 +5472,8 @@ function Threads({
4996
5472
  tabs: "flex gap-2 border-b border-neutral-200 dark:border-neutral-700 overflow-x-auto"
4997
5473
  };
4998
5474
  if (variant === "tabs") {
4999
- return /* @__PURE__ */ jsxs22("div", { className: cn(variantClasses[variant], className), children: [
5000
- threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx26(
5475
+ return /* @__PURE__ */ jsxs23("div", { className: cn(variantClasses[variant], className), children: [
5476
+ threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx29(
5001
5477
  "button",
5002
5478
  {
5003
5479
  onClick: () => onThreadSelect?.(thread.id),
@@ -5009,7 +5485,7 @@ function Threads({
5009
5485
  },
5010
5486
  thread.id
5011
5487
  )),
5012
- showNewButton && onNewThread && /* @__PURE__ */ jsx26(
5488
+ showNewButton && onNewThread && /* @__PURE__ */ jsx29(
5013
5489
  "button",
5014
5490
  {
5015
5491
  onClick: onNewThread,
@@ -5019,8 +5495,8 @@ function Threads({
5019
5495
  )
5020
5496
  ] });
5021
5497
  }
5022
- return /* @__PURE__ */ jsxs22("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
5023
- showNewButton && onNewThread && /* @__PURE__ */ jsx26("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx26(
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(
5024
5500
  "button",
5025
5501
  {
5026
5502
  onClick: onNewThread,
@@ -5028,7 +5504,7 @@ function Threads({
5028
5504
  children: "+ New Conversation"
5029
5505
  }
5030
5506
  ) }),
5031
- /* @__PURE__ */ jsx26(
5507
+ /* @__PURE__ */ jsx29(
5032
5508
  ThreadList,
5033
5509
  {
5034
5510
  threads,
@@ -5042,6 +5518,418 @@ function Threads({
5042
5518
  ] });
5043
5519
  }
5044
5520
 
5521
+ // src/components/AutoInterface/AutoInterface.tsx
5522
+ import { useState as useState13, useRef as useRef8, useCallback, useEffect as useEffect9 } from "react";
5523
+
5524
+ // 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";
5527
+ var gapClasses = {
5528
+ none: "gap-0",
5529
+ sm: "gap-2",
5530
+ md: "gap-4",
5531
+ lg: "gap-6"
5532
+ };
5533
+ var paddingClasses = {
5534
+ none: "p-0",
5535
+ sm: "p-2",
5536
+ md: "p-4",
5537
+ lg: "p-6"
5538
+ };
5539
+ var maxWidthClasses = {
5540
+ sm: "max-w-2xl",
5541
+ md: "max-w-4xl",
5542
+ lg: "max-w-6xl",
5543
+ xl: "max-w-7xl",
5544
+ full: "max-w-full"
5545
+ };
5546
+ function LayoutRenderer({ node, onAction, renderNode }) {
5547
+ const children = node.children || [];
5548
+ switch (node.layout) {
5549
+ case "page":
5550
+ return /* @__PURE__ */ jsx30(PageLayout, { node, renderNode });
5551
+ case "row":
5552
+ return /* @__PURE__ */ jsx30(RowLayout, { node, renderNode });
5553
+ case "columns":
5554
+ return /* @__PURE__ */ jsx30(ColumnsLayout, { node, renderNode });
5555
+ case "stack":
5556
+ return /* @__PURE__ */ jsx30(StackLayout, { node, renderNode });
5557
+ case "sidebar":
5558
+ return /* @__PURE__ */ jsx30(SidebarLayout, { node, renderNode });
5559
+ case "tabs":
5560
+ return /* @__PURE__ */ jsx30(TabsLayout, { node, renderNode });
5561
+ default:
5562
+ return /* @__PURE__ */ jsx30("div", { className: "space-y-4", children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id)) });
5563
+ }
5564
+ }
5565
+ function PageLayout({ node, renderNode }) {
5566
+ const { title, padding = "md", maxWidth = "xl" } = node.props || {};
5567
+ 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)) })
5571
+ ] });
5572
+ }
5573
+ function RowLayout({ node, renderNode }) {
5574
+ const { columns, gap = "md", align = "stretch" } = node.props || {};
5575
+ const children = node.children || [];
5576
+ const templateColumns = columns ? columns.map((c) => `${c}fr`).join(" ") : `repeat(${children.length}, 1fr)`;
5577
+ const alignClasses = {
5578
+ start: "items-start",
5579
+ center: "items-center",
5580
+ end: "items-end",
5581
+ stretch: "items-stretch"
5582
+ };
5583
+ return /* @__PURE__ */ jsx30(
5584
+ "div",
5585
+ {
5586
+ className: cn("grid", gapClasses[gap], alignClasses[align]),
5587
+ style: { gridTemplateColumns: templateColumns },
5588
+ children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id))
5589
+ }
5590
+ );
5591
+ }
5592
+ function ColumnsLayout({ node, renderNode }) {
5593
+ const { count, gap = "md" } = node.props || {};
5594
+ const children = node.children || [];
5595
+ const colCount = count || children.length;
5596
+ return /* @__PURE__ */ jsx30(
5597
+ "div",
5598
+ {
5599
+ className: cn("grid", gapClasses[gap]),
5600
+ style: { gridTemplateColumns: `repeat(${colCount}, 1fr)` },
5601
+ children: children.map((child) => /* @__PURE__ */ jsx30("div", { children: renderNode(child) }, child.id))
5602
+ }
5603
+ );
5604
+ }
5605
+ function StackLayout({ node, renderNode }) {
5606
+ const { gap = "md", align = "stretch" } = node.props || {};
5607
+ const children = node.children || [];
5608
+ const alignClasses = {
5609
+ left: "items-start",
5610
+ center: "items-center",
5611
+ right: "items-end",
5612
+ stretch: "items-stretch"
5613
+ };
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)) });
5615
+ }
5616
+ function SidebarLayout({ node, renderNode }) {
5617
+ const { side = "left", width = "280px" } = node.props || {};
5618
+ const children = node.children || [];
5619
+ const [sidebarChild, ...mainChildren] = side === "left" ? children : [...children].reverse();
5620
+ if (!sidebarChild) return null;
5621
+ const sidebar = /* @__PURE__ */ jsx30(
5622
+ "div",
5623
+ {
5624
+ className: "flex-shrink-0 overflow-y-auto border-neutral-200 dark:border-neutral-700",
5625
+ style: { width },
5626
+ children: renderNode(sidebarChild)
5627
+ }
5628
+ );
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: [
5631
+ sidebar,
5632
+ main
5633
+ ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5634
+ main,
5635
+ sidebar
5636
+ ] }) });
5637
+ }
5638
+ function TabsLayout({ node, renderNode }) {
5639
+ const { labels = [], defaultTab = 0 } = node.props || {};
5640
+ 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(
5644
+ "button",
5645
+ {
5646
+ onClick: () => setActiveTab(idx),
5647
+ className: cn(
5648
+ "px-4 py-2 !text-sm font-medium transition-colors border-b-2 -mb-px",
5649
+ activeTab === idx ? "border-blue-500 !text-blue-600 dark:!text-blue-400" : "border-transparent !text-neutral-500 hover:!text-neutral-700 dark:hover:!text-neutral-300"
5650
+ ),
5651
+ children: label
5652
+ },
5653
+ idx
5654
+ )) }),
5655
+ children[activeTab] && renderNode(children[activeTab])
5656
+ ] });
5657
+ }
5658
+
5659
+ // src/components/AutoInterface/InterfaceRenderer.tsx
5660
+ import { Fragment as Fragment8, jsx as jsx31 } from "react/jsx-runtime";
5661
+ var STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["type", "id", "layout", "props", "children", "actions", "metadata", "isStreaming"]);
5662
+ function normalizeNode(n) {
5663
+ let node = { ...n };
5664
+ if (node.type === "widget" && node.props?.widget) {
5665
+ node.type = node.props.widget;
5666
+ const { widget: _, ...rest } = node.props;
5667
+ node.props = rest;
5668
+ }
5669
+ const explicit = node.props || {};
5670
+ const extra = {};
5671
+ for (const key of Object.keys(node)) {
5672
+ if (!STRUCTURAL_KEYS.has(key)) {
5673
+ extra[key] = node[key];
5674
+ }
5675
+ }
5676
+ node.props = { ...extra, ...explicit };
5677
+ if (node.props.style && !node.props.variant) {
5678
+ node.props.variant = node.props.style;
5679
+ delete node.props.style;
5680
+ }
5681
+ if (node.children) {
5682
+ node.children = node.children.map(normalizeNode);
5683
+ }
5684
+ return node;
5685
+ }
5686
+ function InterfaceRenderer({ node, onAction }) {
5687
+ const renderNode = (rawNode) => {
5688
+ const n = normalizeNode(rawNode);
5689
+ if (n.type === "layout" && n.layout) {
5690
+ return /* @__PURE__ */ jsx31(
5691
+ LayoutRenderer,
5692
+ {
5693
+ node: n,
5694
+ onAction,
5695
+ renderNode
5696
+ },
5697
+ n.id
5698
+ );
5699
+ }
5700
+ return /* @__PURE__ */ jsx31(
5701
+ WidgetRenderer,
5702
+ {
5703
+ widget: {
5704
+ type: n.type,
5705
+ id: n.id,
5706
+ props: n.props || {},
5707
+ actions: n.actions,
5708
+ metadata: n.metadata,
5709
+ isStreaming: n.isStreaming
5710
+ },
5711
+ onAction
5712
+ },
5713
+ n.id
5714
+ );
5715
+ };
5716
+ return /* @__PURE__ */ jsx31(Fragment8, { children: renderNode(node) });
5717
+ }
5718
+
5719
+ // src/components/AutoInterface/InterfaceSkeleton.tsx
5720
+ import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
5721
+ 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" })
5727
+ ] }, 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" })
5732
+ ] }),
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))
5736
+ ] })
5737
+ ] })
5738
+ ] });
5739
+ }
5740
+
5741
+ // src/components/AutoInterface/AutoInterface.tsx
5742
+ import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
5743
+ async function generateInitialInterface(apiUrl, apiKey, agentId, prompt) {
5744
+ const systemContext = generateCompactInterfaceContext();
5745
+ const message = `${systemContext}
5746
+
5747
+ Generate an interface for: ${prompt}`;
5748
+ const headers = { "Content-Type": "application/json" };
5749
+ if (apiKey) headers["X-API-Key"] = apiKey;
5750
+ const response = await fetch(`${apiUrl}/chat`, {
5751
+ method: "POST",
5752
+ headers,
5753
+ body: JSON.stringify({
5754
+ agent_id: agentId,
5755
+ message,
5756
+ stream: false
5757
+ })
5758
+ });
5759
+ if (!response.ok) {
5760
+ const err = await response.json().catch(() => ({ error: "Request failed" }));
5761
+ throw new Error(err.error || `Request failed with status ${response.status}`);
5762
+ }
5763
+ const data = await response.json();
5764
+ const text = data.response || data.message || "";
5765
+ console.log("[AutoInterface] Raw API response:", data);
5766
+ console.log("[AutoInterface] Extracted text (" + text.length + " chars):", text.substring(0, 500));
5767
+ const spec = parseInterfaceFromText(text);
5768
+ console.log("[AutoInterface] Parsed spec:", spec ? "OK" : "null", spec ? JSON.stringify(spec).substring(0, 300) + "..." : "");
5769
+ return { spec, threadId: data.thread_id || null };
5770
+ }
5771
+ function AutoInterface({
5772
+ agentId,
5773
+ threadId,
5774
+ initialPrompt,
5775
+ initialInterface,
5776
+ context,
5777
+ apiUrl,
5778
+ apiKey,
5779
+ onInterfaceChange,
5780
+ onAction,
5781
+ onThreadChange,
5782
+ onError,
5783
+ chatPosition = "right",
5784
+ chatWidth = "380px",
5785
+ chatCollapsible = true,
5786
+ chatPlaceholder = "Ask the AI to generate or update the interface...",
5787
+ chatWelcomeTitle = "Auto Interface",
5788
+ useMock,
5789
+ theme,
5790
+ className
5791
+ }) {
5792
+ const [interfaceSpec, setInterfaceSpec] = useState13(initialInterface || null);
5793
+ const [isGenerating, setIsGenerating] = useState13(false);
5794
+ const [chatCollapsed, setChatCollapsed] = useState13(false);
5795
+ const chatRef = useRef8(null);
5796
+ const systemContext = [
5797
+ generateInterfaceContext(),
5798
+ context || ""
5799
+ ].filter(Boolean).join("\n\n");
5800
+ const updateInterface = useCallback((newSpec) => {
5801
+ setInterfaceSpec(newSpec);
5802
+ onInterfaceChange?.(newSpec);
5803
+ }, [onInterfaceChange]);
5804
+ const handleAction = useCallback((action) => {
5805
+ onAction?.(action);
5806
+ if (chatRef.current) {
5807
+ chatRef.current.sendMessage(
5808
+ `[Action: ${action.type} on widget ${action.widgetId || "unknown"}. Payload: ${JSON.stringify(action.payload)}]`
5809
+ );
5810
+ }
5811
+ }, [onAction]);
5812
+ const handleMessageComplete = useCallback((result) => {
5813
+ if (!result?.data) return;
5814
+ const text = typeof result.data === "string" ? result.data : result.data.message || "";
5815
+ console.log("[AutoInterface] Chat message complete, text (" + text.length + " chars):", text.substring(0, 300));
5816
+ const parsed = parseInterfaceFromText(text);
5817
+ if (parsed) {
5818
+ console.log("[AutoInterface] Parsed full interface from chat");
5819
+ updateInterface(parsed);
5820
+ setIsGenerating(false);
5821
+ return;
5822
+ }
5823
+ const updates = parseUpdatesFromText(text);
5824
+ if (updates.length > 0 && interfaceSpec) {
5825
+ console.log("[AutoInterface] Parsed", updates.length, "updates from chat");
5826
+ const newSpec = applyUpdates(interfaceSpec, updates);
5827
+ updateInterface(newSpec);
5828
+ } else {
5829
+ console.log("[AutoInterface] No interface or updates found in chat message");
5830
+ }
5831
+ setIsGenerating(false);
5832
+ }, [interfaceSpec, updateInterface]);
5833
+ useEffect9(() => {
5834
+ if (!initialPrompt || initialInterface || useMock) return;
5835
+ if (!apiUrl) return;
5836
+ let cancelled = false;
5837
+ setIsGenerating(true);
5838
+ console.log("[AutoInterface] Generating initial interface for prompt:", initialPrompt);
5839
+ console.log("[AutoInterface] API URL:", apiUrl, "| Agent:", agentId);
5840
+ generateInitialInterface(apiUrl, apiKey, agentId, initialPrompt).then(({ spec, threadId: threadId2 }) => {
5841
+ if (cancelled) return;
5842
+ console.log("[AutoInterface] Generation complete. Spec:", spec ? "parsed OK" : "null", "| Thread:", threadId2);
5843
+ if (spec) {
5844
+ console.log("[AutoInterface] Setting interface with", JSON.stringify(spec).length, "bytes");
5845
+ updateInterface(spec);
5846
+ } else {
5847
+ console.warn("[AutoInterface] Agent did not return a parseable @interface block");
5848
+ }
5849
+ setIsGenerating(false);
5850
+ }).catch((err) => {
5851
+ if (cancelled) return;
5852
+ console.error("[AutoInterface] Initial generation failed:", err);
5853
+ onError?.(err instanceof Error ? err : new Error(String(err)));
5854
+ setIsGenerating(false);
5855
+ });
5856
+ return () => {
5857
+ cancelled = true;
5858
+ };
5859
+ }, [initialPrompt]);
5860
+ const hasInterface = interfaceSpec !== null;
5861
+ const showSkeleton = isGenerating && !hasInterface;
5862
+ return /* @__PURE__ */ jsxs26("div", { className: cn(
5863
+ "flex h-full bg-neutral-50 dark:bg-black",
5864
+ chatPosition === "bottom" ? "flex-col" : "flex-row",
5865
+ className
5866
+ ), children: [
5867
+ /* @__PURE__ */ jsxs26("div", { className: cn(
5868
+ "flex-1 overflow-y-auto min-w-0",
5869
+ hasInterface || showSkeleton ? "" : "hidden"
5870
+ ), children: [
5871
+ showSkeleton && /* @__PURE__ */ jsx33(InterfaceSkeleton, {}),
5872
+ hasInterface && interfaceSpec && /* @__PURE__ */ jsx33("div", { className: "p-4", children: /* @__PURE__ */ jsx33(
5873
+ InterfaceRenderer,
5874
+ {
5875
+ node: interfaceSpec.root,
5876
+ onAction: handleAction
5877
+ }
5878
+ ) })
5879
+ ] }),
5880
+ chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */ jsx33(
5881
+ "button",
5882
+ {
5883
+ onClick: () => setChatCollapsed(!chatCollapsed),
5884
+ 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
+ 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" })
5887
+ }
5888
+ ),
5889
+ /* @__PURE__ */ jsx33(
5890
+ "div",
5891
+ {
5892
+ className: cn(
5893
+ "flex-shrink-0 border-neutral-200 dark:border-neutral-700",
5894
+ chatPosition === "right" ? "border-l" : "border-t",
5895
+ chatCollapsed && "hidden",
5896
+ // When no interface is generated yet, chat takes full width
5897
+ !hasInterface && !showSkeleton && "flex-1"
5898
+ ),
5899
+ style: hasInterface || showSkeleton ? chatPosition === "right" ? { width: chatWidth } : { height: "300px" } : void 0,
5900
+ children: /* @__PURE__ */ jsx33(
5901
+ Chat,
5902
+ {
5903
+ ref: chatRef,
5904
+ agentId,
5905
+ threadId,
5906
+ apiUrl,
5907
+ apiKey,
5908
+ useMock,
5909
+ context: systemContext,
5910
+ placeholder: chatPlaceholder,
5911
+ welcomeTitle: chatWelcomeTitle,
5912
+ welcomeSubtitle: "Describe the interface you want to create",
5913
+ enableStreaming: true,
5914
+ enableWidgets: true,
5915
+ showHeader: true,
5916
+ headerTitle: "Chat",
5917
+ onThreadChange,
5918
+ onComplete: handleMessageComplete,
5919
+ onError,
5920
+ className: "h-full",
5921
+ suggestedPrompts: !hasInterface ? [
5922
+ "Show me a sales dashboard",
5923
+ "Create a user management panel",
5924
+ "Build a project overview page"
5925
+ ] : void 0
5926
+ }
5927
+ )
5928
+ }
5929
+ )
5930
+ ] });
5931
+ }
5932
+
5045
5933
  // src/utils/theme-script.ts
5046
5934
  var themeScript = `
5047
5935
  (function() {
@@ -5065,22 +5953,155 @@ var themeScript = `
5065
5953
  function getThemeScript() {
5066
5954
  return themeScript;
5067
5955
  }
5956
+
5957
+ // src/hooks/useInterfaceState.ts
5958
+ import { useState as useState14, useCallback as useCallback2 } from "react";
5959
+ function useInterfaceState(initialSpec) {
5960
+ const [spec, setSpec] = useState14(initialSpec || null);
5961
+ const [isStreaming, setIsStreaming] = useState14(false);
5962
+ const setInterface = useCallback2((newSpec) => {
5963
+ setSpec(newSpec);
5964
+ }, []);
5965
+ const clearInterface = useCallback2(() => {
5966
+ setSpec(null);
5967
+ }, []);
5968
+ const applyInterfaceUpdate = useCallback2((update) => {
5969
+ setSpec((prev) => {
5970
+ if (!prev) return prev;
5971
+ return applyUpdate(prev, update);
5972
+ });
5973
+ }, []);
5974
+ const applyInterfaceUpdates = useCallback2((updates) => {
5975
+ setSpec((prev) => {
5976
+ if (!prev) return prev;
5977
+ return applyUpdates(prev, updates);
5978
+ });
5979
+ }, []);
5980
+ const getNode = useCallback2((id) => {
5981
+ if (!spec) return null;
5982
+ return findNode(spec.root, id);
5983
+ }, [spec]);
5984
+ return {
5985
+ spec,
5986
+ isStreaming,
5987
+ setInterface,
5988
+ clearInterface,
5989
+ applyInterfaceUpdate,
5990
+ applyInterfaceUpdates,
5991
+ setIsStreaming,
5992
+ getNode
5993
+ };
5994
+ }
5995
+
5996
+ // src/hooks/useInterfaceAI.ts
5997
+ import { useCallback as useCallback3, useRef as useRef9 } from "react";
5998
+ function useInterfaceAI({
5999
+ agentId,
6000
+ apiUrl,
6001
+ apiKey,
6002
+ context,
6003
+ onInterface,
6004
+ onUpdates,
6005
+ onError,
6006
+ onStreamStart,
6007
+ onStreamEnd
6008
+ }) {
6009
+ const threadIdRef = useRef9(null);
6010
+ const accumulatedTextRef = useRef9("");
6011
+ if (apiUrl || apiKey) {
6012
+ aptevaClient.configure({
6013
+ ...apiUrl && { apiUrl },
6014
+ ...apiKey && { apiKey }
6015
+ });
6016
+ }
6017
+ const sendMessage = useCallback3(async (message) => {
6018
+ accumulatedTextRef.current = "";
6019
+ onStreamStart?.();
6020
+ const systemPrompt = [
6021
+ generateInterfaceContext(),
6022
+ context || ""
6023
+ ].filter(Boolean).join("\n\n");
6024
+ try {
6025
+ await aptevaClient.chatStream(
6026
+ {
6027
+ agent_id: agentId,
6028
+ message,
6029
+ thread_id: threadIdRef.current || void 0,
6030
+ stream: true,
6031
+ system: systemPrompt
6032
+ },
6033
+ // onChunk
6034
+ (chunk) => {
6035
+ if (chunk.thread_id) {
6036
+ threadIdRef.current = chunk.thread_id;
6037
+ }
6038
+ if (chunk.type === "content" || chunk.type === "token") {
6039
+ accumulatedTextRef.current += chunk.content || "";
6040
+ const parsed = parseInterfaceFromText(accumulatedTextRef.current);
6041
+ if (parsed) {
6042
+ onInterface?.(parsed);
6043
+ }
6044
+ const updates = parseUpdatesFromText(accumulatedTextRef.current);
6045
+ if (updates.length > 0) {
6046
+ onUpdates?.(updates);
6047
+ }
6048
+ }
6049
+ },
6050
+ // onComplete
6051
+ () => {
6052
+ onStreamEnd?.();
6053
+ },
6054
+ // onError
6055
+ (error) => {
6056
+ onError?.(error);
6057
+ onStreamEnd?.();
6058
+ }
6059
+ );
6060
+ } catch (error) {
6061
+ onError?.(error instanceof Error ? error : new Error("Unknown error"));
6062
+ onStreamEnd?.();
6063
+ }
6064
+ }, [agentId, context, onInterface, onUpdates, onError, onStreamStart, onStreamEnd]);
6065
+ return {
6066
+ sendMessage,
6067
+ threadId: threadIdRef.current
6068
+ };
6069
+ }
5068
6070
  export {
5069
6071
  AptevaClient,
6072
+ AutoInterface,
5070
6073
  Button,
5071
6074
  Card,
5072
6075
  Chat,
5073
6076
  Command,
6077
+ InterfaceRenderer,
6078
+ InterfaceSkeleton,
6079
+ Kpi,
6080
+ LayoutRenderer,
5074
6081
  List,
5075
6082
  Prompt,
6083
+ Spacer,
5076
6084
  Stream,
6085
+ TextBlock,
5077
6086
  Threads,
5078
6087
  Widgets,
6088
+ applyUpdate,
6089
+ applyUpdates,
5079
6090
  aptevaClient,
5080
6091
  cn,
6092
+ containsInterface,
6093
+ convertApiMessages,
6094
+ findNode,
6095
+ generateCompactInterfaceContext,
6096
+ generateInterfaceContext,
5081
6097
  getThemeScript,
5082
6098
  mockMessages,
5083
6099
  mockThreads,
5084
- mockWidgets
6100
+ mockWidgets,
6101
+ parseInterfaceFromText,
6102
+ parseUpdatesFromText,
6103
+ stripInterface,
6104
+ useInterfaceAI,
6105
+ useInterfaceState
5085
6106
  };
5086
6107
  //# sourceMappingURL=index.mjs.map