besser-agentic-framework-ui 0.2.0 → 0.2.2
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 +21 -21
- package/dist/besser-agentic-framework-ui.js +498 -245
- package/dist/components/GUIRenderer.d.ts +2 -1
- package/dist/components/SessionSidebar.d.ts +15 -0
- package/dist/lib.d.ts +2 -0
- package/dist/services/db.d.ts +23 -0
- package/dist/style.css +1 -1
- package/dist/types/payload.d.ts +1 -1
- package/package.json +1 -1
|
@@ -25,7 +25,6 @@ var m = {
|
|
|
25
25
|
AGENT_REPLY_AUDIO: "agent_reply_audio",
|
|
26
26
|
AGENT_REPLY_GUI: "agent_reply_gui",
|
|
27
27
|
AGENT_REPLY_GUI_UPDATE: "agent_reply_gui_update",
|
|
28
|
-
USER_UPDATE_UI: "user_update_ui",
|
|
29
28
|
USER_GUI_EVENT: "user_gui_event",
|
|
30
29
|
FETCH_USER_MESSAGES: "fetch_user_messages"
|
|
31
30
|
}, h = {
|
|
@@ -545,14 +544,19 @@ function se({ el: e, id: t, onInteract: n }) {
|
|
|
545
544
|
}
|
|
546
545
|
function ce({ el: e, id: t, className: n, onInteract: r }) {
|
|
547
546
|
let [i, a] = s(typeof e.default_value == "number" ? e.default_value : 0), [o, c] = s(0), l = e.max_value ?? 5;
|
|
548
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ p("div", {
|
|
549
548
|
id: t,
|
|
550
549
|
className: n,
|
|
551
550
|
style: {
|
|
552
551
|
display: "flex",
|
|
553
552
|
gap: "2px"
|
|
554
553
|
},
|
|
555
|
-
children:
|
|
554
|
+
children: [/* @__PURE__ */ f("input", {
|
|
555
|
+
type: "hidden",
|
|
556
|
+
name: e.name,
|
|
557
|
+
"data-value-type": "number",
|
|
558
|
+
value: String(i)
|
|
559
|
+
}), Array.from({ length: l }, (e, t) => t + 1).map((n) => /* @__PURE__ */ f("button", {
|
|
556
560
|
type: "button",
|
|
557
561
|
"aria-label": `${n} star${n === 1 ? "" : "s"}`,
|
|
558
562
|
style: {
|
|
@@ -579,7 +583,7 @@ function ce({ el: e, id: t, className: n, onInteract: r }) {
|
|
|
579
583
|
onMouseEnter: () => !e.disabled && c(n),
|
|
580
584
|
onMouseLeave: () => c(0),
|
|
581
585
|
children: "★"
|
|
582
|
-
}, n))
|
|
586
|
+
}, n))]
|
|
583
587
|
});
|
|
584
588
|
}
|
|
585
589
|
function le({ el: e, id: t, className: n, onInteract: r }) {
|
|
@@ -714,7 +718,7 @@ function ue({ el: e, id: t, className: n, onInteract: r }) {
|
|
|
714
718
|
}, n))
|
|
715
719
|
});
|
|
716
720
|
}
|
|
717
|
-
function
|
|
721
|
+
function de({ el: e, id: t, className: n, onInteract: r }) {
|
|
718
722
|
let [i, a] = s(""), [o, c] = s(""), l = {
|
|
719
723
|
padding: "6px 10px",
|
|
720
724
|
border: "1px solid #cbd5e1",
|
|
@@ -771,10 +775,10 @@ function B({ el: e, id: t, className: n, onInteract: r }) {
|
|
|
771
775
|
]
|
|
772
776
|
});
|
|
773
777
|
}
|
|
774
|
-
function
|
|
775
|
-
let i = e.options ?? [], [a,
|
|
778
|
+
function fe({ el: e, id: t, className: n, onInteract: r }) {
|
|
779
|
+
let i = e.options ?? [], [a, c] = s(() => typeof e.default_value == "string" && e.default_value ? e.default_value.split(",").map((e) => e.trim()).filter(Boolean) : []), l = o(null), u = (n) => {
|
|
776
780
|
let i = a.includes(n) ? a.filter((e) => e !== n) : [...a, n];
|
|
777
|
-
|
|
781
|
+
c(i), l.current && (l.current.value = JSON.stringify(i)), r?.(JSON.stringify({
|
|
778
782
|
elementId: t ?? e.name,
|
|
779
783
|
name: e.name,
|
|
780
784
|
fieldType: e.field_type,
|
|
@@ -791,76 +795,131 @@ function V({ el: e, id: t, className: n, onInteract: r }) {
|
|
|
791
795
|
flexDirection: "column",
|
|
792
796
|
gap: "6px"
|
|
793
797
|
},
|
|
794
|
-
children: [
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
798
|
+
children: [
|
|
799
|
+
/* @__PURE__ */ f("input", {
|
|
800
|
+
type: "hidden",
|
|
801
|
+
ref: l,
|
|
802
|
+
name: e.name,
|
|
803
|
+
"data-value-type": "json",
|
|
804
|
+
defaultValue: JSON.stringify(a)
|
|
805
|
+
}),
|
|
806
|
+
a.length > 0 && /* @__PURE__ */ f("div", {
|
|
802
807
|
style: {
|
|
803
|
-
display: "
|
|
804
|
-
|
|
805
|
-
gap: "4px"
|
|
806
|
-
padding: "2px 8px",
|
|
807
|
-
background: "#eff6ff",
|
|
808
|
-
color: "#1d4ed8",
|
|
809
|
-
borderRadius: "12px",
|
|
810
|
-
fontSize: "0.82em"
|
|
808
|
+
display: "flex",
|
|
809
|
+
flexWrap: "wrap",
|
|
810
|
+
gap: "4px"
|
|
811
811
|
},
|
|
812
|
-
children:
|
|
813
|
-
|
|
814
|
-
onClick: () => c(t),
|
|
815
|
-
disabled: e.disabled,
|
|
812
|
+
children: a.map((t) => /* @__PURE__ */ p("span", {
|
|
813
|
+
className: "gui-chip",
|
|
816
814
|
style: {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
815
|
+
display: "inline-flex",
|
|
816
|
+
alignItems: "center",
|
|
817
|
+
gap: "4px",
|
|
818
|
+
padding: "2px 8px",
|
|
819
|
+
background: "#eff6ff",
|
|
820
|
+
color: "#1d4ed8",
|
|
821
|
+
borderRadius: "12px",
|
|
822
|
+
fontSize: "0.82em"
|
|
823
823
|
},
|
|
824
|
-
children: "
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
className: "gui-ms-list",
|
|
829
|
-
style: {
|
|
830
|
-
border: "1px solid #cbd5e1",
|
|
831
|
-
borderRadius: "4px",
|
|
832
|
-
overflow: "hidden"
|
|
833
|
-
},
|
|
834
|
-
children: i.map((t, n) => {
|
|
835
|
-
let r = a.includes(t.value);
|
|
836
|
-
return /* @__PURE__ */ p("div", {
|
|
837
|
-
className: `gui-ms-item${r ? " gui-ms-item--selected" : ""}`,
|
|
838
|
-
onClick: () => !e.disabled && c(t.value),
|
|
839
|
-
style: {
|
|
840
|
-
padding: "6px 10px",
|
|
841
|
-
cursor: e.disabled ? "default" : "pointer",
|
|
842
|
-
background: r ? "#dbeafe" : n % 2 == 0 ? "#fff" : "#f8fafc",
|
|
843
|
-
color: r ? "#1d4ed8" : "#374151",
|
|
844
|
-
fontWeight: r ? 500 : 400,
|
|
845
|
-
borderBottom: n < i.length - 1 ? "1px solid #e2e8f0" : "none",
|
|
846
|
-
userSelect: "none",
|
|
847
|
-
display: "flex",
|
|
848
|
-
justifyContent: "space-between",
|
|
849
|
-
alignItems: "center"
|
|
850
|
-
},
|
|
851
|
-
children: [/* @__PURE__ */ f("span", { children: t.label }), r && /* @__PURE__ */ f("span", {
|
|
824
|
+
children: [i.find((e) => e.value === t)?.label ?? t, /* @__PURE__ */ f("button", {
|
|
825
|
+
type: "button",
|
|
826
|
+
onClick: () => u(t),
|
|
827
|
+
disabled: e.disabled,
|
|
852
828
|
style: {
|
|
853
|
-
|
|
854
|
-
|
|
829
|
+
background: "none",
|
|
830
|
+
border: "none",
|
|
831
|
+
cursor: "pointer",
|
|
832
|
+
color: "inherit",
|
|
833
|
+
padding: 0,
|
|
834
|
+
lineHeight: 1
|
|
855
835
|
},
|
|
856
|
-
children: "
|
|
836
|
+
children: "×"
|
|
857
837
|
})]
|
|
858
|
-
},
|
|
838
|
+
}, t))
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ f("div", {
|
|
841
|
+
className: "gui-ms-list",
|
|
842
|
+
style: {
|
|
843
|
+
border: "1px solid #cbd5e1",
|
|
844
|
+
borderRadius: "4px",
|
|
845
|
+
overflow: "hidden"
|
|
846
|
+
},
|
|
847
|
+
children: i.map((t, n) => {
|
|
848
|
+
let r = a.includes(t.value);
|
|
849
|
+
return /* @__PURE__ */ p("div", {
|
|
850
|
+
className: `gui-ms-item${r ? " gui-ms-item--selected" : ""}`,
|
|
851
|
+
onClick: () => !e.disabled && u(t.value),
|
|
852
|
+
style: {
|
|
853
|
+
padding: "6px 10px",
|
|
854
|
+
cursor: e.disabled ? "default" : "pointer",
|
|
855
|
+
background: r ? "#dbeafe" : n % 2 == 0 ? "#fff" : "#f8fafc",
|
|
856
|
+
color: r ? "#1d4ed8" : "#374151",
|
|
857
|
+
fontWeight: r ? 500 : 400,
|
|
858
|
+
borderBottom: n < i.length - 1 ? "1px solid #e2e8f0" : "none",
|
|
859
|
+
userSelect: "none",
|
|
860
|
+
display: "flex",
|
|
861
|
+
justifyContent: "space-between",
|
|
862
|
+
alignItems: "center"
|
|
863
|
+
},
|
|
864
|
+
children: [/* @__PURE__ */ f("span", { children: t.label }), r && /* @__PURE__ */ f("span", {
|
|
865
|
+
style: {
|
|
866
|
+
color: "#2563eb",
|
|
867
|
+
fontWeight: 700
|
|
868
|
+
},
|
|
869
|
+
children: "✓"
|
|
870
|
+
})]
|
|
871
|
+
}, n);
|
|
872
|
+
})
|
|
859
873
|
})
|
|
860
|
-
|
|
874
|
+
]
|
|
861
875
|
});
|
|
862
876
|
}
|
|
863
|
-
|
|
877
|
+
function B({ el: e, id: t, className: n, onInteract: r }) {
|
|
878
|
+
let i = e.options ?? [], [a, c] = s(() => Object.fromEntries(i.map((e) => [e.value, !1]))), l = o(null), u = e.disabled ?? !1, d = (n, i) => {
|
|
879
|
+
let o = {
|
|
880
|
+
...a,
|
|
881
|
+
[n]: i
|
|
882
|
+
};
|
|
883
|
+
c(o), l.current && (l.current.value = JSON.stringify(o)), r?.(JSON.stringify({
|
|
884
|
+
elementId: t ?? e.name,
|
|
885
|
+
name: e.name,
|
|
886
|
+
fieldType: e.field_type,
|
|
887
|
+
label: e.label || void 0,
|
|
888
|
+
action: "onChange",
|
|
889
|
+
value: o
|
|
890
|
+
}));
|
|
891
|
+
};
|
|
892
|
+
return /* @__PURE__ */ p("div", {
|
|
893
|
+
id: t,
|
|
894
|
+
className: n,
|
|
895
|
+
style: {
|
|
896
|
+
display: "flex",
|
|
897
|
+
flexDirection: "column",
|
|
898
|
+
gap: "6px"
|
|
899
|
+
},
|
|
900
|
+
children: [/* @__PURE__ */ f("input", {
|
|
901
|
+
type: "hidden",
|
|
902
|
+
ref: l,
|
|
903
|
+
name: e.name,
|
|
904
|
+
"data-value-type": "json",
|
|
905
|
+
defaultValue: JSON.stringify(a)
|
|
906
|
+
}), i.map((e, t) => /* @__PURE__ */ p("label", {
|
|
907
|
+
style: {
|
|
908
|
+
display: "flex",
|
|
909
|
+
alignItems: "center",
|
|
910
|
+
gap: "6px",
|
|
911
|
+
cursor: u ? "default" : "pointer"
|
|
912
|
+
},
|
|
913
|
+
children: [/* @__PURE__ */ f("input", {
|
|
914
|
+
type: "checkbox",
|
|
915
|
+
checked: a[e.value] ?? !1,
|
|
916
|
+
disabled: u,
|
|
917
|
+
onChange: (t) => d(e.value, t.target.checked)
|
|
918
|
+
}), e.label]
|
|
919
|
+
}, t))]
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
var V = {
|
|
864
923
|
Text: "text",
|
|
865
924
|
Password: "password",
|
|
866
925
|
Email: "email",
|
|
@@ -876,7 +935,7 @@ var H = {
|
|
|
876
935
|
Range: "range",
|
|
877
936
|
Checkbox: "checkbox"
|
|
878
937
|
};
|
|
879
|
-
function
|
|
938
|
+
function pe({ el: e, onInteract: t }) {
|
|
880
939
|
let n = e.custom_attributes ?? {}, r = e.label ?? n["data-label"] ?? void 0, i = e.placeholder ?? n["data-placeholder"] ?? e.description ?? e.name, a = e.required ?? n["data-required"] === "true", o = e.min_value ?? (n["data-min"] == null ? void 0 : Number(n["data-min"])), s = e.max_value ?? (n["data-max"] == null ? void 0 : Number(n["data-max"])), c = e.step ?? (n["data-step"] == null ? void 0 : Number(n["data-step"])), l = e.default_value;
|
|
881
940
|
l == null && n["data-default-checked"] != null && (l = String(n["data-default-checked"]).toLowerCase() === "true");
|
|
882
941
|
let u = e.options ?? [];
|
|
@@ -966,7 +1025,7 @@ function de({ el: e, onInteract: t }) {
|
|
|
966
1025
|
children: e.label
|
|
967
1026
|
}, t))]
|
|
968
1027
|
}));
|
|
969
|
-
case "MultiSelect": return w(/* @__PURE__ */ f(
|
|
1028
|
+
case "MultiSelect": return w(/* @__PURE__ */ f(fe, {
|
|
970
1029
|
el: m,
|
|
971
1030
|
id: g,
|
|
972
1031
|
className: _,
|
|
@@ -996,30 +1055,11 @@ function de({ el: e, onInteract: t }) {
|
|
|
996
1055
|
}), t.label]
|
|
997
1056
|
}, n))
|
|
998
1057
|
}));
|
|
999
|
-
case "CheckboxGroup": return w(/* @__PURE__ */ f(
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
},
|
|
1005
|
-
children: u.map((t, n) => /* @__PURE__ */ p("label", {
|
|
1006
|
-
style: {
|
|
1007
|
-
display: "flex",
|
|
1008
|
-
alignItems: "center",
|
|
1009
|
-
gap: "6px",
|
|
1010
|
-
cursor: b ? "default" : "pointer"
|
|
1011
|
-
},
|
|
1012
|
-
children: [/* @__PURE__ */ f("input", {
|
|
1013
|
-
type: "checkbox",
|
|
1014
|
-
name: `${e.name}[]`,
|
|
1015
|
-
value: t.value,
|
|
1016
|
-
disabled: b,
|
|
1017
|
-
onChange: (e) => C({
|
|
1018
|
-
option: t.value,
|
|
1019
|
-
checked: e.target.checked
|
|
1020
|
-
})
|
|
1021
|
-
}), t.label]
|
|
1022
|
-
}, n))
|
|
1058
|
+
case "CheckboxGroup": return w(/* @__PURE__ */ f(B, {
|
|
1059
|
+
el: m,
|
|
1060
|
+
id: g,
|
|
1061
|
+
className: _,
|
|
1062
|
+
onInteract: t
|
|
1023
1063
|
}));
|
|
1024
1064
|
case "Toggle": return /* @__PURE__ */ f(oe, {
|
|
1025
1065
|
el: m,
|
|
@@ -1065,7 +1105,7 @@ function de({ el: e, onInteract: t }) {
|
|
|
1065
1105
|
className: _,
|
|
1066
1106
|
onInteract: t
|
|
1067
1107
|
}));
|
|
1068
|
-
case "DateRange": return w(/* @__PURE__ */ f(
|
|
1108
|
+
case "DateRange": return w(/* @__PURE__ */ f(de, {
|
|
1069
1109
|
el: m,
|
|
1070
1110
|
id: g,
|
|
1071
1111
|
className: _,
|
|
@@ -1167,7 +1207,7 @@ function de({ el: e, onInteract: t }) {
|
|
|
1167
1207
|
onChange: (e) => C(e.target.files?.[0]?.name)
|
|
1168
1208
|
}));
|
|
1169
1209
|
default: return w(/* @__PURE__ */ f("input", {
|
|
1170
|
-
type:
|
|
1210
|
+
type: V[v] ?? v.toLowerCase(),
|
|
1171
1211
|
id: g,
|
|
1172
1212
|
name: e.name,
|
|
1173
1213
|
className: _,
|
|
@@ -1184,7 +1224,7 @@ function de({ el: e, onInteract: t }) {
|
|
|
1184
1224
|
}));
|
|
1185
1225
|
}
|
|
1186
1226
|
}
|
|
1187
|
-
function
|
|
1227
|
+
function me({ el: e, id: t, className: r, style: i }) {
|
|
1188
1228
|
let a = n(D);
|
|
1189
1229
|
return a ? /* @__PURE__ */ p("div", {
|
|
1190
1230
|
id: t,
|
|
@@ -1247,7 +1287,7 @@ function fe({ el: e, id: t, className: r, style: i }) {
|
|
|
1247
1287
|
children: "Chat widget not connected"
|
|
1248
1288
|
});
|
|
1249
1289
|
}
|
|
1250
|
-
function
|
|
1290
|
+
function H(e, t, n, r = !1) {
|
|
1251
1291
|
let i = F(e.styling), a = e.component_id ?? void 0, o = (e.css_classes ?? []).join(" ") || void 0;
|
|
1252
1292
|
switch (e.type) {
|
|
1253
1293
|
case "Text": {
|
|
@@ -1294,27 +1334,33 @@ function U(e, t, n, r = !1) {
|
|
|
1294
1334
|
},
|
|
1295
1335
|
children: e.label
|
|
1296
1336
|
}, e.name);
|
|
1297
|
-
case "Button":
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1337
|
+
case "Button": {
|
|
1338
|
+
let r = e.buttonType?.toLowerCase() ?? "";
|
|
1339
|
+
return /* @__PURE__ */ f("button", {
|
|
1340
|
+
id: a,
|
|
1341
|
+
className: [
|
|
1342
|
+
"gui-form-btn",
|
|
1343
|
+
r === "outlined button" ? "gui-form-btn--outlined" : r === "flat button" ? "gui-form-btn--flat" : r === "floating action button" ? "gui-form-btn--fab" : "gui-form-btn--submit",
|
|
1344
|
+
o
|
|
1345
|
+
].filter(Boolean).join(" "),
|
|
1346
|
+
style: {
|
|
1347
|
+
fontFamily: "inherit",
|
|
1348
|
+
lineHeight: "inherit",
|
|
1349
|
+
...i
|
|
1350
|
+
},
|
|
1351
|
+
type: "button",
|
|
1352
|
+
onClick: () => {
|
|
1353
|
+
e.actionType?.toLowerCase() === "navigate" && e.url && n?.(e.url) || t?.(JSON.stringify({
|
|
1354
|
+
elementId: a ?? e.name,
|
|
1355
|
+
name: e.name,
|
|
1356
|
+
label: e.label || void 0,
|
|
1357
|
+
actionType: e.actionType || void 0,
|
|
1358
|
+
action: "onClick"
|
|
1359
|
+
}));
|
|
1360
|
+
},
|
|
1361
|
+
children: e.label
|
|
1362
|
+
}, e.name);
|
|
1363
|
+
}
|
|
1318
1364
|
case "Image": return /* @__PURE__ */ f("img", {
|
|
1319
1365
|
id: a,
|
|
1320
1366
|
className: o,
|
|
@@ -1325,11 +1371,11 @@ function U(e, t, n, r = !1) {
|
|
|
1325
1371
|
e.target.style.display = "none";
|
|
1326
1372
|
}
|
|
1327
1373
|
}, e.name);
|
|
1328
|
-
case "InputField": return /* @__PURE__ */ f(
|
|
1374
|
+
case "InputField": return /* @__PURE__ */ f(pe, {
|
|
1329
1375
|
el: e,
|
|
1330
1376
|
onInteract: t
|
|
1331
1377
|
}, e.name);
|
|
1332
|
-
case "Form": return /* @__PURE__ */
|
|
1378
|
+
case "Form": return /* @__PURE__ */ p("form", {
|
|
1333
1379
|
id: a,
|
|
1334
1380
|
className: o,
|
|
1335
1381
|
style: {
|
|
@@ -1340,15 +1386,48 @@ function U(e, t, n, r = !1) {
|
|
|
1340
1386
|
},
|
|
1341
1387
|
onSubmit: (n) => {
|
|
1342
1388
|
n.preventDefault();
|
|
1343
|
-
let r =
|
|
1344
|
-
t
|
|
1389
|
+
let r = n.currentTarget, i = {};
|
|
1390
|
+
for (let [e, t] of new FormData(r).entries()) {
|
|
1391
|
+
let n = r.querySelector(`[name="${e}"][data-value-type="json"]`), a = r.querySelector(`[name="${e}"][data-value-type="number"]`);
|
|
1392
|
+
if (n && typeof t == "string") try {
|
|
1393
|
+
i[e] = JSON.parse(t);
|
|
1394
|
+
} catch {
|
|
1395
|
+
i[e] = t;
|
|
1396
|
+
}
|
|
1397
|
+
else a && typeof t == "string" ? i[e] = Number(t) : i[e] = t;
|
|
1398
|
+
}
|
|
1399
|
+
r.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => {
|
|
1400
|
+
e.name && (i[e.name] = e.checked);
|
|
1401
|
+
}), r.querySelectorAll("input[type=\"radio\"]").forEach((e) => {
|
|
1402
|
+
e.name && !(e.name in i) && (i[e.name] = "");
|
|
1403
|
+
}), t?.(JSON.stringify({
|
|
1345
1404
|
elementId: a ?? e.name,
|
|
1346
1405
|
name: e.name,
|
|
1347
1406
|
action: "onSubmit",
|
|
1348
|
-
value:
|
|
1407
|
+
value: i
|
|
1349
1408
|
}));
|
|
1350
1409
|
},
|
|
1351
|
-
children: (e.inputFields ?? []).map((e) =>
|
|
1410
|
+
children: [(e.inputFields ?? []).map((e) => H(e, t, n, r)), /* @__PURE__ */ p("div", {
|
|
1411
|
+
style: {
|
|
1412
|
+
display: "flex",
|
|
1413
|
+
gap: "8px",
|
|
1414
|
+
marginTop: "4px"
|
|
1415
|
+
},
|
|
1416
|
+
children: [/* @__PURE__ */ f("button", {
|
|
1417
|
+
type: "submit",
|
|
1418
|
+
className: "gui-form-btn gui-form-btn--submit",
|
|
1419
|
+
children: e.submit_label ?? "Submit"
|
|
1420
|
+
}), e.show_cancel && /* @__PURE__ */ f("button", {
|
|
1421
|
+
type: "button",
|
|
1422
|
+
className: "gui-form-btn gui-form-btn--cancel",
|
|
1423
|
+
onClick: () => t?.(JSON.stringify({
|
|
1424
|
+
elementId: a ?? e.name,
|
|
1425
|
+
name: e.name,
|
|
1426
|
+
action: "onCancel"
|
|
1427
|
+
})),
|
|
1428
|
+
children: e.cancel_label ?? "Cancel"
|
|
1429
|
+
})]
|
|
1430
|
+
})]
|
|
1352
1431
|
}, e.name);
|
|
1353
1432
|
case "Menu": return /* @__PURE__ */ f(e.tag_name && e.tag_name === "nav" ? "nav" : "div", {
|
|
1354
1433
|
id: a,
|
|
@@ -1449,7 +1528,7 @@ function U(e, t, n, r = !1) {
|
|
|
1449
1528
|
id: a,
|
|
1450
1529
|
className: o,
|
|
1451
1530
|
style: c,
|
|
1452
|
-
children: (e.view_elements ?? []).map((e) =>
|
|
1531
|
+
children: (e.view_elements ?? []).map((e) => H(e, t, n, r))
|
|
1453
1532
|
}, e.name);
|
|
1454
1533
|
}
|
|
1455
1534
|
case "LineChart":
|
|
@@ -1516,7 +1595,7 @@ function U(e, t, n, r = !1) {
|
|
|
1516
1595
|
})
|
|
1517
1596
|
]
|
|
1518
1597
|
}, e.name);
|
|
1519
|
-
case "AgentComponent": return /* @__PURE__ */ f(
|
|
1598
|
+
case "AgentComponent": return /* @__PURE__ */ f(me, {
|
|
1520
1599
|
el: e,
|
|
1521
1600
|
id: a,
|
|
1522
1601
|
className: o,
|
|
@@ -1525,96 +1604,112 @@ function U(e, t, n, r = !1) {
|
|
|
1525
1604
|
default: return null;
|
|
1526
1605
|
}
|
|
1527
1606
|
}
|
|
1528
|
-
function
|
|
1529
|
-
let
|
|
1607
|
+
function U({ content: e, onInteract: n, messageId: o, chatProps: c, chatMode: l = !1 }) {
|
|
1608
|
+
let u = "gui-s" + i().replace(/[^a-zA-Z0-9]/g, ""), d = a(() => {
|
|
1530
1609
|
try {
|
|
1531
1610
|
let t = typeof e == "string" ? e : JSON.stringify(e);
|
|
1532
1611
|
return JSON.parse(t);
|
|
1533
1612
|
} catch {
|
|
1534
1613
|
return null;
|
|
1535
1614
|
}
|
|
1536
|
-
}, [e]),
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1615
|
+
}, [e]), m = a(() => (d?.modules ?? []).flatMap((e) => e.screens), [d]), h = t((e) => {
|
|
1616
|
+
if (n) {
|
|
1617
|
+
if (!o) {
|
|
1618
|
+
n(e);
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
try {
|
|
1622
|
+
let t = JSON.parse(e);
|
|
1623
|
+
n(JSON.stringify({
|
|
1624
|
+
...t,
|
|
1625
|
+
messageId: o
|
|
1626
|
+
}));
|
|
1627
|
+
} catch {
|
|
1628
|
+
n(e);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}, [n, o]), [g, _] = s(0), v = t((e) => {
|
|
1632
|
+
let t = m.findIndex((t) => t.name === e);
|
|
1633
|
+
if (t >= 0) return _(t), !0;
|
|
1634
|
+
let n = m.findIndex((t) => t.route_path === e);
|
|
1635
|
+
if (n >= 0) return _(n), !0;
|
|
1541
1636
|
if (e === "/" || e === "") {
|
|
1542
|
-
let e =
|
|
1543
|
-
return
|
|
1637
|
+
let e = m.findIndex((e) => e.is_main_page);
|
|
1638
|
+
return _(e >= 0 ? e : 0), !0;
|
|
1544
1639
|
}
|
|
1545
1640
|
return !1;
|
|
1546
|
-
}, [
|
|
1641
|
+
}, [m]);
|
|
1547
1642
|
r(() => {
|
|
1548
|
-
let e =
|
|
1549
|
-
|
|
1550
|
-
}, [
|
|
1551
|
-
let
|
|
1643
|
+
let e = m.findIndex((e) => e.is_main_page);
|
|
1644
|
+
_(e >= 0 ? e : 0);
|
|
1645
|
+
}, [m]);
|
|
1646
|
+
let y = a(() => d?.style_entries ? te(d.style_entries, u, l) : "", [
|
|
1647
|
+
d,
|
|
1552
1648
|
u,
|
|
1553
|
-
l
|
|
1554
|
-
c
|
|
1649
|
+
l
|
|
1555
1650
|
]);
|
|
1556
1651
|
if (r(() => {
|
|
1557
|
-
if (!
|
|
1652
|
+
if (!y) return;
|
|
1558
1653
|
let e = document.createElement("style");
|
|
1559
|
-
return e.setAttribute("data-gui-scope",
|
|
1654
|
+
return e.setAttribute("data-gui-scope", u), e.textContent = y, document.head.appendChild(e), () => {
|
|
1560
1655
|
document.head.removeChild(e);
|
|
1561
1656
|
};
|
|
1562
|
-
}, [
|
|
1657
|
+
}, [y, u]), !d) return /* @__PURE__ */ f("p", {
|
|
1563
1658
|
className: "msg-text--muted",
|
|
1564
1659
|
children: "[Invalid UI definition]"
|
|
1565
1660
|
});
|
|
1566
|
-
let
|
|
1567
|
-
if (!
|
|
1661
|
+
let b = m[g];
|
|
1662
|
+
if (!b) return /* @__PURE__ */ f("p", {
|
|
1568
1663
|
className: "msg-text--muted",
|
|
1569
1664
|
children: "[No screens defined]"
|
|
1570
1665
|
});
|
|
1571
|
-
let
|
|
1666
|
+
let x = d.modules.length > 1, S = m.length > 1;
|
|
1572
1667
|
return /* @__PURE__ */ f(D.Provider, {
|
|
1573
|
-
value:
|
|
1668
|
+
value: c ?? null,
|
|
1574
1669
|
children: /* @__PURE__ */ p("div", {
|
|
1575
|
-
className: `gui-renderer${
|
|
1576
|
-
children: [(
|
|
1670
|
+
className: `gui-renderer${l ? " gui-renderer--chat" : ""}`,
|
|
1671
|
+
children: [(x || S) && /* @__PURE__ */ f("div", {
|
|
1577
1672
|
className: "gui-renderer__tabs",
|
|
1578
1673
|
role: "tablist",
|
|
1579
|
-
children:
|
|
1674
|
+
children: m.map((e, t) => /* @__PURE__ */ p("button", {
|
|
1580
1675
|
role: "tab",
|
|
1581
|
-
"aria-selected": t ===
|
|
1582
|
-
className: `gui-renderer__tab${t ===
|
|
1583
|
-
onClick: () =>
|
|
1676
|
+
"aria-selected": t === g,
|
|
1677
|
+
className: `gui-renderer__tab${t === g ? " gui-renderer__tab--active" : ""}`,
|
|
1678
|
+
onClick: () => _(t),
|
|
1584
1679
|
children: [e.name, e.is_main_page && /* @__PURE__ */ f("span", {
|
|
1585
1680
|
className: "gui-renderer__tab-badge",
|
|
1586
1681
|
children: "home"
|
|
1587
1682
|
})]
|
|
1588
1683
|
}, t))
|
|
1589
1684
|
}), /* @__PURE__ */ f("div", {
|
|
1590
|
-
className: `gui-renderer__screen ${
|
|
1591
|
-
children: (
|
|
1685
|
+
className: `gui-renderer__screen ${u}`,
|
|
1686
|
+
children: (b.view_elements ?? []).map((e) => H(e, h, v, l))
|
|
1592
1687
|
})]
|
|
1593
1688
|
})
|
|
1594
1689
|
});
|
|
1595
1690
|
}
|
|
1596
1691
|
//#endregion
|
|
1597
1692
|
//#region src/components/ReasoningTrace.tsx
|
|
1598
|
-
var
|
|
1693
|
+
var he = new Set([
|
|
1599
1694
|
h.TASK_ADDED,
|
|
1600
1695
|
h.TASK_COMPLETED,
|
|
1601
1696
|
h.TASK_SKIPPED
|
|
1602
|
-
]),
|
|
1697
|
+
]), ge = new Set([
|
|
1603
1698
|
"add_tasks",
|
|
1604
1699
|
"complete_task",
|
|
1605
1700
|
"skip_task"
|
|
1606
1701
|
]);
|
|
1607
|
-
function
|
|
1702
|
+
function _e(e) {
|
|
1608
1703
|
if (e.kind !== h.LLM_TOOL_CALLS) return !1;
|
|
1609
1704
|
let t = e.details?.tool_calls ?? [];
|
|
1610
|
-
return t.length === 0 ? !1 : t.every((e) => e.name !== void 0 &&
|
|
1705
|
+
return t.length === 0 ? !1 : t.every((e) => e.name !== void 0 && ge.has(e.name));
|
|
1611
1706
|
}
|
|
1612
|
-
function
|
|
1707
|
+
function W({ trace: e }) {
|
|
1613
1708
|
let [t, n] = s(e.inProgress);
|
|
1614
1709
|
r(() => {
|
|
1615
1710
|
e.inProgress || n(!1);
|
|
1616
1711
|
}, [e.inProgress]);
|
|
1617
|
-
let i = e.inProgress || t, a = e.steps.filter((e) => !(e.kind === h.REASONING_STARTED || e.kind === h.REASONING_FINISHED ||
|
|
1712
|
+
let i = e.inProgress || t, a = e.steps.filter((e) => !(e.kind === h.REASONING_STARTED || e.kind === h.REASONING_FINISHED || he.has(e.kind) || _e(e))), o = new Set(a.map((e) => e.step)).size;
|
|
1618
1713
|
return /* @__PURE__ */ p("div", {
|
|
1619
1714
|
className: `reasoning-trace${e.inProgress ? " reasoning-trace--live" : ""}`,
|
|
1620
1715
|
children: [/* @__PURE__ */ p("button", {
|
|
@@ -1643,18 +1738,18 @@ function G({ trace: e }) {
|
|
|
1643
1738
|
className: `reasoning-trace__body-wrapper${i ? " reasoning-trace__body-wrapper--open" : ""}`,
|
|
1644
1739
|
children: /* @__PURE__ */ p("div", {
|
|
1645
1740
|
className: "reasoning-trace__body-inner",
|
|
1646
|
-
children: [/* @__PURE__ */ f(
|
|
1741
|
+
children: [/* @__PURE__ */ f(be, { steps: a }), e.tasks.length > 0 && /* @__PURE__ */ f(ve, { tasks: e.tasks })]
|
|
1647
1742
|
})
|
|
1648
1743
|
})]
|
|
1649
1744
|
});
|
|
1650
1745
|
}
|
|
1651
|
-
var
|
|
1746
|
+
var G = {
|
|
1652
1747
|
[g.PENDING]: "pending",
|
|
1653
1748
|
[g.IN_PROGRESS]: "in progress",
|
|
1654
1749
|
[g.COMPLETED]: "completed",
|
|
1655
1750
|
[g.SKIPPED]: "skipped"
|
|
1656
1751
|
};
|
|
1657
|
-
function
|
|
1752
|
+
function ve({ tasks: e }) {
|
|
1658
1753
|
let t = e.reduce((e, t) => (e[t.status] = (e[t.status] ?? 0) + 1, e), {}), n = t[g.COMPLETED] ?? 0, r = t[g.SKIPPED] ?? 0, i = (t[g.PENDING] ?? 0) + (t[g.IN_PROGRESS] ?? 0);
|
|
1659
1754
|
return /* @__PURE__ */ p("div", {
|
|
1660
1755
|
className: "task-panel",
|
|
@@ -1686,8 +1781,8 @@ function ge({ tasks: e }) {
|
|
|
1686
1781
|
className: `task-panel__item task-panel__item--${e.status}`,
|
|
1687
1782
|
children: [/* @__PURE__ */ f("span", {
|
|
1688
1783
|
className: `task-panel__box task-panel__box--${e.status}`,
|
|
1689
|
-
title:
|
|
1690
|
-
"aria-label":
|
|
1784
|
+
title: G[e.status] ?? e.status,
|
|
1785
|
+
"aria-label": G[e.status] ?? e.status
|
|
1691
1786
|
}), /* @__PURE__ */ p("span", {
|
|
1692
1787
|
className: "task-panel__text",
|
|
1693
1788
|
children: [
|
|
@@ -1710,7 +1805,7 @@ function ge({ tasks: e }) {
|
|
|
1710
1805
|
})]
|
|
1711
1806
|
});
|
|
1712
1807
|
}
|
|
1713
|
-
function
|
|
1808
|
+
function ye(e) {
|
|
1714
1809
|
let t = [], n = 0;
|
|
1715
1810
|
for (; n < e.length;) if (e[n].kind === h.TOOL_RESULT) {
|
|
1716
1811
|
let r = n;
|
|
@@ -1731,7 +1826,7 @@ function _e(e) {
|
|
|
1731
1826
|
}), n++;
|
|
1732
1827
|
return t;
|
|
1733
1828
|
}
|
|
1734
|
-
function
|
|
1829
|
+
function be({ steps: e }) {
|
|
1735
1830
|
let t = [];
|
|
1736
1831
|
for (let n of e) {
|
|
1737
1832
|
let e = t[t.length - 1];
|
|
@@ -1750,12 +1845,12 @@ function ve({ steps: e }) {
|
|
|
1750
1845
|
children: ["STEP ", t]
|
|
1751
1846
|
}), /* @__PURE__ */ f("ol", {
|
|
1752
1847
|
className: "reasoning-trace__step-list",
|
|
1753
|
-
children:
|
|
1848
|
+
children: ye(e.events).map((e, t) => e.type === "tool_result_group" ? /* @__PURE__ */ f(Se, { steps: e.steps }, t) : /* @__PURE__ */ f(K, { step: e.step }, t))
|
|
1754
1849
|
})]
|
|
1755
1850
|
}, t))
|
|
1756
1851
|
});
|
|
1757
1852
|
}
|
|
1758
|
-
var
|
|
1853
|
+
var xe = {
|
|
1759
1854
|
[h.LLM_TEXT]: "💬",
|
|
1760
1855
|
[h.LLM_TOOL_CALLS]: "🛠️",
|
|
1761
1856
|
[h.TOOL_RESULT]: "📥",
|
|
@@ -1765,7 +1860,7 @@ var q = {
|
|
|
1765
1860
|
[h.PUSHBACK]: "↩️",
|
|
1766
1861
|
[h.MAX_STEPS]: "⏱️"
|
|
1767
1862
|
};
|
|
1768
|
-
function
|
|
1863
|
+
function Se({ steps: e }) {
|
|
1769
1864
|
let [t, n] = s(!1);
|
|
1770
1865
|
return /* @__PURE__ */ p("li", {
|
|
1771
1866
|
className: "reasoning-trace__step",
|
|
@@ -1801,12 +1896,12 @@ function ye({ steps: e }) {
|
|
|
1801
1896
|
]
|
|
1802
1897
|
}), t && /* @__PURE__ */ f("ol", {
|
|
1803
1898
|
className: "reasoning-trace__step-list reasoning-trace__step-list--nested",
|
|
1804
|
-
children: e.map((e, t) => /* @__PURE__ */ f(
|
|
1899
|
+
children: e.map((e, t) => /* @__PURE__ */ f(K, { step: e }, t))
|
|
1805
1900
|
})]
|
|
1806
1901
|
});
|
|
1807
1902
|
}
|
|
1808
|
-
function
|
|
1809
|
-
let [t, n] = s(!1), r =
|
|
1903
|
+
function K({ step: e }) {
|
|
1904
|
+
let [t, n] = s(!1), r = xe[e.kind] ?? "🔹", i = e.details && Object.keys(e.details).length > 0;
|
|
1810
1905
|
return /* @__PURE__ */ p("li", {
|
|
1811
1906
|
className: "reasoning-trace__step",
|
|
1812
1907
|
children: [/* @__PURE__ */ p("button", {
|
|
@@ -1831,29 +1926,29 @@ function J({ step: e }) {
|
|
|
1831
1926
|
}
|
|
1832
1927
|
//#endregion
|
|
1833
1928
|
//#region src/components/MessageBubble.tsx
|
|
1834
|
-
function
|
|
1835
|
-
let {
|
|
1836
|
-
if (!
|
|
1837
|
-
let e =
|
|
1929
|
+
function q({ message: e, onOptionSelect: t, onUIInteract: n }) {
|
|
1930
|
+
let { id: r, action: i, message: a, isUser: o, timestamp: s } = e, c = s ?? null;
|
|
1931
|
+
if (!o && i === "reasoning_trace") {
|
|
1932
|
+
let e = a;
|
|
1838
1933
|
return x(e) ? null : /* @__PURE__ */ p("div", {
|
|
1839
1934
|
className: "message message--agent message--reasoning",
|
|
1840
|
-
children: [
|
|
1935
|
+
children: [c && /* @__PURE__ */ f("span", {
|
|
1841
1936
|
className: "message__timestamp",
|
|
1842
|
-
children:
|
|
1937
|
+
children: c
|
|
1843
1938
|
}), /* @__PURE__ */ f("div", {
|
|
1844
1939
|
className: "message__body",
|
|
1845
|
-
children: /* @__PURE__ */ f(
|
|
1940
|
+
children: /* @__PURE__ */ f(W, { trace: e })
|
|
1846
1941
|
})]
|
|
1847
1942
|
});
|
|
1848
1943
|
}
|
|
1849
|
-
if (
|
|
1850
|
-
if (
|
|
1851
|
-
let e = typeof
|
|
1944
|
+
if (o) {
|
|
1945
|
+
if (i === m.USER_VOICE) {
|
|
1946
|
+
let e = typeof a == "string" ? a : a.data;
|
|
1852
1947
|
return /* @__PURE__ */ p("div", {
|
|
1853
1948
|
className: "message message--user",
|
|
1854
|
-
children: [
|
|
1949
|
+
children: [c && /* @__PURE__ */ f("span", {
|
|
1855
1950
|
className: "message__timestamp message__timestamp--user",
|
|
1856
|
-
children:
|
|
1951
|
+
children: c
|
|
1857
1952
|
}), /* @__PURE__ */ f("div", {
|
|
1858
1953
|
className: "message__body",
|
|
1859
1954
|
children: /* @__PURE__ */ f("div", {
|
|
@@ -1863,47 +1958,57 @@ function Y({ message: e, onOptionSelect: t, onUIInteract: n }) {
|
|
|
1863
1958
|
})]
|
|
1864
1959
|
});
|
|
1865
1960
|
}
|
|
1866
|
-
return
|
|
1961
|
+
return i === m.USER_FILE ? /* @__PURE__ */ p("div", {
|
|
1867
1962
|
className: "message message--user",
|
|
1868
|
-
children: [
|
|
1963
|
+
children: [c && /* @__PURE__ */ f("span", {
|
|
1869
1964
|
className: "message__timestamp message__timestamp--user",
|
|
1870
|
-
children:
|
|
1965
|
+
children: c
|
|
1871
1966
|
}), /* @__PURE__ */ f("div", {
|
|
1872
1967
|
className: "message__body",
|
|
1873
1968
|
children: /* @__PURE__ */ f("div", {
|
|
1874
1969
|
className: "message__bubble message__bubble--user message__bubble--media",
|
|
1875
|
-
children: /* @__PURE__ */ f(
|
|
1970
|
+
children: /* @__PURE__ */ f(J, { content: a })
|
|
1876
1971
|
})
|
|
1877
1972
|
})]
|
|
1878
1973
|
}) : /* @__PURE__ */ p("div", {
|
|
1879
1974
|
className: "message message--user",
|
|
1880
|
-
children: [
|
|
1975
|
+
children: [c && /* @__PURE__ */ f("span", {
|
|
1881
1976
|
className: "message__timestamp message__timestamp--user",
|
|
1882
|
-
children:
|
|
1977
|
+
children: c
|
|
1883
1978
|
}), /* @__PURE__ */ f("div", {
|
|
1884
1979
|
className: "message__body",
|
|
1885
1980
|
children: /* @__PURE__ */ f("div", {
|
|
1886
1981
|
className: "message__bubble message__bubble--user",
|
|
1887
|
-
children: typeof
|
|
1982
|
+
children: typeof a == "string" ? a : JSON.stringify(a)
|
|
1888
1983
|
})
|
|
1889
1984
|
})]
|
|
1890
1985
|
});
|
|
1891
1986
|
}
|
|
1987
|
+
let l, u;
|
|
1988
|
+
if (i === m.AGENT_REPLY_GUI) try {
|
|
1989
|
+
let e = typeof a == "string" ? JSON.parse(a) : a;
|
|
1990
|
+
e?.width && (l = {
|
|
1991
|
+
width: e.width,
|
|
1992
|
+
maxWidth: e.width
|
|
1993
|
+
}, u = { width: "100%" });
|
|
1994
|
+
} catch {}
|
|
1892
1995
|
return /* @__PURE__ */ p("div", {
|
|
1893
1996
|
className: "message message--agent",
|
|
1894
|
-
|
|
1997
|
+
style: l,
|
|
1998
|
+
children: [c && /* @__PURE__ */ f("span", {
|
|
1895
1999
|
className: "message__timestamp",
|
|
1896
|
-
children:
|
|
2000
|
+
children: c
|
|
1897
2001
|
}), /* @__PURE__ */ f("div", {
|
|
1898
2002
|
className: "message__body",
|
|
2003
|
+
style: u,
|
|
1899
2004
|
children: /* @__PURE__ */ f("div", {
|
|
1900
2005
|
className: "message__bubble message__bubble--agent",
|
|
1901
|
-
children:
|
|
2006
|
+
children: Ce(i, a, t, n, r)
|
|
1902
2007
|
})
|
|
1903
2008
|
})]
|
|
1904
2009
|
});
|
|
1905
2010
|
}
|
|
1906
|
-
function
|
|
2011
|
+
function Ce(e, t, n, r, i) {
|
|
1907
2012
|
switch (e) {
|
|
1908
2013
|
case m.AGENT_REPLY_STR: {
|
|
1909
2014
|
let e = String(t), n = E(e);
|
|
@@ -1950,20 +2055,21 @@ function be(e, t, n, r) {
|
|
|
1950
2055
|
FORCE_BODY: !0
|
|
1951
2056
|
}) }
|
|
1952
2057
|
});
|
|
1953
|
-
case m.AGENT_REPLY_FILE: return /* @__PURE__ */ f(
|
|
1954
|
-
case m.AGENT_REPLY_IMAGE: return /* @__PURE__ */ f(
|
|
1955
|
-
case m.AGENT_REPLY_DF: return /* @__PURE__ */ f(
|
|
1956
|
-
case m.AGENT_REPLY_PLOTLY: return /* @__PURE__ */ f(
|
|
1957
|
-
case m.AGENT_REPLY_OPTIONS: return /* @__PURE__ */ f(
|
|
2058
|
+
case m.AGENT_REPLY_FILE: return /* @__PURE__ */ f(J, { content: t });
|
|
2059
|
+
case m.AGENT_REPLY_IMAGE: return /* @__PURE__ */ f(we, { content: t });
|
|
2060
|
+
case m.AGENT_REPLY_DF: return /* @__PURE__ */ f(Te, { content: t });
|
|
2061
|
+
case m.AGENT_REPLY_PLOTLY: return /* @__PURE__ */ f(Ee, { content: t });
|
|
2062
|
+
case m.AGENT_REPLY_OPTIONS: return /* @__PURE__ */ f(De, {
|
|
1958
2063
|
content: t,
|
|
1959
2064
|
onSelect: n
|
|
1960
2065
|
});
|
|
1961
|
-
case m.AGENT_REPLY_LOCATION: return /* @__PURE__ */ f(
|
|
1962
|
-
case m.AGENT_REPLY_RAG: return /* @__PURE__ */ f(
|
|
1963
|
-
case m.AGENT_REPLY_AUDIO: return /* @__PURE__ */ f(
|
|
1964
|
-
case m.AGENT_REPLY_GUI: return /* @__PURE__ */ f(
|
|
2066
|
+
case m.AGENT_REPLY_LOCATION: return /* @__PURE__ */ f(Oe, { content: t });
|
|
2067
|
+
case m.AGENT_REPLY_RAG: return /* @__PURE__ */ f(ke, { content: t });
|
|
2068
|
+
case m.AGENT_REPLY_AUDIO: return /* @__PURE__ */ f(Ae, { content: t });
|
|
2069
|
+
case m.AGENT_REPLY_GUI: return /* @__PURE__ */ f(U, {
|
|
1965
2070
|
content: t,
|
|
1966
2071
|
onInteract: r,
|
|
2072
|
+
messageId: i,
|
|
1967
2073
|
chatMode: !0
|
|
1968
2074
|
});
|
|
1969
2075
|
default: return /* @__PURE__ */ p("p", {
|
|
@@ -1976,7 +2082,7 @@ function be(e, t, n, r) {
|
|
|
1976
2082
|
});
|
|
1977
2083
|
}
|
|
1978
2084
|
}
|
|
1979
|
-
function
|
|
2085
|
+
function J({ content: e }) {
|
|
1980
2086
|
let t = e, n = t.data ?? t.base64 ?? "";
|
|
1981
2087
|
function r() {
|
|
1982
2088
|
try {
|
|
@@ -1994,7 +2100,7 @@ function X({ content: e }) {
|
|
|
1994
2100
|
children: ["📄 ", t.name ?? "Download file"]
|
|
1995
2101
|
});
|
|
1996
2102
|
}
|
|
1997
|
-
function
|
|
2103
|
+
function we({ content: e }) {
|
|
1998
2104
|
let t, n;
|
|
1999
2105
|
if (typeof e == "string") t = e, n = "image/png";
|
|
2000
2106
|
else {
|
|
@@ -2015,7 +2121,7 @@ function xe({ content: e }) {
|
|
|
2015
2121
|
children: "Image unavailable"
|
|
2016
2122
|
});
|
|
2017
2123
|
}
|
|
2018
|
-
function
|
|
2124
|
+
function Te({ content: e }) {
|
|
2019
2125
|
let [t, n] = s(null), [r, i] = s(!0), a = [], o = [];
|
|
2020
2126
|
if (Array.isArray(e) && e.length > 0) a = Object.keys(e[0]), o = e.map((e) => a.map((t) => e[t]));
|
|
2021
2127
|
else if (typeof e == "object" && e) {
|
|
@@ -2056,7 +2162,7 @@ function Se({ content: e }) {
|
|
|
2056
2162
|
})
|
|
2057
2163
|
});
|
|
2058
2164
|
}
|
|
2059
|
-
function
|
|
2165
|
+
function Ee({ content: e }) {
|
|
2060
2166
|
let t = o(null);
|
|
2061
2167
|
return r(() => {
|
|
2062
2168
|
let n = t.current;
|
|
@@ -2086,7 +2192,7 @@ function Ce({ content: e }) {
|
|
|
2086
2192
|
className: "msg-plotly"
|
|
2087
2193
|
});
|
|
2088
2194
|
}
|
|
2089
|
-
function
|
|
2195
|
+
function De({ content: e, onSelect: t }) {
|
|
2090
2196
|
let n;
|
|
2091
2197
|
return n = Array.isArray(e) ? e.map(String) : typeof e == "object" && e ? Object.values(e).map(String) : [], /* @__PURE__ */ f("div", {
|
|
2092
2198
|
className: "msg-options",
|
|
@@ -2097,7 +2203,7 @@ function we({ content: e, onSelect: t }) {
|
|
|
2097
2203
|
}, n))
|
|
2098
2204
|
});
|
|
2099
2205
|
}
|
|
2100
|
-
function
|
|
2206
|
+
function Oe({ content: e }) {
|
|
2101
2207
|
let { latitude: t, longitude: n, zoom: r = 15 } = e, i = 360 / 2 ** (r + 1), a = `https://www.openstreetmap.org/export/embed.html?bbox=${`${n - i},${t - i},${n + i},${t + i}`}&layer=mapnik&marker=${t},${n}`, o = `https://www.openstreetmap.org/?mlat=${t}&mlon=${n}#map=${r}/${t}/${n}`;
|
|
2102
2208
|
return /* @__PURE__ */ p("div", {
|
|
2103
2209
|
className: "msg-location",
|
|
@@ -2122,7 +2228,7 @@ function Te({ content: e }) {
|
|
|
2122
2228
|
})]
|
|
2123
2229
|
});
|
|
2124
2230
|
}
|
|
2125
|
-
function
|
|
2231
|
+
function ke({ content: e }) {
|
|
2126
2232
|
let [t, n] = s(!1), r = e, i = r.docs ?? r.documents ?? [];
|
|
2127
2233
|
return /* @__PURE__ */ p("div", {
|
|
2128
2234
|
className: "msg-rag",
|
|
@@ -2225,45 +2331,78 @@ function Ee({ content: e }) {
|
|
|
2225
2331
|
})]
|
|
2226
2332
|
});
|
|
2227
2333
|
}
|
|
2228
|
-
function
|
|
2229
|
-
let
|
|
2334
|
+
function Y(e, t, n) {
|
|
2335
|
+
for (let r = 0; r < n.length; r++) e.setUint8(t + r, n.charCodeAt(r));
|
|
2336
|
+
return t + n.length;
|
|
2337
|
+
}
|
|
2338
|
+
function X(e, t, n, r) {
|
|
2339
|
+
let i = r.length > 1 ? r[0] : 1, a = r.length > 1 ? r[r.length - 1] : r[0], o, s, c;
|
|
2340
|
+
if (n === "int16") o = e, s = 16, c = 1;
|
|
2341
|
+
else {
|
|
2342
|
+
let t;
|
|
2343
|
+
if (n === "float32") t = new Float32Array(e);
|
|
2344
|
+
else if (n === "float64") {
|
|
2345
|
+
let n = new Float64Array(e);
|
|
2346
|
+
t = new Float32Array(n.length);
|
|
2347
|
+
for (let e = 0; e < n.length; e++) t[e] = n[e];
|
|
2348
|
+
} else if (n === "int32") {
|
|
2349
|
+
let n = new Int32Array(e);
|
|
2350
|
+
t = new Float32Array(n.length);
|
|
2351
|
+
for (let e = 0; e < n.length; e++) t[e] = n[e] / 2147483648;
|
|
2352
|
+
} else t = new Float32Array(e);
|
|
2353
|
+
if (i > 1) {
|
|
2354
|
+
let e = new Float32Array(i * a);
|
|
2355
|
+
for (let n = 0; n < a; n++) for (let r = 0; r < i; r++) e[n * i + r] = t[r * a + n];
|
|
2356
|
+
o = e.buffer;
|
|
2357
|
+
} else o = t.buffer;
|
|
2358
|
+
s = 32, c = 3;
|
|
2359
|
+
}
|
|
2360
|
+
let l = o.byteLength, u = new ArrayBuffer(44 + l), d = new DataView(u), f = 0;
|
|
2361
|
+
return f = Y(d, f, "RIFF"), d.setUint32(f, 36 + l, !0), f += 4, f = Y(d, f, "WAVE"), f = Y(d, f, "fmt "), d.setUint32(f, 16, !0), f += 4, d.setUint16(f, c, !0), f += 2, d.setUint16(f, i, !0), f += 2, d.setUint32(f, t, !0), f += 4, d.setUint32(f, t * i * s / 8, !0), f += 4, d.setUint16(f, i * s / 8, !0), f += 2, d.setUint16(f, s, !0), f += 2, f = Y(d, f, "data"), d.setUint32(f, l, !0), f += 4, new Uint8Array(u, f).set(new Uint8Array(o)), new Blob([u], { type: "audio/wav" });
|
|
2362
|
+
}
|
|
2363
|
+
function Z({ data: e, sampleRate: t, dtype: n, shape: i }) {
|
|
2364
|
+
let [a, o] = s(null);
|
|
2230
2365
|
return r(() => {
|
|
2231
|
-
let
|
|
2366
|
+
let r = null;
|
|
2232
2367
|
try {
|
|
2233
|
-
let
|
|
2234
|
-
for (let e = 0; e <
|
|
2235
|
-
let
|
|
2236
|
-
n = URL.createObjectURL(
|
|
2368
|
+
let a = atob(e), s = new Uint8Array(a.length);
|
|
2369
|
+
for (let e = 0; e < a.length; e++) s[e] = a.charCodeAt(e);
|
|
2370
|
+
let c;
|
|
2371
|
+
c = t && n && i ? X(s.buffer, t, n, i) : new Blob([s], { type: "audio/wav" }), r = URL.createObjectURL(c), o(r);
|
|
2237
2372
|
} catch {
|
|
2238
|
-
|
|
2373
|
+
o(null);
|
|
2239
2374
|
}
|
|
2240
2375
|
return () => {
|
|
2241
|
-
|
|
2376
|
+
r && URL.revokeObjectURL(r);
|
|
2242
2377
|
};
|
|
2243
|
-
}, [
|
|
2378
|
+
}, [
|
|
2379
|
+
e,
|
|
2380
|
+
t,
|
|
2381
|
+
n,
|
|
2382
|
+
JSON.stringify(i)
|
|
2383
|
+
]), a ? /* @__PURE__ */ f("audio", {
|
|
2244
2384
|
controls: !0,
|
|
2245
|
-
src:
|
|
2385
|
+
src: a,
|
|
2246
2386
|
className: "msg-audio__player"
|
|
2247
2387
|
}) : /* @__PURE__ */ f("span", {
|
|
2248
2388
|
className: "msg-text--muted",
|
|
2249
2389
|
children: "Audio unavailable"
|
|
2250
2390
|
});
|
|
2251
2391
|
}
|
|
2252
|
-
function
|
|
2253
|
-
|
|
2254
|
-
|
|
2392
|
+
function Ae({ content: e }) {
|
|
2393
|
+
if (typeof e != "object" || !e) return /* @__PURE__ */ f("span", {
|
|
2394
|
+
className: "msg-text--muted",
|
|
2395
|
+
children: "Audio unavailable"
|
|
2396
|
+
});
|
|
2397
|
+
let t = e, n = t.metadata ?? {};
|
|
2398
|
+
return /* @__PURE__ */ f("div", {
|
|
2255
2399
|
className: "msg-audio",
|
|
2256
|
-
children:
|
|
2257
|
-
data: t.
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
t.sample_rate,
|
|
2263
|
-
" Hz",
|
|
2264
|
-
t.dtype ? ` · ${t.dtype}` : ""
|
|
2265
|
-
]
|
|
2266
|
-
})]
|
|
2400
|
+
children: /* @__PURE__ */ f(Z, {
|
|
2401
|
+
data: t.audio_data_base64,
|
|
2402
|
+
sampleRate: n.sample_rate,
|
|
2403
|
+
dtype: n.dtype,
|
|
2404
|
+
shape: n.shape
|
|
2405
|
+
})
|
|
2267
2406
|
});
|
|
2268
2407
|
}
|
|
2269
2408
|
//#endregion
|
|
@@ -2361,7 +2500,7 @@ function $({ messages: e, setMessages: n, status: i, send: a }) {
|
|
|
2361
2500
|
}]), a(m.USER_MESSAGE, e);
|
|
2362
2501
|
}
|
|
2363
2502
|
function j(e) {
|
|
2364
|
-
a(m.
|
|
2503
|
+
a(m.USER_GUI_EVENT, e);
|
|
2365
2504
|
}
|
|
2366
2505
|
function M(e) {
|
|
2367
2506
|
let t = Array.from(e.target.files ?? []);
|
|
@@ -2390,7 +2529,7 @@ function $({ messages: e, setMessages: n, status: i, send: a }) {
|
|
|
2390
2529
|
children: [e.length === 0 && /* @__PURE__ */ f("div", {
|
|
2391
2530
|
className: "chat-area__empty",
|
|
2392
2531
|
children: i === "connecting" ? "Connecting to agent…" : i === "connected" ? "Send a message to start the conversation" : i === "error" ? "Connection error — check the agent URL" : "Disconnected"
|
|
2393
|
-
}), e.map((e) => /* @__PURE__ */ f(
|
|
2532
|
+
}), e.map((e) => /* @__PURE__ */ f(q, {
|
|
2394
2533
|
message: e,
|
|
2395
2534
|
onOptionSelect: A,
|
|
2396
2535
|
onUIInteract: j
|
|
@@ -2533,8 +2672,122 @@ function $({ messages: e, setMessages: n, status: i, send: a }) {
|
|
|
2533
2672
|
});
|
|
2534
2673
|
}
|
|
2535
2674
|
//#endregion
|
|
2675
|
+
//#region src/components/SessionSidebar.tsx
|
|
2676
|
+
function je({ agentName: e, username: n, selectedSessionId: i, onSelectSession: a, onDeleteSession: c, onSessionsLoaded: l, refreshKey: u = 0, sessionName: d, onSessionNameChange: m, onStartSession: h }) {
|
|
2677
|
+
let [g, _] = s([]), [v, y] = s(!1), [b, x] = s(null), S = o(l);
|
|
2678
|
+
S.current = l;
|
|
2679
|
+
let C = t(() => {
|
|
2680
|
+
let t = new URLSearchParams({ agent_name: e });
|
|
2681
|
+
return n && t.set("username", n), fetch(`/api/sessions?${t.toString()}`).then((e) => {
|
|
2682
|
+
if (!e.ok) throw Error(`Server error ${e.status}`);
|
|
2683
|
+
return e.json();
|
|
2684
|
+
}).then((e) => {
|
|
2685
|
+
_(e), S.current?.(e), x(null);
|
|
2686
|
+
}).catch((e) => x(e.message));
|
|
2687
|
+
}, [e, n]);
|
|
2688
|
+
r(() => {
|
|
2689
|
+
y(!0), C().finally(() => y(!1));
|
|
2690
|
+
let e = setInterval(C, 5e3);
|
|
2691
|
+
return () => clearInterval(e);
|
|
2692
|
+
}, [C, u]);
|
|
2693
|
+
function w(e) {
|
|
2694
|
+
return new Date(e).toLocaleString(void 0, {
|
|
2695
|
+
month: "short",
|
|
2696
|
+
day: "numeric",
|
|
2697
|
+
hour: "2-digit",
|
|
2698
|
+
minute: "2-digit"
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
return /* @__PURE__ */ p("aside", {
|
|
2702
|
+
className: "session-sidebar",
|
|
2703
|
+
children: [/* @__PURE__ */ p("div", {
|
|
2704
|
+
className: "session-sidebar__header",
|
|
2705
|
+
children: [/* @__PURE__ */ f("span", {
|
|
2706
|
+
className: "session-sidebar__title",
|
|
2707
|
+
children: "Sessions"
|
|
2708
|
+
}), /* @__PURE__ */ p("div", {
|
|
2709
|
+
className: "session-sidebar__new",
|
|
2710
|
+
children: [/* @__PURE__ */ f("input", {
|
|
2711
|
+
className: "session-sidebar__name-input",
|
|
2712
|
+
value: d,
|
|
2713
|
+
onChange: (e) => m(e.target.value),
|
|
2714
|
+
placeholder: "Session name (optional)",
|
|
2715
|
+
onKeyDown: (e) => e.key === "Enter" && h()
|
|
2716
|
+
}), /* @__PURE__ */ f("button", {
|
|
2717
|
+
className: "btn btn--primary session-sidebar__start-btn",
|
|
2718
|
+
onClick: h,
|
|
2719
|
+
children: "+ New session"
|
|
2720
|
+
})]
|
|
2721
|
+
})]
|
|
2722
|
+
}), /* @__PURE__ */ p("div", {
|
|
2723
|
+
className: "session-sidebar__body",
|
|
2724
|
+
children: [
|
|
2725
|
+
v && /* @__PURE__ */ f("div", {
|
|
2726
|
+
className: "session-sidebar__status",
|
|
2727
|
+
children: "Loading…"
|
|
2728
|
+
}),
|
|
2729
|
+
!v && b && /* @__PURE__ */ f("div", {
|
|
2730
|
+
className: "session-sidebar__status session-sidebar__status--error",
|
|
2731
|
+
children: b
|
|
2732
|
+
}),
|
|
2733
|
+
!v && !b && g.length === 0 && /* @__PURE__ */ f("div", {
|
|
2734
|
+
className: "session-sidebar__status",
|
|
2735
|
+
children: "No sessions found"
|
|
2736
|
+
}),
|
|
2737
|
+
!v && !b && g.map((e) => {
|
|
2738
|
+
let t = i === e.session_id;
|
|
2739
|
+
return /* @__PURE__ */ p("div", {
|
|
2740
|
+
className: `session-item${t ? " session-item--active" : ""}`,
|
|
2741
|
+
children: [/* @__PURE__ */ p("button", {
|
|
2742
|
+
className: "session-item__content",
|
|
2743
|
+
onClick: () => a(e),
|
|
2744
|
+
children: [
|
|
2745
|
+
/* @__PURE__ */ f("div", {
|
|
2746
|
+
className: "session-item__id",
|
|
2747
|
+
title: e.session_id,
|
|
2748
|
+
children: e.session_name ?? e.session_id
|
|
2749
|
+
}),
|
|
2750
|
+
e.session_name && /* @__PURE__ */ f("div", {
|
|
2751
|
+
className: "session-item__meta",
|
|
2752
|
+
children: e.session_id
|
|
2753
|
+
}),
|
|
2754
|
+
/* @__PURE__ */ f("div", {
|
|
2755
|
+
className: "session-item__meta",
|
|
2756
|
+
children: w(e.timestamp)
|
|
2757
|
+
})
|
|
2758
|
+
]
|
|
2759
|
+
}), t && /* @__PURE__ */ f("button", {
|
|
2760
|
+
className: "session-item__delete",
|
|
2761
|
+
title: "Delete session",
|
|
2762
|
+
onClick: () => c(e),
|
|
2763
|
+
children: /* @__PURE__ */ p("svg", {
|
|
2764
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2765
|
+
width: "14",
|
|
2766
|
+
height: "14",
|
|
2767
|
+
viewBox: "0 0 24 24",
|
|
2768
|
+
fill: "none",
|
|
2769
|
+
stroke: "currentColor",
|
|
2770
|
+
strokeWidth: "2",
|
|
2771
|
+
strokeLinecap: "round",
|
|
2772
|
+
strokeLinejoin: "round",
|
|
2773
|
+
children: [
|
|
2774
|
+
/* @__PURE__ */ f("polyline", { points: "3 6 5 6 21 6" }),
|
|
2775
|
+
/* @__PURE__ */ f("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }),
|
|
2776
|
+
/* @__PURE__ */ f("path", { d: "M10 11v6" }),
|
|
2777
|
+
/* @__PURE__ */ f("path", { d: "M14 11v6" }),
|
|
2778
|
+
/* @__PURE__ */ f("path", { d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" })
|
|
2779
|
+
]
|
|
2780
|
+
})
|
|
2781
|
+
})]
|
|
2782
|
+
}, e.id);
|
|
2783
|
+
})
|
|
2784
|
+
]
|
|
2785
|
+
})]
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
//#endregion
|
|
2536
2789
|
//#region src/hooks/useWebSocket.ts
|
|
2537
|
-
function
|
|
2790
|
+
function Me(e, n) {
|
|
2538
2791
|
let [i, a] = s("disconnected"), c = o(null), l = o(n);
|
|
2539
2792
|
return l.current = n, r(() => {
|
|
2540
2793
|
if (!e) {
|
|
@@ -2576,4 +2829,4 @@ function Oe(e, n) {
|
|
|
2576
2829
|
};
|
|
2577
2830
|
}
|
|
2578
2831
|
//#endregion
|
|
2579
|
-
export { $ as ChatArea,
|
|
2832
|
+
export { $ as ChatArea, U as GUIRenderer, q as MessageBubble, m as PayloadAction, _ as REASONING_TRACE_ACTION, h as ReasoningStepKind, W as ReasoningTrace, je as SessionSidebar, g as TaskStatus, E as detectContentKind, x as isEmptyTrace, y as isReasoningEnd, v as isReasoningStart, T as looksLikeCode, C as looksLikeMarkdown, Me as useWebSocket, b as visibleSteps };
|