@llmnative/agentico 0.18.0 → 0.19.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
@@ -1,9 +1,9 @@
1
1
  import { zodToJsonSchema as e } from "zod-to-json-schema";
2
- import { ActionButton as t, Badge as n, Card as r, ChatMarkdown as i, ChatQuestions as a, ChatReasoning as o, Chatbot as s, Code as c, Dropdown as l, DropdownItem as u, Form as d, Icon as f, Identicon as p, ImageAvatar as m, Input as h, LoadingButton as g, Modal as _, ModalYesNo as v, PromptUtils as y, Tree as b, getAIModelCatalog as x, interpolate as S, parseAIModelRef as C, proxyFetch as w, useAIProviderRegistry as T, useFormController as E, useI18n as D, useProxy as O } from "@llmnative/react";
3
- import ee, { createContext as te, useCallback as k, useContext as A, useEffect as j, useLayoutEffect as M, useMemo as N, useRef as P, useState as F } from "react";
4
- import { Fragment as ne, jsx as I, jsxs as L } from "react/jsx-runtime";
2
+ import { ActionButton as t, Badge as n, Card as r, ChatMarkdown as i, ChatQuestions as a, ChatReasoning as o, Chatbot as s, Code as c, Dropdown as l, DropdownItem as u, Form as d, Icon as f, Identicon as p, ImageAvatar as m, Input as h, LoadingButton as g, Modal as _, ModalYesNo as v, PromptUtils as y, Tree as b, getAIModelCatalog as x, interpolate as S, parseAIModelRef as C, proxyFetch as w, useAIProviderRegistry as T, useFormController as ee, useI18n as E, useProxy as D } from "@llmnative/react";
3
+ import O, { createContext as te, useCallback as k, useContext as A, useEffect as j, useLayoutEffect as M, useMemo as N, useRef as P, useState as F } from "react";
4
+ import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
5
5
  //#region src/domain/messageParts.ts
6
- var R = "text", z = "reasoning";
6
+ var ne = "text", z = "reasoning";
7
7
  function B(e, t, n) {
8
8
  let r = e.findIndex((e) => e.type === t.type && e.id === t.id);
9
9
  if (r >= 0) return e.map((e, n) => n === r ? t : e);
@@ -17,56 +17,56 @@ function B(e, t, n) {
17
17
  function V(e) {
18
18
  return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
19
19
  }
20
- function H(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 re(e) {
25
+ function ie(e) {
26
26
  return e;
27
27
  }
28
28
  //#endregion
29
29
  //#region src/domain/subagentRegistry.ts
30
- var U = [];
31
- function W(e) {
32
- U = e;
30
+ var H = [];
31
+ function U(e) {
32
+ H = e;
33
33
  }
34
- function G() {
35
- return U.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), U;
34
+ function ae() {
35
+ return H.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), H;
36
36
  }
37
- function K(e) {
38
- return U.find((t) => t.id === e);
37
+ function W(e) {
38
+ return H.find((t) => t.id === e);
39
39
  }
40
40
  //#endregion
41
41
  //#region src/domain/crossAgentTools.ts
42
- var q = [];
43
- function ie(...e) {
44
- q = e;
42
+ var G = [];
43
+ function K(...e) {
44
+ G = e;
45
45
  }
46
- function ae(e) {
47
- return q.flatMap((t) => t(e));
46
+ function oe(e) {
47
+ return G.flatMap((t) => t(e));
48
48
  }
49
49
  //#endregion
50
50
  //#region src/domain/mcpTool.ts
51
- function oe(t) {
51
+ function se(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 se(e, t, n, r) {
58
+ function ce(e, t, n, r) {
59
59
  return {
60
60
  name: e,
61
61
  description: t,
62
- inputSchema: oe(n),
63
- ...r ? { outputSchema: oe(r) } : {}
62
+ inputSchema: se(n),
63
+ ...r ? { outputSchema: se(r) } : {}
64
64
  };
65
65
  }
66
66
  //#endregion
67
67
  //#region src/domain/subagentUsageCard.ts
68
- function ce(e) {
69
- let t = oe(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function le(e) {
69
+ let t = se(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 ce(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/domain/prompts.ts
83
- var le = {
83
+ var ue = {
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 le = {
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
- }, ue = {
113
+ }, de = {
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,26 +140,26 @@ var le = {
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
- }, de = le;
143
+ }, q = ue;
144
144
  function fe(e) {
145
- de = {
146
- ...de,
145
+ q = {
146
+ ...q,
147
147
  ...e
148
148
  };
149
149
  }
150
150
  function J() {
151
- return de;
151
+ return q;
152
152
  }
153
153
  function pe() {
154
- de = le;
154
+ q = ue;
155
155
  }
156
156
  //#endregion
157
157
  //#region src/domain/cli/renderManifestCli.ts
158
158
  function me(e, t) {
159
159
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
160
160
  }
161
- function Y(e, t) {
162
- let n = ce(t), r = me(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
161
+ function he(e, t) {
162
+ let n = le(t), r = me(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}`,
@@ -171,38 +171,38 @@ function Y(e, t) {
171
171
  ...i,
172
172
  "",
173
173
  " OUTPUT",
174
- X(t.describeOutput(), 4),
174
+ Y(t.describeOutput(), 4),
175
175
  (t.example, ""),
176
176
  t.example ? " EXAMPLE" : "",
177
177
  t.example ? ` ${t.example}` : ""
178
178
  ].filter((e) => e !== "").join("\n");
179
179
  }
180
- function X(e, t) {
180
+ function Y(e, t) {
181
181
  let n = " ".repeat(t);
182
182
  return e.split("\n").map((e) => e && n + e).join("\n");
183
183
  }
184
- function he(e) {
184
+ function ge(e) {
185
185
  return [
186
186
  "NAME",
187
187
  ` ${e.id} — ${e.label}`,
188
188
  "",
189
189
  "DESCRIPTION",
190
- X(e.description, 2),
190
+ Y(e.description, 2),
191
191
  "",
192
- ...e.commands.map((t) => Y(e.id, t))
192
+ ...e.commands.map((t) => he(e.id, t))
193
193
  ].join("\n");
194
194
  }
195
- function ge(e) {
195
+ function _e(e) {
196
196
  return e.length === 0 ? J().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
197
197
  }
198
198
  //#endregion
199
199
  //#region src/domain/microPrompts.ts
200
- var _e = {
200
+ var X = {
201
201
  id: "closing-summary",
202
202
  get text() {
203
203
  return J().closingSummary;
204
204
  }
205
- }, ve = { [_e.id]: _e };
205
+ }, ve = { [X.id]: X };
206
206
  function ye(e, t) {
207
207
  if (!t || t.length === 0) return e;
208
208
  let n = t.map((e) => ve[e]?.text).filter((e) => !!e);
@@ -330,6 +330,7 @@ var Oe = {
330
330
  eventMore: "More",
331
331
  eventLess: "Less",
332
332
  eventOpen: "Open",
333
+ eventRunning: "In progress",
333
334
  showEvents: "Show what the agents did",
334
335
  hideEvents: "Conversation only",
335
336
  cardView: "View",
@@ -411,6 +412,7 @@ var Oe = {
411
412
  eventMore: "Di più",
412
413
  eventLess: "Meno",
413
414
  eventOpen: "Apri",
415
+ eventRunning: "In corso",
414
416
  showEvents: "Mostra cosa hanno fatto gli agenti",
415
417
  hideEvents: "Solo la conversazione",
416
418
  cardView: "Vedi",
@@ -492,6 +494,7 @@ var Oe = {
492
494
  eventMore: "Mehr",
493
495
  eventLess: "Weniger",
494
496
  eventOpen: "Öffnen",
497
+ eventRunning: "Läuft",
495
498
  showEvents: "Zeigen, was die Agenten getan haben",
496
499
  hideEvents: "Nur das Gespräch",
497
500
  cardView: "Ansehen",
@@ -642,7 +645,7 @@ var et = (e, t) => `entitychat-${e}-${t}`;
642
645
  //#endregion
643
646
  //#region src/domain/chatThread.ts
644
647
  function tt(e) {
645
- return K(e.subagentId)?.thread?.(e.params) || void 0;
648
+ return W(e.subagentId)?.thread?.(e.params) || void 0;
646
649
  }
647
650
  function nt(e, t, n) {
648
651
  let r = $e(e), i = n ? r.find((e) => et(e.subagentId, e.entityId) === n) : void 0, a = i ? Q(i) : Infinity;
@@ -660,14 +663,34 @@ function rt(e, t) {
660
663
  return n;
661
664
  }
662
665
  //#endregion
666
+ //#region src/presentation/imagePreview.ts
667
+ var it = 480, at = 4;
668
+ async function ot(e, t) {
669
+ if (e.type.startsWith("image/") && typeof document < "u" && typeof createImageBitmap == "function") try {
670
+ let n = await createImageBitmap(e), r = Math.min(1, t / Math.max(n.width, n.height)), i = document.createElement("canvas");
671
+ i.width = Math.max(1, Math.round(n.width * r)), i.height = Math.max(1, Math.round(n.height * r));
672
+ let a = i.getContext("2d");
673
+ return a ? (a.fillStyle = "#fff", a.fillRect(0, 0, i.width, i.height), a.drawImage(n, 0, 0, i.width, i.height), n.close?.(), i.toDataURL("image/jpeg", .8)) : void 0;
674
+ } catch {
675
+ return;
676
+ }
677
+ }
678
+ async function st(e, t = 480, n = 4) {
679
+ let r = e.filter((e) => e.type.startsWith("image/")).slice(0, n);
680
+ return (await Promise.all(r.map(async (e) => ({
681
+ name: e.name,
682
+ src: await ot(e, t)
683
+ })))).filter((e) => !!e.src);
684
+ }
685
+ //#endregion
663
686
  //#region src/i18n/index.ts
664
- var it = {
687
+ var ct = {
665
688
  en: { agentico: Oe },
666
689
  it: { agentico: ke },
667
690
  de: { agentico: Ae }
668
691
  };
669
692
  function $() {
670
- let { dict: e } = D(), t = e.agentico;
693
+ let { dict: e } = E(), t = e.agentico;
671
694
  return t ? {
672
695
  ...Oe,
673
696
  ...t
@@ -675,8 +698,8 @@ function $() {
675
698
  }
676
699
  //#endregion
677
700
  //#region src/presentation/AgenticoContext.tsx
678
- var at = "agentico-orchestrator", ot = te(null);
679
- function st({ children: e, scope: t = null, person: n = null, threadEvents: r = null }) {
701
+ var lt = "agentico-orchestrator", ut = te(null);
702
+ function dt({ children: e, scope: t = null, person: n = null, threadEvents: r = null }) {
680
703
  let [i, a] = F(null), o = P(null);
681
704
  j(() => {
682
705
  o.current = i;
@@ -695,8 +718,8 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
695
718
  a(n);
696
719
  }, []), d = k((e) => {
697
720
  a((t) => t && t.id === e ? null : t);
698
- }, []), f = k(() => c((e) => !e), []), p = k(() => c(!0), []), [m, h] = F(null), [g, _] = F(void 0), [v, y] = F(void 0), [b, x] = F(void 0), [S, C] = F(null), [w, T] = F(null), [E, D] = F(void 0), [O, ee] = F([]), te = k((e, t, n = null) => {
699
- ee((r) => {
721
+ }, []), f = k(() => c((e) => !e), []), p = k(() => c(!0), []), [m, h] = F(null), [g, _] = F(void 0), [v, y] = F(void 0), [b, x] = F(void 0), [S, C] = F(null), [w, T] = F(null), [ee, E] = F(void 0), [D, O] = F([]), te = k((e, t, n = null) => {
722
+ O((r) => {
700
723
  let i = r.filter((t) => t.id !== e);
701
724
  return t ? [...i, {
702
725
  id: e,
@@ -704,15 +727,15 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
704
727
  card: n
705
728
  }] : i;
706
729
  });
707
- }, []), A = O.length > 0 ? O[O.length - 1] : null, [M, ne] = F([]), L = k((e, t) => {
708
- ne((n) => {
730
+ }, []), A = D.length > 0 ? D[D.length - 1] : null, [M, I] = F([]), R = k((e, t) => {
731
+ I((n) => {
709
732
  let r = n.filter((t) => t.id !== e);
710
733
  return t ? [...r, {
711
734
  id: e,
712
735
  ...t
713
736
  }] : r;
714
737
  });
715
- }, []), R = N(() => M.map((e) => ({
738
+ }, []), ne = N(() => M.map((e) => ({
716
739
  subagentId: e.subagentId,
717
740
  componentKey: e.componentKey,
718
741
  onResult: e.onResult,
@@ -727,7 +750,7 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
727
750
  });
728
751
  return [...e.values()];
729
752
  }, [M]), B = N(() => z.map((e) => {
730
- let t = K(e.subagentId)?.componentContexts?.[e.componentKey];
753
+ let t = W(e.subagentId)?.componentContexts?.[e.componentKey];
731
754
  if (!t) return null;
732
755
  let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
733
756
  return {
@@ -735,21 +758,21 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
735
758
  agenticoHint: n,
736
759
  userMessage: t.userMessage
737
760
  };
738
- }).filter((e) => e !== null), [z]), V = N(() => B.map((e) => e.userMessage), [B]), H = N(() => {
761
+ }).filter((e) => e !== null), [z]), V = N(() => B.map((e) => e.userMessage), [B]), re = N(() => {
739
762
  if (B.length === 0) return null;
740
763
  if (B.length === 1) return B[0].agenticoHint;
741
764
  let e = B.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
742
765
  return `${J().multipleCandidates}\n\n${e}`;
743
- }, [B]) ?? A?.text ?? null, re = B.length > 0 ? null : A?.card ?? null, U = N(() => [...new Set(R.map((e) => e.subagentId))], [R]), W = U.length === 1 ? U[0] : U.length === 0 ? A?.card?.subagentId ?? null : null, G = k((e, t) => {
766
+ }, [B]) ?? A?.text ?? null, ie = B.length > 0 ? null : A?.card ?? null, H = N(() => [...new Set(ne.map((e) => e.subagentId))], [ne]), U = H.length === 1 ? H[0] : H.length === 0 ? A?.card?.subagentId ?? null : null, ae = k((e, t) => {
744
767
  p();
745
768
  let n = o.current;
746
769
  if (n?.id === "agentico-orchestrator") return;
747
- let r = W && n?.id.startsWith(`subagent-${W}-`) ? n : void 0;
770
+ let r = U && n?.id.startsWith(`subagent-${U}-`) ? n : void 0;
748
771
  T(r ? {
749
772
  taskId: r.id,
750
773
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
751
- } : null), h(e), _(t?.extraDestinations), y(t?.attachments), x(t?.model), D(t?.scopedSubagentId), C(crypto.randomUUID());
752
- }, [p, W]), q = k((e, t, n, r, i, s) => {
774
+ } : null), h(e), _(t?.extraDestinations), y(t?.attachments), x(t?.model), E(t?.scopedSubagentId), C(crypto.randomUUID());
775
+ }, [p, U]), G = k((e, t, n, r, i, s) => {
753
776
  if (!n || !r) return;
754
777
  let c = o.current;
755
778
  if (!c || c.id !== n) return;
@@ -766,24 +789,24 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
766
789
  ...e,
767
790
  savedToDisk: !0
768
791
  } : e));
769
- }, []), [ie, ae] = F(null), [oe, se] = F(null), ce = k((e, t, n) => {
770
- p(), ae({
792
+ }, []), [K, oe] = F(null), [se, ce] = F(null), le = k((e, t, n) => {
793
+ p(), oe({
771
794
  subagentId: e,
772
795
  entityId: t,
773
796
  snapshot: n
774
- }), se(crypto.randomUUID());
775
- }, [p]), [le, ue] = F(null), [de, fe] = F(null), pe = k((e, t) => {
776
- p(), d(at), ue({
797
+ }), ce(crypto.randomUUID());
798
+ }, [p]), [ue, de] = F(null), [q, fe] = F(null), pe = k((e, t) => {
799
+ p(), d(lt), de({
777
800
  subagentId: e,
778
801
  extraDestinations: t
779
802
  }), fe(crypto.randomUUID());
780
- }, [p, d]), [me, Y] = F(null), [X, he] = F(null), ge = k((e, t, n) => {
781
- ue(null), Y({
803
+ }, [p, d]), [me, he] = F(null), [Y, ge] = F(null), _e = k((e, t, n) => {
804
+ de(null), he({
782
805
  subagentId: e,
783
806
  params: t,
784
807
  extraDestinations: n
785
- }), he(crypto.randomUUID());
786
- }, []), [_e, ve] = F(null), [ye, be] = F(null), xe = k((e, t, n) => {
808
+ }), ge(crypto.randomUUID());
809
+ }, []), [X, ve] = F(null), [ye, be] = F(null), xe = k((e, t, n) => {
787
810
  p(), ve({
788
811
  subagentId: e,
789
812
  params: t,
@@ -802,34 +825,34 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
802
825
  closeTask: d,
803
826
  toggleOpen: f,
804
827
  pendingGoal: m,
805
- startOrchestrator: G,
806
- pageContext: H,
807
- pageContextCard: re,
828
+ startOrchestrator: ae,
829
+ pageContext: re,
830
+ pageContextCard: ie,
808
831
  setPageContext: te,
809
- scopedSubagentId: W,
810
- pendingScopedSubagentId: E,
811
- componentAnchors: R,
832
+ scopedSubagentId: U,
833
+ pendingScopedSubagentId: ee,
834
+ componentAnchors: ne,
812
835
  anchoredUserMessages: V,
813
- registerComponentAnchor: L,
836
+ registerComponentAnchor: R,
814
837
  openPanel: p,
815
838
  pendingExtraDestinations: g,
816
839
  pendingAttachments: v,
817
840
  pendingModel: b,
818
841
  orchestratorRunId: S,
819
842
  pendingCarryOver: w,
820
- commitEntityChat: q,
821
- resumeEntityChat: ce,
822
- pendingResume: ie,
823
- resumeRunId: oe,
843
+ commitEntityChat: G,
844
+ resumeEntityChat: le,
845
+ pendingResume: K,
846
+ resumeRunId: se,
824
847
  dismissForeignTask: Se,
825
- pendingManualEntry: le,
826
- manualEntryRunId: de,
848
+ pendingManualEntry: ue,
849
+ manualEntryRunId: q,
827
850
  startManualEntry: pe,
828
851
  pendingResumeWithAI: me,
829
- resumeWithAIRunId: X,
830
- resumeWithAI: ge,
852
+ resumeWithAIRunId: Y,
853
+ resumeWithAI: _e,
831
854
  startSubagent: xe,
832
- pendingStart: _e,
855
+ pendingStart: X,
833
856
  startRunId: ye
834
857
  }), [
835
858
  t,
@@ -841,53 +864,53 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
841
864
  d,
842
865
  f,
843
866
  m,
844
- G,
845
- H,
867
+ ae,
846
868
  re,
869
+ ie,
847
870
  te,
848
- W,
849
- E,
850
- R,
871
+ U,
872
+ ee,
873
+ ne,
851
874
  V,
852
- L,
875
+ R,
853
876
  p,
854
877
  g,
855
878
  v,
856
879
  b,
857
880
  S,
858
881
  w,
859
- q,
860
- ce,
861
- ie,
862
- oe,
863
- Se,
882
+ G,
864
883
  le,
865
- de,
884
+ K,
885
+ se,
886
+ Se,
887
+ ue,
888
+ q,
866
889
  pe,
867
890
  me,
868
- X,
869
- ge,
870
- xe,
891
+ Y,
871
892
  _e,
893
+ xe,
894
+ X,
872
895
  ye
873
896
  ]);
874
- return /* @__PURE__ */ I(ot.Provider, {
897
+ return /* @__PURE__ */ L(ut.Provider, {
875
898
  value: Ce,
876
899
  children: e
877
900
  });
878
901
  }
879
- function ct() {
880
- let e = A(ot);
902
+ function ft() {
903
+ let e = A(ut);
881
904
  if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
882
905
  return e;
883
906
  }
884
907
  //#endregion
885
908
  //#region src/presentation/ThreadEvents.tsx
886
- var lt = "llmnative.agentico.threadEvents";
887
- function ut() {
909
+ var pt = "llmnative.agentico.threadEvents";
910
+ function mt() {
888
911
  let [e, t] = F(() => {
889
912
  try {
890
- return localStorage.getItem(lt) !== "off";
913
+ return localStorage.getItem(pt) !== "off";
891
914
  } catch {
892
915
  return !0;
893
916
  }
@@ -895,12 +918,12 @@ function ut() {
895
918
  return [e, (e) => {
896
919
  t(e);
897
920
  try {
898
- localStorage.setItem(lt, e ? "on" : "off");
921
+ localStorage.setItem(pt, e ? "on" : "off");
899
922
  } catch {}
900
923
  }];
901
924
  }
902
- function dt(e, t, n, r = !0) {
903
- let { threadEvents: i } = ct(), [a, o] = F([]);
925
+ function ht(e, t, n, r = !0) {
926
+ let { threadEvents: i } = ft(), [a, o] = F([]);
904
927
  return j(() => {
905
928
  if (!i || !e || !r) {
906
929
  o([]);
@@ -924,65 +947,71 @@ function dt(e, t, n, r = !0) {
924
947
  r
925
948
  ]), a;
926
949
  }
927
- function ft({ event: e }) {
928
- let t = $(), { locale: r } = D(), [a, o] = F(!1), s = new Date(e.at).toLocaleString(r, {
950
+ function gt({ event: e }) {
951
+ let t = $(), { locale: r } = E(), [a, o] = F(!1), s = new Date(e.at).toLocaleString(r, {
929
952
  dateStyle: "short",
930
953
  timeStyle: "short"
931
954
  });
932
- return /* @__PURE__ */ L("li", {
955
+ return /* @__PURE__ */ R("li", {
933
956
  className: "flex items-start gap-2 py-1 text-xs",
934
957
  "aria-label": `${e.author.name}: ${e.title}`,
935
- children: [/* @__PURE__ */ I("span", {
958
+ "aria-busy": e.running || void 0,
959
+ children: [/* @__PURE__ */ L("span", {
936
960
  className: "flex w-6 shrink-0 justify-center pt-px",
937
- children: /* @__PURE__ */ I(St, { author: e.author })
938
- }), /* @__PURE__ */ L("div", {
939
- className: "min-w-0 flex-1 rounded-md border border-border/60 bg-muted/30 px-2 py-1",
940
- children: [/* @__PURE__ */ L("div", {
961
+ children: /* @__PURE__ */ L(Dt, { author: e.author })
962
+ }), /* @__PURE__ */ R("div", {
963
+ className: `min-w-0 flex-1 rounded-md border px-2 py-1 ${e.running ? "border-primary/40 bg-primary/5" : "border-border/60 bg-muted/30"}`,
964
+ children: [/* @__PURE__ */ R("div", {
941
965
  className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5",
942
966
  children: [
943
- /* @__PURE__ */ I("span", {
967
+ /* @__PURE__ */ L("span", {
944
968
  className: "font-medium text-foreground",
945
969
  children: e.author.name
946
970
  }),
947
- e.icon && /* @__PURE__ */ I(f, {
971
+ e.running ? /* @__PURE__ */ L(f, {
972
+ name: "loader-circle",
973
+ size: 12,
974
+ className: "shrink-0 animate-spin text-primary",
975
+ "aria-label": t.eventRunning
976
+ }) : e.icon && /* @__PURE__ */ L(f, {
948
977
  name: e.icon,
949
978
  size: 12,
950
979
  className: "shrink-0 text-muted-foreground"
951
980
  }),
952
- /* @__PURE__ */ I("span", {
981
+ /* @__PURE__ */ L("span", {
953
982
  className: "min-w-0 break-words text-muted-foreground",
954
983
  children: e.title
955
984
  }),
956
- e.badge && /* @__PURE__ */ I(n, {
985
+ e.badge && /* @__PURE__ */ L(n, {
957
986
  variant: e.badge.variant ?? "light",
958
987
  children: e.badge.label
959
988
  }),
960
- /* @__PURE__ */ L("span", {
989
+ /* @__PURE__ */ R("span", {
961
990
  className: "ms-auto flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground",
962
991
  children: [
963
- /* @__PURE__ */ I("time", {
992
+ /* @__PURE__ */ L("time", {
964
993
  dateTime: new Date(e.at).toISOString(),
965
994
  children: s
966
995
  }),
967
- e.body && /* @__PURE__ */ I("button", {
996
+ e.body && /* @__PURE__ */ L("button", {
968
997
  type: "button",
969
998
  onClick: () => o((e) => !e),
970
999
  "aria-expanded": a,
971
1000
  title: a ? t.eventLess : t.eventMore,
972
1001
  className: "rounded hover:text-foreground",
973
- children: /* @__PURE__ */ I(f, {
1002
+ children: /* @__PURE__ */ L(f, {
974
1003
  name: a ? "chevron-up" : "chevron-down",
975
1004
  size: 12
976
1005
  })
977
1006
  }),
978
- e.href && /* @__PURE__ */ I("a", {
1007
+ e.href && /* @__PURE__ */ L("a", {
979
1008
  href: e.href,
980
1009
  target: "_blank",
981
1010
  rel: "noreferrer",
982
1011
  title: t.eventOpen,
983
1012
  "aria-label": t.eventOpen,
984
1013
  className: "rounded hover:text-foreground",
985
- children: /* @__PURE__ */ I(f, {
1014
+ children: /* @__PURE__ */ L(f, {
986
1015
  name: "external-link",
987
1016
  size: 12
988
1017
  })
@@ -990,7 +1019,7 @@ function ft({ event: e }) {
990
1019
  ]
991
1020
  })
992
1021
  ]
993
- }), a && e.body && /* @__PURE__ */ I(i, {
1022
+ }), a && e.body && /* @__PURE__ */ L(i, {
994
1023
  content: e.body,
995
1024
  tone: "muted",
996
1025
  className: "mt-1 break-words text-xs leading-relaxed"
@@ -1000,7 +1029,7 @@ function ft({ event: e }) {
1000
1029
  }
1001
1030
  //#endregion
1002
1031
  //#region src/presentation/AgentActivityLog.tsx
1003
- function pt(e) {
1032
+ function _t(e) {
1004
1033
  let t = e.search(/[{[]/);
1005
1034
  if (t === -1) return [{
1006
1035
  type: "text",
@@ -1046,51 +1075,51 @@ function pt(e) {
1046
1075
  language: "json"
1047
1076
  });
1048
1077
  let u = e.slice(s + 1);
1049
- return u.trim() && l.push(...pt(u)), l;
1078
+ return u.trim() && l.push(..._t(u)), l;
1050
1079
  }
1051
- function mt(e) {
1080
+ function vt(e) {
1052
1081
  let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
1053
- for (; i = n.exec(e);) i.index > r && t.push(...pt(e.slice(r, i.index))), t.push({
1082
+ for (; i = n.exec(e);) i.index > r && t.push(..._t(e.slice(r, i.index))), t.push({
1054
1083
  type: "code",
1055
1084
  content: i[2].replace(/\n$/, ""),
1056
1085
  language: i[1]
1057
1086
  }), r = n.lastIndex;
1058
- return r < e.length && t.push(...pt(e.slice(r))), t;
1087
+ return r < e.length && t.push(..._t(e.slice(r))), t;
1059
1088
  }
1060
- function ht({ content: e, language: t }) {
1089
+ function yt({ content: e, language: t }) {
1061
1090
  let [n, r] = F(!1);
1062
- return /* @__PURE__ */ L("div", {
1091
+ return /* @__PURE__ */ R("div", {
1063
1092
  className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
1064
1093
  onClick: () => r((e) => !e),
1065
1094
  title: n ? "Clic per comprimere" : "Clic per espandere",
1066
- children: [/* @__PURE__ */ I(c, {
1095
+ children: [/* @__PURE__ */ L(c, {
1067
1096
  language: t,
1068
1097
  showCopy: n,
1069
1098
  background: "transparent",
1070
1099
  className: "!text-[11px]",
1071
1100
  children: e
1072
- }), !n && /* @__PURE__ */ I("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
1101
+ }), !n && /* @__PURE__ */ L("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
1073
1102
  });
1074
1103
  }
1075
- function gt({ text: e, tone: t }) {
1076
- let n = mt(e);
1077
- return /* @__PURE__ */ I(ne, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ I(ht, {
1104
+ function bt({ text: e, tone: t }) {
1105
+ let n = vt(e);
1106
+ return /* @__PURE__ */ L(I, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ L(yt, {
1078
1107
  content: e.content,
1079
1108
  language: e.language
1080
- }, n) : e.content.trim() && /* @__PURE__ */ I(i, {
1109
+ }, n) : e.content.trim() && /* @__PURE__ */ L(i, {
1081
1110
  content: e.content.trim(),
1082
1111
  tone: t,
1083
1112
  className: "break-words text-xs leading-relaxed"
1084
1113
  }, n)) });
1085
1114
  }
1086
- function _t() {
1115
+ function xt() {
1087
1116
  let [e] = F(() => Date.now()), [t, n] = F(e);
1088
1117
  j(() => {
1089
1118
  let e = setInterval(() => n(Date.now()), 1e3);
1090
1119
  return () => clearInterval(e);
1091
1120
  }, []);
1092
1121
  let r = Math.floor((t - e) / 1e3);
1093
- return r < 10 ? null : /* @__PURE__ */ L("span", {
1122
+ return r < 10 ? null : /* @__PURE__ */ R("span", {
1094
1123
  className: "tabular-nums",
1095
1124
  children: [
1096
1125
  " · ",
@@ -1100,40 +1129,66 @@ function _t() {
1100
1129
  ]
1101
1130
  });
1102
1131
  }
1103
- function vt({ status: e }) {
1104
- return e === "running" ? /* @__PURE__ */ I("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ I(f, {
1132
+ function St({ status: e }) {
1133
+ return e === "running" ? /* @__PURE__ */ L("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ L(f, {
1105
1134
  name: "check",
1106
1135
  size: 12,
1107
1136
  className: "shrink-0 text-green-600"
1108
- }) : e === "stopped" ? /* @__PURE__ */ I(f, {
1137
+ }) : e === "stopped" ? /* @__PURE__ */ L(f, {
1109
1138
  name: "circle-slash",
1110
1139
  size: 12,
1111
1140
  className: "shrink-0 text-muted-foreground"
1112
- }) : /* @__PURE__ */ I(f, {
1141
+ }) : /* @__PURE__ */ L(f, {
1113
1142
  name: "x",
1114
1143
  size: 12,
1115
1144
  className: "shrink-0 text-destructive"
1116
1145
  });
1117
1146
  }
1118
- function yt(e, t) {
1147
+ function Ct(e, t) {
1119
1148
  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;
1120
1149
  }
1121
- var bt = 96, xt = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
1122
- function St({ author: e, size: t = 20 }) {
1123
- return e.avatarUrl ? /* @__PURE__ */ I(m, {
1150
+ var wt = 96, Tt = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
1151
+ function Et({ previews: e }) {
1152
+ let [t, n] = F(null);
1153
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("div", {
1154
+ className: "flex flex-wrap gap-1.5",
1155
+ children: e.map((e) => /* @__PURE__ */ L("button", {
1156
+ type: "button",
1157
+ onClick: () => n(e),
1158
+ title: e.name,
1159
+ className: "overflow-hidden rounded-md border border-border/60 bg-background",
1160
+ children: /* @__PURE__ */ L("img", {
1161
+ src: e.src,
1162
+ alt: e.name,
1163
+ className: "block max-h-40 max-w-full object-contain"
1164
+ })
1165
+ }, e.name))
1166
+ }), t && /* @__PURE__ */ L(_, {
1167
+ title: t.name,
1168
+ size: "lg",
1169
+ onClose: () => n(null),
1170
+ children: /* @__PURE__ */ L("img", {
1171
+ src: t.src,
1172
+ alt: t.name,
1173
+ className: "mx-auto block max-h-[70vh] max-w-full object-contain"
1174
+ })
1175
+ })] });
1176
+ }
1177
+ function Dt({ author: e, size: t = 20 }) {
1178
+ return e.avatarUrl ? /* @__PURE__ */ L(m, {
1124
1179
  src: e.avatarUrl,
1125
1180
  title: e.name,
1126
1181
  alt: e.name,
1127
1182
  width: t,
1128
1183
  height: t
1129
- }) : /* @__PURE__ */ I(p, {
1184
+ }) : /* @__PURE__ */ L(p, {
1130
1185
  value: e.name,
1131
1186
  size: t,
1132
1187
  title: e.name
1133
1188
  });
1134
1189
  }
1135
- var Ct = "w-6";
1136
- function wt(e) {
1190
+ var Ot = "w-6";
1191
+ function kt(e) {
1137
1192
  if (!e || e.kind !== "thinking" || !e.parts) return [];
1138
1193
  let t = [];
1139
1194
  for (let n of e.parts) {
@@ -1142,25 +1197,25 @@ function wt(e) {
1142
1197
  }
1143
1198
  return t;
1144
1199
  }
1145
- function Tt({ parts: e, open: t, onToggle: n }) {
1200
+ function At({ parts: e, open: t, onToggle: n }) {
1146
1201
  let r = $(), i = e.filter((e) => e.type === "reasoning"), a = e.filter((e) => e.type === "tool"), o = i.some((e) => e.streaming), s = a.filter((e) => e.status === "running").at(-1), c = Math.round(i.reduce((e, t) => e + (t.duration ?? 0), 0)), l = [...i.length ? [o ? r.reasoningNow : c > 0 ? S(r.reasonedFor, { seconds: c }) : r.reasoned] : [], ...a.length ? [s?.label ?? (a.length === 1 ? r.oneStep : S(r.steps, { count: a.length }))] : []], u = o || !!s, d = a.some((e) => e.status === "error");
1147
- return /* @__PURE__ */ L("button", {
1202
+ return /* @__PURE__ */ R("button", {
1148
1203
  type: "button",
1149
1204
  onClick: n,
1150
1205
  "aria-expanded": t,
1151
1206
  title: r.processDetails,
1152
1207
  className: "inline-flex min-w-0 items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground",
1153
1208
  children: [
1154
- /* @__PURE__ */ I(f, {
1209
+ /* @__PURE__ */ L(f, {
1155
1210
  name: u ? "loader-circle" : d ? "circle-alert" : i.length ? "brain" : "list-checks",
1156
1211
  size: 12,
1157
1212
  className: `shrink-0 ${u ? "animate-spin" : ""}`
1158
1213
  }),
1159
- /* @__PURE__ */ I("span", {
1214
+ /* @__PURE__ */ L("span", {
1160
1215
  className: "truncate",
1161
1216
  children: l.join(" · ")
1162
1217
  }),
1163
- /* @__PURE__ */ I(f, {
1218
+ /* @__PURE__ */ L(f, {
1164
1219
  name: t ? "chevron-up" : "chevron-down",
1165
1220
  size: 12,
1166
1221
  className: "shrink-0"
@@ -1168,13 +1223,13 @@ function Tt({ parts: e, open: t, onToggle: n }) {
1168
1223
  ]
1169
1224
  });
1170
1225
  }
1171
- function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a = !1 }) {
1226
+ function jt({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a = !1 }) {
1172
1227
  let o = $(), s = P(null), [c, l] = F(!1), [u, d] = F(!1);
1173
1228
  M(() => {
1174
1229
  let e = s.current;
1175
1230
  e && d(e.scrollHeight > 97);
1176
1231
  }, [e.detail, e.attachmentNames]);
1177
- let p = u && !c, m = r?.available(e) && i ? /* @__PURE__ */ I(t, {
1232
+ let p = u && !c, m = r?.available(e) && i ? /* @__PURE__ */ L(t, {
1178
1233
  icon: "rotate-ccw",
1179
1234
  ariaLabel: o.retry,
1180
1235
  title: o.retry,
@@ -1182,9 +1237,9 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
1182
1237
  className: "p-1 text-muted-foreground hover:text-foreground",
1183
1238
  disabled: r.disabled,
1184
1239
  onClick: () => r.onRetry(e)
1185
- }) : null, h = r?.available(e) ? /* @__PURE__ */ I("span", {
1240
+ }) : null, h = r?.available(e) ? /* @__PURE__ */ L("span", {
1186
1241
  className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
1187
- children: /* @__PURE__ */ I(t, {
1242
+ children: /* @__PURE__ */ L(t, {
1188
1243
  icon: "pencil",
1189
1244
  ariaLabel: o.editMessage,
1190
1245
  title: o.editMessage,
@@ -1193,46 +1248,50 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
1193
1248
  disabled: r.disabled,
1194
1249
  onClick: () => r.onEdit(e)
1195
1250
  })
1196
- }) : null, g = (t) => /* @__PURE__ */ L("div", {
1251
+ }) : null, g = (t) => /* @__PURE__ */ R("div", {
1197
1252
  className: `${t ? "w-full" : "max-w-[85%]"} rounded-lg bg-primary/10 text-xs text-foreground`,
1198
- children: [/* @__PURE__ */ L("div", {
1253
+ children: [/* @__PURE__ */ R("div", {
1199
1254
  ref: s,
1200
1255
  className: `space-y-1 px-2.5 pt-1.5 ${p ? "overflow-hidden" : ""}`,
1201
- style: p ? { maxHeight: bt } : void 0,
1202
- children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ I("div", {
1203
- className: "flex flex-wrap gap-1",
1204
- children: e.attachmentNames.map((e, t) => /* @__PURE__ */ L("span", {
1205
- className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
1206
- children: [/* @__PURE__ */ I(f, {
1207
- name: "paperclip",
1208
- size: 10,
1209
- className: "shrink-0"
1210
- }), /* @__PURE__ */ I("span", {
1211
- className: "max-w-[160px] truncate",
1212
- children: e
1213
- })]
1214
- }, t))
1215
- }), /* @__PURE__ */ I(gt, { text: e.detail ?? "" })]
1216
- }), u && /* @__PURE__ */ L("button", {
1256
+ style: p ? { maxHeight: wt } : void 0,
1257
+ children: [
1258
+ e.attachmentPreviews && e.attachmentPreviews.length > 0 && /* @__PURE__ */ L(Et, { previews: e.attachmentPreviews }),
1259
+ e.attachmentNames && e.attachmentNames.some((t) => !e.attachmentPreviews?.some((e) => e.name === t)) && /* @__PURE__ */ L("div", {
1260
+ className: "flex flex-wrap gap-1",
1261
+ children: e.attachmentNames.filter((t) => !e.attachmentPreviews?.some((e) => e.name === t)).map((e, t) => /* @__PURE__ */ R("span", {
1262
+ className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
1263
+ children: [/* @__PURE__ */ L(f, {
1264
+ name: "paperclip",
1265
+ size: 10,
1266
+ className: "shrink-0"
1267
+ }), /* @__PURE__ */ L("span", {
1268
+ className: "max-w-[160px] truncate",
1269
+ children: e
1270
+ })]
1271
+ }, t))
1272
+ }),
1273
+ /* @__PURE__ */ L(bt, { text: e.detail ?? "" })
1274
+ ]
1275
+ }), u && /* @__PURE__ */ R("button", {
1217
1276
  type: "button",
1218
1277
  onClick: () => l((e) => !e),
1219
1278
  className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
1220
1279
  title: c ? "Comprimi" : "Espandi",
1221
- children: [p && /* @__PURE__ */ I("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ I(f, {
1280
+ children: [p && /* @__PURE__ */ L("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ L(f, {
1222
1281
  name: c ? "chevron-up" : "chevron-down",
1223
1282
  size: 12
1224
1283
  })]
1225
1284
  })]
1226
1285
  });
1227
- return a ? /* @__PURE__ */ L("div", {
1286
+ return a ? /* @__PURE__ */ R("div", {
1228
1287
  className: `${n ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start gap-2 bg-background py-1.5`,
1229
- children: [/* @__PURE__ */ L("span", {
1230
- className: `flex shrink-0 flex-col items-center ${Ct}`,
1288
+ children: [/* @__PURE__ */ R("span", {
1289
+ className: `flex shrink-0 flex-col items-center ${Ot}`,
1231
1290
  children: [
1232
- e.author ? /* @__PURE__ */ I(St, { author: e.author }) : /* @__PURE__ */ I("span", {
1291
+ e.author ? /* @__PURE__ */ L(Dt, { author: e.author }) : /* @__PURE__ */ L("span", {
1233
1292
  className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground",
1234
1293
  "aria-hidden": !0,
1235
- children: /* @__PURE__ */ I(f, {
1294
+ children: /* @__PURE__ */ L(f, {
1236
1295
  name: "user",
1237
1296
  size: 12
1238
1297
  })
@@ -1240,30 +1299,30 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
1240
1299
  m,
1241
1300
  h
1242
1301
  ]
1243
- }), /* @__PURE__ */ L("div", {
1302
+ }), /* @__PURE__ */ R("div", {
1244
1303
  className: "min-w-0 flex-1",
1245
- children: [e.author && /* @__PURE__ */ I("div", {
1304
+ children: [e.author && /* @__PURE__ */ L("div", {
1246
1305
  className: "pb-0.5 text-xs font-medium text-foreground",
1247
1306
  children: e.author.name
1248
1307
  }), g(!0)]
1249
1308
  })]
1250
- }) : /* @__PURE__ */ L("div", {
1309
+ }) : /* @__PURE__ */ R("div", {
1251
1310
  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`,
1252
- children: [r?.available(e) && /* @__PURE__ */ L("span", {
1311
+ children: [r?.available(e) && /* @__PURE__ */ R("span", {
1253
1312
  className: "flex shrink-0 items-center",
1254
1313
  children: [m, h]
1255
1314
  }), g(!1)]
1256
1315
  });
1257
1316
  }
1258
- var Dt = {
1317
+ var Mt = {
1259
1318
  running: "loader-circle",
1260
1319
  done: "check",
1261
1320
  error: "x",
1262
1321
  stopped: "circle-slash"
1263
1322
  };
1264
- function Ot({ steps: e }) {
1323
+ function Nt({ steps: e }) {
1265
1324
  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 : S(t.steps, { count: e.length }));
1266
- return /* @__PURE__ */ I(b, {
1325
+ return /* @__PURE__ */ L(b, {
1267
1326
  ariaLabel: t.stepsLabel,
1268
1327
  selectedId: null,
1269
1328
  itemClassName: "py-0.5 text-xs text-muted-foreground",
@@ -1273,40 +1332,40 @@ function Ot({ steps: e }) {
1273
1332
  icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
1274
1333
  children: e.map((e) => ({
1275
1334
  id: e.id,
1276
- label: /* @__PURE__ */ I("span", {
1335
+ label: /* @__PURE__ */ L("span", {
1277
1336
  className: e.status === "error" ? "text-destructive" : void 0,
1278
1337
  children: e.label
1279
1338
  }),
1280
- icon: Dt[e.status]
1339
+ icon: Mt[e.status]
1281
1340
  }))
1282
1341
  }]
1283
1342
  });
1284
1343
  }
1285
- function kt({ entry: e, part: a, questions: o }) {
1344
+ function Pt({ entry: e, part: a, questions: o }) {
1286
1345
  let s = $(), [c, l] = F(!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";
1287
- return /* @__PURE__ */ L(r, {
1346
+ return /* @__PURE__ */ R(r, {
1288
1347
  headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
1289
1348
  bodyClassName: "px-3 py-2",
1290
- header: /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I("span", {
1349
+ header: /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("span", {
1291
1350
  className: "min-w-0 text-xs font-semibold text-foreground",
1292
1351
  children: a.title
1293
- }), a.badge && /* @__PURE__ */ I(n, {
1352
+ }), a.badge && /* @__PURE__ */ L(n, {
1294
1353
  variant: a.badge.variant ?? "info",
1295
1354
  children: a.badge.label
1296
1355
  })] }),
1297
- footer: /* @__PURE__ */ L("div", {
1356
+ footer: /* @__PURE__ */ R("div", {
1298
1357
  className: "space-y-1.5 px-3 py-2",
1299
- children: [/* @__PURE__ */ L("div", {
1358
+ children: [/* @__PURE__ */ R("div", {
1300
1359
  className: "flex items-center gap-1",
1301
1360
  children: [
1302
- a.details && /* @__PURE__ */ I(t, {
1361
+ a.details && /* @__PURE__ */ L(t, {
1303
1362
  icon: "eye",
1304
1363
  ariaLabel: s.cardView,
1305
1364
  title: s.cardView,
1306
1365
  variant: "outline-secondary",
1307
1366
  onClick: () => l(!0)
1308
1367
  }),
1309
- (a.actions ?? []).filter((e) => e.variant !== "primary" && e.icon).map((t) => /* @__PURE__ */ I(g, {
1368
+ (a.actions ?? []).filter((e) => e.variant !== "primary" && e.icon).map((t) => /* @__PURE__ */ L(g, {
1310
1369
  icon: t.icon,
1311
1370
  ariaLabel: t.label,
1312
1371
  title: t.label,
@@ -1314,9 +1373,9 @@ function kt({ entry: e, part: a, questions: o }) {
1314
1373
  disabled: !u,
1315
1374
  onClick: () => o.onCardAction(e.id, a.id, t.id)
1316
1375
  }, t.id)),
1317
- /* @__PURE__ */ I("span", {
1376
+ /* @__PURE__ */ L("span", {
1318
1377
  className: "ms-auto flex items-center gap-1",
1319
- children: (a.actions ?? []).filter((e) => e.variant === "primary" || !e.icon).map((t) => /* @__PURE__ */ I(g, {
1378
+ children: (a.actions ?? []).filter((e) => e.variant === "primary" || !e.icon).map((t) => /* @__PURE__ */ L(g, {
1320
1379
  ...t.icon ? { icon: t.icon } : {},
1321
1380
  label: t.label,
1322
1381
  variant: t.variant ?? "outline-primary",
@@ -1325,9 +1384,9 @@ function kt({ entry: e, part: a, questions: o }) {
1325
1384
  }, t.id))
1326
1385
  })
1327
1386
  ]
1328
- }), a.outcome && /* @__PURE__ */ L("p", {
1387
+ }), a.outcome && /* @__PURE__ */ R("p", {
1329
1388
  className: `text-xs ${d}`,
1330
- children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ L(ne, { children: [" ", /* @__PURE__ */ I("a", {
1389
+ children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ R(I, { children: [" ", /* @__PURE__ */ L("a", {
1331
1390
  className: "underline",
1332
1391
  href: a.outcome.link.url,
1333
1392
  target: "_blank",
@@ -1336,27 +1395,27 @@ function kt({ entry: e, part: a, questions: o }) {
1336
1395
  })] })]
1337
1396
  })]
1338
1397
  }),
1339
- children: [a.body ? /* @__PURE__ */ I(i, {
1398
+ children: [a.body ? /* @__PURE__ */ L(i, {
1340
1399
  content: a.body,
1341
1400
  className: "break-words text-xs leading-relaxed text-foreground"
1342
- }) : null, c && a.details && /* @__PURE__ */ I(_, {
1401
+ }) : null, c && a.details && /* @__PURE__ */ L(_, {
1343
1402
  title: a.title,
1344
1403
  position: "right",
1345
1404
  size: "lg",
1346
1405
  onClose: () => l(!1),
1347
- footer: /* @__PURE__ */ I(t, {
1406
+ footer: /* @__PURE__ */ L(t, {
1348
1407
  label: s.cardClose,
1349
1408
  variant: "outline-secondary",
1350
1409
  onClick: () => l(!1)
1351
1410
  }),
1352
- children: /* @__PURE__ */ I(i, {
1411
+ children: /* @__PURE__ */ L(i, {
1353
1412
  content: a.details,
1354
1413
  className: "break-words text-sm leading-relaxed text-foreground"
1355
1414
  })
1356
1415
  })]
1357
1416
  });
1358
1417
  }
1359
- function At(e, t) {
1418
+ function Ft(e, t) {
1360
1419
  let n = e.at(-1);
1361
1420
  if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
1362
1421
  let r = [...n.parts].reverse().find((e) => e.type === "questions");
@@ -1365,9 +1424,9 @@ function At(e, t) {
1365
1424
  part: r
1366
1425
  };
1367
1426
  }
1368
- function jt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1427
+ function It({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1369
1428
  let o = !!n?.canAnswer(e.id);
1370
- return /* @__PURE__ */ I(a, {
1429
+ return /* @__PURE__ */ L(a, {
1371
1430
  questions: t.questions,
1372
1431
  ...t.answers ? { answers: t.answers } : {},
1373
1432
  disabled: !t.answers && !o,
@@ -1376,7 +1435,7 @@ function jt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
1376
1435
  className: i ?? "text-xs"
1377
1436
  });
1378
1437
  }
1379
- function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1438
+ function Lt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1380
1439
  let a = (e.parts ?? []).filter((e) => (e.type !== "questions" || e.id !== n) && !r?.has(e.id)), s = [];
1381
1440
  for (let e of a) {
1382
1441
  let t = s.at(-1);
@@ -1388,25 +1447,25 @@ function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1388
1447
  part: e
1389
1448
  });
1390
1449
  }
1391
- return /* @__PURE__ */ I("div", {
1450
+ return /* @__PURE__ */ L("div", {
1392
1451
  className: "space-y-2",
1393
1452
  children: s.map((n) => {
1394
- if ("steps" in n) return /* @__PURE__ */ I(Ot, { steps: n.steps }, n.key);
1453
+ if ("steps" in n) return /* @__PURE__ */ L(Nt, { steps: n.steps }, n.key);
1395
1454
  let { part: r } = n;
1396
- return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ I(i, {
1455
+ return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ L(i, {
1397
1456
  content: r.text,
1398
1457
  streaming: r.streaming,
1399
1458
  className: "break-words text-xs leading-relaxed text-foreground"
1400
- }, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */ I(o, {
1459
+ }, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */ L(o, {
1401
1460
  content: r.text,
1402
1461
  streaming: r.streaming,
1403
1462
  duration: r.duration,
1404
1463
  className: "my-0"
1405
- }, n.key) : r.type === "card" ? /* @__PURE__ */ I(kt, {
1464
+ }, n.key) : r.type === "card" ? /* @__PURE__ */ L(Pt, {
1406
1465
  entry: e,
1407
1466
  part: r,
1408
1467
  questions: t
1409
- }, n.key) : /* @__PURE__ */ I(jt, {
1468
+ }, n.key) : /* @__PURE__ */ L(It, {
1410
1469
  entry: e,
1411
1470
  part: r,
1412
1471
  questions: t
@@ -1414,53 +1473,53 @@ function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1414
1473
  })
1415
1474
  });
1416
1475
  }
1417
- function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1476
+ function Rt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1418
1477
  let a = $();
1419
1478
  if (e.kind === "thinking" && e.parts) {
1420
1479
  let i = e.status === "error" || e.status === "stopped" || e.status === "running", o = r ? e.parts.filter((e) => !r.has(e.id)).length : e.parts.length;
1421
- return /* @__PURE__ */ L("li", {
1480
+ return /* @__PURE__ */ R("li", {
1422
1481
  className: "text-xs text-muted-foreground",
1423
- children: [o > 0 && /* @__PURE__ */ I(Mt, {
1482
+ children: [o > 0 && /* @__PURE__ */ L(Lt, {
1424
1483
  entry: e,
1425
1484
  questions: t,
1426
1485
  hiddenPartId: n,
1427
1486
  skip: r
1428
- }), i && /* @__PURE__ */ L("div", {
1487
+ }), i && /* @__PURE__ */ R("div", {
1429
1488
  className: `flex items-start gap-1.5 ${o > 0 ? "mt-1" : ""}`,
1430
- children: [/* @__PURE__ */ I("span", {
1489
+ children: [/* @__PURE__ */ L("span", {
1431
1490
  className: "pt-px",
1432
- children: /* @__PURE__ */ I(vt, { status: e.status })
1433
- }), /* @__PURE__ */ L("span", {
1491
+ children: /* @__PURE__ */ L(St, { status: e.status })
1492
+ }), /* @__PURE__ */ R("span", {
1434
1493
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1435
- children: [yt(e, a), e.status === "running" && /* @__PURE__ */ I(_t, {})]
1494
+ children: [Ct(e, a), e.status === "running" && /* @__PURE__ */ L(xt, {})]
1436
1495
  })]
1437
1496
  })]
1438
1497
  });
1439
1498
  }
1440
- let o = e.kind === "thinking" && e.detail ? mt(e.detail) : [], s = o.filter((e) => e.type === "code"), c = o.filter((e) => e.type === "text" && e.content.trim()), l = e.kind === "thinking" ? yt(e, a) : e.label;
1441
- return /* @__PURE__ */ L("li", {
1499
+ let o = e.kind === "thinking" && e.detail ? vt(e.detail) : [], s = o.filter((e) => e.type === "code"), c = o.filter((e) => e.type === "text" && e.content.trim()), l = e.kind === "thinking" ? Ct(e, a) : e.label;
1500
+ return /* @__PURE__ */ R("li", {
1442
1501
  className: "text-xs text-muted-foreground",
1443
1502
  children: [
1444
- /* @__PURE__ */ L("div", {
1503
+ /* @__PURE__ */ R("div", {
1445
1504
  className: "flex items-start gap-1.5",
1446
- children: [/* @__PURE__ */ I("span", {
1505
+ children: [/* @__PURE__ */ L("span", {
1447
1506
  className: "pt-px",
1448
- children: /* @__PURE__ */ I(vt, { status: e.status })
1449
- }), /* @__PURE__ */ I("span", {
1507
+ children: /* @__PURE__ */ L(St, { status: e.status })
1508
+ }), /* @__PURE__ */ L("span", {
1450
1509
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1451
1510
  children: l
1452
1511
  })]
1453
1512
  }),
1454
- s.length > 0 && /* @__PURE__ */ I("div", {
1513
+ s.length > 0 && /* @__PURE__ */ L("div", {
1455
1514
  className: "mt-1 ml-[18px] space-y-1",
1456
- children: s.map((e, t) => /* @__PURE__ */ I(ht, {
1515
+ children: s.map((e, t) => /* @__PURE__ */ L(yt, {
1457
1516
  content: e.content,
1458
1517
  language: e.language
1459
1518
  }, t))
1460
1519
  }),
1461
- c.length > 0 && /* @__PURE__ */ I("div", {
1520
+ c.length > 0 && /* @__PURE__ */ L("div", {
1462
1521
  className: "mt-1 ml-[18px] space-y-2",
1463
- children: c.map((e, t) => /* @__PURE__ */ I(i, {
1522
+ children: c.map((e, t) => /* @__PURE__ */ L(i, {
1464
1523
  content: e.content.trim(),
1465
1524
  tone: "muted",
1466
1525
  className: "break-words text-xs leading-relaxed"
@@ -1469,52 +1528,52 @@ function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
1469
1528
  ]
1470
1529
  });
1471
1530
  }
1472
- function Pt({ parts: e }) {
1473
- return /* @__PURE__ */ I("div", {
1531
+ function zt({ parts: e }) {
1532
+ return /* @__PURE__ */ L("div", {
1474
1533
  className: "mb-1 space-y-1 border-l-2 border-border pl-2 text-xs text-muted-foreground",
1475
- children: e.map((e) => e.type === "reasoning" ? /* @__PURE__ */ I(i, {
1534
+ children: e.map((e) => e.type === "reasoning" ? /* @__PURE__ */ L(i, {
1476
1535
  content: e.text,
1477
1536
  tone: "muted",
1478
1537
  streaming: e.streaming,
1479
1538
  className: "break-words text-xs leading-relaxed"
1480
- }, e.id) : e.type === "tool" ? /* @__PURE__ */ L("div", {
1539
+ }, e.id) : e.type === "tool" ? /* @__PURE__ */ R("div", {
1481
1540
  className: "flex items-start gap-1.5",
1482
- children: [/* @__PURE__ */ I(f, {
1483
- name: Dt[e.status],
1541
+ children: [/* @__PURE__ */ L(f, {
1542
+ name: Mt[e.status],
1484
1543
  size: 12,
1485
1544
  className: `mt-0.5 shrink-0 ${e.status === "running" ? "animate-spin" : ""}`
1486
- }), /* @__PURE__ */ I("span", {
1545
+ }), /* @__PURE__ */ L("span", {
1487
1546
  className: `min-w-0 break-words ${e.status === "error" ? "text-destructive" : ""}`,
1488
1547
  children: e.label
1489
1548
  })]
1490
1549
  }, e.id) : null)
1491
1550
  });
1492
1551
  }
1493
- function Ft({ speaker: e, entries: t, questions: n, docked: r }) {
1494
- let i = wt(t[0]), a = i.length ? new Set(i.map((e) => e.id)) : void 0, [o, s] = F(!1);
1495
- return /* @__PURE__ */ L("div", {
1552
+ function Bt({ speaker: e, entries: t, questions: n, docked: r }) {
1553
+ let i = kt(t[0]), a = i.length ? new Set(i.map((e) => e.id)) : void 0, [o, s] = F(!1);
1554
+ return /* @__PURE__ */ R("div", {
1496
1555
  className: "flex items-start gap-2 pt-1.5",
1497
- children: [/* @__PURE__ */ I("span", {
1498
- className: `flex shrink-0 justify-center pt-px ${Ct}`,
1499
- children: /* @__PURE__ */ I(St, { author: e })
1500
- }), /* @__PURE__ */ L("div", {
1556
+ children: [/* @__PURE__ */ L("span", {
1557
+ className: `flex shrink-0 justify-center pt-px ${Ot}`,
1558
+ children: /* @__PURE__ */ L(Dt, { author: e })
1559
+ }), /* @__PURE__ */ R("div", {
1501
1560
  className: "min-w-0 flex-1",
1502
1561
  children: [
1503
- /* @__PURE__ */ L("div", {
1562
+ /* @__PURE__ */ R("div", {
1504
1563
  className: "flex min-w-0 flex-wrap items-center gap-x-2 pb-0.5",
1505
- children: [/* @__PURE__ */ I("span", {
1564
+ children: [/* @__PURE__ */ L("span", {
1506
1565
  className: "truncate text-xs font-medium text-foreground",
1507
1566
  children: e.name
1508
- }), i.length > 0 && /* @__PURE__ */ I(Tt, {
1567
+ }), i.length > 0 && /* @__PURE__ */ L(At, {
1509
1568
  parts: i,
1510
1569
  open: o,
1511
1570
  onToggle: () => s((e) => !e)
1512
1571
  })]
1513
1572
  }),
1514
- o && i.length > 0 && /* @__PURE__ */ I(Pt, { parts: i }),
1515
- /* @__PURE__ */ I("ul", {
1573
+ o && i.length > 0 && /* @__PURE__ */ L(zt, { parts: i }),
1574
+ /* @__PURE__ */ L("ul", {
1516
1575
  className: "space-y-0.5",
1517
- children: t.map((e, t) => /* @__PURE__ */ I(Nt, {
1576
+ children: t.map((e, t) => /* @__PURE__ */ L(Rt, {
1518
1577
  entry: e,
1519
1578
  questions: n,
1520
1579
  hiddenPartId: r?.entry.id === e.id ? r.part.id : void 0,
@@ -1525,7 +1584,7 @@ function Ft({ speaker: e, entries: t, questions: n, docked: r }) {
1525
1584
  })]
1526
1585
  });
1527
1586
  }
1528
- function It({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i, speaker: a, showAuthors: o, events: s }) {
1587
+ function Vt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i, speaker: a, showAuthors: o, events: s }) {
1529
1588
  if (e.length === 0 && !s?.length) return null;
1530
1589
  let c = o ?? (!!a || e.some((e) => e.kind === "user" && e.author)), l = [];
1531
1590
  for (let t of e) t.kind === "user" || l.length === 0 ? l.push(t.kind === "user" ? {
@@ -1533,80 +1592,80 @@ function It({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, mes
1533
1592
  entries: []
1534
1593
  } : { entries: [t] }) : l[l.length - 1].entries.push(t);
1535
1594
  let u = rt(l.map((e) => (e.user ?? e.entries[0])?.at), s ?? []);
1536
- return /* @__PURE__ */ L("ul", {
1595
+ return /* @__PURE__ */ R("ul", {
1537
1596
  className: "space-y-0.5",
1538
- children: [l.map((e, o) => /* @__PURE__ */ L(ee.Fragment, { children: [u[o].map((e) => /* @__PURE__ */ I(ft, { event: e }, e.id)), /* @__PURE__ */ L("li", { children: [e.user && /* @__PURE__ */ I(Et, {
1597
+ children: [l.map((e, o) => /* @__PURE__ */ R(O.Fragment, { children: [u[o].map((e) => /* @__PURE__ */ L(gt, { event: e }, e.id)), /* @__PURE__ */ R("li", { children: [e.user && /* @__PURE__ */ L(jt, {
1539
1598
  entry: e.user,
1540
1599
  pinned: r,
1541
1600
  actions: i,
1542
- cut: xt(e.entries),
1601
+ cut: Tt(e.entries),
1543
1602
  showAuthor: c
1544
- }), a && e.entries.length > 0 ? /* @__PURE__ */ I(Ft, {
1603
+ }), a && e.entries.length > 0 ? /* @__PURE__ */ L(Bt, {
1545
1604
  speaker: a,
1546
1605
  entries: e.entries,
1547
1606
  questions: t,
1548
1607
  docked: n
1549
- }) : e.entries.length > 0 && /* @__PURE__ */ I("ul", {
1608
+ }) : e.entries.length > 0 && /* @__PURE__ */ L("ul", {
1550
1609
  className: "space-y-0.5",
1551
- children: e.entries.map((e) => /* @__PURE__ */ I(Nt, {
1610
+ children: e.entries.map((e) => /* @__PURE__ */ L(Rt, {
1552
1611
  entry: e,
1553
1612
  questions: t,
1554
1613
  hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
1555
1614
  }, e.id))
1556
- })] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */ I(ft, { event: e }, e.id))]
1615
+ })] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */ L(gt, { event: e }, e.id))]
1557
1616
  });
1558
1617
  }
1559
1618
  //#endregion
1560
1619
  //#region src/presentation/panelWidth.ts
1561
- var Lt = 420, Rt = 320, zt = "60vw", Bt = "agentico:panel-width";
1562
- function Vt(e, t) {
1620
+ var Ht = 420, Ut = 320, Wt = "60vw", Gt = "agentico:panel-width";
1621
+ function Kt(e, t) {
1563
1622
  if (typeof e == "number") return e;
1564
1623
  let n = Number.parseFloat(e);
1565
1624
  return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1566
1625
  }
1567
- function Ht(e, t, n) {
1626
+ function qt(e, t, n) {
1568
1627
  return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1569
1628
  }
1570
- function Ut() {
1629
+ function Jt() {
1571
1630
  try {
1572
- let e = window.localStorage.getItem(Bt), t = e === null ? NaN : Number(e);
1631
+ let e = window.localStorage.getItem(Gt), t = e === null ? NaN : Number(e);
1573
1632
  return Number.isFinite(t) && t > 0 ? t : null;
1574
1633
  } catch {
1575
1634
  return null;
1576
1635
  }
1577
1636
  }
1578
- function Wt(e) {
1637
+ function Yt(e) {
1579
1638
  try {
1580
- e === null ? window.localStorage.removeItem(Bt) : window.localStorage.setItem(Bt, String(e));
1639
+ e === null ? window.localStorage.removeItem(Gt) : window.localStorage.setItem(Gt, String(e));
1581
1640
  } catch {}
1582
1641
  }
1583
- function Gt() {
1642
+ function Xt() {
1584
1643
  return typeof window > "u" ? Infinity : window.innerWidth;
1585
1644
  }
1586
- function Kt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = zt, onWidthChange: r }) {
1587
- let [i, a] = F(Gt), [o, s] = F(() => Ut() ?? e);
1645
+ function Zt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = Wt, onWidthChange: r }) {
1646
+ let [i, a] = F(Xt), [o, s] = F(() => Jt() ?? e);
1588
1647
  j(() => {
1589
1648
  if (typeof window > "u") return;
1590
1649
  let e = () => a(window.innerWidth);
1591
1650
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1592
1651
  }, []);
1593
- let c = t, l = Math.max(c, Vt(n, i)), u = Ht(o, c, l);
1652
+ let c = t, l = Math.max(c, Kt(n, i)), u = qt(o, c, l);
1594
1653
  return j(() => {
1595
1654
  r?.(u);
1596
1655
  }, [u]), {
1597
1656
  width: u,
1598
1657
  min: c,
1599
1658
  max: l,
1600
- set: k((e) => s(Ht(e, c, l)), [c, l]),
1601
- commit: k((e) => Wt(Ht(e, c, l)), [c, l]),
1659
+ set: k((e) => s(qt(e, c, l)), [c, l]),
1660
+ commit: k((e) => Yt(qt(e, c, l)), [c, l]),
1602
1661
  reset: k(() => {
1603
- s(e), Wt(null);
1662
+ s(e), Yt(null);
1604
1663
  }, [e])
1605
1664
  };
1606
1665
  }
1607
1666
  //#endregion
1608
1667
  //#region src/presentation/AgenticoResizeHandle.tsx
1609
- function qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1668
+ function Qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1610
1669
  let o = $(), s = P(null), [c, l] = F(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
1611
1670
  let t = s.current;
1612
1671
  if (t && t.pointerId === e.pointerId) {
@@ -1617,7 +1676,7 @@ function qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1617
1676
  i(t.last);
1618
1677
  }
1619
1678
  };
1620
- return /* @__PURE__ */ I("div", {
1679
+ return /* @__PURE__ */ L("div", {
1621
1680
  role: "separator",
1622
1681
  "aria-orientation": "vertical",
1623
1682
  "aria-label": o.resizePanel,
@@ -1656,7 +1715,7 @@ function qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1656
1715
  let c = u(s);
1657
1716
  r(c), i(c);
1658
1717
  },
1659
- children: /* @__PURE__ */ I("span", {
1718
+ children: /* @__PURE__ */ L("span", {
1660
1719
  "aria-hidden": !0,
1661
1720
  className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
1662
1721
  })
@@ -1664,9 +1723,9 @@ function qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1664
1723
  }
1665
1724
  //#endregion
1666
1725
  //#region src/presentation/AgenticoToggle.tsx
1667
- function Jt({ className: e = "" }) {
1668
- let { isOpen: n, toggleOpen: r, task: i } = ct(), a = $(), o = i?.agent.running ?? !1;
1669
- return /* @__PURE__ */ I(t, {
1726
+ function $t({ className: e = "" }) {
1727
+ let { isOpen: n, toggleOpen: r, task: i } = ft(), a = $(), o = i?.agent.running ?? !1;
1728
+ return /* @__PURE__ */ L(t, {
1670
1729
  icon: "bot",
1671
1730
  ariaLabel: n ? a.closePanel : a.openPanel,
1672
1731
  title: n ? a.closePanel : a.openPanel,
@@ -1677,21 +1736,21 @@ function Jt({ className: e = "" }) {
1677
1736
  }
1678
1737
  //#endregion
1679
1738
  //#region src/presentation/useAIModelCatalog.ts
1680
- var Yt = "llmnative-cms.selectedAIModel";
1681
- function Xt() {
1739
+ var en = "llmnative-cms.selectedAIModel";
1740
+ function tn() {
1682
1741
  try {
1683
- return localStorage.getItem(Yt) ?? "";
1742
+ return localStorage.getItem(en) ?? "";
1684
1743
  } catch {
1685
1744
  return "";
1686
1745
  }
1687
1746
  }
1688
- function Zt(e) {
1747
+ function nn(e) {
1689
1748
  try {
1690
- e ? localStorage.setItem(Yt, e) : localStorage.removeItem(Yt);
1749
+ e ? localStorage.setItem(en, e) : localStorage.removeItem(en);
1691
1750
  } catch {}
1692
1751
  }
1693
- function Qt() {
1694
- let e = T()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = F({}), [i, a] = F(!1), [o, s] = F(Xt);
1752
+ function rn() {
1753
+ let e = T()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = F({}), [i, a] = F(!1), [o, s] = F(tn);
1695
1754
  return j(() => {
1696
1755
  if (!t) {
1697
1756
  r({});
@@ -1702,7 +1761,7 @@ function Qt() {
1702
1761
  if (n) return;
1703
1762
  r(e.modelsByProvider);
1704
1763
  let t = Object.values(e.modelsByProvider).flat();
1705
- s((e) => t.some((t) => t.id === e) ? e : (Zt(""), ""));
1764
+ s((e) => t.some((t) => t.id === e) ? e : (nn(""), ""));
1706
1765
  }).catch((e) => {
1707
1766
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
1708
1767
  }).finally(() => {
@@ -1716,17 +1775,17 @@ function Qt() {
1716
1775
  modelsLoading: i,
1717
1776
  selectedModel: o,
1718
1777
  setSelectedModel: (e) => {
1719
- Zt(e), s(e);
1778
+ nn(e), s(e);
1720
1779
  }
1721
1780
  };
1722
1781
  }
1723
1782
  //#endregion
1724
1783
  //#region src/domain/approval.ts
1725
- var $t = "approval";
1726
- function en(e, t) {
1784
+ var an = "approval";
1785
+ function on(e, t) {
1727
1786
  return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1728
1787
  }
1729
- function tn(e, t, n) {
1788
+ function sn(e, t, n) {
1730
1789
  let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1731
1790
  return {
1732
1791
  approved: r.includes(t) && !r.includes(n),
@@ -1735,11 +1794,11 @@ function tn(e, t, n) {
1735
1794
  }
1736
1795
  //#endregion
1737
1796
  //#region src/presentation/useAgent.ts
1738
- var nn = 20, rn = 26e4;
1739
- function an(e) {
1740
- return e.filter((e) => !y.isTextAttachment(e.mimeType) || e.base64.length <= rn);
1797
+ var cn = 20, ln = 26e4;
1798
+ function un(e) {
1799
+ return e.filter((e) => !y.isTextAttachment(e.mimeType) || e.base64.length <= ln);
1741
1800
  }
1742
- function on(e) {
1801
+ function dn(e) {
1743
1802
  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 : {
1744
1803
  ...e,
1745
1804
  status: e.status === "running" ? "stopped" : e.status,
@@ -1752,10 +1811,10 @@ function on(e) {
1752
1811
  } : e) } : {}
1753
1812
  });
1754
1813
  }
1755
- function sn(e, t = {}) {
1814
+ function fn(e, t = {}) {
1756
1815
  let { defaultEnabled: n = !1 } = t, r = P(t.author);
1757
1816
  r.current = t.author;
1758
- let [i, a] = F(n), { hasProviders: o, modelsByProvider: s, modelsLoading: c, selectedModel: l, setSelectedModel: u } = Qt(), [d, f] = F(!1), [p, m] = F(null), [h, g] = F(!1), [_, v] = F([]), b = P([]), x = (e, t) => {
1817
+ let [i, a] = F(n), { hasProviders: o, modelsByProvider: s, modelsLoading: c, selectedModel: l, setSelectedModel: u } = rn(), [d, f] = F(!1), [p, m] = F(null), [h, g] = F(!1), [_, v] = F([]), b = P([]), x = (e, t) => {
1759
1818
  v((n) => {
1760
1819
  let r = typeof e == "function" ? e(n) : e;
1761
1820
  if (t?.stamp !== !1) {
@@ -1770,29 +1829,36 @@ function sn(e, t = {}) {
1770
1829
  }
1771
1830
  return b.current = r, r;
1772
1831
  });
1773
- }, S = P(/* @__PURE__ */ new Map()), w = $(), E = P(w);
1774
- E.current = w;
1775
- let D = P(null), O = P(!1), ee = P(null), te = P(null), k = P(null), A = () => {
1776
- k.current?.abort();
1777
- }, j = T()?.registry ?? {}, [M, ne] = F(void 0), I = P(void 0), L = (e, t) => {
1832
+ }, S = (e, t) => {
1833
+ t?.some((e) => e.type.startsWith("image/")) && st(t).then((t) => {
1834
+ t.length && x((n) => n.map((n) => n.id === e ? {
1835
+ ...n,
1836
+ attachmentPreviews: t
1837
+ } : n));
1838
+ });
1839
+ }, w = P(/* @__PURE__ */ new Map()), ee = $(), E = P(ee);
1840
+ E.current = ee;
1841
+ let D = P(null), O = P(!1), te = P(null), k = P(null), A = P(null), j = () => {
1842
+ A.current?.abort();
1843
+ }, M = T()?.registry ?? {}, [I, L] = F(void 0), R = P(void 0), z = (e, t) => {
1778
1844
  if (!t) return !1;
1779
1845
  if (!e) return !0;
1780
1846
  let n = C(t);
1781
1847
  return !!n && e.includes(n.provider);
1782
- }, z = N(() => M ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, t.filter((e) => M.includes(e.provider))]).filter(([, e]) => e.length)) : s, [M, s]), re = L(M, l) ? l : Object.values(z).flat()[0]?.id ?? "", U = i && re ? C(re) : null, W = U ? j[U.provider] : null, G = e.executor, K = !!G?.alongside, q = !!G && !K, ie = !G || !!G.canRewind, ae = !!G?.attachments, se = async (e) => ae && e?.length ? Promise.all(e.map((e) => y.fileToAttachment(e))) : void 0, ce = P([]), le = (e) => !!e && ce.current.some((t) => t.value === e), ue = P(!1), [de, fe] = F([]), [pe, me] = F(""), Y = P(""), X = (e) => {
1783
- Y.current = e, me(e);
1784
- }, he = (e) => {
1785
- let t = G?.models?.(e) ?? [];
1786
- ce.current = t, fe(t);
1787
- let n = G?.catalogProviders?.(e);
1788
- I.current = n, ne(n);
1789
- let r = K && !L(n, l) ? t[0]?.value : void 0;
1790
- X(G?.defaultModel?.(e) ?? r ?? "");
1791
- }, ge = async (e, t, n, r, i) => {
1848
+ }, ie = N(() => I ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, t.filter((e) => I.includes(e.provider))]).filter(([, e]) => e.length)) : s, [I, s]), H = z(I, l) ? l : Object.values(ie).flat()[0]?.id ?? "", U = i && H ? C(H) : null, ae = U ? M[U.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, oe = !W || !!W.canRewind, ce = !!W?.attachments, le = async (e) => ce && e?.length ? Promise.all(e.map((e) => y.fileToAttachment(e))) : void 0, ue = P([]), de = (e) => !!e && ue.current.some((t) => t.value === e), q = P(!1), [fe, pe] = F([]), [me, he] = F(""), Y = P(""), ge = (e) => {
1849
+ Y.current = e, he(e);
1850
+ }, _e = (e) => {
1851
+ let t = W?.models?.(e) ?? [];
1852
+ ue.current = t, pe(t);
1853
+ let n = W?.catalogProviders?.(e);
1854
+ R.current = n, L(n);
1855
+ let r = G && !z(n, l) ? t[0]?.value : void 0;
1856
+ ge(W?.defaultModel?.(e) ?? r ?? "");
1857
+ }, X = async (e, t, n, r, i) => {
1792
1858
  let a = D.current;
1793
- if (!a || !G) return m(E.current.noActiveSession), null;
1859
+ if (!a || !W) return m(E.current.noActiveSession), null;
1794
1860
  let o = new AbortController();
1795
- k.current = o;
1861
+ A.current = o;
1796
1862
  let s = crypto.randomUUID();
1797
1863
  x((e) => [...e, {
1798
1864
  id: s,
@@ -1838,17 +1904,17 @@ function sn(e, t = {}) {
1838
1904
  }), v = (e) => f({
1839
1905
  ...e,
1840
1906
  type: "card"
1841
- }), y = /* @__PURE__ */ new Set(), C = 0, w = () => {
1907
+ }), y = /* @__PURE__ */ new Set(), S = 0, C = () => {
1842
1908
  for (let e of y) {
1843
- let t = S.current.get(e);
1844
- S.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
1909
+ let t = w.current.get(e);
1910
+ w.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
1845
1911
  }
1846
1912
  y.clear();
1847
1913
  };
1848
- o.signal.addEventListener("abort", w);
1914
+ o.signal.addEventListener("abort", C);
1849
1915
  let T = (e, t) => {
1850
- C += 1;
1851
- let n = t?.id ?? `questions-${C}`;
1916
+ S += 1;
1917
+ let n = t?.id ?? `questions-${S}`;
1852
1918
  f({
1853
1919
  type: "questions",
1854
1920
  id: n,
@@ -1856,15 +1922,15 @@ function sn(e, t = {}) {
1856
1922
  });
1857
1923
  let r = `${s}:${n}`;
1858
1924
  return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (y.add(r), new Promise((e, t) => {
1859
- S.current.set(r, {
1925
+ w.current.set(r, {
1860
1926
  resolve: e,
1861
1927
  reject: t
1862
1928
  });
1863
1929
  }));
1864
- }, O = (e, t) => {
1930
+ }, ee = (e, t) => {
1865
1931
  d((n) => (t && !p ? B(n, {
1866
1932
  type: "text",
1867
- id: R,
1933
+ id: ne,
1868
1934
  text: t,
1869
1935
  streaming: !1
1870
1936
  }, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
@@ -1873,14 +1939,14 @@ function sn(e, t = {}) {
1873
1939
  } : t.type === "tool" && t.status === "running" && e !== "done" ? {
1874
1940
  ...t,
1875
1941
  status: "stopped"
1876
- } : t), e), o.signal.removeEventListener("abort", w);
1877
- for (let e of y) S.current.delete(e);
1942
+ } : t), e), o.signal.removeEventListener("abort", C);
1943
+ for (let e of y) w.current.delete(e);
1878
1944
  y.clear();
1879
- }, A = e || r?.historyText || "";
1945
+ }, O = e || r?.historyText || "";
1880
1946
  try {
1881
- let c = ee.current;
1882
- ee.current = null;
1883
- let l = b.current, u = l.findIndex((e) => e.id === te.current), d = c ? { activity: c.fresh ? c.activity : (u >= 0 ? l.slice(0, u) : l).filter((e) => e.id !== s) } : void 0, f = await G.turn({
1947
+ let c = te.current;
1948
+ te.current = null;
1949
+ let l = b.current, u = l.findIndex((e) => e.id === k.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({
1884
1950
  params: a.params,
1885
1951
  context: a.context,
1886
1952
  text: e,
@@ -1899,11 +1965,11 @@ function sn(e, t = {}) {
1899
1965
  onQuestions: T,
1900
1966
  onCard: v
1901
1967
  });
1902
- return O("done", f.text), a.history = [
1968
+ return ee("done", f.text), a.history = [
1903
1969
  ...a.history,
1904
- ...A ? [{
1970
+ ...O ? [{
1905
1971
  role: "user",
1906
- content: A
1972
+ content: O
1907
1973
  }] : [],
1908
1974
  {
1909
1975
  role: "assistant",
@@ -1911,14 +1977,14 @@ function sn(e, t = {}) {
1911
1977
  }
1912
1978
  ], f.result ?? null;
1913
1979
  } catch (e) {
1914
- return a.history = [...a.history, ...A ? [{
1980
+ return a.history = [...a.history, ...O ? [{
1915
1981
  role: "user",
1916
- content: A
1917
- }] : []], o.signal.aborted ? (O("stopped"), null) : (O("error"), m(be(e)), null);
1982
+ content: O
1983
+ }] : []], o.signal.aborted ? (ee("stopped"), null) : (ee("error"), m(be(e)), null);
1918
1984
  } finally {
1919
- k.current = null;
1985
+ A.current = null;
1920
1986
  }
1921
- }, _e = async (t, n, r) => {
1987
+ }, ve = async (t, n, r) => {
1922
1988
  let i = b.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = D.current;
1923
1989
  if (!i || !a || !e.onCardAction) return;
1924
1990
  let o;
@@ -1937,7 +2003,7 @@ function sn(e, t = {}) {
1937
2003
  outcome: o
1938
2004
  } : e)
1939
2005
  } : e));
1940
- }, ve = async (e, t, n) => {
2006
+ }, xe = async (e, t, n) => {
1941
2007
  let r = b.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1942
2008
  if (!r || r.type !== "questions") throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
1943
2009
  let i = () => x((r) => r.map((r) => r.id === e ? {
@@ -1946,30 +2012,30 @@ function sn(e, t = {}) {
1946
2012
  ...e,
1947
2013
  answers: n
1948
2014
  } : e)
1949
- } : r)), a = `${e}:${t}`, o = S.current.get(a);
1950
- if (o) return S.current.delete(a), i(), o.resolve(n), null;
2015
+ } : r)), a = `${e}:${t}`, o = w.current.get(a);
2016
+ if (o) return w.current.delete(a), i(), o.resolve(n), null;
1951
2017
  if (O.current) throw m(E.current.requestInProgress), Error(E.current.requestInProgress);
1952
- if (!q || !D.current) throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
2018
+ if (!K || !D.current) throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
1953
2019
  O.current = !0, f(!0), m(null), i();
1954
2020
  try {
1955
- return await ge("", !1, void 0, {
2021
+ return await X("", !1, void 0, {
1956
2022
  id: t,
1957
2023
  answers: n,
1958
- historyText: H(r.questions, n)
2024
+ historyText: re(r.questions, n)
1959
2025
  });
1960
2026
  } finally {
1961
2027
  O.current = !1, f(!1);
1962
2028
  }
1963
- }, xe = async (t, n, r) => {
1964
- let i = I.current, a = Object.values(s).flat().find((e) => !i || i.includes(e.provider))?.id, o = r && L(i, r) ? r : L(i, re) ? void 0 : a, c = o ? C(o) : U, l = c && D.current ? G?.catalogReasoning?.(D.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = D.current;
2029
+ }, Se = async (t, n, r) => {
2030
+ let i = R.current, a = Object.values(s).flat().find((e) => !i || i.includes(e.provider))?.id, o = r && z(i, r) ? r : z(i, H) ? void 0 : a, c = o ? C(o) : U, l = c && D.current ? W?.catalogReasoning?.(D.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = D.current;
1965
2031
  if (!d) return m(E.current.noActiveSession), null;
1966
- let f = o ? C(o) : U, p = f ? j[f.provider] : null;
2032
+ let f = o ? C(o) : U, p = f ? M[f.provider] : null;
1967
2033
  if (!p || !f) return m(E.current.noProviderAvailable), null;
1968
2034
  n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
1969
- let h = (n ?? []).filter((e) => y.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= rn ? `\n\n[File allegato: ${e.name}]\n${y.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 = an(n ?? []), _ = d.tools.map((e) => ({
2035
+ let h = (n ?? []).filter((e) => y.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= ln ? `\n\n[File allegato: ${e.name}]\n${y.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 = un(n ?? []), _ = d.tools.map((e) => ({
1970
2036
  name: e.name,
1971
2037
  description: e.description,
1972
- inputSchema: oe(e.inputSchema)
2038
+ inputSchema: se(e.inputSchema)
1973
2039
  })), v = (e, t, n, r) => {
1974
2040
  let i = E.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1975
2041
  x((e) => [...e, {
@@ -1979,7 +2045,7 @@ function sn(e, t = {}) {
1979
2045
  status: "running",
1980
2046
  parts: [{
1981
2047
  type: "questions",
1982
- id: $t,
2048
+ id: an,
1983
2049
  questions: [{
1984
2050
  header: i.approvalHeader,
1985
2051
  question: i.approveQuestion.replace("{action}", o),
@@ -1988,24 +2054,24 @@ function sn(e, t = {}) {
1988
2054
  }]
1989
2055
  }]
1990
2056
  }]);
1991
- let s = `${a}:${$t}`;
2057
+ let s = `${a}:${an}`;
1992
2058
  return new Promise((e, t) => {
1993
2059
  let n = () => {
1994
- S.current.delete(s), T(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
2060
+ w.current.delete(s), T(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1995
2061
  };
1996
2062
  if (r.aborted) {
1997
2063
  n();
1998
2064
  return;
1999
2065
  }
2000
- r.addEventListener("abort", n, { once: !0 }), S.current.set(s, {
2066
+ r.addEventListener("abort", n, { once: !0 }), w.current.set(s, {
2001
2067
  resolve: (t) => {
2002
- r.removeEventListener("abort", n), T(a, "done"), e(tn(t, i.approve, i.reject));
2068
+ r.removeEventListener("abort", n), T(a, "done"), e(sn(t, i.approve, i.reject));
2003
2069
  },
2004
2070
  reject: t
2005
2071
  });
2006
2072
  });
2007
- }, b = new Map(d.tools.map((e) => [e.name, e])), w = new AbortController();
2008
- k.current = w;
2073
+ }, b = new Map(d.tools.map((e) => [e.name, e])), S = new AbortController();
2074
+ A.current = S;
2009
2075
  let T = (e, t, n, r) => x((i) => i.map((i) => i.id === e ? {
2010
2076
  ...i,
2011
2077
  status: t,
@@ -2014,7 +2080,7 @@ function sn(e, t = {}) {
2014
2080
  } : i));
2015
2081
  try {
2016
2082
  let n = d.history, r = t;
2017
- for (let t = 0; t < nn; t++) {
2083
+ for (let t = 0; t < cn; t++) {
2018
2084
  let i = crypto.randomUUID();
2019
2085
  x((e) => [...e, {
2020
2086
  id: i,
@@ -2030,7 +2096,7 @@ function sn(e, t = {}) {
2030
2096
  ...u,
2031
2097
  history: n,
2032
2098
  tools: _.length ? _ : void 0,
2033
- signal: w.signal,
2099
+ signal: S.signal,
2034
2100
  attachments: t === 0 ? g : void 0,
2035
2101
  logId: d.logId
2036
2102
  });
@@ -2038,12 +2104,12 @@ function sn(e, t = {}) {
2038
2104
  return d.history = [...n, ...r ? [{
2039
2105
  role: "user",
2040
2106
  content: r + h
2041
- }] : []], w.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(be(t)), null);
2107
+ }] : []], S.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(be(t)), null);
2042
2108
  }
2043
2109
  if (d.history = [...n, ...r ? [{
2044
2110
  role: "user",
2045
2111
  content: r + h
2046
- }] : []], !a) return w.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(E.current.noProviderResponse), null);
2112
+ }] : []], !a) return S.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(E.current.noProviderResponse), null);
2047
2113
  if (a.type === "text") return T(i, "done", a.text), e.conversational && a.text.trim() && x((e) => e.map((e) => e.id === i ? {
2048
2114
  ...e,
2049
2115
  parts: [{
@@ -2074,8 +2140,8 @@ function sn(e, t = {}) {
2074
2140
  let s = /* @__PURE__ */ new Map();
2075
2141
  for (let t of a.toolCalls) {
2076
2142
  let n = b.get(t.name);
2077
- if (n && en(n, t.input)) try {
2078
- s.set(t.id, await v(t.id, n, t.input, w.signal));
2143
+ if (n && on(n, t.input)) try {
2144
+ s.set(t.id, await v(t.id, n, t.input, S.signal));
2079
2145
  } catch {
2080
2146
  return e.fallback(d.params, d.context);
2081
2147
  }
@@ -2166,7 +2232,7 @@ function sn(e, t = {}) {
2166
2232
  prompt: ye(J().stopCallingTools, e.microPromptIds),
2167
2233
  model: f.model,
2168
2234
  history: n,
2169
- signal: w.signal,
2235
+ signal: S.signal,
2170
2236
  logId: d.logId
2171
2237
  });
2172
2238
  } catch {
@@ -2179,15 +2245,17 @@ function sn(e, t = {}) {
2179
2245
  }];
2180
2246
  let t = e.parseResponse(a.text, d.params, d.context);
2181
2247
  if (t) return t;
2182
- } else T(i, w.signal.aborted ? "stopped" : "error"), d.history = n;
2183
- return w.signal.aborted || m(E.current.tooManyToolTurns), e.fallback(d.params, d.context);
2248
+ } else T(i, S.signal.aborted ? "stopped" : "error"), d.history = n;
2249
+ return S.signal.aborted || m(E.current.tooManyToolTurns), e.fallback(d.params, d.context);
2184
2250
  } finally {
2185
- k.current = null;
2251
+ A.current = null;
2186
2252
  }
2187
- }, Se = async (t, n) => {
2253
+ }, Ce = async (t, n) => {
2188
2254
  if (O.current) return m(E.current.requestInProgress), null;
2189
- O.current = !0, m(null), x(n?.openingMessage ? [{
2190
- id: crypto.randomUUID(),
2255
+ O.current = !0, m(null);
2256
+ let a = crypto.randomUUID();
2257
+ n?.openingMessage && S(a, n.attachments), x(n?.openingMessage ? [{
2258
+ id: a,
2191
2259
  kind: "user",
2192
2260
  label: "Tu",
2193
2261
  status: "done",
@@ -2204,13 +2272,13 @@ function sn(e, t = {}) {
2204
2272
  history: [],
2205
2273
  logId: crypto.randomUUID(),
2206
2274
  attachmentsRef: a
2207
- }, q) return g(!0), he(t), await ge(n?.openingMessage ?? "", !0, void 0, void 0, await se(n?.attachments));
2208
- if (K) {
2209
- he(t), ue.current = !1;
2275
+ }, K) return g(!0), _e(t), await X(n?.openingMessage ?? "", !0, void 0, void 0, await le(n?.attachments));
2276
+ if (G) {
2277
+ _e(t), q.current = !1;
2210
2278
  let e = n?.model || Y.current;
2211
- if (le(e)) return g(!0), ue.current = !0, await ge(n?.openingMessage ?? "", !0, e, void 0, await se(n?.attachments));
2279
+ if (de(e)) return g(!0), q.current = !0, await X(n?.openingMessage ?? "", !0, e, void 0, await le(n?.attachments));
2212
2280
  }
2213
- let s = n?.model || void 0, c = s ? !!j[C(s)?.provider ?? ""] : !!W;
2281
+ let s = n?.model || void 0, c = s ? !!M[C(s)?.provider ?? ""] : !!ae;
2214
2282
  if (!i || !c) {
2215
2283
  g(!1);
2216
2284
  let n = e.fallback(t, r);
@@ -2223,18 +2291,18 @@ function sn(e, t = {}) {
2223
2291
  }
2224
2292
  g(!0);
2225
2293
  let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, u = ye(e.buildPrompt(t, r), e.microPromptIds);
2226
- return await xe(u, l, s);
2294
+ return await Se(u, l, s);
2227
2295
  } catch (e) {
2228
2296
  return m(be(e)), null;
2229
2297
  } finally {
2230
2298
  O.current = !1, f(!1);
2231
2299
  }
2232
- }, Ce = async (t, n) => {
2300
+ }, we = async (t, n) => {
2233
2301
  if (O.current) {
2234
2302
  m(E.current.requestInProgress);
2235
2303
  return;
2236
2304
  }
2237
- O.current = !0, m(null), x(on(n.activity), { stamp: !1 }), f(!0);
2305
+ O.current = !0, m(null), x(dn(n.activity), { stamp: !1 }), f(!0);
2238
2306
  try {
2239
2307
  let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
2240
2308
  D.current = {
@@ -2244,20 +2312,20 @@ function sn(e, t = {}) {
2244
2312
  history: n.history,
2245
2313
  logId: crypto.randomUUID(),
2246
2314
  attachmentsRef: a
2247
- }, (q || K) && he(t), ue.current = !1, g(q || K || i && !!W);
2315
+ }, (K || G) && _e(t), q.current = !1, g(K || G || i && !!ae);
2248
2316
  } catch (e) {
2249
2317
  m(be(e));
2250
2318
  } finally {
2251
2319
  O.current = !1, f(!1);
2252
2320
  }
2253
- }, we = async (t, n) => {
2321
+ }, Te = async (t, n) => {
2254
2322
  if (O.current) return m(E.current.requestInProgress), null;
2255
2323
  if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
2256
2324
  let i = D.current;
2257
2325
  if (!i) return m(E.current.noActiveSession), null;
2258
2326
  O.current = !0, f(!0);
2259
2327
  let a = crypto.randomUUID();
2260
- te.current = a, x((e) => [...e, {
2328
+ k.current = a, S(a, n?.attachments), x((e) => [...e, {
2261
2329
  id: a,
2262
2330
  kind: "user",
2263
2331
  label: "Tu",
@@ -2269,26 +2337,26 @@ function sn(e, t = {}) {
2269
2337
  historyAt: i.history.length
2270
2338
  }]);
2271
2339
  try {
2272
- if (q) return await ge(t, !1, n?.model || void 0, void 0, await se(n?.attachments));
2273
- let r = n?.model || (K ? Y.current : "");
2274
- if (K && le(r)) {
2275
- let e = !ue.current;
2276
- return ue.current = !0, await ge(t, e, r, void 0, await se(n?.attachments));
2340
+ if (K) return await X(t, !1, n?.model || void 0, void 0, await le(n?.attachments));
2341
+ let r = n?.model || (G ? Y.current : "");
2342
+ if (G && de(r)) {
2343
+ let e = !q.current;
2344
+ return q.current = !0, await X(t, e, r, void 0, await le(n?.attachments));
2277
2345
  }
2278
- ee.current &&= {
2279
- ...ee.current,
2346
+ te.current &&= {
2347
+ ...te.current,
2280
2348
  fresh: !1
2281
2349
  };
2282
2350
  let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, o = ye(e.buildFollowUpPrompt(t, i.params, i.context), e.microPromptIds);
2283
- return await xe(o, a, n?.model || void 0);
2351
+ return await Se(o, a, n?.model || void 0);
2284
2352
  } catch (e) {
2285
2353
  return m(be(e)), null;
2286
2354
  } finally {
2287
2355
  O.current = !1, f(!1);
2288
2356
  }
2289
- }, Te = (e) => {
2357
+ }, Ee = (e) => {
2290
2358
  let t = D.current, n = _.findIndex((t) => t.id === e), r = _[n], i = r?.detail?.trim();
2291
- if (!ie || !t || !r || r.kind !== "user" || !i) return;
2359
+ if (!oe || !t || !r || r.kind !== "user" || !i) return;
2292
2360
  if (r.historyAt !== void 0) return r.historyAt;
2293
2361
  let a = _.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
2294
2362
  for (let e = 0; e < t.history.length; e += 1) {
@@ -2299,18 +2367,18 @@ function sn(e, t = {}) {
2299
2367
  }
2300
2368
  }
2301
2369
  return n === _.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
2302
- }, Ee = (e) => Te(e) !== void 0, De = async (e, t) => {
2370
+ }, De = (e) => Ee(e) !== void 0, Oe = async (e, t) => {
2303
2371
  if (O.current) return m(E.current.requestInProgress), null;
2304
- let n = D.current, r = _.findIndex((t) => t.id === e), i = _[r], a = Te(e);
2372
+ let n = D.current, r = _.findIndex((t) => t.id === e), i = _[r], a = Ee(e);
2305
2373
  if (!n || !i || a === void 0) return null;
2306
2374
  let o = (t ?? i.detail ?? "").trim();
2307
2375
  if (!o) return null;
2308
2376
  let s = _.slice(0, r);
2309
- return n.history = n.history.slice(0, a), ee.current = {
2377
+ return n.history = n.history.slice(0, a), te.current = {
2310
2378
  activity: s,
2311
2379
  fresh: !0
2312
- }, x(s), we(o);
2313
- }, Oe = () => {
2380
+ }, x(s), Te(o);
2381
+ }, ke = () => {
2314
2382
  let t = D.current;
2315
2383
  if (!t) return null;
2316
2384
  m(null);
@@ -2321,7 +2389,7 @@ function sn(e, t = {}) {
2321
2389
  status: "done",
2322
2390
  label: e.describeFallback?.(n) ?? E.current.continueWithoutAiFallback
2323
2391
  }]), n;
2324
- }, ke = () => D.current ? {
2392
+ }, Ae = () => D.current ? {
2325
2393
  history: D.current.history,
2326
2394
  activity: _
2327
2395
  } : null;
@@ -2329,54 +2397,54 @@ function sn(e, t = {}) {
2329
2397
  enabled: i,
2330
2398
  setEnabled: a,
2331
2399
  hasProviders: o,
2332
- selectedModel: q || K && pe ? pe : re,
2333
- setSelectedModel: q ? X : K ? (e) => {
2334
- le(e) ? X(e) : (X(""), u(e));
2400
+ selectedModel: K || G && me ? me : H,
2401
+ setSelectedModel: K ? ge : G ? (e) => {
2402
+ de(e) ? ge(e) : (ge(""), u(e));
2335
2403
  } : u,
2336
- modelsByProvider: z,
2404
+ modelsByProvider: ie,
2337
2405
  modelsLoading: c,
2338
2406
  running: d,
2339
2407
  error: p,
2340
2408
  canContinue: h,
2341
- remote: q,
2342
- remoteModels: de,
2343
- alongside: K,
2344
- ...G?.catalogGroup ? { catalogGroup: G.catalogGroup } : {},
2409
+ remote: K,
2410
+ remoteModels: fe,
2411
+ alongside: G,
2412
+ ...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
2345
2413
  activity: _,
2346
- run: Se,
2347
- resume: Ce,
2348
- sendMessage: we,
2349
- stop: A,
2350
- runFallback: Oe,
2351
- snapshot: ke,
2352
- answerQuestions: ve,
2353
- cardAction: _e,
2354
- rewind: De,
2355
- canRewind: ie,
2356
- rewindable: Ee,
2357
- executorAttachments: ae,
2414
+ run: Ce,
2415
+ resume: we,
2416
+ sendMessage: Te,
2417
+ stop: j,
2418
+ runFallback: ke,
2419
+ snapshot: Ae,
2420
+ answerQuestions: xe,
2421
+ cardAction: ve,
2422
+ rewind: Oe,
2423
+ canRewind: oe,
2424
+ rewindable: De,
2425
+ executorAttachments: ce,
2358
2426
  offersFallback: e.offersFallback !== !1
2359
2427
  };
2360
2428
  }
2361
2429
  //#endregion
2362
2430
  //#region src/domain/orchestrator/prompt.ts
2363
- function cn() {
2431
+ function pn() {
2364
2432
  let e = J();
2365
2433
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
2366
2434
  }
2367
- function ln(e, t, n) {
2435
+ function mn(e, t, n) {
2368
2436
  let r = J(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
2369
2437
  return `${r.orchestratorIntro}
2370
2438
 
2371
2439
  ${r.toolsHeading}
2372
2440
  ${t}
2373
2441
  ${i}
2374
- ${cn()}
2442
+ ${pn()}
2375
2443
 
2376
2444
  ${r.userRequestHeading}
2377
2445
  ${e}`;
2378
2446
  }
2379
- function un(e, t) {
2447
+ function hn(e, t) {
2380
2448
  return t ? {
2381
2449
  kind: "handoff",
2382
2450
  ...t
@@ -2387,27 +2455,27 @@ function un(e, t) {
2387
2455
  }
2388
2456
  //#endregion
2389
2457
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
2390
- function dn(e) {
2391
- return G().filter((t) => !t.onlyWhenAnchored || e === t.id);
2458
+ function gn(e) {
2459
+ return ae().filter((t) => !t.onlyWhenAnchored || e === t.id);
2392
2460
  }
2393
- function fn(e) {
2461
+ function _n(e) {
2394
2462
  return {
2395
2463
  buildContext(e) {
2396
2464
  return {
2397
- cliCatalog: ge(dn(e.scopedSubagentId)),
2465
+ cliCatalog: _e(gn(e.scopedSubagentId)),
2398
2466
  handoff: { current: null },
2399
2467
  collected: {}
2400
2468
  };
2401
2469
  },
2402
2470
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
2403
- return ln(e, n, t);
2471
+ return mn(e, n, t);
2404
2472
  },
2405
2473
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
2406
- return `${e}\n\n${cn()}\n\n${J().toolsHeading}\n${n}`;
2474
+ return `${e}\n\n${pn()}\n\n${J().toolsHeading}\n${n}`;
2407
2475
  },
2408
2476
  parseResponse(e, t, n) {
2409
2477
  let r = n.handoff.current;
2410
- return n.handoff.current = null, un(e, r);
2478
+ return n.handoff.current = null, hn(e, r);
2411
2479
  },
2412
2480
  fallback() {
2413
2481
  return {
@@ -2419,11 +2487,11 @@ function fn(e) {
2419
2487
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
2420
2488
  },
2421
2489
  getTools(t, n, r) {
2422
- let i = ae({
2490
+ let i = oe({
2423
2491
  attachmentsRef: r,
2424
2492
  collected: n.collected,
2425
2493
  proxyFetch: w
2426
- }), a = t.scopedSubagentId ? K(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = dn(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2494
+ }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = gn(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2427
2495
  name: `${t.id}_${r.name}`,
2428
2496
  description: `${t.label}: ${r.summary}`,
2429
2497
  inputSchema: r.inputSchema,
@@ -2447,13 +2515,13 @@ function fn(e) {
2447
2515
  }
2448
2516
  //#endregion
2449
2517
  //#region src/presentation/deriveHistoryTitle.ts
2450
- function pn(e, t) {
2518
+ function vn(e, t) {
2451
2519
  return e.deriveHistoryTitle?.(t) ?? e.label;
2452
2520
  }
2453
2521
  //#endregion
2454
2522
  //#region src/presentation/ResultDestinationPicker.tsx
2455
- function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2456
- let s = $(), c = ct(), l = c.scope, u = O(), [d, f] = F(null), [p, m] = F(new Set(i ?? [])), [h, g] = F(null), _ = De(), v = /* @__PURE__ */ new Map();
2523
+ function yn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2524
+ let s = $(), c = ft(), l = c.scope, u = D(), [d, f] = F(null), [p, m] = F(new Set(i ?? [])), [h, g] = F(null), _ = De(), v = /* @__PURE__ */ new Map();
2457
2525
  e.destinationIds.forEach((e) => {
2458
2526
  let t = _[e];
2459
2527
  t && v.set(e, t);
@@ -2470,23 +2538,23 @@ function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2470
2538
  storageProvider: l?.storageProvider ?? null,
2471
2539
  proxyFetch: u
2472
2540
  }, n);
2473
- m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, pn(e, n));
2541
+ m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, vn(e, n));
2474
2542
  } catch (e) {
2475
2543
  g(e instanceof Error ? e.message : String(e));
2476
2544
  } finally {
2477
2545
  f(null);
2478
2546
  }
2479
2547
  };
2480
- return /* @__PURE__ */ L("div", {
2548
+ return /* @__PURE__ */ R("div", {
2481
2549
  className: "space-y-2",
2482
2550
  children: [
2483
- /* @__PURE__ */ I("p", {
2551
+ /* @__PURE__ */ L("p", {
2484
2552
  className: "text-xs font-medium text-muted-foreground",
2485
2553
  children: s.destinationPickerTitle
2486
2554
  }),
2487
- /* @__PURE__ */ I("div", {
2555
+ /* @__PURE__ */ L("div", {
2488
2556
  className: "flex flex-wrap gap-2",
2489
- children: y.map((e) => /* @__PURE__ */ I("button", {
2557
+ children: y.map((e) => /* @__PURE__ */ L("button", {
2490
2558
  type: "button",
2491
2559
  disabled: d !== null,
2492
2560
  onClick: () => void b(e.id),
@@ -2494,7 +2562,7 @@ function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2494
2562
  children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
2495
2563
  }, e.id))
2496
2564
  }),
2497
- h && /* @__PURE__ */ I("p", {
2565
+ h && /* @__PURE__ */ L("p", {
2498
2566
  className: "text-xs text-destructive",
2499
2567
  children: h
2500
2568
  })
@@ -2503,33 +2571,33 @@ function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2503
2571
  }
2504
2572
  //#endregion
2505
2573
  //#region src/presentation/reports/subagentReportRegistry.tsx
2506
- var hn = {};
2507
- function gn(e) {
2508
- Object.assign(hn, e);
2574
+ var bn = {};
2575
+ function xn(e) {
2576
+ Object.assign(bn, e);
2509
2577
  }
2510
- function _n(e) {
2511
- return hn[e];
2578
+ function Sn(e) {
2579
+ return bn[e];
2512
2580
  }
2513
2581
  //#endregion
2514
2582
  //#region src/presentation/reports/GenericResultPreview.tsx
2515
- function vn({ result: e }) {
2583
+ function Cn({ result: e }) {
2516
2584
  let [t, n] = F(!1);
2517
- return /* @__PURE__ */ L("div", {
2585
+ return /* @__PURE__ */ R("div", {
2518
2586
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
2519
2587
  onClick: () => n((e) => !e),
2520
2588
  title: t ? "Clic per comprimere" : "Clic per espandere",
2521
- children: [/* @__PURE__ */ I(c, {
2589
+ children: [/* @__PURE__ */ L(c, {
2522
2590
  language: "json",
2523
2591
  showCopy: t,
2524
2592
  background: "transparent",
2525
2593
  className: "!text-[11px]",
2526
2594
  children: JSON.stringify(e, null, 2)
2527
- }), !t && /* @__PURE__ */ I("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
2595
+ }), !t && /* @__PURE__ */ L("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
2528
2596
  });
2529
2597
  }
2530
2598
  //#endregion
2531
2599
  //#region src/presentation/liveAnchorDestination.ts
2532
- function yn(e, t, n) {
2600
+ function wn(e, t, n) {
2533
2601
  return e.length === 0 ? null : {
2534
2602
  id: "live-component",
2535
2603
  label: "Applica al componente aperto",
@@ -2540,38 +2608,38 @@ function yn(e, t, n) {
2540
2608
  }
2541
2609
  //#endregion
2542
2610
  //#region src/presentation/subagentControls.ts
2543
- var bn = {};
2544
- function xn(e) {
2545
- Object.assign(bn, e);
2611
+ var Tn = {};
2612
+ function En(e) {
2613
+ Object.assign(Tn, e);
2546
2614
  }
2547
- function Sn(e) {
2548
- return bn[e];
2615
+ function Dn(e) {
2616
+ return Tn[e];
2549
2617
  }
2550
2618
  //#endregion
2551
2619
  //#region src/presentation/chatTitles.ts
2552
- function Cn(e, t = 6e3) {
2620
+ function On(e, t = 6e3) {
2553
2621
  let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Xe(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
2554
2622
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
2555
2623
  }
2556
- function wn(e) {
2624
+ function kn(e) {
2557
2625
  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);
2558
2626
  }
2559
- function Tn(e, t) {
2627
+ function An(e, t) {
2560
2628
  try {
2561
2629
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2562
2630
  } catch {
2563
2631
  return;
2564
2632
  }
2565
2633
  }
2566
- function En(e, t, n, r, i) {
2567
- let a = Tn(e, t), o = (e) => {
2634
+ function jn(e, t, n, r, i) {
2635
+ let a = An(e, t), o = (e) => {
2568
2636
  let t = e ? C(e) : null;
2569
2637
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2570
2638
  };
2571
2639
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2572
2640
  }
2573
- function Dn(e) {
2574
- let t = T()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Qt(), i = P({
2641
+ function Mn(e) {
2642
+ let t = T()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = rn(), i = P({
2575
2643
  registry: t,
2576
2644
  modelsByProvider: n,
2577
2645
  selectedModel: r
@@ -2583,17 +2651,17 @@ function Dn(e) {
2583
2651
  };
2584
2652
  let a = P(/* @__PURE__ */ new Set()), o = k(async (t, n, r) => {
2585
2653
  if (!e) return !1;
2586
- let o = Ue(e, t, n), s = K(t), c = `${e}:${t}:${n}`;
2654
+ let o = Ue(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2587
2655
  if (!o || !s?.autoTitle || o.name || !Ye(o) || a.current.has(c)) return !1;
2588
- let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = En(s, o.params, r ?? d, u, l), p = f ? C(f) : null;
2656
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = jn(s, o.params, r ?? d, u, l), p = f ? C(f) : null;
2589
2657
  if (!p) return !1;
2590
2658
  a.current.add(c);
2591
2659
  try {
2592
2660
  let r = await l[p.provider].complete({
2593
- prompt: J().chatTitle.replace("{chat}", Cn(o.activity)),
2661
+ prompt: J().chatTitle.replace("{chat}", On(o.activity)),
2594
2662
  model: p.model,
2595
2663
  history: []
2596
- }), i = r && r.type === "text" ? wn(r.text) : "";
2664
+ }), i = r && r.type === "text" ? kn(r.text) : "";
2597
2665
  return i ? Ze(e, t, n, i, "model") : !1;
2598
2666
  } catch {
2599
2667
  return !1;
@@ -2602,9 +2670,9 @@ function Dn(e) {
2602
2670
  }
2603
2671
  }, [e]), s = Object.keys(n).length > 0;
2604
2672
  return j(() => {
2605
- e && s && !On.has(e) && (On.add(e), (async () => {
2673
+ e && s && !Nn.has(e) && (Nn.add(e), (async () => {
2606
2674
  for (let t of $e(e)) {
2607
- let n = K(t.subagentId);
2675
+ let n = W(t.subagentId);
2608
2676
  if (n?.autoTitle) {
2609
2677
  if (n.definition.conversational && !Ye(t)) {
2610
2678
  Qe(e, t.subagentId, t.entityId);
@@ -2620,18 +2688,18 @@ function Dn(e) {
2620
2688
  o
2621
2689
  ]), o;
2622
2690
  }
2623
- var On = /* @__PURE__ */ new Set(), kn = () => ({});
2624
- function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2625
- let c = ct(), l = sn(e.definition, {
2691
+ var Nn = /* @__PURE__ */ new Set(), Pn = () => ({});
2692
+ function Fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2693
+ let c = ft(), l = fn(e.definition, {
2626
2694
  defaultEnabled: !0,
2627
2695
  ...c.person ? { author: c.person } : {}
2628
- }), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p = O(), m = P(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [h, g] = F(null), _ = (t) => {
2696
+ }), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p = D(), m = P(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [h, g] = F(null), _ = (t) => {
2629
2697
  e.definition.conversational || g(t);
2630
- }, [v, y] = F([]), [b, x] = F(null), S = _n(e.id), C = S?.kind === "selection" ? S : null, [w, T] = F(null), E = P(!1), D = P(0), ee = P(null);
2631
- h && h !== ee.current && (ee.current = h, D.current = (r?.length ?? 0) + l.activity.length);
2698
+ }, [v, y] = F([]), [b, x] = F(null), S = Sn(e.id), C = S?.kind === "selection" ? S : null, [w, T] = F(null), ee = P(!1), E = P(0), O = P(null);
2699
+ h && h !== O.current && (O.current = h, E.current = (r?.length ?? 0) + l.activity.length);
2632
2700
  let te = P(!1), k = l.remote || !l.hasProviders || l.selectedModel !== "";
2633
2701
  j(() => {
2634
- !E.current && k && (E.current = !0, a ? (W.current = !0, l.resume(e.toParams(t), a)) : (o && l.setSelectedModel(o), l.run(e.toParams(t), {
2702
+ !ee.current && k && (ee.current = !0, a ? (U.current = !0, l.resume(e.toParams(t), a)) : (o && l.setSelectedModel(o), l.run(e.toParams(t), {
2635
2703
  model: o,
2636
2704
  openingMessage: s
2637
2705
  }).then((e) => {
@@ -2651,7 +2719,7 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2651
2719
  ...t,
2652
2720
  pinnedEntityId: r
2653
2721
  }).then((n) => {
2654
- n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t, pn(e, t));
2722
+ n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t, vn(e, t));
2655
2723
  }).catch((e) => x(e instanceof Error ? e.message : String(e))));
2656
2724
  });
2657
2725
  }, [
@@ -2666,20 +2734,20 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2666
2734
  ...n,
2667
2735
  [e]: t
2668
2736
  });
2669
- }, M = (e) => _(e), R = N(() => h && C && w ? C.applySelection(h, w) : h, [
2737
+ }, M = (e) => _(e), ne = N(() => h && C && w ? C.applySelection(h, w) : h, [
2670
2738
  h,
2671
2739
  C,
2672
2740
  w
2673
- ]), z = N(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), B = N(() => yn(z, t, m), [
2741
+ ]), z = N(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), B = N(() => wn(z, t, m), [
2674
2742
  z,
2675
2743
  t,
2676
2744
  m
2677
- ]), V = N(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), re = Dn(f?.id), U = P(!1), W = P(!1);
2745
+ ]), V = N(() => B ? [B, ...n ?? []] : n, [B, n]), re = e.chatEntityId?.(t), ie = Mn(f?.id), H = P(!1), U = P(!1);
2678
2746
  j(() => {
2679
- let n = !U.current && l.running, i = U.current && !l.running;
2680
- if (U.current = l.running, !n && !i || !H || !f) return;
2681
- if (W.current) {
2682
- i && (W.current = !1);
2747
+ let n = !H.current && l.running, i = H.current && !l.running;
2748
+ if (H.current = l.running, !n && !i || !re || !f) return;
2749
+ if (U.current) {
2750
+ i && (U.current = !1);
2683
2751
  return;
2684
2752
  }
2685
2753
  let a = l.snapshot();
@@ -2688,59 +2756,59 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2688
2756
  e.autoTitle && e.definition.conversational && !Ye({ activity: o }) || (We({
2689
2757
  scopeId: f.id,
2690
2758
  subagentId: e.id,
2691
- entityId: H,
2759
+ entityId: re,
2692
2760
  params: t,
2693
- title: pn(e, t),
2761
+ title: vn(e, t),
2694
2762
  history: a.history,
2695
2763
  activity: o
2696
- }), i && e.autoTitle && re(e.id, H, l.selectedModel));
2764
+ }), i && e.autoTitle && ie(e.id, re, l.selectedModel));
2697
2765
  }, [l.running]);
2698
- let G = () => {
2766
+ let ae = () => {
2699
2767
  te.current = !0, l.running && l.stop(), c.closeTask(m);
2700
- }, K = P(Sn(e.id) ?? kn).current, q = K({
2768
+ }, W = P(Dn(e.id) ?? Pn).current, G = W({
2701
2769
  params: t,
2702
2770
  taskId: m,
2703
2771
  running: l.running,
2704
- close: G
2705
- }), ie = (e) => {
2772
+ close: ae
2773
+ }), K = (e) => {
2706
2774
  y((t) => t.includes(e) ? t : [...t, e]);
2707
2775
  };
2708
2776
  return j(() => {
2709
2777
  te.current || c.openTask({
2710
2778
  id: m,
2711
- title: pn(e, t),
2779
+ title: vn(e, t),
2712
2780
  icon: e.icon,
2713
2781
  agent: l,
2714
2782
  onApplied: (e) => _(e),
2715
2783
  precedingActivity: r,
2716
- panelExtraAnchorIndex: D.current,
2717
- onDismiss: G,
2784
+ panelExtraAnchorIndex: E.current,
2785
+ onDismiss: ae,
2718
2786
  ...u ? { thread: u } : {},
2719
2787
  ...d ? { speaker: d } : {},
2720
- ...H ? { savedToDisk: !0 } : {},
2721
- panelActions: q.content,
2722
- composerActions: q.actions,
2723
- composerCommands: q.commands,
2724
- panelExtra: h ? /* @__PURE__ */ L(ne, { children: [
2725
- C && w ? /* @__PURE__ */ I(C.Report, {
2788
+ ...re ? { savedToDisk: !0 } : {},
2789
+ panelActions: G.content,
2790
+ composerActions: G.actions,
2791
+ composerCommands: G.commands,
2792
+ panelExtra: h ? /* @__PURE__ */ R(I, { children: [
2793
+ C && w ? /* @__PURE__ */ L(C.Report, {
2726
2794
  result: h,
2727
2795
  selection: w,
2728
2796
  onChange: A
2729
- }) : S?.kind === "editable" ? /* @__PURE__ */ I(S.Report, {
2797
+ }) : S?.kind === "editable" ? /* @__PURE__ */ L(S.Report, {
2730
2798
  result: h,
2731
2799
  onResultChange: M
2732
- }) : /* @__PURE__ */ I(vn, { result: R }),
2733
- b && /* @__PURE__ */ L("p", {
2800
+ }) : /* @__PURE__ */ L(Cn, { result: ne }),
2801
+ b && /* @__PURE__ */ R("p", {
2734
2802
  className: "text-xs text-destructive",
2735
2803
  children: ["Salvataggio automatico non riuscito: ", b]
2736
2804
  }),
2737
- /* @__PURE__ */ I(mn, {
2805
+ /* @__PURE__ */ L(yn, {
2738
2806
  manifest: e,
2739
- result: R,
2807
+ result: ne,
2740
2808
  meta: t,
2741
2809
  taskId: m,
2742
2810
  initiallyApplied: v,
2743
- onApplied: ie,
2811
+ onApplied: K,
2744
2812
  extraDestinations: V
2745
2813
  })
2746
2814
  ] }) : void 0
@@ -2760,32 +2828,32 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2760
2828
  e,
2761
2829
  t,
2762
2830
  h,
2763
- R,
2831
+ ne,
2764
2832
  w,
2765
2833
  v,
2766
2834
  n,
2767
2835
  r,
2768
2836
  b,
2769
- q.content,
2770
- q.actions,
2771
- q.commands
2837
+ G.content,
2838
+ G.actions,
2839
+ G.commands
2772
2840
  ]), j(() => () => {
2773
2841
  c.closeTask(m);
2774
2842
  }, [c.closeTask, m]), null;
2775
2843
  }
2776
2844
  //#endregion
2777
2845
  //#region src/presentation/OrchestratorRunner.tsx
2778
- function jn({ userGoal: e }) {
2779
- let t = $(), n = N(() => fn({
2846
+ function In({ userGoal: e }) {
2847
+ let t = $(), n = N(() => _n({
2780
2848
  unavailable: t.orchestratorUnavailable,
2781
2849
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2782
2850
  preparing: t.orchestratorPreparing,
2783
2851
  collecting: t.orchestratorCollecting
2784
- }), []), r = ct(), i = sn(n, {
2852
+ }), []), r = ft(), i = fn(n, {
2785
2853
  defaultEnabled: !0,
2786
2854
  ...r.person ? { author: r.person } : {}
2787
2855
  }), [a, o] = F(null), s = P(!1), c = !i.hasProviders || i.selectedModel !== "", l = P(r.pendingExtraDestinations), u = P(r.pendingAttachments), d = P(r.pendingModel), f = P(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), p = P(r.pendingCarryOver), m = P(!1), h = (e) => {
2788
- e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(at));
2856
+ e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(lt));
2789
2857
  };
2790
2858
  j(() => {
2791
2859
  !s.current && c && (s.current = !0, d.current && i.setSelectedModel(d.current), i.run({
@@ -2801,7 +2869,7 @@ function jn({ userGoal: e }) {
2801
2869
  }));
2802
2870
  }, [c]), j(() => {
2803
2871
  m.current || r.openTask({
2804
- id: at,
2872
+ id: lt,
2805
2873
  title: "Agentico",
2806
2874
  icon: "bot",
2807
2875
  agent: i,
@@ -2809,7 +2877,7 @@ function jn({ userGoal: e }) {
2809
2877
  scopedSubagentId: f.current,
2810
2878
  precedingActivity: p.current?.activity,
2811
2879
  onDismiss: () => {
2812
- m.current = !0, i.running && i.stop(), r.closeTask(at);
2880
+ m.current = !0, i.running && i.stop(), r.closeTask(lt);
2813
2881
  }
2814
2882
  });
2815
2883
  }, [
@@ -2822,12 +2890,12 @@ function jn({ userGoal: e }) {
2822
2890
  i.hasProviders,
2823
2891
  r.openTask
2824
2892
  ]), j(() => () => {
2825
- r.closeTask(at);
2893
+ r.closeTask(lt);
2826
2894
  }, [r.closeTask]);
2827
2895
  let g = N(() => [...p.current?.activity ?? [], ...i.activity], [i.activity]);
2828
2896
  if (!a) return null;
2829
- let _ = K(a.subagentId);
2830
- return _ ? /* @__PURE__ */ I(An, {
2897
+ let _ = W(a.subagentId);
2898
+ return _ ? /* @__PURE__ */ L(Fn, {
2831
2899
  manifest: _,
2832
2900
  params: a.params,
2833
2901
  extraDestinations: l.current,
@@ -2838,11 +2906,11 @@ function jn({ userGoal: e }) {
2838
2906
  }
2839
2907
  //#endregion
2840
2908
  //#region src/presentation/ManualEntryRunner.tsx
2841
- function Mn({ manifest: e, extraDestinations: n }) {
2842
- let r = ct(), i = sn(e.definition, {
2909
+ function Ln({ manifest: e, extraDestinations: n }) {
2910
+ let r = ft(), i = fn(e.definition, {
2843
2911
  defaultEnabled: !1,
2844
2912
  ...r.person ? { author: r.person } : {}
2845
- }), a = $(), o = P(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = F(null), [l, u] = F([]), d = _n(e.id), f = d?.kind === "selection" ? d : null, [p, m] = F(null), [h, g] = F(null), _ = P(!1), v = (t) => {
2913
+ }), a = $(), o = P(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = F(null), [l, u] = F([]), d = Sn(e.id), f = d?.kind === "selection" ? d : null, [p, m] = F(null), [h, g] = F(null), _ = P(!1), v = (t) => {
2846
2914
  if (!e.manualEntry) return;
2847
2915
  let n;
2848
2916
  try {
@@ -2869,7 +2937,7 @@ function Mn({ manifest: e, extraDestinations: n }) {
2869
2937
  p
2870
2938
  ]), S = (e) => {
2871
2939
  u((t) => t.includes(e) ? t : [...t, e]);
2872
- }, C = N(() => r.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [r.componentAnchors, e.id]), w = N(() => h ? yn(C, h, o) : null, [
2940
+ }, C = N(() => r.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [r.componentAnchors, e.id]), w = N(() => h ? wn(C, h, o) : null, [
2873
2941
  C,
2874
2942
  h,
2875
2943
  o
@@ -2888,18 +2956,18 @@ function Mn({ manifest: e, extraDestinations: n }) {
2888
2956
  onDismiss: () => {
2889
2957
  _.current = !0, i.running && i.stop(), r.closeTask(o);
2890
2958
  },
2891
- panelExtra: s ? /* @__PURE__ */ L("div", {
2959
+ panelExtra: s ? /* @__PURE__ */ R("div", {
2892
2960
  className: "space-y-2",
2893
2961
  children: [
2894
- f && p ? /* @__PURE__ */ I(f.Report, {
2962
+ f && p ? /* @__PURE__ */ L(f.Report, {
2895
2963
  result: s,
2896
2964
  selection: p,
2897
2965
  onChange: y
2898
- }) : d?.kind === "editable" ? /* @__PURE__ */ I(d.Report, {
2966
+ }) : d?.kind === "editable" ? /* @__PURE__ */ L(d.Report, {
2899
2967
  result: s,
2900
2968
  onResultChange: b
2901
- }) : /* @__PURE__ */ I(vn, { result: x }),
2902
- /* @__PURE__ */ I(mn, {
2969
+ }) : /* @__PURE__ */ L(Cn, { result: x }),
2970
+ /* @__PURE__ */ L(yn, {
2903
2971
  manifest: e,
2904
2972
  result: x,
2905
2973
  meta: h ?? {},
@@ -2908,7 +2976,7 @@ function Mn({ manifest: e, extraDestinations: n }) {
2908
2976
  onApplied: S,
2909
2977
  extraDestinations: T
2910
2978
  }),
2911
- i.hasProviders && /* @__PURE__ */ I(t, {
2979
+ i.hasProviders && /* @__PURE__ */ L(t, {
2912
2980
  label: a.resumeWithAi,
2913
2981
  variant: "outline-secondary",
2914
2982
  className: "text-xs",
@@ -2936,39 +3004,39 @@ function Mn({ manifest: e, extraDestinations: n }) {
2936
3004
  }
2937
3005
  //#endregion
2938
3006
  //#region src/presentation/EarlierSessions.tsx
2939
- function Nn({ title: e, meta: t, action: n }) {
2940
- return /* @__PURE__ */ L("div", {
3007
+ function Rn({ title: e, meta: t, action: n }) {
3008
+ return /* @__PURE__ */ R("div", {
2941
3009
  role: "separator",
2942
3010
  "aria-label": e,
2943
3011
  className: "my-3 flex items-center gap-2 text-[11px] text-muted-foreground",
2944
3012
  children: [
2945
- /* @__PURE__ */ I("span", { className: "h-px flex-1 bg-border" }),
2946
- /* @__PURE__ */ L("span", {
3013
+ /* @__PURE__ */ L("span", { className: "h-px flex-1 bg-border" }),
3014
+ /* @__PURE__ */ R("span", {
2947
3015
  className: "flex min-w-0 max-w-[75%] flex-col items-center text-center",
2948
3016
  children: [
2949
- /* @__PURE__ */ I("span", {
3017
+ /* @__PURE__ */ L("span", {
2950
3018
  className: "max-w-full truncate font-medium text-foreground",
2951
3019
  children: e
2952
3020
  }),
2953
- t && /* @__PURE__ */ I("span", { children: t }),
3021
+ t && /* @__PURE__ */ L("span", { children: t }),
2954
3022
  n
2955
3023
  ]
2956
3024
  }),
2957
- /* @__PURE__ */ I("span", { className: "h-px flex-1 bg-border" })
3025
+ /* @__PURE__ */ L("span", { className: "h-px flex-1 bg-border" })
2958
3026
  ]
2959
3027
  });
2960
3028
  }
2961
- function Pn({ chat: e, thread: t, from: n, showEvents: r }) {
2962
- let i = dt(t, n, e.savedAt, r);
2963
- return /* @__PURE__ */ I(It, {
3029
+ function zn({ chat: e, thread: t, from: n, showEvents: r }) {
3030
+ let i = ht(t, n, e.savedAt, r);
3031
+ return /* @__PURE__ */ L(Vt, {
2964
3032
  activity: e.activity,
2965
3033
  pinUserMessages: !1,
2966
- speaker: K(e.subagentId)?.speaker?.(e.params),
3034
+ speaker: W(e.subagentId)?.speaker?.(e.params),
2967
3035
  events: i
2968
3036
  });
2969
3037
  }
2970
- function Fn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onContinue: o, busy: s = !1, showEvents: c = !0 }) {
2971
- let l = $(), { locale: u } = D(), [d, f] = F(0);
3038
+ function Bn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onContinue: o, busy: s = !1, showEvents: c = !0 }) {
3039
+ let l = $(), { locale: u } = E(), [d, f] = F(0);
2972
3040
  j(() => Ve(() => f((e) => e + 1)), []);
2973
3041
  let p = N(() => nt(e, n, r), [
2974
3042
  e,
@@ -3017,11 +3085,11 @@ function Fn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
3017
3085
  let t = p[p.indexOf(e) + 1];
3018
3086
  return t ? t.savedAt : Q(e);
3019
3087
  };
3020
- return /* @__PURE__ */ L("div", { children: [
3021
- g && /* @__PURE__ */ I("div", {
3088
+ return /* @__PURE__ */ R("div", { children: [
3089
+ g && /* @__PURE__ */ L("div", {
3022
3090
  ref: b,
3023
3091
  className: "flex justify-center pb-1",
3024
- children: /* @__PURE__ */ I(t, {
3092
+ children: /* @__PURE__ */ L(t, {
3025
3093
  icon: "history",
3026
3094
  label: l.earlierSession,
3027
3095
  variant: "link",
@@ -3029,31 +3097,31 @@ function Fn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
3029
3097
  onClick: v
3030
3098
  })
3031
3099
  }),
3032
- C.map((e) => /* @__PURE__ */ L("section", {
3100
+ C.map((e) => /* @__PURE__ */ R("section", {
3033
3101
  "aria-label": Je(e),
3034
- children: [/* @__PURE__ */ I(Nn, {
3102
+ children: [/* @__PURE__ */ L(Rn, {
3035
3103
  title: Je(e),
3036
3104
  meta: S(l.sessionOf, { at: x(Q(e)) }),
3037
- action: /* @__PURE__ */ I(t, {
3105
+ action: /* @__PURE__ */ L(t, {
3038
3106
  label: l.continueSession,
3039
3107
  variant: "link",
3040
3108
  className: "text-[11px]",
3041
3109
  disabled: s,
3042
3110
  onClick: () => o(e)
3043
3111
  })
3044
- }), /* @__PURE__ */ I(Pn, {
3112
+ }), /* @__PURE__ */ L(zn, {
3045
3113
  chat: e,
3046
3114
  thread: n,
3047
3115
  from: w(e),
3048
3116
  showEvents: c
3049
3117
  })]
3050
3118
  }, `${e.subagentId}:${e.entityId}`)),
3051
- m > 0 && /* @__PURE__ */ I(Nn, { title: l.thisSession })
3119
+ m > 0 && /* @__PURE__ */ L(Rn, { title: l.thisSession })
3052
3120
  ] });
3053
3121
  }
3054
3122
  //#endregion
3055
3123
  //#region src/presentation/Agentico.tsx
3056
- function In(e, t) {
3124
+ function Vn(e, t) {
3057
3125
  return Object.values(e).flat().map((e) => {
3058
3126
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
3059
3127
  return {
@@ -3065,7 +3133,7 @@ function In(e, t) {
3065
3133
  };
3066
3134
  });
3067
3135
  }
3068
- function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
3136
+ function Hn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
3069
3137
  let a = $(), [o, c] = F(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
3070
3138
  j(() => {
3071
3139
  n && c(n.detail ?? "");
@@ -3085,20 +3153,20 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
3085
3153
  }).then((e) => {
3086
3154
  e && u(e);
3087
3155
  });
3088
- }, 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, ...In(l.modelsByProvider, l.catalogGroup)] : In(l.modelsByProvider);
3089
- return /* @__PURE__ */ L(ne, { children: [n && /* @__PURE__ */ L("div", {
3156
+ }, 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, ...Vn(l.modelsByProvider, l.catalogGroup)] : Vn(l.modelsByProvider);
3157
+ return /* @__PURE__ */ R(I, { children: [n && /* @__PURE__ */ R("div", {
3090
3158
  className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
3091
3159
  children: [
3092
- /* @__PURE__ */ I(f, {
3160
+ /* @__PURE__ */ L(f, {
3093
3161
  name: "pencil",
3094
3162
  size: 12,
3095
3163
  className: "shrink-0"
3096
3164
  }),
3097
- /* @__PURE__ */ I("span", {
3165
+ /* @__PURE__ */ L("span", {
3098
3166
  className: "flex-1",
3099
3167
  children: a.editingMessage
3100
3168
  }),
3101
- /* @__PURE__ */ I(t, {
3169
+ /* @__PURE__ */ L(t, {
3102
3170
  label: a.cancelEdit,
3103
3171
  variant: "link",
3104
3172
  className: "p-0 text-xs",
@@ -3107,7 +3175,7 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
3107
3175
  }
3108
3176
  })
3109
3177
  ]
3110
- }), /* @__PURE__ */ I(s, {
3178
+ }), /* @__PURE__ */ L(s, {
3111
3179
  value: o,
3112
3180
  onChange: c,
3113
3181
  placeholder: d?.prompt ?? a.messagePlaceholder,
@@ -3126,21 +3194,21 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
3126
3194
  maxHeight: 220
3127
3195
  })] });
3128
3196
  }
3129
- function Rn() {
3130
- let { startOrchestrator: e } = ct(), t = $(), [n, r] = F(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Qt(), l = (t) => {
3197
+ function Un() {
3198
+ let { startOrchestrator: e } = ft(), t = $(), [n, r] = F(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = rn(), l = (t) => {
3131
3199
  t.text.trim() && (e(t.text.trim(), {
3132
3200
  attachments: t.files.length > 0 ? t.files : void 0,
3133
3201
  model: t.model || void 0
3134
3202
  }), r(""));
3135
3203
  }, u = i && !o;
3136
- return /* @__PURE__ */ I(s, {
3204
+ return /* @__PURE__ */ L(s, {
3137
3205
  value: n,
3138
3206
  onChange: r,
3139
3207
  placeholder: t.orchestratorStarterPlaceholder,
3140
3208
  disabled: !n.trim() || u,
3141
3209
  onSubmit: l,
3142
3210
  attachments: !0,
3143
- models: In(a),
3211
+ models: Vn(a),
3144
3212
  selectedModel: o,
3145
3213
  onModelChange: c,
3146
3214
  modelPlaceholder: t.selectModelPlaceholder,
@@ -3148,30 +3216,30 @@ function Rn() {
3148
3216
  maxHeight: 220
3149
3217
  });
3150
3218
  }
3151
- function zn({ chat: e, onClose: t }) {
3152
- let n = $(), r = E();
3153
- return /* @__PURE__ */ I(_, {
3219
+ function Wn({ chat: e, onClose: t }) {
3220
+ let n = $(), r = ee();
3221
+ return /* @__PURE__ */ L(_, {
3154
3222
  title: n.renameChat,
3155
3223
  size: "sm",
3156
3224
  onClose: t,
3157
3225
  onSave: () => (Ze(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Je(e)), "person"), t(), Promise.resolve(!0)),
3158
- children: /* @__PURE__ */ L(d, {
3226
+ children: /* @__PURE__ */ R(d, {
3159
3227
  appearance: "empty",
3160
3228
  controller: r,
3161
3229
  defaultValues: { title: Je(e) },
3162
3230
  footer: !1,
3163
- children: [/* @__PURE__ */ I(h, {
3231
+ children: [/* @__PURE__ */ L(h, {
3164
3232
  name: "title",
3165
3233
  label: n.chatTitleLabel,
3166
3234
  placeholder: e.title
3167
- }), /* @__PURE__ */ I("p", {
3235
+ }), /* @__PURE__ */ L("p", {
3168
3236
  className: "text-xs text-muted-foreground",
3169
3237
  children: n.chatTitleHint
3170
3238
  })]
3171
3239
  })
3172
3240
  });
3173
3241
  }
3174
- function Bn(e, t, n = Date.now()) {
3242
+ function Gn(e, t, n = Date.now()) {
3175
3243
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
3176
3244
  numeric: "auto",
3177
3245
  style: "short"
@@ -3183,55 +3251,55 @@ function Bn(e, t, n = Date.now()) {
3183
3251
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
3184
3252
  return i.format(0, "minute");
3185
3253
  }
3186
- function Vn({ card: e }) {
3254
+ function Kn({ card: e }) {
3187
3255
  let t = $();
3188
- return e.humanSummaryOnly ? /* @__PURE__ */ L("div", {
3256
+ return e.humanSummaryOnly ? /* @__PURE__ */ R("div", {
3189
3257
  className: "space-y-2 rounded-lg border border-border/60 p-3",
3190
- children: [/* @__PURE__ */ L("p", {
3258
+ children: [/* @__PURE__ */ R("p", {
3191
3259
  className: "text-xs font-medium text-foreground",
3192
3260
  children: [
3193
3261
  "\"",
3194
3262
  e.label,
3195
3263
  "\""
3196
3264
  ]
3197
- }), /* @__PURE__ */ I("p", {
3265
+ }), /* @__PURE__ */ L("p", {
3198
3266
  className: "text-xs text-muted-foreground",
3199
3267
  children: e.humanSummary
3200
3268
  })]
3201
- }) : /* @__PURE__ */ L("div", {
3269
+ }) : /* @__PURE__ */ R("div", {
3202
3270
  className: "space-y-2 rounded-lg border border-border/60 p-3",
3203
3271
  children: [
3204
- /* @__PURE__ */ I("p", {
3272
+ /* @__PURE__ */ L("p", {
3205
3273
  className: "text-xs font-medium text-foreground",
3206
3274
  children: S(t.newInstance, { label: e.label })
3207
3275
  }),
3208
- /* @__PURE__ */ I("p", {
3276
+ /* @__PURE__ */ L("p", {
3209
3277
  className: "text-xs text-muted-foreground",
3210
3278
  children: e.humanSummary
3211
3279
  }),
3212
- e.fields.length > 0 && /* @__PURE__ */ I("ul", {
3280
+ e.fields.length > 0 && /* @__PURE__ */ L("ul", {
3213
3281
  className: "space-y-1",
3214
- children: e.fields.map((e) => /* @__PURE__ */ L("li", {
3282
+ children: e.fields.map((e) => /* @__PURE__ */ R("li", {
3215
3283
  className: "flex items-start gap-1.5 text-xs",
3216
- children: [/* @__PURE__ */ I(n, {
3284
+ children: [/* @__PURE__ */ L(n, {
3217
3285
  variant: e.required ? "primary" : "secondary",
3218
3286
  className: "mt-px shrink-0",
3219
3287
  children: e.required ? "richiesto" : "opzionale"
3220
- }), /* @__PURE__ */ L("span", {
3288
+ }), /* @__PURE__ */ R("span", {
3221
3289
  className: "min-w-0",
3222
- children: [/* @__PURE__ */ I("span", {
3290
+ children: [/* @__PURE__ */ L("span", {
3223
3291
  className: "font-mono text-foreground",
3224
3292
  children: e.key
3225
- }), e.humanDescription ? /* @__PURE__ */ L("span", {
3293
+ }), e.humanDescription ? /* @__PURE__ */ R("span", {
3226
3294
  className: "text-muted-foreground",
3227
3295
  children: [" — ", e.humanDescription]
3228
3296
  }) : null]
3229
3297
  })]
3230
3298
  }, e.key))
3231
3299
  }),
3232
- e.example && /* @__PURE__ */ L("p", {
3300
+ e.example && /* @__PURE__ */ R("p", {
3233
3301
  className: "text-xs text-muted-foreground",
3234
- children: ["Esempio: ", /* @__PURE__ */ I("span", {
3302
+ children: ["Esempio: ", /* @__PURE__ */ L("span", {
3235
3303
  className: "font-mono",
3236
3304
  children: e.example
3237
3305
  })]
@@ -3239,24 +3307,24 @@ function Vn({ card: e }) {
3239
3307
  ]
3240
3308
  });
3241
3309
  }
3242
- function Hn({ messages: e }) {
3243
- return /* @__PURE__ */ I("div", {
3310
+ function qn({ messages: e }) {
3311
+ return /* @__PURE__ */ L("div", {
3244
3312
  className: "space-y-2 rounded-lg border border-border/60 p-3",
3245
- children: e.map((e, t) => /* @__PURE__ */ I("p", {
3313
+ children: e.map((e, t) => /* @__PURE__ */ L("p", {
3246
3314
  className: "text-xs text-muted-foreground",
3247
3315
  children: e
3248
3316
  }, t))
3249
3317
  });
3250
3318
  }
3251
- function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
3252
- let c = $(), { locale: d } = D(), [p, m] = F(""), [h, g] = F(0);
3319
+ function Jn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
3320
+ let c = $(), { locale: d } = E(), [p, m] = F(""), [h, g] = F(0);
3253
3321
  j(() => Ve(() => g((e) => e + 1)), []);
3254
3322
  let _ = N(() => r ? $e(e) : [], [
3255
3323
  e,
3256
3324
  r,
3257
3325
  h
3258
3326
  ]), [v, y] = F(null), b = async (t) => {
3259
- let r = K(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
3327
+ let r = W(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
3260
3328
  if (!i || window.confirm(i)) {
3261
3329
  try {
3262
3330
  await r?.onArchive?.(t.entityId, t.params);
@@ -3268,11 +3336,11 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
3268
3336
  }, x = N(() => {
3269
3337
  let e = p.trim().toLowerCase();
3270
3338
  return e ? _.filter((t) => {
3271
- let n = K(t.subagentId)?.label ?? t.subagentId;
3339
+ let n = W(t.subagentId)?.label ?? t.subagentId;
3272
3340
  return Je(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
3273
3341
  }) : _;
3274
3342
  }, [_, p]);
3275
- return /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I(l, {
3343
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(l, {
3276
3344
  trigger: {
3277
3345
  icon: "history",
3278
3346
  title: c.chatHistory
@@ -3283,22 +3351,22 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
3283
3351
  position: "end",
3284
3352
  strategy: "absolute",
3285
3353
  menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
3286
- header: /* @__PURE__ */ L("div", {
3354
+ header: /* @__PURE__ */ R("div", {
3287
3355
  className: "flex items-center gap-2 px-1 pb-1.5",
3288
3356
  children: [
3289
- /* @__PURE__ */ I(f, {
3357
+ /* @__PURE__ */ L(f, {
3290
3358
  name: "search",
3291
3359
  size: 14,
3292
3360
  className: "shrink-0 text-muted-foreground"
3293
3361
  }),
3294
- /* @__PURE__ */ I("input", {
3362
+ /* @__PURE__ */ L("input", {
3295
3363
  autoFocus: !0,
3296
3364
  value: p,
3297
3365
  onChange: (e) => m(e.target.value),
3298
3366
  placeholder: c.searchChats,
3299
3367
  className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
3300
3368
  }),
3301
- /* @__PURE__ */ I(t, {
3369
+ /* @__PURE__ */ L(t, {
3302
3370
  icon: "square-pen",
3303
3371
  ariaLabel: c.newChat,
3304
3372
  title: c.newChat,
@@ -3308,12 +3376,12 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
3308
3376
  })
3309
3377
  ]
3310
3378
  }),
3311
- children: x.length === 0 ? /* @__PURE__ */ I("p", {
3379
+ children: x.length === 0 ? /* @__PURE__ */ L("p", {
3312
3380
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
3313
3381
  children: _.length === 0 ? c.noSavedChats : c.noResults
3314
3382
  }) : x.map((e) => {
3315
- let t = K(e.subagentId), r = n === et(e.subagentId, e.entityId);
3316
- return /* @__PURE__ */ I(u, {
3383
+ let t = W(e.subagentId), r = n === et(e.subagentId, e.entityId);
3384
+ return /* @__PURE__ */ L(u, {
3317
3385
  icon: r ? "check" : t?.icon ?? "bot",
3318
3386
  className: r ? "bg-accent font-semibold text-primary" : void 0,
3319
3387
  actions: [{
@@ -3328,54 +3396,54 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
3328
3396
  onClick: () => void b(e)
3329
3397
  }],
3330
3398
  onClick: () => a(e.subagentId, e.entityId, e),
3331
- children: /* @__PURE__ */ L("span", {
3399
+ children: /* @__PURE__ */ R("span", {
3332
3400
  className: "flex min-w-0 flex-1 items-center justify-between gap-2",
3333
- children: [/* @__PURE__ */ I("span", {
3401
+ children: [/* @__PURE__ */ L("span", {
3334
3402
  className: "min-w-0 truncate",
3335
3403
  title: `${t?.label ?? e.subagentId} · ${Je(e)}`,
3336
3404
  children: Je(e)
3337
- }), /* @__PURE__ */ I("span", {
3405
+ }), /* @__PURE__ */ L("span", {
3338
3406
  className: "shrink-0 text-xs text-muted-foreground",
3339
3407
  title: `${c.chatStarted.replace("{at}", new Date(Q(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
3340
- children: Bn(Q(e), d)
3408
+ children: Gn(Q(e), d)
3341
3409
  })]
3342
3410
  })
3343
3411
  }, `${e.subagentId}:${e.entityId}`);
3344
3412
  })
3345
- }), v && /* @__PURE__ */ I(zn, {
3413
+ }), v && /* @__PURE__ */ L(Wn, {
3346
3414
  chat: v,
3347
3415
  onClose: () => y(null)
3348
3416
  })] });
3349
3417
  }
3350
- function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
3351
- let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: y, pendingExtraDestinations: b, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T, threadEvents: E } = ct(), D = $(), O = P(null), [ee, te] = F(!1), [k, A] = F(null), [M, R] = F(null);
3418
+ function Yn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
3419
+ let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: y, pendingExtraDestinations: b, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T, threadEvents: ee } = ft(), E = $(), D = P(null), [O, te] = F(!1), [k, A] = F(null), [M, ne] = F(null);
3352
3420
  j(() => {
3353
- A(null), R(null);
3354
- }, [a?.id]), Dn(T?.id);
3355
- let z = Kt({
3421
+ A(null), ne(null);
3422
+ }, [a?.id]), Mn(T?.id);
3423
+ let z = Zt({
3356
3424
  defaultWidth: e,
3357
3425
  minWidth: n,
3358
3426
  maxWidth: r,
3359
3427
  onWidthChange: i
3360
3428
  }), B = () => {
3361
- (!a || a.agent.running || a.savedToDisk || window.confirm(D.unsavedConversationConfirm)) && (m(), te(!1));
3362
- }, V = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], H = V.length, re = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? H, H)), U = V.slice(0, re), W = V.slice(re), G = !!(a && !a.agent.running && a.agent.error), [q, ie] = ut(), ae = P({ at: Date.now() });
3363
- ae.current.id !== a?.id && (ae.current = {
3429
+ (!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(), te(!1));
3430
+ }, V = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], re = V.length, ie = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? re, re)), H = V.slice(0, ie), U = V.slice(ie), ae = !!(a && !a.agent.running && a.agent.error), [G, K] = mt(), oe = P({ at: Date.now() });
3431
+ oe.current.id !== a?.id && (oe.current = {
3364
3432
  id: a?.id,
3365
3433
  at: Date.now()
3366
3434
  });
3367
- let oe = N(() => {
3368
- if (!T || !a?.thread) return ae.current.at;
3435
+ let se = N(() => {
3436
+ if (!T || !a?.thread) return oe.current.at;
3369
3437
  let e = nt(T.id, a.thread, a.id)[0];
3370
3438
  if (e) return e.savedAt;
3371
3439
  let t = $e(T.id).find((e) => et(e.subagentId, e.entityId) === a.id);
3372
- return t ? Q(t) : V.find((e) => e.at !== void 0)?.at ?? ae.current.at;
3440
+ return t ? Q(t) : V.find((e) => e.at !== void 0)?.at ?? oe.current.at;
3373
3441
  }, [
3374
3442
  T?.id,
3375
3443
  a?.thread,
3376
3444
  a?.id,
3377
- H === 0
3378
- ]), se = dt(a?.thread, oe, Infinity, q), ce = W.find((e) => e.at !== void 0)?.at, le = W.length === 0 || ce === void 0 ? se : se.filter((e) => e.at < ce), ue = W.length === 0 || ce === void 0 ? [] : se.filter((e) => e.at >= ce), de = (e, t) => {
3445
+ re === 0
3446
+ ]), ce = ht(a?.thread, se, Infinity, G), le = U.find((e) => e.at !== void 0)?.at, ue = U.length === 0 || le === void 0 ? ce : ce.filter((e) => e.at < le), de = U.length === 0 || le === void 0 ? [] : ce.filter((e) => e.at >= le), q = (e, t) => {
3379
3447
  a && (A(null), a.agent.rewind(e.id, t).then((e) => {
3380
3448
  e && a.onApplied(e);
3381
3449
  }));
@@ -3384,53 +3452,53 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3384
3452
  return [...new Set(n.filter(Boolean))];
3385
3453
  }, J = (e, t) => {
3386
3454
  let n = fe(e);
3387
- n.length ? R({
3455
+ n.length ? ne({
3388
3456
  entry: e,
3389
3457
  steps: n,
3390
3458
  ...t === void 0 ? {} : { text: t }
3391
- }) : de(e, t);
3459
+ }) : q(e, t);
3392
3460
  }, pe = a ? {
3393
3461
  available: (e) => a.agent.activity.some((t) => t.id === e.id) && a.agent.rewindable(e.id),
3394
3462
  disabled: a.agent.running,
3395
3463
  onRetry: (e) => J(e),
3396
3464
  onEdit: (e) => A(e)
3397
- } : void 0, me = new Set(a?.agent.activity.map((e) => e.id) ?? []), Y = a ? {
3465
+ } : void 0, me = new Set(a?.agent.activity.map((e) => e.id) ?? []), he = a ? {
3398
3466
  canAnswer: (e) => me.has(e),
3399
3467
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
3400
3468
  e && a.onApplied(e);
3401
3469
  }),
3402
3470
  onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
3403
- } : void 0, X = Y ? At(V, Y.canAnswer) : null, he = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? K(a.scopedSubagentId) : void 0, ge = he?.manualEntry ? he : null, _e = P(!0);
3471
+ } : void 0, Y = he ? Ft(V, he.canAnswer) : null, ge = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, _e = ge?.manualEntry ? ge : null, X = P(!0);
3404
3472
  j(() => {
3405
- let e = O.current;
3473
+ let e = D.current;
3406
3474
  if (!e) return;
3407
3475
  let t = () => {
3408
- _e.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
3476
+ X.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
3409
3477
  };
3410
3478
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
3411
3479
  }, [a?.id]), j(() => {
3412
- let e = O.current;
3413
- e && (_e.current = !0, e.scrollTop = e.scrollHeight);
3480
+ let e = D.current;
3481
+ e && (X.current = !0, e.scrollTop = e.scrollHeight);
3414
3482
  }, [a?.id]);
3415
3483
  let ve = V.at(-1)?.detail?.length ?? 0;
3416
3484
  j(() => {
3417
- let e = O.current;
3418
- e && _e.current && (e.scrollTop = e.scrollHeight);
3485
+ let e = D.current;
3486
+ e && X.current && (e.scrollTop = e.scrollHeight);
3419
3487
  }, [
3420
- H,
3421
- G,
3488
+ re,
3489
+ ae,
3422
3490
  ve
3423
3491
  ]);
3424
3492
  let ye = P(null);
3425
3493
  j(() => {
3426
- let e = O.current, t = ye.current;
3494
+ let e = D.current, t = ye.current;
3427
3495
  if (!e || !t || typeof ResizeObserver > "u") return;
3428
3496
  let n = new ResizeObserver(() => {
3429
- _e.current && (e.scrollTop = e.scrollHeight);
3497
+ X.current && (e.scrollTop = e.scrollHeight);
3430
3498
  });
3431
3499
  return n.observe(t), () => n.disconnect();
3432
3500
  }, [a?.id, o]);
3433
- let be = s ? /* @__PURE__ */ I(jn, { userGoal: s }, c) : null, xe = f ? K(f.subagentId) : void 0, Se = f && xe ? /* @__PURE__ */ I(An, {
3501
+ let be = s ? /* @__PURE__ */ L(In, { userGoal: s }, c) : null, xe = f ? W(f.subagentId) : void 0, Se = f && xe ? /* @__PURE__ */ L(Fn, {
3434
3502
  manifest: xe,
3435
3503
  params: f.snapshot.params,
3436
3504
  taskId: et(f.subagentId, f.entityId),
@@ -3438,30 +3506,30 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3438
3506
  history: f.snapshot.history,
3439
3507
  activity: f.snapshot.activity
3440
3508
  }
3441
- }, p) : null, Ce = g ? K(g.subagentId) : void 0, we = g && Ce ? /* @__PURE__ */ I(Mn, {
3509
+ }, p) : null, Ce = g ? W(g.subagentId) : void 0, we = g && Ce ? /* @__PURE__ */ L(Ln, {
3442
3510
  manifest: Ce,
3443
3511
  extraDestinations: g.extraDestinations
3444
- }, _) : null, Te = x ? K(x.subagentId) : void 0, Ee = x && Te ? /* @__PURE__ */ I(An, {
3512
+ }, _) : null, Te = x ? W(x.subagentId) : void 0, Ee = x && Te ? /* @__PURE__ */ L(Fn, {
3445
3513
  manifest: Te,
3446
3514
  params: x.params,
3447
3515
  extraDestinations: x.extraDestinations
3448
- }, S) : null, De = C ? K(C.subagentId) : void 0, Oe = C && De ? /* @__PURE__ */ I(An, {
3516
+ }, S) : null, De = C ? W(C.subagentId) : void 0, Oe = C && De ? /* @__PURE__ */ L(Fn, {
3449
3517
  manifest: De,
3450
3518
  params: C.params,
3451
3519
  taskId: C.taskId,
3452
3520
  openingMessage: C.openingMessage
3453
3521
  }, w) : null;
3454
- return o ? /* @__PURE__ */ L(ne, { children: [
3522
+ return o ? /* @__PURE__ */ R(I, { children: [
3455
3523
  be,
3456
3524
  Se,
3457
3525
  we,
3458
3526
  Ee,
3459
3527
  Oe,
3460
- /* @__PURE__ */ L("div", {
3528
+ /* @__PURE__ */ R("div", {
3461
3529
  style: { width: z.width },
3462
3530
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
3463
3531
  children: [
3464
- /* @__PURE__ */ I(qt, {
3532
+ /* @__PURE__ */ L(Qt, {
3465
3533
  width: z.width,
3466
3534
  min: z.min,
3467
3535
  max: z.max,
@@ -3469,87 +3537,87 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3469
3537
  onCommit: z.commit,
3470
3538
  onReset: z.reset
3471
3539
  }),
3472
- /* @__PURE__ */ L("div", {
3540
+ /* @__PURE__ */ R("div", {
3473
3541
  className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
3474
3542
  children: [
3475
- /* @__PURE__ */ I("span", {
3543
+ /* @__PURE__ */ L("span", {
3476
3544
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
3477
3545
  children: a ? a.title : "Agentico"
3478
3546
  }),
3479
- a?.thread && E && /* @__PURE__ */ I(t, {
3480
- icon: q ? "activity" : "message-square",
3481
- ariaLabel: q ? D.hideEvents : D.showEvents,
3482
- title: q ? D.hideEvents : D.showEvents,
3547
+ a?.thread && ee && /* @__PURE__ */ L(t, {
3548
+ icon: G ? "activity" : "message-square",
3549
+ ariaLabel: G ? E.hideEvents : E.showEvents,
3550
+ title: G ? E.hideEvents : E.showEvents,
3483
3551
  variant: "link",
3484
- className: `p-1 ${q ? "text-primary" : "text-muted-foreground"}`,
3485
- onClick: () => ie(!q)
3552
+ className: `p-1 ${G ? "text-primary" : "text-muted-foreground"}`,
3553
+ onClick: () => K(!G)
3486
3554
  }),
3487
- T && /* @__PURE__ */ I(Un, {
3555
+ T && /* @__PURE__ */ L(Jn, {
3488
3556
  scopeId: T.id,
3489
3557
  currentTaskId: a?.id ?? null,
3490
- open: ee,
3558
+ open: O,
3491
3559
  onOpenChange: te,
3492
3560
  onNewChat: B,
3493
3561
  onSelect: (e, t, n) => h(e, t, n),
3494
3562
  onArchivedCurrent: m
3495
3563
  }),
3496
- /* @__PURE__ */ I(Jt, {})
3564
+ /* @__PURE__ */ L($t, {})
3497
3565
  ]
3498
3566
  }),
3499
- /* @__PURE__ */ I("div", {
3500
- ref: O,
3501
- className: `flex-1 overflow-y-auto px-3 pb-2 ${X ? "min-h-24" : "min-h-0"}`,
3502
- children: /* @__PURE__ */ I("div", {
3567
+ /* @__PURE__ */ L("div", {
3568
+ ref: D,
3569
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${Y ? "min-h-24" : "min-h-0"}`,
3570
+ children: /* @__PURE__ */ L("div", {
3503
3571
  ref: ye,
3504
3572
  className: "pt-2",
3505
- children: a ? /* @__PURE__ */ L(ne, { children: [
3506
- T && a.thread && /* @__PURE__ */ I(Fn, {
3573
+ children: a ? /* @__PURE__ */ R(I, { children: [
3574
+ T && a.thread && /* @__PURE__ */ L(Bn, {
3507
3575
  scopeId: T.id,
3508
3576
  thread: a.thread,
3509
3577
  taskId: a.id,
3510
- scrollRef: O,
3578
+ scrollRef: D,
3511
3579
  busy: a.agent.running,
3512
- showEvents: q,
3580
+ showEvents: G,
3513
3581
  onLoad: () => {
3514
- _e.current = !1;
3582
+ X.current = !1;
3515
3583
  },
3516
3584
  onContinue: (e) => h(e.subagentId, e.entityId, e)
3517
3585
  }),
3518
- a.manualEntry && V.length === 0 && /* @__PURE__ */ I("p", {
3586
+ a.manualEntry && V.length === 0 && /* @__PURE__ */ L("p", {
3519
3587
  className: "text-xs text-muted-foreground",
3520
3588
  children: a.manualEntry.prompt
3521
3589
  }),
3522
- /* @__PURE__ */ I(It, {
3523
- activity: U,
3524
- questions: Y,
3525
- docked: X,
3526
- pinUserMessages: !X,
3590
+ /* @__PURE__ */ L(Vt, {
3591
+ activity: H,
3592
+ questions: he,
3593
+ docked: Y,
3594
+ pinUserMessages: !Y,
3527
3595
  messageActions: pe,
3528
3596
  speaker: a.speaker,
3529
- events: le
3597
+ events: ue
3530
3598
  }),
3531
- a.panelExtra && /* @__PURE__ */ I("div", {
3599
+ a.panelExtra && /* @__PURE__ */ L("div", {
3532
3600
  className: "mt-3",
3533
3601
  children: a.panelExtra
3534
3602
  }),
3535
- W.length > 0 && /* @__PURE__ */ I(It, {
3536
- activity: W,
3537
- questions: Y,
3538
- docked: X,
3539
- pinUserMessages: !X,
3603
+ U.length > 0 && /* @__PURE__ */ L(Vt, {
3604
+ activity: U,
3605
+ questions: he,
3606
+ docked: Y,
3607
+ pinUserMessages: !Y,
3540
3608
  messageActions: pe,
3541
3609
  speaker: a.speaker,
3542
- events: ue
3610
+ events: de
3543
3611
  }),
3544
- !a.agent.running && a.agent.error && /* @__PURE__ */ L("div", {
3612
+ !a.agent.running && a.agent.error && /* @__PURE__ */ R("div", {
3545
3613
  className: "mt-2 flex items-center gap-2",
3546
3614
  children: [
3547
- /* @__PURE__ */ I("p", {
3615
+ /* @__PURE__ */ L("p", {
3548
3616
  className: "flex-1 text-xs text-destructive",
3549
3617
  children: a.agent.error
3550
3618
  }),
3551
- /* @__PURE__ */ I(t, {
3552
- label: D.retry,
3619
+ /* @__PURE__ */ L(t, {
3620
+ label: E.retry,
3553
3621
  variant: "secondary",
3554
3622
  className: "shrink-0",
3555
3623
  onClick: () => {
@@ -3558,18 +3626,18 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3558
3626
  J(e);
3559
3627
  return;
3560
3628
  }
3561
- a.agent.sendMessage(D.retryMessage, { retry: !0 }).then((e) => {
3629
+ a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
3562
3630
  e && a.onApplied(e);
3563
3631
  });
3564
3632
  }
3565
3633
  }),
3566
- !a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ I(t, {
3567
- label: D.continueWithoutAi,
3634
+ !a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ L(t, {
3635
+ label: E.continueWithoutAi,
3568
3636
  variant: "secondary",
3569
3637
  className: "shrink-0",
3570
3638
  onClick: () => {
3571
- if (ge) {
3572
- y(ge.id, b);
3639
+ if (_e) {
3640
+ y(_e.id, b);
3573
3641
  return;
3574
3642
  }
3575
3643
  let e = a.agent.runFallback();
@@ -3578,66 +3646,66 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3578
3646
  })
3579
3647
  ]
3580
3648
  })
3581
- ] }) : d.length > 0 ? /* @__PURE__ */ I(Hn, { messages: d }) : u ? /* @__PURE__ */ I(Vn, { card: u }) : /* @__PURE__ */ I("p", {
3649
+ ] }) : d.length > 0 ? /* @__PURE__ */ L(qn, { messages: d }) : u ? /* @__PURE__ */ L(Kn, { card: u }) : /* @__PURE__ */ L("p", {
3582
3650
  className: "text-xs text-muted-foreground",
3583
- children: l ?? D.orchestratorStarterHint
3651
+ children: l ?? E.orchestratorStarterHint
3584
3652
  })
3585
3653
  })
3586
3654
  }),
3587
- a && X ? /* @__PURE__ */ L("section", {
3588
- "aria-label": D.pendingQuestions,
3655
+ a && Y ? /* @__PURE__ */ R("section", {
3656
+ "aria-label": E.pendingQuestions,
3589
3657
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
3590
3658
  children: [
3591
- a.panelActions && /* @__PURE__ */ I("div", {
3659
+ a.panelActions && /* @__PURE__ */ L("div", {
3592
3660
  className: "shrink-0 px-4 pt-3",
3593
3661
  children: a.panelActions
3594
3662
  }),
3595
- /* @__PURE__ */ I("div", {
3663
+ /* @__PURE__ */ L("div", {
3596
3664
  className: "min-h-0 overflow-y-auto px-4 py-3",
3597
- children: /* @__PURE__ */ I(jt, {
3598
- entry: X.entry,
3599
- part: X.part,
3600
- questions: Y,
3665
+ children: /* @__PURE__ */ L(It, {
3666
+ entry: Y.entry,
3667
+ part: Y.part,
3668
+ questions: he,
3601
3669
  autoFocus: !0
3602
- }, `${X.entry.id}:${X.part.id}`)
3670
+ }, `${Y.entry.id}:${Y.part.id}`)
3603
3671
  }),
3604
- a.agent.running && /* @__PURE__ */ I("div", {
3672
+ a.agent.running && /* @__PURE__ */ L("div", {
3605
3673
  className: "flex shrink-0 justify-end px-4 pb-3",
3606
- children: /* @__PURE__ */ I(t, {
3674
+ children: /* @__PURE__ */ L(t, {
3607
3675
  icon: "square",
3608
- label: D.stop,
3676
+ label: E.stop,
3609
3677
  variant: "secondary",
3610
3678
  onClick: a.agent.stop
3611
3679
  })
3612
3680
  })
3613
3681
  ]
3614
- }) : /* @__PURE__ */ L("div", {
3682
+ }) : /* @__PURE__ */ R("div", {
3615
3683
  className: "border-t border-border/60 px-4 py-3",
3616
- children: [a?.panelActions && /* @__PURE__ */ I("div", {
3684
+ children: [a?.panelActions && /* @__PURE__ */ L("div", {
3617
3685
  className: "mb-2",
3618
3686
  children: a.panelActions
3619
- }), a ? /* @__PURE__ */ I(Ln, {
3687
+ }), a ? /* @__PURE__ */ L(Hn, {
3620
3688
  task: a,
3621
3689
  editing: k,
3622
3690
  onCancelEdit: () => A(null),
3623
3691
  onSendEdit: (e, t) => J(e, t)
3624
- }, a.id) : /* @__PURE__ */ I(Rn, {})]
3692
+ }, a.id) : /* @__PURE__ */ L(Un, {})]
3625
3693
  }),
3626
- M && /* @__PURE__ */ L(v, {
3627
- title: D.rewindTitle,
3628
- onClose: () => R(null),
3629
- onYes: async () => (de(M.entry, M.text), !0),
3630
- children: [/* @__PURE__ */ I("p", {
3694
+ M && /* @__PURE__ */ R(v, {
3695
+ title: E.rewindTitle,
3696
+ onClose: () => ne(null),
3697
+ onYes: async () => (q(M.entry, M.text), !0),
3698
+ children: [/* @__PURE__ */ L("p", {
3631
3699
  className: "text-sm",
3632
- children: D.rewindText
3633
- }), /* @__PURE__ */ I("ul", {
3700
+ children: E.rewindText
3701
+ }), /* @__PURE__ */ L("ul", {
3634
3702
  className: "mt-2 list-disc space-y-0.5 ps-5 text-sm text-muted-foreground",
3635
- children: M.steps.slice(0, 8).map((e) => /* @__PURE__ */ I("li", { children: e }, e))
3703
+ children: M.steps.slice(0, 8).map((e) => /* @__PURE__ */ L("li", { children: e }, e))
3636
3704
  })]
3637
3705
  })
3638
3706
  ]
3639
3707
  })
3640
- ] }) : /* @__PURE__ */ L(ne, { children: [
3708
+ ] }) : /* @__PURE__ */ R(I, { children: [
3641
3709
  be,
3642
3710
  Se,
3643
3711
  we,
@@ -3647,14 +3715,14 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
3647
3715
  }
3648
3716
  //#endregion
3649
3717
  //#region src/presentation/useAgenticoPageContext.ts
3650
- function Gn(e, t) {
3651
- let { setPageContext: n } = ct(), r = P(crypto.randomUUID()).current;
3718
+ function Xn(e, t) {
3719
+ let { setPageContext: n } = ft(), r = P(crypto.randomUUID()).current;
3652
3720
  j(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
3653
3721
  }
3654
3722
  //#endregion
3655
3723
  //#region src/presentation/useSubagentComponentContext.ts
3656
- function Kn(e, t, n, r, i = !0, a) {
3657
- let { registerComponentAnchor: o } = ct(), s = P(crypto.randomUUID()).current, c = P(n);
3724
+ function Zn(e, t, n, r, i = !0, a) {
3725
+ let { registerComponentAnchor: o } = ft(), s = P(crypto.randomUUID()).current, c = P(n);
3658
3726
  c.current = n, j(() => {
3659
3727
  if (i) return o(s, {
3660
3728
  subagentId: e,
@@ -3672,6 +3740,6 @@ function Kn(e, t, n, r, i = !0, a) {
3672
3740
  ]);
3673
3741
  }
3674
3742
  //#endregion
3675
- export { zt as AGENTICO_MAX_WIDTH, Rt as AGENTICO_MIN_WIDTH, Lt as AGENTICO_WIDTH, Bt as AGENTICO_WIDTH_STORAGE_KEY, Wn as Agentico, st as AgenticoProvider, Jt as AgenticoToggle, z as DEFAULT_REASONING_PART_ID, R as DEFAULT_TEXT_PART_ID, Ce as JSON_EXPORT_DESTINATION_ID, ve as MICRO_PROMPT_REGISTRY, at as ORCHESTRATOR_TASK_ID, _e as SUMMARY_MICRO_PROMPT, Ae as agenticoDe, Oe as agenticoEn, ke as agenticoIt, le as agenticoPromptsEn, ue as agenticoPromptsIt, it as agenticoTranslations, ye as applyMicroPrompts, Ye as chatHasPersonMessage, Q as chatStartedAt, tt as chatThreadOf, Je as chatTitle, fe as configureAgenticoPrompts, Ne as configureEntityChatStore, ae as createCrossAgentTools, re as defineSubagent, nt as earlierSessions, et as entityChatTaskId, be as extractErrorMessage, xe as extractJsonBlock, K as findSubagentManifest, H as formatQuestionAnswers, J as getAgenticoPrompts, De as getDestinationRegistry, Ue as getEntityChat, Sn as getSubagentControls, G as getSubagentRegistry, _n as getSubagentReport, Pe as hasEntityChatBackend, we as jsonExportDestination, $e as listEntityChats, V as messagePartsText, Ve as onEntityChatsChange, rt as placeEvents, ie as registerCrossAgentTools, Ee as registerDestinations, xn as registerSubagentControls, gn as registerSubagentReports, W as registerSubagents, Qe as removeEntityChat, Ze as renameEntityChat, ge as renderRegistryCli, he as renderSubagentCli, pe as resetAgenticoPrompts, We as saveEntityChat, Le as syncEntityChats, oe as toJsonSchema, se as toMcpTool, B as upsertMessagePart, sn as useAgent, ct as useAgentico, $ as useAgenticoI18n, Gn as useAgenticoPageContext, Kn as useSubagentComponentContext };
3743
+ export { Wt as AGENTICO_MAX_WIDTH, Ut as AGENTICO_MIN_WIDTH, Ht as AGENTICO_WIDTH, Gt as AGENTICO_WIDTH_STORAGE_KEY, Yn as Agentico, dt as AgenticoProvider, $t as AgenticoToggle, z as DEFAULT_REASONING_PART_ID, ne as DEFAULT_TEXT_PART_ID, Ce as JSON_EXPORT_DESTINATION_ID, ve as MICRO_PROMPT_REGISTRY, lt as ORCHESTRATOR_TASK_ID, at as PREVIEW_LIMIT, it as PREVIEW_MAX, X as SUMMARY_MICRO_PROMPT, Ae as agenticoDe, Oe as agenticoEn, ke as agenticoIt, ue as agenticoPromptsEn, de as agenticoPromptsIt, ct as agenticoTranslations, ye as applyMicroPrompts, Ye as chatHasPersonMessage, Q as chatStartedAt, tt as chatThreadOf, Je as chatTitle, fe as configureAgenticoPrompts, Ne as configureEntityChatStore, oe as createCrossAgentTools, ie as defineSubagent, nt as earlierSessions, et as entityChatTaskId, be as extractErrorMessage, xe as extractJsonBlock, W as findSubagentManifest, re as formatQuestionAnswers, J as getAgenticoPrompts, De as getDestinationRegistry, Ue as getEntityChat, Dn as getSubagentControls, ae as getSubagentRegistry, Sn as getSubagentReport, Pe as hasEntityChatBackend, st as imagePreviews, we as jsonExportDestination, $e as listEntityChats, V as messagePartsText, Ve as onEntityChatsChange, rt as placeEvents, K as registerCrossAgentTools, Ee as registerDestinations, En as registerSubagentControls, xn as registerSubagentReports, U as registerSubagents, Qe as removeEntityChat, Ze as renameEntityChat, _e as renderRegistryCli, ge as renderSubagentCli, pe as resetAgenticoPrompts, We as saveEntityChat, Le as syncEntityChats, se as toJsonSchema, ce as toMcpTool, B as upsertMessagePart, fn as useAgent, ft as useAgentico, $ as useAgenticoI18n, Xn as useAgenticoPageContext, Zn as useSubagentComponentContext };
3676
3744
 
3677
3745
  //# sourceMappingURL=index.mjs.map