@llmnative/agentico 0.10.3 → 0.12.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,10 +1,10 @@
1
1
  import { zodToJsonSchema as e } from "zod-to-json-schema";
2
2
  import { ActionButton as t, Badge as n, ChatMarkdown as r, ChatQuestions as i, ChatReasoning as a, Chatbot as o, Code as s, Dropdown as c, DropdownItem as l, Form as u, Icon as d, Input as f, Modal as p, PromptUtils as m, Tree as h, getAIModelCatalog as g, interpolate as _, parseAIModelRef as v, proxyFetch as y, useAIProviderRegistry as b, useFormController as x, useI18n as S, useProxy as C } from "@llmnative/react";
3
3
  import { createContext as w, useCallback as T, useContext as E, useEffect as D, useLayoutEffect as O, useMemo as k, useRef as A, useState as j } from "react";
4
- import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
4
+ import { Fragment as ee, jsx as M, jsxs as N } from "react/jsx-runtime";
5
5
  //#region src/domain/messageParts.ts
6
- var F = "text", ee = "reasoning";
7
- function I(e, t, n) {
6
+ var P = "text", te = "reasoning";
7
+ function F(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);
10
10
  let i = t.type === "reasoning" || !n ? e : e.map((e) => e.type === "reasoning" && e.streaming ? n(e) : e), a = i.findIndex((e) => e.type === "text" && e.id === "text");
@@ -14,59 +14,59 @@ function I(e, t, n) {
14
14
  ...i.slice(a)
15
15
  ] : [...i, t];
16
16
  }
17
- function L(e) {
17
+ function ne(e) {
18
18
  return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
19
19
  }
20
- function R(e, t) {
20
+ function I(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 z(e) {
25
+ function re(e) {
26
26
  return e;
27
27
  }
28
28
  //#endregion
29
29
  //#region src/domain/subagentRegistry.ts
30
- var B = [];
31
- function te(e) {
32
- B = e;
30
+ var L = [];
31
+ function ie(e) {
32
+ L = e;
33
33
  }
34
- function V() {
35
- return B.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), B;
34
+ function R() {
35
+ return L.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), L;
36
36
  }
37
- function H(e) {
38
- return B.find((t) => t.id === e);
37
+ function z(e) {
38
+ return L.find((t) => t.id === e);
39
39
  }
40
40
  //#endregion
41
41
  //#region src/domain/crossAgentTools.ts
42
- var U = [];
43
- function W(...e) {
44
- U = e;
42
+ var B = [];
43
+ function V(...e) {
44
+ B = e;
45
45
  }
46
- function G(e) {
47
- return U.flatMap((t) => t(e));
46
+ function H(e) {
47
+ return B.flatMap((t) => t(e));
48
48
  }
49
49
  //#endregion
50
50
  //#region src/domain/mcpTool.ts
51
- function K(t) {
51
+ function U(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 q(e, t, n, r) {
58
+ function W(e, t, n, r) {
59
59
  return {
60
60
  name: e,
61
61
  description: t,
62
- inputSchema: K(n),
63
- ...r ? { outputSchema: K(r) } : {}
62
+ inputSchema: U(n),
63
+ ...r ? { outputSchema: U(r) } : {}
64
64
  };
65
65
  }
66
66
  //#endregion
67
67
  //#region src/domain/subagentUsageCard.ts
68
- function ne(e) {
69
- let t = K(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function ae(e) {
69
+ let t = U(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 ne(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/domain/prompts.ts
83
- var J = {
83
+ var oe = {
84
84
  orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
85
85
  responseRules: [
86
86
  "BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
@@ -110,7 +110,7 @@ var J = {
110
110
  ].join(" "),
111
111
  multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on.",
112
112
  chatTitle: "Write a title for this chat, as a list of chats shows it: 3 to 6 words saying what it is about, in the language the person writes in. Answer with the title only: no quotes, no final period.\n\n{chat}"
113
- }, Y = {
113
+ }, G = {
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 J = {
140
140
  ].join(" "),
141
141
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
142
142
  chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
143
- }, re = J;
144
- function ie(e) {
145
- re = {
146
- ...re,
143
+ }, se = oe;
144
+ function ce(e) {
145
+ se = {
146
+ ...se,
147
147
  ...e
148
148
  };
149
149
  }
150
- function X() {
151
- return re;
150
+ function K() {
151
+ return se;
152
152
  }
153
- function ae() {
154
- re = J;
153
+ function le() {
154
+ se = oe;
155
155
  }
156
156
  //#endregion
157
157
  //#region src/domain/cli/renderManifestCli.ts
158
- function oe(e, t) {
158
+ function ue(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 se(e, t) {
162
- let n = ne(t), r = oe(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
161
+ function q(e, t) {
162
+ let n = ae(t), r = ue(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,46 +171,46 @@ function se(e, t) {
171
171
  ...i,
172
172
  "",
173
173
  " OUTPUT",
174
- Z(t.describeOutput(), 4),
174
+ J(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 Z(e, t) {
180
+ function J(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 ce(e) {
184
+ function de(e) {
185
185
  return [
186
186
  "NAME",
187
187
  ` ${e.id} — ${e.label}`,
188
188
  "",
189
189
  "DESCRIPTION",
190
- Z(e.description, 2),
190
+ J(e.description, 2),
191
191
  "",
192
- ...e.commands.map((t) => se(e.id, t))
192
+ ...e.commands.map((t) => q(e.id, t))
193
193
  ].join("\n");
194
194
  }
195
- function le(e) {
196
- return e.length === 0 ? X().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
195
+ function Y(e) {
196
+ return e.length === 0 ? K().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 ue = {
200
+ var fe = {
201
201
  id: "closing-summary",
202
202
  get text() {
203
- return X().closingSummary;
203
+ return K().closingSummary;
204
204
  }
205
- }, de = { [ue.id]: ue };
206
- function fe(e, t) {
205
+ }, pe = { [fe.id]: fe };
206
+ function me(e, t) {
207
207
  if (!t || t.length === 0) return e;
208
- let n = t.map((e) => de[e]?.text).filter((e) => !!e);
208
+ let n = t.map((e) => pe[e]?.text).filter((e) => !!e);
209
209
  return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
210
210
  }
211
211
  //#endregion
212
212
  //#region src/domain/extractErrorMessage.ts
213
- function pe(e) {
213
+ function X(e) {
214
214
  if (e instanceof Error) return e.message;
215
215
  if (typeof e == "object" && e) {
216
216
  let t = e;
@@ -229,13 +229,13 @@ function pe(e) {
229
229
  }
230
230
  //#endregion
231
231
  //#region src/domain/extractJsonBlock.ts
232
- function me(e) {
232
+ function he(e) {
233
233
  let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
234
234
  if (t) return t[1].trim();
235
235
  let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
236
- return he(n) ?? n;
236
+ return ge(n) ?? n;
237
237
  }
238
- function he(e) {
238
+ function ge(e) {
239
239
  let t = e.search(/[{[]/);
240
240
  if (t === -1) return null;
241
241
  let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
@@ -256,8 +256,8 @@ function he(e) {
256
256
  }
257
257
  //#endregion
258
258
  //#region src/domain/jsonExportDestination.ts
259
- var ge = "json-export", _e = {
260
- id: ge,
259
+ var _e = "json-export", ve = {
260
+ id: _e,
261
261
  label: "Export as JSON",
262
262
  async apply(e) {
263
263
  let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
@@ -268,19 +268,19 @@ var ge = "json-export", _e = {
268
268
  URL.revokeObjectURL(n);
269
269
  }
270
270
  }
271
- }, ve = {};
272
- function ye(e) {
273
- ve = e;
271
+ }, ye = {};
272
+ function be(e) {
273
+ ye = e;
274
274
  }
275
- function be() {
275
+ function xe() {
276
276
  return {
277
- [_e.id]: _e,
278
- ...ve
277
+ [ve.id]: ve,
278
+ ...ye
279
279
  };
280
280
  }
281
281
  //#endregion
282
282
  //#region src/i18n/en.ts
283
- var xe = {
283
+ var Se = {
284
284
  modelLabel: "Model",
285
285
  modelsLoading: "Loading…",
286
286
  noModelsAvailable: "No models available",
@@ -341,7 +341,7 @@ var xe = {
341
341
  resizePanelHint: "Drag to resize, double-click to reset",
342
342
  pendingQuestions: "Questions of the agent",
343
343
  stop: "Stop"
344
- }, Se = {
344
+ }, Ce = {
345
345
  modelLabel: "Modello",
346
346
  modelsLoading: "Caricamento…",
347
347
  noModelsAvailable: "Nessun modello disponibile",
@@ -402,7 +402,7 @@ var xe = {
402
402
  resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
403
403
  pendingQuestions: "Domande dell'agente",
404
404
  stop: "Ferma"
405
- }, Ce = {
405
+ }, we = {
406
406
  modelLabel: "Modell",
407
407
  modelsLoading: "Wird geladen…",
408
408
  noModelsAvailable: "Keine Modelle verfügbar",
@@ -463,11 +463,39 @@ var xe = {
463
463
  resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
464
464
  pendingQuestions: "Fragen des Agenten",
465
465
  stop: "Stoppen"
466
- }, we = "llmnative.agentico.entityChat";
467
- function Te(e) {
468
- we = e.storageKey;
466
+ }, Te = "llmnative.agentico.entityChat", Ee;
467
+ function De(e) {
468
+ Te = e.storageKey, Ee = e.backend;
469
+ }
470
+ var Oe = () => !!Ee, ke = ({ synced: e, ...t }) => t;
471
+ function Ae(e) {
472
+ if (!Ee) return;
473
+ let t = Z(e.scopeId, e.subagentId, e.entityId);
474
+ Promise.resolve(Ee.save(ke(e))).then(() => {
475
+ let e = Ne(), n = e.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === t);
476
+ n && !n.synced && Ie(e.map((e) => e === n ? {
477
+ ...e,
478
+ synced: !0
479
+ } : e));
480
+ }, () => void 0);
469
481
  }
470
- function Ee(e) {
482
+ async function je(e) {
483
+ if (!Ee) return;
484
+ let t = (await Ee.load(e)).map(Me).filter((t) => t !== null && t.scopeId === e), n = (e) => e.changedAt ?? e.savedAt, r = Ne(), i = r.filter((t) => t.scopeId !== e), a = r.filter((t) => t.scopeId === e), o = t.map((e) => {
485
+ let t = a.find((t) => Z(t.scopeId, t.subagentId, t.entityId) === Z(e.scopeId, e.subagentId, e.entityId));
486
+ return t && n(t) > n(e) ? (Ae(t), t) : {
487
+ ...e,
488
+ synced: !0
489
+ };
490
+ }), s = a.filter((e) => !e.synced && !t.some((t) => Z(t.scopeId, t.subagentId, t.entityId) === Z(e.scopeId, e.subagentId, e.entityId)));
491
+ Ie([
492
+ ...i,
493
+ ...o,
494
+ ...s
495
+ ]);
496
+ for (let e of s) Ae(e);
497
+ }
498
+ function Me(e) {
471
499
  if (!e || typeof e != "object") return null;
472
500
  let t = e;
473
501
  if (typeof t.entityId != "string") return null;
@@ -479,92 +507,102 @@ function Ee(e) {
479
507
  scopeId: n
480
508
  };
481
509
  }
482
- function De() {
510
+ function Ne() {
483
511
  try {
484
- let e = localStorage.getItem(we);
512
+ let e = localStorage.getItem(Te);
485
513
  if (!e) return [];
486
514
  let t = JSON.parse(e);
487
- return Array.isArray(t) ? t.map(Ee).filter((e) => e !== null) : [];
515
+ return Array.isArray(t) ? t.map(Me).filter((e) => e !== null) : [];
488
516
  } catch {
489
517
  return [];
490
518
  }
491
519
  }
492
- var Oe = /* @__PURE__ */ new Set();
493
- function ke(e) {
494
- return Oe.add(e), () => {
495
- Oe.delete(e);
520
+ var Pe = /* @__PURE__ */ new Set();
521
+ function Fe(e) {
522
+ return Pe.add(e), () => {
523
+ Pe.delete(e);
496
524
  };
497
525
  }
498
- function Ae(e) {
526
+ function Ie(e) {
499
527
  try {
500
- localStorage.setItem(we, JSON.stringify(e));
528
+ localStorage.setItem(Te, JSON.stringify(e));
501
529
  } catch {}
502
- for (let e of [...Oe]) e();
530
+ for (let e of [...Pe]) e();
503
531
  }
504
- var je = (e, t, n) => `${e}:${t}:${n}`;
505
- function Me(e, t, n) {
506
- let r = je(e, t, n);
507
- return De().find((e) => je(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
532
+ var Z = (e, t, n) => `${e}:${t}:${n}`;
533
+ function Le(e, t, n) {
534
+ let r = Z(e, t, n);
535
+ return Ne().find((e) => Z(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
508
536
  }
509
- function Ne(e) {
510
- let t = je(e.scopeId, e.subagentId, e.entityId), n = De(), r = n.find((e) => je(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r);
511
- a.push({
537
+ function Re(e) {
538
+ let t = Z(e.scopeId, e.subagentId, e.entityId), n = Ne(), r = n.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r), o = {
512
539
  ...e,
513
540
  savedAt: i,
514
- startedAt: r ? Ve(r) : i,
541
+ changedAt: i,
542
+ startedAt: r ? Ke(r) : i,
515
543
  ...r?.name ? {
516
544
  name: r.name,
517
545
  namedBy: r.namedBy
518
- } : {}
519
- }), Ae(a);
546
+ } : {},
547
+ ...r?.synced ? { synced: !0 } : {}
548
+ };
549
+ a.push(o), Ie(a), Ae(o);
520
550
  }
521
- var Pe = new Set([
522
- xe,
551
+ var ze = new Set([
523
552
  Se,
524
- Ce
525
- ].map((e) => e.retryMessage.trim().toLowerCase())), Fe = (e) => e.kind === "user" && !!e.detail?.trim() && !e.retry && !Pe.has(e.detail.trim().toLowerCase()), Ie = (e) => {
526
- let t = (e.activity.find(Fe)?.detail ?? "").trim().split("\n")[0].trim();
553
+ Ce,
554
+ we
555
+ ].map((e) => e.retryMessage.trim().toLowerCase())), Be = (e) => e.kind === "user" && !!e.detail?.trim() && !e.retry && !ze.has(e.detail.trim().toLowerCase()), Ve = (e) => {
556
+ let t = (e.activity.find(Be)?.detail ?? "").trim().split("\n")[0].trim();
527
557
  return t.length > 80 ? `${t.slice(0, 80).trimEnd()}…` : t;
528
- }, Le = (e) => e.name || Ie(e) || e.title || e.entityId, Re = (e) => e.activity.some(Fe), ze = (e) => e.kind === "user" && !Fe(e) && !!e.detail?.trim();
529
- function Be(e, t, n, r, i = "person") {
530
- let a = je(e, t, n), o = De(), s = o.find((e) => je(e.scopeId, e.subagentId, e.entityId) === a);
558
+ }, He = (e) => e.name || Ve(e) || e.title || e.entityId, Ue = (e) => e.activity.some(Be), We = (e) => e.kind === "user" && !Be(e) && !!e.detail?.trim();
559
+ function Ge(e, t, n, r, i = "person") {
560
+ let a = Z(e, t, n), o = Ne(), s = o.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === a);
531
561
  if (!s || i === "model" && s.namedBy === "person") return !1;
532
562
  let c = r.trim().replace(/\s+/g, " ").slice(0, 120), { name: l, namedBy: u, ...d } = s, f = c ? {
533
563
  ...d,
534
564
  name: c,
535
- namedBy: i
536
- } : d;
537
- return Ae(o.map((e) => e === s ? f : e)), !0;
538
- }
539
- var Ve = (e) => e.startedAt ?? e.savedAt;
540
- function He(e, t, n) {
541
- let r = je(e, t, n);
542
- Ae(De().filter((e) => je(e.scopeId, e.subagentId, e.entityId) !== r));
543
- }
544
- function Ue(e) {
545
- return De().filter((t) => t.scopeId === e).sort((e, t) => Ve(t) - Ve(e));
546
- }
547
- var We = (e, t) => `entitychat-${e}-${t}`, Ge = {
548
- en: { agentico: xe },
549
- it: { agentico: Se },
550
- de: { agentico: Ce }
565
+ namedBy: i,
566
+ changedAt: Date.now()
567
+ } : {
568
+ ...d,
569
+ changedAt: Date.now()
570
+ };
571
+ return Ie(o.map((e) => e === s ? f : e)), Ae(f), !0;
572
+ }
573
+ var Ke = (e) => e.startedAt ?? e.savedAt;
574
+ function qe(e, t, n) {
575
+ let r = Z(e, t, n);
576
+ Ie(Ne().filter((e) => Z(e.scopeId, e.subagentId, e.entityId) !== r)), Ee && Promise.resolve(Ee.remove(e, t, n)).catch(() => void 0);
577
+ }
578
+ function Je(e) {
579
+ return Ne().filter((t) => t.scopeId === e).sort((e, t) => Ke(t) - Ke(e));
580
+ }
581
+ var Ye = (e, t) => `entitychat-${e}-${t}`, Xe = {
582
+ en: { agentico: Se },
583
+ it: { agentico: Ce },
584
+ de: { agentico: we }
551
585
  };
552
586
  function Q() {
553
587
  let { dict: e } = S(), t = e.agentico;
554
588
  return t ? {
555
- ...xe,
589
+ ...Se,
556
590
  ...t
557
- } : xe;
591
+ } : Se;
558
592
  }
559
593
  //#endregion
560
594
  //#region src/presentation/AgenticoContext.tsx
561
- var Ke = "agentico-orchestrator", qe = w(null);
562
- function Je({ children: e, scope: t = null }) {
595
+ var Ze = "agentico-orchestrator", Qe = w(null);
596
+ function $e({ children: e, scope: t = null }) {
563
597
  let [n, r] = j(null), i = A(null);
564
598
  D(() => {
565
599
  i.current = n;
566
600
  }, [n]);
567
- let [a, o] = j(!1), s = T((e) => {
601
+ let [a, o] = j(!1), s = t?.id;
602
+ D(() => {
603
+ s && je(s).catch(() => void 0);
604
+ }, [s]);
605
+ let c = T((e) => {
568
606
  let t = i.current;
569
607
  t && t.id !== e.id && t.onDismiss();
570
608
  let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
@@ -572,10 +610,10 @@ function Je({ children: e, scope: t = null }) {
572
610
  savedToDisk: !0
573
611
  } : e;
574
612
  r(n);
575
- }, []), c = T((e) => {
613
+ }, []), l = T((e) => {
576
614
  r((t) => t && t.id === e ? null : t);
577
- }, []), l = T(() => o((e) => !e), []), u = T(() => o(!0), []), [d, f] = j(null), [p, m] = j(void 0), [h, g] = j(void 0), [_, v] = j(void 0), [y, b] = j(null), [x, S] = j(null), [C, w] = j(void 0), [E, O] = j([]), M = T((e, t, n = null) => {
578
- O((r) => {
615
+ }, []), u = T(() => o((e) => !e), []), d = T(() => o(!0), []), [f, p] = j(null), [m, h] = j(void 0), [g, _] = j(void 0), [v, y] = j(void 0), [b, x] = j(null), [S, C] = j(null), [w, E] = j(void 0), [O, ee] = j([]), N = T((e, t, n = null) => {
616
+ ee((r) => {
579
617
  let i = r.filter((t) => t.id !== e);
580
618
  return t ? [...i, {
581
619
  id: e,
@@ -583,30 +621,30 @@ function Je({ children: e, scope: t = null }) {
583
621
  card: n
584
622
  }] : i;
585
623
  });
586
- }, []), P = E.length > 0 ? E[E.length - 1] : null, [F, ee] = j([]), I = T((e, t) => {
587
- ee((n) => {
624
+ }, []), P = O.length > 0 ? O[O.length - 1] : null, [te, F] = j([]), ne = T((e, t) => {
625
+ F((n) => {
588
626
  let r = n.filter((t) => t.id !== e);
589
627
  return t ? [...r, {
590
628
  id: e,
591
629
  ...t
592
630
  }] : r;
593
631
  });
594
- }, []), L = k(() => F.map((e) => ({
632
+ }, []), I = k(() => te.map((e) => ({
595
633
  subagentId: e.subagentId,
596
634
  componentKey: e.componentKey,
597
635
  onResult: e.onResult,
598
636
  pinnedEntityId: e.pinnedEntityId
599
- })), [F]), R = k(() => {
637
+ })), [te]), re = k(() => {
600
638
  let e = /* @__PURE__ */ new Map();
601
- for (let t of F) e.set(t.subagentId, {
639
+ for (let t of te) e.set(t.subagentId, {
602
640
  subagentId: t.subagentId,
603
641
  componentKey: t.componentKey,
604
642
  onResult: t.onResult,
605
643
  contextInfo: t.contextInfo
606
644
  });
607
645
  return [...e.values()];
608
- }, [F]), z = k(() => R.map((e) => {
609
- let t = H(e.subagentId)?.componentContexts?.[e.componentKey];
646
+ }, [te]), L = k(() => re.map((e) => {
647
+ let t = z(e.subagentId)?.componentContexts?.[e.componentKey];
610
648
  if (!t) return null;
611
649
  let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
612
650
  return {
@@ -614,26 +652,26 @@ function Je({ children: e, scope: t = null }) {
614
652
  agenticoHint: n,
615
653
  userMessage: t.userMessage
616
654
  };
617
- }).filter((e) => e !== null), [R]), B = k(() => z.map((e) => e.userMessage), [z]), te = k(() => {
618
- if (z.length === 0) return null;
619
- if (z.length === 1) return z[0].agenticoHint;
620
- let e = z.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
621
- return `${X().multipleCandidates}\n\n${e}`;
622
- }, [z]) ?? P?.text ?? null, V = z.length > 0 ? null : P?.card ?? null, U = k(() => [...new Set(L.map((e) => e.subagentId))], [L]), W = U.length === 1 ? U[0] : U.length === 0 ? P?.card?.subagentId ?? null : null, G = T((e, t) => {
623
- u();
655
+ }).filter((e) => e !== null), [re]), ie = k(() => L.map((e) => e.userMessage), [L]), R = k(() => {
656
+ if (L.length === 0) return null;
657
+ if (L.length === 1) return L[0].agenticoHint;
658
+ let e = L.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
659
+ return `${K().multipleCandidates}\n\n${e}`;
660
+ }, [L]) ?? P?.text ?? null, B = L.length > 0 ? null : P?.card ?? null, V = k(() => [...new Set(I.map((e) => e.subagentId))], [I]), H = V.length === 1 ? V[0] : V.length === 0 ? P?.card?.subagentId ?? null : null, U = T((e, t) => {
661
+ d();
624
662
  let n = i.current;
625
663
  if (n?.id === "agentico-orchestrator") return;
626
- let r = W && n?.id.startsWith(`subagent-${W}-`) ? n : void 0;
627
- S(r ? {
664
+ let r = H && n?.id.startsWith(`subagent-${H}-`) ? n : void 0;
665
+ C(r ? {
628
666
  taskId: r.id,
629
667
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
630
- } : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), w(t?.scopedSubagentId), b(crypto.randomUUID());
631
- }, [u, W]), K = T((e, t, n, a, o, s) => {
668
+ } : null), p(e), h(t?.extraDestinations), _(t?.attachments), y(t?.model), E(t?.scopedSubagentId), x(crypto.randomUUID());
669
+ }, [d, H]), W = T((e, t, n, a, o, s) => {
632
670
  if (!n || !a) return;
633
671
  let c = i.current;
634
672
  if (!c || c.id !== n) return;
635
673
  let l = c.agent.snapshot();
636
- l && (Ne({
674
+ l && (Re({
637
675
  scopeId: a,
638
676
  subagentId: e,
639
677
  entityId: t,
@@ -645,120 +683,120 @@ function Je({ children: e, scope: t = null }) {
645
683
  ...e,
646
684
  savedToDisk: !0
647
685
  } : e));
648
- }, []), [q, ne] = j(null), [J, Y] = j(null), re = T((e, t, n) => {
649
- u(), ne({
686
+ }, []), [ae, oe] = j(null), [G, se] = j(null), ce = T((e, t, n) => {
687
+ d(), oe({
650
688
  subagentId: e,
651
689
  entityId: t,
652
690
  snapshot: n
653
- }), Y(crypto.randomUUID());
654
- }, [u]), [ie, ae] = j(null), [oe, se] = j(null), Z = T((e, t) => {
655
- u(), c(Ke), ae({
691
+ }), se(crypto.randomUUID());
692
+ }, [d]), [le, ue] = j(null), [q, J] = j(null), de = T((e, t) => {
693
+ d(), l(Ze), ue({
656
694
  subagentId: e,
657
695
  extraDestinations: t
658
- }), se(crypto.randomUUID());
659
- }, [u, c]), [ce, le] = j(null), [ue, de] = j(null), fe = T((e, t, n) => {
660
- ae(null), le({
696
+ }), J(crypto.randomUUID());
697
+ }, [d, l]), [Y, fe] = j(null), [pe, me] = j(null), X = T((e, t, n) => {
698
+ ue(null), fe({
661
699
  subagentId: e,
662
700
  params: t,
663
701
  extraDestinations: n
664
- }), de(crypto.randomUUID());
665
- }, []), [pe, me] = j(null), [he, ge] = j(null), _e = T((e, t, n) => {
666
- u(), me({
702
+ }), me(crypto.randomUUID());
703
+ }, []), [he, ge] = j(null), [_e, ve] = j(null), ye = T((e, t, n) => {
704
+ d(), ge({
667
705
  subagentId: e,
668
706
  params: t,
669
707
  ...n
670
- }), ge(crypto.randomUUID());
671
- }, [u]), ve = T(() => {
708
+ }), ve(crypto.randomUUID());
709
+ }, [d]), be = T(() => {
672
710
  let e = i.current;
673
711
  e && e.onDismiss();
674
- }, []), ye = k(() => ({
712
+ }, []), xe = k(() => ({
675
713
  scope: t,
676
714
  task: n,
677
715
  isOpen: a,
678
- openTask: s,
679
- closeTask: c,
680
- toggleOpen: l,
681
- pendingGoal: d,
682
- startOrchestrator: G,
683
- pageContext: te,
684
- pageContextCard: V,
685
- setPageContext: M,
686
- scopedSubagentId: W,
687
- pendingScopedSubagentId: C,
688
- componentAnchors: L,
689
- anchoredUserMessages: B,
690
- registerComponentAnchor: I,
691
- openPanel: u,
692
- pendingExtraDestinations: p,
693
- pendingAttachments: h,
694
- pendingModel: _,
695
- orchestratorRunId: y,
696
- pendingCarryOver: x,
697
- commitEntityChat: K,
698
- resumeEntityChat: re,
699
- pendingResume: q,
700
- resumeRunId: J,
701
- dismissForeignTask: ve,
702
- pendingManualEntry: ie,
703
- manualEntryRunId: oe,
704
- startManualEntry: Z,
705
- pendingResumeWithAI: ce,
706
- resumeWithAIRunId: ue,
707
- resumeWithAI: fe,
708
- startSubagent: _e,
709
- pendingStart: pe,
710
- startRunId: he
716
+ openTask: c,
717
+ closeTask: l,
718
+ toggleOpen: u,
719
+ pendingGoal: f,
720
+ startOrchestrator: U,
721
+ pageContext: R,
722
+ pageContextCard: B,
723
+ setPageContext: N,
724
+ scopedSubagentId: H,
725
+ pendingScopedSubagentId: w,
726
+ componentAnchors: I,
727
+ anchoredUserMessages: ie,
728
+ registerComponentAnchor: ne,
729
+ openPanel: d,
730
+ pendingExtraDestinations: m,
731
+ pendingAttachments: g,
732
+ pendingModel: v,
733
+ orchestratorRunId: b,
734
+ pendingCarryOver: S,
735
+ commitEntityChat: W,
736
+ resumeEntityChat: ce,
737
+ pendingResume: ae,
738
+ resumeRunId: G,
739
+ dismissForeignTask: be,
740
+ pendingManualEntry: le,
741
+ manualEntryRunId: q,
742
+ startManualEntry: de,
743
+ pendingResumeWithAI: Y,
744
+ resumeWithAIRunId: pe,
745
+ resumeWithAI: X,
746
+ startSubagent: ye,
747
+ pendingStart: he,
748
+ startRunId: _e
711
749
  }), [
712
750
  t,
713
751
  n,
714
752
  a,
715
- s,
716
753
  c,
717
754
  l,
718
- d,
719
- G,
720
- te,
721
- V,
722
- M,
723
- W,
724
- C,
725
- L,
755
+ u,
756
+ f,
757
+ U,
758
+ R,
726
759
  B,
760
+ N,
761
+ H,
762
+ w,
727
763
  I,
728
- u,
729
- p,
730
- h,
731
- _,
732
- y,
733
- x,
734
- K,
735
- re,
736
- q,
737
- J,
738
- ve,
739
764
  ie,
740
- oe,
741
- Z,
765
+ ne,
766
+ d,
767
+ m,
768
+ g,
769
+ v,
770
+ b,
771
+ S,
772
+ W,
742
773
  ce,
743
- ue,
744
- fe,
745
- _e,
774
+ ae,
775
+ G,
776
+ be,
777
+ le,
778
+ q,
779
+ de,
780
+ Y,
746
781
  pe,
747
- he
782
+ X,
783
+ ye,
784
+ he,
785
+ _e
748
786
  ]);
749
- return /* @__PURE__ */ N(qe.Provider, {
750
- value: ye,
787
+ return /* @__PURE__ */ M(Qe.Provider, {
788
+ value: xe,
751
789
  children: e
752
790
  });
753
791
  }
754
792
  function $() {
755
- let e = E(qe);
793
+ let e = E(Qe);
756
794
  if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
757
795
  return e;
758
796
  }
759
797
  //#endregion
760
798
  //#region src/presentation/AgentActivityLog.tsx
761
- function Ye(e) {
799
+ function et(e) {
762
800
  let t = e.search(/[{[]/);
763
801
  if (t === -1) return [{
764
802
  type: "text",
@@ -804,97 +842,97 @@ function Ye(e) {
804
842
  language: "json"
805
843
  });
806
844
  let u = e.slice(s + 1);
807
- return u.trim() && l.push(...Ye(u)), l;
845
+ return u.trim() && l.push(...et(u)), l;
808
846
  }
809
- function Xe(e) {
847
+ function tt(e) {
810
848
  let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
811
- for (; i = n.exec(e);) i.index > r && t.push(...Ye(e.slice(r, i.index))), t.push({
849
+ for (; i = n.exec(e);) i.index > r && t.push(...et(e.slice(r, i.index))), t.push({
812
850
  type: "code",
813
851
  content: i[2].replace(/\n$/, ""),
814
852
  language: i[1]
815
853
  }), r = n.lastIndex;
816
- return r < e.length && t.push(...Ye(e.slice(r))), t;
854
+ return r < e.length && t.push(...et(e.slice(r))), t;
817
855
  }
818
- function Ze({ content: e, language: t }) {
856
+ function nt({ content: e, language: t }) {
819
857
  let [n, r] = j(!1);
820
- return /* @__PURE__ */ P("div", {
858
+ return /* @__PURE__ */ N("div", {
821
859
  className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
822
860
  onClick: () => r((e) => !e),
823
861
  title: n ? "Clic per comprimere" : "Clic per espandere",
824
- children: [/* @__PURE__ */ N(s, {
862
+ children: [/* @__PURE__ */ M(s, {
825
863
  language: t,
826
864
  showCopy: n,
827
865
  background: "transparent",
828
866
  className: "!text-[11px]",
829
867
  children: e
830
- }), !n && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
868
+ }), !n && /* @__PURE__ */ M("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
831
869
  });
832
870
  }
833
- function Qe({ text: e, tone: t }) {
834
- let n = Xe(e);
835
- return /* @__PURE__ */ N(M, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ N(Ze, {
871
+ function rt({ text: e, tone: t }) {
872
+ let n = tt(e);
873
+ return /* @__PURE__ */ M(ee, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ M(nt, {
836
874
  content: e.content,
837
875
  language: e.language
838
- }, n) : e.content.trim() && /* @__PURE__ */ N(r, {
876
+ }, n) : e.content.trim() && /* @__PURE__ */ M(r, {
839
877
  content: e.content.trim(),
840
878
  tone: t,
841
879
  className: "break-words text-xs leading-relaxed"
842
880
  }, n)) });
843
881
  }
844
- function $e({ status: e }) {
845
- return e === "running" ? /* @__PURE__ */ N("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ N(d, {
882
+ function it({ status: e }) {
883
+ return e === "running" ? /* @__PURE__ */ M("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ M(d, {
846
884
  name: "check",
847
885
  size: 12,
848
886
  className: "shrink-0 text-green-600"
849
- }) : e === "stopped" ? /* @__PURE__ */ N(d, {
887
+ }) : e === "stopped" ? /* @__PURE__ */ M(d, {
850
888
  name: "circle-slash",
851
889
  size: 12,
852
890
  className: "shrink-0 text-muted-foreground"
853
- }) : /* @__PURE__ */ N(d, {
891
+ }) : /* @__PURE__ */ M(d, {
854
892
  name: "x",
855
893
  size: 12,
856
894
  className: "shrink-0 text-destructive"
857
895
  });
858
896
  }
859
- function et(e, t) {
897
+ function at(e, t) {
860
898
  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;
861
899
  }
862
- var tt = 96;
863
- function nt({ entry: e, pinned: t = !0 }) {
900
+ var ot = 96;
901
+ function st({ entry: e, pinned: t = !0 }) {
864
902
  let n = A(null), [r, i] = j(!1), [a, o] = j(!1);
865
903
  O(() => {
866
904
  let e = n.current;
867
905
  e && o(e.scrollHeight > 97);
868
906
  }, [e.detail, e.attachmentNames]);
869
907
  let s = a && !r;
870
- return /* @__PURE__ */ N("div", {
908
+ return /* @__PURE__ */ M("div", {
871
909
  className: `${t ? "sticky top-0 z-20 border-b border-border/40" : ""} flex justify-end bg-background py-1.5`,
872
- children: /* @__PURE__ */ P("div", {
910
+ children: /* @__PURE__ */ N("div", {
873
911
  className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
874
- children: [/* @__PURE__ */ P("div", {
912
+ children: [/* @__PURE__ */ N("div", {
875
913
  ref: n,
876
914
  className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
877
- style: s ? { maxHeight: tt } : void 0,
878
- children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ N("div", {
915
+ style: s ? { maxHeight: ot } : void 0,
916
+ children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ M("div", {
879
917
  className: "flex flex-wrap gap-1",
880
- children: e.attachmentNames.map((e, t) => /* @__PURE__ */ P("span", {
918
+ children: e.attachmentNames.map((e, t) => /* @__PURE__ */ N("span", {
881
919
  className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
882
- children: [/* @__PURE__ */ N(d, {
920
+ children: [/* @__PURE__ */ M(d, {
883
921
  name: "paperclip",
884
922
  size: 10,
885
923
  className: "shrink-0"
886
- }), /* @__PURE__ */ N("span", {
924
+ }), /* @__PURE__ */ M("span", {
887
925
  className: "max-w-[160px] truncate",
888
926
  children: e
889
927
  })]
890
928
  }, t))
891
- }), /* @__PURE__ */ N(Qe, { text: e.detail ?? "" })]
892
- }), a && /* @__PURE__ */ P("button", {
929
+ }), /* @__PURE__ */ M(rt, { text: e.detail ?? "" })]
930
+ }), a && /* @__PURE__ */ N("button", {
893
931
  type: "button",
894
932
  onClick: () => i((e) => !e),
895
933
  className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
896
934
  title: r ? "Comprimi" : "Espandi",
897
- children: [s && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ N(d, {
935
+ children: [s && /* @__PURE__ */ M("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ M(d, {
898
936
  name: r ? "chevron-up" : "chevron-down",
899
937
  size: 12
900
938
  })]
@@ -902,15 +940,15 @@ function nt({ entry: e, pinned: t = !0 }) {
902
940
  })
903
941
  });
904
942
  }
905
- var rt = {
943
+ var ct = {
906
944
  running: "loader-circle",
907
945
  done: "check",
908
946
  error: "x",
909
947
  stopped: "circle-slash"
910
948
  };
911
- function it({ steps: e }) {
949
+ function lt({ steps: e }) {
912
950
  let t = Q(), n = e.filter((e) => e.status === "running").at(-1), r = e.some((e) => e.status === "error"), i = n?.label ?? (e.length === 1 ? t.oneStep : _(t.steps, { count: e.length }));
913
- return /* @__PURE__ */ N(h, {
951
+ return /* @__PURE__ */ M(h, {
914
952
  ariaLabel: t.stepsLabel,
915
953
  selectedId: null,
916
954
  itemClassName: "py-0.5 text-xs text-muted-foreground",
@@ -920,16 +958,16 @@ function it({ steps: e }) {
920
958
  icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
921
959
  children: e.map((e) => ({
922
960
  id: e.id,
923
- label: /* @__PURE__ */ N("span", {
961
+ label: /* @__PURE__ */ M("span", {
924
962
  className: e.status === "error" ? "text-destructive" : void 0,
925
963
  children: e.label
926
964
  }),
927
- icon: rt[e.status]
965
+ icon: ct[e.status]
928
966
  }))
929
967
  }]
930
968
  });
931
969
  }
932
- function at(e, t) {
970
+ function ut(e, t) {
933
971
  let n = e.at(-1);
934
972
  if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
935
973
  let r = [...n.parts].reverse().find((e) => e.type === "questions");
@@ -938,9 +976,9 @@ function at(e, t) {
938
976
  part: r
939
977
  };
940
978
  }
941
- function ot({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
979
+ function dt({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
942
980
  let o = !!n?.canAnswer(e.id);
943
- return /* @__PURE__ */ N(i, {
981
+ return /* @__PURE__ */ M(i, {
944
982
  questions: t.questions,
945
983
  ...t.answers ? { answers: t.answers } : {},
946
984
  disabled: !t.answers && !o,
@@ -949,7 +987,7 @@ function ot({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
949
987
  className: a ?? "text-xs"
950
988
  });
951
989
  }
952
- function st({ entry: e, questions: t, hiddenPartId: n }) {
990
+ function ft({ entry: e, questions: t, hiddenPartId: n }) {
953
991
  let i = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), o = [];
954
992
  for (let e of i) {
955
993
  let t = o.at(-1);
@@ -961,21 +999,21 @@ function st({ entry: e, questions: t, hiddenPartId: n }) {
961
999
  part: e
962
1000
  });
963
1001
  }
964
- return /* @__PURE__ */ N("div", {
1002
+ return /* @__PURE__ */ M("div", {
965
1003
  className: "space-y-2",
966
1004
  children: o.map((n) => {
967
- if ("steps" in n) return /* @__PURE__ */ N(it, { steps: n.steps }, n.key);
1005
+ if ("steps" in n) return /* @__PURE__ */ M(lt, { steps: n.steps }, n.key);
968
1006
  let { part: i } = n;
969
- return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ N(r, {
1007
+ return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ M(r, {
970
1008
  content: i.text,
971
1009
  streaming: i.streaming,
972
1010
  className: "break-words text-xs leading-relaxed text-foreground"
973
- }, n.key) : null : i.type === "reasoning" ? /* @__PURE__ */ N(a, {
1011
+ }, n.key) : null : i.type === "reasoning" ? /* @__PURE__ */ M(a, {
974
1012
  content: i.text,
975
1013
  streaming: i.streaming,
976
1014
  duration: i.duration,
977
1015
  className: "my-0"
978
- }, n.key) : /* @__PURE__ */ N(ot, {
1016
+ }, n.key) : /* @__PURE__ */ M(dt, {
979
1017
  entry: e,
980
1018
  part: i,
981
1019
  questions: t
@@ -983,52 +1021,52 @@ function st({ entry: e, questions: t, hiddenPartId: n }) {
983
1021
  })
984
1022
  });
985
1023
  }
986
- function ct({ entry: e, questions: t, hiddenPartId: n }) {
1024
+ function pt({ entry: e, questions: t, hiddenPartId: n }) {
987
1025
  let i = Q();
988
1026
  if (e.kind === "thinking" && e.parts) {
989
1027
  let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
990
- return /* @__PURE__ */ P("li", {
1028
+ return /* @__PURE__ */ N("li", {
991
1029
  className: "text-xs text-muted-foreground",
992
- children: [e.parts.length > 0 && /* @__PURE__ */ N(st, {
1030
+ children: [e.parts.length > 0 && /* @__PURE__ */ M(ft, {
993
1031
  entry: e,
994
1032
  questions: t,
995
1033
  hiddenPartId: n
996
- }), r && /* @__PURE__ */ P("div", {
1034
+ }), r && /* @__PURE__ */ N("div", {
997
1035
  className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
998
- children: [/* @__PURE__ */ N("span", {
1036
+ children: [/* @__PURE__ */ M("span", {
999
1037
  className: "pt-px",
1000
- children: /* @__PURE__ */ N($e, { status: e.status })
1001
- }), /* @__PURE__ */ N("span", {
1038
+ children: /* @__PURE__ */ M(it, { status: e.status })
1039
+ }), /* @__PURE__ */ M("span", {
1002
1040
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1003
- children: et(e, i)
1041
+ children: at(e, i)
1004
1042
  })]
1005
1043
  })]
1006
1044
  });
1007
1045
  }
1008
- let a = e.kind === "thinking" && e.detail ? Xe(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? et(e, i) : e.label;
1009
- return /* @__PURE__ */ P("li", {
1046
+ let a = e.kind === "thinking" && e.detail ? tt(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? at(e, i) : e.label;
1047
+ return /* @__PURE__ */ N("li", {
1010
1048
  className: "text-xs text-muted-foreground",
1011
1049
  children: [
1012
- /* @__PURE__ */ P("div", {
1050
+ /* @__PURE__ */ N("div", {
1013
1051
  className: "flex items-start gap-1.5",
1014
- children: [/* @__PURE__ */ N("span", {
1052
+ children: [/* @__PURE__ */ M("span", {
1015
1053
  className: "pt-px",
1016
- children: /* @__PURE__ */ N($e, { status: e.status })
1017
- }), /* @__PURE__ */ N("span", {
1054
+ children: /* @__PURE__ */ M(it, { status: e.status })
1055
+ }), /* @__PURE__ */ M("span", {
1018
1056
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1019
1057
  children: c
1020
1058
  })]
1021
1059
  }),
1022
- o.length > 0 && /* @__PURE__ */ N("div", {
1060
+ o.length > 0 && /* @__PURE__ */ M("div", {
1023
1061
  className: "mt-1 ml-[18px] space-y-1",
1024
- children: o.map((e, t) => /* @__PURE__ */ N(Ze, {
1062
+ children: o.map((e, t) => /* @__PURE__ */ M(nt, {
1025
1063
  content: e.content,
1026
1064
  language: e.language
1027
1065
  }, t))
1028
1066
  }),
1029
- s.length > 0 && /* @__PURE__ */ N("div", {
1067
+ s.length > 0 && /* @__PURE__ */ M("div", {
1030
1068
  className: "mt-1 ml-[18px] space-y-2",
1031
- children: s.map((e, t) => /* @__PURE__ */ N(r, {
1069
+ children: s.map((e, t) => /* @__PURE__ */ M(r, {
1032
1070
  content: e.content.trim(),
1033
1071
  tone: "muted",
1034
1072
  className: "break-words text-xs leading-relaxed"
@@ -1037,21 +1075,21 @@ function ct({ entry: e, questions: t, hiddenPartId: n }) {
1037
1075
  ]
1038
1076
  });
1039
1077
  }
1040
- function lt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1078
+ function mt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1041
1079
  if (e.length === 0) return null;
1042
1080
  let i = [];
1043
1081
  for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
1044
1082
  user: t,
1045
1083
  entries: []
1046
1084
  } : { entries: [t] }) : i[i.length - 1].entries.push(t);
1047
- return /* @__PURE__ */ N("ul", {
1085
+ return /* @__PURE__ */ M("ul", {
1048
1086
  className: "space-y-0.5",
1049
- children: i.map((e) => /* @__PURE__ */ P("li", { children: [e.user && /* @__PURE__ */ N(nt, {
1087
+ children: i.map((e) => /* @__PURE__ */ N("li", { children: [e.user && /* @__PURE__ */ M(st, {
1050
1088
  entry: e.user,
1051
1089
  pinned: r
1052
- }), e.entries.length > 0 && /* @__PURE__ */ N("ul", {
1090
+ }), e.entries.length > 0 && /* @__PURE__ */ M("ul", {
1053
1091
  className: "space-y-0.5",
1054
- children: e.entries.map((e) => /* @__PURE__ */ N(ct, {
1092
+ children: e.entries.map((e) => /* @__PURE__ */ M(pt, {
1055
1093
  entry: e,
1056
1094
  questions: t,
1057
1095
  hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
@@ -1061,55 +1099,55 @@ function lt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1061
1099
  }
1062
1100
  //#endregion
1063
1101
  //#region src/presentation/panelWidth.ts
1064
- var ut = 420, dt = 320, ft = "60vw", pt = "agentico:panel-width";
1065
- function mt(e, t) {
1102
+ var ht = 420, gt = 320, _t = "60vw", vt = "agentico:panel-width";
1103
+ function yt(e, t) {
1066
1104
  if (typeof e == "number") return e;
1067
1105
  let n = Number.parseFloat(e);
1068
1106
  return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1069
1107
  }
1070
- function ht(e, t, n) {
1108
+ function bt(e, t, n) {
1071
1109
  return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1072
1110
  }
1073
- function gt() {
1111
+ function xt() {
1074
1112
  try {
1075
- let e = window.localStorage.getItem(pt), t = e === null ? NaN : Number(e);
1113
+ let e = window.localStorage.getItem(vt), t = e === null ? NaN : Number(e);
1076
1114
  return Number.isFinite(t) && t > 0 ? t : null;
1077
1115
  } catch {
1078
1116
  return null;
1079
1117
  }
1080
1118
  }
1081
- function _t(e) {
1119
+ function St(e) {
1082
1120
  try {
1083
- e === null ? window.localStorage.removeItem(pt) : window.localStorage.setItem(pt, String(e));
1121
+ e === null ? window.localStorage.removeItem(vt) : window.localStorage.setItem(vt, String(e));
1084
1122
  } catch {}
1085
1123
  }
1086
- function vt() {
1124
+ function Ct() {
1087
1125
  return typeof window > "u" ? Infinity : window.innerWidth;
1088
1126
  }
1089
- function yt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = ft, onWidthChange: r }) {
1090
- let [i, a] = j(vt), [o, s] = j(() => gt() ?? e);
1127
+ function wt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = _t, onWidthChange: r }) {
1128
+ let [i, a] = j(Ct), [o, s] = j(() => xt() ?? e);
1091
1129
  D(() => {
1092
1130
  if (typeof window > "u") return;
1093
1131
  let e = () => a(window.innerWidth);
1094
1132
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1095
1133
  }, []);
1096
- let c = t, l = Math.max(c, mt(n, i)), u = ht(o, c, l);
1134
+ let c = t, l = Math.max(c, yt(n, i)), u = bt(o, c, l);
1097
1135
  return D(() => {
1098
1136
  r?.(u);
1099
1137
  }, [u]), {
1100
1138
  width: u,
1101
1139
  min: c,
1102
1140
  max: l,
1103
- set: T((e) => s(ht(e, c, l)), [c, l]),
1104
- commit: T((e) => _t(ht(e, c, l)), [c, l]),
1141
+ set: T((e) => s(bt(e, c, l)), [c, l]),
1142
+ commit: T((e) => St(bt(e, c, l)), [c, l]),
1105
1143
  reset: T(() => {
1106
- s(e), _t(null);
1144
+ s(e), St(null);
1107
1145
  }, [e])
1108
1146
  };
1109
1147
  }
1110
1148
  //#endregion
1111
1149
  //#region src/presentation/AgenticoResizeHandle.tsx
1112
- function bt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1150
+ function Tt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1113
1151
  let o = Q(), s = A(null), [c, l] = j(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
1114
1152
  let t = s.current;
1115
1153
  if (t && t.pointerId === e.pointerId) {
@@ -1120,7 +1158,7 @@ function bt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1120
1158
  i(t.last);
1121
1159
  }
1122
1160
  };
1123
- return /* @__PURE__ */ N("div", {
1161
+ return /* @__PURE__ */ M("div", {
1124
1162
  role: "separator",
1125
1163
  "aria-orientation": "vertical",
1126
1164
  "aria-label": o.resizePanel,
@@ -1159,7 +1197,7 @@ function bt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1159
1197
  let c = u(s);
1160
1198
  r(c), i(c);
1161
1199
  },
1162
- children: /* @__PURE__ */ N("span", {
1200
+ children: /* @__PURE__ */ M("span", {
1163
1201
  "aria-hidden": !0,
1164
1202
  className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
1165
1203
  })
@@ -1167,9 +1205,9 @@ function bt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1167
1205
  }
1168
1206
  //#endregion
1169
1207
  //#region src/presentation/AgenticoToggle.tsx
1170
- function xt({ className: e = "" }) {
1208
+ function Et({ className: e = "" }) {
1171
1209
  let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
1172
- return /* @__PURE__ */ N(t, {
1210
+ return /* @__PURE__ */ M(t, {
1173
1211
  icon: "bot",
1174
1212
  ariaLabel: n ? a.closePanel : a.openPanel,
1175
1213
  title: n ? a.closePanel : a.openPanel,
@@ -1180,21 +1218,21 @@ function xt({ className: e = "" }) {
1180
1218
  }
1181
1219
  //#endregion
1182
1220
  //#region src/presentation/useAIModelCatalog.ts
1183
- var St = "llmnative-cms.selectedAIModel";
1184
- function Ct() {
1221
+ var Dt = "llmnative-cms.selectedAIModel";
1222
+ function Ot() {
1185
1223
  try {
1186
- return localStorage.getItem(St) ?? "";
1224
+ return localStorage.getItem(Dt) ?? "";
1187
1225
  } catch {
1188
1226
  return "";
1189
1227
  }
1190
1228
  }
1191
- function wt(e) {
1229
+ function kt(e) {
1192
1230
  try {
1193
- e ? localStorage.setItem(St, e) : localStorage.removeItem(St);
1231
+ e ? localStorage.setItem(Dt, e) : localStorage.removeItem(Dt);
1194
1232
  } catch {}
1195
1233
  }
1196
- function Tt() {
1197
- let e = b()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = j({}), [i, a] = j(!1), [o, s] = j(Ct);
1234
+ function At() {
1235
+ let e = b()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = j({}), [i, a] = j(!1), [o, s] = j(Ot);
1198
1236
  return D(() => {
1199
1237
  if (!t) {
1200
1238
  r({});
@@ -1205,7 +1243,7 @@ function Tt() {
1205
1243
  if (n) return;
1206
1244
  r(e.modelsByProvider);
1207
1245
  let t = Object.values(e.modelsByProvider).flat();
1208
- s((e) => t.some((t) => t.id === e) ? e : (wt(""), ""));
1246
+ s((e) => t.some((t) => t.id === e) ? e : (kt(""), ""));
1209
1247
  }).catch((e) => {
1210
1248
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
1211
1249
  }).finally(() => {
@@ -1219,17 +1257,17 @@ function Tt() {
1219
1257
  modelsLoading: i,
1220
1258
  selectedModel: o,
1221
1259
  setSelectedModel: (e) => {
1222
- wt(e), s(e);
1260
+ kt(e), s(e);
1223
1261
  }
1224
1262
  };
1225
1263
  }
1226
1264
  //#endregion
1227
1265
  //#region src/domain/approval.ts
1228
- var Et = "approval";
1229
- function Dt(e, t) {
1266
+ var jt = "approval";
1267
+ function Mt(e, t) {
1230
1268
  return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1231
1269
  }
1232
- function Ot(e, t, n) {
1270
+ function Nt(e, t, n) {
1233
1271
  let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1234
1272
  return {
1235
1273
  approved: r.includes(t) && !r.includes(n),
@@ -1238,37 +1276,37 @@ function Ot(e, t, n) {
1238
1276
  }
1239
1277
  //#endregion
1240
1278
  //#region src/presentation/useAgent.ts
1241
- var kt = 20, At = 26e4;
1242
- function jt(e) {
1243
- return e.filter((e) => !m.isTextAttachment(e.mimeType) || e.base64.length <= At);
1279
+ var Pt = 20, Ft = 26e4;
1280
+ function It(e) {
1281
+ return e.filter((e) => !m.isTextAttachment(e.mimeType) || e.base64.length <= Ft);
1244
1282
  }
1245
- function Mt(e, t = {}) {
1246
- let { defaultEnabled: n = !1 } = t, [r, i] = j(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Tt(), [u, d] = j(!1), [f, p] = j(null), [h, g] = j(!1), [_, y] = j([]), x = A([]), S = (e) => {
1283
+ function Lt(e, t = {}) {
1284
+ let { defaultEnabled: n = !1 } = t, [r, i] = j(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = At(), [u, d] = j(!1), [f, p] = j(null), [h, g] = j(!1), [_, y] = j([]), x = A([]), S = (e) => {
1247
1285
  y((t) => {
1248
1286
  let n = typeof e == "function" ? e(t) : e;
1249
1287
  return x.current = n, n;
1250
1288
  });
1251
1289
  }, C = A(/* @__PURE__ */ new Map()), w = Q(), T = A(w);
1252
1290
  T.current = w;
1253
- let E = A(null), D = A(!1), O = A(null), M = () => {
1291
+ let E = A(null), D = A(!1), O = A(null), ee = () => {
1254
1292
  O.current?.abort();
1255
- }, N = b()?.registry ?? {}, [P, ee] = j(void 0), z = A(void 0), B = (e, t) => {
1293
+ }, M = b()?.registry ?? {}, [N, te] = j(void 0), re = A(void 0), L = (e, t) => {
1256
1294
  if (!t) return !1;
1257
1295
  if (!e) return !0;
1258
1296
  let n = v(t);
1259
1297
  return !!n && e.includes(n.provider);
1260
- }, te = k(() => P ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => P.includes(e.provider))]).filter(([, e]) => e.length)) : o, [P, o]), V = B(P, c) ? c : Object.values(te).flat()[0]?.id ?? "", H = r && V ? v(V) : null, U = H ? N[H.provider] : null, W = e.executor, G = !!W?.alongside, q = !!W && !G, ne = A([]), J = (e) => !!e && ne.current.some((t) => t.value === e), Y = A(!1), [re, ie] = j([]), [ae, oe] = j(""), se = A(""), Z = (e) => {
1261
- se.current = e, oe(e);
1262
- }, ce = (e) => {
1263
- let t = W?.models?.(e) ?? [];
1264
- ne.current = t, ie(t);
1265
- let n = W?.catalogProviders?.(e);
1266
- z.current = n, ee(n);
1267
- let r = G && !B(n, c) ? t[0]?.value : void 0;
1268
- Z(W?.defaultModel?.(e) ?? r ?? "");
1269
- }, le = async (e, t, n, r) => {
1298
+ }, ie = k(() => N ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => N.includes(e.provider))]).filter(([, e]) => e.length)) : o, [N, o]), R = L(N, c) ? c : Object.values(ie).flat()[0]?.id ?? "", z = r && R ? v(R) : null, B = z ? M[z.provider] : null, V = e.executor, H = !!V?.alongside, W = !!V && !H, ae = A([]), oe = (e) => !!e && ae.current.some((t) => t.value === e), G = A(!1), [se, ce] = j([]), [le, ue] = j(""), q = A(""), J = (e) => {
1299
+ q.current = e, ue(e);
1300
+ }, de = (e) => {
1301
+ let t = V?.models?.(e) ?? [];
1302
+ ae.current = t, ce(t);
1303
+ let n = V?.catalogProviders?.(e);
1304
+ re.current = n, te(n);
1305
+ let r = H && !L(n, c) ? t[0]?.value : void 0;
1306
+ J(V?.defaultModel?.(e) ?? r ?? "");
1307
+ }, Y = async (e, t, n, r) => {
1270
1308
  let i = E.current;
1271
- if (!i || !W) return p(T.current.noActiveSession), null;
1309
+ if (!i || !V) return p(T.current.noActiveSession), null;
1272
1310
  let a = new AbortController();
1273
1311
  O.current = a;
1274
1312
  let o = crypto.randomUUID();
@@ -1285,14 +1323,14 @@ function Mt(e, t = {}) {
1285
1323
  duration: e.duration ?? c(e.id)
1286
1324
  }), u = (e, t) => S((n) => n.map((n) => {
1287
1325
  if (n.id !== o) return n;
1288
- let r = e(n.parts ?? []), i = L(r);
1326
+ let r = e(n.parts ?? []), i = ne(r);
1289
1327
  return {
1290
1328
  ...n,
1291
1329
  parts: r,
1292
1330
  ...t ? { status: t } : {},
1293
1331
  ...i ? { detail: i } : {}
1294
1332
  };
1295
- })), d = (e) => u((t) => I(t, e, l)), f = !1, m = (e, t) => {
1333
+ })), d = (e) => u((t) => F(t, e, l)), f = !1, m = (e, t) => {
1296
1334
  t?.id && t.id !== "text" && (f = !0), d({
1297
1335
  type: "text",
1298
1336
  id: t?.id ?? "text",
@@ -1337,9 +1375,9 @@ function Mt(e, t = {}) {
1337
1375
  });
1338
1376
  }));
1339
1377
  }, x = (e, t) => {
1340
- u((n) => (t && !f ? I(n, {
1378
+ u((n) => (t && !f ? F(n, {
1341
1379
  type: "text",
1342
- id: F,
1380
+ id: P,
1343
1381
  text: t,
1344
1382
  streaming: !1
1345
1383
  }, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
@@ -1353,13 +1391,13 @@ function Mt(e, t = {}) {
1353
1391
  _.clear();
1354
1392
  }, w = e || r?.historyText || "";
1355
1393
  try {
1356
- let o = await W.turn({
1394
+ let o = await V.turn({
1357
1395
  params: i.params,
1358
1396
  context: i.context,
1359
1397
  text: e,
1360
1398
  first: t,
1361
1399
  signal: a.signal,
1362
- ...n || se.current ? { model: n || se.current } : {},
1400
+ ...n || q.current ? { model: n || q.current } : {},
1363
1401
  ...r ? { answers: {
1364
1402
  id: r.id,
1365
1403
  answers: r.answers
@@ -1384,11 +1422,11 @@ function Mt(e, t = {}) {
1384
1422
  return i.history = [...i.history, ...w ? [{
1385
1423
  role: "user",
1386
1424
  content: w
1387
- }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), p(pe(e)), null);
1425
+ }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), p(X(e)), null);
1388
1426
  } finally {
1389
1427
  O.current = null;
1390
1428
  }
1391
- }, ue = async (e, t, n) => {
1429
+ }, fe = async (e, t, n) => {
1392
1430
  let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1393
1431
  if (!r || r.type !== "questions") throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1394
1432
  let i = () => S((r) => r.map((r) => r.id === e ? {
@@ -1400,28 +1438,28 @@ function Mt(e, t = {}) {
1400
1438
  } : r)), a = `${e}:${t}`, o = C.current.get(a);
1401
1439
  if (o) return C.current.delete(a), i(), o.resolve(n), null;
1402
1440
  if (D.current) throw p(T.current.requestInProgress), Error(T.current.requestInProgress);
1403
- if (!q || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1441
+ if (!W || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1404
1442
  D.current = !0, d(!0), p(null), i();
1405
1443
  try {
1406
- return await le("", !1, void 0, {
1444
+ return await Y("", !1, void 0, {
1407
1445
  id: t,
1408
1446
  answers: n,
1409
- historyText: R(r.questions, n)
1447
+ historyText: I(r.questions, n)
1410
1448
  });
1411
1449
  } finally {
1412
1450
  D.current = !1, d(!1);
1413
1451
  }
1414
- }, de = async (t, n, r) => {
1415
- let i = z.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && B(i, r) ? r : B(i, V) ? void 0 : a, c = E.current;
1416
- if (!c) return p(T.current.noActiveSession), null;
1417
- let l = s ? v(s) : H, u = l ? N[l.provider] : null;
1418
- if (!u || !l) return p(T.current.noProviderAvailable), null;
1419
- n?.length && (c.attachmentsRef.current = [...c.attachmentsRef.current ?? [], ...n]);
1420
- let d = (n ?? []).filter((e) => m.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= At ? `\n\n[File allegato: ${e.name}]\n${m.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(""), f = jt(n ?? []), h = c.tools.map((e) => ({
1452
+ }, pe = async (t, n, r) => {
1453
+ let i = re.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && L(i, r) ? r : L(i, R) ? void 0 : a, c = s ? v(s) : z, l = c && E.current ? V?.catalogReasoning?.(E.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = E.current;
1454
+ if (!d) return p(T.current.noActiveSession), null;
1455
+ let f = s ? v(s) : z, h = f ? M[f.provider] : null;
1456
+ if (!h || !f) return p(T.current.noProviderAvailable), null;
1457
+ n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
1458
+ let g = (n ?? []).filter((e) => m.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Ft ? `\n\n[File allegato: ${e.name}]\n${m.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(""), _ = It(n ?? []), y = d.tools.map((e) => ({
1421
1459
  name: e.name,
1422
1460
  description: e.description,
1423
- inputSchema: K(e.inputSchema)
1424
- })), g = (e, t, n, r) => {
1461
+ inputSchema: U(e.inputSchema)
1462
+ })), b = (e, t, n, r) => {
1425
1463
  let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1426
1464
  S((e) => [...e, {
1427
1465
  id: a,
@@ -1430,7 +1468,7 @@ function Mt(e, t = {}) {
1430
1468
  status: "running",
1431
1469
  parts: [{
1432
1470
  type: "questions",
1433
- id: Et,
1471
+ id: jt,
1434
1472
  questions: [{
1435
1473
  header: i.approvalHeader,
1436
1474
  question: i.approveQuestion.replace("{action}", o),
@@ -1439,10 +1477,10 @@ function Mt(e, t = {}) {
1439
1477
  }]
1440
1478
  }]
1441
1479
  }]);
1442
- let s = `${a}:${Et}`;
1480
+ let s = `${a}:${jt}`;
1443
1481
  return new Promise((e, t) => {
1444
1482
  let n = () => {
1445
- C.current.delete(s), b(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1483
+ C.current.delete(s), D(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1446
1484
  };
1447
1485
  if (r.aborted) {
1448
1486
  n();
@@ -1450,22 +1488,22 @@ function Mt(e, t = {}) {
1450
1488
  }
1451
1489
  r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
1452
1490
  resolve: (t) => {
1453
- r.removeEventListener("abort", n), b(a, "done"), e(Ot(t, i.approve, i.reject));
1491
+ r.removeEventListener("abort", n), D(a, "done"), e(Nt(t, i.approve, i.reject));
1454
1492
  },
1455
1493
  reject: t
1456
1494
  });
1457
1495
  });
1458
- }, _ = new Map(c.tools.map((e) => [e.name, e])), y = new AbortController();
1459
- O.current = y;
1460
- let b = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1496
+ }, x = new Map(d.tools.map((e) => [e.name, e])), w = new AbortController();
1497
+ O.current = w;
1498
+ let D = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1461
1499
  ...i,
1462
1500
  status: t,
1463
1501
  ...n === void 0 ? {} : { detail: n },
1464
1502
  ...r === void 0 ? {} : { toolNames: r }
1465
1503
  } : i));
1466
1504
  try {
1467
- let n = c.history, r = t;
1468
- for (let t = 0; t < kt; t++) {
1505
+ let n = d.history, r = t;
1506
+ for (let t = 0; t < Pt; t++) {
1469
1507
  let i = crypto.randomUUID();
1470
1508
  S((e) => [...e, {
1471
1509
  id: i,
@@ -1475,63 +1513,64 @@ function Mt(e, t = {}) {
1475
1513
  }]);
1476
1514
  let a;
1477
1515
  try {
1478
- a = await u.complete({
1516
+ a = await h.complete({
1479
1517
  prompt: r,
1480
- model: l.model,
1518
+ model: f.model,
1519
+ ...u,
1481
1520
  history: n,
1482
- tools: h.length ? h : void 0,
1483
- signal: y.signal,
1484
- attachments: t === 0 ? f : void 0,
1485
- logId: c.logId
1521
+ tools: y.length ? y : void 0,
1522
+ signal: w.signal,
1523
+ attachments: t === 0 ? _ : void 0,
1524
+ logId: d.logId
1486
1525
  });
1487
1526
  } catch (t) {
1488
- return c.history = [...n, ...r ? [{
1527
+ return d.history = [...n, ...r ? [{
1489
1528
  role: "user",
1490
- content: r + d
1491
- }] : []], y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), p(pe(t)), null);
1529
+ content: r + g
1530
+ }] : []], w.signal.aborted ? (D(i, "stopped"), e.fallback(d.params, d.context)) : (D(i, "error"), p(X(t)), null);
1492
1531
  }
1493
- if (c.history = [...n, ...r ? [{
1532
+ if (d.history = [...n, ...r ? [{
1494
1533
  role: "user",
1495
- content: r + d
1496
- }] : []], !a) return y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), p(T.current.noProviderResponse), null);
1497
- if (a.type === "text") return b(i, "done", a.text), e.conversational && a.text.trim() && S((e) => e.map((e) => e.id === i ? {
1534
+ content: r + g
1535
+ }] : []], !a) return w.signal.aborted ? (D(i, "stopped"), e.fallback(d.params, d.context)) : (D(i, "error"), p(T.current.noProviderResponse), null);
1536
+ if (a.type === "text") return D(i, "done", a.text), e.conversational && a.text.trim() && S((e) => e.map((e) => e.id === i ? {
1498
1537
  ...e,
1499
1538
  parts: [{
1500
1539
  type: "text",
1501
1540
  id: "text",
1502
1541
  text: a.text
1503
1542
  }]
1504
- } : e)), c.history = [
1543
+ } : e)), d.history = [
1505
1544
  ...n,
1506
1545
  ...r ? [{
1507
1546
  role: "user",
1508
- content: r + d
1547
+ content: r + g
1509
1548
  }] : [],
1510
1549
  {
1511
1550
  role: "assistant",
1512
1551
  content: a.text
1513
1552
  }
1514
- ], e.parseResponse(a.text, c.params, c.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1553
+ ], e.parseResponse(a.text, d.params, d.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1515
1554
  responseLength: a.text.length,
1516
1555
  responsePreview: a.text.length > 2e3 ? `${a.text.slice(0, 1e3)}\n…[troncato qui nel log, ${a.text.length} caratteri totali]…\n${a.text.slice(-1e3)}` : a.text,
1517
- params: c.params
1518
- }), p(T.current.invalidResponse), e.fallback(c.params, c.context));
1556
+ params: d.params
1557
+ }), p(T.current.invalidResponse), e.fallback(d.params, d.context));
1519
1558
  let o = a.toolCalls.map((e) => {
1520
- let t = _.get(e.name);
1559
+ let t = x.get(e.name);
1521
1560
  return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1522
1561
  });
1523
- b(i, "done", a.text || void 0, a.text ? void 0 : o);
1562
+ D(i, "done", a.text || void 0, a.text ? void 0 : o);
1524
1563
  let s = /* @__PURE__ */ new Map();
1525
1564
  for (let t of a.toolCalls) {
1526
- let n = _.get(t.name);
1527
- if (n && Dt(n, t.input)) try {
1528
- s.set(t.id, await g(t.id, n, t.input, y.signal));
1565
+ let n = x.get(t.name);
1566
+ if (n && Mt(n, t.input)) try {
1567
+ s.set(t.id, await b(t.id, n, t.input, w.signal));
1529
1568
  } catch {
1530
- return e.fallback(c.params, c.context);
1569
+ return e.fallback(d.params, d.context);
1531
1570
  }
1532
1571
  }
1533
- let m = await Promise.all(a.toolCalls.map(async (e) => {
1534
- let t = _.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
1572
+ let c = await Promise.all(a.toolCalls.map(async (e) => {
1573
+ let t = x.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
1535
1574
  if (r && !r.approved) {
1536
1575
  S((t) => [...t, {
1537
1576
  id: e.id,
@@ -1539,7 +1578,7 @@ function Mt(e, t = {}) {
1539
1578
  label: n,
1540
1579
  status: "stopped"
1541
1580
  }]);
1542
- let t = X().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1581
+ let t = K().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1543
1582
  return {
1544
1583
  toolCallId: e.id,
1545
1584
  name: e.name,
@@ -1552,7 +1591,7 @@ function Mt(e, t = {}) {
1552
1591
  kind: "tool",
1553
1592
  label: n,
1554
1593
  status: "running"
1555
- }]), !t) return b(e.id, "error"), {
1594
+ }]), !t) return D(e.id, "error"), {
1556
1595
  toolCallId: e.id,
1557
1596
  name: e.name,
1558
1597
  output: `Tool sconosciuto: ${e.name}`,
@@ -1560,16 +1599,16 @@ function Mt(e, t = {}) {
1560
1599
  };
1561
1600
  try {
1562
1601
  let n = await t.execute(e.input);
1563
- return b(e.id, "done"), {
1602
+ return D(e.id, "done"), {
1564
1603
  toolCallId: e.id,
1565
1604
  name: e.name,
1566
1605
  output: n
1567
1606
  };
1568
1607
  } catch (t) {
1569
- return b(e.id, "error"), {
1608
+ return D(e.id, "error"), {
1570
1609
  toolCallId: e.id,
1571
1610
  name: e.name,
1572
- output: pe(t),
1611
+ output: X(t),
1573
1612
  isError: !0
1574
1613
  };
1575
1614
  }
@@ -1578,7 +1617,7 @@ function Mt(e, t = {}) {
1578
1617
  ...n,
1579
1618
  ...r ? [{
1580
1619
  role: "user",
1581
- content: r + d
1620
+ content: r + g
1582
1621
  }] : [],
1583
1622
  {
1584
1623
  role: "assistant",
@@ -1587,7 +1626,7 @@ function Mt(e, t = {}) {
1587
1626
  },
1588
1627
  {
1589
1628
  role: "tool_result",
1590
- results: m
1629
+ results: c
1591
1630
  }
1592
1631
  ], r = "";
1593
1632
  }
@@ -1600,29 +1639,30 @@ function Mt(e, t = {}) {
1600
1639
  }]);
1601
1640
  let a;
1602
1641
  try {
1603
- a = await u.complete({
1604
- prompt: fe(X().stopCallingTools, e.microPromptIds),
1605
- model: l.model,
1642
+ a = await h.complete({
1643
+ ...u,
1644
+ prompt: me(K().stopCallingTools, e.microPromptIds),
1645
+ model: f.model,
1606
1646
  history: n,
1607
- signal: y.signal,
1608
- logId: c.logId
1647
+ signal: w.signal,
1648
+ logId: d.logId
1609
1649
  });
1610
1650
  } catch {
1611
1651
  a = null;
1612
1652
  }
1613
1653
  if (a?.type === "text") {
1614
- b(i, "done", a.text), c.history = [...n, {
1654
+ D(i, "done", a.text), d.history = [...n, {
1615
1655
  role: "assistant",
1616
1656
  content: a.text
1617
1657
  }];
1618
- let t = e.parseResponse(a.text, c.params, c.context);
1658
+ let t = e.parseResponse(a.text, d.params, d.context);
1619
1659
  if (t) return t;
1620
- } else b(i, y.signal.aborted ? "stopped" : "error"), c.history = n;
1621
- return y.signal.aborted || p(T.current.tooManyToolTurns), e.fallback(c.params, c.context);
1660
+ } else D(i, w.signal.aborted ? "stopped" : "error"), d.history = n;
1661
+ return w.signal.aborted || p(T.current.tooManyToolTurns), e.fallback(d.params, d.context);
1622
1662
  } finally {
1623
1663
  O.current = null;
1624
1664
  }
1625
- }, me = async (t, n) => {
1665
+ }, he = async (t, n) => {
1626
1666
  if (D.current) return p(T.current.requestInProgress), null;
1627
1667
  D.current = !0, p(null), S(n?.openingMessage ? [{
1628
1668
  id: crypto.randomUUID(),
@@ -1641,13 +1681,13 @@ function Mt(e, t = {}) {
1641
1681
  history: [],
1642
1682
  logId: crypto.randomUUID(),
1643
1683
  attachmentsRef: a
1644
- }, q) return g(!0), ce(t), await le(n?.openingMessage ?? "", !0);
1645
- if (G) {
1646
- ce(t), Y.current = !1;
1647
- let e = n?.model || se.current;
1648
- if (J(e)) return g(!0), Y.current = !0, await le(n?.openingMessage ?? "", !0, e);
1684
+ }, W) return g(!0), de(t), await Y(n?.openingMessage ?? "", !0);
1685
+ if (H) {
1686
+ de(t), G.current = !1;
1687
+ let e = n?.model || q.current;
1688
+ if (oe(e)) return g(!0), G.current = !0, await Y(n?.openingMessage ?? "", !0, e);
1649
1689
  }
1650
- let s = n?.model || void 0, c = s ? !!N[v(s)?.provider ?? ""] : !!U;
1690
+ let s = n?.model || void 0, c = s ? !!M[v(s)?.provider ?? ""] : !!B;
1651
1691
  if (!r || !c) {
1652
1692
  g(!1);
1653
1693
  let n = e.fallback(t, i);
@@ -1659,14 +1699,14 @@ function Mt(e, t = {}) {
1659
1699
  }]), n;
1660
1700
  }
1661
1701
  g(!0);
1662
- let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, u = fe(e.buildPrompt(t, i), e.microPromptIds);
1663
- return await de(u, l, s);
1702
+ let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, u = me(e.buildPrompt(t, i), e.microPromptIds);
1703
+ return await pe(u, l, s);
1664
1704
  } catch (e) {
1665
- return p(pe(e)), null;
1705
+ return p(X(e)), null;
1666
1706
  } finally {
1667
1707
  D.current = !1, d(!1);
1668
1708
  }
1669
- }, he = async (t, n) => {
1709
+ }, ge = async (t, n) => {
1670
1710
  if (D.current) {
1671
1711
  p(T.current.requestInProgress);
1672
1712
  return;
@@ -1681,13 +1721,13 @@ function Mt(e, t = {}) {
1681
1721
  history: n.history,
1682
1722
  logId: crypto.randomUUID(),
1683
1723
  attachmentsRef: a
1684
- }, (q || G) && ce(t), Y.current = !1, g(q || G || r && !!U);
1724
+ }, (W || H) && de(t), G.current = !1, g(W || H || r && !!B);
1685
1725
  } catch (e) {
1686
- p(pe(e));
1726
+ p(X(e));
1687
1727
  } finally {
1688
1728
  D.current = !1, d(!1);
1689
1729
  }
1690
- }, ge = async (t, n) => {
1730
+ }, _e = async (t, n) => {
1691
1731
  if (D.current) return p(T.current.requestInProgress), null;
1692
1732
  if (p(null), !t.trim()) return p("Messaggio vuoto."), null;
1693
1733
  let r = E.current;
@@ -1702,20 +1742,20 @@ function Mt(e, t = {}) {
1702
1742
  ...n?.retry ? { retry: !0 } : {}
1703
1743
  }]);
1704
1744
  try {
1705
- if (q) return await le(t, !1, n?.model || void 0);
1706
- let i = n?.model || (G ? se.current : "");
1707
- if (G && J(i)) {
1708
- let e = !Y.current;
1709
- return Y.current = !0, await le(t, e, i);
1745
+ if (W) return await Y(t, !1, n?.model || void 0);
1746
+ let i = n?.model || (H ? q.current : "");
1747
+ if (H && oe(i)) {
1748
+ let e = !G.current;
1749
+ return G.current = !0, await Y(t, e, i);
1710
1750
  }
1711
- let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, o = fe(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1712
- return await de(o, a, n?.model || void 0);
1751
+ let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => m.fileToAttachment(e))) : void 0, o = me(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1752
+ return await pe(o, a, n?.model || void 0);
1713
1753
  } catch (e) {
1714
- return p(pe(e)), null;
1754
+ return p(X(e)), null;
1715
1755
  } finally {
1716
1756
  D.current = !1, d(!1);
1717
1757
  }
1718
- }, _e = () => {
1758
+ }, ve = () => {
1719
1759
  let t = E.current;
1720
1760
  if (!t) return null;
1721
1761
  p(null);
@@ -1726,7 +1766,7 @@ function Mt(e, t = {}) {
1726
1766
  status: "done",
1727
1767
  label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
1728
1768
  }]), n;
1729
- }, ve = () => E.current ? {
1769
+ }, ye = () => E.current ? {
1730
1770
  history: E.current.history,
1731
1771
  activity: _
1732
1772
  } : null;
@@ -1734,48 +1774,48 @@ function Mt(e, t = {}) {
1734
1774
  enabled: r,
1735
1775
  setEnabled: i,
1736
1776
  hasProviders: a,
1737
- selectedModel: q || G && ae ? ae : V,
1738
- setSelectedModel: q ? Z : G ? (e) => {
1739
- J(e) ? Z(e) : (Z(""), l(e));
1777
+ selectedModel: W || H && le ? le : R,
1778
+ setSelectedModel: W ? J : H ? (e) => {
1779
+ oe(e) ? J(e) : (J(""), l(e));
1740
1780
  } : l,
1741
- modelsByProvider: te,
1781
+ modelsByProvider: ie,
1742
1782
  modelsLoading: s,
1743
1783
  running: u,
1744
1784
  error: f,
1745
1785
  canContinue: h,
1746
- remote: q,
1747
- remoteModels: re,
1748
- alongside: G,
1749
- ...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
1786
+ remote: W,
1787
+ remoteModels: se,
1788
+ alongside: H,
1789
+ ...V?.catalogGroup ? { catalogGroup: V.catalogGroup } : {},
1750
1790
  activity: _,
1751
- run: me,
1752
- resume: he,
1753
- sendMessage: ge,
1754
- stop: M,
1755
- runFallback: _e,
1756
- snapshot: ve,
1757
- answerQuestions: ue
1791
+ run: he,
1792
+ resume: ge,
1793
+ sendMessage: _e,
1794
+ stop: ee,
1795
+ runFallback: ve,
1796
+ snapshot: ye,
1797
+ answerQuestions: fe
1758
1798
  };
1759
1799
  }
1760
1800
  //#endregion
1761
1801
  //#region src/domain/orchestrator/prompt.ts
1762
- function Nt() {
1763
- let e = X();
1802
+ function Rt() {
1803
+ let e = K();
1764
1804
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1765
1805
  }
1766
- function Pt(e, t, n) {
1767
- let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1806
+ function zt(e, t, n) {
1807
+ let r = K(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1768
1808
  return `${r.orchestratorIntro}
1769
1809
 
1770
1810
  ${r.toolsHeading}
1771
1811
  ${t}
1772
1812
  ${i}
1773
- ${Nt()}
1813
+ ${Rt()}
1774
1814
 
1775
1815
  ${r.userRequestHeading}
1776
1816
  ${e}`;
1777
1817
  }
1778
- function Ft(e, t) {
1818
+ function Bt(e, t) {
1779
1819
  return t ? {
1780
1820
  kind: "handoff",
1781
1821
  ...t
@@ -1786,27 +1826,27 @@ function Ft(e, t) {
1786
1826
  }
1787
1827
  //#endregion
1788
1828
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1789
- function It(e) {
1790
- return V().filter((t) => !t.onlyWhenAnchored || e === t.id);
1829
+ function Vt(e) {
1830
+ return R().filter((t) => !t.onlyWhenAnchored || e === t.id);
1791
1831
  }
1792
- function Lt(e) {
1832
+ function Ht(e) {
1793
1833
  return {
1794
1834
  buildContext(e) {
1795
1835
  return {
1796
- cliCatalog: le(It(e.scopedSubagentId)),
1836
+ cliCatalog: Y(Vt(e.scopedSubagentId)),
1797
1837
  handoff: { current: null },
1798
1838
  collected: {}
1799
1839
  };
1800
1840
  },
1801
1841
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1802
- return Pt(e, n, t);
1842
+ return zt(e, n, t);
1803
1843
  },
1804
1844
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1805
- return `${e}\n\n${Nt()}\n\n${X().toolsHeading}\n${n}`;
1845
+ return `${e}\n\n${Rt()}\n\n${K().toolsHeading}\n${n}`;
1806
1846
  },
1807
1847
  parseResponse(e, t, n) {
1808
1848
  let r = n.handoff.current;
1809
- return n.handoff.current = null, Ft(e, r);
1849
+ return n.handoff.current = null, Bt(e, r);
1810
1850
  },
1811
1851
  fallback() {
1812
1852
  return {
@@ -1818,11 +1858,11 @@ function Lt(e) {
1818
1858
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
1819
1859
  },
1820
1860
  getTools(t, n, r) {
1821
- let i = G({
1861
+ let i = H({
1822
1862
  attachmentsRef: r,
1823
1863
  collected: n.collected,
1824
1864
  proxyFetch: y
1825
- }), a = t.scopedSubagentId ? H(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = It(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1865
+ }), a = t.scopedSubagentId ? z(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Vt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1826
1866
  name: `${t.id}_${r.name}`,
1827
1867
  description: `${t.label}: ${r.summary}`,
1828
1868
  inputSchema: r.inputSchema,
@@ -1836,7 +1876,7 @@ function Lt(e) {
1836
1876
  params: i
1837
1877
  }, {
1838
1878
  status: "queued",
1839
- note: _(X().handoffQueued, { label: t.label })
1879
+ note: _(K().handoffQueued, { label: t.label })
1840
1880
  };
1841
1881
  }
1842
1882
  })));
@@ -1846,17 +1886,17 @@ function Lt(e) {
1846
1886
  }
1847
1887
  //#endregion
1848
1888
  //#region src/presentation/deriveHistoryTitle.ts
1849
- function Rt(e, t) {
1889
+ function Ut(e, t) {
1850
1890
  return e.deriveHistoryTitle?.(t) ?? e.label;
1851
1891
  }
1852
1892
  //#endregion
1853
1893
  //#region src/presentation/ResultDestinationPicker.tsx
1854
- function zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1855
- let s = Q(), c = $(), l = c.scope, u = C(), [d, f] = j(null), [p, m] = j(new Set(i ?? [])), [h, g] = j(null), v = be(), y = /* @__PURE__ */ new Map();
1894
+ function Wt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1895
+ let s = Q(), c = $(), l = c.scope, u = C(), [d, f] = j(null), [p, m] = j(new Set(i ?? [])), [h, g] = j(null), v = xe(), y = /* @__PURE__ */ new Map();
1856
1896
  e.destinationIds.forEach((e) => {
1857
1897
  let t = v[e];
1858
1898
  t && y.set(e, t);
1859
- }), (o ?? []).forEach((e) => y.set(e.id, e)), y.set(_e.id, _e);
1899
+ }), (o ?? []).forEach((e) => y.set(e.id, e)), y.set(ve.id, ve);
1860
1900
  let b = Array.from(y.values()), x = async (i) => {
1861
1901
  f(i), g(null);
1862
1902
  try {
@@ -1869,23 +1909,23 @@ function zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1869
1909
  storageProvider: l?.storageProvider ?? null,
1870
1910
  proxyFetch: u
1871
1911
  }, n);
1872
- m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Rt(e, n));
1912
+ m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Ut(e, n));
1873
1913
  } catch (e) {
1874
1914
  g(e instanceof Error ? e.message : String(e));
1875
1915
  } finally {
1876
1916
  f(null);
1877
1917
  }
1878
1918
  };
1879
- return /* @__PURE__ */ P("div", {
1919
+ return /* @__PURE__ */ N("div", {
1880
1920
  className: "space-y-2",
1881
1921
  children: [
1882
- /* @__PURE__ */ N("p", {
1922
+ /* @__PURE__ */ M("p", {
1883
1923
  className: "text-xs font-medium text-muted-foreground",
1884
1924
  children: s.destinationPickerTitle
1885
1925
  }),
1886
- /* @__PURE__ */ N("div", {
1926
+ /* @__PURE__ */ M("div", {
1887
1927
  className: "flex flex-wrap gap-2",
1888
- children: b.map((e) => /* @__PURE__ */ N("button", {
1928
+ children: b.map((e) => /* @__PURE__ */ M("button", {
1889
1929
  type: "button",
1890
1930
  disabled: d !== null,
1891
1931
  onClick: () => void x(e.id),
@@ -1893,7 +1933,7 @@ function zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1893
1933
  children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
1894
1934
  }, e.id))
1895
1935
  }),
1896
- h && /* @__PURE__ */ N("p", {
1936
+ h && /* @__PURE__ */ M("p", {
1897
1937
  className: "text-xs text-destructive",
1898
1938
  children: h
1899
1939
  })
@@ -1902,33 +1942,33 @@ function zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1902
1942
  }
1903
1943
  //#endregion
1904
1944
  //#region src/presentation/reports/subagentReportRegistry.tsx
1905
- var Bt = {};
1906
- function Vt(e) {
1907
- Object.assign(Bt, e);
1945
+ var Gt = {};
1946
+ function Kt(e) {
1947
+ Object.assign(Gt, e);
1908
1948
  }
1909
- function Ht(e) {
1910
- return Bt[e];
1949
+ function qt(e) {
1950
+ return Gt[e];
1911
1951
  }
1912
1952
  //#endregion
1913
1953
  //#region src/presentation/reports/GenericResultPreview.tsx
1914
- function Ut({ result: e }) {
1954
+ function Jt({ result: e }) {
1915
1955
  let [t, n] = j(!1);
1916
- return /* @__PURE__ */ P("div", {
1956
+ return /* @__PURE__ */ N("div", {
1917
1957
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
1918
1958
  onClick: () => n((e) => !e),
1919
1959
  title: t ? "Clic per comprimere" : "Clic per espandere",
1920
- children: [/* @__PURE__ */ N(s, {
1960
+ children: [/* @__PURE__ */ M(s, {
1921
1961
  language: "json",
1922
1962
  showCopy: t,
1923
1963
  background: "transparent",
1924
1964
  className: "!text-[11px]",
1925
1965
  children: JSON.stringify(e, null, 2)
1926
- }), !t && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
1966
+ }), !t && /* @__PURE__ */ M("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
1927
1967
  });
1928
1968
  }
1929
1969
  //#endregion
1930
1970
  //#region src/presentation/liveAnchorDestination.ts
1931
- function Wt(e, t, n) {
1971
+ function Yt(e, t, n) {
1932
1972
  return e.length === 0 ? null : {
1933
1973
  id: "live-component",
1934
1974
  label: "Applica al componente aperto",
@@ -1939,38 +1979,38 @@ function Wt(e, t, n) {
1939
1979
  }
1940
1980
  //#endregion
1941
1981
  //#region src/presentation/subagentControls.ts
1942
- var Gt = {};
1943
- function Kt(e) {
1944
- Object.assign(Gt, e);
1982
+ var Xt = {};
1983
+ function Zt(e) {
1984
+ Object.assign(Xt, e);
1945
1985
  }
1946
- function qt(e) {
1947
- return Gt[e];
1986
+ function Qt(e) {
1987
+ return Xt[e];
1948
1988
  }
1949
1989
  //#endregion
1950
1990
  //#region src/presentation/chatTitles.ts
1951
- function Jt(e, t = 6e3) {
1952
- let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !ze(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
1991
+ function $t(e, t = 6e3) {
1992
+ let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !We(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
1953
1993
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
1954
1994
  }
1955
- function Yt(e) {
1995
+ function en(e) {
1956
1996
  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);
1957
1997
  }
1958
- function Xt(e, t) {
1998
+ function tn(e, t) {
1959
1999
  try {
1960
2000
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
1961
2001
  } catch {
1962
2002
  return;
1963
2003
  }
1964
2004
  }
1965
- function Zt(e, t, n, r, i) {
1966
- let a = Xt(e, t), o = (e) => {
2005
+ function nn(e, t, n, r, i) {
2006
+ let a = tn(e, t), o = (e) => {
1967
2007
  let t = e ? v(e) : null;
1968
2008
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
1969
2009
  };
1970
2010
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
1971
2011
  }
1972
- function Qt(e) {
1973
- let t = b()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Tt(), i = A({
2012
+ function rn(e) {
2013
+ let t = b()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = At(), i = A({
1974
2014
  registry: t,
1975
2015
  modelsByProvider: n,
1976
2016
  selectedModel: r
@@ -1982,18 +2022,18 @@ function Qt(e) {
1982
2022
  };
1983
2023
  let a = A(/* @__PURE__ */ new Set()), o = T(async (t, n, r) => {
1984
2024
  if (!e) return !1;
1985
- let o = Me(e, t, n), s = H(t), c = `${e}:${t}:${n}`;
1986
- if (!o || !s?.autoTitle || o.name || !Re(o) || a.current.has(c)) return !1;
1987
- let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = Zt(s, o.params, r ?? d, u, l), p = f ? v(f) : null;
2025
+ let o = Le(e, t, n), s = z(t), c = `${e}:${t}:${n}`;
2026
+ if (!o || !s?.autoTitle || o.name || !Ue(o) || a.current.has(c)) return !1;
2027
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = nn(s, o.params, r ?? d, u, l), p = f ? v(f) : null;
1988
2028
  if (!p) return !1;
1989
2029
  a.current.add(c);
1990
2030
  try {
1991
2031
  let r = await l[p.provider].complete({
1992
- prompt: X().chatTitle.replace("{chat}", Jt(o.activity)),
2032
+ prompt: K().chatTitle.replace("{chat}", $t(o.activity)),
1993
2033
  model: p.model,
1994
2034
  history: []
1995
- }), i = r && r.type === "text" ? Yt(r.text) : "";
1996
- return i ? Be(e, t, n, i, "model") : !1;
2035
+ }), i = r && r.type === "text" ? en(r.text) : "";
2036
+ return i ? Ge(e, t, n, i, "model") : !1;
1997
2037
  } catch {
1998
2038
  return !1;
1999
2039
  } finally {
@@ -2001,12 +2041,12 @@ function Qt(e) {
2001
2041
  }
2002
2042
  }, [e]), s = Object.keys(n).length > 0;
2003
2043
  return D(() => {
2004
- e && s && !$t.has(e) && ($t.add(e), (async () => {
2005
- for (let t of Ue(e)) {
2006
- let n = H(t.subagentId);
2044
+ e && s && !an.has(e) && (an.add(e), (async () => {
2045
+ for (let t of Je(e)) {
2046
+ let n = z(t.subagentId);
2007
2047
  if (n?.autoTitle) {
2008
- if (n.definition.conversational && !Re(t)) {
2009
- He(e, t.subagentId, t.entityId);
2048
+ if (n.definition.conversational && !Ue(t)) {
2049
+ qe(e, t.subagentId, t.entityId);
2010
2050
  continue;
2011
2051
  }
2012
2052
  t.name || await o(t.subagentId, t.entityId);
@@ -2019,23 +2059,23 @@ function Qt(e) {
2019
2059
  o
2020
2060
  ]), o;
2021
2061
  }
2022
- var $t = /* @__PURE__ */ new Set(), en = () => ({});
2023
- function tn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2024
- let c = Mt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = C(), f = A(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = j(null), h = (t) => {
2062
+ var an = /* @__PURE__ */ new Set(), on = () => ({});
2063
+ function sn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2064
+ let c = Lt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = C(), f = A(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = j(null), h = (t) => {
2025
2065
  e.definition.conversational || m(t);
2026
- }, [g, _] = j([]), [v, y] = j(null), b = Ht(e.id), x = b?.kind === "selection" ? b : null, [S, w] = j(null), T = A(!1), E = A(0), O = A(null);
2066
+ }, [g, _] = j([]), [v, y] = j(null), b = qt(e.id), x = b?.kind === "selection" ? b : null, [S, w] = j(null), T = A(!1), E = A(0), O = A(null);
2027
2067
  p && p !== O.current && (O.current = p, E.current = (r?.length ?? 0) + c.activity.length);
2028
- let F = A(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
2068
+ let P = A(!1), te = c.remote || !c.hasProviders || c.selectedModel !== "";
2029
2069
  D(() => {
2030
- !T.current && ee && (T.current = !0, a ? (W.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
2070
+ !T.current && te && (T.current = !0, a ? (V.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
2031
2071
  model: o,
2032
2072
  openingMessage: s
2033
2073
  }).then((e) => {
2034
2074
  e && h(e);
2035
2075
  })));
2036
- }, [ee]), D(() => {
2076
+ }, [te]), D(() => {
2037
2077
  if (!p || !u) return;
2038
- let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = be();
2078
+ let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = xe();
2039
2079
  n.forEach((n) => {
2040
2080
  let a = i[n];
2041
2081
  a && (y(null), a.apply(p, {
@@ -2047,7 +2087,7 @@ function tn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2047
2087
  ...t,
2048
2088
  pinnedEntityId: r
2049
2089
  }).then((n) => {
2050
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Rt(e, t));
2090
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Ut(e, t));
2051
2091
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2052
2092
  });
2053
2093
  }, [
@@ -2057,85 +2097,85 @@ function tn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2057
2097
  ]), D(() => {
2058
2098
  p && x && w(x.defaultSelection(p));
2059
2099
  }, [p, x]);
2060
- let I = (e, t) => {
2100
+ let F = (e, t) => {
2061
2101
  w((n) => n && {
2062
2102
  ...n,
2063
2103
  [e]: t
2064
2104
  });
2065
- }, L = (e) => h(e), R = k(() => p && x && S ? x.applySelection(p, S) : p, [
2105
+ }, ne = (e) => h(e), I = k(() => p && x && S ? x.applySelection(p, S) : p, [
2066
2106
  p,
2067
2107
  x,
2068
2108
  S
2069
- ]), z = k(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = k(() => Wt(z, t, f), [
2070
- z,
2109
+ ]), re = k(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), L = k(() => Yt(re, t, f), [
2110
+ re,
2071
2111
  t,
2072
2112
  f
2073
- ]), te = k(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = Qt(u?.id), U = A(!1), W = A(!1);
2113
+ ]), ie = k(() => L ? [L, ...n ?? []] : n, [L, n]), R = e.chatEntityId?.(t), z = rn(u?.id), B = A(!1), V = A(!1);
2074
2114
  D(() => {
2075
- let n = !U.current && c.running, i = U.current && !c.running;
2076
- if (U.current = c.running, !n && !i || !V || !u) return;
2077
- if (W.current) {
2078
- i && (W.current = !1);
2115
+ let n = !B.current && c.running, i = B.current && !c.running;
2116
+ if (B.current = c.running, !n && !i || !R || !u) return;
2117
+ if (V.current) {
2118
+ i && (V.current = !1);
2079
2119
  return;
2080
2120
  }
2081
2121
  let a = c.snapshot();
2082
2122
  if (!a) return;
2083
2123
  let o = [...r ?? [], ...a.activity];
2084
- e.autoTitle && e.definition.conversational && !Re({ activity: o }) || (Ne({
2124
+ e.autoTitle && e.definition.conversational && !Ue({ activity: o }) || (Re({
2085
2125
  scopeId: u.id,
2086
2126
  subagentId: e.id,
2087
- entityId: V,
2127
+ entityId: R,
2088
2128
  params: t,
2089
- title: Rt(e, t),
2129
+ title: Ut(e, t),
2090
2130
  history: a.history,
2091
2131
  activity: o
2092
- }), i && e.autoTitle && H(e.id, V, c.selectedModel));
2132
+ }), i && e.autoTitle && z(e.id, R, c.selectedModel));
2093
2133
  }, [c.running]);
2094
- let G = () => {
2095
- F.current = !0, c.running && c.stop(), l.closeTask(f);
2096
- }, K = A(qt(e.id) ?? en).current, q = K({
2134
+ let H = () => {
2135
+ P.current = !0, c.running && c.stop(), l.closeTask(f);
2136
+ }, U = A(Qt(e.id) ?? on).current, W = U({
2097
2137
  params: t,
2098
2138
  taskId: f,
2099
2139
  running: c.running,
2100
- close: G
2101
- }), ne = (e) => {
2140
+ close: H
2141
+ }), ae = (e) => {
2102
2142
  _((t) => t.includes(e) ? t : [...t, e]);
2103
2143
  };
2104
2144
  return D(() => {
2105
- F.current || l.openTask({
2145
+ P.current || l.openTask({
2106
2146
  id: f,
2107
- title: Rt(e, t),
2147
+ title: Ut(e, t),
2108
2148
  icon: e.icon,
2109
2149
  agent: c,
2110
2150
  onApplied: (e) => h(e),
2111
2151
  precedingActivity: r,
2112
2152
  panelExtraAnchorIndex: E.current,
2113
- onDismiss: G,
2114
- ...V ? { savedToDisk: !0 } : {},
2115
- panelActions: q.content,
2116
- composerActions: q.actions,
2117
- composerCommands: q.commands,
2118
- panelExtra: p ? /* @__PURE__ */ P(M, { children: [
2119
- x && S ? /* @__PURE__ */ N(x.Report, {
2153
+ onDismiss: H,
2154
+ ...R ? { savedToDisk: !0 } : {},
2155
+ panelActions: W.content,
2156
+ composerActions: W.actions,
2157
+ composerCommands: W.commands,
2158
+ panelExtra: p ? /* @__PURE__ */ N(ee, { children: [
2159
+ x && S ? /* @__PURE__ */ M(x.Report, {
2120
2160
  result: p,
2121
2161
  selection: S,
2122
- onChange: I
2123
- }) : b?.kind === "editable" ? /* @__PURE__ */ N(b.Report, {
2162
+ onChange: F
2163
+ }) : b?.kind === "editable" ? /* @__PURE__ */ M(b.Report, {
2124
2164
  result: p,
2125
- onResultChange: L
2126
- }) : /* @__PURE__ */ N(Ut, { result: R }),
2127
- v && /* @__PURE__ */ P("p", {
2165
+ onResultChange: ne
2166
+ }) : /* @__PURE__ */ M(Jt, { result: I }),
2167
+ v && /* @__PURE__ */ N("p", {
2128
2168
  className: "text-xs text-destructive",
2129
2169
  children: ["Salvataggio automatico non riuscito: ", v]
2130
2170
  }),
2131
- /* @__PURE__ */ N(zt, {
2171
+ /* @__PURE__ */ M(Wt, {
2132
2172
  manifest: e,
2133
- result: R,
2173
+ result: I,
2134
2174
  meta: t,
2135
2175
  taskId: f,
2136
2176
  initiallyApplied: g,
2137
- onApplied: ne,
2138
- extraDestinations: te
2177
+ onApplied: ae,
2178
+ extraDestinations: ie
2139
2179
  })
2140
2180
  ] }) : void 0
2141
2181
  });
@@ -2154,29 +2194,29 @@ function tn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2154
2194
  e,
2155
2195
  t,
2156
2196
  p,
2157
- R,
2197
+ I,
2158
2198
  S,
2159
2199
  g,
2160
2200
  n,
2161
2201
  r,
2162
2202
  v,
2163
- q.content,
2164
- q.actions,
2165
- q.commands
2203
+ W.content,
2204
+ W.actions,
2205
+ W.commands
2166
2206
  ]), D(() => () => {
2167
2207
  l.closeTask(f);
2168
2208
  }, [l.closeTask, f]), null;
2169
2209
  }
2170
2210
  //#endregion
2171
2211
  //#region src/presentation/OrchestratorRunner.tsx
2172
- function nn({ userGoal: e }) {
2173
- let t = Q(), n = Mt(k(() => Lt({
2212
+ function cn({ userGoal: e }) {
2213
+ let t = Q(), n = Lt(k(() => Ht({
2174
2214
  unavailable: t.orchestratorUnavailable,
2175
2215
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2176
2216
  preparing: t.orchestratorPreparing,
2177
2217
  collecting: t.orchestratorCollecting
2178
2218
  }), []), { defaultEnabled: !0 }), r = $(), [i, a] = j(null), o = A(!1), s = !n.hasProviders || n.selectedModel !== "", c = A(r.pendingExtraDestinations), l = A(r.pendingAttachments), u = A(r.pendingModel), d = A(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), f = A(r.pendingCarryOver), p = A(!1), m = (e) => {
2179
- e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Ke));
2219
+ e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Ze));
2180
2220
  };
2181
2221
  D(() => {
2182
2222
  !o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
@@ -2192,7 +2232,7 @@ function nn({ userGoal: e }) {
2192
2232
  }));
2193
2233
  }, [s]), D(() => {
2194
2234
  p.current || r.openTask({
2195
- id: Ke,
2235
+ id: Ze,
2196
2236
  title: "Agentico",
2197
2237
  icon: "bot",
2198
2238
  agent: n,
@@ -2200,7 +2240,7 @@ function nn({ userGoal: e }) {
2200
2240
  scopedSubagentId: d.current,
2201
2241
  precedingActivity: f.current?.activity,
2202
2242
  onDismiss: () => {
2203
- p.current = !0, n.running && n.stop(), r.closeTask(Ke);
2243
+ p.current = !0, n.running && n.stop(), r.closeTask(Ze);
2204
2244
  }
2205
2245
  });
2206
2246
  }, [
@@ -2213,12 +2253,12 @@ function nn({ userGoal: e }) {
2213
2253
  n.hasProviders,
2214
2254
  r.openTask
2215
2255
  ]), D(() => () => {
2216
- r.closeTask(Ke);
2256
+ r.closeTask(Ze);
2217
2257
  }, [r.closeTask]);
2218
2258
  let h = k(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2219
2259
  if (!i) return null;
2220
- let g = H(i.subagentId);
2221
- return g ? /* @__PURE__ */ N(tn, {
2260
+ let g = z(i.subagentId);
2261
+ return g ? /* @__PURE__ */ M(sn, {
2222
2262
  manifest: g,
2223
2263
  params: i.params,
2224
2264
  extraDestinations: c.current,
@@ -2229,8 +2269,8 @@ function nn({ userGoal: e }) {
2229
2269
  }
2230
2270
  //#endregion
2231
2271
  //#region src/presentation/ManualEntryRunner.tsx
2232
- function rn({ manifest: e, extraDestinations: n }) {
2233
- let r = Mt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = A(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = j(null), [l, u] = j([]), d = Ht(e.id), f = d?.kind === "selection" ? d : null, [p, m] = j(null), [h, g] = j(null), _ = A(!1), v = (t) => {
2272
+ function ln({ manifest: e, extraDestinations: n }) {
2273
+ let r = Lt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = A(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = j(null), [l, u] = j([]), d = qt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = j(null), [h, g] = j(null), _ = A(!1), v = (t) => {
2234
2274
  if (!e.manualEntry) return;
2235
2275
  let n;
2236
2276
  try {
@@ -2257,7 +2297,7 @@ function rn({ manifest: e, extraDestinations: n }) {
2257
2297
  p
2258
2298
  ]), S = (e) => {
2259
2299
  u((t) => t.includes(e) ? t : [...t, e]);
2260
- }, C = k(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = k(() => h ? Wt(C, h, o) : null, [
2300
+ }, C = k(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = k(() => h ? Yt(C, h, o) : null, [
2261
2301
  C,
2262
2302
  h,
2263
2303
  o
@@ -2276,18 +2316,18 @@ function rn({ manifest: e, extraDestinations: n }) {
2276
2316
  onDismiss: () => {
2277
2317
  _.current = !0, r.running && r.stop(), a.closeTask(o);
2278
2318
  },
2279
- panelExtra: s ? /* @__PURE__ */ P("div", {
2319
+ panelExtra: s ? /* @__PURE__ */ N("div", {
2280
2320
  className: "space-y-2",
2281
2321
  children: [
2282
- f && p ? /* @__PURE__ */ N(f.Report, {
2322
+ f && p ? /* @__PURE__ */ M(f.Report, {
2283
2323
  result: s,
2284
2324
  selection: p,
2285
2325
  onChange: y
2286
- }) : d?.kind === "editable" ? /* @__PURE__ */ N(d.Report, {
2326
+ }) : d?.kind === "editable" ? /* @__PURE__ */ M(d.Report, {
2287
2327
  result: s,
2288
2328
  onResultChange: b
2289
- }) : /* @__PURE__ */ N(Ut, { result: x }),
2290
- /* @__PURE__ */ N(zt, {
2329
+ }) : /* @__PURE__ */ M(Jt, { result: x }),
2330
+ /* @__PURE__ */ M(Wt, {
2291
2331
  manifest: e,
2292
2332
  result: x,
2293
2333
  meta: h ?? {},
@@ -2296,7 +2336,7 @@ function rn({ manifest: e, extraDestinations: n }) {
2296
2336
  onApplied: S,
2297
2337
  extraDestinations: T
2298
2338
  }),
2299
- r.hasProviders && /* @__PURE__ */ N(t, {
2339
+ r.hasProviders && /* @__PURE__ */ M(t, {
2300
2340
  label: i.resumeWithAi,
2301
2341
  variant: "outline-secondary",
2302
2342
  className: "text-xs",
@@ -2324,7 +2364,7 @@ function rn({ manifest: e, extraDestinations: n }) {
2324
2364
  }
2325
2365
  //#endregion
2326
2366
  //#region src/presentation/Agentico.tsx
2327
- function an(e, t) {
2367
+ function un(e, t) {
2328
2368
  return Object.values(e).flat().map((e) => {
2329
2369
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2330
2370
  return {
@@ -2336,7 +2376,7 @@ function an(e, t) {
2336
2376
  };
2337
2377
  });
2338
2378
  }
2339
- function on({ task: e }) {
2379
+ function dn({ task: e }) {
2340
2380
  let t = Q(), [n, r] = j(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
2341
2381
  if (r(""), s) {
2342
2382
  s.onSubmit(e.text);
@@ -2348,8 +2388,8 @@ function on({ task: e }) {
2348
2388
  }).then((e) => {
2349
2389
  e && a(e);
2350
2390
  });
2351
- }, u = !!s || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...an(i.modelsByProvider, i.catalogGroup)] : an(i.modelsByProvider);
2352
- return /* @__PURE__ */ N(o, {
2391
+ }, u = !!s || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...un(i.modelsByProvider, i.catalogGroup)] : un(i.modelsByProvider);
2392
+ return /* @__PURE__ */ M(o, {
2353
2393
  value: n,
2354
2394
  onChange: r,
2355
2395
  placeholder: s?.prompt ?? t.messagePlaceholder,
@@ -2368,21 +2408,21 @@ function on({ task: e }) {
2368
2408
  maxHeight: 220
2369
2409
  });
2370
2410
  }
2371
- function sn() {
2372
- let { startOrchestrator: e } = $(), t = Q(), [n, r] = j(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = Tt(), l = (t) => {
2411
+ function fn() {
2412
+ let { startOrchestrator: e } = $(), t = Q(), [n, r] = j(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = At(), l = (t) => {
2373
2413
  t.text.trim() && (e(t.text.trim(), {
2374
2414
  attachments: t.files.length > 0 ? t.files : void 0,
2375
2415
  model: t.model || void 0
2376
2416
  }), r(""));
2377
2417
  }, u = i && !s;
2378
- return /* @__PURE__ */ N(o, {
2418
+ return /* @__PURE__ */ M(o, {
2379
2419
  value: n,
2380
2420
  onChange: r,
2381
2421
  placeholder: t.orchestratorStarterPlaceholder,
2382
2422
  disabled: !n.trim() || u,
2383
2423
  onSubmit: l,
2384
2424
  attachments: !0,
2385
- models: an(a),
2425
+ models: un(a),
2386
2426
  selectedModel: s,
2387
2427
  onModelChange: c,
2388
2428
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2390,30 +2430,30 @@ function sn() {
2390
2430
  maxHeight: 220
2391
2431
  });
2392
2432
  }
2393
- function cn({ chat: e, onClose: t }) {
2433
+ function pn({ chat: e, onClose: t }) {
2394
2434
  let n = Q(), r = x();
2395
- return /* @__PURE__ */ N(p, {
2435
+ return /* @__PURE__ */ M(p, {
2396
2436
  title: n.renameChat,
2397
2437
  size: "sm",
2398
2438
  onClose: t,
2399
- onSave: () => (Be(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Le(e)), "person"), t(), Promise.resolve(!0)),
2400
- children: /* @__PURE__ */ P(u, {
2439
+ onSave: () => (Ge(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? He(e)), "person"), t(), Promise.resolve(!0)),
2440
+ children: /* @__PURE__ */ N(u, {
2401
2441
  appearance: "empty",
2402
2442
  controller: r,
2403
- defaultValues: { title: Le(e) },
2443
+ defaultValues: { title: He(e) },
2404
2444
  footer: !1,
2405
- children: [/* @__PURE__ */ N(f, {
2445
+ children: [/* @__PURE__ */ M(f, {
2406
2446
  name: "title",
2407
2447
  label: n.chatTitleLabel,
2408
2448
  placeholder: e.title
2409
- }), /* @__PURE__ */ N("p", {
2449
+ }), /* @__PURE__ */ M("p", {
2410
2450
  className: "text-xs text-muted-foreground",
2411
2451
  children: n.chatTitleHint
2412
2452
  })]
2413
2453
  })
2414
2454
  });
2415
2455
  }
2416
- function ln(e, t, n = Date.now()) {
2456
+ function mn(e, t, n = Date.now()) {
2417
2457
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2418
2458
  numeric: "auto",
2419
2459
  style: "short"
@@ -2425,55 +2465,55 @@ function ln(e, t, n = Date.now()) {
2425
2465
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2426
2466
  return i.format(0, "minute");
2427
2467
  }
2428
- function un({ card: e }) {
2468
+ function hn({ card: e }) {
2429
2469
  let t = Q();
2430
- return e.humanSummaryOnly ? /* @__PURE__ */ P("div", {
2470
+ return e.humanSummaryOnly ? /* @__PURE__ */ N("div", {
2431
2471
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2432
- children: [/* @__PURE__ */ P("p", {
2472
+ children: [/* @__PURE__ */ N("p", {
2433
2473
  className: "text-xs font-medium text-foreground",
2434
2474
  children: [
2435
2475
  "\"",
2436
2476
  e.label,
2437
2477
  "\""
2438
2478
  ]
2439
- }), /* @__PURE__ */ N("p", {
2479
+ }), /* @__PURE__ */ M("p", {
2440
2480
  className: "text-xs text-muted-foreground",
2441
2481
  children: e.humanSummary
2442
2482
  })]
2443
- }) : /* @__PURE__ */ P("div", {
2483
+ }) : /* @__PURE__ */ N("div", {
2444
2484
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2445
2485
  children: [
2446
- /* @__PURE__ */ N("p", {
2486
+ /* @__PURE__ */ M("p", {
2447
2487
  className: "text-xs font-medium text-foreground",
2448
2488
  children: _(t.newInstance, { label: e.label })
2449
2489
  }),
2450
- /* @__PURE__ */ N("p", {
2490
+ /* @__PURE__ */ M("p", {
2451
2491
  className: "text-xs text-muted-foreground",
2452
2492
  children: e.humanSummary
2453
2493
  }),
2454
- e.fields.length > 0 && /* @__PURE__ */ N("ul", {
2494
+ e.fields.length > 0 && /* @__PURE__ */ M("ul", {
2455
2495
  className: "space-y-1",
2456
- children: e.fields.map((e) => /* @__PURE__ */ P("li", {
2496
+ children: e.fields.map((e) => /* @__PURE__ */ N("li", {
2457
2497
  className: "flex items-start gap-1.5 text-xs",
2458
- children: [/* @__PURE__ */ N(n, {
2498
+ children: [/* @__PURE__ */ M(n, {
2459
2499
  variant: e.required ? "primary" : "secondary",
2460
2500
  className: "mt-px shrink-0",
2461
2501
  children: e.required ? "richiesto" : "opzionale"
2462
- }), /* @__PURE__ */ P("span", {
2502
+ }), /* @__PURE__ */ N("span", {
2463
2503
  className: "min-w-0",
2464
- children: [/* @__PURE__ */ N("span", {
2504
+ children: [/* @__PURE__ */ M("span", {
2465
2505
  className: "font-mono text-foreground",
2466
2506
  children: e.key
2467
- }), e.humanDescription ? /* @__PURE__ */ P("span", {
2507
+ }), e.humanDescription ? /* @__PURE__ */ N("span", {
2468
2508
  className: "text-muted-foreground",
2469
2509
  children: [" — ", e.humanDescription]
2470
2510
  }) : null]
2471
2511
  })]
2472
2512
  }, e.key))
2473
2513
  }),
2474
- e.example && /* @__PURE__ */ P("p", {
2514
+ e.example && /* @__PURE__ */ N("p", {
2475
2515
  className: "text-xs text-muted-foreground",
2476
- children: ["Esempio: ", /* @__PURE__ */ N("span", {
2516
+ children: ["Esempio: ", /* @__PURE__ */ M("span", {
2477
2517
  className: "font-mono",
2478
2518
  children: e.example
2479
2519
  })]
@@ -2481,40 +2521,40 @@ function un({ card: e }) {
2481
2521
  ]
2482
2522
  });
2483
2523
  }
2484
- function dn({ messages: e }) {
2485
- return /* @__PURE__ */ N("div", {
2524
+ function gn({ messages: e }) {
2525
+ return /* @__PURE__ */ M("div", {
2486
2526
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2487
- children: e.map((e, t) => /* @__PURE__ */ N("p", {
2527
+ children: e.map((e, t) => /* @__PURE__ */ M("p", {
2488
2528
  className: "text-xs text-muted-foreground",
2489
2529
  children: e
2490
2530
  }, t))
2491
2531
  });
2492
2532
  }
2493
- function fn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2533
+ function _n({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2494
2534
  let u = Q(), { locale: f } = S(), [p, m] = j(""), [h, g] = j(0);
2495
- D(() => ke(() => g((e) => e + 1)), []);
2496
- let _ = k(() => r ? Ue(e) : [], [
2535
+ D(() => Fe(() => g((e) => e + 1)), []);
2536
+ let _ = k(() => r ? Je(e) : [], [
2497
2537
  e,
2498
2538
  r,
2499
2539
  h
2500
2540
  ]), [v, y] = j(null), b = async (t) => {
2501
- let r = H(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2541
+ let r = z(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2502
2542
  if (!i || window.confirm(i)) {
2503
2543
  try {
2504
2544
  await r?.onArchive?.(t.entityId, t.params);
2505
2545
  } catch {
2506
2546
  return;
2507
2547
  }
2508
- He(e, t.subagentId, t.entityId), n === We(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2548
+ qe(e, t.subagentId, t.entityId), n === Ye(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2509
2549
  }
2510
2550
  }, x = k(() => {
2511
2551
  let e = p.trim().toLowerCase();
2512
2552
  return e ? _.filter((t) => {
2513
- let n = H(t.subagentId)?.label ?? t.subagentId;
2514
- return Le(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
2553
+ let n = z(t.subagentId)?.label ?? t.subagentId;
2554
+ return He(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
2515
2555
  }) : _;
2516
2556
  }, [_, p]);
2517
- return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(c, {
2557
+ return /* @__PURE__ */ N(ee, { children: [/* @__PURE__ */ M(c, {
2518
2558
  trigger: {
2519
2559
  icon: "history",
2520
2560
  title: u.chatHistory
@@ -2525,22 +2565,22 @@ function fn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2525
2565
  position: "end",
2526
2566
  strategy: "absolute",
2527
2567
  menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
2528
- header: /* @__PURE__ */ P("div", {
2568
+ header: /* @__PURE__ */ N("div", {
2529
2569
  className: "flex items-center gap-2 px-1 pb-1.5",
2530
2570
  children: [
2531
- /* @__PURE__ */ N(d, {
2571
+ /* @__PURE__ */ M(d, {
2532
2572
  name: "search",
2533
2573
  size: 14,
2534
2574
  className: "shrink-0 text-muted-foreground"
2535
2575
  }),
2536
- /* @__PURE__ */ N("input", {
2576
+ /* @__PURE__ */ M("input", {
2537
2577
  autoFocus: !0,
2538
2578
  value: p,
2539
2579
  onChange: (e) => m(e.target.value),
2540
2580
  placeholder: u.searchChats,
2541
2581
  className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
2542
2582
  }),
2543
- /* @__PURE__ */ N(t, {
2583
+ /* @__PURE__ */ M(t, {
2544
2584
  icon: "square-pen",
2545
2585
  ariaLabel: u.newChat,
2546
2586
  title: u.newChat,
@@ -2550,12 +2590,12 @@ function fn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2550
2590
  })
2551
2591
  ]
2552
2592
  }),
2553
- children: x.length === 0 ? /* @__PURE__ */ N("p", {
2593
+ children: x.length === 0 ? /* @__PURE__ */ M("p", {
2554
2594
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
2555
2595
  children: _.length === 0 ? u.noSavedChats : u.noResults
2556
2596
  }) : x.map((e) => {
2557
- let t = H(e.subagentId), r = n === We(e.subagentId, e.entityId);
2558
- return /* @__PURE__ */ N(l, {
2597
+ let t = z(e.subagentId), r = n === Ye(e.subagentId, e.entityId);
2598
+ return /* @__PURE__ */ M(l, {
2559
2599
  icon: r ? "check" : t?.icon ?? "bot",
2560
2600
  className: r ? "bg-accent font-semibold text-primary" : void 0,
2561
2601
  actions: [{
@@ -2570,163 +2610,163 @@ function fn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2570
2610
  onClick: () => void b(e)
2571
2611
  }],
2572
2612
  onClick: () => a(e.subagentId, e.entityId, e),
2573
- children: /* @__PURE__ */ P("span", {
2613
+ children: /* @__PURE__ */ N("span", {
2574
2614
  className: "flex min-w-0 flex-1 items-center justify-between gap-2",
2575
- children: [/* @__PURE__ */ N("span", {
2615
+ children: [/* @__PURE__ */ M("span", {
2576
2616
  className: "min-w-0 truncate",
2577
- title: `${t?.label ?? e.subagentId} · ${Le(e)}`,
2578
- children: Le(e)
2579
- }), /* @__PURE__ */ N("span", {
2617
+ title: `${t?.label ?? e.subagentId} · ${He(e)}`,
2618
+ children: He(e)
2619
+ }), /* @__PURE__ */ M("span", {
2580
2620
  className: "shrink-0 text-xs text-muted-foreground",
2581
- title: `${u.chatStarted.replace("{at}", new Date(Ve(e)).toLocaleString(f))} · ${u.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(f))}`,
2582
- children: ln(Ve(e), f)
2621
+ title: `${u.chatStarted.replace("{at}", new Date(Ke(e)).toLocaleString(f))} · ${u.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(f))}`,
2622
+ children: mn(Ke(e), f)
2583
2623
  })]
2584
2624
  })
2585
2625
  }, `${e.subagentId}:${e.entityId}`);
2586
2626
  })
2587
- }), v && /* @__PURE__ */ N(cn, {
2627
+ }), v && /* @__PURE__ */ M(pn, {
2588
2628
  chat: v,
2589
2629
  onClose: () => y(null)
2590
2630
  })] });
2591
2631
  }
2592
- function pn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2632
+ function vn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2593
2633
  let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: C, scope: w } = $(), T = Q(), E = A(null), [O, k] = j(!1);
2594
- Qt(w?.id);
2595
- let F = yt({
2634
+ rn(w?.id);
2635
+ let P = wt({
2596
2636
  defaultWidth: e,
2597
2637
  minWidth: n,
2598
2638
  maxWidth: r,
2599
2639
  onWidthChange: i
2600
- }), ee = () => {
2640
+ }), te = () => {
2601
2641
  (!a || a.agent.running || a.savedToDisk || window.confirm(T.unsavedConversationConfirm)) && (m(), k(!1));
2602
- }, I = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], L = I.length, R = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? L, L)), z = I.slice(0, R), B = I.slice(R), te = !!(a && !a.agent.running && a.agent.error), V = new Set(a?.agent.activity.map((e) => e.id) ?? []), U = a ? {
2603
- canAnswer: (e) => V.has(e),
2642
+ }, F = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], ne = F.length, I = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? ne, ne)), re = F.slice(0, I), L = F.slice(I), ie = !!(a && !a.agent.running && a.agent.error), R = new Set(a?.agent.activity.map((e) => e.id) ?? []), B = a ? {
2643
+ canAnswer: (e) => R.has(e),
2604
2644
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2605
2645
  e && a.onApplied(e);
2606
2646
  })
2607
- } : void 0, W = U ? at(I, U.canAnswer) : null, G = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? H(a.scopedSubagentId) : void 0, K = G?.manualEntry ? G : null, q = A(!0);
2647
+ } : void 0, V = B ? ut(F, B.canAnswer) : null, H = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? z(a.scopedSubagentId) : void 0, U = H?.manualEntry ? H : null, W = A(!0);
2608
2648
  D(() => {
2609
2649
  let e = E.current;
2610
2650
  if (!e) return;
2611
2651
  let t = () => {
2612
- q.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2652
+ W.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2613
2653
  };
2614
2654
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
2615
2655
  }, [a?.id]), D(() => {
2616
2656
  let e = E.current;
2617
- e && (q.current = !0, e.scrollTop = e.scrollHeight);
2657
+ e && (W.current = !0, e.scrollTop = e.scrollHeight);
2618
2658
  }, [a?.id]);
2619
- let ne = I.at(-1)?.detail?.length ?? 0;
2659
+ let ae = F.at(-1)?.detail?.length ?? 0;
2620
2660
  D(() => {
2621
2661
  let e = E.current;
2622
- e && q.current && (e.scrollTop = e.scrollHeight);
2662
+ e && W.current && (e.scrollTop = e.scrollHeight);
2623
2663
  }, [
2624
- L,
2625
- te,
2626
- ne
2664
+ ne,
2665
+ ie,
2666
+ ae
2627
2667
  ]);
2628
- let J = A(null);
2668
+ let oe = A(null);
2629
2669
  D(() => {
2630
- let e = E.current, t = J.current;
2670
+ let e = E.current, t = oe.current;
2631
2671
  if (!e || !t || typeof ResizeObserver > "u") return;
2632
2672
  let n = new ResizeObserver(() => {
2633
- q.current && (e.scrollTop = e.scrollHeight);
2673
+ W.current && (e.scrollTop = e.scrollHeight);
2634
2674
  });
2635
2675
  return n.observe(t), () => n.disconnect();
2636
2676
  }, [a?.id, o]);
2637
- let Y = s ? /* @__PURE__ */ N(nn, { userGoal: s }, c) : null, re = f ? H(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ N(tn, {
2638
- manifest: re,
2677
+ let G = s ? /* @__PURE__ */ M(cn, { userGoal: s }, c) : null, se = f ? z(f.subagentId) : void 0, ce = f && se ? /* @__PURE__ */ M(sn, {
2678
+ manifest: se,
2639
2679
  params: f.snapshot.params,
2640
- taskId: We(f.subagentId, f.entityId),
2680
+ taskId: Ye(f.subagentId, f.entityId),
2641
2681
  resumeSeed: {
2642
2682
  history: f.snapshot.history,
2643
2683
  activity: f.snapshot.activity
2644
2684
  }
2645
- }, p) : null, X = g ? H(g.subagentId) : void 0, ae = g && X ? /* @__PURE__ */ N(rn, {
2646
- manifest: X,
2685
+ }, p) : null, K = g ? z(g.subagentId) : void 0, le = g && K ? /* @__PURE__ */ M(ln, {
2686
+ manifest: K,
2647
2687
  extraDestinations: g.extraDestinations
2648
- }, _) : null, oe = b ? H(b.subagentId) : void 0, se = b && oe ? /* @__PURE__ */ N(tn, {
2649
- manifest: oe,
2688
+ }, _) : null, ue = b ? z(b.subagentId) : void 0, q = b && ue ? /* @__PURE__ */ M(sn, {
2689
+ manifest: ue,
2650
2690
  params: b.params,
2651
2691
  extraDestinations: b.extraDestinations
2652
- }, x) : null, Z = S ? H(S.subagentId) : void 0, ce = S && Z ? /* @__PURE__ */ N(tn, {
2653
- manifest: Z,
2692
+ }, x) : null, J = S ? z(S.subagentId) : void 0, de = S && J ? /* @__PURE__ */ M(sn, {
2693
+ manifest: J,
2654
2694
  params: S.params,
2655
2695
  taskId: S.taskId,
2656
2696
  openingMessage: S.openingMessage
2657
2697
  }, C) : null;
2658
- return o ? /* @__PURE__ */ P(M, { children: [
2659
- Y,
2660
- ie,
2661
- ae,
2662
- se,
2698
+ return o ? /* @__PURE__ */ N(ee, { children: [
2699
+ G,
2663
2700
  ce,
2664
- /* @__PURE__ */ P("div", {
2665
- style: { width: F.width },
2701
+ le,
2702
+ q,
2703
+ de,
2704
+ /* @__PURE__ */ N("div", {
2705
+ style: { width: P.width },
2666
2706
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2667
2707
  children: [
2668
- /* @__PURE__ */ N(bt, {
2669
- width: F.width,
2670
- min: F.min,
2671
- max: F.max,
2672
- onResize: F.set,
2673
- onCommit: F.commit,
2674
- onReset: F.reset
2708
+ /* @__PURE__ */ M(Tt, {
2709
+ width: P.width,
2710
+ min: P.min,
2711
+ max: P.max,
2712
+ onResize: P.set,
2713
+ onCommit: P.commit,
2714
+ onReset: P.reset
2675
2715
  }),
2676
- /* @__PURE__ */ P("div", {
2716
+ /* @__PURE__ */ N("div", {
2677
2717
  className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
2678
2718
  children: [
2679
- /* @__PURE__ */ N("span", {
2719
+ /* @__PURE__ */ M("span", {
2680
2720
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2681
2721
  children: a ? a.title : "Agentico"
2682
2722
  }),
2683
- w && /* @__PURE__ */ N(fn, {
2723
+ w && /* @__PURE__ */ M(_n, {
2684
2724
  scopeId: w.id,
2685
2725
  currentTaskId: a?.id ?? null,
2686
2726
  open: O,
2687
2727
  onOpenChange: k,
2688
- onNewChat: ee,
2728
+ onNewChat: te,
2689
2729
  onSelect: (e, t, n) => h(e, t, n),
2690
2730
  onArchivedCurrent: m
2691
2731
  }),
2692
- /* @__PURE__ */ N(xt, {})
2732
+ /* @__PURE__ */ M(Et, {})
2693
2733
  ]
2694
2734
  }),
2695
- /* @__PURE__ */ N("div", {
2735
+ /* @__PURE__ */ M("div", {
2696
2736
  ref: E,
2697
- className: `flex-1 overflow-y-auto px-3 pb-2 ${W ? "min-h-24" : "min-h-0"}`,
2698
- children: /* @__PURE__ */ N("div", {
2699
- ref: J,
2737
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${V ? "min-h-24" : "min-h-0"}`,
2738
+ children: /* @__PURE__ */ M("div", {
2739
+ ref: oe,
2700
2740
  className: "pt-2",
2701
- children: a ? /* @__PURE__ */ P(M, { children: [
2702
- a.manualEntry && I.length === 0 && /* @__PURE__ */ N("p", {
2741
+ children: a ? /* @__PURE__ */ N(ee, { children: [
2742
+ a.manualEntry && F.length === 0 && /* @__PURE__ */ M("p", {
2703
2743
  className: "text-xs text-muted-foreground",
2704
2744
  children: a.manualEntry.prompt
2705
2745
  }),
2706
- /* @__PURE__ */ N(lt, {
2707
- activity: z,
2708
- questions: U,
2709
- docked: W,
2710
- pinUserMessages: !W
2746
+ /* @__PURE__ */ M(mt, {
2747
+ activity: re,
2748
+ questions: B,
2749
+ docked: V,
2750
+ pinUserMessages: !V
2711
2751
  }),
2712
- a.panelExtra && /* @__PURE__ */ N("div", {
2752
+ a.panelExtra && /* @__PURE__ */ M("div", {
2713
2753
  className: "mt-3",
2714
2754
  children: a.panelExtra
2715
2755
  }),
2716
- B.length > 0 && /* @__PURE__ */ N(lt, {
2717
- activity: B,
2718
- questions: U,
2719
- docked: W,
2720
- pinUserMessages: !W
2756
+ L.length > 0 && /* @__PURE__ */ M(mt, {
2757
+ activity: L,
2758
+ questions: B,
2759
+ docked: V,
2760
+ pinUserMessages: !V
2721
2761
  }),
2722
- !a.agent.running && a.agent.error && /* @__PURE__ */ P("div", {
2762
+ !a.agent.running && a.agent.error && /* @__PURE__ */ N("div", {
2723
2763
  className: "mt-2 flex items-center gap-2",
2724
2764
  children: [
2725
- /* @__PURE__ */ N("p", {
2765
+ /* @__PURE__ */ M("p", {
2726
2766
  className: "flex-1 text-xs text-destructive",
2727
2767
  children: a.agent.error
2728
2768
  }),
2729
- /* @__PURE__ */ N(t, {
2769
+ /* @__PURE__ */ M(t, {
2730
2770
  label: T.retry,
2731
2771
  variant: "secondary",
2732
2772
  className: "shrink-0",
@@ -2736,13 +2776,13 @@ function pn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2736
2776
  });
2737
2777
  }
2738
2778
  }),
2739
- !a.agent.remote && /* @__PURE__ */ N(t, {
2779
+ !a.agent.remote && /* @__PURE__ */ M(t, {
2740
2780
  label: T.continueWithoutAi,
2741
2781
  variant: "secondary",
2742
2782
  className: "shrink-0",
2743
2783
  onClick: () => {
2744
- if (K) {
2745
- v(K.id, y);
2784
+ if (U) {
2785
+ v(U.id, y);
2746
2786
  return;
2747
2787
  }
2748
2788
  let e = a.agent.runFallback();
@@ -2751,32 +2791,32 @@ function pn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2751
2791
  })
2752
2792
  ]
2753
2793
  })
2754
- ] }) : d.length > 0 ? /* @__PURE__ */ N(dn, { messages: d }) : u ? /* @__PURE__ */ N(un, { card: u }) : /* @__PURE__ */ N("p", {
2794
+ ] }) : d.length > 0 ? /* @__PURE__ */ M(gn, { messages: d }) : u ? /* @__PURE__ */ M(hn, { card: u }) : /* @__PURE__ */ M("p", {
2755
2795
  className: "text-xs text-muted-foreground",
2756
2796
  children: l ?? T.orchestratorStarterHint
2757
2797
  })
2758
2798
  })
2759
2799
  }),
2760
- a && W ? /* @__PURE__ */ P("section", {
2800
+ a && V ? /* @__PURE__ */ N("section", {
2761
2801
  "aria-label": T.pendingQuestions,
2762
2802
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
2763
2803
  children: [
2764
- a.panelActions && /* @__PURE__ */ N("div", {
2804
+ a.panelActions && /* @__PURE__ */ M("div", {
2765
2805
  className: "shrink-0 px-4 pt-3",
2766
2806
  children: a.panelActions
2767
2807
  }),
2768
- /* @__PURE__ */ N("div", {
2808
+ /* @__PURE__ */ M("div", {
2769
2809
  className: "min-h-0 overflow-y-auto px-4 py-3",
2770
- children: /* @__PURE__ */ N(ot, {
2771
- entry: W.entry,
2772
- part: W.part,
2773
- questions: U,
2810
+ children: /* @__PURE__ */ M(dt, {
2811
+ entry: V.entry,
2812
+ part: V.part,
2813
+ questions: B,
2774
2814
  autoFocus: !0
2775
- }, `${W.entry.id}:${W.part.id}`)
2815
+ }, `${V.entry.id}:${V.part.id}`)
2776
2816
  }),
2777
- a.agent.running && /* @__PURE__ */ N("div", {
2817
+ a.agent.running && /* @__PURE__ */ M("div", {
2778
2818
  className: "flex shrink-0 justify-end px-4 pb-3",
2779
- children: /* @__PURE__ */ N(t, {
2819
+ children: /* @__PURE__ */ M(t, {
2780
2820
  icon: "square",
2781
2821
  label: T.stop,
2782
2822
  variant: "secondary",
@@ -2784,32 +2824,32 @@ function pn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2784
2824
  })
2785
2825
  })
2786
2826
  ]
2787
- }) : /* @__PURE__ */ P("div", {
2827
+ }) : /* @__PURE__ */ N("div", {
2788
2828
  className: "border-t border-border/60 px-4 py-3",
2789
- children: [a?.panelActions && /* @__PURE__ */ N("div", {
2829
+ children: [a?.panelActions && /* @__PURE__ */ M("div", {
2790
2830
  className: "mb-2",
2791
2831
  children: a.panelActions
2792
- }), a ? /* @__PURE__ */ N(on, { task: a }, a.id) : /* @__PURE__ */ N(sn, {})]
2832
+ }), a ? /* @__PURE__ */ M(dn, { task: a }, a.id) : /* @__PURE__ */ M(fn, {})]
2793
2833
  })
2794
2834
  ]
2795
2835
  })
2796
- ] }) : /* @__PURE__ */ P(M, { children: [
2797
- Y,
2798
- ie,
2799
- ae,
2800
- se,
2801
- ce
2836
+ ] }) : /* @__PURE__ */ N(ee, { children: [
2837
+ G,
2838
+ ce,
2839
+ le,
2840
+ q,
2841
+ de
2802
2842
  ] });
2803
2843
  }
2804
2844
  //#endregion
2805
2845
  //#region src/presentation/useAgenticoPageContext.ts
2806
- function mn(e, t) {
2846
+ function yn(e, t) {
2807
2847
  let { setPageContext: n } = $(), r = A(crypto.randomUUID()).current;
2808
2848
  D(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2809
2849
  }
2810
2850
  //#endregion
2811
2851
  //#region src/presentation/useSubagentComponentContext.ts
2812
- function hn(e, t, n, r, i = !0, a) {
2852
+ function bn(e, t, n, r, i = !0, a) {
2813
2853
  let { registerComponentAnchor: o } = $(), s = A(crypto.randomUUID()).current, c = A(n);
2814
2854
  c.current = n, D(() => {
2815
2855
  if (i) return o(s, {
@@ -2828,6 +2868,6 @@ function hn(e, t, n, r, i = !0, a) {
2828
2868
  ]);
2829
2869
  }
2830
2870
  //#endregion
2831
- export { ft as AGENTICO_MAX_WIDTH, dt as AGENTICO_MIN_WIDTH, ut as AGENTICO_WIDTH, pt as AGENTICO_WIDTH_STORAGE_KEY, pn as Agentico, Je as AgenticoProvider, xt as AgenticoToggle, ee as DEFAULT_REASONING_PART_ID, F as DEFAULT_TEXT_PART_ID, ge as JSON_EXPORT_DESTINATION_ID, de as MICRO_PROMPT_REGISTRY, Ke as ORCHESTRATOR_TASK_ID, ue as SUMMARY_MICRO_PROMPT, Ce as agenticoDe, xe as agenticoEn, Se as agenticoIt, J as agenticoPromptsEn, Y as agenticoPromptsIt, Ge as agenticoTranslations, fe as applyMicroPrompts, Re as chatHasPersonMessage, Ve as chatStartedAt, Le as chatTitle, ie as configureAgenticoPrompts, Te as configureEntityChatStore, G as createCrossAgentTools, z as defineSubagent, We as entityChatTaskId, pe as extractErrorMessage, me as extractJsonBlock, H as findSubagentManifest, R as formatQuestionAnswers, X as getAgenticoPrompts, be as getDestinationRegistry, Me as getEntityChat, qt as getSubagentControls, V as getSubagentRegistry, Ht as getSubagentReport, _e as jsonExportDestination, Ue as listEntityChats, L as messagePartsText, ke as onEntityChatsChange, W as registerCrossAgentTools, ye as registerDestinations, Kt as registerSubagentControls, Vt as registerSubagentReports, te as registerSubagents, He as removeEntityChat, Be as renameEntityChat, le as renderRegistryCli, ce as renderSubagentCli, ae as resetAgenticoPrompts, Ne as saveEntityChat, K as toJsonSchema, q as toMcpTool, I as upsertMessagePart, Mt as useAgent, $ as useAgentico, Q as useAgenticoI18n, mn as useAgenticoPageContext, hn as useSubagentComponentContext };
2871
+ export { _t as AGENTICO_MAX_WIDTH, gt as AGENTICO_MIN_WIDTH, ht as AGENTICO_WIDTH, vt as AGENTICO_WIDTH_STORAGE_KEY, vn as Agentico, $e as AgenticoProvider, Et as AgenticoToggle, te as DEFAULT_REASONING_PART_ID, P as DEFAULT_TEXT_PART_ID, _e as JSON_EXPORT_DESTINATION_ID, pe as MICRO_PROMPT_REGISTRY, Ze as ORCHESTRATOR_TASK_ID, fe as SUMMARY_MICRO_PROMPT, we as agenticoDe, Se as agenticoEn, Ce as agenticoIt, oe as agenticoPromptsEn, G as agenticoPromptsIt, Xe as agenticoTranslations, me as applyMicroPrompts, Ue as chatHasPersonMessage, Ke as chatStartedAt, He as chatTitle, ce as configureAgenticoPrompts, De as configureEntityChatStore, H as createCrossAgentTools, re as defineSubagent, Ye as entityChatTaskId, X as extractErrorMessage, he as extractJsonBlock, z as findSubagentManifest, I as formatQuestionAnswers, K as getAgenticoPrompts, xe as getDestinationRegistry, Le as getEntityChat, Qt as getSubagentControls, R as getSubagentRegistry, qt as getSubagentReport, Oe as hasEntityChatBackend, ve as jsonExportDestination, Je as listEntityChats, ne as messagePartsText, Fe as onEntityChatsChange, V as registerCrossAgentTools, be as registerDestinations, Zt as registerSubagentControls, Kt as registerSubagentReports, ie as registerSubagents, qe as removeEntityChat, Ge as renameEntityChat, Y as renderRegistryCli, de as renderSubagentCli, le as resetAgenticoPrompts, Re as saveEntityChat, je as syncEntityChats, U as toJsonSchema, W as toMcpTool, F as upsertMessagePart, Lt as useAgent, $ as useAgentico, Q as useAgenticoI18n, yn as useAgenticoPageContext, bn as useSubagentComponentContext };
2832
2872
 
2833
2873
  //# sourceMappingURL=index.mjs.map