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