@apteva/apteva-kit 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
 
6
6
  // src/components/Chat/Chat.tsx
7
- import { useState as useState3, useEffect as useEffect3, useRef as useRef4 } from "react";
7
+ import { useState as useState3, useEffect as useEffect3, useRef as useRef4, useMemo } from "react";
8
8
 
9
9
  // src/components/Chat/MessageList.tsx
10
10
  import { useEffect as useEffect2, useRef } from "react";
@@ -498,6 +498,237 @@ function validateFile(file) {
498
498
  return { valid: true };
499
499
  }
500
500
 
501
+ // src/utils/widget-parser.ts
502
+ function findMatchingBracket(text, startIndex) {
503
+ let depth = 0;
504
+ let inString = false;
505
+ let escapeNext = false;
506
+ for (let i = startIndex; i < text.length; i++) {
507
+ const char = text[i];
508
+ if (escapeNext) {
509
+ escapeNext = false;
510
+ continue;
511
+ }
512
+ if (char === "\\" && inString) {
513
+ escapeNext = true;
514
+ continue;
515
+ }
516
+ if (char === '"') {
517
+ inString = !inString;
518
+ continue;
519
+ }
520
+ if (inString) continue;
521
+ if (char === "[" || char === "{") {
522
+ depth++;
523
+ } else if (char === "]" || char === "}") {
524
+ depth--;
525
+ if (depth === 0) {
526
+ return i;
527
+ }
528
+ }
529
+ }
530
+ return -1;
531
+ }
532
+ function parseWidgetsFromText(text) {
533
+ const segments = [];
534
+ let hasWidgets = false;
535
+ let hasPendingWidget = false;
536
+ let currentIndex = 0;
537
+ let pendingWidgetType = null;
538
+ let processText = text;
539
+ const lastWidgetStart = text.lastIndexOf("@ui:");
540
+ if (lastWidgetStart !== -1) {
541
+ const afterStart = text.slice(lastWidgetStart);
542
+ const typeMatch = afterStart.match(/^@ui:(\w+)/);
543
+ if (typeMatch) {
544
+ const widgetType = typeMatch[1];
545
+ const bracketOpenIndex = afterStart.indexOf("[");
546
+ if (bracketOpenIndex === -1) {
547
+ processText = text.slice(0, lastWidgetStart);
548
+ pendingWidgetType = widgetType;
549
+ hasPendingWidget = true;
550
+ } else {
551
+ const fullBracketStart = lastWidgetStart + bracketOpenIndex;
552
+ const bracketEnd = findMatchingBracket(text, fullBracketStart);
553
+ if (bracketEnd === -1) {
554
+ processText = text.slice(0, lastWidgetStart);
555
+ pendingWidgetType = widgetType;
556
+ hasPendingWidget = true;
557
+ }
558
+ }
559
+ }
560
+ }
561
+ if (hasPendingWidget) {
562
+ processText = processText.replace(/[\s:;\-–—\.]+$/g, "");
563
+ }
564
+ const startPattern = /@ui:(\w+)\[/g;
565
+ let match;
566
+ while ((match = startPattern.exec(processText)) !== null) {
567
+ const widgetType = match[1];
568
+ const bracketStart = match.index + match[0].length - 1;
569
+ const bracketEnd = findMatchingBracket(processText, bracketStart);
570
+ if (bracketEnd === -1) {
571
+ continue;
572
+ }
573
+ const jsonContent = processText.slice(bracketStart + 1, bracketEnd);
574
+ if (match.index > currentIndex) {
575
+ const textContent = processText.slice(currentIndex, match.index).trim();
576
+ if (textContent) {
577
+ segments.push({
578
+ type: "text",
579
+ content: textContent
580
+ });
581
+ }
582
+ }
583
+ try {
584
+ const trimmedJson = jsonContent.trim();
585
+ const props = JSON.parse(trimmedJson);
586
+ const widgetId = `widget-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
587
+ segments.push({
588
+ type: "widget",
589
+ widget: {
590
+ type: widgetType,
591
+ id: widgetId,
592
+ props
593
+ }
594
+ });
595
+ hasWidgets = true;
596
+ } catch (e) {
597
+ }
598
+ currentIndex = bracketEnd + 1;
599
+ startPattern.lastIndex = currentIndex;
600
+ }
601
+ if (currentIndex < processText.length) {
602
+ const remainingText = processText.slice(currentIndex).trim();
603
+ if (remainingText) {
604
+ segments.push({
605
+ type: "text",
606
+ content: remainingText
607
+ });
608
+ }
609
+ }
610
+ if (segments.length === 0 && processText.trim()) {
611
+ segments.push({
612
+ type: "text",
613
+ content: processText.trim()
614
+ });
615
+ }
616
+ if (pendingWidgetType) {
617
+ segments.push({
618
+ type: "widget_pending",
619
+ pendingType: pendingWidgetType
620
+ });
621
+ }
622
+ return { segments, hasWidgets, hasPendingWidget };
623
+ }
624
+
625
+ // src/utils/widget-context.ts
626
+ var WIDGET_DEFINITIONS = {
627
+ card: {
628
+ description: "Displays a card with title and optional description, image, footer",
629
+ schema: '{"title": "string", "description?": "string", "image?": "url", "footer?": "string"}',
630
+ example: '@ui:card[{"title": "Summary", "description": "Key findings from the analysis"}]'
631
+ },
632
+ list: {
633
+ description: "Displays a list of items with title, subtitle, and optional description",
634
+ schema: '{"items": [{"id": "string", "title": "string", "subtitle?": "string", "description?": "string", "image?": "url"}]}',
635
+ example: '@ui:list[{"items": [{"id": "1", "title": "First item", "subtitle": "Details"}]}]'
636
+ },
637
+ button_group: {
638
+ description: "Displays action buttons. User clicks are sent back to you with the button id",
639
+ schema: '{"buttons": [{"id": "string", "label": "string", "variant?": "primary|secondary|outline"}], "layout?": "horizontal|vertical"}',
640
+ example: '@ui:button_group[{"buttons": [{"id": "confirm", "label": "Confirm", "variant": "primary"}, {"id": "cancel", "label": "Cancel"}]}]'
641
+ },
642
+ form: {
643
+ description: "Displays an input form. Submitted data is sent back to you",
644
+ schema: '{"title?": "string", "fields": [{"name": "string", "type": "text|number|select|checkbox|textarea|date", "label": "string", "required?": boolean, "placeholder?": "string", "options?": [{"label": "string", "value": "string"}]}]}',
645
+ example: '@ui:form[{"title": "Contact", "fields": [{"name": "email", "type": "text", "label": "Email", "required": true}]}]'
646
+ },
647
+ image: {
648
+ description: "Displays a single image with optional caption",
649
+ schema: '{"src": "url", "alt": "string", "caption?": "string"}',
650
+ example: '@ui:image[{"src": "https://example.com/img.png", "alt": "Description", "caption": "Figure 1"}]'
651
+ },
652
+ gallery: {
653
+ description: "Displays multiple images in a grid or carousel layout",
654
+ schema: '{"images": [{"id": "string", "src": "url", "alt": "string", "caption?": "string"}], "layout?": "grid|carousel"}',
655
+ example: '@ui:gallery[{"images": [{"id": "1", "src": "https://example.com/1.png", "alt": "Image 1"}], "layout": "grid"}]'
656
+ },
657
+ chart: {
658
+ description: "Displays a chart visualization (line, bar, pie, doughnut)",
659
+ schema: '{"chartType": "line|bar|pie|doughnut", "title?": "string", "data": {"labels": ["string"], "datasets": [{"label": "string", "data": [number], "backgroundColor?": "string|string[]"}]}}',
660
+ example: '@ui:chart[{"chartType": "bar", "title": "Sales", "data": {"labels": ["Q1", "Q2"], "datasets": [{"label": "Revenue", "data": [100, 150]}]}}]'
661
+ },
662
+ map: {
663
+ description: "Displays an interactive map with optional markers",
664
+ schema: '{"center": {"lat": number, "lng": number}, "zoom?": number, "markers?": [{"id": "string", "position": {"lat": number, "lng": number}, "title": "string"}]}',
665
+ example: '@ui:map[{"center": {"lat": 40.7128, "lng": -74.0060}, "zoom": 12, "markers": [{"id": "1", "position": {"lat": 40.7128, "lng": -74.0060}, "title": "NYC"}]}]'
666
+ },
667
+ table: {
668
+ description: "Displays structured data in rows and columns",
669
+ schema: '{"columns": [{"key": "string", "label": "string", "align?": "left|center|right"}], "rows": [{"id?": "string", ...}], "caption?": "string", "compact?": boolean, "striped?": boolean}',
670
+ example: '@ui:table[{"columns": [{"key": "name", "label": "Name"}, {"key": "status", "label": "Status"}], "rows": [{"name": "Item 1", "status": "Active"}, {"name": "Item 2", "status": "Pending"}]}]'
671
+ }
672
+ };
673
+ var ALL_WIDGET_TYPES = Object.keys(WIDGET_DEFINITIONS);
674
+ function generateWidgetContext(enabledWidgets) {
675
+ const widgets = enabledWidgets || ALL_WIDGET_TYPES;
676
+ let context = `
677
+ ## Available UI Widgets
678
+
679
+ `;
680
+ context += `You can render rich UI components in your responses using this syntax: @ui:type[{json_props}]
681
+
682
+ `;
683
+ context += `The widget syntax will be automatically converted to interactive UI. Users see the rendered widget, not the raw syntax.
684
+
685
+ `;
686
+ context += `### Available widgets:
687
+
688
+ `;
689
+ for (const type of widgets) {
690
+ const def = WIDGET_DEFINITIONS[type];
691
+ if (!def) continue;
692
+ context += `**${type}** - ${def.description}
693
+ `;
694
+ context += `Schema: \`${def.schema}\`
695
+ `;
696
+ context += `Example: \`${def.example}\`
697
+
698
+ `;
699
+ }
700
+ context += `### Important notes:
701
+ `;
702
+ context += `- JSON must be valid (use double quotes for strings)
703
+ `;
704
+ context += `- Widget actions (button clicks, form submissions) are sent back to you
705
+ `;
706
+ context += `- You can include multiple widgets in a single response
707
+ `;
708
+ context += `- Combine widgets with regular text for context
709
+ `;
710
+ return context;
711
+ }
712
+ function generateCompactWidgetContext(enabledWidgets) {
713
+ const widgets = enabledWidgets || ALL_WIDGET_TYPES;
714
+ let context = `
715
+ UI Widgets: Use @ui:type[{props}] syntax.
716
+ `;
717
+ context += `Available: ${widgets.join(", ")}
718
+ `;
719
+ context += `Examples:
720
+ `;
721
+ const examples = ["card", "list", "button_group"].filter((w) => widgets.includes(w));
722
+ for (const type of examples) {
723
+ const def = WIDGET_DEFINITIONS[type];
724
+ if (def) {
725
+ context += `${def.example}
726
+ `;
727
+ }
728
+ }
729
+ return context;
730
+ }
731
+
501
732
  // src/components/Widgets/Widgets.tsx
502
733
  import { useEffect } from "react";
503
734
 
@@ -642,31 +873,109 @@ function ButtonGroup({ widget, onAction }) {
642
873
  );
643
874
  }
644
875
 
645
- // src/components/Widgets/WidgetRenderer.tsx
876
+ // src/components/Widgets/widget-library/Table.tsx
646
877
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
878
+ function Table({ widget, onAction }) {
879
+ const { columns, rows, caption, compact = false, striped = false } = widget.props;
880
+ const getAlignment = (align) => {
881
+ switch (align) {
882
+ case "center":
883
+ return "text-center";
884
+ case "right":
885
+ return "text-right";
886
+ default:
887
+ return "text-left";
888
+ }
889
+ };
890
+ return /* @__PURE__ */ jsx5("div", { className: "border border-gray-200 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 overflow-hidden", children: /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs3("table", { className: "w-full", children: [
891
+ caption && /* @__PURE__ */ jsx5("caption", { className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-400 text-left bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: caption }),
892
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsx5("tr", { className: "bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: columns.map((column) => /* @__PURE__ */ jsx5(
893
+ "th",
894
+ {
895
+ className: cn(
896
+ "font-semibold text-gray-900 dark:text-white",
897
+ compact ? "px-3 py-2 text-xs" : "px-4 py-3 text-sm",
898
+ getAlignment(column.align)
899
+ ),
900
+ style: column.width ? { width: column.width } : void 0,
901
+ children: column.label
902
+ },
903
+ column.key
904
+ )) }) }),
905
+ /* @__PURE__ */ jsxs3("tbody", { children: [
906
+ rows.map((row, rowIndex) => /* @__PURE__ */ jsx5(
907
+ "tr",
908
+ {
909
+ className: cn(
910
+ "border-b border-gray-200 dark:border-gray-700 last:border-b-0",
911
+ "transition-colors hover:bg-gray-50 dark:hover:bg-gray-800",
912
+ striped && rowIndex % 2 === 1 && "bg-gray-50/50 dark:bg-gray-800/50"
913
+ ),
914
+ onClick: () => {
915
+ if (widget.actions && widget.actions.length > 0) {
916
+ onAction?.({
917
+ type: widget.actions[0].type,
918
+ payload: row,
919
+ widgetId: widget.id,
920
+ timestamp: /* @__PURE__ */ new Date()
921
+ });
922
+ }
923
+ },
924
+ style: { cursor: widget.actions?.length ? "pointer" : "default" },
925
+ children: columns.map((column) => /* @__PURE__ */ jsx5(
926
+ "td",
927
+ {
928
+ className: cn(
929
+ "text-gray-700 dark:text-gray-300",
930
+ compact ? "px-3 py-2 text-xs" : "px-4 py-3 text-sm",
931
+ getAlignment(column.align)
932
+ ),
933
+ children: row[column.key] ?? "\u2014"
934
+ },
935
+ column.key
936
+ ))
937
+ },
938
+ row.id || rowIndex
939
+ )),
940
+ rows.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
941
+ "td",
942
+ {
943
+ colSpan: columns.length,
944
+ className: "px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400",
945
+ children: "No data available"
946
+ }
947
+ ) })
948
+ ] })
949
+ ] }) }) });
950
+ }
951
+
952
+ // src/components/Widgets/WidgetRenderer.tsx
953
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
647
954
  function WidgetRenderer({ widget, onAction }) {
648
955
  switch (widget.type) {
649
956
  case "card":
650
- return /* @__PURE__ */ jsx5(Card, { widget, onAction });
957
+ return /* @__PURE__ */ jsx6(Card, { widget, onAction });
651
958
  case "list":
652
- return /* @__PURE__ */ jsx5(List, { widget, onAction });
959
+ return /* @__PURE__ */ jsx6(List, { widget, onAction });
653
960
  case "button":
654
- return /* @__PURE__ */ jsx5(Button, { widget, onAction });
961
+ return /* @__PURE__ */ jsx6(Button, { widget, onAction });
655
962
  case "button_group":
656
- return /* @__PURE__ */ jsx5(ButtonGroup, { widget, onAction });
963
+ return /* @__PURE__ */ jsx6(ButtonGroup, { widget, onAction });
964
+ case "table":
965
+ return /* @__PURE__ */ jsx6(Table, { widget, onAction });
657
966
  default:
658
- return /* @__PURE__ */ jsxs3("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
659
- /* @__PURE__ */ jsxs3("p", { className: "text-sm text-yellow-800", children: [
967
+ return /* @__PURE__ */ jsxs4("div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
968
+ /* @__PURE__ */ jsxs4("p", { className: "text-sm text-yellow-800", children: [
660
969
  "Unknown widget type: ",
661
970
  widget.type
662
971
  ] }),
663
- /* @__PURE__ */ jsx5("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
972
+ /* @__PURE__ */ jsx6("pre", { className: "text-xs mt-2 overflow-auto", children: JSON.stringify(widget, null, 2) })
664
973
  ] });
665
974
  }
666
975
  }
667
976
 
668
977
  // src/components/Widgets/Widgets.tsx
669
- import { jsx as jsx6 } from "react/jsx-runtime";
978
+ import { jsx as jsx7 } from "react/jsx-runtime";
670
979
  function Widgets({
671
980
  widgets,
672
981
  onAction,
@@ -691,11 +1000,85 @@ function Widgets({
691
1000
  normal: "gap-4",
692
1001
  loose: "gap-6"
693
1002
  };
694
- return /* @__PURE__ */ jsx6("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx6(WidgetRenderer, { widget, onAction }, widget.id)) });
1003
+ return /* @__PURE__ */ jsx7("div", { className: cn(layoutClasses[layout], spacingClasses[spacing], className), children: widgets.map((widget) => /* @__PURE__ */ jsx7(WidgetRenderer, { widget, onAction }, widget.id)) });
1004
+ }
1005
+
1006
+ // src/components/Widgets/WidgetSkeleton.tsx
1007
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1008
+ function WidgetSkeleton({ type, className }) {
1009
+ switch (type) {
1010
+ case "card":
1011
+ return /* @__PURE__ */ jsx8("div", { className: cn("animate-pulse rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden", className), children: /* @__PURE__ */ jsxs5("div", { className: "p-4 space-y-3", children: [
1012
+ /* @__PURE__ */ jsx8("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4" }),
1013
+ /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-full" }),
1014
+ /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-5/6" })
1015
+ ] }) });
1016
+ case "list":
1017
+ return /* @__PURE__ */ jsx8("div", { className: cn("animate-pulse space-y-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 p-3 rounded-lg border border-gray-200 dark:border-gray-700", children: [
1018
+ /* @__PURE__ */ jsx8("div", { className: "w-10 h-10 bg-gray-200 dark:bg-gray-700 rounded-full flex-shrink-0" }),
1019
+ /* @__PURE__ */ jsxs5("div", { className: "flex-1 space-y-2", children: [
1020
+ /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-1/2" }),
1021
+ /* @__PURE__ */ jsx8("div", { className: "h-2 bg-gray-200 dark:bg-gray-700 rounded w-3/4" })
1022
+ ] })
1023
+ ] }, i)) });
1024
+ case "button_group":
1025
+ return /* @__PURE__ */ jsxs5("div", { className: cn("animate-pulse flex gap-2", className), children: [
1026
+ /* @__PURE__ */ jsx8("div", { className: "h-9 bg-gray-200 dark:bg-gray-700 rounded-lg w-20" }),
1027
+ /* @__PURE__ */ jsx8("div", { className: "h-9 bg-gray-200 dark:bg-gray-700 rounded-lg w-20" }),
1028
+ /* @__PURE__ */ jsx8("div", { className: "h-9 bg-gray-200 dark:bg-gray-700 rounded-lg w-20" })
1029
+ ] });
1030
+ case "form":
1031
+ return /* @__PURE__ */ jsxs5("div", { className: cn("animate-pulse rounded-lg border border-gray-200 dark:border-gray-700 p-4 space-y-4", className), children: [
1032
+ /* @__PURE__ */ jsx8("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3" }),
1033
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
1034
+ /* @__PURE__ */ jsx8("div", { className: "h-10 bg-gray-200 dark:bg-gray-700 rounded" }),
1035
+ /* @__PURE__ */ jsx8("div", { className: "h-10 bg-gray-200 dark:bg-gray-700 rounded" })
1036
+ ] }),
1037
+ /* @__PURE__ */ jsx8("div", { className: "h-9 bg-gray-200 dark:bg-gray-700 rounded w-24" })
1038
+ ] });
1039
+ case "chart":
1040
+ return /* @__PURE__ */ jsxs5("div", { className: cn("animate-pulse rounded-lg border border-gray-200 dark:border-gray-700 p-4", className), children: [
1041
+ /* @__PURE__ */ jsx8("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/4 mb-4" }),
1042
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-end gap-2 h-32", children: [
1043
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 bg-gray-200 dark:bg-gray-700 rounded-t h-1/2" }),
1044
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 bg-gray-200 dark:bg-gray-700 rounded-t h-3/4" }),
1045
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 bg-gray-200 dark:bg-gray-700 rounded-t h-1/3" }),
1046
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 bg-gray-200 dark:bg-gray-700 rounded-t h-full" }),
1047
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 bg-gray-200 dark:bg-gray-700 rounded-t h-2/3" })
1048
+ ] })
1049
+ ] });
1050
+ case "image":
1051
+ return /* @__PURE__ */ jsx8("div", { className: cn("animate-pulse", className), children: /* @__PURE__ */ jsx8("div", { className: "aspect-video bg-gray-200 dark:bg-gray-700 rounded-lg" }) });
1052
+ case "gallery":
1053
+ return /* @__PURE__ */ jsx8("div", { className: cn("animate-pulse grid grid-cols-3 gap-2", className), children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx8("div", { className: "aspect-square bg-gray-200 dark:bg-gray-700 rounded-lg" }, i)) });
1054
+ case "map":
1055
+ return /* @__PURE__ */ jsx8("div", { className: cn("animate-pulse", className), children: /* @__PURE__ */ jsx8("div", { className: "h-48 bg-gray-200 dark:bg-gray-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsxs5("svg", { className: "w-8 h-8 text-gray-300 dark:text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1056
+ /* @__PURE__ */ jsx8("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" }),
1057
+ /* @__PURE__ */ jsx8("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z" })
1058
+ ] }) }) });
1059
+ case "table":
1060
+ return /* @__PURE__ */ jsxs5("div", { className: cn("animate-pulse rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden", className), children: [
1061
+ /* @__PURE__ */ jsxs5("div", { className: "flex bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: [
1062
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-300 dark:bg-gray-600 rounded w-16" }) }),
1063
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-300 dark:bg-gray-600 rounded w-20" }) }),
1064
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-300 dark:bg-gray-600 rounded w-14" }) })
1065
+ ] }),
1066
+ [1, 2, 3].map((i) => /* @__PURE__ */ jsxs5("div", { className: "flex border-b border-gray-200 dark:border-gray-700 last:border-b-0", children: [
1067
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-24" }) }),
1068
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-16" }) }),
1069
+ /* @__PURE__ */ jsx8("div", { className: "flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-20" }) })
1070
+ ] }, i))
1071
+ ] });
1072
+ default:
1073
+ return /* @__PURE__ */ jsxs5("div", { className: cn("animate-pulse rounded-lg border border-gray-200 dark:border-gray-700 p-4", className), children: [
1074
+ /* @__PURE__ */ jsx8("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2 mb-2" }),
1075
+ /* @__PURE__ */ jsx8("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-full" })
1076
+ ] });
1077
+ }
695
1078
  }
696
1079
 
697
1080
  // src/components/Chat/MarkdownContent.tsx
698
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1081
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
699
1082
  function parseInlineMarkdown(text, keyPrefix = "") {
700
1083
  const result = [];
701
1084
  const boldRegex = /(\*\*|__)(.+?)\1/g;
@@ -706,7 +1089,7 @@ function parseInlineMarkdown(text, keyPrefix = "") {
706
1089
  if (match.index > lastIndex) {
707
1090
  result.push(text.slice(lastIndex, match.index));
708
1091
  }
709
- result.push(/* @__PURE__ */ jsx7("strong", { children: match[2] }, `${keyPrefix}b${key++}`));
1092
+ result.push(/* @__PURE__ */ jsx9("strong", { children: match[2] }, `${keyPrefix}b${key++}`));
710
1093
  lastIndex = match.index + match[0].length;
711
1094
  }
712
1095
  if (lastIndex < text.length) {
@@ -724,7 +1107,7 @@ function parseMarkdown(content) {
724
1107
  const h2Match = line.match(/^##\s+(.*)$/);
725
1108
  if (h2Match) {
726
1109
  result.push(
727
- /* @__PURE__ */ jsx7("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
1110
+ /* @__PURE__ */ jsx9("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
728
1111
  );
729
1112
  i++;
730
1113
  continue;
@@ -732,7 +1115,7 @@ function parseMarkdown(content) {
732
1115
  const h3Match = line.match(/^###\s+(.*)$/);
733
1116
  if (h3Match) {
734
1117
  result.push(
735
- /* @__PURE__ */ jsx7("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
1118
+ /* @__PURE__ */ jsx9("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
736
1119
  );
737
1120
  i++;
738
1121
  continue;
@@ -745,7 +1128,7 @@ function parseMarkdown(content) {
745
1128
  const itemMatch = lines[i].match(/^(\s*)([-*+])\s+(.*)$/);
746
1129
  if (itemMatch && itemMatch[1].length === indent) {
747
1130
  listItems.push(
748
- /* @__PURE__ */ jsx7("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
1131
+ /* @__PURE__ */ jsx9("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
749
1132
  );
750
1133
  i++;
751
1134
  } else {
@@ -753,7 +1136,7 @@ function parseMarkdown(content) {
753
1136
  }
754
1137
  }
755
1138
  result.push(
756
- /* @__PURE__ */ jsx7("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
1139
+ /* @__PURE__ */ jsx9("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
757
1140
  );
758
1141
  continue;
759
1142
  }
@@ -765,7 +1148,7 @@ function parseMarkdown(content) {
765
1148
  const itemMatch = lines[i].match(/^(\s*)(\d+)\.\s+(.*)$/);
766
1149
  if (itemMatch && itemMatch[1].length === indent) {
767
1150
  listItems.push(
768
- /* @__PURE__ */ jsx7("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
1151
+ /* @__PURE__ */ jsx9("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
769
1152
  );
770
1153
  i++;
771
1154
  } else {
@@ -773,7 +1156,7 @@ function parseMarkdown(content) {
773
1156
  }
774
1157
  }
775
1158
  result.push(
776
- /* @__PURE__ */ jsx7("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
1159
+ /* @__PURE__ */ jsx9("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
777
1160
  );
778
1161
  continue;
779
1162
  }
@@ -796,19 +1179,19 @@ function parseMarkdown(content) {
796
1179
  }
797
1180
  }
798
1181
  result.push(
799
- /* @__PURE__ */ jsx7("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs4("table", { className: "apteva-md-table", children: [
800
- /* @__PURE__ */ jsx7("thead", { children: /* @__PURE__ */ jsx7("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx7("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
801
- /* @__PURE__ */ jsx7("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx7("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx7("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
1182
+ /* @__PURE__ */ jsx9("div", { className: "apteva-md-table-wrapper", children: /* @__PURE__ */ jsxs6("table", { className: "apteva-md-table", children: [
1183
+ /* @__PURE__ */ jsx9("thead", { children: /* @__PURE__ */ jsx9("tr", { children: headerCells.map((cell, idx) => /* @__PURE__ */ jsx9("th", { className: "apteva-md-th", children: parseInlineMarkdown(cell, `th${key}${idx}`) }, `th${idx}`)) }) }),
1184
+ /* @__PURE__ */ jsx9("tbody", { children: bodyRows.map((row, rowIdx) => /* @__PURE__ */ jsx9("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ jsx9("td", { className: "apteva-md-td", children: parseInlineMarkdown(cell, `td${key}${rowIdx}${cellIdx}`) }, `td${cellIdx}`)) }, `tr${rowIdx}`)) })
802
1185
  ] }) }, `table-wrapper${key++}`)
803
1186
  );
804
1187
  continue;
805
1188
  }
806
1189
  }
807
1190
  if (line === "") {
808
- result.push(/* @__PURE__ */ jsx7("br", {}, `br${key++}`));
1191
+ result.push(/* @__PURE__ */ jsx9("br", {}, `br${key++}`));
809
1192
  } else {
810
1193
  result.push(
811
- /* @__PURE__ */ jsxs4("span", { children: [
1194
+ /* @__PURE__ */ jsxs6("span", { children: [
812
1195
  parseInlineMarkdown(line, `${key}`),
813
1196
  i < lines.length - 1 ? "\n" : ""
814
1197
  ] }, `p${key++}`)
@@ -819,38 +1202,59 @@ function parseMarkdown(content) {
819
1202
  return result;
820
1203
  }
821
1204
  function MarkdownContent({ content, className = "" }) {
822
- return /* @__PURE__ */ jsx7("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
1205
+ return /* @__PURE__ */ jsx9("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
823
1206
  }
824
1207
 
825
1208
  // src/components/Chat/ToolCall.tsx
826
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1209
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
827
1210
  function ToolCall({ name, status }) {
828
- return /* @__PURE__ */ jsxs5("div", { className: "apteva-tool-call", children: [
829
- status === "running" && /* @__PURE__ */ jsx8("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-running" }),
830
- status === "completed" && /* @__PURE__ */ jsx8("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-completed" }),
831
- status === "error" && /* @__PURE__ */ jsx8("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-error" }),
832
- /* @__PURE__ */ jsx8("span", { className: "apteva-tool-call-name", children: name }),
833
- status === "running" && /* @__PURE__ */ jsx8("span", { className: "apteva-tool-call-status", children: "Running..." }),
834
- status === "completed" && /* @__PURE__ */ jsx8("span", { className: "apteva-tool-call-status apteva-tool-call-status-completed", children: "Completed" }),
835
- status === "error" && /* @__PURE__ */ jsx8("span", { className: "apteva-tool-call-status apteva-tool-call-status-error", children: "Error" })
1211
+ return /* @__PURE__ */ jsxs7("div", { className: "apteva-tool-call", children: [
1212
+ status === "running" && /* @__PURE__ */ jsx10("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-running" }),
1213
+ status === "completed" && /* @__PURE__ */ jsx10("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-completed" }),
1214
+ status === "error" && /* @__PURE__ */ jsx10("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-error" }),
1215
+ /* @__PURE__ */ jsx10("span", { className: "apteva-tool-call-name", children: name }),
1216
+ status === "running" && /* @__PURE__ */ jsx10("span", { className: "apteva-tool-call-status", children: "Running..." }),
1217
+ status === "completed" && /* @__PURE__ */ jsx10("span", { className: "apteva-tool-call-status apteva-tool-call-status-completed", children: "Completed" }),
1218
+ status === "error" && /* @__PURE__ */ jsx10("span", { className: "apteva-tool-call-status apteva-tool-call-status-error", children: "Error" })
836
1219
  ] });
837
1220
  }
838
1221
 
839
1222
  // src/components/Chat/Message.tsx
840
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
841
- function Message({ message, onAction }) {
1223
+ import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1224
+ function Message({ message, onAction, enableWidgets }) {
842
1225
  const isUser = message.role === "user";
843
1226
  const contentSegments = message.metadata?.content_segments;
1227
+ const renderTextContent = (text) => {
1228
+ if (!enableWidgets || isUser) {
1229
+ return /* @__PURE__ */ jsx11(MarkdownContent, { content: text });
1230
+ }
1231
+ const parsed = parseWidgetsFromText(text);
1232
+ if (parsed.segments.length === 0) {
1233
+ return null;
1234
+ }
1235
+ return /* @__PURE__ */ jsx11(Fragment, { children: parsed.segments.map((segment, index) => {
1236
+ if (segment.type === "text" && segment.content) {
1237
+ return /* @__PURE__ */ jsx11(MarkdownContent, { content: segment.content }, `text-${index}`);
1238
+ }
1239
+ if (segment.type === "widget" && segment.widget) {
1240
+ return /* @__PURE__ */ jsx11("div", { className: "my-3", children: /* @__PURE__ */ jsx11(WidgetRenderer, { widget: segment.widget, onAction }) }, `widget-${index}`);
1241
+ }
1242
+ if (segment.type === "widget_pending" && segment.pendingType) {
1243
+ return /* @__PURE__ */ jsx11("div", { className: "my-3", children: /* @__PURE__ */ jsx11(WidgetSkeleton, { type: segment.pendingType }) }, `pending-${index}`);
1244
+ }
1245
+ return null;
1246
+ }) });
1247
+ };
844
1248
  const renderContent = () => {
845
1249
  if (isUser) {
846
- return /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap !text-sm leading-relaxed", children: message.content });
1250
+ return /* @__PURE__ */ jsx11("div", { className: "whitespace-pre-wrap !text-sm leading-relaxed", children: message.content });
847
1251
  }
848
1252
  if (contentSegments && contentSegments.length > 0) {
849
- return /* @__PURE__ */ jsx9("div", { children: contentSegments.map((segment, index) => {
1253
+ return /* @__PURE__ */ jsx11("div", { children: contentSegments.map((segment, index) => {
850
1254
  if (segment.type === "text") {
851
- return segment.content ? /* @__PURE__ */ jsx9(MarkdownContent, { content: segment.content }, `text-${index}`) : null;
1255
+ return segment.content ? /* @__PURE__ */ jsx11("div", { children: renderTextContent(segment.content) }, `text-${index}`) : null;
852
1256
  } else if (segment.type === "tool") {
853
- return /* @__PURE__ */ jsx9("div", { className: "my-2", children: /* @__PURE__ */ jsx9(
1257
+ return /* @__PURE__ */ jsx11("div", { className: "my-2", children: /* @__PURE__ */ jsx11(
854
1258
  ToolCall,
855
1259
  {
856
1260
  name: segment.name,
@@ -861,9 +1265,9 @@ function Message({ message, onAction }) {
861
1265
  return null;
862
1266
  }) });
863
1267
  }
864
- return /* @__PURE__ */ jsx9(MarkdownContent, { content: message.content });
1268
+ return renderTextContent(message.content);
865
1269
  };
866
- return /* @__PURE__ */ jsxs6(
1270
+ return /* @__PURE__ */ jsxs8(
867
1271
  "div",
868
1272
  {
869
1273
  className: cn(
@@ -872,16 +1276,16 @@ function Message({ message, onAction }) {
872
1276
  ),
873
1277
  children: [
874
1278
  renderContent(),
875
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx9("div", { className: cn(isUser ? "mt-3" : "mt-2"), children: /* @__PURE__ */ jsx9(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
876
- /* @__PURE__ */ jsx9("div", { className: cn("!text-xs opacity-70", isUser ? "mt-1.5 !text-gray-500 dark:!text-gray-400" : "mt-1 !text-gray-500 dark:!text-gray-400"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
1279
+ message.widgets && message.widgets.length > 0 && /* @__PURE__ */ jsx11("div", { className: cn(isUser ? "mt-3" : "mt-2"), children: /* @__PURE__ */ jsx11(Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
1280
+ /* @__PURE__ */ jsx11("div", { className: cn("!text-xs opacity-70", isUser ? "mt-1.5 !text-gray-500 dark:!text-gray-400" : "mt-1 !text-gray-500 dark:!text-gray-400"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
877
1281
  ]
878
1282
  }
879
1283
  );
880
1284
  }
881
1285
 
882
1286
  // src/components/Chat/WelcomeScreen.tsx
883
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
884
- var DefaultIcon = () => /* @__PURE__ */ jsx10("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
1287
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1288
+ var DefaultIcon = () => /* @__PURE__ */ jsx12("svg", { className: "w-12 h-12 sm:w-16 sm:h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12(
885
1289
  "path",
886
1290
  {
887
1291
  strokeLinecap: "round",
@@ -890,7 +1294,7 @@ var DefaultIcon = () => /* @__PURE__ */ jsx10("svg", { className: "w-12 h-12 sm:
890
1294
  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"
891
1295
  }
892
1296
  ) });
893
- var ArrowIcon = () => /* @__PURE__ */ jsx10("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
1297
+ var ArrowIcon = () => /* @__PURE__ */ jsx12("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) });
894
1298
  function WelcomeScreen({
895
1299
  title,
896
1300
  subtitle,
@@ -905,18 +1309,18 @@ function WelcomeScreen({
905
1309
  const hasPrompts = normalizedPrompts.length > 0;
906
1310
  const hasHeader = title || subtitle || icon;
907
1311
  if (!hasHeader && !hasPrompts) {
908
- return /* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ jsxs7("div", { className: "text-center space-y-2", children: [
909
- /* @__PURE__ */ jsx10("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx10(DefaultIcon, {}) }),
910
- /* @__PURE__ */ jsx10("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
1312
+ return /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ jsxs9("div", { className: "text-center space-y-2", children: [
1313
+ /* @__PURE__ */ jsx12("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx12(DefaultIcon, {}) }),
1314
+ /* @__PURE__ */ jsx12("p", { className: "text-sm", children: "No messages yet. Start a conversation!" })
911
1315
  ] }) });
912
1316
  }
913
1317
  if (variant === "minimal") {
914
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col h-full px-4 py-4", children: [
915
- hasHeader && /* @__PURE__ */ jsxs7("div", { className: "mb-4", children: [
916
- title && /* @__PURE__ */ jsx10("h2", { className: "text-lg font-semibold !text-gray-900 dark:!text-white", children: title }),
917
- subtitle && /* @__PURE__ */ jsx10("p", { className: "text-sm !text-gray-500 dark:!text-gray-400 mt-1", children: subtitle })
1318
+ return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col h-full px-4 py-4", children: [
1319
+ hasHeader && /* @__PURE__ */ jsxs9("div", { className: "mb-4", children: [
1320
+ title && /* @__PURE__ */ jsx12("h2", { className: "text-lg font-semibold !text-gray-900 dark:!text-white", children: title }),
1321
+ subtitle && /* @__PURE__ */ jsx12("p", { className: "text-sm !text-gray-500 dark:!text-gray-400 mt-1", children: subtitle })
918
1322
  ] }),
919
- hasPrompts && /* @__PURE__ */ jsx10("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx10(
1323
+ hasPrompts && /* @__PURE__ */ jsx12("div", { className: "flex-1 space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx12(
920
1324
  "button",
921
1325
  {
922
1326
  onClick: () => onPromptClick(prompt.text),
@@ -929,11 +1333,11 @@ function WelcomeScreen({
929
1333
  "transition-all duration-200",
930
1334
  "group"
931
1335
  ),
932
- children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3", children: [
933
- /* @__PURE__ */ jsx10("div", { className: "flex-shrink-0 !text-gray-400 dark:!text-gray-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx10(ArrowIcon, {}) }),
934
- /* @__PURE__ */ jsxs7("div", { className: "flex-1 min-w-0", children: [
935
- /* @__PURE__ */ jsx10("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white truncate", children: prompt.text }),
936
- prompt.description && /* @__PURE__ */ jsx10("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-0.5 truncate", children: prompt.description })
1336
+ children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
1337
+ /* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 !text-gray-400 dark:!text-gray-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors", children: prompt.icon || /* @__PURE__ */ jsx12(ArrowIcon, {}) }),
1338
+ /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1339
+ /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white truncate", children: prompt.text }),
1340
+ prompt.description && /* @__PURE__ */ jsx12("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-0.5 truncate", children: prompt.description })
937
1341
  ] })
938
1342
  ] })
939
1343
  },
@@ -941,14 +1345,14 @@ function WelcomeScreen({
941
1345
  )) })
942
1346
  ] });
943
1347
  }
944
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
945
- /* @__PURE__ */ jsxs7("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
946
- /* @__PURE__ */ jsx10("div", { className: "mb-4 !text-gray-400 dark:!text-gray-500 flex justify-center", children: icon || /* @__PURE__ */ jsx10(DefaultIcon, {}) }),
947
- title && /* @__PURE__ */ jsx10("h1", { className: "text-xl sm:text-2xl font-semibold !text-gray-900 dark:!text-white mb-2", children: title }),
948
- subtitle && /* @__PURE__ */ jsx10("p", { className: "text-sm sm:text-base !text-gray-500 dark:!text-gray-400", children: subtitle })
1348
+ return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8", children: [
1349
+ /* @__PURE__ */ jsxs9("div", { className: "text-center mb-6 sm:mb-8 max-w-md", children: [
1350
+ /* @__PURE__ */ jsx12("div", { className: "mb-4 !text-gray-400 dark:!text-gray-500 flex justify-center", children: icon || /* @__PURE__ */ jsx12(DefaultIcon, {}) }),
1351
+ title && /* @__PURE__ */ jsx12("h1", { className: "text-xl sm:text-2xl font-semibold !text-gray-900 dark:!text-white mb-2", children: title }),
1352
+ subtitle && /* @__PURE__ */ jsx12("p", { className: "text-sm sm:text-base !text-gray-500 dark:!text-gray-400", children: subtitle })
949
1353
  ] }),
950
- hasPrompts && /* @__PURE__ */ jsxs7("div", { className: "w-full max-w-2xl", children: [
951
- /* @__PURE__ */ jsx10("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx10(
1354
+ hasPrompts && /* @__PURE__ */ jsxs9("div", { className: "w-full max-w-2xl", children: [
1355
+ /* @__PURE__ */ jsx12("div", { className: "sm:hidden space-y-2", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx12(
952
1356
  "button",
953
1357
  {
954
1358
  onClick: () => onPromptClick(prompt.text),
@@ -963,20 +1367,20 @@ function WelcomeScreen({
963
1367
  "shadow-sm hover:shadow",
964
1368
  "group"
965
1369
  ),
966
- children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3", children: [
967
- /* @__PURE__ */ jsx10("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center !text-gray-500 dark:!text-gray-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__ */ jsx10(ArrowIcon, {}) }),
968
- /* @__PURE__ */ jsxs7("div", { className: "flex-1 min-w-0", children: [
969
- /* @__PURE__ */ jsx10("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white", children: prompt.text }),
970
- prompt.description && /* @__PURE__ */ jsx10("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-0.5 line-clamp-1", children: prompt.description })
1370
+ children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
1371
+ /* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 w-8 h-8 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center !text-gray-500 dark:!text-gray-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__ */ jsx12(ArrowIcon, {}) }),
1372
+ /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1373
+ /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white", children: prompt.text }),
1374
+ prompt.description && /* @__PURE__ */ jsx12("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-0.5 line-clamp-1", children: prompt.description })
971
1375
  ] }),
972
- /* @__PURE__ */ jsx10(
1376
+ /* @__PURE__ */ jsx12(
973
1377
  "svg",
974
1378
  {
975
1379
  className: "w-4 h-4 !text-gray-400 group-hover:!text-blue-500 transition-colors flex-shrink-0",
976
1380
  fill: "none",
977
1381
  stroke: "currentColor",
978
1382
  viewBox: "0 0 24 24",
979
- children: /* @__PURE__ */ jsx10(
1383
+ children: /* @__PURE__ */ jsx12(
980
1384
  "path",
981
1385
  {
982
1386
  strokeLinecap: "round",
@@ -991,7 +1395,7 @@ function WelcomeScreen({
991
1395
  },
992
1396
  index
993
1397
  )) }),
994
- /* @__PURE__ */ jsx10("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx10(
1398
+ /* @__PURE__ */ jsx12("div", { className: "hidden sm:grid sm:grid-cols-2 gap-3", children: normalizedPrompts.map((prompt, index) => /* @__PURE__ */ jsx12(
995
1399
  "button",
996
1400
  {
997
1401
  onClick: () => onPromptClick(prompt.text),
@@ -1006,11 +1410,11 @@ function WelcomeScreen({
1006
1410
  "transition-all duration-200",
1007
1411
  "group"
1008
1412
  ),
1009
- children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-3", children: [
1010
- /* @__PURE__ */ jsx10("div", { className: "flex-shrink-0 w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center !text-gray-500 dark:!text-gray-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__ */ jsx10(ArrowIcon, {}) }),
1011
- /* @__PURE__ */ jsxs7("div", { className: "flex-1 min-w-0", children: [
1012
- /* @__PURE__ */ jsx10("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white leading-snug", children: prompt.text }),
1013
- prompt.description && /* @__PURE__ */ jsx10("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-1 line-clamp-2", children: prompt.description })
1413
+ children: /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-3", children: [
1414
+ /* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 w-9 h-9 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center !text-gray-500 dark:!text-gray-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__ */ jsx12(ArrowIcon, {}) }),
1415
+ /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1416
+ /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium !text-gray-900 dark:!text-white leading-snug", children: prompt.text }),
1417
+ prompt.description && /* @__PURE__ */ jsx12("p", { className: "text-xs !text-gray-500 dark:!text-gray-400 mt-1 line-clamp-2", children: prompt.description })
1014
1418
  ] })
1015
1419
  ] })
1016
1420
  },
@@ -1021,7 +1425,7 @@ function WelcomeScreen({
1021
1425
  }
1022
1426
 
1023
1427
  // src/components/Chat/MessageList.tsx
1024
- import { jsx as jsx11 } from "react/jsx-runtime";
1428
+ import { jsx as jsx13 } from "react/jsx-runtime";
1025
1429
  function MessageList({
1026
1430
  messages,
1027
1431
  onAction,
@@ -1030,7 +1434,8 @@ function MessageList({
1030
1434
  welcomeIcon,
1031
1435
  suggestedPrompts,
1032
1436
  welcomeVariant,
1033
- onPromptClick
1437
+ onPromptClick,
1438
+ enableWidgets
1034
1439
  }) {
1035
1440
  const listRef = useRef(null);
1036
1441
  useEffect2(() => {
@@ -1038,7 +1443,7 @@ function MessageList({
1038
1443
  listRef.current.scrollTop = listRef.current.scrollHeight;
1039
1444
  }
1040
1445
  }, [messages]);
1041
- return /* @__PURE__ */ jsx11("div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3 apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ jsx11(
1446
+ return /* @__PURE__ */ jsx13("div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3 apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ jsx13(
1042
1447
  WelcomeScreen,
1043
1448
  {
1044
1449
  title: welcomeTitle,
@@ -1049,13 +1454,13 @@ function MessageList({
1049
1454
  onPromptClick: onPromptClick || (() => {
1050
1455
  })
1051
1456
  }
1052
- ) : messages.map((message) => /* @__PURE__ */ jsx11(Message, { message, onAction }, message.id)) });
1457
+ ) : messages.map((message) => /* @__PURE__ */ jsx13(Message, { message, onAction, enableWidgets }, message.id)) });
1053
1458
  }
1054
1459
 
1055
1460
  // src/components/Chat/Composer.tsx
1056
1461
  import { useState, useRef as useRef2 } from "react";
1057
- import { Fragment, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1058
- function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, onFileUpload, onSwitchMode }) {
1462
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1463
+ function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, isLoading = false, onStop, onFileUpload, onSwitchMode }) {
1059
1464
  const [text, setText] = useState("");
1060
1465
  const [showMenu, setShowMenu] = useState(false);
1061
1466
  const [pendingFiles, setPendingFiles] = useState([]);
@@ -1128,56 +1533,56 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1128
1533
  };
1129
1534
  const getFileIcon = (mimeType) => {
1130
1535
  if (mimeType.startsWith("image/")) {
1131
- return /* @__PURE__ */ jsx12("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("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" }) });
1536
+ return /* @__PURE__ */ jsx14("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("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" }) });
1132
1537
  }
1133
1538
  if (mimeType === "application/pdf") {
1134
- return /* @__PURE__ */ jsx12("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("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" }) });
1539
+ return /* @__PURE__ */ jsx14("svg", { className: "w-4 h-4", 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" }) });
1135
1540
  }
1136
- return /* @__PURE__ */ jsx12("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("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" }) });
1541
+ return /* @__PURE__ */ jsx14("svg", { className: "w-4 h-4", 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" }) });
1137
1542
  };
1138
- return /* @__PURE__ */ jsxs8("div", { className: "px-4 py-3 relative", children: [
1139
- fileError && /* @__PURE__ */ jsx12("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__ */ jsxs8("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-sm", children: [
1140
- /* @__PURE__ */ jsx12("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
1141
- /* @__PURE__ */ jsx12("span", { children: fileError })
1543
+ return /* @__PURE__ */ jsxs10("div", { className: "px-4 py-3 relative", children: [
1544
+ fileError && /* @__PURE__ */ jsx14("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__ */ jsxs10("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-sm", children: [
1545
+ /* @__PURE__ */ jsx14("svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
1546
+ /* @__PURE__ */ jsx14("span", { children: fileError })
1142
1547
  ] }) }),
1143
- pendingFiles.length > 0 && /* @__PURE__ */ jsx12("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs8(
1548
+ pendingFiles.length > 0 && /* @__PURE__ */ jsx14("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs10(
1144
1549
  "div",
1145
1550
  {
1146
1551
  className: "relative group flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",
1147
1552
  children: [
1148
- pf.preview ? /* @__PURE__ */ jsx12("img", { src: pf.preview, alt: pf.file.name, className: "w-8 h-8 object-cover rounded" }) : /* @__PURE__ */ jsx12("div", { className: "w-8 h-8 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1149
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-col min-w-0", children: [
1150
- /* @__PURE__ */ jsx12("span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[120px]", children: pf.file.name }),
1151
- /* @__PURE__ */ jsx12("span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: formatFileSize(pf.file.size) })
1553
+ pf.preview ? /* @__PURE__ */ jsx14("img", { src: pf.preview, alt: pf.file.name, className: "w-8 h-8 object-cover rounded" }) : /* @__PURE__ */ jsx14("div", { className: "w-8 h-8 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1554
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col min-w-0", children: [
1555
+ /* @__PURE__ */ jsx14("span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[120px]", children: pf.file.name }),
1556
+ /* @__PURE__ */ jsx14("span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: formatFileSize(pf.file.size) })
1152
1557
  ] }),
1153
- /* @__PURE__ */ jsx12(
1558
+ /* @__PURE__ */ jsx14(
1154
1559
  "button",
1155
1560
  {
1156
1561
  onClick: () => removeFile(index),
1157
1562
  className: "absolute -top-1.5 -right-1.5 w-5 h-5 bg-gray-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
1158
1563
  title: "Remove file",
1159
- children: /* @__PURE__ */ jsx12("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1564
+ children: /* @__PURE__ */ jsx14("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1160
1565
  }
1161
1566
  )
1162
1567
  ]
1163
1568
  },
1164
1569
  index
1165
1570
  )) }),
1166
- /* @__PURE__ */ jsxs8("div", { className: "apteva-composer relative border-2 border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
1167
- /* @__PURE__ */ jsxs8("div", { className: "relative flex-shrink-0", children: [
1168
- /* @__PURE__ */ jsx12(
1571
+ /* @__PURE__ */ jsxs10("div", { className: "apteva-composer relative border-2 border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
1572
+ /* @__PURE__ */ jsxs10("div", { className: "relative flex-shrink-0", children: [
1573
+ /* @__PURE__ */ jsx14(
1169
1574
  "button",
1170
1575
  {
1171
1576
  ref: menuButtonRef,
1172
1577
  onClick: () => setShowMenu(!showMenu),
1173
1578
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-700 dark:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",
1174
1579
  title: "More options",
1175
- children: /* @__PURE__ */ jsx12("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1580
+ children: /* @__PURE__ */ jsx14("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1176
1581
  }
1177
1582
  ),
1178
- showMenu && /* @__PURE__ */ jsxs8(Fragment, { children: [
1179
- /* @__PURE__ */ jsx12("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1180
- /* @__PURE__ */ jsxs8(
1583
+ showMenu && /* @__PURE__ */ jsxs10(Fragment2, { children: [
1584
+ /* @__PURE__ */ jsx14("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1585
+ /* @__PURE__ */ jsxs10(
1181
1586
  "div",
1182
1587
  {
1183
1588
  className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -1186,7 +1591,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1186
1591
  top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
1187
1592
  },
1188
1593
  children: [
1189
- /* @__PURE__ */ jsxs8(
1594
+ /* @__PURE__ */ jsxs10(
1190
1595
  "button",
1191
1596
  {
1192
1597
  onClick: () => {
@@ -1195,12 +1600,12 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1195
1600
  },
1196
1601
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
1197
1602
  children: [
1198
- /* @__PURE__ */ jsx12("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("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)" }) }),
1199
- /* @__PURE__ */ jsx12("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1603
+ /* @__PURE__ */ jsx14("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("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)" }) }),
1604
+ /* @__PURE__ */ jsx14("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1200
1605
  ]
1201
1606
  }
1202
1607
  ),
1203
- onSwitchMode && /* @__PURE__ */ jsxs8(
1608
+ onSwitchMode && /* @__PURE__ */ jsxs10(
1204
1609
  "button",
1205
1610
  {
1206
1611
  onClick: () => {
@@ -1209,8 +1614,8 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1209
1614
  },
1210
1615
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
1211
1616
  children: [
1212
- /* @__PURE__ */ jsx12("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1213
- /* @__PURE__ */ jsx12("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1617
+ /* @__PURE__ */ jsx14("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
1618
+ /* @__PURE__ */ jsx14("span", { className: "!text-sm font-medium", children: "Switch to command mode" })
1214
1619
  ]
1215
1620
  }
1216
1621
  )
@@ -1219,7 +1624,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1219
1624
  )
1220
1625
  ] })
1221
1626
  ] }),
1222
- /* @__PURE__ */ jsx12(
1627
+ /* @__PURE__ */ jsx14(
1223
1628
  "textarea",
1224
1629
  {
1225
1630
  ref: textareaRef,
@@ -1233,18 +1638,26 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1233
1638
  style: { maxHeight: "120px" }
1234
1639
  }
1235
1640
  ),
1236
- /* @__PURE__ */ jsx12(
1641
+ isLoading && onStop ? /* @__PURE__ */ jsx14(
1642
+ "button",
1643
+ {
1644
+ onClick: onStop,
1645
+ className: "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-red-400 dark:border-red-500 bg-red-50 dark:bg-red-900/30 !text-red-600 dark:!text-red-400 hover:bg-red-100 dark:hover:bg-red-900/50",
1646
+ title: "Stop generation",
1647
+ children: /* @__PURE__ */ jsx14("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
1648
+ }
1649
+ ) : /* @__PURE__ */ jsx14(
1237
1650
  "button",
1238
1651
  {
1239
1652
  onClick: handleSend,
1240
1653
  disabled: !text.trim() && pendingFiles.length === 0 || disabled,
1241
1654
  className: "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 !text-gray-700 dark:!text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",
1242
1655
  title: "Send message",
1243
- children: /* @__PURE__ */ jsx12("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1656
+ children: /* @__PURE__ */ jsx14("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx14("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1244
1657
  }
1245
1658
  )
1246
1659
  ] }),
1247
- /* @__PURE__ */ jsx12(
1660
+ /* @__PURE__ */ jsx14(
1248
1661
  "input",
1249
1662
  {
1250
1663
  ref: fileInputRef,
@@ -1260,7 +1673,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1260
1673
 
1261
1674
  // src/components/Chat/CommandComposer.tsx
1262
1675
  import { useState as useState2, useRef as useRef3 } from "react";
1263
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1676
+ import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1264
1677
  function CommandComposer({
1265
1678
  onExecute,
1266
1679
  state,
@@ -1272,6 +1685,7 @@ function CommandComposer({
1272
1685
  onApprove,
1273
1686
  onReject,
1274
1687
  onReset,
1688
+ onStop,
1275
1689
  onExpand,
1276
1690
  placeholder = "Enter your command...",
1277
1691
  disabled = false
@@ -1349,12 +1763,12 @@ function CommandComposer({
1349
1763
  };
1350
1764
  const getFileIcon = (mimeType) => {
1351
1765
  if (mimeType.startsWith("image/")) {
1352
- return /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" }) });
1766
+ return /* @__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: "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" }) });
1353
1767
  }
1354
1768
  if (mimeType === "application/pdf") {
1355
- return /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" }) });
1769
+ return /* @__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: "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" }) });
1356
1770
  }
1357
- return /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" }) });
1771
+ return /* @__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: "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" }) });
1358
1772
  };
1359
1773
  const getDisplayContent = () => {
1360
1774
  if (state === "loading") {
@@ -1379,32 +1793,12 @@ function CommandComposer({
1379
1793
  };
1380
1794
  const isShowingResult = state !== "idle";
1381
1795
  const { text: displayContent, isToolCall } = getDisplayContent();
1382
- return /* @__PURE__ */ jsxs9("div", { className: "w-full relative", children: [
1383
- fileError && /* @__PURE__ */ jsx13("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__ */ jsxs9("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-xs", children: [
1384
- /* @__PURE__ */ jsx13("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
1385
- /* @__PURE__ */ jsx13("span", { children: fileError })
1796
+ return /* @__PURE__ */ jsxs11("div", { className: "w-full relative", children: [
1797
+ fileError && /* @__PURE__ */ jsx15("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__ */ jsxs11("div", { className: "flex items-center gap-2 !text-red-700 dark:!text-red-300 text-xs", children: [
1798
+ /* @__PURE__ */ jsx15("svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
1799
+ /* @__PURE__ */ jsx15("span", { children: fileError })
1386
1800
  ] }) }),
1387
- pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx13("div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs9(
1388
- "div",
1389
- {
1390
- className: "relative group flex items-center gap-2 px-2 py-1.5 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",
1391
- children: [
1392
- pf.preview ? /* @__PURE__ */ jsx13("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover rounded" }) : /* @__PURE__ */ jsx13("div", { className: "w-6 h-6 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1393
- /* @__PURE__ */ jsx13("span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[100px]", children: pf.file.name }),
1394
- /* @__PURE__ */ jsx13(
1395
- "button",
1396
- {
1397
- onClick: () => removeFile(index),
1398
- className: "w-4 h-4 bg-gray-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center",
1399
- title: "Remove file",
1400
- children: /* @__PURE__ */ jsx13("svg", { className: "w-2.5 h-2.5", 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" }) })
1401
- }
1402
- )
1403
- ]
1404
- },
1405
- index
1406
- )) }),
1407
- /* @__PURE__ */ jsxs9(
1801
+ /* @__PURE__ */ jsxs11(
1408
1802
  "div",
1409
1803
  {
1410
1804
  className: cn(
@@ -1416,21 +1810,21 @@ function CommandComposer({
1416
1810
  state === "error" && "border-red-400 dark:border-red-500"
1417
1811
  ),
1418
1812
  children: [
1419
- /* @__PURE__ */ jsxs9("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
1420
- state === "idle" && /* @__PURE__ */ jsxs9("div", { className: "relative", children: [
1421
- /* @__PURE__ */ jsx13(
1813
+ /* @__PURE__ */ jsxs11("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
1814
+ state === "idle" && /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
1815
+ /* @__PURE__ */ jsx15(
1422
1816
  "button",
1423
1817
  {
1424
1818
  ref: menuButtonRef,
1425
1819
  onClick: () => setShowMenu(!showMenu),
1426
1820
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-500 dark:!text-gray-400 hover:!text-gray-700 dark:hover:!text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",
1427
1821
  title: "More options",
1428
- children: /* @__PURE__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1822
+ children: /* @__PURE__ */ jsx15("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
1429
1823
  }
1430
1824
  ),
1431
- showMenu && /* @__PURE__ */ jsxs9(Fragment2, { children: [
1432
- /* @__PURE__ */ jsx13("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1433
- /* @__PURE__ */ jsxs9(
1825
+ showMenu && /* @__PURE__ */ jsxs11(Fragment3, { children: [
1826
+ /* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
1827
+ /* @__PURE__ */ jsxs11(
1434
1828
  "div",
1435
1829
  {
1436
1830
  className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
@@ -1439,7 +1833,7 @@ function CommandComposer({
1439
1833
  top: (menuButtonRef.current?.getBoundingClientRect().bottom ?? 0) + 8
1440
1834
  },
1441
1835
  children: [
1442
- /* @__PURE__ */ jsxs9(
1836
+ /* @__PURE__ */ jsxs11(
1443
1837
  "button",
1444
1838
  {
1445
1839
  onClick: () => {
@@ -1448,12 +1842,12 @@ function CommandComposer({
1448
1842
  },
1449
1843
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
1450
1844
  children: [
1451
- /* @__PURE__ */ jsx13("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13("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)" }) }),
1452
- /* @__PURE__ */ jsx13("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1845
+ /* @__PURE__ */ jsx15("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("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)" }) }),
1846
+ /* @__PURE__ */ jsx15("span", { className: "!text-sm font-medium", children: "Add photos & files" })
1453
1847
  ]
1454
1848
  }
1455
1849
  ),
1456
- onExpand && /* @__PURE__ */ jsxs9(
1850
+ onExpand && /* @__PURE__ */ jsxs11(
1457
1851
  "button",
1458
1852
  {
1459
1853
  onClick: () => {
@@ -1462,8 +1856,8 @@ function CommandComposer({
1462
1856
  },
1463
1857
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
1464
1858
  children: [
1465
- /* @__PURE__ */ jsx13("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("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" }) }),
1466
- /* @__PURE__ */ jsx13("span", { className: "!text-sm font-medium", children: "Expand to chat" })
1859
+ /* @__PURE__ */ jsx15("svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("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" }) }),
1860
+ /* @__PURE__ */ jsx15("span", { className: "!text-sm font-medium", children: "Expand to chat" })
1467
1861
  ]
1468
1862
  }
1469
1863
  )
@@ -1472,17 +1866,37 @@ function CommandComposer({
1472
1866
  )
1473
1867
  ] })
1474
1868
  ] }),
1475
- state === "loading" && !toolName && /* @__PURE__ */ jsx13("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
1476
- state === "loading" && toolName && /* @__PURE__ */ jsx13("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
1869
+ state === "loading" && !toolName && /* @__PURE__ */ jsx15("div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
1870
+ state === "loading" && toolName && /* @__PURE__ */ jsx15("div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
1477
1871
  ] }),
1478
- state === "idle" ? /* @__PURE__ */ jsx13(
1872
+ pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ jsx15("div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ jsxs11(
1873
+ "div",
1874
+ {
1875
+ className: "relative group flex items-center justify-center w-6 h-6 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",
1876
+ title: pf.file.name,
1877
+ children: [
1878
+ pf.preview ? /* @__PURE__ */ jsx15("img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ jsx15("span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
1879
+ /* @__PURE__ */ jsx15(
1880
+ "button",
1881
+ {
1882
+ onClick: () => removeFile(index),
1883
+ className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
1884
+ title: "Remove",
1885
+ children: /* @__PURE__ */ jsx15("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1886
+ }
1887
+ )
1888
+ ]
1889
+ },
1890
+ index
1891
+ )) }),
1892
+ state === "idle" ? /* @__PURE__ */ jsx15(
1479
1893
  "textarea",
1480
1894
  {
1481
1895
  ref: inputRef,
1482
1896
  value: input,
1483
1897
  onChange: (e) => handleInputChange(e.target.value),
1484
1898
  onKeyDown: handleKeyDown,
1485
- placeholder,
1899
+ placeholder: pendingFiles.length > 0 ? "Add a message..." : placeholder,
1486
1900
  disabled,
1487
1901
  rows: 1,
1488
1902
  className: cn(
@@ -1493,7 +1907,7 @@ function CommandComposer({
1493
1907
  ),
1494
1908
  style: { minHeight: "24px", maxHeight: "120px" }
1495
1909
  }
1496
- ) : /* @__PURE__ */ jsx13(
1910
+ ) : /* @__PURE__ */ jsx15(
1497
1911
  "div",
1498
1912
  {
1499
1913
  className: cn(
@@ -1504,14 +1918,14 @@ function CommandComposer({
1504
1918
  state === "error" && "!text-red-600 dark:!text-red-400",
1505
1919
  state === "plan-pending" && "!text-amber-700 dark:!text-amber-300"
1506
1920
  ),
1507
- children: isToolCall ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
1508
- /* @__PURE__ */ jsx13("span", { className: "font-mono", children: displayContent }),
1509
- /* @__PURE__ */ jsx13("span", { className: "text-gray-400 dark:text-gray-500", children: "Running..." })
1921
+ children: isToolCall ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
1922
+ /* @__PURE__ */ jsx15("span", { className: "font-mono", children: displayContent }),
1923
+ /* @__PURE__ */ jsx15("span", { className: "text-gray-400 dark:text-gray-500", children: "Running..." })
1510
1924
  ] }) : displayContent
1511
1925
  }
1512
1926
  ),
1513
- /* @__PURE__ */ jsx13("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1514
- /* @__PURE__ */ jsx13(
1927
+ /* @__PURE__ */ jsx15("div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
1928
+ /* @__PURE__ */ jsx15(
1515
1929
  "button",
1516
1930
  {
1517
1931
  onClick: onApprove,
@@ -1519,7 +1933,7 @@ function CommandComposer({
1519
1933
  children: "Approve"
1520
1934
  }
1521
1935
  ),
1522
- /* @__PURE__ */ jsx13(
1936
+ /* @__PURE__ */ jsx15(
1523
1937
  "button",
1524
1938
  {
1525
1939
  onClick: onReject,
@@ -1527,17 +1941,26 @@ function CommandComposer({
1527
1941
  children: "Modify"
1528
1942
  }
1529
1943
  )
1530
- ] }) : /* @__PURE__ */ jsxs9(Fragment2, { children: [
1531
- (state === "success" || state === "error") && /* @__PURE__ */ jsx13(
1944
+ ] }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
1945
+ state === "loading" && onStop && /* @__PURE__ */ jsx15(
1946
+ "button",
1947
+ {
1948
+ onClick: onStop,
1949
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all border border-red-400 dark:border-red-500 bg-red-50 dark:bg-red-900/30 !text-red-600 dark:!text-red-400 hover:bg-red-100 dark:hover:bg-red-900/50",
1950
+ title: "Stop generation",
1951
+ children: /* @__PURE__ */ jsx15("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx15("rect", { x: "2", y: "2", width: "10", height: "10", rx: "1", fill: "currentColor" }) })
1952
+ }
1953
+ ),
1954
+ (state === "success" || state === "error") && /* @__PURE__ */ jsx15(
1532
1955
  "button",
1533
1956
  {
1534
1957
  onClick: handleNewCommand,
1535
1958
  className: "w-8 h-8 rounded-lg flex items-center justify-center !text-gray-400 hover:!text-gray-600 dark:hover:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",
1536
1959
  title: "New command",
1537
- children: /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", 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" }) })
1960
+ children: /* @__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: "M6 18L18 6M6 6l12 12" }) })
1538
1961
  }
1539
1962
  ),
1540
- state === "idle" && /* @__PURE__ */ jsx13(
1963
+ state === "idle" && /* @__PURE__ */ jsx15(
1541
1964
  "button",
1542
1965
  {
1543
1966
  onClick: handleSubmit,
@@ -1549,14 +1972,14 @@ function CommandComposer({
1549
1972
  input.trim() || pendingFiles.length > 0 ? "bg-gray-900 dark:bg-white !text-white dark:!text-gray-900 border-gray-900 dark:border-white" : "bg-white dark:bg-gray-800 !text-gray-400"
1550
1973
  ),
1551
1974
  title: "Execute command",
1552
- children: /* @__PURE__ */ jsx13("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx13("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
1975
+ children: /* @__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: "M5 12h14M12 5l7 7-7 7" }) })
1553
1976
  }
1554
1977
  )
1555
1978
  ] }) })
1556
1979
  ]
1557
1980
  }
1558
1981
  ),
1559
- /* @__PURE__ */ jsx13(
1982
+ /* @__PURE__ */ jsx15(
1560
1983
  "input",
1561
1984
  {
1562
1985
  ref: fileInputRef,
@@ -1731,11 +2154,32 @@ var AptevaClient = class {
1731
2154
  const data = await response.json();
1732
2155
  return data.messages;
1733
2156
  }
2157
+ /**
2158
+ * Cancel an in-progress request
2159
+ */
2160
+ async cancelRequest(agentId, requestId) {
2161
+ try {
2162
+ const response = await fetch(`${this.config.apiUrl}/agents/${agentId}/requests/${requestId}/cancel`, {
2163
+ method: "POST",
2164
+ headers: {
2165
+ "Content-Type": "application/json",
2166
+ "X-API-Key": this.config.apiKey
2167
+ }
2168
+ });
2169
+ if (!response.ok) {
2170
+ const error = await response.json().catch(() => ({ error: "Cancel request failed" }));
2171
+ throw new Error(error.error || `Cancel request failed with status ${response.status}`);
2172
+ }
2173
+ } catch (error) {
2174
+ console.error("[AptevaClient] Cancel request error:", error);
2175
+ throw error;
2176
+ }
2177
+ }
1734
2178
  };
1735
2179
  var aptevaClient = new AptevaClient();
1736
2180
 
1737
2181
  // src/components/Chat/Chat.tsx
1738
- import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
2182
+ import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1739
2183
  function Chat({
1740
2184
  agentId,
1741
2185
  threadId,
@@ -1768,10 +2212,16 @@ function Chat({
1768
2212
  onFileUpload,
1769
2213
  onComplete,
1770
2214
  onError,
2215
+ onToolResult,
1771
2216
  // UI
1772
2217
  placeholder,
1773
2218
  showHeader = true,
1774
2219
  headerTitle = "Chat",
2220
+ // Widget detection
2221
+ enableWidgets = false,
2222
+ availableWidgets,
2223
+ compactWidgetContext = false,
2224
+ onWidgetRender,
1775
2225
  className
1776
2226
  }) {
1777
2227
  const [messages, setMessages] = useState3(initialMessages);
@@ -1785,11 +2235,18 @@ function Chat({
1785
2235
  const [commandInput, setCommandInput] = useState3("");
1786
2236
  const [streamedContent, setStreamedContent] = useState3("");
1787
2237
  const [currentToolName, setCurrentToolName] = useState3(null);
2238
+ const [currentRequestId, setCurrentRequestId] = useState3(null);
1788
2239
  const [plan, setPlan] = useState3("");
1789
2240
  const [pendingCommand, setPendingCommand] = useState3("");
1790
2241
  const [internalPlanMode, setInternalPlanMode] = useState3(planMode);
1791
2242
  const [showSettingsMenu, setShowSettingsMenu] = useState3(false);
1792
2243
  const fileInputRef = useRef4(null);
2244
+ const effectiveContext = useMemo(() => {
2245
+ if (!enableWidgets) return context;
2246
+ const widgetContext = compactWidgetContext ? generateCompactWidgetContext(availableWidgets) : generateWidgetContext(availableWidgets);
2247
+ return context ? `${context}
2248
+ ${widgetContext}` : widgetContext;
2249
+ }, [context, enableWidgets, availableWidgets, compactWidgetContext]);
1793
2250
  useEffect3(() => {
1794
2251
  if (apiUrl || apiKey) {
1795
2252
  aptevaClient.configure({
@@ -1894,7 +2351,7 @@ function Chat({
1894
2351
  message: messagePayload,
1895
2352
  stream: true,
1896
2353
  ...currentThreadId && { thread_id: currentThreadId },
1897
- ...context && { system: context }
2354
+ ...effectiveContext && { system: effectiveContext }
1898
2355
  },
1899
2356
  (chunk) => {
1900
2357
  switch (chunk.type) {
@@ -1907,6 +2364,11 @@ function Chat({
1907
2364
  }
1908
2365
  }
1909
2366
  break;
2367
+ case "request_id":
2368
+ if (chunk.request_id) {
2369
+ setCurrentRequestId(chunk.request_id);
2370
+ }
2371
+ break;
1910
2372
  case "content":
1911
2373
  case "token":
1912
2374
  if (chunk.content) {
@@ -1935,6 +2397,7 @@ function Chat({
1935
2397
  const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
1936
2398
  if (toolSegment) {
1937
2399
  toolSegment.result = chunk.content;
2400
+ onToolResult?.(toolSegment.name, chunk.content);
1938
2401
  }
1939
2402
  updateMessage();
1940
2403
  }
@@ -1979,6 +2442,7 @@ function Chat({
1979
2442
  onThreadChange?.(threadId2);
1980
2443
  }
1981
2444
  setIsLoading(false);
2445
+ setCurrentRequestId(null);
1982
2446
  },
1983
2447
  (error) => {
1984
2448
  const errorMessage = {
@@ -1996,6 +2460,7 @@ function Chat({
1996
2460
  return [...prev, errorMessage];
1997
2461
  });
1998
2462
  setIsLoading(false);
2463
+ setCurrentRequestId(null);
1999
2464
  onError?.(error);
2000
2465
  }
2001
2466
  );
@@ -2038,7 +2503,7 @@ function Chat({
2038
2503
  } else {
2039
2504
  try {
2040
2505
  const planningInstruction = `CRITICAL PLANNING MODE: You are ONLY creating a plan. Write a numbered list of steps describing what WOULD be done. DO NOT execute anything.`;
2041
- const systemMessage = context ? `${context}
2506
+ const systemMessage = effectiveContext ? `${effectiveContext}
2042
2507
 
2043
2508
  ${planningInstruction}` : planningInstruction;
2044
2509
  const response = await aptevaClient.chat({
@@ -2109,12 +2574,13 @@ ${planningInstruction}` : planningInstruction;
2109
2574
  }
2110
2575
  } else {
2111
2576
  const commandInstruction = `CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`;
2112
- const systemMessage = context ? `${context}
2577
+ const systemMessage = effectiveContext ? `${effectiveContext}
2113
2578
 
2114
2579
  ${commandInstruction}` : commandInstruction;
2115
2580
  const messagePayload = files && files.length > 0 ? await buildMessageWithAttachments(currentCommand, files) : currentCommand;
2116
2581
  if (enableStreaming) {
2117
2582
  let accumulatedContent = "";
2583
+ let lastToolName = "";
2118
2584
  await aptevaClient.chatStream(
2119
2585
  {
2120
2586
  agent_id: agentId,
@@ -2131,16 +2597,20 @@ ${commandInstruction}` : commandInstruction;
2131
2597
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
2132
2598
  setProgress(estimatedProgress);
2133
2599
  } else if (chunk.type === "tool_call" && chunk.tool_name) {
2600
+ lastToolName = chunk.tool_name;
2134
2601
  setCurrentToolName(chunk.tool_name);
2135
2602
  accumulatedContent = "";
2136
2603
  setStreamedContent("");
2137
2604
  } else if (chunk.type === "tool_result") {
2605
+ onToolResult?.(lastToolName, chunk.content);
2138
2606
  setCurrentToolName(null);
2139
2607
  } else if (chunk.type === "thread_id" && chunk.thread_id) {
2140
2608
  if (!currentThreadId) {
2141
2609
  setCurrentThreadId(chunk.thread_id);
2142
2610
  onThreadChange?.(chunk.thread_id);
2143
2611
  }
2612
+ } else if (chunk.type === "request_id" && chunk.request_id) {
2613
+ setCurrentRequestId(chunk.request_id);
2144
2614
  }
2145
2615
  },
2146
2616
  (threadId2) => {
@@ -2152,11 +2622,13 @@ ${commandInstruction}` : commandInstruction;
2152
2622
  setCommandResult(result);
2153
2623
  setCommandState("success");
2154
2624
  setProgress(100);
2625
+ setCurrentRequestId(null);
2155
2626
  onComplete?.(result);
2156
2627
  },
2157
2628
  (error) => {
2158
2629
  setCommandError(error);
2159
2630
  setCommandState("error");
2631
+ setCurrentRequestId(null);
2160
2632
  onError?.(error);
2161
2633
  }
2162
2634
  );
@@ -2213,11 +2685,28 @@ ${planToExecute}`;
2213
2685
  setPendingCommand("");
2214
2686
  setCommandState("idle");
2215
2687
  };
2688
+ const handleStop = async () => {
2689
+ if (currentRequestId && agentId) {
2690
+ try {
2691
+ await aptevaClient.cancelRequest(agentId, currentRequestId);
2692
+ } catch (error) {
2693
+ console.error("Failed to cancel request:", error);
2694
+ }
2695
+ }
2696
+ setIsLoading(false);
2697
+ if (commandState === "loading") {
2698
+ setCommandState("idle");
2699
+ setStreamedContent("");
2700
+ setCurrentToolName(null);
2701
+ setProgress(0);
2702
+ }
2703
+ setCurrentRequestId(null);
2704
+ };
2216
2705
  const isCompact = commandVariant === "compact";
2217
- return /* @__PURE__ */ jsxs10("div", { className: cn("flex flex-col h-full", className), children: [
2218
- showHeader && mode === "chat" && /* @__PURE__ */ jsx14("div", { className: "px-4 py-3 flex items-center justify-between", children: /* @__PURE__ */ jsx14("h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }) }),
2219
- mode === "chat" && /* @__PURE__ */ jsxs10(Fragment3, { children: [
2220
- /* @__PURE__ */ jsx14(
2706
+ return /* @__PURE__ */ jsxs12("div", { className: cn("flex flex-col h-full", className), children: [
2707
+ showHeader && mode === "chat" && /* @__PURE__ */ jsx16("div", { className: "px-4 py-3 flex items-center justify-between", children: /* @__PURE__ */ jsx16("h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }) }),
2708
+ mode === "chat" && /* @__PURE__ */ jsxs12(Fragment4, { children: [
2709
+ /* @__PURE__ */ jsx16(
2221
2710
  MessageList,
2222
2711
  {
2223
2712
  messages,
@@ -2227,22 +2716,25 @@ ${planToExecute}`;
2227
2716
  welcomeIcon,
2228
2717
  suggestedPrompts,
2229
2718
  welcomeVariant,
2230
- onPromptClick: (prompt) => handleSendMessage(prompt)
2719
+ onPromptClick: (prompt) => handleSendMessage(prompt),
2720
+ enableWidgets
2231
2721
  }
2232
2722
  ),
2233
- isLoading && /* @__PURE__ */ jsx14("div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
2234
- /* @__PURE__ */ jsx14(
2723
+ isLoading && /* @__PURE__ */ jsx16("div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
2724
+ /* @__PURE__ */ jsx16(
2235
2725
  Composer,
2236
2726
  {
2237
2727
  onSendMessage: handleSendMessage,
2238
2728
  placeholder: placeholder || defaultPlaceholder,
2239
2729
  disabled: isLoading,
2730
+ isLoading,
2731
+ onStop: handleStop,
2240
2732
  onFileUpload,
2241
2733
  onSwitchMode: showModeToggle ? () => handleModeChange("command") : void 0
2242
2734
  }
2243
2735
  )
2244
2736
  ] }),
2245
- mode === "command" && /* @__PURE__ */ jsx14("div", { className: "w-full", children: /* @__PURE__ */ jsx14(
2737
+ mode === "command" && /* @__PURE__ */ jsx16("div", { className: "w-full", children: /* @__PURE__ */ jsx16(
2246
2738
  CommandComposer,
2247
2739
  {
2248
2740
  onExecute: (text, files) => {
@@ -2258,11 +2750,12 @@ ${planToExecute}`;
2258
2750
  onApprove: approvePlan,
2259
2751
  onReject: rejectPlan,
2260
2752
  onReset: resetCommand,
2753
+ onStop: handleStop,
2261
2754
  onExpand: showModeToggle ? () => handleModeChange("chat") : void 0,
2262
2755
  placeholder: placeholder || "Enter your command..."
2263
2756
  }
2264
2757
  ) }),
2265
- /* @__PURE__ */ jsx14("style", { dangerouslySetInnerHTML: {
2758
+ /* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: {
2266
2759
  __html: `
2267
2760
  @keyframes pulse-border {
2268
2761
  0%, 100% { border-color: rgb(59, 130, 246); }
@@ -2281,11 +2774,11 @@ ${planToExecute}`;
2281
2774
 
2282
2775
  // src/components/Chat/CommandOutput.tsx
2283
2776
  import { useState as useState4 } from "react";
2284
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2777
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
2285
2778
 
2286
2779
  // src/components/Command/Command.tsx
2287
2780
  import React, { useState as useState5, useEffect as useEffect4 } from "react";
2288
- import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2781
+ import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
2289
2782
  function Command({
2290
2783
  agentId,
2291
2784
  command: initialCommand,
@@ -2735,7 +3228,7 @@ ${planToExecute}`;
2735
3228
  setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
2736
3229
  };
2737
3230
  const isCompact = variant === "compact";
2738
- return /* @__PURE__ */ jsxs12(
3231
+ return /* @__PURE__ */ jsxs14(
2739
3232
  "div",
2740
3233
  {
2741
3234
  className: cn(
@@ -2750,9 +3243,9 @@ ${planToExecute}`;
2750
3243
  ),
2751
3244
  style: { minHeight: isCompact ? "auto" : "180px" },
2752
3245
  children: [
2753
- /* @__PURE__ */ jsxs12("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
2754
- state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs12(Fragment4, { children: [
2755
- /* @__PURE__ */ jsx16(
3246
+ /* @__PURE__ */ jsxs14("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
3247
+ state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3248
+ /* @__PURE__ */ jsx18(
2756
3249
  "textarea",
2757
3250
  {
2758
3251
  value: command,
@@ -2768,42 +3261,42 @@ ${planToExecute}`;
2768
3261
  rows: 6
2769
3262
  }
2770
3263
  ),
2771
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs12("div", { className: "relative group", children: [
2772
- file.type === "image" ? /* @__PURE__ */ jsx16(
3264
+ uploadedFiles.length > 0 && /* @__PURE__ */ jsx18("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs14("div", { className: "relative group", children: [
3265
+ file.type === "image" ? /* @__PURE__ */ jsx18(
2773
3266
  "img",
2774
3267
  {
2775
3268
  src: file.preview,
2776
3269
  alt: file.name,
2777
3270
  className: "w-20 h-20 object-cover rounded-lg border-2 border-gray-300 dark:border-gray-600"
2778
3271
  }
2779
- ) : /* @__PURE__ */ jsxs12("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", children: [
2780
- /* @__PURE__ */ jsx16("svg", { className: "w-8 h-8 text-gray-500 dark:text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx16("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" }) }),
2781
- /* @__PURE__ */ jsx16("span", { className: "text-[8px] text-gray-500 dark:text-gray-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
3272
+ ) : /* @__PURE__ */ jsxs14("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", children: [
3273
+ /* @__PURE__ */ jsx18("svg", { className: "w-8 h-8 text-gray-500 dark:text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18("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" }) }),
3274
+ /* @__PURE__ */ jsx18("span", { className: "text-[8px] text-gray-500 dark:text-gray-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
2782
3275
  ] }),
2783
- /* @__PURE__ */ jsx16(
3276
+ /* @__PURE__ */ jsx18(
2784
3277
  "button",
2785
3278
  {
2786
3279
  onClick: () => removeFile(index),
2787
3280
  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",
2788
3281
  title: `Remove ${file.type}`,
2789
- children: /* @__PURE__ */ jsx16("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3282
+ children: /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
2790
3283
  }
2791
3284
  )
2792
3285
  ] }, index)) })
2793
3286
  ] }),
2794
- state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs12(Fragment4, { children: [
2795
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
2796
- enableFileUpload && /* @__PURE__ */ jsx16(
3287
+ state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3288
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
3289
+ enableFileUpload && /* @__PURE__ */ jsx18(
2797
3290
  "button",
2798
3291
  {
2799
3292
  onClick: () => fileInputRef.current?.click(),
2800
3293
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
2801
3294
  title: "Attach file",
2802
- children: /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("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)" }) })
3295
+ children: /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("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)" }) })
2803
3296
  }
2804
3297
  ),
2805
- planMode && /* @__PURE__ */ jsxs12("div", { className: "relative settings-menu-container", children: [
2806
- /* @__PURE__ */ jsx16(
3298
+ planMode && /* @__PURE__ */ jsxs14("div", { className: "relative settings-menu-container", children: [
3299
+ /* @__PURE__ */ jsx18(
2807
3300
  "button",
2808
3301
  {
2809
3302
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -2812,28 +3305,28 @@ ${planToExecute}`;
2812
3305
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-gray-500 dark:!text-gray-500"
2813
3306
  ),
2814
3307
  title: "Settings",
2815
- children: /* @__PURE__ */ jsxs12("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2816
- /* @__PURE__ */ jsx16("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
2817
- /* @__PURE__ */ jsx16("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
2818
- /* @__PURE__ */ jsx16("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
2819
- /* @__PURE__ */ jsx16("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
2820
- /* @__PURE__ */ jsx16("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
2821
- /* @__PURE__ */ jsx16("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
2822
- /* @__PURE__ */ jsx16("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
2823
- /* @__PURE__ */ jsx16("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
2824
- /* @__PURE__ */ jsx16("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
3308
+ children: /* @__PURE__ */ jsxs14("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3309
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
3310
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
3311
+ /* @__PURE__ */ jsx18("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
3312
+ /* @__PURE__ */ jsx18("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
3313
+ /* @__PURE__ */ jsx18("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
3314
+ /* @__PURE__ */ jsx18("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
3315
+ /* @__PURE__ */ jsx18("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
3316
+ /* @__PURE__ */ jsx18("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
3317
+ /* @__PURE__ */ jsx18("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
2825
3318
  ] })
2826
3319
  }
2827
3320
  ),
2828
- showSettingsMenu && /* @__PURE__ */ jsx16("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between cursor-pointer group", children: [
2829
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2830
- /* @__PURE__ */ jsx16("svg", { className: "w-3.5 h-3.5 text-gray-500 dark:text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("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" }) }),
2831
- /* @__PURE__ */ jsxs12("div", { children: [
2832
- /* @__PURE__ */ jsx16("div", { className: "text-xs font-medium text-gray-700 dark:text-gray-300", children: "Plan Mode" }),
2833
- /* @__PURE__ */ jsx16("div", { className: "text-[10px] text-gray-500 dark:text-gray-400", children: "Review first" })
3321
+ showSettingsMenu && /* @__PURE__ */ jsx18("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs14("label", { className: "flex items-center justify-between cursor-pointer group", children: [
3322
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3323
+ /* @__PURE__ */ jsx18("svg", { className: "w-3.5 h-3.5 text-gray-500 dark:text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("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" }) }),
3324
+ /* @__PURE__ */ jsxs14("div", { children: [
3325
+ /* @__PURE__ */ jsx18("div", { className: "text-xs font-medium text-gray-700 dark:text-gray-300", children: "Plan Mode" }),
3326
+ /* @__PURE__ */ jsx18("div", { className: "text-[10px] text-gray-500 dark:text-gray-400", children: "Review first" })
2834
3327
  ] })
2835
3328
  ] }),
2836
- /* @__PURE__ */ jsx16(
3329
+ /* @__PURE__ */ jsx18(
2837
3330
  "button",
2838
3331
  {
2839
3332
  onClick: (e) => {
@@ -2845,7 +3338,7 @@ ${planToExecute}`;
2845
3338
  internalPlanMode ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"
2846
3339
  ),
2847
3340
  type: "button",
2848
- children: /* @__PURE__ */ jsx16(
3341
+ children: /* @__PURE__ */ jsx18(
2849
3342
  "span",
2850
3343
  {
2851
3344
  className: cn(
@@ -2859,26 +3352,26 @@ ${planToExecute}`;
2859
3352
  ] }) })
2860
3353
  ] })
2861
3354
  ] }),
2862
- uploadedFiles.length > 0 && /* @__PURE__ */ jsx16("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs12("div", { className: "relative group", children: [
2863
- file.type === "image" ? /* @__PURE__ */ jsx16(
3355
+ uploadedFiles.length > 0 && /* @__PURE__ */ jsx18("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs14("div", { className: "relative group", children: [
3356
+ file.type === "image" ? /* @__PURE__ */ jsx18(
2864
3357
  "img",
2865
3358
  {
2866
3359
  src: file.preview,
2867
3360
  alt: file.name,
2868
3361
  className: "w-8 h-8 object-cover rounded border border-gray-300 dark:border-gray-600"
2869
3362
  }
2870
- ) : /* @__PURE__ */ jsx16("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", title: file.name, children: /* @__PURE__ */ jsx16("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx16("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" }) }) }),
2871
- /* @__PURE__ */ jsx16(
3363
+ ) : /* @__PURE__ */ jsx18("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", title: file.name, children: /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx18("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" }) }) }),
3364
+ /* @__PURE__ */ jsx18(
2872
3365
  "button",
2873
3366
  {
2874
3367
  onClick: () => removeFile(index),
2875
3368
  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",
2876
3369
  title: "Remove",
2877
- children: /* @__PURE__ */ jsx16("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
3370
+ children: /* @__PURE__ */ jsx18("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
2878
3371
  }
2879
3372
  )
2880
3373
  ] }, index)) }),
2881
- /* @__PURE__ */ jsx16(
3374
+ /* @__PURE__ */ jsx18(
2882
3375
  "input",
2883
3376
  {
2884
3377
  type: "text",
@@ -2894,7 +3387,7 @@ ${planToExecute}`;
2894
3387
  className: "flex-1 bg-transparent border-none focus:outline-none !text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 py-1"
2895
3388
  }
2896
3389
  ),
2897
- /* @__PURE__ */ jsx16(
3390
+ /* @__PURE__ */ jsx18(
2898
3391
  "button",
2899
3392
  {
2900
3393
  onClick: () => executeCommand(),
@@ -2910,33 +3403,33 @@ ${planToExecute}`;
2910
3403
  !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
2911
3404
  ),
2912
3405
  title: "Execute",
2913
- children: /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3406
+ children: /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
2914
3407
  }
2915
3408
  )
2916
3409
  ] }),
2917
- state === "loading" && !isCompact && /* @__PURE__ */ jsxs12("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
2918
- /* @__PURE__ */ jsx16("div", { className: "w-6 h-6 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
2919
- /* @__PURE__ */ jsx16("div", { className: "text-gray-600 dark:text-gray-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
2920
- showProgress && /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-sm", children: [
2921
- /* @__PURE__ */ jsx16("div", { className: "w-full bg-gray-200 dark:bg-gray-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx16(
3410
+ state === "loading" && !isCompact && /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
3411
+ /* @__PURE__ */ jsx18("div", { className: "w-6 h-6 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
3412
+ /* @__PURE__ */ jsx18("div", { className: "text-gray-600 dark:text-gray-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
3413
+ showProgress && /* @__PURE__ */ jsxs14("div", { className: "w-full max-w-sm", children: [
3414
+ /* @__PURE__ */ jsx18("div", { className: "w-full bg-gray-200 dark:bg-gray-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx18(
2922
3415
  "div",
2923
3416
  {
2924
3417
  className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
2925
3418
  style: { width: `${progress}%` }
2926
3419
  }
2927
3420
  ) }),
2928
- /* @__PURE__ */ jsxs12("p", { className: "text-xs text-gray-500 mt-2 text-center", children: [
3421
+ /* @__PURE__ */ jsxs14("p", { className: "text-xs text-gray-500 mt-2 text-center", children: [
2929
3422
  progress,
2930
3423
  "%"
2931
3424
  ] })
2932
3425
  ] })
2933
3426
  ] }),
2934
- state === "loading" && isCompact && /* @__PURE__ */ jsxs12(Fragment4, { children: [
2935
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
2936
- /* @__PURE__ */ jsx16("div", { className: "w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
2937
- /* @__PURE__ */ jsx16("div", { className: "text-gray-600 dark:text-gray-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
3427
+ state === "loading" && isCompact && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3428
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
3429
+ /* @__PURE__ */ jsx18("div", { className: "w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin" }),
3430
+ /* @__PURE__ */ jsx18("div", { className: "text-gray-600 dark:text-gray-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
2938
3431
  ] }),
2939
- /* @__PURE__ */ jsx16(
3432
+ /* @__PURE__ */ jsx18(
2940
3433
  "button",
2941
3434
  {
2942
3435
  disabled: true,
@@ -2948,20 +3441,20 @@ ${planToExecute}`;
2948
3441
  "!text-lg",
2949
3442
  "opacity-30 cursor-not-allowed"
2950
3443
  ),
2951
- children: /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3444
+ children: /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
2952
3445
  }
2953
3446
  )
2954
3447
  ] }),
2955
- state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx16("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs12("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: [
2956
- /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-2 mb-3", children: [
2957
- /* @__PURE__ */ jsx16("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__ */ jsx16("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" }) }),
2958
- /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
2959
- /* @__PURE__ */ jsx16("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
2960
- /* @__PURE__ */ jsx16("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
3448
+ state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx18("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs14("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: [
3449
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-2 mb-3", children: [
3450
+ /* @__PURE__ */ jsx18("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__ */ jsx18("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" }) }),
3451
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1", children: [
3452
+ /* @__PURE__ */ jsx18("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
3453
+ /* @__PURE__ */ jsx18("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
2961
3454
  ] })
2962
3455
  ] }),
2963
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-2 mt-4", children: [
2964
- /* @__PURE__ */ jsx16(
3456
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-2 mt-4", children: [
3457
+ /* @__PURE__ */ jsx18(
2965
3458
  "button",
2966
3459
  {
2967
3460
  onClick: approvePlan,
@@ -2969,7 +3462,7 @@ ${planToExecute}`;
2969
3462
  children: "Approve & Execute"
2970
3463
  }
2971
3464
  ),
2972
- /* @__PURE__ */ jsx16(
3465
+ /* @__PURE__ */ jsx18(
2973
3466
  "button",
2974
3467
  {
2975
3468
  onClick: rejectPlan,
@@ -2979,20 +3472,20 @@ ${planToExecute}`;
2979
3472
  )
2980
3473
  ] })
2981
3474
  ] }) }),
2982
- state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs12(Fragment4, { children: [
2983
- /* @__PURE__ */ jsxs12(
3475
+ state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3476
+ /* @__PURE__ */ jsxs14(
2984
3477
  "button",
2985
3478
  {
2986
3479
  onClick: () => setShowPlanDetails(true),
2987
3480
  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",
2988
3481
  children: [
2989
- /* @__PURE__ */ jsx16("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__ */ jsx16("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" }) }),
2990
- /* @__PURE__ */ jsx16("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
3482
+ /* @__PURE__ */ jsx18("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__ */ jsx18("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" }) }),
3483
+ /* @__PURE__ */ jsx18("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
2991
3484
  ]
2992
3485
  }
2993
3486
  ),
2994
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-2 flex-shrink-0", children: [
2995
- /* @__PURE__ */ jsx16(
3487
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-2 flex-shrink-0", children: [
3488
+ /* @__PURE__ */ jsx18(
2996
3489
  "button",
2997
3490
  {
2998
3491
  onClick: approvePlan,
@@ -3000,7 +3493,7 @@ ${planToExecute}`;
3000
3493
  children: "Approve"
3001
3494
  }
3002
3495
  ),
3003
- /* @__PURE__ */ jsx16(
3496
+ /* @__PURE__ */ jsx18(
3004
3497
  "button",
3005
3498
  {
3006
3499
  onClick: rejectPlan,
@@ -3010,15 +3503,15 @@ ${planToExecute}`;
3010
3503
  )
3011
3504
  ] })
3012
3505
  ] }),
3013
- state === "error" && /* @__PURE__ */ jsxs12("div", { className: "flex-1 flex flex-col", children: [
3014
- /* @__PURE__ */ jsx16("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__ */ jsxs12("div", { className: "flex items-start gap-2", children: [
3015
- /* @__PURE__ */ jsx16("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__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3016
- /* @__PURE__ */ jsxs12("div", { children: [
3017
- /* @__PURE__ */ jsx16("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
3018
- /* @__PURE__ */ jsx16("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
3506
+ state === "error" && /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col", children: [
3507
+ /* @__PURE__ */ jsx18("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__ */ jsxs14("div", { className: "flex items-start gap-2", children: [
3508
+ /* @__PURE__ */ jsx18("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__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3509
+ /* @__PURE__ */ jsxs14("div", { children: [
3510
+ /* @__PURE__ */ jsx18("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
3511
+ /* @__PURE__ */ jsx18("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
3019
3512
  ] })
3020
3513
  ] }) }),
3021
- allowInput && /* @__PURE__ */ jsx16(
3514
+ allowInput && /* @__PURE__ */ jsx18(
3022
3515
  "textarea",
3023
3516
  {
3024
3517
  value: command,
@@ -3035,16 +3528,16 @@ ${planToExecute}`;
3035
3528
  }
3036
3529
  )
3037
3530
  ] }),
3038
- state === "success" && result && !isCompact && /* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
3039
- /* @__PURE__ */ jsxs12("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: [
3040
- /* @__PURE__ */ jsx16("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__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3041
- /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
3042
- /* @__PURE__ */ jsx16("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
3043
- /* @__PURE__ */ jsx16("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
3531
+ state === "success" && result && !isCompact && /* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
3532
+ /* @__PURE__ */ jsxs14("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: [
3533
+ /* @__PURE__ */ jsx18("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__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3534
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1", children: [
3535
+ /* @__PURE__ */ jsx18("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
3536
+ /* @__PURE__ */ jsx18("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
3044
3537
  ] })
3045
3538
  ] }),
3046
- result.data?.summary && /* @__PURE__ */ jsx16("div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3047
- result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx16("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx16(
3539
+ result.data?.summary && /* @__PURE__ */ jsx18("div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3540
+ result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx18("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx18(
3048
3541
  WidgetRenderer,
3049
3542
  {
3050
3543
  widget,
@@ -3053,8 +3546,8 @@ ${planToExecute}`;
3053
3546
  widget.id
3054
3547
  )) })
3055
3548
  ] }) }),
3056
- state === "success" && result && isCompact && /* @__PURE__ */ jsxs12(Fragment4, { children: [
3057
- /* @__PURE__ */ jsxs12(
3549
+ state === "success" && result && isCompact && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3550
+ /* @__PURE__ */ jsxs14(
3058
3551
  "div",
3059
3552
  {
3060
3553
  className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
@@ -3063,12 +3556,12 @@ ${planToExecute}`;
3063
3556
  setResult(null);
3064
3557
  },
3065
3558
  children: [
3066
- /* @__PURE__ */ jsx16("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3067
- /* @__PURE__ */ jsx16("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" })
3559
+ /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
3560
+ /* @__PURE__ */ jsx18("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" })
3068
3561
  ]
3069
3562
  }
3070
3563
  ),
3071
- /* @__PURE__ */ jsx16(
3564
+ /* @__PURE__ */ jsx18(
3072
3565
  "button",
3073
3566
  {
3074
3567
  onClick: () => {
@@ -3084,24 +3577,24 @@ ${planToExecute}`;
3084
3577
  "!text-lg"
3085
3578
  ),
3086
3579
  title: "New command",
3087
- children: /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3580
+ children: /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3088
3581
  }
3089
3582
  )
3090
3583
  ] })
3091
3584
  ] }),
3092
- !isCompact && /* @__PURE__ */ jsxs12("div", { className: "p-3 flex items-center justify-between gap-2", children: [
3093
- /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs12(Fragment4, { children: [
3094
- enableFileUpload && /* @__PURE__ */ jsx16(
3585
+ !isCompact && /* @__PURE__ */ jsxs14("div", { className: "p-3 flex items-center justify-between gap-2", children: [
3586
+ /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs14(Fragment5, { children: [
3587
+ enableFileUpload && /* @__PURE__ */ jsx18(
3095
3588
  "button",
3096
3589
  {
3097
3590
  onClick: () => fileInputRef.current?.click(),
3098
3591
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
3099
3592
  title: "Attach file",
3100
- children: /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("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)" }) })
3593
+ children: /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("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)" }) })
3101
3594
  }
3102
3595
  ),
3103
- planMode && /* @__PURE__ */ jsxs12("div", { className: "relative settings-menu-container", children: [
3104
- /* @__PURE__ */ jsx16(
3596
+ planMode && /* @__PURE__ */ jsxs14("div", { className: "relative settings-menu-container", children: [
3597
+ /* @__PURE__ */ jsx18(
3105
3598
  "button",
3106
3599
  {
3107
3600
  onClick: () => setShowSettingsMenu(!showSettingsMenu),
@@ -3110,28 +3603,28 @@ ${planToExecute}`;
3110
3603
  internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-gray-500 dark:!text-gray-500"
3111
3604
  ),
3112
3605
  title: "Settings",
3113
- children: /* @__PURE__ */ jsxs12("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3114
- /* @__PURE__ */ jsx16("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
3115
- /* @__PURE__ */ jsx16("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
3116
- /* @__PURE__ */ jsx16("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
3117
- /* @__PURE__ */ jsx16("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
3118
- /* @__PURE__ */ jsx16("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
3119
- /* @__PURE__ */ jsx16("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
3120
- /* @__PURE__ */ jsx16("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
3121
- /* @__PURE__ */ jsx16("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
3122
- /* @__PURE__ */ jsx16("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
3606
+ children: /* @__PURE__ */ jsxs14("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3607
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
3608
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
3609
+ /* @__PURE__ */ jsx18("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
3610
+ /* @__PURE__ */ jsx18("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
3611
+ /* @__PURE__ */ jsx18("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
3612
+ /* @__PURE__ */ jsx18("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
3613
+ /* @__PURE__ */ jsx18("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
3614
+ /* @__PURE__ */ jsx18("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
3615
+ /* @__PURE__ */ jsx18("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
3123
3616
  ] })
3124
3617
  }
3125
3618
  ),
3126
- showSettingsMenu && /* @__PURE__ */ jsx16("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between cursor-pointer group", children: [
3127
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3128
- /* @__PURE__ */ jsx16("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("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" }) }),
3129
- /* @__PURE__ */ jsxs12("div", { children: [
3130
- /* @__PURE__ */ jsx16("div", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Plan Mode" }),
3131
- /* @__PURE__ */ jsx16("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Review before executing" })
3619
+ showSettingsMenu && /* @__PURE__ */ jsx18("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs14("label", { className: "flex items-center justify-between cursor-pointer group", children: [
3620
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3621
+ /* @__PURE__ */ jsx18("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("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" }) }),
3622
+ /* @__PURE__ */ jsxs14("div", { children: [
3623
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Plan Mode" }),
3624
+ /* @__PURE__ */ jsx18("div", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Review before executing" })
3132
3625
  ] })
3133
3626
  ] }),
3134
- /* @__PURE__ */ jsx16(
3627
+ /* @__PURE__ */ jsx18(
3135
3628
  "button",
3136
3629
  {
3137
3630
  onClick: (e) => {
@@ -3143,7 +3636,7 @@ ${planToExecute}`;
3143
3636
  internalPlanMode ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"
3144
3637
  ),
3145
3638
  type: "button",
3146
- children: /* @__PURE__ */ jsx16(
3639
+ children: /* @__PURE__ */ jsx18(
3147
3640
  "span",
3148
3641
  {
3149
3642
  className: cn(
@@ -3157,9 +3650,9 @@ ${planToExecute}`;
3157
3650
  ] }) })
3158
3651
  ] })
3159
3652
  ] }) }),
3160
- !(state === "idle" && allowInput) && /* @__PURE__ */ jsx16("div", {}),
3161
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3162
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx16(
3653
+ !(state === "idle" && allowInput) && /* @__PURE__ */ jsx18("div", {}),
3654
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3655
+ (state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx18(
3163
3656
  "button",
3164
3657
  {
3165
3658
  onClick: resetCommand,
@@ -3167,7 +3660,7 @@ ${planToExecute}`;
3167
3660
  children: "Reset"
3168
3661
  }
3169
3662
  ),
3170
- (state === "idle" || state === "error") && /* @__PURE__ */ jsx16(
3663
+ (state === "idle" || state === "error") && /* @__PURE__ */ jsx18(
3171
3664
  "button",
3172
3665
  {
3173
3666
  onClick: () => executeCommand(),
@@ -3183,29 +3676,29 @@ ${planToExecute}`;
3183
3676
  !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
3184
3677
  ),
3185
3678
  title: state === "error" ? "Retry" : "Execute",
3186
- children: state === "error" ? /* @__PURE__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("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__ */ jsx16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx16("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3679
+ children: state === "error" ? /* @__PURE__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("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__ */ jsx18("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3187
3680
  }
3188
3681
  )
3189
3682
  ] })
3190
3683
  ] }),
3191
- showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx16("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs12("div", { className: "bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
3192
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700", children: [
3193
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
3194
- /* @__PURE__ */ jsx16("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("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" }) }),
3195
- /* @__PURE__ */ jsx16("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Proposed Execution Plan" })
3684
+ showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx18("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs14("div", { className: "bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
3685
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700", children: [
3686
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-3", children: [
3687
+ /* @__PURE__ */ jsx18("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("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" }) }),
3688
+ /* @__PURE__ */ jsx18("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Proposed Execution Plan" })
3196
3689
  ] }),
3197
- /* @__PURE__ */ jsx16(
3690
+ /* @__PURE__ */ jsx18(
3198
3691
  "button",
3199
3692
  {
3200
3693
  onClick: () => setShowPlanDetails(false),
3201
3694
  className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",
3202
- children: /* @__PURE__ */ jsx16("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx16("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3695
+ children: /* @__PURE__ */ jsx18("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
3203
3696
  }
3204
3697
  )
3205
3698
  ] }),
3206
- /* @__PURE__ */ jsx16("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx16("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx16("div", { className: "text-gray-700 dark:text-gray-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
3207
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50", children: [
3208
- /* @__PURE__ */ jsx16(
3699
+ /* @__PURE__ */ jsx18("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx18("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx18("div", { className: "text-gray-700 dark:text-gray-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
3700
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50", children: [
3701
+ /* @__PURE__ */ jsx18(
3209
3702
  "button",
3210
3703
  {
3211
3704
  onClick: rejectPlan,
@@ -3213,7 +3706,7 @@ ${planToExecute}`;
3213
3706
  children: "Modify Command"
3214
3707
  }
3215
3708
  ),
3216
- /* @__PURE__ */ jsx16(
3709
+ /* @__PURE__ */ jsx18(
3217
3710
  "button",
3218
3711
  {
3219
3712
  onClick: approvePlan,
@@ -3223,7 +3716,7 @@ ${planToExecute}`;
3223
3716
  )
3224
3717
  ] })
3225
3718
  ] }) }),
3226
- /* @__PURE__ */ jsx16(
3719
+ /* @__PURE__ */ jsx18(
3227
3720
  "input",
3228
3721
  {
3229
3722
  ref: fileInputRef,
@@ -3234,7 +3727,7 @@ ${planToExecute}`;
3234
3727
  accept: "image/*,application/pdf,.doc,.docx,.txt"
3235
3728
  }
3236
3729
  ),
3237
- /* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: {
3730
+ /* @__PURE__ */ jsx18("style", { dangerouslySetInnerHTML: {
3238
3731
  __html: `
3239
3732
  @keyframes pulse-border {
3240
3733
  0%, 100% {
@@ -3256,7 +3749,7 @@ ${planToExecute}`;
3256
3749
 
3257
3750
  // src/components/Prompt/Prompt.tsx
3258
3751
  import { useState as useState6 } from "react";
3259
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
3752
+ import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3260
3753
  function Prompt({
3261
3754
  agentId,
3262
3755
  placeholder = "Enter your prompt...",
@@ -3318,9 +3811,9 @@ function Prompt({
3318
3811
  handleSubmit();
3319
3812
  }
3320
3813
  };
3321
- return /* @__PURE__ */ jsxs13("div", { className: cn("space-y-2", className), children: [
3322
- /* @__PURE__ */ jsxs13("div", { className: "flex gap-2", children: [
3323
- /* @__PURE__ */ jsx17(
3814
+ return /* @__PURE__ */ jsxs15("div", { className: cn("space-y-2", className), children: [
3815
+ /* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
3816
+ /* @__PURE__ */ jsx19(
3324
3817
  "input",
3325
3818
  {
3326
3819
  type: "text",
@@ -3333,7 +3826,7 @@ function Prompt({
3333
3826
  className: "flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-gray-800 dark:border-gray-600 dark:text-white"
3334
3827
  }
3335
3828
  ),
3336
- submitOn === "button" && /* @__PURE__ */ jsx17(
3829
+ submitOn === "button" && /* @__PURE__ */ jsx19(
3337
3830
  "button",
3338
3831
  {
3339
3832
  onClick: handleSubmit,
@@ -3343,13 +3836,13 @@ function Prompt({
3343
3836
  }
3344
3837
  )
3345
3838
  ] }),
3346
- maxLength && /* @__PURE__ */ jsxs13("p", { className: "text-xs text-gray-500", children: [
3839
+ maxLength && /* @__PURE__ */ jsxs15("p", { className: "text-xs text-gray-500", children: [
3347
3840
  value.length,
3348
3841
  " / ",
3349
3842
  maxLength,
3350
3843
  " characters"
3351
3844
  ] }),
3352
- showSuggestions && !value && /* @__PURE__ */ jsx17("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx17(
3845
+ showSuggestions && !value && /* @__PURE__ */ jsx19("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx19(
3353
3846
  "button",
3354
3847
  {
3355
3848
  onClick: () => setValue(suggestion),
@@ -3358,16 +3851,16 @@ function Prompt({
3358
3851
  },
3359
3852
  idx
3360
3853
  )) }),
3361
- isLoading && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
3362
- /* @__PURE__ */ jsx17("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
3363
- /* @__PURE__ */ jsx17("span", { children: "AI is processing your request..." })
3854
+ isLoading && /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
3855
+ /* @__PURE__ */ jsx19("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
3856
+ /* @__PURE__ */ jsx19("span", { children: "AI is processing your request..." })
3364
3857
  ] })
3365
3858
  ] });
3366
3859
  }
3367
3860
 
3368
3861
  // src/components/Stream/Stream.tsx
3369
3862
  import { useState as useState7, useEffect as useEffect5 } from "react";
3370
- import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3863
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
3371
3864
  function Stream({
3372
3865
  agentId,
3373
3866
  prompt,
@@ -3447,7 +3940,7 @@ function Stream({
3447
3940
  plain: "text-gray-900 dark:text-gray-100"
3448
3941
  };
3449
3942
  if (!isStreaming && !isComplete) {
3450
- return /* @__PURE__ */ jsx18("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx18(
3943
+ return /* @__PURE__ */ jsx20("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx20(
3451
3944
  "button",
3452
3945
  {
3453
3946
  onClick: startStreaming,
@@ -3456,9 +3949,9 @@ function Stream({
3456
3949
  }
3457
3950
  ) });
3458
3951
  }
3459
- return /* @__PURE__ */ jsxs14("div", { className: cn(variantClasses[variant], className), children: [
3952
+ return /* @__PURE__ */ jsxs16("div", { className: cn(variantClasses[variant], className), children: [
3460
3953
  text,
3461
- isStreaming && showCursor && /* @__PURE__ */ jsx18("span", { className: "apteva-stream-cursor" })
3954
+ isStreaming && showCursor && /* @__PURE__ */ jsx20("span", { className: "apteva-stream-cursor" })
3462
3955
  ] });
3463
3956
  }
3464
3957
 
@@ -3466,9 +3959,9 @@ function Stream({
3466
3959
  import { useState as useState8 } from "react";
3467
3960
 
3468
3961
  // src/components/Threads/ThreadItem.tsx
3469
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3962
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
3470
3963
  function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
3471
- return /* @__PURE__ */ jsxs15(
3964
+ return /* @__PURE__ */ jsxs17(
3472
3965
  "div",
3473
3966
  {
3474
3967
  className: cn("apteva-thread-item", {
@@ -3476,19 +3969,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
3476
3969
  }),
3477
3970
  onClick: onSelect,
3478
3971
  children: [
3479
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
3480
- /* @__PURE__ */ jsx19("h4", { className: "font-semibold text-gray-900 dark:text-white truncate", children: thread.title }),
3481
- thread.preview && /* @__PURE__ */ jsx19("p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: thread.preview }),
3482
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 mt-1 text-xs text-gray-500", children: [
3483
- /* @__PURE__ */ jsxs15("span", { children: [
3972
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
3973
+ /* @__PURE__ */ jsx21("h4", { className: "font-semibold text-gray-900 dark:text-white truncate", children: thread.title }),
3974
+ thread.preview && /* @__PURE__ */ jsx21("p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: thread.preview }),
3975
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 mt-1 text-xs text-gray-500", children: [
3976
+ /* @__PURE__ */ jsxs17("span", { children: [
3484
3977
  thread.messageCount,
3485
3978
  " messages"
3486
3979
  ] }),
3487
- /* @__PURE__ */ jsx19("span", { children: "\u2022" }),
3488
- /* @__PURE__ */ jsx19("span", { children: formatRelativeTime(thread.updatedAt) })
3980
+ /* @__PURE__ */ jsx21("span", { children: "\u2022" }),
3981
+ /* @__PURE__ */ jsx21("span", { children: formatRelativeTime(thread.updatedAt) })
3489
3982
  ] })
3490
3983
  ] }),
3491
- onDelete && /* @__PURE__ */ jsx19(
3984
+ onDelete && /* @__PURE__ */ jsx21(
3492
3985
  "button",
3493
3986
  {
3494
3987
  onClick: (e) => {
@@ -3518,7 +4011,7 @@ function formatRelativeTime(date) {
3518
4011
  }
3519
4012
 
3520
4013
  // src/components/Threads/ThreadList.tsx
3521
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4014
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
3522
4015
  function ThreadList({
3523
4016
  threads,
3524
4017
  currentThreadId,
@@ -3532,8 +4025,8 @@ function ThreadList({
3532
4025
  (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
3533
4026
  );
3534
4027
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
3535
- return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col h-full", children: [
3536
- showSearch && /* @__PURE__ */ jsx20("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx20(
4028
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col h-full", children: [
4029
+ showSearch && /* @__PURE__ */ jsx22("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx22(
3537
4030
  "input",
3538
4031
  {
3539
4032
  type: "text",
@@ -3543,10 +4036,10 @@ function ThreadList({
3543
4036
  className: "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-gray-800 dark:border-gray-600 dark:text-white"
3544
4037
  }
3545
4038
  ) }),
3546
- /* @__PURE__ */ jsxs16("div", { className: "flex-1 overflow-y-auto", children: [
3547
- Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs16("div", { children: [
3548
- groupBy !== "none" && /* @__PURE__ */ jsx20("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase", children: group }),
3549
- groupThreads.map((thread) => /* @__PURE__ */ jsx20(
4039
+ /* @__PURE__ */ jsxs18("div", { className: "flex-1 overflow-y-auto", children: [
4040
+ Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs18("div", { children: [
4041
+ groupBy !== "none" && /* @__PURE__ */ jsx22("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase", children: group }),
4042
+ groupThreads.map((thread) => /* @__PURE__ */ jsx22(
3550
4043
  ThreadItem,
3551
4044
  {
3552
4045
  thread,
@@ -3557,9 +4050,9 @@ function ThreadList({
3557
4050
  thread.id
3558
4051
  ))
3559
4052
  ] }, group)),
3560
- filteredThreads.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "p-8 text-center text-gray-500", children: [
3561
- /* @__PURE__ */ jsx20("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx20("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" }) }),
3562
- /* @__PURE__ */ jsx20("p", { children: "No conversations found" })
4053
+ filteredThreads.length === 0 && /* @__PURE__ */ jsxs18("div", { className: "p-8 text-center text-gray-500", children: [
4054
+ /* @__PURE__ */ jsx22("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx22("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" }) }),
4055
+ /* @__PURE__ */ jsx22("p", { children: "No conversations found" })
3563
4056
  ] })
3564
4057
  ] })
3565
4058
  ] });
@@ -3591,7 +4084,7 @@ function groupThreadsByDate(threads) {
3591
4084
  }
3592
4085
 
3593
4086
  // src/components/Threads/Threads.tsx
3594
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
4087
+ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
3595
4088
  function Threads({
3596
4089
  threads,
3597
4090
  currentThreadId,
@@ -3610,8 +4103,8 @@ function Threads({
3610
4103
  tabs: "flex gap-2 border-b border-gray-200 dark:border-gray-700 overflow-x-auto"
3611
4104
  };
3612
4105
  if (variant === "tabs") {
3613
- return /* @__PURE__ */ jsxs17("div", { className: cn(variantClasses[variant], className), children: [
3614
- threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx21(
4106
+ return /* @__PURE__ */ jsxs19("div", { className: cn(variantClasses[variant], className), children: [
4107
+ threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx23(
3615
4108
  "button",
3616
4109
  {
3617
4110
  onClick: () => onThreadSelect?.(thread.id),
@@ -3623,7 +4116,7 @@ function Threads({
3623
4116
  },
3624
4117
  thread.id
3625
4118
  )),
3626
- showNewButton && onNewThread && /* @__PURE__ */ jsx21(
4119
+ showNewButton && onNewThread && /* @__PURE__ */ jsx23(
3627
4120
  "button",
3628
4121
  {
3629
4122
  onClick: onNewThread,
@@ -3633,8 +4126,8 @@ function Threads({
3633
4126
  )
3634
4127
  ] });
3635
4128
  }
3636
- return /* @__PURE__ */ jsxs17("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
3637
- showNewButton && onNewThread && /* @__PURE__ */ jsx21("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx21(
4129
+ return /* @__PURE__ */ jsxs19("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
4130
+ showNewButton && onNewThread && /* @__PURE__ */ jsx23("div", { className: "p-3 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx23(
3638
4131
  "button",
3639
4132
  {
3640
4133
  onClick: onNewThread,
@@ -3642,7 +4135,7 @@ function Threads({
3642
4135
  children: "+ New Conversation"
3643
4136
  }
3644
4137
  ) }),
3645
- /* @__PURE__ */ jsx21(
4138
+ /* @__PURE__ */ jsx23(
3646
4139
  ThreadList,
3647
4140
  {
3648
4141
  threads,