@llmnative/agentico 0.15.2 → 0.16.0

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
@@ -17,56 +17,56 @@ function L(e, t, n) {
17
17
  function R(e) {
18
18
  return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
19
19
  }
20
- function z(e, t) {
20
+ function re(e, t) {
21
21
  return t.map((t, n) => `${t.header ?? e[n]?.header ?? e[n]?.question ?? t.id ?? `${n + 1}`}: ${t.values.join(", ")}`).join("\n");
22
22
  }
23
23
  //#endregion
24
24
  //#region src/domain/defineSubagent.ts
25
- function B(e) {
25
+ function z(e) {
26
26
  return e;
27
27
  }
28
28
  //#endregion
29
29
  //#region src/domain/subagentRegistry.ts
30
- var V = [];
31
- function H(e) {
32
- V = e;
30
+ var B = [];
31
+ function V(e) {
32
+ B = e;
33
33
  }
34
- function U() {
35
- return V.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), V;
34
+ function H() {
35
+ return B.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), B;
36
36
  }
37
- function W(e) {
38
- return V.find((t) => t.id === e);
37
+ function U(e) {
38
+ return B.find((t) => t.id === e);
39
39
  }
40
40
  //#endregion
41
41
  //#region src/domain/crossAgentTools.ts
42
- var G = [];
43
- function K(...e) {
44
- G = e;
42
+ var W = [];
43
+ function G(...e) {
44
+ W = e;
45
45
  }
46
- function q(e) {
47
- return G.flatMap((t) => t(e));
46
+ function K(e) {
47
+ return W.flatMap((t) => t(e));
48
48
  }
49
49
  //#endregion
50
50
  //#region src/domain/mcpTool.ts
51
- function re(t) {
51
+ function ie(t) {
52
52
  let { $schema: n, ...r } = e(t, {
53
53
  target: "jsonSchema7",
54
54
  $refStrategy: "none"
55
55
  });
56
56
  return r;
57
57
  }
58
- function ie(e, t, n, r) {
58
+ function ae(e, t, n, r) {
59
59
  return {
60
60
  name: e,
61
61
  description: t,
62
- inputSchema: re(n),
63
- ...r ? { outputSchema: re(r) } : {}
62
+ inputSchema: ie(n),
63
+ ...r ? { outputSchema: ie(r) } : {}
64
64
  };
65
65
  }
66
66
  //#endregion
67
67
  //#region src/domain/subagentUsageCard.ts
68
- function ae(e) {
69
- let t = re(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function oe(e) {
69
+ let t = ie(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
70
70
  return Object.entries(n).map(([t, n]) => {
71
71
  let i = typeof n.description == "string" ? n.description : "";
72
72
  return {
@@ -80,7 +80,7 @@ function ae(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/domain/prompts.ts
83
- var J = {
83
+ var q = {
84
84
  orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
85
85
  responseRules: [
86
86
  "BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
@@ -110,7 +110,7 @@ var J = {
110
110
  ].join(" "),
111
111
  multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on.",
112
112
  chatTitle: "Write a title for this chat, as a list of chats shows it: 3 to 6 words saying what it is about, in the language the person writes in. Answer with the title only: no quotes, no final period.\n\n{chat}"
113
- }, Y = {
113
+ }, J = {
114
114
  orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
115
115
  responseRules: [
116
116
  "PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
@@ -140,18 +140,18 @@ var J = {
140
140
  ].join(" "),
141
141
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
142
142
  chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
143
- }, oe = J;
143
+ }, Y = q;
144
144
  function se(e) {
145
- oe = {
146
- ...oe,
145
+ Y = {
146
+ ...Y,
147
147
  ...e
148
148
  };
149
149
  }
150
150
  function X() {
151
- return oe;
151
+ return Y;
152
152
  }
153
153
  function ce() {
154
- oe = J;
154
+ Y = q;
155
155
  }
156
156
  //#endregion
157
157
  //#region src/domain/cli/renderManifestCli.ts
@@ -159,7 +159,7 @@ function le(e, t) {
159
159
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
160
160
  }
161
161
  function ue(e, t) {
162
- let n = ae(t), r = le(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
162
+ let n = oe(t), r = le(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
163
163
  return [
164
164
  `COMMAND: ${e} ${t.name}`,
165
165
  ` ${t.summary}`,
@@ -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",
@@ -668,7 +665,7 @@ function tt({ children: e, scope: t = null }) {
668
665
  });
669
666
  return [...e.values()];
670
667
  }, [N]), R = A(() => L.map((e) => {
671
- let t = W(e.subagentId)?.componentContexts?.[e.componentKey];
668
+ let t = U(e.subagentId)?.componentContexts?.[e.componentKey];
672
669
  if (!t) return null;
673
670
  let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
674
671
  return {
@@ -676,21 +673,21 @@ function tt({ children: e, scope: t = null }) {
676
673
  agenticoHint: n,
677
674
  userMessage: t.userMessage
678
675
  };
679
- }).filter((e) => e !== null), [L]), z = A(() => R.map((e) => e.userMessage), [R]), B = A(() => {
676
+ }).filter((e) => e !== null), [L]), re = A(() => R.map((e) => e.userMessage), [R]), z = A(() => {
680
677
  if (R.length === 0) return null;
681
678
  if (R.length === 1) return R[0].agenticoHint;
682
679
  let e = R.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
683
680
  return `${X().multipleCandidates}\n\n${e}`;
684
- }, [R]) ?? te?.text ?? null, V = R.length > 0 ? null : te?.card ?? null, H = A(() => [...new Set(I.map((e) => e.subagentId))], [I]), U = H.length === 1 ? H[0] : H.length === 0 ? te?.card?.subagentId ?? null : null, G = O((e, t) => {
681
+ }, [R]) ?? te?.text ?? null, B = R.length > 0 ? null : te?.card ?? null, V = A(() => [...new Set(I.map((e) => e.subagentId))], [I]), H = V.length === 1 ? V[0] : V.length === 0 ? te?.card?.subagentId ?? null : null, W = O((e, t) => {
685
682
  d();
686
683
  let n = i.current;
687
684
  if (n?.id === "agentico-orchestrator") return;
688
- let r = U && n?.id.startsWith(`subagent-${U}-`) ? n : void 0;
685
+ let r = H && n?.id.startsWith(`subagent-${H}-`) ? n : void 0;
689
686
  C(r ? {
690
687
  taskId: r.id,
691
688
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
692
689
  } : null), p(e), h(t?.extraDestinations), _(t?.attachments), y(t?.model), T(t?.scopedSubagentId), x(crypto.randomUUID());
693
- }, [d, U]), K = O((e, t, n, a, o, s) => {
690
+ }, [d, H]), G = O((e, t, n, a, o, s) => {
694
691
  if (!n || !a) return;
695
692
  let c = i.current;
696
693
  if (!c || c.id !== n) return;
@@ -707,19 +704,19 @@ function tt({ children: e, scope: t = null }) {
707
704
  ...e,
708
705
  savedToDisk: !0
709
706
  } : e));
710
- }, []), [q, re] = M(null), [ie, ae] = M(null), J = O((e, t, n) => {
711
- d(), re({
707
+ }, []), [K, ie] = M(null), [ae, oe] = M(null), q = O((e, t, n) => {
708
+ d(), ie({
712
709
  subagentId: e,
713
710
  entityId: t,
714
711
  snapshot: n
715
- }), ae(crypto.randomUUID());
716
- }, [d]), [Y, oe] = M(null), [se, ce] = M(null), le = O((e, t) => {
717
- d(), l($e), oe({
712
+ }), oe(crypto.randomUUID());
713
+ }, [d]), [J, Y] = M(null), [se, ce] = M(null), le = O((e, t) => {
714
+ d(), l($e), Y({
718
715
  subagentId: e,
719
716
  extraDestinations: t
720
717
  }), ce(crypto.randomUUID());
721
718
  }, [d, l]), [ue, de] = M(null), [fe, pe] = M(null), me = O((e, t, n) => {
722
- oe(null), de({
719
+ Y(null), de({
723
720
  subagentId: e,
724
721
  params: t,
725
722
  extraDestinations: n
@@ -741,14 +738,14 @@ function tt({ children: e, scope: t = null }) {
741
738
  closeTask: l,
742
739
  toggleOpen: u,
743
740
  pendingGoal: f,
744
- startOrchestrator: G,
745
- pageContext: B,
746
- pageContextCard: V,
741
+ startOrchestrator: W,
742
+ pageContext: z,
743
+ pageContextCard: B,
747
744
  setPageContext: ee,
748
- scopedSubagentId: U,
745
+ scopedSubagentId: H,
749
746
  pendingScopedSubagentId: w,
750
747
  componentAnchors: I,
751
- anchoredUserMessages: z,
748
+ anchoredUserMessages: re,
752
749
  registerComponentAnchor: ne,
753
750
  openPanel: d,
754
751
  pendingExtraDestinations: m,
@@ -756,12 +753,12 @@ function tt({ children: e, scope: t = null }) {
756
753
  pendingModel: v,
757
754
  orchestratorRunId: b,
758
755
  pendingCarryOver: S,
759
- commitEntityChat: K,
760
- resumeEntityChat: J,
761
- pendingResume: q,
762
- resumeRunId: ie,
756
+ commitEntityChat: G,
757
+ resumeEntityChat: q,
758
+ pendingResume: K,
759
+ resumeRunId: ae,
763
760
  dismissForeignTask: ye,
764
- pendingManualEntry: Y,
761
+ pendingManualEntry: J,
765
762
  manualEntryRunId: se,
766
763
  startManualEntry: le,
767
764
  pendingResumeWithAI: ue,
@@ -778,14 +775,14 @@ function tt({ children: e, scope: t = null }) {
778
775
  l,
779
776
  u,
780
777
  f,
781
- G,
778
+ W,
779
+ z,
782
780
  B,
783
- V,
784
781
  ee,
785
- U,
782
+ H,
786
783
  w,
787
784
  I,
788
- z,
785
+ re,
789
786
  ne,
790
787
  d,
791
788
  m,
@@ -793,12 +790,12 @@ function tt({ children: e, scope: t = null }) {
793
790
  v,
794
791
  b,
795
792
  S,
796
- K,
797
- J,
793
+ G,
798
794
  q,
799
- ie,
795
+ K,
796
+ ae,
800
797
  ye,
801
- Y,
798
+ J,
802
799
  se,
803
800
  le,
804
801
  ue,
@@ -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;
@@ -1442,39 +1443,39 @@ function Ut(e, t = {}) {
1442
1443
  T.current = w;
1443
1444
  let E = j(null), D = j(!1), O = j(null), ee = j(null), k = j(null), te = () => {
1444
1445
  k.current?.abort();
1445
- }, N = C()?.registry ?? {}, [P, F] = M(void 0), I = j(void 0), B = (e, t) => {
1446
+ }, N = C()?.registry ?? {}, [P, F] = M(void 0), I = j(void 0), z = (e, t) => {
1446
1447
  if (!t) return !1;
1447
1448
  if (!e) return !0;
1448
1449
  let n = x(t);
1449
1450
  return !!n && e.includes(n.provider);
1450
- }, V = A(() => P ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => P.includes(e.provider))]).filter(([, e]) => e.length)) : o, [P, o]), H = B(P, c) ? c : Object.values(V).flat()[0]?.id ?? "", U = r && H ? x(H) : null, W = U ? N[U.provider] : null, G = e.executor, K = !!G?.alongside, q = !!G && !K, ie = !G || !!G.canRewind, ae = j([]), J = (e) => !!e && ae.current.some((t) => t.value === e), Y = j(!1), [oe, se] = M([]), [ce, le] = M(""), ue = j(""), de = (e) => {
1451
- ue.current = e, le(e);
1452
- }, fe = (e) => {
1453
- let t = G?.models?.(e) ?? [];
1454
- ae.current = t, se(t);
1455
- let n = G?.catalogProviders?.(e);
1451
+ }, B = A(() => P ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => P.includes(e.provider))]).filter(([, e]) => e.length)) : o, [P, o]), V = z(P, c) ? c : Object.values(B).flat()[0]?.id ?? "", H = r && V ? x(V) : null, U = H ? N[H.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, ae = !W || !!W.canRewind, oe = !!W?.attachments, q = async (e) => oe && e?.length ? Promise.all(e.map((e) => _.fileToAttachment(e))) : void 0, J = j([]), Y = (e) => !!e && J.current.some((t) => t.value === e), se = j(!1), [ce, le] = M([]), [ue, de] = M(""), fe = j(""), pe = (e) => {
1452
+ fe.current = e, de(e);
1453
+ }, me = (e) => {
1454
+ let t = W?.models?.(e) ?? [];
1455
+ J.current = t, le(t);
1456
+ let n = W?.catalogProviders?.(e);
1456
1457
  I.current = n, F(n);
1457
- let r = K && !B(n, c) ? t[0]?.value : void 0;
1458
- de(G?.defaultModel?.(e) ?? r ?? "");
1459
- }, pe = async (e, t, n, r) => {
1460
- let i = E.current;
1461
- if (!i || !G) return p(T.current.noActiveSession), null;
1462
- let a = new AbortController();
1463
- k.current = a;
1464
- let o = crypto.randomUUID();
1458
+ let r = G && !z(n, c) ? t[0]?.value : void 0;
1459
+ pe(W?.defaultModel?.(e) ?? r ?? "");
1460
+ }, he = async (e, t, n, r, i) => {
1461
+ let a = E.current;
1462
+ if (!a || !W) return p(T.current.noActiveSession), null;
1463
+ let o = new AbortController();
1464
+ k.current = o;
1465
+ let s = crypto.randomUUID();
1465
1466
  b((e) => [...e, {
1466
- id: o,
1467
+ id: s,
1467
1468
  kind: "thinking",
1468
1469
  label: T.current.thinking,
1469
1470
  status: "running",
1470
1471
  parts: []
1471
1472
  }]);
1472
- let s = /* @__PURE__ */ new Map(), c = (e) => Math.max(1, Math.round((Date.now() - (s.get(e) ?? Date.now())) / 1e3)), l = (e) => ({
1473
+ let c = /* @__PURE__ */ new Map(), l = (e) => Math.max(1, Math.round((Date.now() - (c.get(e) ?? Date.now())) / 1e3)), u = (e) => ({
1473
1474
  ...e,
1474
1475
  streaming: !1,
1475
- duration: e.duration ?? c(e.id)
1476
- }), u = (e, t) => b((n) => n.map((n) => {
1477
- if (n.id !== o) return n;
1476
+ duration: e.duration ?? l(e.id)
1477
+ }), d = (e, t) => b((n) => n.map((n) => {
1478
+ if (n.id !== s) return n;
1478
1479
  let r = e(n.parts ?? []), i = R(r);
1479
1480
  return {
1480
1481
  ...n,
@@ -1482,110 +1483,111 @@ function Ut(e, t = {}) {
1482
1483
  ...t ? { status: t } : {},
1483
1484
  ...i ? { detail: i } : {}
1484
1485
  };
1485
- })), d = (e) => u((t) => L(t, e, l)), f = !1, m = (e, t) => {
1486
- t?.id && t.id !== "text" && (f = !0), d({
1486
+ })), f = (e) => d((t) => L(t, e, u)), m = !1, h = (e, t) => {
1487
+ t?.id && t.id !== "text" && (m = !0), f({
1487
1488
  type: "text",
1488
1489
  id: t?.id ?? "text",
1489
1490
  text: e,
1490
1491
  streaming: !t?.done
1491
1492
  });
1492
- }, h = (e, t) => {
1493
+ }, g = (e, t) => {
1493
1494
  let n = t?.id ?? "reasoning";
1494
- s.has(n) || s.set(n, Date.now()), d({
1495
+ c.has(n) || c.set(n, Date.now()), f({
1495
1496
  type: "reasoning",
1496
1497
  id: n,
1497
1498
  text: e,
1498
1499
  streaming: !t?.done,
1499
- ...t?.duration === void 0 ? t?.done ? { duration: c(n) } : {} : { duration: t.duration }
1500
+ ...t?.duration === void 0 ? t?.done ? { duration: l(n) } : {} : { duration: t.duration }
1500
1501
  });
1501
- }, g = (e) => d({
1502
+ }, _ = (e) => f({
1502
1503
  type: "tool",
1503
1504
  id: e.id,
1504
1505
  label: e.label,
1505
1506
  status: e.status
1506
- }), _ = (e) => d({
1507
+ }), v = (e) => f({
1507
1508
  ...e,
1508
1509
  type: "card"
1509
- }), v = /* @__PURE__ */ new Set(), x = 0, C = () => {
1510
- for (let e of v) {
1510
+ }), x = /* @__PURE__ */ new Set(), C = 0, w = () => {
1511
+ for (let e of x) {
1511
1512
  let t = S.current.get(e);
1512
1513
  S.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
1513
1514
  }
1514
- v.clear();
1515
+ x.clear();
1515
1516
  };
1516
- a.signal.addEventListener("abort", C);
1517
- let w = (e, t) => {
1518
- x += 1;
1519
- let n = t?.id ?? `questions-${x}`;
1520
- d({
1517
+ o.signal.addEventListener("abort", w);
1518
+ let D = (e, t) => {
1519
+ C += 1;
1520
+ let n = t?.id ?? `questions-${C}`;
1521
+ f({
1521
1522
  type: "questions",
1522
1523
  id: n,
1523
1524
  questions: e
1524
1525
  });
1525
- let r = `${o}:${n}`;
1526
- return a.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (v.add(r), new Promise((e, t) => {
1526
+ let r = `${s}:${n}`;
1527
+ return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (x.add(r), new Promise((e, t) => {
1527
1528
  S.current.set(r, {
1528
1529
  resolve: e,
1529
1530
  reject: t
1530
1531
  });
1531
1532
  }));
1532
- }, D = (e, t) => {
1533
- u((n) => (t && !f ? L(n, {
1533
+ }, te = (e, t) => {
1534
+ d((n) => (t && !m ? L(n, {
1534
1535
  type: "text",
1535
1536
  id: ne,
1536
1537
  text: t,
1537
1538
  streaming: !1
1538
- }, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
1539
+ }, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
1539
1540
  ...t,
1540
1541
  streaming: !1
1541
1542
  } : t.type === "tool" && t.status === "running" && e !== "done" ? {
1542
1543
  ...t,
1543
1544
  status: "stopped"
1544
- } : t), e), a.signal.removeEventListener("abort", C);
1545
- for (let e of v) S.current.delete(e);
1546
- v.clear();
1547
- }, te = e || r?.historyText || "";
1545
+ } : t), e), o.signal.removeEventListener("abort", w);
1546
+ for (let e of x) S.current.delete(e);
1547
+ x.clear();
1548
+ }, A = e || r?.historyText || "";
1548
1549
  try {
1549
- let s = O.current;
1550
+ let c = O.current;
1550
1551
  O.current = null;
1551
- let c = y.current, l = c.findIndex((e) => e.id === ee.current), u = s ? { activity: s.fresh ? s.activity : (l >= 0 ? c.slice(0, l) : c).filter((e) => e.id !== o) } : void 0, d = await G.turn({
1552
- params: i.params,
1553
- context: i.context,
1552
+ let l = y.current, u = l.findIndex((e) => e.id === ee.current), d = c ? { activity: c.fresh ? c.activity : (u >= 0 ? l.slice(0, u) : l).filter((e) => e.id !== s) } : void 0, f = await W.turn({
1553
+ params: a.params,
1554
+ context: a.context,
1554
1555
  text: e,
1555
1556
  first: t,
1556
- signal: a.signal,
1557
- ...u ? { rewound: u } : {},
1558
- ...n || ue.current ? { model: n || ue.current } : {},
1557
+ signal: o.signal,
1558
+ ...d ? { rewound: d } : {},
1559
+ ...i?.length ? { attachments: i } : {},
1560
+ ...n || fe.current ? { model: n || fe.current } : {},
1559
1561
  ...r ? { answers: {
1560
1562
  id: r.id,
1561
1563
  answers: r.answers
1562
1564
  } } : {},
1563
- onText: m,
1564
- onReasoning: h,
1565
- onStep: g,
1566
- onQuestions: w,
1567
- onCard: _
1565
+ onText: h,
1566
+ onReasoning: g,
1567
+ onStep: _,
1568
+ onQuestions: D,
1569
+ onCard: v
1568
1570
  });
1569
- return D("done", d.text), i.history = [
1570
- ...i.history,
1571
- ...te ? [{
1571
+ return te("done", f.text), a.history = [
1572
+ ...a.history,
1573
+ ...A ? [{
1572
1574
  role: "user",
1573
- content: te
1575
+ content: A
1574
1576
  }] : [],
1575
1577
  {
1576
1578
  role: "assistant",
1577
- content: d.text
1579
+ content: f.text
1578
1580
  }
1579
- ], d.result ?? null;
1581
+ ], f.result ?? null;
1580
1582
  } catch (e) {
1581
- return i.history = [...i.history, ...te ? [{
1583
+ return a.history = [...a.history, ...A ? [{
1582
1584
  role: "user",
1583
- content: te
1584
- }] : []], a.signal.aborted ? (D("stopped"), null) : (D("error"), p(Z(e)), null);
1585
+ content: A
1586
+ }] : []], o.signal.aborted ? (te("stopped"), null) : (te("error"), p(Z(e)), null);
1585
1587
  } finally {
1586
1588
  k.current = null;
1587
1589
  }
1588
- }, me = async (t, n, r) => {
1590
+ }, _e = async (t, n, r) => {
1589
1591
  let i = y.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = E.current;
1590
1592
  if (!i || !a || !e.onCardAction) return;
1591
1593
  let o;
@@ -1604,7 +1606,7 @@ function Ut(e, t = {}) {
1604
1606
  outcome: o
1605
1607
  } : e)
1606
1608
  } : e));
1607
- }, he = async (e, t, n) => {
1609
+ }, ve = async (e, t, n) => {
1608
1610
  let r = y.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1609
1611
  if (!r || r.type !== "questions") throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1610
1612
  let i = () => b((r) => r.map((r) => r.id === e ? {
@@ -1616,27 +1618,27 @@ function Ut(e, t = {}) {
1616
1618
  } : r)), a = `${e}:${t}`, o = S.current.get(a);
1617
1619
  if (o) return S.current.delete(a), i(), o.resolve(n), null;
1618
1620
  if (D.current) throw p(T.current.requestInProgress), Error(T.current.requestInProgress);
1619
- if (!q || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1621
+ if (!K || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1620
1622
  D.current = !0, d(!0), p(null), i();
1621
1623
  try {
1622
- return await pe("", !1, void 0, {
1624
+ return await he("", !1, void 0, {
1623
1625
  id: t,
1624
1626
  answers: n,
1625
- historyText: z(r.questions, n)
1627
+ historyText: re(r.questions, n)
1626
1628
  });
1627
1629
  } finally {
1628
1630
  D.current = !1, d(!1);
1629
1631
  }
1630
- }, _e = async (t, n, r) => {
1631
- let i = I.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && B(i, r) ? r : B(i, H) ? void 0 : a, c = s ? x(s) : U, l = c && E.current ? G?.catalogReasoning?.(E.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = E.current;
1632
+ }, ye = async (t, n, r) => {
1633
+ let i = I.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && z(i, r) ? r : z(i, V) ? void 0 : a, c = s ? x(s) : H, l = c && E.current ? W?.catalogReasoning?.(E.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = E.current;
1632
1634
  if (!d) return p(T.current.noActiveSession), null;
1633
- let f = s ? x(s) : U, m = f ? N[f.provider] : null;
1635
+ let f = s ? x(s) : H, m = f ? N[f.provider] : null;
1634
1636
  if (!m || !f) return p(T.current.noProviderAvailable), null;
1635
1637
  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) => ({
1638
+ 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
1639
  name: e.name,
1638
1640
  description: e.description,
1639
- inputSchema: re(e.inputSchema)
1641
+ inputSchema: ie(e.inputSchema)
1640
1642
  })), y = (e, t, n, r) => {
1641
1643
  let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1642
1644
  b((e) => [...e, {
@@ -1646,7 +1648,7 @@ function Ut(e, t = {}) {
1646
1648
  status: "running",
1647
1649
  parts: [{
1648
1650
  type: "questions",
1649
- id: It,
1651
+ id: Lt,
1650
1652
  questions: [{
1651
1653
  header: i.approvalHeader,
1652
1654
  question: i.approveQuestion.replace("{action}", o),
@@ -1655,7 +1657,7 @@ function Ut(e, t = {}) {
1655
1657
  }]
1656
1658
  }]
1657
1659
  }]);
1658
- let s = `${a}:${It}`;
1660
+ let s = `${a}:${Lt}`;
1659
1661
  return new Promise((e, t) => {
1660
1662
  let n = () => {
1661
1663
  S.current.delete(s), D(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
@@ -1666,7 +1668,7 @@ function Ut(e, t = {}) {
1666
1668
  }
1667
1669
  r.addEventListener("abort", n, { once: !0 }), S.current.set(s, {
1668
1670
  resolve: (t) => {
1669
- r.removeEventListener("abort", n), D(a, "done"), e(Rt(t, i.approve, i.reject));
1671
+ r.removeEventListener("abort", n), D(a, "done"), e(zt(t, i.approve, i.reject));
1670
1672
  },
1671
1673
  reject: t
1672
1674
  });
@@ -1681,7 +1683,7 @@ function Ut(e, t = {}) {
1681
1683
  } : i));
1682
1684
  try {
1683
1685
  let n = d.history, r = t;
1684
- for (let t = 0; t < zt; t++) {
1686
+ for (let t = 0; t < Bt; t++) {
1685
1687
  let i = crypto.randomUUID();
1686
1688
  b((e) => [...e, {
1687
1689
  id: i,
@@ -1741,7 +1743,7 @@ function Ut(e, t = {}) {
1741
1743
  let s = /* @__PURE__ */ new Map();
1742
1744
  for (let t of a.toolCalls) {
1743
1745
  let n = C.get(t.name);
1744
- if (n && Lt(n, t.input)) try {
1746
+ if (n && Rt(n, t.input)) try {
1745
1747
  s.set(t.id, await y(t.id, n, t.input, w.signal));
1746
1748
  } catch {
1747
1749
  return e.fallback(d.params, d.context);
@@ -1851,7 +1853,7 @@ function Ut(e, t = {}) {
1851
1853
  } finally {
1852
1854
  k.current = null;
1853
1855
  }
1854
- }, ve = async (t, n) => {
1856
+ }, be = async (t, n) => {
1855
1857
  if (D.current) return p(T.current.requestInProgress), null;
1856
1858
  D.current = !0, p(null), b(n?.openingMessage ? [{
1857
1859
  id: crypto.randomUUID(),
@@ -1870,13 +1872,13 @@ function Ut(e, t = {}) {
1870
1872
  history: [],
1871
1873
  logId: crypto.randomUUID(),
1872
1874
  attachmentsRef: a
1873
- }, q) return h(!0), fe(t), await pe(n?.openingMessage ?? "", !0);
1874
- if (K) {
1875
- fe(t), Y.current = !1;
1876
- let e = n?.model || ue.current;
1877
- if (J(e)) return h(!0), Y.current = !0, await pe(n?.openingMessage ?? "", !0, e);
1875
+ }, K) return h(!0), me(t), await he(n?.openingMessage ?? "", !0, void 0, void 0, await q(n?.attachments));
1876
+ if (G) {
1877
+ me(t), se.current = !1;
1878
+ let e = n?.model || fe.current;
1879
+ if (Y(e)) return h(!0), se.current = !0, await he(n?.openingMessage ?? "", !0, e, void 0, await q(n?.attachments));
1878
1880
  }
1879
- let s = n?.model || void 0, c = s ? !!N[x(s)?.provider ?? ""] : !!W;
1881
+ let s = n?.model || void 0, c = s ? !!N[x(s)?.provider ?? ""] : !!U;
1880
1882
  if (!r || !c) {
1881
1883
  h(!1);
1882
1884
  let n = e.fallback(t, i);
@@ -1889,18 +1891,18 @@ function Ut(e, t = {}) {
1889
1891
  }
1890
1892
  h(!0);
1891
1893
  let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => _.fileToAttachment(e))) : void 0, u = ge(e.buildPrompt(t, i), e.microPromptIds);
1892
- return await _e(u, l, s);
1894
+ return await ye(u, l, s);
1893
1895
  } catch (e) {
1894
1896
  return p(Z(e)), null;
1895
1897
  } finally {
1896
1898
  D.current = !1, d(!1);
1897
1899
  }
1898
- }, ye = async (t, n) => {
1900
+ }, xe = async (t, n) => {
1899
1901
  if (D.current) {
1900
1902
  p(T.current.requestInProgress);
1901
1903
  return;
1902
1904
  }
1903
- D.current = !0, p(null), b(Ht(n.activity)), d(!0);
1905
+ D.current = !0, p(null), b(Ut(n.activity)), d(!0);
1904
1906
  try {
1905
1907
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1906
1908
  E.current = {
@@ -1910,13 +1912,13 @@ function Ut(e, t = {}) {
1910
1912
  history: n.history,
1911
1913
  logId: crypto.randomUUID(),
1912
1914
  attachmentsRef: a
1913
- }, (q || K) && fe(t), Y.current = !1, h(q || K || r && !!W);
1915
+ }, (K || G) && me(t), se.current = !1, h(K || G || r && !!U);
1914
1916
  } catch (e) {
1915
1917
  p(Z(e));
1916
1918
  } finally {
1917
1919
  D.current = !1, d(!1);
1918
1920
  }
1919
- }, be = async (t, n) => {
1921
+ }, Se = async (t, n) => {
1920
1922
  if (D.current) return p(T.current.requestInProgress), null;
1921
1923
  if (p(null), !t.trim()) return p("Messaggio vuoto."), null;
1922
1924
  let r = E.current;
@@ -1934,26 +1936,26 @@ function Ut(e, t = {}) {
1934
1936
  historyAt: r.history.length
1935
1937
  }]);
1936
1938
  try {
1937
- if (q) return await pe(t, !1, n?.model || void 0);
1938
- let i = n?.model || (K ? ue.current : "");
1939
- if (K && J(i)) {
1940
- let e = !Y.current;
1941
- return Y.current = !0, await pe(t, e, i);
1939
+ if (K) return await he(t, !1, n?.model || void 0, void 0, await q(n?.attachments));
1940
+ let i = n?.model || (G ? fe.current : "");
1941
+ if (G && Y(i)) {
1942
+ let e = !se.current;
1943
+ return se.current = !0, await he(t, e, i, void 0, await q(n?.attachments));
1942
1944
  }
1943
1945
  O.current &&= {
1944
1946
  ...O.current,
1945
1947
  fresh: !1
1946
1948
  };
1947
1949
  let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => _.fileToAttachment(e))) : void 0, o = ge(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1948
- return await _e(o, a, n?.model || void 0);
1950
+ return await ye(o, a, n?.model || void 0);
1949
1951
  } catch (e) {
1950
1952
  return p(Z(e)), null;
1951
1953
  } finally {
1952
1954
  D.current = !1, d(!1);
1953
1955
  }
1954
- }, xe = (e) => {
1956
+ }, Ce = (e) => {
1955
1957
  let t = E.current, n = g.findIndex((t) => t.id === e), r = g[n], i = r?.detail?.trim();
1956
- if (!ie || !t || !r || r.kind !== "user" || !i) return;
1958
+ if (!ae || !t || !r || r.kind !== "user" || !i) return;
1957
1959
  if (r.historyAt !== void 0) return r.historyAt;
1958
1960
  let a = g.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
1959
1961
  for (let e = 0; e < t.history.length; e += 1) {
@@ -1964,9 +1966,9 @@ function Ut(e, t = {}) {
1964
1966
  }
1965
1967
  }
1966
1968
  return n === g.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
1967
- }, Se = (e) => xe(e) !== void 0, Ce = async (e, t) => {
1969
+ }, we = (e) => Ce(e) !== void 0, Te = async (e, t) => {
1968
1970
  if (D.current) return p(T.current.requestInProgress), null;
1969
- let n = E.current, r = g.findIndex((t) => t.id === e), i = g[r], a = xe(e);
1971
+ let n = E.current, r = g.findIndex((t) => t.id === e), i = g[r], a = Ce(e);
1970
1972
  if (!n || !i || a === void 0) return null;
1971
1973
  let o = (t ?? i.detail ?? "").trim();
1972
1974
  if (!o) return null;
@@ -1974,8 +1976,8 @@ function Ut(e, t = {}) {
1974
1976
  return n.history = n.history.slice(0, a), O.current = {
1975
1977
  activity: s,
1976
1978
  fresh: !0
1977
- }, b(s), be(o);
1978
- }, we = () => {
1979
+ }, b(s), Se(o);
1980
+ }, Ee = () => {
1979
1981
  let t = E.current;
1980
1982
  if (!t) return null;
1981
1983
  p(null);
@@ -1986,7 +1988,7 @@ function Ut(e, t = {}) {
1986
1988
  status: "done",
1987
1989
  label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
1988
1990
  }]), n;
1989
- }, Te = () => E.current ? {
1991
+ }, De = () => E.current ? {
1990
1992
  history: E.current.history,
1991
1993
  activity: g
1992
1994
  } : null;
@@ -1994,53 +1996,54 @@ function Ut(e, t = {}) {
1994
1996
  enabled: r,
1995
1997
  setEnabled: i,
1996
1998
  hasProviders: a,
1997
- selectedModel: q || K && ce ? ce : H,
1998
- setSelectedModel: q ? de : K ? (e) => {
1999
- J(e) ? de(e) : (de(""), l(e));
1999
+ selectedModel: K || G && ue ? ue : V,
2000
+ setSelectedModel: K ? pe : G ? (e) => {
2001
+ Y(e) ? pe(e) : (pe(""), l(e));
2000
2002
  } : l,
2001
- modelsByProvider: V,
2003
+ modelsByProvider: B,
2002
2004
  modelsLoading: s,
2003
2005
  running: u,
2004
2006
  error: f,
2005
2007
  canContinue: m,
2006
- remote: q,
2007
- remoteModels: oe,
2008
- alongside: K,
2009
- ...G?.catalogGroup ? { catalogGroup: G.catalogGroup } : {},
2008
+ remote: K,
2009
+ remoteModels: ce,
2010
+ alongside: G,
2011
+ ...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
2010
2012
  activity: g,
2011
- run: ve,
2012
- resume: ye,
2013
- sendMessage: be,
2013
+ run: be,
2014
+ resume: xe,
2015
+ sendMessage: Se,
2014
2016
  stop: te,
2015
- runFallback: we,
2016
- snapshot: Te,
2017
- answerQuestions: he,
2018
- cardAction: me,
2019
- rewind: Ce,
2020
- canRewind: ie,
2021
- rewindable: Se,
2017
+ runFallback: Ee,
2018
+ snapshot: De,
2019
+ answerQuestions: ve,
2020
+ cardAction: _e,
2021
+ rewind: Te,
2022
+ canRewind: ae,
2023
+ rewindable: we,
2024
+ executorAttachments: oe,
2022
2025
  offersFallback: e.offersFallback !== !1
2023
2026
  };
2024
2027
  }
2025
2028
  //#endregion
2026
2029
  //#region src/domain/orchestrator/prompt.ts
2027
- function Wt() {
2030
+ function Gt() {
2028
2031
  let e = X();
2029
2032
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
2030
2033
  }
2031
- function Gt(e, t, n) {
2034
+ function Kt(e, t, n) {
2032
2035
  let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
2033
2036
  return `${r.orchestratorIntro}
2034
2037
 
2035
2038
  ${r.toolsHeading}
2036
2039
  ${t}
2037
2040
  ${i}
2038
- ${Wt()}
2041
+ ${Gt()}
2039
2042
 
2040
2043
  ${r.userRequestHeading}
2041
2044
  ${e}`;
2042
2045
  }
2043
- function Kt(e, t) {
2046
+ function qt(e, t) {
2044
2047
  return t ? {
2045
2048
  kind: "handoff",
2046
2049
  ...t
@@ -2051,27 +2054,27 @@ function Kt(e, t) {
2051
2054
  }
2052
2055
  //#endregion
2053
2056
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
2054
- function qt(e) {
2055
- return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
2056
- }
2057
2057
  function Jt(e) {
2058
+ return H().filter((t) => !t.onlyWhenAnchored || e === t.id);
2059
+ }
2060
+ function Yt(e) {
2058
2061
  return {
2059
2062
  buildContext(e) {
2060
2063
  return {
2061
- cliCatalog: pe(qt(e.scopedSubagentId)),
2064
+ cliCatalog: pe(Jt(e.scopedSubagentId)),
2062
2065
  handoff: { current: null },
2063
2066
  collected: {}
2064
2067
  };
2065
2068
  },
2066
2069
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
2067
- return Gt(e, n, t);
2070
+ return Kt(e, n, t);
2068
2071
  },
2069
2072
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
2070
- return `${e}\n\n${Wt()}\n\n${X().toolsHeading}\n${n}`;
2073
+ return `${e}\n\n${Gt()}\n\n${X().toolsHeading}\n${n}`;
2071
2074
  },
2072
2075
  parseResponse(e, t, n) {
2073
2076
  let r = n.handoff.current;
2074
- return n.handoff.current = null, Kt(e, r);
2077
+ return n.handoff.current = null, qt(e, r);
2075
2078
  },
2076
2079
  fallback() {
2077
2080
  return {
@@ -2083,11 +2086,11 @@ function Jt(e) {
2083
2086
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
2084
2087
  },
2085
2088
  getTools(t, n, r) {
2086
- let i = q({
2089
+ let i = K({
2087
2090
  attachmentsRef: r,
2088
2091
  collected: n.collected,
2089
2092
  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) => ({
2093
+ }), a = t.scopedSubagentId ? U(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
2094
  name: `${t.id}_${r.name}`,
2092
2095
  description: `${t.label}: ${r.summary}`,
2093
2096
  inputSchema: r.inputSchema,
@@ -2111,12 +2114,12 @@ function Jt(e) {
2111
2114
  }
2112
2115
  //#endregion
2113
2116
  //#region src/presentation/deriveHistoryTitle.ts
2114
- function Yt(e, t) {
2117
+ function Xt(e, t) {
2115
2118
  return e.deriveHistoryTitle?.(t) ?? e.label;
2116
2119
  }
2117
2120
  //#endregion
2118
2121
  //#region src/presentation/ResultDestinationPicker.tsx
2119
- function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2122
+ function Zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2120
2123
  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
2124
  e.destinationIds.forEach((e) => {
2122
2125
  let t = _[e];
@@ -2134,7 +2137,7 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2134
2137
  storageProvider: l?.storageProvider ?? null,
2135
2138
  proxyFetch: u
2136
2139
  }, 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));
2140
+ 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
2141
  } catch (e) {
2139
2142
  g(e instanceof Error ? e.message : String(e));
2140
2143
  } finally {
@@ -2167,16 +2170,16 @@ function Xt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2167
2170
  }
2168
2171
  //#endregion
2169
2172
  //#region src/presentation/reports/subagentReportRegistry.tsx
2170
- var Zt = {};
2171
- function Qt(e) {
2172
- Object.assign(Zt, e);
2173
- }
2173
+ var Qt = {};
2174
2174
  function $t(e) {
2175
- return Zt[e];
2175
+ Object.assign(Qt, e);
2176
+ }
2177
+ function en(e) {
2178
+ return Qt[e];
2176
2179
  }
2177
2180
  //#endregion
2178
2181
  //#region src/presentation/reports/GenericResultPreview.tsx
2179
- function en({ result: e }) {
2182
+ function tn({ result: e }) {
2180
2183
  let [t, n] = M(!1);
2181
2184
  return /* @__PURE__ */ F("div", {
2182
2185
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -2193,7 +2196,7 @@ function en({ result: e }) {
2193
2196
  }
2194
2197
  //#endregion
2195
2198
  //#region src/presentation/liveAnchorDestination.ts
2196
- function tn(e, t, n) {
2199
+ function nn(e, t, n) {
2197
2200
  return e.length === 0 ? null : {
2198
2201
  id: "live-component",
2199
2202
  label: "Applica al componente aperto",
@@ -2204,38 +2207,38 @@ function tn(e, t, n) {
2204
2207
  }
2205
2208
  //#endregion
2206
2209
  //#region src/presentation/subagentControls.ts
2207
- var nn = {};
2208
- function rn(e) {
2209
- Object.assign(nn, e);
2210
- }
2210
+ var rn = {};
2211
2211
  function an(e) {
2212
- return nn[e];
2212
+ Object.assign(rn, e);
2213
+ }
2214
+ function on(e) {
2215
+ return rn[e];
2213
2216
  }
2214
2217
  //#endregion
2215
2218
  //#region src/presentation/chatTitles.ts
2216
- function on(e, t = 6e3) {
2219
+ function sn(e, t = 6e3) {
2217
2220
  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
2221
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
2219
2222
  }
2220
- function sn(e) {
2223
+ function cn(e) {
2221
2224
  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
2225
  }
2223
- function cn(e, t) {
2226
+ function ln(e, t) {
2224
2227
  try {
2225
2228
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2226
2229
  } catch {
2227
2230
  return;
2228
2231
  }
2229
2232
  }
2230
- function ln(e, t, n, r, i) {
2231
- let a = cn(e, t), o = (e) => {
2233
+ function un(e, t, n, r, i) {
2234
+ let a = ln(e, t), o = (e) => {
2232
2235
  let t = e ? x(e) : null;
2233
2236
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2234
2237
  };
2235
2238
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2236
2239
  }
2237
- function un(e) {
2238
- let t = C()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Ft(), i = j({
2240
+ function dn(e) {
2241
+ let t = C()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = It(), i = j({
2239
2242
  registry: t,
2240
2243
  modelsByProvider: n,
2241
2244
  selectedModel: r
@@ -2247,17 +2250,17 @@ function un(e) {
2247
2250
  };
2248
2251
  let a = j(/* @__PURE__ */ new Set()), o = O(async (t, n, r) => {
2249
2252
  if (!e) return !1;
2250
- let o = ze(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2253
+ let o = ze(e, t, n), s = U(t), c = `${e}:${t}:${n}`;
2251
2254
  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;
2255
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = un(s, o.params, r ?? d, u, l), p = f ? x(f) : null;
2253
2256
  if (!p) return !1;
2254
2257
  a.current.add(c);
2255
2258
  try {
2256
2259
  let r = await l[p.provider].complete({
2257
- prompt: X().chatTitle.replace("{chat}", on(o.activity)),
2260
+ prompt: X().chatTitle.replace("{chat}", sn(o.activity)),
2258
2261
  model: p.model,
2259
2262
  history: []
2260
- }), i = r && r.type === "text" ? sn(r.text) : "";
2263
+ }), i = r && r.type === "text" ? cn(r.text) : "";
2261
2264
  return i ? qe(e, t, n, i, "model") : !1;
2262
2265
  } catch {
2263
2266
  return !1;
@@ -2266,9 +2269,9 @@ function un(e) {
2266
2269
  }
2267
2270
  }, [e]), s = Object.keys(n).length > 0;
2268
2271
  return k(() => {
2269
- e && s && !dn.has(e) && (dn.add(e), (async () => {
2272
+ e && s && !fn.has(e) && (fn.add(e), (async () => {
2270
2273
  for (let t of Xe(e)) {
2271
- let n = W(t.subagentId);
2274
+ let n = U(t.subagentId);
2272
2275
  if (n?.autoTitle) {
2273
2276
  if (n.definition.conversational && !Ge(t)) {
2274
2277
  Ye(e, t.subagentId, t.entityId);
@@ -2284,15 +2287,15 @@ function un(e) {
2284
2287
  o
2285
2288
  ]), o;
2286
2289
  }
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) => {
2290
+ var fn = /* @__PURE__ */ new Set(), pn = () => ({});
2291
+ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2292
+ 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
2293
  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);
2294
+ }, [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
2295
  p && p !== D.current && (D.current = p, T.current = (r?.length ?? 0) + c.activity.length);
2293
2296
  let O = j(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
2294
2297
  k(() => {
2295
- !w.current && ee && (w.current = !0, a ? (U.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
2298
+ !w.current && ee && (w.current = !0, a ? (H.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
2296
2299
  model: o,
2297
2300
  openingMessage: s
2298
2301
  }).then((e) => {
@@ -2312,7 +2315,7 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2312
2315
  ...t,
2313
2316
  pinnedEntityId: r
2314
2317
  }).then((n) => {
2315
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Yt(e, t));
2318
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Xt(e, t));
2316
2319
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2317
2320
  });
2318
2321
  }, [
@@ -2331,16 +2334,16 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2331
2334
  p,
2332
2335
  x,
2333
2336
  S
2334
- ]), L = A(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), R = A(() => tn(L, t, f), [
2337
+ ]), L = A(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), R = A(() => nn(L, t, f), [
2335
2338
  L,
2336
2339
  t,
2337
2340
  f
2338
- ]), z = A(() => R ? [R, ...n ?? []] : n, [R, n]), B = e.chatEntityId?.(t), V = un(u?.id), H = j(!1), U = j(!1);
2341
+ ]), re = A(() => R ? [R, ...n ?? []] : n, [R, n]), z = e.chatEntityId?.(t), B = dn(u?.id), V = j(!1), H = j(!1);
2339
2342
  k(() => {
2340
- let n = !H.current && c.running, i = H.current && !c.running;
2341
- if (H.current = c.running, !n && !i || !B || !u) return;
2342
- if (U.current) {
2343
- i && (U.current = !1);
2343
+ let n = !V.current && c.running, i = V.current && !c.running;
2344
+ if (V.current = c.running, !n && !i || !z || !u) return;
2345
+ if (H.current) {
2346
+ i && (H.current = !1);
2344
2347
  return;
2345
2348
  }
2346
2349
  let a = c.snapshot();
@@ -2349,37 +2352,37 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2349
2352
  e.autoTitle && e.definition.conversational && !Ge({ activity: o }) || (Be({
2350
2353
  scopeId: u.id,
2351
2354
  subagentId: e.id,
2352
- entityId: B,
2355
+ entityId: z,
2353
2356
  params: t,
2354
- title: Yt(e, t),
2357
+ title: Xt(e, t),
2355
2358
  history: a.history,
2356
2359
  activity: o
2357
- }), i && e.autoTitle && V(e.id, B, c.selectedModel));
2360
+ }), i && e.autoTitle && B(e.id, z, c.selectedModel));
2358
2361
  }, [c.running]);
2359
- let W = () => {
2362
+ let U = () => {
2360
2363
  O.current = !0, c.running && c.stop(), l.closeTask(f);
2361
- }, G = j(an(e.id) ?? fn).current, K = G({
2364
+ }, W = j(on(e.id) ?? pn).current, G = W({
2362
2365
  params: t,
2363
2366
  taskId: f,
2364
2367
  running: c.running,
2365
- close: W
2366
- }), q = (e) => {
2368
+ close: U
2369
+ }), K = (e) => {
2367
2370
  _((t) => t.includes(e) ? t : [...t, e]);
2368
2371
  };
2369
2372
  return k(() => {
2370
2373
  O.current || l.openTask({
2371
2374
  id: f,
2372
- title: Yt(e, t),
2375
+ title: Xt(e, t),
2373
2376
  icon: e.icon,
2374
2377
  agent: c,
2375
2378
  onApplied: (e) => h(e),
2376
2379
  precedingActivity: r,
2377
2380
  panelExtraAnchorIndex: T.current,
2378
- onDismiss: W,
2379
- ...B ? { savedToDisk: !0 } : {},
2380
- panelActions: K.content,
2381
- composerActions: K.actions,
2382
- composerCommands: K.commands,
2381
+ onDismiss: U,
2382
+ ...z ? { savedToDisk: !0 } : {},
2383
+ panelActions: G.content,
2384
+ composerActions: G.actions,
2385
+ composerCommands: G.commands,
2383
2386
  panelExtra: p ? /* @__PURE__ */ F(N, { children: [
2384
2387
  x && S ? /* @__PURE__ */ P(x.Report, {
2385
2388
  result: p,
@@ -2388,19 +2391,19 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2388
2391
  }) : b?.kind === "editable" ? /* @__PURE__ */ P(b.Report, {
2389
2392
  result: p,
2390
2393
  onResultChange: ne
2391
- }) : /* @__PURE__ */ P(en, { result: I }),
2394
+ }) : /* @__PURE__ */ P(tn, { result: I }),
2392
2395
  v && /* @__PURE__ */ F("p", {
2393
2396
  className: "text-xs text-destructive",
2394
2397
  children: ["Salvataggio automatico non riuscito: ", v]
2395
2398
  }),
2396
- /* @__PURE__ */ P(Xt, {
2399
+ /* @__PURE__ */ P(Zt, {
2397
2400
  manifest: e,
2398
2401
  result: I,
2399
2402
  meta: t,
2400
2403
  taskId: f,
2401
2404
  initiallyApplied: g,
2402
- onApplied: q,
2403
- extraDestinations: z
2405
+ onApplied: K,
2406
+ extraDestinations: re
2404
2407
  })
2405
2408
  ] }) : void 0
2406
2409
  });
@@ -2425,17 +2428,17 @@ function pn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2425
2428
  n,
2426
2429
  r,
2427
2430
  v,
2428
- K.content,
2429
- K.actions,
2430
- K.commands
2431
+ G.content,
2432
+ G.actions,
2433
+ G.commands
2431
2434
  ]), k(() => () => {
2432
2435
  l.closeTask(f);
2433
2436
  }, [l.closeTask, f]), null;
2434
2437
  }
2435
2438
  //#endregion
2436
2439
  //#region src/presentation/OrchestratorRunner.tsx
2437
- function mn({ userGoal: e }) {
2438
- let t = $(), n = Ut(A(() => Jt({
2440
+ function hn({ userGoal: e }) {
2441
+ let t = $(), n = Wt(A(() => Yt({
2439
2442
  unavailable: t.orchestratorUnavailable,
2440
2443
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2441
2444
  preparing: t.orchestratorPreparing,
@@ -2482,8 +2485,8 @@ function mn({ userGoal: e }) {
2482
2485
  }, [r.closeTask]);
2483
2486
  let h = A(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2484
2487
  if (!i) return null;
2485
- let g = W(i.subagentId);
2486
- return g ? /* @__PURE__ */ P(pn, {
2488
+ let g = U(i.subagentId);
2489
+ return g ? /* @__PURE__ */ P(mn, {
2487
2490
  manifest: g,
2488
2491
  params: i.params,
2489
2492
  extraDestinations: c.current,
@@ -2494,8 +2497,8 @@ function mn({ userGoal: e }) {
2494
2497
  }
2495
2498
  //#endregion
2496
2499
  //#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) => {
2500
+ function gn({ manifest: e, extraDestinations: n }) {
2501
+ 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
2502
  if (!e.manualEntry) return;
2500
2503
  let n;
2501
2504
  try {
@@ -2522,7 +2525,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2522
2525
  p
2523
2526
  ]), S = (e) => {
2524
2527
  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, [
2528
+ }, 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
2529
  C,
2527
2530
  h,
2528
2531
  o
@@ -2551,8 +2554,8 @@ function hn({ manifest: e, extraDestinations: n }) {
2551
2554
  }) : d?.kind === "editable" ? /* @__PURE__ */ P(d.Report, {
2552
2555
  result: s,
2553
2556
  onResultChange: b
2554
- }) : /* @__PURE__ */ P(en, { result: x }),
2555
- /* @__PURE__ */ P(Xt, {
2557
+ }) : /* @__PURE__ */ P(tn, { result: x }),
2558
+ /* @__PURE__ */ P(Zt, {
2556
2559
  manifest: e,
2557
2560
  result: x,
2558
2561
  meta: h ?? {},
@@ -2589,7 +2592,7 @@ function hn({ manifest: e, extraDestinations: n }) {
2589
2592
  }
2590
2593
  //#endregion
2591
2594
  //#region src/presentation/Agentico.tsx
2592
- function gn(e, t) {
2595
+ function _n(e, t) {
2593
2596
  return Object.values(e).flat().map((e) => {
2594
2597
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2595
2598
  return {
@@ -2601,7 +2604,7 @@ function gn(e, t) {
2601
2604
  };
2602
2605
  });
2603
2606
  }
2604
- function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2607
+ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2605
2608
  let a = $(), [o, c] = M(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
2606
2609
  k(() => {
2607
2610
  n && c(n.detail ?? "");
@@ -2621,7 +2624,7 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2621
2624
  }).then((e) => {
2622
2625
  e && u(e);
2623
2626
  });
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);
2627
+ }, 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
2628
  return /* @__PURE__ */ F(N, { children: [n && /* @__PURE__ */ F("div", {
2626
2629
  className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
2627
2630
  children: [
@@ -2651,7 +2654,7 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2651
2654
  onStop: l.stop,
2652
2655
  disabled: !o.trim() || _,
2653
2656
  onSubmit: m,
2654
- attachments: !d && !l.remote && !g,
2657
+ attachments: !d && (l.remote || g ? l.executorAttachments : !0),
2655
2658
  models: v,
2656
2659
  selectedModel: h ? "" : l.selectedModel,
2657
2660
  actions: e.composerActions,
@@ -2662,8 +2665,8 @@ function _n({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
2662
2665
  maxHeight: 220
2663
2666
  })] });
2664
2667
  }
2665
- function vn() {
2666
- let { startOrchestrator: e } = nt(), t = $(), [n, r] = M(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Ft(), l = (t) => {
2668
+ function yn() {
2669
+ let { startOrchestrator: e } = nt(), t = $(), [n, r] = M(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = It(), l = (t) => {
2667
2670
  t.text.trim() && (e(t.text.trim(), {
2668
2671
  attachments: t.files.length > 0 ? t.files : void 0,
2669
2672
  model: t.model || void 0
@@ -2676,7 +2679,7 @@ function vn() {
2676
2679
  disabled: !n.trim() || u,
2677
2680
  onSubmit: l,
2678
2681
  attachments: !0,
2679
- models: gn(a),
2682
+ models: _n(a),
2680
2683
  selectedModel: o,
2681
2684
  onModelChange: c,
2682
2685
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2684,7 +2687,7 @@ function vn() {
2684
2687
  maxHeight: 220
2685
2688
  });
2686
2689
  }
2687
- function yn({ chat: e, onClose: t }) {
2690
+ function bn({ chat: e, onClose: t }) {
2688
2691
  let n = $(), r = w();
2689
2692
  return /* @__PURE__ */ P(h, {
2690
2693
  title: n.renameChat,
@@ -2707,7 +2710,7 @@ function yn({ chat: e, onClose: t }) {
2707
2710
  })
2708
2711
  });
2709
2712
  }
2710
- function bn(e, t, n = Date.now()) {
2713
+ function xn(e, t, n = Date.now()) {
2711
2714
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2712
2715
  numeric: "auto",
2713
2716
  style: "short"
@@ -2719,7 +2722,7 @@ function bn(e, t, n = Date.now()) {
2719
2722
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2720
2723
  return i.format(0, "minute");
2721
2724
  }
2722
- function xn({ card: e }) {
2725
+ function Sn({ card: e }) {
2723
2726
  let t = $();
2724
2727
  return e.humanSummaryOnly ? /* @__PURE__ */ F("div", {
2725
2728
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2775,7 +2778,7 @@ function xn({ card: e }) {
2775
2778
  ]
2776
2779
  });
2777
2780
  }
2778
- function Sn({ messages: e }) {
2781
+ function Cn({ messages: e }) {
2779
2782
  return /* @__PURE__ */ P("div", {
2780
2783
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2781
2784
  children: e.map((e, t) => /* @__PURE__ */ P("p", {
@@ -2784,7 +2787,7 @@ function Sn({ messages: e }) {
2784
2787
  }, t))
2785
2788
  });
2786
2789
  }
2787
- function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2790
+ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2788
2791
  let c = $(), { locale: d } = T(), [p, m] = M(""), [h, g] = M(0);
2789
2792
  k(() => Le(() => g((e) => e + 1)), []);
2790
2793
  let _ = A(() => r ? Xe(e) : [], [
@@ -2792,7 +2795,7 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2792
2795
  r,
2793
2796
  h
2794
2797
  ]), [v, y] = M(null), b = async (t) => {
2795
- let r = W(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2798
+ let r = U(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2796
2799
  if (!i || window.confirm(i)) {
2797
2800
  try {
2798
2801
  await r?.onArchive?.(t.entityId, t.params);
@@ -2804,7 +2807,7 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2804
2807
  }, x = A(() => {
2805
2808
  let e = p.trim().toLowerCase();
2806
2809
  return e ? _.filter((t) => {
2807
- let n = W(t.subagentId)?.label ?? t.subagentId;
2810
+ let n = U(t.subagentId)?.label ?? t.subagentId;
2808
2811
  return We(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
2809
2812
  }) : _;
2810
2813
  }, [_, p]);
@@ -2848,7 +2851,7 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2848
2851
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
2849
2852
  children: _.length === 0 ? c.noSavedChats : c.noResults
2850
2853
  }) : x.map((e) => {
2851
- let t = W(e.subagentId), r = n === Ze(e.subagentId, e.entityId);
2854
+ let t = U(e.subagentId), r = n === Ze(e.subagentId, e.entityId);
2852
2855
  return /* @__PURE__ */ P(u, {
2853
2856
  icon: r ? "check" : t?.icon ?? "bot",
2854
2857
  className: r ? "bg-accent font-semibold text-primary" : void 0,
@@ -2873,54 +2876,54 @@ function Cn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2873
2876
  }), /* @__PURE__ */ P("span", {
2874
2877
  className: "shrink-0 text-xs text-muted-foreground",
2875
2878
  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)
2879
+ children: xn(Je(e), d)
2877
2880
  })]
2878
2881
  })
2879
2882
  }, `${e.subagentId}:${e.entityId}`);
2880
2883
  })
2881
- }), v && /* @__PURE__ */ P(yn, {
2884
+ }), v && /* @__PURE__ */ P(bn, {
2882
2885
  chat: v,
2883
2886
  onClose: () => y(null)
2884
2887
  })] });
2885
2888
  }
2886
- function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2889
+ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2887
2890
  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
2891
  k(() => {
2889
2892
  A(null), I(null);
2890
- }, [a?.id]), un(T?.id);
2891
- let L = kt({
2893
+ }, [a?.id]), dn(T?.id);
2894
+ let L = At({
2892
2895
  defaultWidth: e,
2893
2896
  minWidth: n,
2894
2897
  maxWidth: r,
2895
2898
  onWidthChange: i
2896
2899
  }), R = () => {
2897
2900
  (!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(), ee(!1));
2898
- }, z = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], B = z.length, V = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? B, B)), H = z.slice(0, V), U = z.slice(V), G = !!(a && !a.agent.running && a.agent.error), K = (e, t) => {
2901
+ }, re = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], z = re.length, B = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? z, z)), V = re.slice(0, B), H = re.slice(B), W = !!(a && !a.agent.running && a.agent.error), G = (e, t) => {
2899
2902
  a && (A(null), a.agent.rewind(e.id, t).then((e) => {
2900
2903
  e && a.onApplied(e);
2901
2904
  }));
2902
- }, q = (e) => {
2905
+ }, K = (e) => {
2903
2906
  let t = a?.agent.activity ?? [], n = t.slice(t.findIndex((t) => t.id === e.id) + 1).flatMap((e) => [...e.kind === "tool" && e.status === "done" ? [e.label] : [], ...(e.parts ?? []).flatMap((e) => e.type === "tool" && e.status === "done" ? [e.label] : [])]);
2904
2907
  return [...new Set(n.filter(Boolean))];
2905
- }, re = (e, t) => {
2906
- let n = q(e);
2908
+ }, ie = (e, t) => {
2909
+ let n = K(e);
2907
2910
  n.length ? I({
2908
2911
  entry: e,
2909
2912
  steps: n,
2910
2913
  ...t === void 0 ? {} : { text: t }
2911
- }) : K(e, t);
2912
- }, ie = a ? {
2914
+ }) : G(e, t);
2915
+ }, ae = a ? {
2913
2916
  available: (e) => a.agent.activity.some((t) => t.id === e.id) && a.agent.rewindable(e.id),
2914
2917
  disabled: a.agent.running,
2915
- onRetry: (e) => re(e),
2918
+ onRetry: (e) => ie(e),
2916
2919
  onEdit: (e) => A(e)
2917
- } : void 0, ae = new Set(a?.agent.activity.map((e) => e.id) ?? []), J = a ? {
2918
- canAnswer: (e) => ae.has(e),
2920
+ } : void 0, oe = new Set(a?.agent.activity.map((e) => e.id) ?? []), q = a ? {
2921
+ canAnswer: (e) => oe.has(e),
2919
2922
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2920
2923
  e && a.onApplied(e);
2921
2924
  }),
2922
2925
  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);
2926
+ } : void 0, J = q ? gt(re, q.canAnswer) : null, Y = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? U(a.scopedSubagentId) : void 0, se = Y?.manualEntry ? Y : null, X = j(!0);
2924
2927
  k(() => {
2925
2928
  let e = D.current;
2926
2929
  if (!e) return;
@@ -2932,13 +2935,13 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2932
2935
  let e = D.current;
2933
2936
  e && (X.current = !0, e.scrollTop = e.scrollHeight);
2934
2937
  }, [a?.id]);
2935
- let ce = z.at(-1)?.detail?.length ?? 0;
2938
+ let ce = re.at(-1)?.detail?.length ?? 0;
2936
2939
  k(() => {
2937
2940
  let e = D.current;
2938
2941
  e && X.current && (e.scrollTop = e.scrollHeight);
2939
2942
  }, [
2940
- B,
2941
- G,
2943
+ z,
2944
+ W,
2942
2945
  ce
2943
2946
  ]);
2944
2947
  let le = j(null);
@@ -2950,7 +2953,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2950
2953
  });
2951
2954
  return n.observe(t), () => n.disconnect();
2952
2955
  }, [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, {
2956
+ let ue = s ? /* @__PURE__ */ P(hn, { userGoal: s }, c) : null, de = f ? U(f.subagentId) : void 0, fe = f && de ? /* @__PURE__ */ P(mn, {
2954
2957
  manifest: de,
2955
2958
  params: f.snapshot.params,
2956
2959
  taskId: Ze(f.subagentId, f.entityId),
@@ -2958,14 +2961,14 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2958
2961
  history: f.snapshot.history,
2959
2962
  activity: f.snapshot.activity
2960
2963
  }
2961
- }, p) : null, pe = _ ? W(_.subagentId) : void 0, me = _ && pe ? /* @__PURE__ */ P(hn, {
2964
+ }, p) : null, pe = _ ? U(_.subagentId) : void 0, me = _ && pe ? /* @__PURE__ */ P(gn, {
2962
2965
  manifest: pe,
2963
2966
  extraDestinations: _.extraDestinations
2964
- }, v) : null, he = x ? W(x.subagentId) : void 0, ge = x && he ? /* @__PURE__ */ P(pn, {
2967
+ }, v) : null, he = x ? U(x.subagentId) : void 0, ge = x && he ? /* @__PURE__ */ P(mn, {
2965
2968
  manifest: he,
2966
2969
  params: x.params,
2967
2970
  extraDestinations: x.extraDestinations
2968
- }, S) : null, Z = C ? W(C.subagentId) : void 0, _e = C && Z ? /* @__PURE__ */ P(pn, {
2971
+ }, S) : null, Z = C ? U(C.subagentId) : void 0, _e = C && Z ? /* @__PURE__ */ P(mn, {
2969
2972
  manifest: Z,
2970
2973
  params: C.params,
2971
2974
  taskId: C.taskId,
@@ -2981,7 +2984,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2981
2984
  style: { width: L.width },
2982
2985
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2983
2986
  children: [
2984
- /* @__PURE__ */ P(At, {
2987
+ /* @__PURE__ */ P(jt, {
2985
2988
  width: L.width,
2986
2989
  min: L.min,
2987
2990
  max: L.max,
@@ -2996,7 +2999,7 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2996
2999
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2997
3000
  children: a ? a.title : "Agentico"
2998
3001
  }),
2999
- T && /* @__PURE__ */ P(Cn, {
3002
+ T && /* @__PURE__ */ P(wn, {
3000
3003
  scopeId: T.id,
3001
3004
  currentTaskId: a?.id ?? null,
3002
3005
  open: O,
@@ -3005,37 +3008,37 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3005
3008
  onSelect: (e, t, n) => h(e, t, n),
3006
3009
  onArchivedCurrent: m
3007
3010
  }),
3008
- /* @__PURE__ */ P(jt, {})
3011
+ /* @__PURE__ */ P(Mt, {})
3009
3012
  ]
3010
3013
  }),
3011
3014
  /* @__PURE__ */ P("div", {
3012
3015
  ref: D,
3013
- className: `flex-1 overflow-y-auto px-3 pb-2 ${Y ? "min-h-24" : "min-h-0"}`,
3016
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${J ? "min-h-24" : "min-h-0"}`,
3014
3017
  children: /* @__PURE__ */ P("div", {
3015
3018
  ref: le,
3016
3019
  className: "pt-2",
3017
3020
  children: a ? /* @__PURE__ */ F(N, { children: [
3018
- a.manualEntry && z.length === 0 && /* @__PURE__ */ P("p", {
3021
+ a.manualEntry && re.length === 0 && /* @__PURE__ */ P("p", {
3019
3022
  className: "text-xs text-muted-foreground",
3020
3023
  children: a.manualEntry.prompt
3021
3024
  }),
3022
- /* @__PURE__ */ P(yt, {
3023
- activity: H,
3024
- questions: J,
3025
- docked: Y,
3026
- pinUserMessages: !Y,
3027
- messageActions: ie
3025
+ /* @__PURE__ */ P(bt, {
3026
+ activity: V,
3027
+ questions: q,
3028
+ docked: J,
3029
+ pinUserMessages: !J,
3030
+ messageActions: ae
3028
3031
  }),
3029
3032
  a.panelExtra && /* @__PURE__ */ P("div", {
3030
3033
  className: "mt-3",
3031
3034
  children: a.panelExtra
3032
3035
  }),
3033
- U.length > 0 && /* @__PURE__ */ P(yt, {
3034
- activity: U,
3035
- questions: J,
3036
- docked: Y,
3037
- pinUserMessages: !Y,
3038
- messageActions: ie
3036
+ H.length > 0 && /* @__PURE__ */ P(bt, {
3037
+ activity: H,
3038
+ questions: q,
3039
+ docked: J,
3040
+ pinUserMessages: !J,
3041
+ messageActions: ae
3039
3042
  }),
3040
3043
  !a.agent.running && a.agent.error && /* @__PURE__ */ F("div", {
3041
3044
  className: "mt-2 flex items-center gap-2",
@@ -3049,6 +3052,11 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3049
3052
  variant: "secondary",
3050
3053
  className: "shrink-0",
3051
3054
  onClick: () => {
3055
+ let e = [...a.agent.activity].reverse().find((e) => e.kind === "user");
3056
+ if (e && a.agent.rewindable(e.id)) {
3057
+ ie(e);
3058
+ return;
3059
+ }
3052
3060
  a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
3053
3061
  e && a.onApplied(e);
3054
3062
  });
@@ -3069,13 +3077,13 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3069
3077
  })
3070
3078
  ]
3071
3079
  })
3072
- ] }) : d.length > 0 ? /* @__PURE__ */ P(Sn, { messages: d }) : u ? /* @__PURE__ */ P(xn, { card: u }) : /* @__PURE__ */ P("p", {
3080
+ ] }) : d.length > 0 ? /* @__PURE__ */ P(Cn, { messages: d }) : u ? /* @__PURE__ */ P(Sn, { card: u }) : /* @__PURE__ */ P("p", {
3073
3081
  className: "text-xs text-muted-foreground",
3074
3082
  children: l ?? E.orchestratorStarterHint
3075
3083
  })
3076
3084
  })
3077
3085
  }),
3078
- a && Y ? /* @__PURE__ */ F("section", {
3086
+ a && J ? /* @__PURE__ */ F("section", {
3079
3087
  "aria-label": E.pendingQuestions,
3080
3088
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
3081
3089
  children: [
@@ -3085,12 +3093,12 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3085
3093
  }),
3086
3094
  /* @__PURE__ */ P("div", {
3087
3095
  className: "min-h-0 overflow-y-auto px-4 py-3",
3088
- children: /* @__PURE__ */ P(gt, {
3089
- entry: Y.entry,
3090
- part: Y.part,
3091
- questions: J,
3096
+ children: /* @__PURE__ */ P(_t, {
3097
+ entry: J.entry,
3098
+ part: J.part,
3099
+ questions: q,
3092
3100
  autoFocus: !0
3093
- }, `${Y.entry.id}:${Y.part.id}`)
3101
+ }, `${J.entry.id}:${J.part.id}`)
3094
3102
  }),
3095
3103
  a.agent.running && /* @__PURE__ */ P("div", {
3096
3104
  className: "flex shrink-0 justify-end px-4 pb-3",
@@ -3107,17 +3115,17 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3107
3115
  children: [a?.panelActions && /* @__PURE__ */ P("div", {
3108
3116
  className: "mb-2",
3109
3117
  children: a.panelActions
3110
- }), a ? /* @__PURE__ */ P(_n, {
3118
+ }), a ? /* @__PURE__ */ P(vn, {
3111
3119
  task: a,
3112
3120
  editing: te,
3113
3121
  onCancelEdit: () => A(null),
3114
- onSendEdit: (e, t) => re(e, t)
3115
- }, a.id) : /* @__PURE__ */ P(vn, {})]
3122
+ onSendEdit: (e, t) => ie(e, t)
3123
+ }, a.id) : /* @__PURE__ */ P(yn, {})]
3116
3124
  }),
3117
3125
  ne && /* @__PURE__ */ F(g, {
3118
3126
  title: E.rewindTitle,
3119
3127
  onClose: () => I(null),
3120
- onYes: async () => (K(ne.entry, ne.text), !0),
3128
+ onYes: async () => (G(ne.entry, ne.text), !0),
3121
3129
  children: [/* @__PURE__ */ P("p", {
3122
3130
  className: "text-sm",
3123
3131
  children: E.rewindText
@@ -3138,13 +3146,13 @@ function wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3138
3146
  }
3139
3147
  //#endregion
3140
3148
  //#region src/presentation/useAgenticoPageContext.ts
3141
- function Tn(e, t) {
3149
+ function En(e, t) {
3142
3150
  let { setPageContext: n } = nt(), r = j(crypto.randomUUID()).current;
3143
3151
  k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
3144
3152
  }
3145
3153
  //#endregion
3146
3154
  //#region src/presentation/useSubagentComponentContext.ts
3147
- function En(e, t, n, r, i = !0, a) {
3155
+ function Dn(e, t, n, r, i = !0, a) {
3148
3156
  let { registerComponentAnchor: o } = nt(), s = j(crypto.randomUUID()).current, c = j(n);
3149
3157
  c.current = n, k(() => {
3150
3158
  if (i) return o(s, {
@@ -3163,6 +3171,6 @@ function En(e, t, n, r, i = !0, a) {
3163
3171
  ]);
3164
3172
  }
3165
3173
  //#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 };
3174
+ 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, q as agenticoPromptsEn, J as agenticoPromptsIt, Qe as agenticoTranslations, ge as applyMicroPrompts, Ge as chatHasPersonMessage, Je as chatStartedAt, We as chatTitle, se as configureAgenticoPrompts, ke as configureEntityChatStore, K as createCrossAgentTools, z as defineSubagent, Ze as entityChatTaskId, Z as extractErrorMessage, _e as extractJsonBlock, U as findSubagentManifest, re as formatQuestionAnswers, X as getAgenticoPrompts, Ce as getDestinationRegistry, ze as getEntityChat, on as getSubagentControls, H as getSubagentRegistry, en as getSubagentReport, Ae as hasEntityChatBackend, be as jsonExportDestination, Xe as listEntityChats, R as messagePartsText, Le as onEntityChatsChange, G as registerCrossAgentTools, Se as registerDestinations, an as registerSubagentControls, $t as registerSubagentReports, V as registerSubagents, Ye as removeEntityChat, qe as renameEntityChat, pe as renderRegistryCli, fe as renderSubagentCli, ce as resetAgenticoPrompts, Be as saveEntityChat, Ne as syncEntityChats, ie as toJsonSchema, ae as toMcpTool, L as upsertMessagePart, Wt as useAgent, nt as useAgentico, $ as useAgenticoI18n, En as useAgenticoPageContext, Dn as useSubagentComponentContext };
3167
3175
 
3168
3176
  //# sourceMappingURL=index.mjs.map