@llmnative/agentico 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -342,7 +342,6 @@ var we = {
342
342
  resizePanel: "Resize the agent panel",
343
343
  resizePanelHint: "Drag to resize, double-click to reset",
344
344
  pendingQuestions: "Questions of the agent",
345
- retryFromHere: "Retry from here",
346
345
  editMessage: "Edit",
347
346
  editingMessage: "Editing a message: sent, the chat goes back to it.",
348
347
  cancelEdit: "Cancel",
@@ -411,7 +410,6 @@ var we = {
411
410
  resizePanel: "Ridimensiona il pannello dell'agente",
412
411
  resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
413
412
  pendingQuestions: "Domande dell'agente",
414
- retryFromHere: "Riprova da qui",
415
413
  editMessage: "Modifica",
416
414
  editingMessage: "Modifichi un messaggio: inviato, la chat torna a quel punto.",
417
415
  cancelEdit: "Annulla",
@@ -480,7 +478,6 @@ var we = {
480
478
  resizePanel: "Agent-Bereich in der Größe ändern",
481
479
  resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
482
480
  pendingQuestions: "Fragen des Agenten",
483
- retryFromHere: "Ab hier wiederholen",
484
481
  editMessage: "Bearbeiten",
485
482
  editingMessage: "Du bearbeitest eine Nachricht: gesendet, geht der Chat dorthin zurück.",
486
483
  cancelEdit: "Abbrechen",
@@ -938,41 +935,44 @@ function ct({ status: e }) {
938
935
  function lt(e, t) {
939
936
  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;
940
937
  }
941
- var ut = 96;
942
- function dt({ entry: e, pinned: n = !0, actions: r }) {
943
- let i = $(), a = j(null), [o, s] = M(!1), [c, l] = M(!1);
938
+ var ut = 96, dt = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
939
+ function ft({ entry: e, pinned: n = !0, actions: r, cut: i = !1 }) {
940
+ let a = $(), o = j(null), [s, c] = M(!1), [l, u] = M(!1);
944
941
  te(() => {
945
- let e = a.current;
946
- e && l(e.scrollHeight > 97);
942
+ let e = o.current;
943
+ e && u(e.scrollHeight > 97);
947
944
  }, [e.detail, e.attachmentNames]);
948
- let u = c && !o;
945
+ let d = l && !s;
949
946
  return /* @__PURE__ */ F("div", {
950
947
  className: `${n ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start justify-end gap-1 bg-background py-1.5`,
951
948
  children: [r?.available(e) && /* @__PURE__ */ F("span", {
952
- className: "flex shrink-0 items-center opacity-50 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
953
- children: [/* @__PURE__ */ P(t, {
949
+ className: "flex shrink-0 items-center",
950
+ children: [i && /* @__PURE__ */ P(t, {
954
951
  icon: "rotate-ccw",
955
- ariaLabel: i.retryFromHere,
956
- title: i.retryFromHere,
952
+ ariaLabel: a.retry,
953
+ title: a.retry,
957
954
  variant: "link",
958
955
  className: "p-1 text-muted-foreground hover:text-foreground",
959
956
  disabled: r.disabled,
960
957
  onClick: () => r.onRetry(e)
961
- }), /* @__PURE__ */ P(t, {
962
- icon: "pencil",
963
- ariaLabel: i.editMessage,
964
- title: i.editMessage,
965
- variant: "link",
966
- className: "p-1 text-muted-foreground hover:text-foreground",
967
- disabled: r.disabled,
968
- onClick: () => r.onEdit(e)
958
+ }), /* @__PURE__ */ P("span", {
959
+ className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
960
+ children: /* @__PURE__ */ P(t, {
961
+ icon: "pencil",
962
+ ariaLabel: a.editMessage,
963
+ title: a.editMessage,
964
+ variant: "link",
965
+ className: "p-1 text-muted-foreground hover:text-foreground",
966
+ disabled: r.disabled,
967
+ onClick: () => r.onEdit(e)
968
+ })
969
969
  })]
970
970
  }), /* @__PURE__ */ F("div", {
971
971
  className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
972
972
  children: [/* @__PURE__ */ F("div", {
973
- ref: a,
974
- className: `space-y-1 px-2.5 pt-1.5 ${u ? "overflow-hidden" : ""}`,
975
- style: u ? { maxHeight: ut } : void 0,
973
+ ref: o,
974
+ className: `space-y-1 px-2.5 pt-1.5 ${d ? "overflow-hidden" : ""}`,
975
+ style: d ? { maxHeight: ut } : void 0,
976
976
  children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ P("div", {
977
977
  className: "flex flex-wrap gap-1",
978
978
  children: e.attachmentNames.map((e, t) => /* @__PURE__ */ F("span", {
@@ -987,26 +987,26 @@ function dt({ entry: e, pinned: n = !0, actions: r }) {
987
987
  })]
988
988
  }, t))
989
989
  }), /* @__PURE__ */ P(ot, { text: e.detail ?? "" })]
990
- }), c && /* @__PURE__ */ F("button", {
990
+ }), l && /* @__PURE__ */ F("button", {
991
991
  type: "button",
992
- onClick: () => s((e) => !e),
992
+ onClick: () => c((e) => !e),
993
993
  className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
994
- title: o ? "Comprimi" : "Espandi",
995
- children: [u && /* @__PURE__ */ P("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ P(f, {
996
- name: o ? "chevron-up" : "chevron-down",
994
+ title: s ? "Comprimi" : "Espandi",
995
+ children: [d && /* @__PURE__ */ P("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ P(f, {
996
+ name: s ? "chevron-up" : "chevron-down",
997
997
  size: 12
998
998
  })]
999
999
  })]
1000
1000
  })]
1001
1001
  });
1002
1002
  }
1003
- var ft = {
1003
+ var pt = {
1004
1004
  running: "loader-circle",
1005
1005
  done: "check",
1006
1006
  error: "x",
1007
1007
  stopped: "circle-slash"
1008
1008
  };
1009
- function pt({ steps: e }) {
1009
+ function mt({ steps: e }) {
1010
1010
  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 : b(t.steps, { count: e.length }));
1011
1011
  return /* @__PURE__ */ P(v, {
1012
1012
  ariaLabel: t.stepsLabel,
@@ -1022,12 +1022,12 @@ function pt({ steps: e }) {
1022
1022
  className: e.status === "error" ? "text-destructive" : void 0,
1023
1023
  children: e.label
1024
1024
  }),
1025
- icon: ft[e.status]
1025
+ icon: pt[e.status]
1026
1026
  }))
1027
1027
  }]
1028
1028
  });
1029
1029
  }
1030
- function mt({ entry: e, part: a, questions: o }) {
1030
+ function ht({ entry: e, part: a, questions: o }) {
1031
1031
  let s = $(), [c, l] = M(!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";
1032
1032
  return /* @__PURE__ */ F(r, {
1033
1033
  headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
@@ -1101,7 +1101,7 @@ function mt({ entry: e, part: a, questions: o }) {
1101
1101
  })]
1102
1102
  });
1103
1103
  }
1104
- function ht(e, t) {
1104
+ function gt(e, t) {
1105
1105
  let n = e.at(-1);
1106
1106
  if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
1107
1107
  let r = [...n.parts].reverse().find((e) => e.type === "questions");
@@ -1110,7 +1110,7 @@ function ht(e, t) {
1110
1110
  part: r
1111
1111
  };
1112
1112
  }
1113
- function gt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1113
+ function _t({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1114
1114
  let o = !!n?.canAnswer(e.id);
1115
1115
  return /* @__PURE__ */ P(a, {
1116
1116
  questions: t.questions,
@@ -1121,7 +1121,7 @@ function gt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1121
1121
  className: i ?? "text-xs"
1122
1122
  });
1123
1123
  }
1124
- function _t({ entry: e, questions: t, hiddenPartId: n }) {
1124
+ function vt({ entry: e, questions: t, hiddenPartId: n }) {
1125
1125
  let r = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), a = [];
1126
1126
  for (let e of r) {
1127
1127
  let t = a.at(-1);
@@ -1136,7 +1136,7 @@ function _t({ entry: e, questions: t, hiddenPartId: n }) {
1136
1136
  return /* @__PURE__ */ P("div", {
1137
1137
  className: "space-y-2",
1138
1138
  children: a.map((n) => {
1139
- if ("steps" in n) return /* @__PURE__ */ P(pt, { steps: n.steps }, n.key);
1139
+ if ("steps" in n) return /* @__PURE__ */ P(mt, { steps: n.steps }, n.key);
1140
1140
  let { part: r } = n;
1141
1141
  return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ P(i, {
1142
1142
  content: r.text,
@@ -1147,11 +1147,11 @@ function _t({ entry: e, questions: t, hiddenPartId: n }) {
1147
1147
  streaming: r.streaming,
1148
1148
  duration: r.duration,
1149
1149
  className: "my-0"
1150
- }, n.key) : r.type === "card" ? /* @__PURE__ */ P(mt, {
1150
+ }, n.key) : r.type === "card" ? /* @__PURE__ */ P(ht, {
1151
1151
  entry: e,
1152
1152
  part: r,
1153
1153
  questions: t
1154
- }, n.key) : /* @__PURE__ */ P(gt, {
1154
+ }, n.key) : /* @__PURE__ */ P(_t, {
1155
1155
  entry: e,
1156
1156
  part: r,
1157
1157
  questions: t
@@ -1159,13 +1159,13 @@ function _t({ entry: e, questions: t, hiddenPartId: n }) {
1159
1159
  })
1160
1160
  });
1161
1161
  }
1162
- function vt({ entry: e, questions: t, hiddenPartId: n }) {
1162
+ function yt({ entry: e, questions: t, hiddenPartId: n }) {
1163
1163
  let r = $();
1164
1164
  if (e.kind === "thinking" && e.parts) {
1165
1165
  let i = e.status === "error" || e.status === "stopped" || e.status === "running";
1166
1166
  return /* @__PURE__ */ F("li", {
1167
1167
  className: "text-xs text-muted-foreground",
1168
- children: [e.parts.length > 0 && /* @__PURE__ */ P(_t, {
1168
+ children: [e.parts.length > 0 && /* @__PURE__ */ P(vt, {
1169
1169
  entry: e,
1170
1170
  questions: t,
1171
1171
  hiddenPartId: n
@@ -1213,7 +1213,7 @@ function vt({ entry: e, questions: t, hiddenPartId: n }) {
1213
1213
  ]
1214
1214
  });
1215
1215
  }
1216
- function yt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i }) {
1216
+ function bt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i }) {
1217
1217
  if (e.length === 0) return null;
1218
1218
  let a = [];
1219
1219
  for (let t of e) t.kind === "user" || a.length === 0 ? a.push(t.kind === "user" ? {
@@ -1222,13 +1222,14 @@ function yt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, mes
1222
1222
  } : { entries: [t] }) : a[a.length - 1].entries.push(t);
1223
1223
  return /* @__PURE__ */ P("ul", {
1224
1224
  className: "space-y-0.5",
1225
- children: a.map((e) => /* @__PURE__ */ F("li", { children: [e.user && /* @__PURE__ */ P(dt, {
1225
+ children: a.map((e) => /* @__PURE__ */ F("li", { children: [e.user && /* @__PURE__ */ P(ft, {
1226
1226
  entry: e.user,
1227
1227
  pinned: r,
1228
- actions: i
1228
+ actions: i,
1229
+ cut: dt(e.entries)
1229
1230
  }), e.entries.length > 0 && /* @__PURE__ */ P("ul", {
1230
1231
  className: "space-y-0.5",
1231
- children: e.entries.map((e) => /* @__PURE__ */ P(vt, {
1232
+ children: e.entries.map((e) => /* @__PURE__ */ P(yt, {
1232
1233
  entry: e,
1233
1234
  questions: t,
1234
1235
  hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
@@ -1238,55 +1239,55 @@ function yt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, mes
1238
1239
  }
1239
1240
  //#endregion
1240
1241
  //#region src/presentation/panelWidth.ts
1241
- var bt = 420, xt = 320, St = "60vw", Ct = "agentico:panel-width";
1242
- function wt(e, t) {
1242
+ var xt = 420, St = 320, Ct = "60vw", wt = "agentico:panel-width";
1243
+ function Tt(e, t) {
1243
1244
  if (typeof e == "number") return e;
1244
1245
  let n = Number.parseFloat(e);
1245
1246
  return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1246
1247
  }
1247
- function Tt(e, t, n) {
1248
+ function Et(e, t, n) {
1248
1249
  return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1249
1250
  }
1250
- function Et() {
1251
+ function Dt() {
1251
1252
  try {
1252
- let e = window.localStorage.getItem(Ct), t = e === null ? NaN : Number(e);
1253
+ let e = window.localStorage.getItem(wt), t = e === null ? NaN : Number(e);
1253
1254
  return Number.isFinite(t) && t > 0 ? t : null;
1254
1255
  } catch {
1255
1256
  return null;
1256
1257
  }
1257
1258
  }
1258
- function Dt(e) {
1259
+ function Ot(e) {
1259
1260
  try {
1260
- e === null ? window.localStorage.removeItem(Ct) : window.localStorage.setItem(Ct, String(e));
1261
+ e === null ? window.localStorage.removeItem(wt) : window.localStorage.setItem(wt, String(e));
1261
1262
  } catch {}
1262
1263
  }
1263
- function Ot() {
1264
+ function kt() {
1264
1265
  return typeof window > "u" ? Infinity : window.innerWidth;
1265
1266
  }
1266
- function kt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = St, onWidthChange: r }) {
1267
- let [i, a] = M(Ot), [o, s] = M(() => Et() ?? e);
1267
+ function At({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = Ct, onWidthChange: r }) {
1268
+ let [i, a] = M(kt), [o, s] = M(() => Dt() ?? e);
1268
1269
  k(() => {
1269
1270
  if (typeof window > "u") return;
1270
1271
  let e = () => a(window.innerWidth);
1271
1272
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1272
1273
  }, []);
1273
- let c = t, l = Math.max(c, wt(n, i)), u = Tt(o, c, l);
1274
+ let c = t, l = Math.max(c, Tt(n, i)), u = Et(o, c, l);
1274
1275
  return k(() => {
1275
1276
  r?.(u);
1276
1277
  }, [u]), {
1277
1278
  width: u,
1278
1279
  min: c,
1279
1280
  max: l,
1280
- set: O((e) => s(Tt(e, c, l)), [c, l]),
1281
- commit: O((e) => Dt(Tt(e, c, l)), [c, l]),
1281
+ set: O((e) => s(Et(e, c, l)), [c, l]),
1282
+ commit: O((e) => Ot(Et(e, c, l)), [c, l]),
1282
1283
  reset: O(() => {
1283
- s(e), Dt(null);
1284
+ s(e), Ot(null);
1284
1285
  }, [e])
1285
1286
  };
1286
1287
  }
1287
1288
  //#endregion
1288
1289
  //#region src/presentation/AgenticoResizeHandle.tsx
1289
- function At({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1290
+ function jt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1290
1291
  let o = $(), s = j(null), [c, l] = M(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
1291
1292
  let t = s.current;
1292
1293
  if (t && t.pointerId === e.pointerId) {
@@ -1344,7 +1345,7 @@ function At({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1344
1345
  }
1345
1346
  //#endregion
1346
1347
  //#region src/presentation/AgenticoToggle.tsx
1347
- function jt({ className: e = "" }) {
1348
+ function Mt({ className: e = "" }) {
1348
1349
  let { isOpen: n, toggleOpen: r, task: i } = nt(), a = $(), o = i?.agent.running ?? !1;
1349
1350
  return /* @__PURE__ */ P(t, {
1350
1351
  icon: "bot",
@@ -1357,21 +1358,21 @@ function jt({ className: e = "" }) {
1357
1358
  }
1358
1359
  //#endregion
1359
1360
  //#region src/presentation/useAIModelCatalog.ts
1360
- var Mt = "llmnative-cms.selectedAIModel";
1361
- function Nt() {
1361
+ var Nt = "llmnative-cms.selectedAIModel";
1362
+ function Pt() {
1362
1363
  try {
1363
- return localStorage.getItem(Mt) ?? "";
1364
+ return localStorage.getItem(Nt) ?? "";
1364
1365
  } catch {
1365
1366
  return "";
1366
1367
  }
1367
1368
  }
1368
- function Pt(e) {
1369
+ function Ft(e) {
1369
1370
  try {
1370
- e ? localStorage.setItem(Mt, e) : localStorage.removeItem(Mt);
1371
+ e ? localStorage.setItem(Nt, e) : localStorage.removeItem(Nt);
1371
1372
  } catch {}
1372
1373
  }
1373
- function Ft() {
1374
- let e = C()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = M({}), [i, a] = M(!1), [o, s] = M(Nt);
1374
+ function It() {
1375
+ let e = C()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = M({}), [i, a] = M(!1), [o, s] = M(Pt);
1375
1376
  return k(() => {
1376
1377
  if (!t) {
1377
1378
  r({});
@@ -1382,7 +1383,7 @@ function Ft() {
1382
1383
  if (n) return;
1383
1384
  r(e.modelsByProvider);
1384
1385
  let t = Object.values(e.modelsByProvider).flat();
1385
- s((e) => t.some((t) => t.id === e) ? e : (Pt(""), ""));
1386
+ s((e) => t.some((t) => t.id === e) ? e : (Ft(""), ""));
1386
1387
  }).catch((e) => {
1387
1388
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
1388
1389
  }).finally(() => {
@@ -1396,17 +1397,17 @@ function Ft() {
1396
1397
  modelsLoading: i,
1397
1398
  selectedModel: o,
1398
1399
  setSelectedModel: (e) => {
1399
- Pt(e), s(e);
1400
+ Ft(e), s(e);
1400
1401
  }
1401
1402
  };
1402
1403
  }
1403
1404
  //#endregion
1404
1405
  //#region src/domain/approval.ts
1405
- var It = "approval";
1406
- function Lt(e, t) {
1406
+ var Lt = "approval";
1407
+ function Rt(e, t) {
1407
1408
  return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1408
1409
  }
1409
- function Rt(e, t, n) {
1410
+ function zt(e, t, n) {
1410
1411
  let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1411
1412
  return {
1412
1413
  approved: r.includes(t) && !r.includes(n),
@@ -1415,11 +1416,11 @@ function Rt(e, t, n) {
1415
1416
  }
1416
1417
  //#endregion
1417
1418
  //#region src/presentation/useAgent.ts
1418
- var zt = 20, Bt = 26e4;
1419
- function Vt(e) {
1420
- return e.filter((e) => !_.isTextAttachment(e.mimeType) || e.base64.length <= Bt);
1421
- }
1419
+ var Bt = 20, Vt = 26e4;
1422
1420
  function Ht(e) {
1421
+ return e.filter((e) => !_.isTextAttachment(e.mimeType) || e.base64.length <= Vt);
1422
+ }
1423
+ function Ut(e) {
1423
1424
  return e.map((e) => e.status !== "running" && !e.parts?.some((e) => e.type === "tool" && e.status === "running" || (e.type === "text" || e.type === "reasoning") && e.streaming) ? e : {
1424
1425
  ...e,
1425
1426
  status: e.status === "running" ? "stopped" : e.status,
@@ -1432,8 +1433,8 @@ function Ht(e) {
1432
1433
  } : e) } : {}
1433
1434
  });
1434
1435
  }
1435
- function Ut(e, t = {}) {
1436
- let { defaultEnabled: n = !1 } = t, [r, i] = M(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Ft(), [u, d] = M(!1), [f, p] = M(null), [m, h] = M(!1), [g, v] = M([]), y = j([]), b = (e) => {
1436
+ function Wt(e, t = {}) {
1437
+ let { defaultEnabled: n = !1 } = t, [r, i] = M(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = It(), [u, d] = M(!1), [f, p] = M(null), [m, h] = M(!1), [g, v] = M([]), y = j([]), b = (e) => {
1437
1438
  v((t) => {
1438
1439
  let n = typeof e == "function" ? e(t) : e;
1439
1440
  return y.current = n, n;
@@ -1633,7 +1634,7 @@ function Ut(e, t = {}) {
1633
1634
  let f = s ? x(s) : U, m = f ? N[f.provider] : null;
1634
1635
  if (!m || !f) return p(T.current.noProviderAvailable), null;
1635
1636
  n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
1636
- let h = (n ?? []).filter((e) => _.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Bt ? `\n\n[File allegato: ${e.name}]\n${_.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(""), g = Vt(n ?? []), v = d.tools.map((e) => ({
1637
+ let h = (n ?? []).filter((e) => _.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Vt ? `\n\n[File allegato: ${e.name}]\n${_.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(""), g = Ht(n ?? []), v = d.tools.map((e) => ({
1637
1638
  name: e.name,
1638
1639
  description: e.description,
1639
1640
  inputSchema: re(e.inputSchema)
@@ -1646,7 +1647,7 @@ function Ut(e, t = {}) {
1646
1647
  status: "running",
1647
1648
  parts: [{
1648
1649
  type: "questions",
1649
- id: It,
1650
+ id: Lt,
1650
1651
  questions: [{
1651
1652
  header: i.approvalHeader,
1652
1653
  question: i.approveQuestion.replace("{action}", o),
@@ -1655,7 +1656,7 @@ function Ut(e, t = {}) {
1655
1656
  }]
1656
1657
  }]
1657
1658
  }]);
1658
- let s = `${a}:${It}`;
1659
+ let s = `${a}:${Lt}`;
1659
1660
  return new Promise((e, t) => {
1660
1661
  let n = () => {
1661
1662
  S.current.delete(s), D(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
@@ -1666,7 +1667,7 @@ function Ut(e, t = {}) {
1666
1667
  }
1667
1668
  r.addEventListener("abort", n, { once: !0 }), S.current.set(s, {
1668
1669
  resolve: (t) => {
1669
- r.removeEventListener("abort", n), D(a, "done"), e(Rt(t, i.approve, i.reject));
1670
+ r.removeEventListener("abort", n), D(a, "done"), e(zt(t, i.approve, i.reject));
1670
1671
  },
1671
1672
  reject: t
1672
1673
  });
@@ -1681,7 +1682,7 @@ function Ut(e, t = {}) {
1681
1682
  } : i));
1682
1683
  try {
1683
1684
  let n = d.history, r = t;
1684
- for (let t = 0; t < zt; t++) {
1685
+ for (let t = 0; t < Bt; t++) {
1685
1686
  let i = crypto.randomUUID();
1686
1687
  b((e) => [...e, {
1687
1688
  id: i,
@@ -1741,7 +1742,7 @@ function Ut(e, t = {}) {
1741
1742
  let s = /* @__PURE__ */ new Map();
1742
1743
  for (let t of a.toolCalls) {
1743
1744
  let n = C.get(t.name);
1744
- if (n && Lt(n, t.input)) try {
1745
+ if (n && Rt(n, t.input)) try {
1745
1746
  s.set(t.id, await y(t.id, n, t.input, w.signal));
1746
1747
  } catch {
1747
1748
  return e.fallback(d.params, d.context);
@@ -1900,7 +1901,7 @@ function Ut(e, t = {}) {
1900
1901
  p(T.current.requestInProgress);
1901
1902
  return;
1902
1903
  }
1903
- D.current = !0, p(null), b(Ht(n.activity)), d(!0);
1904
+ D.current = !0, p(null), b(Ut(n.activity)), d(!0);
1904
1905
  try {
1905
1906
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1906
1907
  E.current = {
@@ -2024,23 +2025,23 @@ function Ut(e, t = {}) {
2024
2025
  }
2025
2026
  //#endregion
2026
2027
  //#region src/domain/orchestrator/prompt.ts
2027
- function Wt() {
2028
+ function Gt() {
2028
2029
  let e = X();
2029
2030
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
2030
2031
  }
2031
- function Gt(e, t, n) {
2032
+ function Kt(e, t, n) {
2032
2033
  let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
2033
2034
  return `${r.orchestratorIntro}
2034
2035
 
2035
2036
  ${r.toolsHeading}
2036
2037
  ${t}
2037
2038
  ${i}
2038
- ${Wt()}
2039
+ ${Gt()}
2039
2040
 
2040
2041
  ${r.userRequestHeading}
2041
2042
  ${e}`;
2042
2043
  }
2043
- function Kt(e, t) {
2044
+ function qt(e, t) {
2044
2045
  return t ? {
2045
2046
  kind: "handoff",
2046
2047
  ...t
@@ -2051,27 +2052,27 @@ function Kt(e, t) {
2051
2052
  }
2052
2053
  //#endregion
2053
2054
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
2054
- function qt(e) {
2055
+ function Jt(e) {
2055
2056
  return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
2056
2057
  }
2057
- function Jt(e) {
2058
+ function Yt(e) {
2058
2059
  return {
2059
2060
  buildContext(e) {
2060
2061
  return {
2061
- cliCatalog: pe(qt(e.scopedSubagentId)),
2062
+ cliCatalog: pe(Jt(e.scopedSubagentId)),
2062
2063
  handoff: { current: null },
2063
2064
  collected: {}
2064
2065
  };
2065
2066
  },
2066
2067
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
2067
- return Gt(e, n, t);
2068
+ return Kt(e, n, t);
2068
2069
  },
2069
2070
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
2070
- return `${e}\n\n${Wt()}\n\n${X().toolsHeading}\n${n}`;
2071
+ return `${e}\n\n${Gt()}\n\n${X().toolsHeading}\n${n}`;
2071
2072
  },
2072
2073
  parseResponse(e, t, n) {
2073
2074
  let r = n.handoff.current;
2074
- return n.handoff.current = null, Kt(e, r);
2075
+ return n.handoff.current = null, qt(e, r);
2075
2076
  },
2076
2077
  fallback() {
2077
2078
  return {
@@ -2087,7 +2088,7 @@ function Jt(e) {
2087
2088
  attachmentsRef: r,
2088
2089
  collected: n.collected,
2089
2090
  proxyFetch: S
2090
- }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = qt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2091
+ }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Jt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2091
2092
  name: `${t.id}_${r.name}`,
2092
2093
  description: `${t.label}: ${r.summary}`,
2093
2094
  inputSchema: r.inputSchema,
@@ -2111,12 +2112,12 @@ function Jt(e) {
2111
2112
  }
2112
2113
  //#endregion
2113
2114
  //#region src/presentation/deriveHistoryTitle.ts
2114
- function Yt(e, t) {
2115
+ function Xt(e, t) {
2115
2116
  return e.deriveHistoryTitle?.(t) ?? e.label;
2116
2117
  }
2117
2118
  //#endregion
2118
2119
  //#region src/presentation/ResultDestinationPicker.tsx
2119
- function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2120
+ function Zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2120
2121
  let s = $(), c = nt(), l = c.scope, u = E(), [d, f] = M(null), [p, m] = M(new Set(i ?? [])), [h, g] = M(null), _ = Ce(), v = /* @__PURE__ */ new Map();
2121
2122
  e.destinationIds.forEach((e) => {
2122
2123
  let t = _[e];
@@ -2134,7 +2135,7 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2134
2135
  storageProvider: l?.storageProvider ?? null,
2135
2136
  proxyFetch: u
2136
2137
  }, n);
2137
- m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Yt(e, n));
2138
+ m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Xt(e, n));
2138
2139
  } catch (e) {
2139
2140
  g(e instanceof Error ? e.message : String(e));
2140
2141
  } finally {
@@ -2167,16 +2168,16 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2167
2168
  }
2168
2169
  //#endregion
2169
2170
  //#region src/presentation/reports/subagentReportRegistry.tsx
2170
- var Zt = {};
2171
- function Qt(e) {
2172
- Object.assign(Zt, e);
2173
- }
2171
+ var Qt = {};
2174
2172
  function $t(e) {
2175
- return Zt[e];
2173
+ Object.assign(Qt, e);
2174
+ }
2175
+ function en(e) {
2176
+ return Qt[e];
2176
2177
  }
2177
2178
  //#endregion
2178
2179
  //#region src/presentation/reports/GenericResultPreview.tsx
2179
- function en({ result: e }) {
2180
+ function tn({ result: e }) {
2180
2181
  let [t, n] = M(!1);
2181
2182
  return /* @__PURE__ */ F("div", {
2182
2183
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -2193,7 +2194,7 @@ function en({ result: e }) {
2193
2194
  }
2194
2195
  //#endregion
2195
2196
  //#region src/presentation/liveAnchorDestination.ts
2196
- function tn(e, t, n) {
2197
+ function nn(e, t, n) {
2197
2198
  return e.length === 0 ? null : {
2198
2199
  id: "live-component",
2199
2200
  label: "Applica al componente aperto",
@@ -2204,38 +2205,38 @@ function tn(e, t, n) {
2204
2205
  }
2205
2206
  //#endregion
2206
2207
  //#region src/presentation/subagentControls.ts
2207
- var nn = {};
2208
- function rn(e) {
2209
- Object.assign(nn, e);
2210
- }
2208
+ var rn = {};
2211
2209
  function an(e) {
2212
- return nn[e];
2210
+ Object.assign(rn, e);
2211
+ }
2212
+ function on(e) {
2213
+ return rn[e];
2213
2214
  }
2214
2215
  //#endregion
2215
2216
  //#region src/presentation/chatTitles.ts
2216
- function on(e, t = 6e3) {
2217
+ function sn(e, t = 6e3) {
2217
2218
  let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Ke(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
2218
2219
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
2219
2220
  }
2220
- function sn(e) {
2221
+ function cn(e) {
2221
2222
  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);
2222
2223
  }
2223
- function cn(e, t) {
2224
+ function ln(e, t) {
2224
2225
  try {
2225
2226
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2226
2227
  } catch {
2227
2228
  return;
2228
2229
  }
2229
2230
  }
2230
- function ln(e, t, n, r, i) {
2231
- let a = cn(e, t), o = (e) => {
2231
+ function un(e, t, n, r, i) {
2232
+ let a = ln(e, t), o = (e) => {
2232
2233
  let t = e ? x(e) : null;
2233
2234
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2234
2235
  };
2235
2236
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2236
2237
  }
2237
- function un(e) {
2238
- let t = C()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Ft(), i = j({
2238
+ function dn(e) {
2239
+ let t = C()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = It(), i = j({
2239
2240
  registry: t,
2240
2241
  modelsByProvider: n,
2241
2242
  selectedModel: r
@@ -2249,15 +2250,15 @@ function un(e) {
2249
2250
  if (!e) return !1;
2250
2251
  let o = ze(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2251
2252
  if (!o || !s?.autoTitle || o.name || !Ge(o) || a.current.has(c)) return !1;
2252
- let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = ln(s, o.params, r ?? d, u, l), p = f ? x(f) : null;
2253
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = un(s, o.params, r ?? d, u, l), p = f ? x(f) : null;
2253
2254
  if (!p) return !1;
2254
2255
  a.current.add(c);
2255
2256
  try {
2256
2257
  let r = await l[p.provider].complete({
2257
- prompt: X().chatTitle.replace("{chat}", on(o.activity)),
2258
+ prompt: X().chatTitle.replace("{chat}", sn(o.activity)),
2258
2259
  model: p.model,
2259
2260
  history: []
2260
- }), i = r && r.type === "text" ? sn(r.text) : "";
2261
+ }), i = r && r.type === "text" ? cn(r.text) : "";
2261
2262
  return i ? qe(e, t, n, i, "model") : !1;
2262
2263
  } catch {
2263
2264
  return !1;
@@ -2266,7 +2267,7 @@ function un(e) {
2266
2267
  }
2267
2268
  }, [e]), s = Object.keys(n).length > 0;
2268
2269
  return k(() => {
2269
- e && s && !dn.has(e) && (dn.add(e), (async () => {
2270
+ e && s && !fn.has(e) && (fn.add(e), (async () => {
2270
2271
  for (let t of Xe(e)) {
2271
2272
  let n = W(t.subagentId);
2272
2273
  if (n?.autoTitle) {
@@ -2284,11 +2285,11 @@ function un(e) {
2284
2285
  o
2285
2286
  ]), o;
2286
2287
  }
2287
- var dn = /* @__PURE__ */ new Set(), fn = () => ({});
2288
- function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2289
- let c = Ut(e.definition, { defaultEnabled: !0 }), l = nt(), u = l.scope, d = E(), f = j(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = M(null), h = (t) => {
2288
+ var fn = /* @__PURE__ */ new Set(), pn = () => ({});
2289
+ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2290
+ let c = Wt(e.definition, { defaultEnabled: !0 }), l = nt(), u = l.scope, d = E(), f = j(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = M(null), h = (t) => {
2290
2291
  e.definition.conversational || m(t);
2291
- }, [g, _] = M([]), [v, y] = M(null), b = $t(e.id), x = b?.kind === "selection" ? b : null, [S, C] = M(null), w = j(!1), T = j(0), D = j(null);
2292
+ }, [g, _] = M([]), [v, y] = M(null), b = en(e.id), x = b?.kind === "selection" ? b : null, [S, C] = M(null), w = j(!1), T = j(0), D = j(null);
2292
2293
  p && p !== D.current && (D.current = p, T.current = (r?.length ?? 0) + c.activity.length);
2293
2294
  let O = j(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
2294
2295
  k(() => {
@@ -2312,7 +2313,7 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2312
2313
  ...t,
2313
2314
  pinnedEntityId: r
2314
2315
  }).then((n) => {
2315
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Yt(e, t));
2316
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Xt(e, t));
2316
2317
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2317
2318
  });
2318
2319
  }, [
@@ -2331,11 +2332,11 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2331
2332
  p,
2332
2333
  x,
2333
2334
  S
2334
- ]), L = A(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), R = A(() => tn(L, t, f), [
2335
+ ]), L = A(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), R = A(() => nn(L, t, f), [
2335
2336
  L,
2336
2337
  t,
2337
2338
  f
2338
- ]), z = A(() => R ? [R, ...n ?? []] : n, [R, n]), B = e.chatEntityId?.(t), V = un(u?.id), H = j(!1), U = j(!1);
2339
+ ]), z = A(() => R ? [R, ...n ?? []] : n, [R, n]), B = e.chatEntityId?.(t), V = dn(u?.id), H = j(!1), U = j(!1);
2339
2340
  k(() => {
2340
2341
  let n = !H.current && c.running, i = H.current && !c.running;
2341
2342
  if (H.current = c.running, !n && !i || !B || !u) return;
@@ -2351,14 +2352,14 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2351
2352
  subagentId: e.id,
2352
2353
  entityId: B,
2353
2354
  params: t,
2354
- title: Yt(e, t),
2355
+ title: Xt(e, t),
2355
2356
  history: a.history,
2356
2357
  activity: o
2357
2358
  }), i && e.autoTitle && V(e.id, B, c.selectedModel));
2358
2359
  }, [c.running]);
2359
2360
  let W = () => {
2360
2361
  O.current = !0, c.running && c.stop(), l.closeTask(f);
2361
- }, G = j(an(e.id) ?? fn).current, K = G({
2362
+ }, G = j(on(e.id) ?? pn).current, K = G({
2362
2363
  params: t,
2363
2364
  taskId: f,
2364
2365
  running: c.running,
@@ -2369,7 +2370,7 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2369
2370
  return k(() => {
2370
2371
  O.current || l.openTask({
2371
2372
  id: f,
2372
- title: Yt(e, t),
2373
+ title: Xt(e, t),
2373
2374
  icon: e.icon,
2374
2375
  agent: c,
2375
2376
  onApplied: (e) => h(e),
@@ -2388,12 +2389,12 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2388
2389
  }) : b?.kind === "editable" ? /* @__PURE__ */ P(b.Report, {
2389
2390
  result: p,
2390
2391
  onResultChange: ne
2391
- }) : /* @__PURE__ */ P(en, { result: I }),
2392
+ }) : /* @__PURE__ */ P(tn, { result: I }),
2392
2393
  v && /* @__PURE__ */ F("p", {
2393
2394
  className: "text-xs text-destructive",
2394
2395
  children: ["Salvataggio automatico non riuscito: ", v]
2395
2396
  }),
2396
- /* @__PURE__ */ P(Xt, {
2397
+ /* @__PURE__ */ P(Zt, {
2397
2398
  manifest: e,
2398
2399
  result: I,
2399
2400
  meta: t,
@@ -2434,8 +2435,8 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2434
2435
  }
2435
2436
  //#endregion
2436
2437
  //#region src/presentation/OrchestratorRunner.tsx
2437
- function mn({ userGoal: e }) {
2438
- let t = $(), n = Ut(A(() => Jt({
2438
+ function hn({ userGoal: e }) {
2439
+ let t = $(), n = Wt(A(() => Yt({
2439
2440
  unavailable: t.orchestratorUnavailable,
2440
2441
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2441
2442
  preparing: t.orchestratorPreparing,
@@ -2483,7 +2484,7 @@ function mn({ userGoal: e }) {
2483
2484
  let h = A(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2484
2485
  if (!i) return null;
2485
2486
  let g = W(i.subagentId);
2486
- return g ? /* @__PURE__ */ P(pn, {
2487
+ return g ? /* @__PURE__ */ P(mn, {
2487
2488
  manifest: g,
2488
2489
  params: i.params,
2489
2490
  extraDestinations: c.current,
@@ -2494,8 +2495,8 @@ function mn({ userGoal: e }) {
2494
2495
  }
2495
2496
  //#endregion
2496
2497
  //#region src/presentation/ManualEntryRunner.tsx
2497
- function hn({ manifest: e, extraDestinations: n }) {
2498
- let r = Ut(e.definition, { defaultEnabled: !1 }), i = $(), a = nt(), o = j(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = M(null), [l, u] = M([]), d = $t(e.id), f = d?.kind === "selection" ? d : null, [p, m] = M(null), [h, g] = M(null), _ = j(!1), v = (t) => {
2498
+ function gn({ manifest: e, extraDestinations: n }) {
2499
+ let r = Wt(e.definition, { defaultEnabled: !1 }), i = $(), a = nt(), o = j(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = M(null), [l, u] = M([]), d = en(e.id), f = d?.kind === "selection" ? d : null, [p, m] = M(null), [h, g] = M(null), _ = j(!1), v = (t) => {
2499
2500
  if (!e.manualEntry) return;
2500
2501
  let n;
2501
2502
  try {
@@ -2522,7 +2523,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2522
2523
  p
2523
2524
  ]), S = (e) => {
2524
2525
  u((t) => t.includes(e) ? t : [...t, e]);
2525
- }, C = A(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = A(() => h ? tn(C, h, o) : null, [
2526
+ }, C = A(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = A(() => h ? nn(C, h, o) : null, [
2526
2527
  C,
2527
2528
  h,
2528
2529
  o
@@ -2551,8 +2552,8 @@ function hn({ manifest: e, extraDestinations: n }) {
2551
2552
  }) : d?.kind === "editable" ? /* @__PURE__ */ P(d.Report, {
2552
2553
  result: s,
2553
2554
  onResultChange: b
2554
- }) : /* @__PURE__ */ P(en, { result: x }),
2555
- /* @__PURE__ */ P(Xt, {
2555
+ }) : /* @__PURE__ */ P(tn, { result: x }),
2556
+ /* @__PURE__ */ P(Zt, {
2556
2557
  manifest: e,
2557
2558
  result: x,
2558
2559
  meta: h ?? {},
@@ -2589,7 +2590,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2589
2590
  }
2590
2591
  //#endregion
2591
2592
  //#region src/presentation/Agentico.tsx
2592
- function gn(e, t) {
2593
+ function _n(e, t) {
2593
2594
  return Object.values(e).flat().map((e) => {
2594
2595
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2595
2596
  return {
@@ -2601,7 +2602,7 @@ function gn(e, t) {
2601
2602
  };
2602
2603
  });
2603
2604
  }
2604
- function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2605
+ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2605
2606
  let a = $(), [o, c] = M(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
2606
2607
  k(() => {
2607
2608
  n && c(n.detail ?? "");
@@ -2621,7 +2622,7 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2621
2622
  }).then((e) => {
2622
2623
  e && u(e);
2623
2624
  });
2624
- }, h = !!d || l.remote && l.remoteModels.length === 0, g = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), _ = !h && !l.remote && !g && l.hasProviders && !l.selectedModel, v = h ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...gn(l.modelsByProvider, l.catalogGroup)] : gn(l.modelsByProvider);
2625
+ }, h = !!d || l.remote && l.remoteModels.length === 0, g = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), _ = !h && !l.remote && !g && l.hasProviders && !l.selectedModel, v = h ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ..._n(l.modelsByProvider, l.catalogGroup)] : _n(l.modelsByProvider);
2625
2626
  return /* @__PURE__ */ F(N, { children: [n && /* @__PURE__ */ F("div", {
2626
2627
  className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
2627
2628
  children: [
@@ -2662,8 +2663,8 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2662
2663
  maxHeight: 220
2663
2664
  })] });
2664
2665
  }
2665
- function vn() {
2666
- let { startOrchestrator: e } = nt(), t = $(), [n, r] = M(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Ft(), l = (t) => {
2666
+ function yn() {
2667
+ let { startOrchestrator: e } = nt(), t = $(), [n, r] = M(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = It(), l = (t) => {
2667
2668
  t.text.trim() && (e(t.text.trim(), {
2668
2669
  attachments: t.files.length > 0 ? t.files : void 0,
2669
2670
  model: t.model || void 0
@@ -2676,7 +2677,7 @@ function vn() {
2676
2677
  disabled: !n.trim() || u,
2677
2678
  onSubmit: l,
2678
2679
  attachments: !0,
2679
- models: gn(a),
2680
+ models: _n(a),
2680
2681
  selectedModel: o,
2681
2682
  onModelChange: c,
2682
2683
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2684,7 +2685,7 @@ function vn() {
2684
2685
  maxHeight: 220
2685
2686
  });
2686
2687
  }
2687
- function yn({ chat: e, onClose: t }) {
2688
+ function bn({ chat: e, onClose: t }) {
2688
2689
  let n = $(), r = w();
2689
2690
  return /* @__PURE__ */ P(h, {
2690
2691
  title: n.renameChat,
@@ -2707,7 +2708,7 @@ function yn({ chat: e, onClose: t }) {
2707
2708
  })
2708
2709
  });
2709
2710
  }
2710
- function bn(e, t, n = Date.now()) {
2711
+ function xn(e, t, n = Date.now()) {
2711
2712
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2712
2713
  numeric: "auto",
2713
2714
  style: "short"
@@ -2719,7 +2720,7 @@ function bn(e, t, n = Date.now()) {
2719
2720
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2720
2721
  return i.format(0, "minute");
2721
2722
  }
2722
- function xn({ card: e }) {
2723
+ function Sn({ card: e }) {
2723
2724
  let t = $();
2724
2725
  return e.humanSummaryOnly ? /* @__PURE__ */ F("div", {
2725
2726
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2775,7 +2776,7 @@ function xn({ card: e }) {
2775
2776
  ]
2776
2777
  });
2777
2778
  }
2778
- function Sn({ messages: e }) {
2779
+ function Cn({ messages: e }) {
2779
2780
  return /* @__PURE__ */ P("div", {
2780
2781
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2781
2782
  children: e.map((e, t) => /* @__PURE__ */ P("p", {
@@ -2784,7 +2785,7 @@ function Sn({ messages: e }) {
2784
2785
  }, t))
2785
2786
  });
2786
2787
  }
2787
- function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2788
+ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2788
2789
  let c = $(), { locale: d } = T(), [p, m] = M(""), [h, g] = M(0);
2789
2790
  k(() => Le(() => g((e) => e + 1)), []);
2790
2791
  let _ = A(() => r ? Xe(e) : [], [
@@ -2873,22 +2874,22 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2873
2874
  }), /* @__PURE__ */ P("span", {
2874
2875
  className: "shrink-0 text-xs text-muted-foreground",
2875
2876
  title: `${c.chatStarted.replace("{at}", new Date(Je(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
2876
- children: bn(Je(e), d)
2877
+ children: xn(Je(e), d)
2877
2878
  })]
2878
2879
  })
2879
2880
  }, `${e.subagentId}:${e.entityId}`);
2880
2881
  })
2881
- }), v && /* @__PURE__ */ P(yn, {
2882
+ }), v && /* @__PURE__ */ P(bn, {
2882
2883
  chat: v,
2883
2884
  onClose: () => y(null)
2884
2885
  })] });
2885
2886
  }
2886
- function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2887
+ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2887
2888
  let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: _, manualEntryRunId: v, startManualEntry: y, pendingExtraDestinations: b, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T } = nt(), E = $(), D = j(null), [O, ee] = M(!1), [te, A] = M(null), [ne, I] = M(null);
2888
2889
  k(() => {
2889
2890
  A(null), I(null);
2890
- }, [a?.id]), un(T?.id);
2891
- let L = kt({
2891
+ }, [a?.id]), dn(T?.id);
2892
+ let L = At({
2892
2893
  defaultWidth: e,
2893
2894
  minWidth: n,
2894
2895
  maxWidth: r,
@@ -2920,7 +2921,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2920
2921
  e && a.onApplied(e);
2921
2922
  }),
2922
2923
  onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
2923
- } : void 0, Y = J ? ht(z, J.canAnswer) : null, oe = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, se = oe?.manualEntry ? oe : null, X = j(!0);
2924
+ } : void 0, Y = J ? gt(z, J.canAnswer) : null, oe = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, se = oe?.manualEntry ? oe : null, X = j(!0);
2924
2925
  k(() => {
2925
2926
  let e = D.current;
2926
2927
  if (!e) return;
@@ -2950,7 +2951,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2950
2951
  });
2951
2952
  return n.observe(t), () => n.disconnect();
2952
2953
  }, [a?.id, o]);
2953
- let ue = s ? /* @__PURE__ */ P(mn, { userGoal: s }, c) : null, de = f ? W(f.subagentId) : void 0, fe = f && de ? /* @__PURE__ */ P(pn, {
2954
+ let ue = s ? /* @__PURE__ */ P(hn, { userGoal: s }, c) : null, de = f ? W(f.subagentId) : void 0, fe = f && de ? /* @__PURE__ */ P(mn, {
2954
2955
  manifest: de,
2955
2956
  params: f.snapshot.params,
2956
2957
  taskId: Ze(f.subagentId, f.entityId),
@@ -2958,14 +2959,14 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2958
2959
  history: f.snapshot.history,
2959
2960
  activity: f.snapshot.activity
2960
2961
  }
2961
- }, p) : null, pe = _ ? W(_.subagentId) : void 0, me = _ && pe ? /* @__PURE__ */ P(hn, {
2962
+ }, p) : null, pe = _ ? W(_.subagentId) : void 0, me = _ && pe ? /* @__PURE__ */ P(gn, {
2962
2963
  manifest: pe,
2963
2964
  extraDestinations: _.extraDestinations
2964
- }, v) : null, he = x ? W(x.subagentId) : void 0, ge = x && he ? /* @__PURE__ */ P(pn, {
2965
+ }, v) : null, he = x ? W(x.subagentId) : void 0, ge = x && he ? /* @__PURE__ */ P(mn, {
2965
2966
  manifest: he,
2966
2967
  params: x.params,
2967
2968
  extraDestinations: x.extraDestinations
2968
- }, S) : null, Z = C ? W(C.subagentId) : void 0, _e = C && Z ? /* @__PURE__ */ P(pn, {
2969
+ }, S) : null, Z = C ? W(C.subagentId) : void 0, _e = C && Z ? /* @__PURE__ */ P(mn, {
2969
2970
  manifest: Z,
2970
2971
  params: C.params,
2971
2972
  taskId: C.taskId,
@@ -2981,7 +2982,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2981
2982
  style: { width: L.width },
2982
2983
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2983
2984
  children: [
2984
- /* @__PURE__ */ P(At, {
2985
+ /* @__PURE__ */ P(jt, {
2985
2986
  width: L.width,
2986
2987
  min: L.min,
2987
2988
  max: L.max,
@@ -2996,7 +2997,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2996
2997
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2997
2998
  children: a ? a.title : "Agentico"
2998
2999
  }),
2999
- T && /* @__PURE__ */ P(Cn, {
3000
+ T && /* @__PURE__ */ P(wn, {
3000
3001
  scopeId: T.id,
3001
3002
  currentTaskId: a?.id ?? null,
3002
3003
  open: O,
@@ -3005,7 +3006,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3005
3006
  onSelect: (e, t, n) => h(e, t, n),
3006
3007
  onArchivedCurrent: m
3007
3008
  }),
3008
- /* @__PURE__ */ P(jt, {})
3009
+ /* @__PURE__ */ P(Mt, {})
3009
3010
  ]
3010
3011
  }),
3011
3012
  /* @__PURE__ */ P("div", {
@@ -3019,7 +3020,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3019
3020
  className: "text-xs text-muted-foreground",
3020
3021
  children: a.manualEntry.prompt
3021
3022
  }),
3022
- /* @__PURE__ */ P(yt, {
3023
+ /* @__PURE__ */ P(bt, {
3023
3024
  activity: H,
3024
3025
  questions: J,
3025
3026
  docked: Y,
@@ -3030,7 +3031,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3030
3031
  className: "mt-3",
3031
3032
  children: a.panelExtra
3032
3033
  }),
3033
- U.length > 0 && /* @__PURE__ */ P(yt, {
3034
+ U.length > 0 && /* @__PURE__ */ P(bt, {
3034
3035
  activity: U,
3035
3036
  questions: J,
3036
3037
  docked: Y,
@@ -3049,6 +3050,11 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3049
3050
  variant: "secondary",
3050
3051
  className: "shrink-0",
3051
3052
  onClick: () => {
3053
+ let e = [...a.agent.activity].reverse().find((e) => e.kind === "user");
3054
+ if (e && a.agent.rewindable(e.id)) {
3055
+ re(e);
3056
+ return;
3057
+ }
3052
3058
  a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
3053
3059
  e && a.onApplied(e);
3054
3060
  });
@@ -3069,7 +3075,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3069
3075
  })
3070
3076
  ]
3071
3077
  })
3072
- ] }) : d.length > 0 ? /* @__PURE__ */ P(Sn, { messages: d }) : u ? /* @__PURE__ */ P(xn, { card: u }) : /* @__PURE__ */ P("p", {
3078
+ ] }) : d.length > 0 ? /* @__PURE__ */ P(Cn, { messages: d }) : u ? /* @__PURE__ */ P(Sn, { card: u }) : /* @__PURE__ */ P("p", {
3073
3079
  className: "text-xs text-muted-foreground",
3074
3080
  children: l ?? E.orchestratorStarterHint
3075
3081
  })
@@ -3085,7 +3091,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3085
3091
  }),
3086
3092
  /* @__PURE__ */ P("div", {
3087
3093
  className: "min-h-0 overflow-y-auto px-4 py-3",
3088
- children: /* @__PURE__ */ P(gt, {
3094
+ children: /* @__PURE__ */ P(_t, {
3089
3095
  entry: Y.entry,
3090
3096
  part: Y.part,
3091
3097
  questions: J,
@@ -3107,12 +3113,12 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3107
3113
  children: [a?.panelActions && /* @__PURE__ */ P("div", {
3108
3114
  className: "mb-2",
3109
3115
  children: a.panelActions
3110
- }), a ? /* @__PURE__ */ P(_n, {
3116
+ }), a ? /* @__PURE__ */ P(vn, {
3111
3117
  task: a,
3112
3118
  editing: te,
3113
3119
  onCancelEdit: () => A(null),
3114
3120
  onSendEdit: (e, t) => re(e, t)
3115
- }, a.id) : /* @__PURE__ */ P(vn, {})]
3121
+ }, a.id) : /* @__PURE__ */ P(yn, {})]
3116
3122
  }),
3117
3123
  ne && /* @__PURE__ */ F(g, {
3118
3124
  title: E.rewindTitle,
@@ -3138,13 +3144,13 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3138
3144
  }
3139
3145
  //#endregion
3140
3146
  //#region src/presentation/useAgenticoPageContext.ts
3141
- function Tn(e, t) {
3147
+ function En(e, t) {
3142
3148
  let { setPageContext: n } = nt(), r = j(crypto.randomUUID()).current;
3143
3149
  k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
3144
3150
  }
3145
3151
  //#endregion
3146
3152
  //#region src/presentation/useSubagentComponentContext.ts
3147
- function En(e, t, n, r, i = !0, a) {
3153
+ function Dn(e, t, n, r, i = !0, a) {
3148
3154
  let { registerComponentAnchor: o } = nt(), s = j(crypto.randomUUID()).current, c = j(n);
3149
3155
  c.current = n, k(() => {
3150
3156
  if (i) return o(s, {
@@ -3163,6 +3169,6 @@ function En(e, t, n, r, i = !0, a) {
3163
3169
  ]);
3164
3170
  }
3165
3171
  //#endregion
3166
- export { St as AGENTICO_MAX_WIDTH, xt as AGENTICO_MIN_WIDTH, bt as AGENTICO_WIDTH, Ct as AGENTICO_WIDTH_STORAGE_KEY, wn as Agentico, tt as AgenticoProvider, jt as AgenticoToggle, I as DEFAULT_REASONING_PART_ID, ne as DEFAULT_TEXT_PART_ID, ye as JSON_EXPORT_DESTINATION_ID, he as MICRO_PROMPT_REGISTRY, $e as ORCHESTRATOR_TASK_ID, me as SUMMARY_MICRO_PROMPT, Ee as agenticoDe, we as agenticoEn, Te as agenticoIt, J as agenticoPromptsEn, Y as agenticoPromptsIt, Qe as agenticoTranslations, ge as applyMicroPrompts, Ge as chatHasPersonMessage, Je as chatStartedAt, We as chatTitle, se as configureAgenticoPrompts, ke as configureEntityChatStore, q as createCrossAgentTools, B as defineSubagent, Ze as entityChatTaskId, Z as extractErrorMessage, _e as extractJsonBlock, W as findSubagentManifest, z as formatQuestionAnswers, X as getAgenticoPrompts, Ce as getDestinationRegistry, ze as getEntityChat, an as getSubagentControls, U as getSubagentRegistry, $t as getSubagentReport, Ae as hasEntityChatBackend, be as jsonExportDestination, Xe as listEntityChats, R as messagePartsText, Le as onEntityChatsChange, K as registerCrossAgentTools, Se as registerDestinations, rn as registerSubagentControls, Qt as registerSubagentReports, H as registerSubagents, Ye as removeEntityChat, qe as renameEntityChat, pe as renderRegistryCli, fe as renderSubagentCli, ce as resetAgenticoPrompts, Be as saveEntityChat, Ne as syncEntityChats, re as toJsonSchema, ie as toMcpTool, L as upsertMessagePart, Ut as useAgent, nt as useAgentico, $ as useAgenticoI18n, Tn as useAgenticoPageContext, En as useSubagentComponentContext };
3172
+ export { Ct as AGENTICO_MAX_WIDTH, St as AGENTICO_MIN_WIDTH, xt as AGENTICO_WIDTH, wt as AGENTICO_WIDTH_STORAGE_KEY, Tn as Agentico, tt as AgenticoProvider, Mt as AgenticoToggle, I as DEFAULT_REASONING_PART_ID, ne as DEFAULT_TEXT_PART_ID, ye as JSON_EXPORT_DESTINATION_ID, he as MICRO_PROMPT_REGISTRY, $e as ORCHESTRATOR_TASK_ID, me as SUMMARY_MICRO_PROMPT, Ee as agenticoDe, we as agenticoEn, Te as agenticoIt, J as agenticoPromptsEn, Y as agenticoPromptsIt, Qe as agenticoTranslations, ge as applyMicroPrompts, Ge as chatHasPersonMessage, Je as chatStartedAt, We as chatTitle, se as configureAgenticoPrompts, ke as configureEntityChatStore, q as createCrossAgentTools, B as defineSubagent, Ze as entityChatTaskId, Z as extractErrorMessage, _e as extractJsonBlock, W as findSubagentManifest, z as formatQuestionAnswers, X as getAgenticoPrompts, Ce as getDestinationRegistry, ze as getEntityChat, on as getSubagentControls, U as getSubagentRegistry, en as getSubagentReport, Ae as hasEntityChatBackend, be as jsonExportDestination, Xe as listEntityChats, R as messagePartsText, Le as onEntityChatsChange, K as registerCrossAgentTools, Se as registerDestinations, an as registerSubagentControls, $t as registerSubagentReports, H as registerSubagents, Ye as removeEntityChat, qe as renameEntityChat, pe as renderRegistryCli, fe as renderSubagentCli, ce as resetAgenticoPrompts, Be as saveEntityChat, Ne as syncEntityChats, re as toJsonSchema, ie as toMcpTool, L as upsertMessagePart, Wt as useAgent, nt as useAgentico, $ as useAgenticoI18n, En as useAgenticoPageContext, Dn as useSubagentComponentContext };
3167
3173
 
3168
3174
  //# sourceMappingURL=index.mjs.map