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