@llmnative/agentico 0.15.1 → 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 = {
@@ -1963,6 +1964,7 @@ function Ut(e, t = {}) {
1963
1964
  o += 1;
1964
1965
  }
1965
1966
  }
1967
+ return n === g.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
1966
1968
  }, Se = (e) => xe(e) !== void 0, Ce = async (e, t) => {
1967
1969
  if (D.current) return p(T.current.requestInProgress), null;
1968
1970
  let n = E.current, r = g.findIndex((t) => t.id === e), i = g[r], a = xe(e);
@@ -2023,23 +2025,23 @@ function Ut(e, t = {}) {
2023
2025
  }
2024
2026
  //#endregion
2025
2027
  //#region src/domain/orchestrator/prompt.ts
2026
- function Wt() {
2028
+ function Gt() {
2027
2029
  let e = X();
2028
2030
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
2029
2031
  }
2030
- function Gt(e, t, n) {
2032
+ function Kt(e, t, n) {
2031
2033
  let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
2032
2034
  return `${r.orchestratorIntro}
2033
2035
 
2034
2036
  ${r.toolsHeading}
2035
2037
  ${t}
2036
2038
  ${i}
2037
- ${Wt()}
2039
+ ${Gt()}
2038
2040
 
2039
2041
  ${r.userRequestHeading}
2040
2042
  ${e}`;
2041
2043
  }
2042
- function Kt(e, t) {
2044
+ function qt(e, t) {
2043
2045
  return t ? {
2044
2046
  kind: "handoff",
2045
2047
  ...t
@@ -2050,27 +2052,27 @@ function Kt(e, t) {
2050
2052
  }
2051
2053
  //#endregion
2052
2054
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
2053
- function qt(e) {
2055
+ function Jt(e) {
2054
2056
  return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
2055
2057
  }
2056
- function Jt(e) {
2058
+ function Yt(e) {
2057
2059
  return {
2058
2060
  buildContext(e) {
2059
2061
  return {
2060
- cliCatalog: pe(qt(e.scopedSubagentId)),
2062
+ cliCatalog: pe(Jt(e.scopedSubagentId)),
2061
2063
  handoff: { current: null },
2062
2064
  collected: {}
2063
2065
  };
2064
2066
  },
2065
2067
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
2066
- return Gt(e, n, t);
2068
+ return Kt(e, n, t);
2067
2069
  },
2068
2070
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
2069
- return `${e}\n\n${Wt()}\n\n${X().toolsHeading}\n${n}`;
2071
+ return `${e}\n\n${Gt()}\n\n${X().toolsHeading}\n${n}`;
2070
2072
  },
2071
2073
  parseResponse(e, t, n) {
2072
2074
  let r = n.handoff.current;
2073
- return n.handoff.current = null, Kt(e, r);
2075
+ return n.handoff.current = null, qt(e, r);
2074
2076
  },
2075
2077
  fallback() {
2076
2078
  return {
@@ -2086,7 +2088,7 @@ function Jt(e) {
2086
2088
  attachmentsRef: r,
2087
2089
  collected: n.collected,
2088
2090
  proxyFetch: S
2089
- }), 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) => ({
2090
2092
  name: `${t.id}_${r.name}`,
2091
2093
  description: `${t.label}: ${r.summary}`,
2092
2094
  inputSchema: r.inputSchema,
@@ -2110,12 +2112,12 @@ function Jt(e) {
2110
2112
  }
2111
2113
  //#endregion
2112
2114
  //#region src/presentation/deriveHistoryTitle.ts
2113
- function Yt(e, t) {
2115
+ function Xt(e, t) {
2114
2116
  return e.deriveHistoryTitle?.(t) ?? e.label;
2115
2117
  }
2116
2118
  //#endregion
2117
2119
  //#region src/presentation/ResultDestinationPicker.tsx
2118
- 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 }) {
2119
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();
2120
2122
  e.destinationIds.forEach((e) => {
2121
2123
  let t = _[e];
@@ -2133,7 +2135,7 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2133
2135
  storageProvider: l?.storageProvider ?? null,
2134
2136
  proxyFetch: u
2135
2137
  }, n);
2136
- 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));
2137
2139
  } catch (e) {
2138
2140
  g(e instanceof Error ? e.message : String(e));
2139
2141
  } finally {
@@ -2166,16 +2168,16 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2166
2168
  }
2167
2169
  //#endregion
2168
2170
  //#region src/presentation/reports/subagentReportRegistry.tsx
2169
- var Zt = {};
2170
- function Qt(e) {
2171
- Object.assign(Zt, e);
2172
- }
2171
+ var Qt = {};
2173
2172
  function $t(e) {
2174
- return Zt[e];
2173
+ Object.assign(Qt, e);
2174
+ }
2175
+ function en(e) {
2176
+ return Qt[e];
2175
2177
  }
2176
2178
  //#endregion
2177
2179
  //#region src/presentation/reports/GenericResultPreview.tsx
2178
- function en({ result: e }) {
2180
+ function tn({ result: e }) {
2179
2181
  let [t, n] = M(!1);
2180
2182
  return /* @__PURE__ */ F("div", {
2181
2183
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -2192,7 +2194,7 @@ function en({ result: e }) {
2192
2194
  }
2193
2195
  //#endregion
2194
2196
  //#region src/presentation/liveAnchorDestination.ts
2195
- function tn(e, t, n) {
2197
+ function nn(e, t, n) {
2196
2198
  return e.length === 0 ? null : {
2197
2199
  id: "live-component",
2198
2200
  label: "Applica al componente aperto",
@@ -2203,38 +2205,38 @@ function tn(e, t, n) {
2203
2205
  }
2204
2206
  //#endregion
2205
2207
  //#region src/presentation/subagentControls.ts
2206
- var nn = {};
2207
- function rn(e) {
2208
- Object.assign(nn, e);
2209
- }
2208
+ var rn = {};
2210
2209
  function an(e) {
2211
- return nn[e];
2210
+ Object.assign(rn, e);
2211
+ }
2212
+ function on(e) {
2213
+ return rn[e];
2212
2214
  }
2213
2215
  //#endregion
2214
2216
  //#region src/presentation/chatTitles.ts
2215
- function on(e, t = 6e3) {
2217
+ function sn(e, t = 6e3) {
2216
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");
2217
2219
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
2218
2220
  }
2219
- function sn(e) {
2221
+ function cn(e) {
2220
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);
2221
2223
  }
2222
- function cn(e, t) {
2224
+ function ln(e, t) {
2223
2225
  try {
2224
2226
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2225
2227
  } catch {
2226
2228
  return;
2227
2229
  }
2228
2230
  }
2229
- function ln(e, t, n, r, i) {
2230
- let a = cn(e, t), o = (e) => {
2231
+ function un(e, t, n, r, i) {
2232
+ let a = ln(e, t), o = (e) => {
2231
2233
  let t = e ? x(e) : null;
2232
2234
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2233
2235
  };
2234
2236
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2235
2237
  }
2236
- function un(e) {
2237
- 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({
2238
2240
  registry: t,
2239
2241
  modelsByProvider: n,
2240
2242
  selectedModel: r
@@ -2248,15 +2250,15 @@ function un(e) {
2248
2250
  if (!e) return !1;
2249
2251
  let o = ze(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2250
2252
  if (!o || !s?.autoTitle || o.name || !Ge(o) || a.current.has(c)) return !1;
2251
- 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;
2252
2254
  if (!p) return !1;
2253
2255
  a.current.add(c);
2254
2256
  try {
2255
2257
  let r = await l[p.provider].complete({
2256
- prompt: X().chatTitle.replace("{chat}", on(o.activity)),
2258
+ prompt: X().chatTitle.replace("{chat}", sn(o.activity)),
2257
2259
  model: p.model,
2258
2260
  history: []
2259
- }), i = r && r.type === "text" ? sn(r.text) : "";
2261
+ }), i = r && r.type === "text" ? cn(r.text) : "";
2260
2262
  return i ? qe(e, t, n, i, "model") : !1;
2261
2263
  } catch {
2262
2264
  return !1;
@@ -2265,7 +2267,7 @@ function un(e) {
2265
2267
  }
2266
2268
  }, [e]), s = Object.keys(n).length > 0;
2267
2269
  return k(() => {
2268
- e && s && !dn.has(e) && (dn.add(e), (async () => {
2270
+ e && s && !fn.has(e) && (fn.add(e), (async () => {
2269
2271
  for (let t of Xe(e)) {
2270
2272
  let n = W(t.subagentId);
2271
2273
  if (n?.autoTitle) {
@@ -2283,11 +2285,11 @@ function un(e) {
2283
2285
  o
2284
2286
  ]), o;
2285
2287
  }
2286
- var dn = /* @__PURE__ */ new Set(), fn = () => ({});
2287
- function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2288
- 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) => {
2289
2291
  e.definition.conversational || m(t);
2290
- }, [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);
2291
2293
  p && p !== D.current && (D.current = p, T.current = (r?.length ?? 0) + c.activity.length);
2292
2294
  let O = j(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
2293
2295
  k(() => {
@@ -2311,7 +2313,7 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2311
2313
  ...t,
2312
2314
  pinnedEntityId: r
2313
2315
  }).then((n) => {
2314
- 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));
2315
2317
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2316
2318
  });
2317
2319
  }, [
@@ -2330,11 +2332,11 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2330
2332
  p,
2331
2333
  x,
2332
2334
  S
2333
- ]), 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), [
2334
2336
  L,
2335
2337
  t,
2336
2338
  f
2337
- ]), 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);
2338
2340
  k(() => {
2339
2341
  let n = !H.current && c.running, i = H.current && !c.running;
2340
2342
  if (H.current = c.running, !n && !i || !B || !u) return;
@@ -2350,14 +2352,14 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2350
2352
  subagentId: e.id,
2351
2353
  entityId: B,
2352
2354
  params: t,
2353
- title: Yt(e, t),
2355
+ title: Xt(e, t),
2354
2356
  history: a.history,
2355
2357
  activity: o
2356
2358
  }), i && e.autoTitle && V(e.id, B, c.selectedModel));
2357
2359
  }, [c.running]);
2358
2360
  let W = () => {
2359
2361
  O.current = !0, c.running && c.stop(), l.closeTask(f);
2360
- }, G = j(an(e.id) ?? fn).current, K = G({
2362
+ }, G = j(on(e.id) ?? pn).current, K = G({
2361
2363
  params: t,
2362
2364
  taskId: f,
2363
2365
  running: c.running,
@@ -2368,7 +2370,7 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2368
2370
  return k(() => {
2369
2371
  O.current || l.openTask({
2370
2372
  id: f,
2371
- title: Yt(e, t),
2373
+ title: Xt(e, t),
2372
2374
  icon: e.icon,
2373
2375
  agent: c,
2374
2376
  onApplied: (e) => h(e),
@@ -2387,12 +2389,12 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2387
2389
  }) : b?.kind === "editable" ? /* @__PURE__ */ P(b.Report, {
2388
2390
  result: p,
2389
2391
  onResultChange: ne
2390
- }) : /* @__PURE__ */ P(en, { result: I }),
2392
+ }) : /* @__PURE__ */ P(tn, { result: I }),
2391
2393
  v && /* @__PURE__ */ F("p", {
2392
2394
  className: "text-xs text-destructive",
2393
2395
  children: ["Salvataggio automatico non riuscito: ", v]
2394
2396
  }),
2395
- /* @__PURE__ */ P(Xt, {
2397
+ /* @__PURE__ */ P(Zt, {
2396
2398
  manifest: e,
2397
2399
  result: I,
2398
2400
  meta: t,
@@ -2433,8 +2435,8 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2433
2435
  }
2434
2436
  //#endregion
2435
2437
  //#region src/presentation/OrchestratorRunner.tsx
2436
- function mn({ userGoal: e }) {
2437
- let t = $(), n = Ut(A(() => Jt({
2438
+ function hn({ userGoal: e }) {
2439
+ let t = $(), n = Wt(A(() => Yt({
2438
2440
  unavailable: t.orchestratorUnavailable,
2439
2441
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2440
2442
  preparing: t.orchestratorPreparing,
@@ -2482,7 +2484,7 @@ function mn({ userGoal: e }) {
2482
2484
  let h = A(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2483
2485
  if (!i) return null;
2484
2486
  let g = W(i.subagentId);
2485
- return g ? /* @__PURE__ */ P(pn, {
2487
+ return g ? /* @__PURE__ */ P(mn, {
2486
2488
  manifest: g,
2487
2489
  params: i.params,
2488
2490
  extraDestinations: c.current,
@@ -2493,8 +2495,8 @@ function mn({ userGoal: e }) {
2493
2495
  }
2494
2496
  //#endregion
2495
2497
  //#region src/presentation/ManualEntryRunner.tsx
2496
- function hn({ manifest: e, extraDestinations: n }) {
2497
- 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) => {
2498
2500
  if (!e.manualEntry) return;
2499
2501
  let n;
2500
2502
  try {
@@ -2521,7 +2523,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2521
2523
  p
2522
2524
  ]), S = (e) => {
2523
2525
  u((t) => t.includes(e) ? t : [...t, e]);
2524
- }, 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, [
2525
2527
  C,
2526
2528
  h,
2527
2529
  o
@@ -2550,8 +2552,8 @@ function hn({ manifest: e, extraDestinations: n }) {
2550
2552
  }) : d?.kind === "editable" ? /* @__PURE__ */ P(d.Report, {
2551
2553
  result: s,
2552
2554
  onResultChange: b
2553
- }) : /* @__PURE__ */ P(en, { result: x }),
2554
- /* @__PURE__ */ P(Xt, {
2555
+ }) : /* @__PURE__ */ P(tn, { result: x }),
2556
+ /* @__PURE__ */ P(Zt, {
2555
2557
  manifest: e,
2556
2558
  result: x,
2557
2559
  meta: h ?? {},
@@ -2588,7 +2590,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2588
2590
  }
2589
2591
  //#endregion
2590
2592
  //#region src/presentation/Agentico.tsx
2591
- function gn(e, t) {
2593
+ function _n(e, t) {
2592
2594
  return Object.values(e).flat().map((e) => {
2593
2595
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2594
2596
  return {
@@ -2600,7 +2602,7 @@ function gn(e, t) {
2600
2602
  };
2601
2603
  });
2602
2604
  }
2603
- function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2605
+ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2604
2606
  let a = $(), [o, c] = M(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
2605
2607
  k(() => {
2606
2608
  n && c(n.detail ?? "");
@@ -2620,7 +2622,7 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2620
2622
  }).then((e) => {
2621
2623
  e && u(e);
2622
2624
  });
2623
- }, 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);
2624
2626
  return /* @__PURE__ */ F(N, { children: [n && /* @__PURE__ */ F("div", {
2625
2627
  className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
2626
2628
  children: [
@@ -2661,8 +2663,8 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2661
2663
  maxHeight: 220
2662
2664
  })] });
2663
2665
  }
2664
- function vn() {
2665
- 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) => {
2666
2668
  t.text.trim() && (e(t.text.trim(), {
2667
2669
  attachments: t.files.length > 0 ? t.files : void 0,
2668
2670
  model: t.model || void 0
@@ -2675,7 +2677,7 @@ function vn() {
2675
2677
  disabled: !n.trim() || u,
2676
2678
  onSubmit: l,
2677
2679
  attachments: !0,
2678
- models: gn(a),
2680
+ models: _n(a),
2679
2681
  selectedModel: o,
2680
2682
  onModelChange: c,
2681
2683
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2683,7 +2685,7 @@ function vn() {
2683
2685
  maxHeight: 220
2684
2686
  });
2685
2687
  }
2686
- function yn({ chat: e, onClose: t }) {
2688
+ function bn({ chat: e, onClose: t }) {
2687
2689
  let n = $(), r = w();
2688
2690
  return /* @__PURE__ */ P(h, {
2689
2691
  title: n.renameChat,
@@ -2706,7 +2708,7 @@ function yn({ chat: e, onClose: t }) {
2706
2708
  })
2707
2709
  });
2708
2710
  }
2709
- function bn(e, t, n = Date.now()) {
2711
+ function xn(e, t, n = Date.now()) {
2710
2712
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2711
2713
  numeric: "auto",
2712
2714
  style: "short"
@@ -2718,7 +2720,7 @@ function bn(e, t, n = Date.now()) {
2718
2720
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2719
2721
  return i.format(0, "minute");
2720
2722
  }
2721
- function xn({ card: e }) {
2723
+ function Sn({ card: e }) {
2722
2724
  let t = $();
2723
2725
  return e.humanSummaryOnly ? /* @__PURE__ */ F("div", {
2724
2726
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2774,7 +2776,7 @@ function xn({ card: e }) {
2774
2776
  ]
2775
2777
  });
2776
2778
  }
2777
- function Sn({ messages: e }) {
2779
+ function Cn({ messages: e }) {
2778
2780
  return /* @__PURE__ */ P("div", {
2779
2781
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2780
2782
  children: e.map((e, t) => /* @__PURE__ */ P("p", {
@@ -2783,7 +2785,7 @@ function Sn({ messages: e }) {
2783
2785
  }, t))
2784
2786
  });
2785
2787
  }
2786
- 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 }) {
2787
2789
  let c = $(), { locale: d } = T(), [p, m] = M(""), [h, g] = M(0);
2788
2790
  k(() => Le(() => g((e) => e + 1)), []);
2789
2791
  let _ = A(() => r ? Xe(e) : [], [
@@ -2872,22 +2874,22 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2872
2874
  }), /* @__PURE__ */ P("span", {
2873
2875
  className: "shrink-0 text-xs text-muted-foreground",
2874
2876
  title: `${c.chatStarted.replace("{at}", new Date(Je(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
2875
- children: bn(Je(e), d)
2877
+ children: xn(Je(e), d)
2876
2878
  })]
2877
2879
  })
2878
2880
  }, `${e.subagentId}:${e.entityId}`);
2879
2881
  })
2880
- }), v && /* @__PURE__ */ P(yn, {
2882
+ }), v && /* @__PURE__ */ P(bn, {
2881
2883
  chat: v,
2882
2884
  onClose: () => y(null)
2883
2885
  })] });
2884
2886
  }
2885
- function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2887
+ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2886
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);
2887
2889
  k(() => {
2888
2890
  A(null), I(null);
2889
- }, [a?.id]), un(T?.id);
2890
- let L = kt({
2891
+ }, [a?.id]), dn(T?.id);
2892
+ let L = At({
2891
2893
  defaultWidth: e,
2892
2894
  minWidth: n,
2893
2895
  maxWidth: r,
@@ -2919,7 +2921,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2919
2921
  e && a.onApplied(e);
2920
2922
  }),
2921
2923
  onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
2922
- } : 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);
2923
2925
  k(() => {
2924
2926
  let e = D.current;
2925
2927
  if (!e) return;
@@ -2949,7 +2951,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2949
2951
  });
2950
2952
  return n.observe(t), () => n.disconnect();
2951
2953
  }, [a?.id, o]);
2952
- 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, {
2953
2955
  manifest: de,
2954
2956
  params: f.snapshot.params,
2955
2957
  taskId: Ze(f.subagentId, f.entityId),
@@ -2957,14 +2959,14 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2957
2959
  history: f.snapshot.history,
2958
2960
  activity: f.snapshot.activity
2959
2961
  }
2960
- }, 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, {
2961
2963
  manifest: pe,
2962
2964
  extraDestinations: _.extraDestinations
2963
- }, 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, {
2964
2966
  manifest: he,
2965
2967
  params: x.params,
2966
2968
  extraDestinations: x.extraDestinations
2967
- }, 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, {
2968
2970
  manifest: Z,
2969
2971
  params: C.params,
2970
2972
  taskId: C.taskId,
@@ -2980,7 +2982,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2980
2982
  style: { width: L.width },
2981
2983
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2982
2984
  children: [
2983
- /* @__PURE__ */ P(At, {
2985
+ /* @__PURE__ */ P(jt, {
2984
2986
  width: L.width,
2985
2987
  min: L.min,
2986
2988
  max: L.max,
@@ -2995,7 +2997,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2995
2997
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2996
2998
  children: a ? a.title : "Agentico"
2997
2999
  }),
2998
- T && /* @__PURE__ */ P(Cn, {
3000
+ T && /* @__PURE__ */ P(wn, {
2999
3001
  scopeId: T.id,
3000
3002
  currentTaskId: a?.id ?? null,
3001
3003
  open: O,
@@ -3004,7 +3006,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3004
3006
  onSelect: (e, t, n) => h(e, t, n),
3005
3007
  onArchivedCurrent: m
3006
3008
  }),
3007
- /* @__PURE__ */ P(jt, {})
3009
+ /* @__PURE__ */ P(Mt, {})
3008
3010
  ]
3009
3011
  }),
3010
3012
  /* @__PURE__ */ P("div", {
@@ -3018,7 +3020,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3018
3020
  className: "text-xs text-muted-foreground",
3019
3021
  children: a.manualEntry.prompt
3020
3022
  }),
3021
- /* @__PURE__ */ P(yt, {
3023
+ /* @__PURE__ */ P(bt, {
3022
3024
  activity: H,
3023
3025
  questions: J,
3024
3026
  docked: Y,
@@ -3029,7 +3031,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3029
3031
  className: "mt-3",
3030
3032
  children: a.panelExtra
3031
3033
  }),
3032
- U.length > 0 && /* @__PURE__ */ P(yt, {
3034
+ U.length > 0 && /* @__PURE__ */ P(bt, {
3033
3035
  activity: U,
3034
3036
  questions: J,
3035
3037
  docked: Y,
@@ -3048,6 +3050,11 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3048
3050
  variant: "secondary",
3049
3051
  className: "shrink-0",
3050
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
+ }
3051
3058
  a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
3052
3059
  e && a.onApplied(e);
3053
3060
  });
@@ -3068,7 +3075,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3068
3075
  })
3069
3076
  ]
3070
3077
  })
3071
- ] }) : 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", {
3072
3079
  className: "text-xs text-muted-foreground",
3073
3080
  children: l ?? E.orchestratorStarterHint
3074
3081
  })
@@ -3084,7 +3091,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3084
3091
  }),
3085
3092
  /* @__PURE__ */ P("div", {
3086
3093
  className: "min-h-0 overflow-y-auto px-4 py-3",
3087
- children: /* @__PURE__ */ P(gt, {
3094
+ children: /* @__PURE__ */ P(_t, {
3088
3095
  entry: Y.entry,
3089
3096
  part: Y.part,
3090
3097
  questions: J,
@@ -3106,12 +3113,12 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3106
3113
  children: [a?.panelActions && /* @__PURE__ */ P("div", {
3107
3114
  className: "mb-2",
3108
3115
  children: a.panelActions
3109
- }), a ? /* @__PURE__ */ P(_n, {
3116
+ }), a ? /* @__PURE__ */ P(vn, {
3110
3117
  task: a,
3111
3118
  editing: te,
3112
3119
  onCancelEdit: () => A(null),
3113
3120
  onSendEdit: (e, t) => re(e, t)
3114
- }, a.id) : /* @__PURE__ */ P(vn, {})]
3121
+ }, a.id) : /* @__PURE__ */ P(yn, {})]
3115
3122
  }),
3116
3123
  ne && /* @__PURE__ */ F(g, {
3117
3124
  title: E.rewindTitle,
@@ -3137,13 +3144,13 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3137
3144
  }
3138
3145
  //#endregion
3139
3146
  //#region src/presentation/useAgenticoPageContext.ts
3140
- function Tn(e, t) {
3147
+ function En(e, t) {
3141
3148
  let { setPageContext: n } = nt(), r = j(crypto.randomUUID()).current;
3142
3149
  k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
3143
3150
  }
3144
3151
  //#endregion
3145
3152
  //#region src/presentation/useSubagentComponentContext.ts
3146
- function En(e, t, n, r, i = !0, a) {
3153
+ function Dn(e, t, n, r, i = !0, a) {
3147
3154
  let { registerComponentAnchor: o } = nt(), s = j(crypto.randomUUID()).current, c = j(n);
3148
3155
  c.current = n, k(() => {
3149
3156
  if (i) return o(s, {
@@ -3162,6 +3169,6 @@ function En(e, t, n, r, i = !0, a) {
3162
3169
  ]);
3163
3170
  }
3164
3171
  //#endregion
3165
- 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 };
3166
3173
 
3167
3174
  //# sourceMappingURL=index.mjs.map