@llmnative/agentico 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -885,7 +885,24 @@ function at({ text: e, tone: t }) {
|
|
|
885
885
|
className: "break-words text-xs leading-relaxed"
|
|
886
886
|
}, n)) });
|
|
887
887
|
}
|
|
888
|
-
function ot(
|
|
888
|
+
function ot() {
|
|
889
|
+
let [e] = N(() => Date.now()), [t, n] = N(e);
|
|
890
|
+
k(() => {
|
|
891
|
+
let e = setInterval(() => n(Date.now()), 1e3);
|
|
892
|
+
return () => clearInterval(e);
|
|
893
|
+
}, []);
|
|
894
|
+
let r = Math.floor((t - e) / 1e3);
|
|
895
|
+
return r < 10 ? null : /* @__PURE__ */ I("span", {
|
|
896
|
+
className: "tabular-nums",
|
|
897
|
+
children: [
|
|
898
|
+
" · ",
|
|
899
|
+
Math.floor(r / 60),
|
|
900
|
+
":",
|
|
901
|
+
String(r % 60).padStart(2, "0")
|
|
902
|
+
]
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
function st({ status: e }) {
|
|
889
906
|
return e === "running" ? /* @__PURE__ */ F("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ F(f, {
|
|
890
907
|
name: "check",
|
|
891
908
|
size: 12,
|
|
@@ -900,11 +917,11 @@ function ot({ status: e }) {
|
|
|
900
917
|
className: "shrink-0 text-destructive"
|
|
901
918
|
});
|
|
902
919
|
}
|
|
903
|
-
function
|
|
920
|
+
function ct(e, t) {
|
|
904
921
|
return e.status === "running" ? t.thinking : e.status === "error" ? t.modelRequestError : e.status === "stopped" ? t.stopped : e.detail ? t.responseReceived : e.toolNames && e.toolNames.length > 0 ? e.toolNames.join(" · ") : t.toolRequest;
|
|
905
922
|
}
|
|
906
|
-
var
|
|
907
|
-
function
|
|
923
|
+
var lt = 96;
|
|
924
|
+
function ut({ entry: e, pinned: t = !0 }) {
|
|
908
925
|
let n = M(null), [r, i] = N(!1), [a, o] = N(!1);
|
|
909
926
|
A(() => {
|
|
910
927
|
let e = n.current;
|
|
@@ -918,7 +935,7 @@ function lt({ entry: e, pinned: t = !0 }) {
|
|
|
918
935
|
children: [/* @__PURE__ */ I("div", {
|
|
919
936
|
ref: n,
|
|
920
937
|
className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
|
|
921
|
-
style: s ? { maxHeight:
|
|
938
|
+
style: s ? { maxHeight: lt } : void 0,
|
|
922
939
|
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ F("div", {
|
|
923
940
|
className: "flex flex-wrap gap-1",
|
|
924
941
|
children: e.attachmentNames.map((e, t) => /* @__PURE__ */ I("span", {
|
|
@@ -946,13 +963,13 @@ function lt({ entry: e, pinned: t = !0 }) {
|
|
|
946
963
|
})
|
|
947
964
|
});
|
|
948
965
|
}
|
|
949
|
-
var
|
|
966
|
+
var dt = {
|
|
950
967
|
running: "loader-circle",
|
|
951
968
|
done: "check",
|
|
952
969
|
error: "x",
|
|
953
970
|
stopped: "circle-slash"
|
|
954
971
|
};
|
|
955
|
-
function
|
|
972
|
+
function ft({ steps: e }) {
|
|
956
973
|
let t = $(), n = e.filter((e) => e.status === "running").at(-1), r = e.some((e) => e.status === "error"), i = n?.label ?? (e.length === 1 ? t.oneStep : y(t.steps, { count: e.length }));
|
|
957
974
|
return /* @__PURE__ */ F(_, {
|
|
958
975
|
ariaLabel: t.stepsLabel,
|
|
@@ -968,12 +985,12 @@ function dt({ steps: e }) {
|
|
|
968
985
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
969
986
|
children: e.label
|
|
970
987
|
}),
|
|
971
|
-
icon:
|
|
988
|
+
icon: dt[e.status]
|
|
972
989
|
}))
|
|
973
990
|
}]
|
|
974
991
|
});
|
|
975
992
|
}
|
|
976
|
-
function
|
|
993
|
+
function pt({ entry: e, part: a, questions: o }) {
|
|
977
994
|
let s = $(), [c, l] = N(!1), u = !!(o?.onCardAction && o.canAnswer(e.id) && !a.outcome), d = a.outcome?.status === "done" ? "text-success" : a.outcome?.status === "error" ? "text-destructive" : "text-muted-foreground";
|
|
978
995
|
return /* @__PURE__ */ I(r, {
|
|
979
996
|
headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
|
|
@@ -1033,7 +1050,7 @@ function ft({ entry: e, part: a, questions: o }) {
|
|
|
1033
1050
|
})]
|
|
1034
1051
|
});
|
|
1035
1052
|
}
|
|
1036
|
-
function
|
|
1053
|
+
function mt(e, t) {
|
|
1037
1054
|
let n = e.at(-1);
|
|
1038
1055
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
1039
1056
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -1042,7 +1059,7 @@ function pt(e, t) {
|
|
|
1042
1059
|
part: r
|
|
1043
1060
|
};
|
|
1044
1061
|
}
|
|
1045
|
-
function
|
|
1062
|
+
function ht({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
1046
1063
|
let o = !!n?.canAnswer(e.id);
|
|
1047
1064
|
return /* @__PURE__ */ F(a, {
|
|
1048
1065
|
questions: t.questions,
|
|
@@ -1053,7 +1070,7 @@ function mt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
|
1053
1070
|
className: i ?? "text-xs"
|
|
1054
1071
|
});
|
|
1055
1072
|
}
|
|
1056
|
-
function
|
|
1073
|
+
function gt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
1057
1074
|
let r = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), a = [];
|
|
1058
1075
|
for (let e of r) {
|
|
1059
1076
|
let t = a.at(-1);
|
|
@@ -1068,7 +1085,7 @@ function ht({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1068
1085
|
return /* @__PURE__ */ F("div", {
|
|
1069
1086
|
className: "space-y-2",
|
|
1070
1087
|
children: a.map((n) => {
|
|
1071
|
-
if ("steps" in n) return /* @__PURE__ */ F(
|
|
1088
|
+
if ("steps" in n) return /* @__PURE__ */ F(ft, { steps: n.steps }, n.key);
|
|
1072
1089
|
let { part: r } = n;
|
|
1073
1090
|
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ F(i, {
|
|
1074
1091
|
content: r.text,
|
|
@@ -1079,11 +1096,11 @@ function ht({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1079
1096
|
streaming: r.streaming,
|
|
1080
1097
|
duration: r.duration,
|
|
1081
1098
|
className: "my-0"
|
|
1082
|
-
}, n.key) : r.type === "card" ? /* @__PURE__ */ F(
|
|
1099
|
+
}, n.key) : r.type === "card" ? /* @__PURE__ */ F(pt, {
|
|
1083
1100
|
entry: e,
|
|
1084
1101
|
part: r,
|
|
1085
1102
|
questions: t
|
|
1086
|
-
}, n.key) : /* @__PURE__ */ F(
|
|
1103
|
+
}, n.key) : /* @__PURE__ */ F(ht, {
|
|
1087
1104
|
entry: e,
|
|
1088
1105
|
part: r,
|
|
1089
1106
|
questions: t
|
|
@@ -1091,13 +1108,13 @@ function ht({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1091
1108
|
})
|
|
1092
1109
|
});
|
|
1093
1110
|
}
|
|
1094
|
-
function
|
|
1111
|
+
function _t({ entry: e, questions: t, hiddenPartId: n }) {
|
|
1095
1112
|
let r = $();
|
|
1096
1113
|
if (e.kind === "thinking" && e.parts) {
|
|
1097
|
-
let i = e.status === "error" || e.status === "stopped" || e.status === "running"
|
|
1114
|
+
let i = e.status === "error" || e.status === "stopped" || e.status === "running";
|
|
1098
1115
|
return /* @__PURE__ */ I("li", {
|
|
1099
1116
|
className: "text-xs text-muted-foreground",
|
|
1100
|
-
children: [e.parts.length > 0 && /* @__PURE__ */ F(
|
|
1117
|
+
children: [e.parts.length > 0 && /* @__PURE__ */ F(gt, {
|
|
1101
1118
|
entry: e,
|
|
1102
1119
|
questions: t,
|
|
1103
1120
|
hiddenPartId: n
|
|
@@ -1105,15 +1122,15 @@ function gt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1105
1122
|
className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
|
|
1106
1123
|
children: [/* @__PURE__ */ F("span", {
|
|
1107
1124
|
className: "pt-px",
|
|
1108
|
-
children: /* @__PURE__ */ F(
|
|
1109
|
-
}), /* @__PURE__ */
|
|
1125
|
+
children: /* @__PURE__ */ F(st, { status: e.status })
|
|
1126
|
+
}), /* @__PURE__ */ I("span", {
|
|
1110
1127
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1111
|
-
children:
|
|
1128
|
+
children: [ct(e, r), e.status === "running" && /* @__PURE__ */ F(ot, {})]
|
|
1112
1129
|
})]
|
|
1113
1130
|
})]
|
|
1114
1131
|
});
|
|
1115
1132
|
}
|
|
1116
|
-
let a = e.kind === "thinking" && e.detail ? rt(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ?
|
|
1133
|
+
let a = e.kind === "thinking" && e.detail ? rt(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? ct(e, r) : e.label;
|
|
1117
1134
|
return /* @__PURE__ */ I("li", {
|
|
1118
1135
|
className: "text-xs text-muted-foreground",
|
|
1119
1136
|
children: [
|
|
@@ -1121,7 +1138,7 @@ function gt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1121
1138
|
className: "flex items-start gap-1.5",
|
|
1122
1139
|
children: [/* @__PURE__ */ F("span", {
|
|
1123
1140
|
className: "pt-px",
|
|
1124
|
-
children: /* @__PURE__ */ F(
|
|
1141
|
+
children: /* @__PURE__ */ F(st, { status: e.status })
|
|
1125
1142
|
}), /* @__PURE__ */ F("span", {
|
|
1126
1143
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1127
1144
|
children: c
|
|
@@ -1145,7 +1162,7 @@ function gt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1145
1162
|
]
|
|
1146
1163
|
});
|
|
1147
1164
|
}
|
|
1148
|
-
function
|
|
1165
|
+
function vt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
1149
1166
|
if (e.length === 0) return null;
|
|
1150
1167
|
let i = [];
|
|
1151
1168
|
for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
|
|
@@ -1154,12 +1171,12 @@ function _t({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
|
1154
1171
|
} : { entries: [t] }) : i[i.length - 1].entries.push(t);
|
|
1155
1172
|
return /* @__PURE__ */ F("ul", {
|
|
1156
1173
|
className: "space-y-0.5",
|
|
1157
|
-
children: i.map((e) => /* @__PURE__ */ I("li", { children: [e.user && /* @__PURE__ */ F(
|
|
1174
|
+
children: i.map((e) => /* @__PURE__ */ I("li", { children: [e.user && /* @__PURE__ */ F(ut, {
|
|
1158
1175
|
entry: e.user,
|
|
1159
1176
|
pinned: r
|
|
1160
1177
|
}), e.entries.length > 0 && /* @__PURE__ */ F("ul", {
|
|
1161
1178
|
className: "space-y-0.5",
|
|
1162
|
-
children: e.entries.map((e) => /* @__PURE__ */ F(
|
|
1179
|
+
children: e.entries.map((e) => /* @__PURE__ */ F(_t, {
|
|
1163
1180
|
entry: e,
|
|
1164
1181
|
questions: t,
|
|
1165
1182
|
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
@@ -1169,55 +1186,55 @@ function _t({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
|
|
|
1169
1186
|
}
|
|
1170
1187
|
//#endregion
|
|
1171
1188
|
//#region src/presentation/panelWidth.ts
|
|
1172
|
-
var
|
|
1173
|
-
function
|
|
1189
|
+
var yt = 420, bt = 320, xt = "60vw", St = "agentico:panel-width";
|
|
1190
|
+
function Ct(e, t) {
|
|
1174
1191
|
if (typeof e == "number") return e;
|
|
1175
1192
|
let n = Number.parseFloat(e);
|
|
1176
1193
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1177
1194
|
}
|
|
1178
|
-
function
|
|
1195
|
+
function wt(e, t, n) {
|
|
1179
1196
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1180
1197
|
}
|
|
1181
|
-
function
|
|
1198
|
+
function Tt() {
|
|
1182
1199
|
try {
|
|
1183
|
-
let e = window.localStorage.getItem(
|
|
1200
|
+
let e = window.localStorage.getItem(St), t = e === null ? NaN : Number(e);
|
|
1184
1201
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1185
1202
|
} catch {
|
|
1186
1203
|
return null;
|
|
1187
1204
|
}
|
|
1188
1205
|
}
|
|
1189
|
-
function
|
|
1206
|
+
function Et(e) {
|
|
1190
1207
|
try {
|
|
1191
|
-
e === null ? window.localStorage.removeItem(
|
|
1208
|
+
e === null ? window.localStorage.removeItem(St) : window.localStorage.setItem(St, String(e));
|
|
1192
1209
|
} catch {}
|
|
1193
1210
|
}
|
|
1194
|
-
function
|
|
1211
|
+
function Dt() {
|
|
1195
1212
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1196
1213
|
}
|
|
1197
|
-
function
|
|
1198
|
-
let [i, a] = N(
|
|
1214
|
+
function Ot({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = xt, onWidthChange: r }) {
|
|
1215
|
+
let [i, a] = N(Dt), [o, s] = N(() => Tt() ?? e);
|
|
1199
1216
|
k(() => {
|
|
1200
1217
|
if (typeof window > "u") return;
|
|
1201
1218
|
let e = () => a(window.innerWidth);
|
|
1202
1219
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1203
1220
|
}, []);
|
|
1204
|
-
let c = t, l = Math.max(c,
|
|
1221
|
+
let c = t, l = Math.max(c, Ct(n, i)), u = wt(o, c, l);
|
|
1205
1222
|
return k(() => {
|
|
1206
1223
|
r?.(u);
|
|
1207
1224
|
}, [u]), {
|
|
1208
1225
|
width: u,
|
|
1209
1226
|
min: c,
|
|
1210
1227
|
max: l,
|
|
1211
|
-
set: D((e) => s(
|
|
1212
|
-
commit: D((e) =>
|
|
1228
|
+
set: D((e) => s(wt(e, c, l)), [c, l]),
|
|
1229
|
+
commit: D((e) => Et(wt(e, c, l)), [c, l]),
|
|
1213
1230
|
reset: D(() => {
|
|
1214
|
-
s(e),
|
|
1231
|
+
s(e), Et(null);
|
|
1215
1232
|
}, [e])
|
|
1216
1233
|
};
|
|
1217
1234
|
}
|
|
1218
1235
|
//#endregion
|
|
1219
1236
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1220
|
-
function
|
|
1237
|
+
function kt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1221
1238
|
let o = $(), s = M(null), [c, l] = N(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1222
1239
|
let t = s.current;
|
|
1223
1240
|
if (t && t.pointerId === e.pointerId) {
|
|
@@ -1275,7 +1292,7 @@ function Ot({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1275
1292
|
}
|
|
1276
1293
|
//#endregion
|
|
1277
1294
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1278
|
-
function
|
|
1295
|
+
function At({ className: e = "" }) {
|
|
1279
1296
|
let { isOpen: n, toggleOpen: r, task: i } = tt(), a = $(), o = i?.agent.running ?? !1;
|
|
1280
1297
|
return /* @__PURE__ */ F(t, {
|
|
1281
1298
|
icon: "bot",
|
|
@@ -1288,21 +1305,21 @@ function kt({ className: e = "" }) {
|
|
|
1288
1305
|
}
|
|
1289
1306
|
//#endregion
|
|
1290
1307
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1291
|
-
var
|
|
1292
|
-
function
|
|
1308
|
+
var jt = "llmnative-cms.selectedAIModel";
|
|
1309
|
+
function Mt() {
|
|
1293
1310
|
try {
|
|
1294
|
-
return localStorage.getItem(
|
|
1311
|
+
return localStorage.getItem(jt) ?? "";
|
|
1295
1312
|
} catch {
|
|
1296
1313
|
return "";
|
|
1297
1314
|
}
|
|
1298
1315
|
}
|
|
1299
|
-
function
|
|
1316
|
+
function Nt(e) {
|
|
1300
1317
|
try {
|
|
1301
|
-
e ? localStorage.setItem(
|
|
1318
|
+
e ? localStorage.setItem(jt, e) : localStorage.removeItem(jt);
|
|
1302
1319
|
} catch {}
|
|
1303
1320
|
}
|
|
1304
|
-
function
|
|
1305
|
-
let e = S()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = N({}), [i, a] = N(!1), [o, s] = N(
|
|
1321
|
+
function Pt() {
|
|
1322
|
+
let e = S()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = N({}), [i, a] = N(!1), [o, s] = N(Mt);
|
|
1306
1323
|
return k(() => {
|
|
1307
1324
|
if (!t) {
|
|
1308
1325
|
r({});
|
|
@@ -1313,7 +1330,7 @@ function Nt() {
|
|
|
1313
1330
|
if (n) return;
|
|
1314
1331
|
r(e.modelsByProvider);
|
|
1315
1332
|
let t = Object.values(e.modelsByProvider).flat();
|
|
1316
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1333
|
+
s((e) => t.some((t) => t.id === e) ? e : (Nt(""), ""));
|
|
1317
1334
|
}).catch((e) => {
|
|
1318
1335
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
1319
1336
|
}).finally(() => {
|
|
@@ -1327,17 +1344,17 @@ function Nt() {
|
|
|
1327
1344
|
modelsLoading: i,
|
|
1328
1345
|
selectedModel: o,
|
|
1329
1346
|
setSelectedModel: (e) => {
|
|
1330
|
-
|
|
1347
|
+
Nt(e), s(e);
|
|
1331
1348
|
}
|
|
1332
1349
|
};
|
|
1333
1350
|
}
|
|
1334
1351
|
//#endregion
|
|
1335
1352
|
//#region src/domain/approval.ts
|
|
1336
|
-
var
|
|
1337
|
-
function
|
|
1353
|
+
var Ft = "approval";
|
|
1354
|
+
function It(e, t) {
|
|
1338
1355
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1339
1356
|
}
|
|
1340
|
-
function
|
|
1357
|
+
function Lt(e, t, n) {
|
|
1341
1358
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1342
1359
|
return {
|
|
1343
1360
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1346,12 +1363,12 @@ function It(e, t, n) {
|
|
|
1346
1363
|
}
|
|
1347
1364
|
//#endregion
|
|
1348
1365
|
//#region src/presentation/useAgent.ts
|
|
1349
|
-
var
|
|
1350
|
-
function
|
|
1351
|
-
return e.filter((e) => !g.isTextAttachment(e.mimeType) || e.base64.length <=
|
|
1366
|
+
var Rt = 20, zt = 26e4;
|
|
1367
|
+
function Bt(e) {
|
|
1368
|
+
return e.filter((e) => !g.isTextAttachment(e.mimeType) || e.base64.length <= zt);
|
|
1352
1369
|
}
|
|
1353
|
-
function
|
|
1354
|
-
let { defaultEnabled: n = !1 } = t, [r, i] = N(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } =
|
|
1370
|
+
function Vt(e, t = {}) {
|
|
1371
|
+
let { defaultEnabled: n = !1 } = t, [r, i] = N(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Pt(), [u, d] = N(!1), [f, p] = N(null), [m, h] = N(!1), [_, v] = N([]), y = M([]), x = (e) => {
|
|
1355
1372
|
v((t) => {
|
|
1356
1373
|
let n = typeof e == "function" ? e(t) : e;
|
|
1357
1374
|
return y.current = n, n;
|
|
@@ -1548,7 +1565,7 @@ function Bt(e, t = {}) {
|
|
|
1548
1565
|
let f = s ? b(s) : H, m = f ? A[f.provider] : null;
|
|
1549
1566
|
if (!m || !f) return p(T.current.noProviderAvailable), null;
|
|
1550
1567
|
n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
|
|
1551
|
-
let h = (n ?? []).filter((e) => g.isTextAttachment(e.mimeType)).map((e) => e.base64.length <=
|
|
1568
|
+
let h = (n ?? []).filter((e) => g.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= zt ? `\n\n[File allegato: ${e.name}]\n${g.decodeBase64Text(e.base64)}` : `\n\n[File allegato: ${e.name} — troppo grande per essere incollato qui. Usa uno dei tool di lettura file disponibili (es. list_csv_columns/extract_csv_column) per leggerne il contenuto prima di chiedere altro all'utente.]`).join(""), _ = Bt(n ?? []), v = d.tools.map((e) => ({
|
|
1552
1569
|
name: e.name,
|
|
1553
1570
|
description: e.description,
|
|
1554
1571
|
inputSchema: ne(e.inputSchema)
|
|
@@ -1561,7 +1578,7 @@ function Bt(e, t = {}) {
|
|
|
1561
1578
|
status: "running",
|
|
1562
1579
|
parts: [{
|
|
1563
1580
|
type: "questions",
|
|
1564
|
-
id:
|
|
1581
|
+
id: Ft,
|
|
1565
1582
|
questions: [{
|
|
1566
1583
|
header: i.approvalHeader,
|
|
1567
1584
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -1570,7 +1587,7 @@ function Bt(e, t = {}) {
|
|
|
1570
1587
|
}]
|
|
1571
1588
|
}]
|
|
1572
1589
|
}]);
|
|
1573
|
-
let s = `${a}:${
|
|
1590
|
+
let s = `${a}:${Ft}`;
|
|
1574
1591
|
return new Promise((e, t) => {
|
|
1575
1592
|
let n = () => {
|
|
1576
1593
|
C.current.delete(s), D(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
@@ -1581,7 +1598,7 @@ function Bt(e, t = {}) {
|
|
|
1581
1598
|
}
|
|
1582
1599
|
r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
|
|
1583
1600
|
resolve: (t) => {
|
|
1584
|
-
r.removeEventListener("abort", n), D(a, "done"), e(
|
|
1601
|
+
r.removeEventListener("abort", n), D(a, "done"), e(Lt(t, i.approve, i.reject));
|
|
1585
1602
|
},
|
|
1586
1603
|
reject: t
|
|
1587
1604
|
});
|
|
@@ -1596,7 +1613,7 @@ function Bt(e, t = {}) {
|
|
|
1596
1613
|
} : i));
|
|
1597
1614
|
try {
|
|
1598
1615
|
let n = d.history, r = t;
|
|
1599
|
-
for (let t = 0; t <
|
|
1616
|
+
for (let t = 0; t < Rt; t++) {
|
|
1600
1617
|
let i = crypto.randomUUID();
|
|
1601
1618
|
x((e) => [...e, {
|
|
1602
1619
|
id: i,
|
|
@@ -1656,7 +1673,7 @@ function Bt(e, t = {}) {
|
|
|
1656
1673
|
let s = /* @__PURE__ */ new Map();
|
|
1657
1674
|
for (let t of a.toolCalls) {
|
|
1658
1675
|
let n = S.get(t.name);
|
|
1659
|
-
if (n &&
|
|
1676
|
+
if (n && It(n, t.input)) try {
|
|
1660
1677
|
s.set(t.id, await y(t.id, n, t.input, w.signal));
|
|
1661
1678
|
} catch {
|
|
1662
1679
|
return e.fallback(d.params, d.context);
|
|
@@ -1904,23 +1921,23 @@ function Bt(e, t = {}) {
|
|
|
1904
1921
|
}
|
|
1905
1922
|
//#endregion
|
|
1906
1923
|
//#region src/domain/orchestrator/prompt.ts
|
|
1907
|
-
function
|
|
1924
|
+
function Ht() {
|
|
1908
1925
|
let e = X();
|
|
1909
1926
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
1910
1927
|
}
|
|
1911
|
-
function
|
|
1928
|
+
function Ut(e, t, n) {
|
|
1912
1929
|
let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
1913
1930
|
return `${r.orchestratorIntro}
|
|
1914
1931
|
|
|
1915
1932
|
${r.toolsHeading}
|
|
1916
1933
|
${t}
|
|
1917
1934
|
${i}
|
|
1918
|
-
${
|
|
1935
|
+
${Ht()}
|
|
1919
1936
|
|
|
1920
1937
|
${r.userRequestHeading}
|
|
1921
1938
|
${e}`;
|
|
1922
1939
|
}
|
|
1923
|
-
function
|
|
1940
|
+
function Wt(e, t) {
|
|
1924
1941
|
return t ? {
|
|
1925
1942
|
kind: "handoff",
|
|
1926
1943
|
...t
|
|
@@ -1931,27 +1948,27 @@ function Ut(e, t) {
|
|
|
1931
1948
|
}
|
|
1932
1949
|
//#endregion
|
|
1933
1950
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
1934
|
-
function
|
|
1951
|
+
function Gt(e) {
|
|
1935
1952
|
return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
1936
1953
|
}
|
|
1937
|
-
function
|
|
1954
|
+
function Kt(e) {
|
|
1938
1955
|
return {
|
|
1939
1956
|
buildContext(e) {
|
|
1940
1957
|
return {
|
|
1941
|
-
cliCatalog: de(
|
|
1958
|
+
cliCatalog: de(Gt(e.scopedSubagentId)),
|
|
1942
1959
|
handoff: { current: null },
|
|
1943
1960
|
collected: {}
|
|
1944
1961
|
};
|
|
1945
1962
|
},
|
|
1946
1963
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
1947
|
-
return
|
|
1964
|
+
return Ut(e, n, t);
|
|
1948
1965
|
},
|
|
1949
1966
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
1950
|
-
return `${e}\n\n${
|
|
1967
|
+
return `${e}\n\n${Ht()}\n\n${X().toolsHeading}\n${n}`;
|
|
1951
1968
|
},
|
|
1952
1969
|
parseResponse(e, t, n) {
|
|
1953
1970
|
let r = n.handoff.current;
|
|
1954
|
-
return n.handoff.current = null,
|
|
1971
|
+
return n.handoff.current = null, Wt(e, r);
|
|
1955
1972
|
},
|
|
1956
1973
|
fallback() {
|
|
1957
1974
|
return {
|
|
@@ -1967,7 +1984,7 @@ function Gt(e) {
|
|
|
1967
1984
|
attachmentsRef: r,
|
|
1968
1985
|
collected: n.collected,
|
|
1969
1986
|
proxyFetch: x
|
|
1970
|
-
}), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s =
|
|
1987
|
+
}), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Gt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
1971
1988
|
name: `${t.id}_${r.name}`,
|
|
1972
1989
|
description: `${t.label}: ${r.summary}`,
|
|
1973
1990
|
inputSchema: r.inputSchema,
|
|
@@ -1991,12 +2008,12 @@ function Gt(e) {
|
|
|
1991
2008
|
}
|
|
1992
2009
|
//#endregion
|
|
1993
2010
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
1994
|
-
function
|
|
2011
|
+
function qt(e, t) {
|
|
1995
2012
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
1996
2013
|
}
|
|
1997
2014
|
//#endregion
|
|
1998
2015
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
1999
|
-
function
|
|
2016
|
+
function Jt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
2000
2017
|
let s = $(), c = tt(), l = c.scope, u = T(), [d, f] = N(null), [p, m] = N(new Set(i ?? [])), [h, g] = N(null), _ = Se(), v = /* @__PURE__ */ new Map();
|
|
2001
2018
|
e.destinationIds.forEach((e) => {
|
|
2002
2019
|
let t = _[e];
|
|
@@ -2014,7 +2031,7 @@ function qt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2014
2031
|
storageProvider: l?.storageProvider ?? null,
|
|
2015
2032
|
proxyFetch: u
|
|
2016
2033
|
}, n);
|
|
2017
|
-
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n,
|
|
2034
|
+
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, qt(e, n));
|
|
2018
2035
|
} catch (e) {
|
|
2019
2036
|
g(e instanceof Error ? e.message : String(e));
|
|
2020
2037
|
} finally {
|
|
@@ -2047,16 +2064,16 @@ function qt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2047
2064
|
}
|
|
2048
2065
|
//#endregion
|
|
2049
2066
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
2050
|
-
var
|
|
2051
|
-
function Yt(e) {
|
|
2052
|
-
Object.assign(Jt, e);
|
|
2053
|
-
}
|
|
2067
|
+
var Yt = {};
|
|
2054
2068
|
function Xt(e) {
|
|
2055
|
-
|
|
2069
|
+
Object.assign(Yt, e);
|
|
2070
|
+
}
|
|
2071
|
+
function Zt(e) {
|
|
2072
|
+
return Yt[e];
|
|
2056
2073
|
}
|
|
2057
2074
|
//#endregion
|
|
2058
2075
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
2059
|
-
function
|
|
2076
|
+
function Qt({ result: e }) {
|
|
2060
2077
|
let [t, n] = N(!1);
|
|
2061
2078
|
return /* @__PURE__ */ I("div", {
|
|
2062
2079
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
@@ -2073,7 +2090,7 @@ function Zt({ result: e }) {
|
|
|
2073
2090
|
}
|
|
2074
2091
|
//#endregion
|
|
2075
2092
|
//#region src/presentation/liveAnchorDestination.ts
|
|
2076
|
-
function
|
|
2093
|
+
function $t(e, t, n) {
|
|
2077
2094
|
return e.length === 0 ? null : {
|
|
2078
2095
|
id: "live-component",
|
|
2079
2096
|
label: "Applica al componente aperto",
|
|
@@ -2084,38 +2101,38 @@ function Qt(e, t, n) {
|
|
|
2084
2101
|
}
|
|
2085
2102
|
//#endregion
|
|
2086
2103
|
//#region src/presentation/subagentControls.ts
|
|
2087
|
-
var
|
|
2088
|
-
function en(e) {
|
|
2089
|
-
Object.assign($t, e);
|
|
2090
|
-
}
|
|
2104
|
+
var en = {};
|
|
2091
2105
|
function tn(e) {
|
|
2092
|
-
|
|
2106
|
+
Object.assign(en, e);
|
|
2107
|
+
}
|
|
2108
|
+
function nn(e) {
|
|
2109
|
+
return en[e];
|
|
2093
2110
|
}
|
|
2094
2111
|
//#endregion
|
|
2095
2112
|
//#region src/presentation/chatTitles.ts
|
|
2096
|
-
function
|
|
2113
|
+
function rn(e, t = 6e3) {
|
|
2097
2114
|
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Ge(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
|
|
2098
2115
|
return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
|
|
2099
2116
|
}
|
|
2100
|
-
function
|
|
2117
|
+
function an(e) {
|
|
2101
2118
|
return (e.trim().split("\n").map((e) => e.trim()).find(Boolean) ?? "").replace(/^(title|titolo)\s*:\s*/i, "").replace(/^#+\s*/, "").replace(/^["'«“]+|["'»”]+$/g, "").replace(/[.。]+$/, "").trim().slice(0, 80);
|
|
2102
2119
|
}
|
|
2103
|
-
function
|
|
2120
|
+
function on(e, t) {
|
|
2104
2121
|
try {
|
|
2105
2122
|
return e.definition.executor?.catalogProviders?.(e.toParams(t));
|
|
2106
2123
|
} catch {
|
|
2107
2124
|
return;
|
|
2108
2125
|
}
|
|
2109
2126
|
}
|
|
2110
|
-
function
|
|
2111
|
-
let a =
|
|
2127
|
+
function sn(e, t, n, r, i) {
|
|
2128
|
+
let a = on(e, t), o = (e) => {
|
|
2112
2129
|
let t = e ? b(e) : null;
|
|
2113
2130
|
return !(!t || !i[t.provider] || a && !a.includes(t.provider));
|
|
2114
2131
|
};
|
|
2115
2132
|
return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
|
|
2116
2133
|
}
|
|
2117
|
-
function
|
|
2118
|
-
let t = S()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } =
|
|
2134
|
+
function cn(e) {
|
|
2135
|
+
let t = S()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Pt(), i = M({
|
|
2119
2136
|
registry: t,
|
|
2120
2137
|
modelsByProvider: n,
|
|
2121
2138
|
selectedModel: r
|
|
@@ -2129,15 +2146,15 @@ function sn(e) {
|
|
|
2129
2146
|
if (!e) return !1;
|
|
2130
2147
|
let o = Re(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
|
|
2131
2148
|
if (!o || !s?.autoTitle || o.name || !We(o) || a.current.has(c)) return !1;
|
|
2132
|
-
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f =
|
|
2149
|
+
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = sn(s, o.params, r ?? d, u, l), p = f ? b(f) : null;
|
|
2133
2150
|
if (!p) return !1;
|
|
2134
2151
|
a.current.add(c);
|
|
2135
2152
|
try {
|
|
2136
2153
|
let r = await l[p.provider].complete({
|
|
2137
|
-
prompt: X().chatTitle.replace("{chat}",
|
|
2154
|
+
prompt: X().chatTitle.replace("{chat}", rn(o.activity)),
|
|
2138
2155
|
model: p.model,
|
|
2139
2156
|
history: []
|
|
2140
|
-
}), i = r && r.type === "text" ?
|
|
2157
|
+
}), i = r && r.type === "text" ? an(r.text) : "";
|
|
2141
2158
|
return i ? Ke(e, t, n, i, "model") : !1;
|
|
2142
2159
|
} catch {
|
|
2143
2160
|
return !1;
|
|
@@ -2146,7 +2163,7 @@ function sn(e) {
|
|
|
2146
2163
|
}
|
|
2147
2164
|
}, [e]), s = Object.keys(n).length > 0;
|
|
2148
2165
|
return k(() => {
|
|
2149
|
-
e && s && !
|
|
2166
|
+
e && s && !ln.has(e) && (ln.add(e), (async () => {
|
|
2150
2167
|
for (let t of Ye(e)) {
|
|
2151
2168
|
let n = W(t.subagentId);
|
|
2152
2169
|
if (n?.autoTitle) {
|
|
@@ -2164,11 +2181,11 @@ function sn(e) {
|
|
|
2164
2181
|
o
|
|
2165
2182
|
]), o;
|
|
2166
2183
|
}
|
|
2167
|
-
var
|
|
2168
|
-
function
|
|
2169
|
-
let c =
|
|
2184
|
+
var ln = /* @__PURE__ */ new Set(), un = () => ({});
|
|
2185
|
+
function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
2186
|
+
let c = Vt(e.definition, { defaultEnabled: !0 }), l = tt(), u = l.scope, d = T(), f = M(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = N(null), h = (t) => {
|
|
2170
2187
|
e.definition.conversational || m(t);
|
|
2171
|
-
}, [g, _] = N([]), [v, y] = N(null), b =
|
|
2188
|
+
}, [g, _] = N([]), [v, y] = N(null), b = Zt(e.id), x = b?.kind === "selection" ? b : null, [S, C] = N(null), w = M(!1), E = M(0), D = M(null);
|
|
2172
2189
|
p && p !== D.current && (D.current = p, E.current = (r?.length ?? 0) + c.activity.length);
|
|
2173
2190
|
let O = M(!1), A = c.remote || !c.hasProviders || c.selectedModel !== "";
|
|
2174
2191
|
k(() => {
|
|
@@ -2192,7 +2209,7 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2192
2209
|
...t,
|
|
2193
2210
|
pinnedEntityId: r
|
|
2194
2211
|
}).then((n) => {
|
|
2195
|
-
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t,
|
|
2212
|
+
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, qt(e, t));
|
|
2196
2213
|
}).catch((e) => y(e instanceof Error ? e.message : String(e))));
|
|
2197
2214
|
});
|
|
2198
2215
|
}, [
|
|
@@ -2211,11 +2228,11 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2211
2228
|
p,
|
|
2212
2229
|
x,
|
|
2213
2230
|
S
|
|
2214
|
-
]), ee = j(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = j(() =>
|
|
2231
|
+
]), ee = j(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = j(() => $t(ee, t, f), [
|
|
2215
2232
|
ee,
|
|
2216
2233
|
t,
|
|
2217
2234
|
f
|
|
2218
|
-
]), te = j(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H =
|
|
2235
|
+
]), te = j(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = cn(u?.id), U = M(!1), W = M(!1);
|
|
2219
2236
|
k(() => {
|
|
2220
2237
|
let n = !U.current && c.running, i = U.current && !c.running;
|
|
2221
2238
|
if (U.current = c.running, !n && !i || !V || !u) return;
|
|
@@ -2231,14 +2248,14 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2231
2248
|
subagentId: e.id,
|
|
2232
2249
|
entityId: V,
|
|
2233
2250
|
params: t,
|
|
2234
|
-
title:
|
|
2251
|
+
title: qt(e, t),
|
|
2235
2252
|
history: a.history,
|
|
2236
2253
|
activity: o
|
|
2237
2254
|
}), i && e.autoTitle && H(e.id, V, c.selectedModel));
|
|
2238
2255
|
}, [c.running]);
|
|
2239
2256
|
let G = () => {
|
|
2240
2257
|
O.current = !0, c.running && c.stop(), l.closeTask(f);
|
|
2241
|
-
}, K = M(
|
|
2258
|
+
}, K = M(nn(e.id) ?? un).current, q = K({
|
|
2242
2259
|
params: t,
|
|
2243
2260
|
taskId: f,
|
|
2244
2261
|
running: c.running,
|
|
@@ -2249,7 +2266,7 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2249
2266
|
return k(() => {
|
|
2250
2267
|
O.current || l.openTask({
|
|
2251
2268
|
id: f,
|
|
2252
|
-
title:
|
|
2269
|
+
title: qt(e, t),
|
|
2253
2270
|
icon: e.icon,
|
|
2254
2271
|
agent: c,
|
|
2255
2272
|
onApplied: (e) => h(e),
|
|
@@ -2268,12 +2285,12 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2268
2285
|
}) : b?.kind === "editable" ? /* @__PURE__ */ F(b.Report, {
|
|
2269
2286
|
result: p,
|
|
2270
2287
|
onResultChange: R
|
|
2271
|
-
}) : /* @__PURE__ */ F(
|
|
2288
|
+
}) : /* @__PURE__ */ F(Qt, { result: z }),
|
|
2272
2289
|
v && /* @__PURE__ */ I("p", {
|
|
2273
2290
|
className: "text-xs text-destructive",
|
|
2274
2291
|
children: ["Salvataggio automatico non riuscito: ", v]
|
|
2275
2292
|
}),
|
|
2276
|
-
/* @__PURE__ */ F(
|
|
2293
|
+
/* @__PURE__ */ F(Jt, {
|
|
2277
2294
|
manifest: e,
|
|
2278
2295
|
result: z,
|
|
2279
2296
|
meta: t,
|
|
@@ -2314,8 +2331,8 @@ function un({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2314
2331
|
}
|
|
2315
2332
|
//#endregion
|
|
2316
2333
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2317
|
-
function
|
|
2318
|
-
let t = $(), n =
|
|
2334
|
+
function fn({ userGoal: e }) {
|
|
2335
|
+
let t = $(), n = Vt(j(() => Kt({
|
|
2319
2336
|
unavailable: t.orchestratorUnavailable,
|
|
2320
2337
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2321
2338
|
preparing: t.orchestratorPreparing,
|
|
@@ -2363,7 +2380,7 @@ function dn({ userGoal: e }) {
|
|
|
2363
2380
|
let h = j(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
|
|
2364
2381
|
if (!i) return null;
|
|
2365
2382
|
let g = W(i.subagentId);
|
|
2366
|
-
return g ? /* @__PURE__ */ F(
|
|
2383
|
+
return g ? /* @__PURE__ */ F(dn, {
|
|
2367
2384
|
manifest: g,
|
|
2368
2385
|
params: i.params,
|
|
2369
2386
|
extraDestinations: c.current,
|
|
@@ -2374,8 +2391,8 @@ function dn({ userGoal: e }) {
|
|
|
2374
2391
|
}
|
|
2375
2392
|
//#endregion
|
|
2376
2393
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2377
|
-
function
|
|
2378
|
-
let r =
|
|
2394
|
+
function pn({ manifest: e, extraDestinations: n }) {
|
|
2395
|
+
let r = Vt(e.definition, { defaultEnabled: !1 }), i = $(), a = tt(), o = M(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = N(null), [l, u] = N([]), d = Zt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = N(null), [h, g] = N(null), _ = M(!1), v = (t) => {
|
|
2379
2396
|
if (!e.manualEntry) return;
|
|
2380
2397
|
let n;
|
|
2381
2398
|
try {
|
|
@@ -2402,7 +2419,7 @@ function fn({ manifest: e, extraDestinations: n }) {
|
|
|
2402
2419
|
p
|
|
2403
2420
|
]), S = (e) => {
|
|
2404
2421
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
2405
|
-
}, C = j(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = j(() => h ?
|
|
2422
|
+
}, C = j(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = j(() => h ? $t(C, h, o) : null, [
|
|
2406
2423
|
C,
|
|
2407
2424
|
h,
|
|
2408
2425
|
o
|
|
@@ -2431,8 +2448,8 @@ function fn({ manifest: e, extraDestinations: n }) {
|
|
|
2431
2448
|
}) : d?.kind === "editable" ? /* @__PURE__ */ F(d.Report, {
|
|
2432
2449
|
result: s,
|
|
2433
2450
|
onResultChange: b
|
|
2434
|
-
}) : /* @__PURE__ */ F(
|
|
2435
|
-
/* @__PURE__ */ F(
|
|
2451
|
+
}) : /* @__PURE__ */ F(Qt, { result: x }),
|
|
2452
|
+
/* @__PURE__ */ F(Jt, {
|
|
2436
2453
|
manifest: e,
|
|
2437
2454
|
result: x,
|
|
2438
2455
|
meta: h ?? {},
|
|
@@ -2469,7 +2486,7 @@ function fn({ manifest: e, extraDestinations: n }) {
|
|
|
2469
2486
|
}
|
|
2470
2487
|
//#endregion
|
|
2471
2488
|
//#region src/presentation/Agentico.tsx
|
|
2472
|
-
function
|
|
2489
|
+
function mn(e, t) {
|
|
2473
2490
|
return Object.values(e).flat().map((e) => {
|
|
2474
2491
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
2475
2492
|
return {
|
|
@@ -2481,7 +2498,7 @@ function pn(e, t) {
|
|
|
2481
2498
|
};
|
|
2482
2499
|
});
|
|
2483
2500
|
}
|
|
2484
|
-
function
|
|
2501
|
+
function hn({ task: e }) {
|
|
2485
2502
|
let t = $(), [n, r] = N(""), { agent: i, onApplied: a, manualEntry: o } = e, c = i.running, l = (e) => {
|
|
2486
2503
|
if (r(""), o) {
|
|
2487
2504
|
o.onSubmit(e.text);
|
|
@@ -2493,7 +2510,7 @@ function mn({ task: e }) {
|
|
|
2493
2510
|
}).then((e) => {
|
|
2494
2511
|
e && a(e);
|
|
2495
2512
|
});
|
|
2496
|
-
}, u = !!o || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...
|
|
2513
|
+
}, u = !!o || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...mn(i.modelsByProvider, i.catalogGroup)] : mn(i.modelsByProvider);
|
|
2497
2514
|
return /* @__PURE__ */ F(s, {
|
|
2498
2515
|
value: n,
|
|
2499
2516
|
onChange: r,
|
|
@@ -2513,8 +2530,8 @@ function mn({ task: e }) {
|
|
|
2513
2530
|
maxHeight: 220
|
|
2514
2531
|
});
|
|
2515
2532
|
}
|
|
2516
|
-
function
|
|
2517
|
-
let { startOrchestrator: e } = tt(), t = $(), [n, r] = N(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } =
|
|
2533
|
+
function gn() {
|
|
2534
|
+
let { startOrchestrator: e } = tt(), t = $(), [n, r] = N(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Pt(), l = (t) => {
|
|
2518
2535
|
t.text.trim() && (e(t.text.trim(), {
|
|
2519
2536
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
2520
2537
|
model: t.model || void 0
|
|
@@ -2527,7 +2544,7 @@ function hn() {
|
|
|
2527
2544
|
disabled: !n.trim() || u,
|
|
2528
2545
|
onSubmit: l,
|
|
2529
2546
|
attachments: !0,
|
|
2530
|
-
models:
|
|
2547
|
+
models: mn(a),
|
|
2531
2548
|
selectedModel: o,
|
|
2532
2549
|
onModelChange: c,
|
|
2533
2550
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -2535,7 +2552,7 @@ function hn() {
|
|
|
2535
2552
|
maxHeight: 220
|
|
2536
2553
|
});
|
|
2537
2554
|
}
|
|
2538
|
-
function
|
|
2555
|
+
function _n({ chat: e, onClose: t }) {
|
|
2539
2556
|
let n = $(), r = C();
|
|
2540
2557
|
return /* @__PURE__ */ F(h, {
|
|
2541
2558
|
title: n.renameChat,
|
|
@@ -2558,7 +2575,7 @@ function gn({ chat: e, onClose: t }) {
|
|
|
2558
2575
|
})
|
|
2559
2576
|
});
|
|
2560
2577
|
}
|
|
2561
|
-
function
|
|
2578
|
+
function vn(e, t, n = Date.now()) {
|
|
2562
2579
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
2563
2580
|
numeric: "auto",
|
|
2564
2581
|
style: "short"
|
|
@@ -2570,7 +2587,7 @@ function _n(e, t, n = Date.now()) {
|
|
|
2570
2587
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
2571
2588
|
return i.format(0, "minute");
|
|
2572
2589
|
}
|
|
2573
|
-
function
|
|
2590
|
+
function yn({ card: e }) {
|
|
2574
2591
|
let t = $();
|
|
2575
2592
|
return e.humanSummaryOnly ? /* @__PURE__ */ I("div", {
|
|
2576
2593
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
@@ -2626,7 +2643,7 @@ function vn({ card: e }) {
|
|
|
2626
2643
|
]
|
|
2627
2644
|
});
|
|
2628
2645
|
}
|
|
2629
|
-
function
|
|
2646
|
+
function bn({ messages: e }) {
|
|
2630
2647
|
return /* @__PURE__ */ F("div", {
|
|
2631
2648
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2632
2649
|
children: e.map((e, t) => /* @__PURE__ */ F("p", {
|
|
@@ -2635,7 +2652,7 @@ function yn({ messages: e }) {
|
|
|
2635
2652
|
}, t))
|
|
2636
2653
|
});
|
|
2637
2654
|
}
|
|
2638
|
-
function
|
|
2655
|
+
function xn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
2639
2656
|
let c = $(), { locale: d } = w(), [p, m] = N(""), [h, g] = N(0);
|
|
2640
2657
|
k(() => Ie(() => g((e) => e + 1)), []);
|
|
2641
2658
|
let _ = j(() => r ? Ye(e) : [], [
|
|
@@ -2724,20 +2741,20 @@ function bn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2724
2741
|
}), /* @__PURE__ */ F("span", {
|
|
2725
2742
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2726
2743
|
title: `${c.chatStarted.replace("{at}", new Date(qe(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
|
|
2727
|
-
children:
|
|
2744
|
+
children: vn(qe(e), d)
|
|
2728
2745
|
})]
|
|
2729
2746
|
})
|
|
2730
2747
|
}, `${e.subagentId}:${e.entityId}`);
|
|
2731
2748
|
})
|
|
2732
|
-
}), v && /* @__PURE__ */ F(
|
|
2749
|
+
}), v && /* @__PURE__ */ F(_n, {
|
|
2733
2750
|
chat: v,
|
|
2734
2751
|
onClose: () => y(null)
|
|
2735
2752
|
})] });
|
|
2736
2753
|
}
|
|
2737
|
-
function
|
|
2754
|
+
function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
|
|
2738
2755
|
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: C, scope: w } = tt(), T = $(), E = M(null), [D, O] = N(!1);
|
|
2739
|
-
|
|
2740
|
-
let A =
|
|
2756
|
+
cn(w?.id);
|
|
2757
|
+
let A = Ot({
|
|
2741
2758
|
defaultWidth: e,
|
|
2742
2759
|
minWidth: n,
|
|
2743
2760
|
maxWidth: r,
|
|
@@ -2750,7 +2767,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2750
2767
|
e && a.onApplied(e);
|
|
2751
2768
|
}),
|
|
2752
2769
|
onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
|
|
2753
|
-
} : void 0, U = H ?
|
|
2770
|
+
} : void 0, U = H ? mt(L, H.canAnswer) : null, G = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, K = G?.manualEntry ? G : null, q = M(!0);
|
|
2754
2771
|
k(() => {
|
|
2755
2772
|
let e = E.current;
|
|
2756
2773
|
if (!e) return;
|
|
@@ -2780,7 +2797,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2780
2797
|
});
|
|
2781
2798
|
return n.observe(t), () => n.disconnect();
|
|
2782
2799
|
}, [a?.id, o]);
|
|
2783
|
-
let J = s ? /* @__PURE__ */ F(
|
|
2800
|
+
let J = s ? /* @__PURE__ */ F(fn, { userGoal: s }, c) : null, ie = f ? W(f.subagentId) : void 0, ae = f && ie ? /* @__PURE__ */ F(dn, {
|
|
2784
2801
|
manifest: ie,
|
|
2785
2802
|
params: f.snapshot.params,
|
|
2786
2803
|
taskId: Xe(f.subagentId, f.entityId),
|
|
@@ -2788,14 +2805,14 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2788
2805
|
history: f.snapshot.history,
|
|
2789
2806
|
activity: f.snapshot.activity
|
|
2790
2807
|
}
|
|
2791
|
-
}, p) : null, Y = g ? W(g.subagentId) : void 0, oe = g && Y ? /* @__PURE__ */ F(
|
|
2808
|
+
}, p) : null, Y = g ? W(g.subagentId) : void 0, oe = g && Y ? /* @__PURE__ */ F(pn, {
|
|
2792
2809
|
manifest: Y,
|
|
2793
2810
|
extraDestinations: g.extraDestinations
|
|
2794
|
-
}, _) : null, X = b ? W(b.subagentId) : void 0, Z = b && X ? /* @__PURE__ */ F(
|
|
2811
|
+
}, _) : null, X = b ? W(b.subagentId) : void 0, Z = b && X ? /* @__PURE__ */ F(dn, {
|
|
2795
2812
|
manifest: X,
|
|
2796
2813
|
params: b.params,
|
|
2797
2814
|
extraDestinations: b.extraDestinations
|
|
2798
|
-
}, x) : null, se = S ? W(S.subagentId) : void 0, ce = S && se ? /* @__PURE__ */ F(
|
|
2815
|
+
}, x) : null, se = S ? W(S.subagentId) : void 0, ce = S && se ? /* @__PURE__ */ F(dn, {
|
|
2799
2816
|
manifest: se,
|
|
2800
2817
|
params: S.params,
|
|
2801
2818
|
taskId: S.taskId,
|
|
@@ -2811,7 +2828,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2811
2828
|
style: { width: A.width },
|
|
2812
2829
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
2813
2830
|
children: [
|
|
2814
|
-
/* @__PURE__ */ F(
|
|
2831
|
+
/* @__PURE__ */ F(kt, {
|
|
2815
2832
|
width: A.width,
|
|
2816
2833
|
min: A.min,
|
|
2817
2834
|
max: A.max,
|
|
@@ -2826,7 +2843,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2826
2843
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
2827
2844
|
children: a ? a.title : "Agentico"
|
|
2828
2845
|
}),
|
|
2829
|
-
w && /* @__PURE__ */ F(
|
|
2846
|
+
w && /* @__PURE__ */ F(xn, {
|
|
2830
2847
|
scopeId: w.id,
|
|
2831
2848
|
currentTaskId: a?.id ?? null,
|
|
2832
2849
|
open: D,
|
|
@@ -2835,7 +2852,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2835
2852
|
onSelect: (e, t, n) => h(e, t, n),
|
|
2836
2853
|
onArchivedCurrent: m
|
|
2837
2854
|
}),
|
|
2838
|
-
/* @__PURE__ */ F(
|
|
2855
|
+
/* @__PURE__ */ F(At, {})
|
|
2839
2856
|
]
|
|
2840
2857
|
}),
|
|
2841
2858
|
/* @__PURE__ */ F("div", {
|
|
@@ -2849,7 +2866,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2849
2866
|
className: "text-xs text-muted-foreground",
|
|
2850
2867
|
children: a.manualEntry.prompt
|
|
2851
2868
|
}),
|
|
2852
|
-
/* @__PURE__ */ F(
|
|
2869
|
+
/* @__PURE__ */ F(vt, {
|
|
2853
2870
|
activity: ee,
|
|
2854
2871
|
questions: H,
|
|
2855
2872
|
docked: U,
|
|
@@ -2859,7 +2876,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2859
2876
|
className: "mt-3",
|
|
2860
2877
|
children: a.panelExtra
|
|
2861
2878
|
}),
|
|
2862
|
-
B.length > 0 && /* @__PURE__ */ F(
|
|
2879
|
+
B.length > 0 && /* @__PURE__ */ F(vt, {
|
|
2863
2880
|
activity: B,
|
|
2864
2881
|
questions: H,
|
|
2865
2882
|
docked: U,
|
|
@@ -2897,7 +2914,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2897
2914
|
})
|
|
2898
2915
|
]
|
|
2899
2916
|
})
|
|
2900
|
-
] }) : d.length > 0 ? /* @__PURE__ */ F(
|
|
2917
|
+
] }) : d.length > 0 ? /* @__PURE__ */ F(bn, { messages: d }) : u ? /* @__PURE__ */ F(yn, { card: u }) : /* @__PURE__ */ F("p", {
|
|
2901
2918
|
className: "text-xs text-muted-foreground",
|
|
2902
2919
|
children: l ?? T.orchestratorStarterHint
|
|
2903
2920
|
})
|
|
@@ -2913,7 +2930,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2913
2930
|
}),
|
|
2914
2931
|
/* @__PURE__ */ F("div", {
|
|
2915
2932
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
2916
|
-
children: /* @__PURE__ */ F(
|
|
2933
|
+
children: /* @__PURE__ */ F(ht, {
|
|
2917
2934
|
entry: U.entry,
|
|
2918
2935
|
part: U.part,
|
|
2919
2936
|
questions: H,
|
|
@@ -2935,7 +2952,7 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2935
2952
|
children: [a?.panelActions && /* @__PURE__ */ F("div", {
|
|
2936
2953
|
className: "mb-2",
|
|
2937
2954
|
children: a.panelActions
|
|
2938
|
-
}), a ? /* @__PURE__ */ F(
|
|
2955
|
+
}), a ? /* @__PURE__ */ F(hn, { task: a }, a.id) : /* @__PURE__ */ F(gn, {})]
|
|
2939
2956
|
})
|
|
2940
2957
|
]
|
|
2941
2958
|
})
|
|
@@ -2949,13 +2966,13 @@ function xn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2949
2966
|
}
|
|
2950
2967
|
//#endregion
|
|
2951
2968
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
2952
|
-
function
|
|
2969
|
+
function Cn(e, t) {
|
|
2953
2970
|
let { setPageContext: n } = tt(), r = M(crypto.randomUUID()).current;
|
|
2954
2971
|
k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
2955
2972
|
}
|
|
2956
2973
|
//#endregion
|
|
2957
2974
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
2958
|
-
function
|
|
2975
|
+
function wn(e, t, n, r, i = !0, a) {
|
|
2959
2976
|
let { registerComponentAnchor: o } = tt(), s = M(crypto.randomUUID()).current, c = M(n);
|
|
2960
2977
|
c.current = n, k(() => {
|
|
2961
2978
|
if (i) return o(s, {
|
|
@@ -2974,6 +2991,6 @@ function Cn(e, t, n, r, i = !0, a) {
|
|
|
2974
2991
|
]);
|
|
2975
2992
|
}
|
|
2976
2993
|
//#endregion
|
|
2977
|
-
export {
|
|
2994
|
+
export { xt as AGENTICO_MAX_WIDTH, bt as AGENTICO_MIN_WIDTH, yt as AGENTICO_WIDTH, St as AGENTICO_WIDTH_STORAGE_KEY, Sn as Agentico, et as AgenticoProvider, At as AgenticoToggle, R as DEFAULT_REASONING_PART_ID, L as DEFAULT_TEXT_PART_ID, ve as JSON_EXPORT_DESTINATION_ID, pe as MICRO_PROMPT_REGISTRY, Qe as ORCHESTRATOR_TASK_ID, fe as SUMMARY_MICRO_PROMPT, Te as agenticoDe, Ce as agenticoEn, we as agenticoIt, ie as agenticoPromptsEn, ae as agenticoPromptsIt, Ze as agenticoTranslations, me as applyMicroPrompts, We as chatHasPersonMessage, qe as chatStartedAt, Ue as chatTitle, oe as configureAgenticoPrompts, Oe as configureEntityChatStore, q as createCrossAgentTools, te as defineSubagent, Xe as entityChatTaskId, he as extractErrorMessage, ge as extractJsonBlock, W as findSubagentManifest, B as formatQuestionAnswers, X as getAgenticoPrompts, Se as getDestinationRegistry, Re as getEntityChat, nn as getSubagentControls, U as getSubagentRegistry, Zt as getSubagentReport, ke as hasEntityChatBackend, ye as jsonExportDestination, Ye as listEntityChats, ee as messagePartsText, Ie as onEntityChatsChange, K as registerCrossAgentTools, xe as registerDestinations, tn as registerSubagentControls, Xt as registerSubagentReports, H as registerSubagents, Je as removeEntityChat, Ke as renameEntityChat, de as renderRegistryCli, ue as renderSubagentCli, Z as resetAgenticoPrompts, ze as saveEntityChat, Me as syncEntityChats, ne as toJsonSchema, re as toMcpTool, z as upsertMessagePart, Vt as useAgent, tt as useAgentico, $ as useAgenticoI18n, Cn as useAgenticoPageContext, wn as useSubagentComponentContext };
|
|
2978
2995
|
|
|
2979
2996
|
//# sourceMappingURL=index.mjs.map
|