@llmnative/agentico 0.12.0 → 0.13.1

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,114 @@ 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() {
889
+ let [e] = N(() => Date.now()), [t, n] = N(e);
890
+ k(() => {
891
+ let e = setInterval(() => n(Date.now()), 1e3);
892
+ return () => clearInterval(e);
893
+ }, []);
894
+ let r = Math.floor((t - e) / 1e3);
895
+ return r < 10 ? null : /* @__PURE__ */ I("span", {
896
+ className: "tabular-nums",
897
+ children: [
898
+ " · ",
899
+ Math.floor(r / 60),
900
+ ":",
901
+ String(r % 60).padStart(2, "0")
902
+ ]
903
+ });
904
+ }
905
+ function st({ status: e }) {
906
+ 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
907
  name: "check",
885
908
  size: 12,
886
909
  className: "shrink-0 text-green-600"
887
- }) : e === "stopped" ? /* @__PURE__ */ M(d, {
910
+ }) : e === "stopped" ? /* @__PURE__ */ F(f, {
888
911
  name: "circle-slash",
889
912
  size: 12,
890
913
  className: "shrink-0 text-muted-foreground"
891
- }) : /* @__PURE__ */ M(d, {
914
+ }) : /* @__PURE__ */ F(f, {
892
915
  name: "x",
893
916
  size: 12,
894
917
  className: "shrink-0 text-destructive"
895
918
  });
896
919
  }
897
- function at(e, t) {
920
+ function ct(e, t) {
898
921
  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
922
  }
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(() => {
923
+ var lt = 96;
924
+ function ut({ entry: e, pinned: t = !0 }) {
925
+ let n = M(null), [r, i] = N(!1), [a, o] = N(!1);
926
+ A(() => {
904
927
  let e = n.current;
905
928
  e && o(e.scrollHeight > 97);
906
929
  }, [e.detail, e.attachmentNames]);
907
930
  let s = a && !r;
908
- return /* @__PURE__ */ M("div", {
931
+ return /* @__PURE__ */ F("div", {
909
932
  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", {
933
+ children: /* @__PURE__ */ I("div", {
911
934
  className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
912
- children: [/* @__PURE__ */ N("div", {
935
+ children: [/* @__PURE__ */ I("div", {
913
936
  ref: n,
914
937
  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", {
938
+ style: s ? { maxHeight: lt } : void 0,
939
+ children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ F("div", {
917
940
  className: "flex flex-wrap gap-1",
918
- children: e.attachmentNames.map((e, t) => /* @__PURE__ */ N("span", {
941
+ children: e.attachmentNames.map((e, t) => /* @__PURE__ */ I("span", {
919
942
  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, {
943
+ children: [/* @__PURE__ */ F(f, {
921
944
  name: "paperclip",
922
945
  size: 10,
923
946
  className: "shrink-0"
924
- }), /* @__PURE__ */ M("span", {
947
+ }), /* @__PURE__ */ F("span", {
925
948
  className: "max-w-[160px] truncate",
926
949
  children: e
927
950
  })]
928
951
  }, t))
929
- }), /* @__PURE__ */ M(rt, { text: e.detail ?? "" })]
930
- }), a && /* @__PURE__ */ N("button", {
952
+ }), /* @__PURE__ */ F(at, { text: e.detail ?? "" })]
953
+ }), a && /* @__PURE__ */ I("button", {
931
954
  type: "button",
932
955
  onClick: () => i((e) => !e),
933
956
  className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
934
957
  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, {
958
+ 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
959
  name: r ? "chevron-up" : "chevron-down",
937
960
  size: 12
938
961
  })]
@@ -940,15 +963,15 @@ function st({ entry: e, pinned: t = !0 }) {
940
963
  })
941
964
  });
942
965
  }
943
- var ct = {
966
+ var dt = {
944
967
  running: "loader-circle",
945
968
  done: "check",
946
969
  error: "x",
947
970
  stopped: "circle-slash"
948
971
  };
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, {
972
+ function ft({ steps: e }) {
973
+ 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 }));
974
+ return /* @__PURE__ */ F(_, {
952
975
  ariaLabel: t.stepsLabel,
953
976
  selectedId: null,
954
977
  itemClassName: "py-0.5 text-xs text-muted-foreground",
@@ -958,16 +981,76 @@ function lt({ steps: e }) {
958
981
  icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
959
982
  children: e.map((e) => ({
960
983
  id: e.id,
961
- label: /* @__PURE__ */ M("span", {
984
+ label: /* @__PURE__ */ F("span", {
962
985
  className: e.status === "error" ? "text-destructive" : void 0,
963
986
  children: e.label
964
987
  }),
965
- icon: ct[e.status]
988
+ icon: dt[e.status]
966
989
  }))
967
990
  }]
968
991
  });
969
992
  }
970
- function ut(e, t) {
993
+ function pt({ entry: e, part: a, questions: o }) {
994
+ 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";
995
+ return /* @__PURE__ */ I(r, {
996
+ headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
997
+ bodyClassName: "px-3 py-2",
998
+ header: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
999
+ className: "min-w-0 text-xs font-semibold text-foreground",
1000
+ children: a.title
1001
+ }), a.badge && /* @__PURE__ */ F(n, {
1002
+ variant: a.badge.variant ?? "info",
1003
+ children: a.badge.label
1004
+ })] }),
1005
+ footer: /* @__PURE__ */ I("div", {
1006
+ className: "flex flex-wrap items-center gap-2 px-3 py-2",
1007
+ children: [
1008
+ a.details && /* @__PURE__ */ F(t, {
1009
+ icon: "eye",
1010
+ label: s.cardView,
1011
+ variant: "outline-secondary",
1012
+ onClick: () => l(!0)
1013
+ }),
1014
+ (a.actions ?? []).map((t) => /* @__PURE__ */ F(m, {
1015
+ ...t.icon ? { icon: t.icon } : {},
1016
+ label: t.label,
1017
+ variant: t.variant ?? "outline-primary",
1018
+ disabled: !u,
1019
+ onClick: () => o.onCardAction(e.id, a.id, t.id)
1020
+ }, t.id)),
1021
+ a.outcome && /* @__PURE__ */ I("span", {
1022
+ className: `text-xs ${d}`,
1023
+ children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ I(P, { children: [" ", /* @__PURE__ */ F("a", {
1024
+ className: "underline",
1025
+ href: a.outcome.link.url,
1026
+ target: "_blank",
1027
+ rel: "noopener noreferrer",
1028
+ children: a.outcome.link.label
1029
+ })] })]
1030
+ })
1031
+ ]
1032
+ }),
1033
+ children: [a.body ? /* @__PURE__ */ F(i, {
1034
+ content: a.body,
1035
+ className: "break-words text-xs leading-relaxed text-foreground"
1036
+ }) : null, c && a.details && /* @__PURE__ */ F(h, {
1037
+ title: a.title,
1038
+ position: "right",
1039
+ size: "lg",
1040
+ onClose: () => l(!1),
1041
+ footer: /* @__PURE__ */ F(t, {
1042
+ label: s.cardClose,
1043
+ variant: "outline-secondary",
1044
+ onClick: () => l(!1)
1045
+ }),
1046
+ children: /* @__PURE__ */ F(i, {
1047
+ content: a.details,
1048
+ className: "break-words text-sm leading-relaxed text-foreground"
1049
+ })
1050
+ })]
1051
+ });
1052
+ }
1053
+ function mt(e, t) {
971
1054
  let n = e.at(-1);
972
1055
  if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
973
1056
  let r = [...n.parts].reverse().find((e) => e.type === "questions");
@@ -976,97 +1059,101 @@ function ut(e, t) {
976
1059
  part: r
977
1060
  };
978
1061
  }
979
- function dt({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
1062
+ function ht({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
980
1063
  let o = !!n?.canAnswer(e.id);
981
- return /* @__PURE__ */ M(i, {
1064
+ return /* @__PURE__ */ F(a, {
982
1065
  questions: t.questions,
983
1066
  ...t.answers ? { answers: t.answers } : {},
984
1067
  disabled: !t.answers && !o,
985
1068
  onSubmit: n && o ? (r) => n.onAnswer(e.id, t.id, r) : void 0,
986
1069
  autoFocus: r,
987
- className: a ?? "text-xs"
1070
+ className: i ?? "text-xs"
988
1071
  });
989
1072
  }
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({
1073
+ function gt({ entry: e, questions: t, hiddenPartId: n }) {
1074
+ let r = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), a = [];
1075
+ for (let e of r) {
1076
+ let t = a.at(-1);
1077
+ e.type === "tool" ? t && "steps" in t ? t.steps.push(e) : a.push({
995
1078
  key: `tool-${e.id}`,
996
1079
  steps: [e]
997
- }) : o.push({
1080
+ }) : a.push({
998
1081
  key: `${e.type}-${e.id}`,
999
1082
  part: e
1000
1083
  });
1001
1084
  }
1002
- return /* @__PURE__ */ M("div", {
1085
+ return /* @__PURE__ */ F("div", {
1003
1086
  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,
1087
+ children: a.map((n) => {
1088
+ if ("steps" in n) return /* @__PURE__ */ F(ft, { steps: n.steps }, n.key);
1089
+ let { part: r } = n;
1090
+ return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ F(i, {
1091
+ content: r.text,
1092
+ streaming: r.streaming,
1010
1093
  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,
1094
+ }, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */ F(o, {
1095
+ content: r.text,
1096
+ streaming: r.streaming,
1097
+ duration: r.duration,
1015
1098
  className: "my-0"
1016
- }, n.key) : /* @__PURE__ */ M(dt, {
1099
+ }, n.key) : r.type === "card" ? /* @__PURE__ */ F(pt, {
1100
+ entry: e,
1101
+ part: r,
1102
+ questions: t
1103
+ }, n.key) : /* @__PURE__ */ F(ht, {
1017
1104
  entry: e,
1018
- part: i,
1105
+ part: r,
1019
1106
  questions: t
1020
1107
  }, n.key);
1021
1108
  })
1022
1109
  });
1023
1110
  }
1024
- function pt({ entry: e, questions: t, hiddenPartId: n }) {
1025
- let i = Q();
1111
+ function _t({ entry: e, questions: t, hiddenPartId: n }) {
1112
+ let r = $();
1026
1113
  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", {
1114
+ let i = e.status === "error" || e.status === "stopped" || e.status === "running";
1115
+ return /* @__PURE__ */ I("li", {
1029
1116
  className: "text-xs text-muted-foreground",
1030
- children: [e.parts.length > 0 && /* @__PURE__ */ M(ft, {
1117
+ children: [e.parts.length > 0 && /* @__PURE__ */ F(gt, {
1031
1118
  entry: e,
1032
1119
  questions: t,
1033
1120
  hiddenPartId: n
1034
- }), r && /* @__PURE__ */ N("div", {
1121
+ }), i && /* @__PURE__ */ I("div", {
1035
1122
  className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
1036
- children: [/* @__PURE__ */ M("span", {
1123
+ children: [/* @__PURE__ */ F("span", {
1037
1124
  className: "pt-px",
1038
- children: /* @__PURE__ */ M(it, { status: e.status })
1039
- }), /* @__PURE__ */ M("span", {
1125
+ children: /* @__PURE__ */ F(st, { status: e.status })
1126
+ }), /* @__PURE__ */ I("span", {
1040
1127
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1041
- children: at(e, i)
1128
+ children: [ct(e, r), e.status === "running" && /* @__PURE__ */ F(ot, {})]
1042
1129
  })]
1043
1130
  })]
1044
1131
  });
1045
1132
  }
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", {
1133
+ 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" ? ct(e, r) : e.label;
1134
+ return /* @__PURE__ */ I("li", {
1048
1135
  className: "text-xs text-muted-foreground",
1049
1136
  children: [
1050
- /* @__PURE__ */ N("div", {
1137
+ /* @__PURE__ */ I("div", {
1051
1138
  className: "flex items-start gap-1.5",
1052
- children: [/* @__PURE__ */ M("span", {
1139
+ children: [/* @__PURE__ */ F("span", {
1053
1140
  className: "pt-px",
1054
- children: /* @__PURE__ */ M(it, { status: e.status })
1055
- }), /* @__PURE__ */ M("span", {
1141
+ children: /* @__PURE__ */ F(st, { status: e.status })
1142
+ }), /* @__PURE__ */ F("span", {
1056
1143
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
1057
1144
  children: c
1058
1145
  })]
1059
1146
  }),
1060
- o.length > 0 && /* @__PURE__ */ M("div", {
1147
+ o.length > 0 && /* @__PURE__ */ F("div", {
1061
1148
  className: "mt-1 ml-[18px] space-y-1",
1062
- children: o.map((e, t) => /* @__PURE__ */ M(nt, {
1149
+ children: o.map((e, t) => /* @__PURE__ */ F(it, {
1063
1150
  content: e.content,
1064
1151
  language: e.language
1065
1152
  }, t))
1066
1153
  }),
1067
- s.length > 0 && /* @__PURE__ */ M("div", {
1154
+ s.length > 0 && /* @__PURE__ */ F("div", {
1068
1155
  className: "mt-1 ml-[18px] space-y-2",
1069
- children: s.map((e, t) => /* @__PURE__ */ M(r, {
1156
+ children: s.map((e, t) => /* @__PURE__ */ F(i, {
1070
1157
  content: e.content.trim(),
1071
1158
  tone: "muted",
1072
1159
  className: "break-words text-xs leading-relaxed"
@@ -1075,21 +1162,21 @@ function pt({ entry: e, questions: t, hiddenPartId: n }) {
1075
1162
  ]
1076
1163
  });
1077
1164
  }
1078
- function mt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1165
+ function vt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1079
1166
  if (e.length === 0) return null;
1080
1167
  let i = [];
1081
1168
  for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
1082
1169
  user: t,
1083
1170
  entries: []
1084
1171
  } : { entries: [t] }) : i[i.length - 1].entries.push(t);
1085
- return /* @__PURE__ */ M("ul", {
1172
+ return /* @__PURE__ */ F("ul", {
1086
1173
  className: "space-y-0.5",
1087
- children: i.map((e) => /* @__PURE__ */ N("li", { children: [e.user && /* @__PURE__ */ M(st, {
1174
+ children: i.map((e) => /* @__PURE__ */ I("li", { children: [e.user && /* @__PURE__ */ F(ut, {
1088
1175
  entry: e.user,
1089
1176
  pinned: r
1090
- }), e.entries.length > 0 && /* @__PURE__ */ M("ul", {
1177
+ }), e.entries.length > 0 && /* @__PURE__ */ F("ul", {
1091
1178
  className: "space-y-0.5",
1092
- children: e.entries.map((e) => /* @__PURE__ */ M(pt, {
1179
+ children: e.entries.map((e) => /* @__PURE__ */ F(_t, {
1093
1180
  entry: e,
1094
1181
  questions: t,
1095
1182
  hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
@@ -1099,56 +1186,56 @@ function mt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1099
1186
  }
1100
1187
  //#endregion
1101
1188
  //#region src/presentation/panelWidth.ts
1102
- var ht = 420, gt = 320, _t = "60vw", vt = "agentico:panel-width";
1103
- function yt(e, t) {
1189
+ var yt = 420, bt = 320, xt = "60vw", St = "agentico:panel-width";
1190
+ function Ct(e, t) {
1104
1191
  if (typeof e == "number") return e;
1105
1192
  let n = Number.parseFloat(e);
1106
1193
  return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1107
1194
  }
1108
- function bt(e, t, n) {
1195
+ function wt(e, t, n) {
1109
1196
  return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1110
1197
  }
1111
- function xt() {
1198
+ function Tt() {
1112
1199
  try {
1113
- let e = window.localStorage.getItem(vt), t = e === null ? NaN : Number(e);
1200
+ let e = window.localStorage.getItem(St), t = e === null ? NaN : Number(e);
1114
1201
  return Number.isFinite(t) && t > 0 ? t : null;
1115
1202
  } catch {
1116
1203
  return null;
1117
1204
  }
1118
1205
  }
1119
- function St(e) {
1206
+ function Et(e) {
1120
1207
  try {
1121
- e === null ? window.localStorage.removeItem(vt) : window.localStorage.setItem(vt, String(e));
1208
+ e === null ? window.localStorage.removeItem(St) : window.localStorage.setItem(St, String(e));
1122
1209
  } catch {}
1123
1210
  }
1124
- function Ct() {
1211
+ function Dt() {
1125
1212
  return typeof window > "u" ? Infinity : window.innerWidth;
1126
1213
  }
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(() => {
1214
+ function Ot({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = xt, onWidthChange: r }) {
1215
+ let [i, a] = N(Dt), [o, s] = N(() => Tt() ?? e);
1216
+ k(() => {
1130
1217
  if (typeof window > "u") return;
1131
1218
  let e = () => a(window.innerWidth);
1132
1219
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1133
1220
  }, []);
1134
- let c = t, l = Math.max(c, yt(n, i)), u = bt(o, c, l);
1135
- return D(() => {
1221
+ let c = t, l = Math.max(c, Ct(n, i)), u = wt(o, c, l);
1222
+ return k(() => {
1136
1223
  r?.(u);
1137
1224
  }, [u]), {
1138
1225
  width: u,
1139
1226
  min: c,
1140
1227
  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);
1228
+ set: D((e) => s(wt(e, c, l)), [c, l]),
1229
+ commit: D((e) => Et(wt(e, c, l)), [c, l]),
1230
+ reset: D(() => {
1231
+ s(e), Et(null);
1145
1232
  }, [e])
1146
1233
  };
1147
1234
  }
1148
1235
  //#endregion
1149
1236
  //#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) => {
1237
+ function kt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1238
+ 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
1239
  let t = s.current;
1153
1240
  if (t && t.pointerId === e.pointerId) {
1154
1241
  s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
@@ -1158,7 +1245,7 @@ function Tt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1158
1245
  i(t.last);
1159
1246
  }
1160
1247
  };
1161
- return /* @__PURE__ */ M("div", {
1248
+ return /* @__PURE__ */ F("div", {
1162
1249
  role: "separator",
1163
1250
  "aria-orientation": "vertical",
1164
1251
  "aria-label": o.resizePanel,
@@ -1197,7 +1284,7 @@ function Tt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1197
1284
  let c = u(s);
1198
1285
  r(c), i(c);
1199
1286
  },
1200
- children: /* @__PURE__ */ M("span", {
1287
+ children: /* @__PURE__ */ F("span", {
1201
1288
  "aria-hidden": !0,
1202
1289
  className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
1203
1290
  })
@@ -1205,9 +1292,9 @@ function Tt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1205
1292
  }
1206
1293
  //#endregion
1207
1294
  //#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, {
1295
+ function At({ className: e = "" }) {
1296
+ let { isOpen: n, toggleOpen: r, task: i } = tt(), a = $(), o = i?.agent.running ?? !1;
1297
+ return /* @__PURE__ */ F(t, {
1211
1298
  icon: "bot",
1212
1299
  ariaLabel: n ? a.closePanel : a.openPanel,
1213
1300
  title: n ? a.closePanel : a.openPanel,
@@ -1218,32 +1305,32 @@ function Et({ className: e = "" }) {
1218
1305
  }
1219
1306
  //#endregion
1220
1307
  //#region src/presentation/useAIModelCatalog.ts
1221
- var Dt = "llmnative-cms.selectedAIModel";
1222
- function Ot() {
1308
+ var jt = "llmnative-cms.selectedAIModel";
1309
+ function Mt() {
1223
1310
  try {
1224
- return localStorage.getItem(Dt) ?? "";
1311
+ return localStorage.getItem(jt) ?? "";
1225
1312
  } catch {
1226
1313
  return "";
1227
1314
  }
1228
1315
  }
1229
- function kt(e) {
1316
+ function Nt(e) {
1230
1317
  try {
1231
- e ? localStorage.setItem(Dt, e) : localStorage.removeItem(Dt);
1318
+ e ? localStorage.setItem(jt, e) : localStorage.removeItem(jt);
1232
1319
  } catch {}
1233
1320
  }
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(() => {
1321
+ function Pt() {
1322
+ let e = S()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = N({}), [i, a] = N(!1), [o, s] = N(Mt);
1323
+ return k(() => {
1237
1324
  if (!t) {
1238
1325
  r({});
1239
1326
  return;
1240
1327
  }
1241
1328
  let n = !1;
1242
- return a(!0), g(e).then((e) => {
1329
+ return a(!0), v(e).then((e) => {
1243
1330
  if (n) return;
1244
1331
  r(e.modelsByProvider);
1245
1332
  let t = Object.values(e.modelsByProvider).flat();
1246
- s((e) => t.some((t) => t.id === e) ? e : (kt(""), ""));
1333
+ s((e) => t.some((t) => t.id === e) ? e : (Nt(""), ""));
1247
1334
  }).catch((e) => {
1248
1335
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
1249
1336
  }).finally(() => {
@@ -1257,17 +1344,17 @@ function At() {
1257
1344
  modelsLoading: i,
1258
1345
  selectedModel: o,
1259
1346
  setSelectedModel: (e) => {
1260
- kt(e), s(e);
1347
+ Nt(e), s(e);
1261
1348
  }
1262
1349
  };
1263
1350
  }
1264
1351
  //#endregion
1265
1352
  //#region src/domain/approval.ts
1266
- var jt = "approval";
1267
- function Mt(e, t) {
1353
+ var Ft = "approval";
1354
+ function It(e, t) {
1268
1355
  return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1269
1356
  }
1270
- function Nt(e, t, n) {
1357
+ function Lt(e, t, n) {
1271
1358
  let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1272
1359
  return {
1273
1360
  approved: r.includes(t) && !r.includes(n),
@@ -1276,41 +1363,41 @@ function Nt(e, t, n) {
1276
1363
  }
1277
1364
  //#endregion
1278
1365
  //#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);
1366
+ var Rt = 20, zt = 26e4;
1367
+ function Bt(e) {
1368
+ return e.filter((e) => !g.isTextAttachment(e.mimeType) || e.base64.length <= zt);
1282
1369
  }
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) => {
1370
+ function Vt(e, t = {}) {
1371
+ let { defaultEnabled: n = !1 } = t, [r, i] = N(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Pt(), [u, d] = N(!1), [f, p] = N(null), [m, h] = N(!1), [_, v] = N([]), y = M([]), x = (e) => {
1372
+ v((t) => {
1286
1373
  let n = typeof e == "function" ? e(t) : e;
1287
- return x.current = n, n;
1374
+ return y.current = n, n;
1288
1375
  });
1289
- }, C = A(/* @__PURE__ */ new Map()), w = Q(), T = A(w);
1376
+ }, C = M(/* @__PURE__ */ new Map()), w = $(), T = M(w);
1290
1377
  T.current = w;
1291
- let E = A(null), D = A(!1), O = A(null), ee = () => {
1378
+ let E = M(null), D = M(!1), O = M(null), k = () => {
1292
1379
  O.current?.abort();
1293
- }, M = b()?.registry ?? {}, [N, te] = j(void 0), re = A(void 0), L = (e, t) => {
1380
+ }, A = S()?.registry ?? {}, [P, F] = N(void 0), I = M(void 0), R = (e, t) => {
1294
1381
  if (!t) return !1;
1295
1382
  if (!e) return !0;
1296
- let n = v(t);
1383
+ let n = b(t);
1297
1384
  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) => {
1385
+ }, 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) => {
1386
+ Z.current = e, oe(e);
1387
+ }, ce = (e) => {
1388
+ let t = W?.models?.(e) ?? [];
1389
+ q.current = t, ae(t);
1390
+ let n = W?.catalogProviders?.(e);
1391
+ I.current = n, F(n);
1392
+ let r = G && !R(n, c) ? t[0]?.value : void 0;
1393
+ se(W?.defaultModel?.(e) ?? r ?? "");
1394
+ }, le = async (e, t, n, r) => {
1308
1395
  let i = E.current;
1309
- if (!i || !V) return p(T.current.noActiveSession), null;
1396
+ if (!i || !W) return p(T.current.noActiveSession), null;
1310
1397
  let a = new AbortController();
1311
1398
  O.current = a;
1312
1399
  let o = crypto.randomUUID();
1313
- S((e) => [...e, {
1400
+ x((e) => [...e, {
1314
1401
  id: o,
1315
1402
  kind: "thinking",
1316
1403
  label: T.current.thinking,
@@ -1321,16 +1408,16 @@ function Lt(e, t = {}) {
1321
1408
  ...e,
1322
1409
  streaming: !1,
1323
1410
  duration: e.duration ?? c(e.id)
1324
- }), u = (e, t) => S((n) => n.map((n) => {
1411
+ }), u = (e, t) => x((n) => n.map((n) => {
1325
1412
  if (n.id !== o) return n;
1326
- let r = e(n.parts ?? []), i = ne(r);
1413
+ let r = e(n.parts ?? []), i = ee(r);
1327
1414
  return {
1328
1415
  ...n,
1329
1416
  parts: r,
1330
1417
  ...t ? { status: t } : {},
1331
1418
  ...i ? { detail: i } : {}
1332
1419
  };
1333
- })), d = (e) => u((t) => F(t, e, l)), f = !1, m = (e, t) => {
1420
+ })), d = (e) => u((t) => z(t, e, l)), f = !1, m = (e, t) => {
1334
1421
  t?.id && t.id !== "text" && (f = !0), d({
1335
1422
  type: "text",
1336
1423
  id: t?.id ?? "text",
@@ -1351,33 +1438,36 @@ function Lt(e, t = {}) {
1351
1438
  id: e.id,
1352
1439
  label: e.label,
1353
1440
  status: e.status
1354
- }), _ = /* @__PURE__ */ new Set(), v = 0, y = () => {
1355
- for (let e of _) {
1441
+ }), _ = (e) => d({
1442
+ ...e,
1443
+ type: "card"
1444
+ }), v = /* @__PURE__ */ new Set(), y = 0, b = () => {
1445
+ for (let e of v) {
1356
1446
  let t = C.current.get(e);
1357
1447
  C.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
1358
1448
  }
1359
- _.clear();
1449
+ v.clear();
1360
1450
  };
1361
- a.signal.addEventListener("abort", y);
1362
- let b = (e, t) => {
1363
- v += 1;
1364
- let n = t?.id ?? `questions-${v}`;
1451
+ a.signal.addEventListener("abort", b);
1452
+ let S = (e, t) => {
1453
+ y += 1;
1454
+ let n = t?.id ?? `questions-${y}`;
1365
1455
  d({
1366
1456
  type: "questions",
1367
1457
  id: n,
1368
1458
  questions: e
1369
1459
  });
1370
1460
  let r = `${o}:${n}`;
1371
- return a.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (_.add(r), new Promise((e, t) => {
1461
+ return a.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (v.add(r), new Promise((e, t) => {
1372
1462
  C.current.set(r, {
1373
1463
  resolve: e,
1374
1464
  reject: t
1375
1465
  });
1376
1466
  }));
1377
- }, x = (e, t) => {
1378
- u((n) => (t && !f ? F(n, {
1467
+ }, w = (e, t) => {
1468
+ u((n) => (t && !f ? z(n, {
1379
1469
  type: "text",
1380
- id: P,
1470
+ id: L,
1381
1471
  text: t,
1382
1472
  streaming: !1
1383
1473
  }, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
@@ -1386,18 +1476,18 @@ function Lt(e, t = {}) {
1386
1476
  } : t.type === "tool" && t.status === "running" && e !== "done" ? {
1387
1477
  ...t,
1388
1478
  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 || "";
1479
+ } : t), e), a.signal.removeEventListener("abort", b);
1480
+ for (let e of v) C.current.delete(e);
1481
+ v.clear();
1482
+ }, D = e || r?.historyText || "";
1393
1483
  try {
1394
- let o = await V.turn({
1484
+ let o = await W.turn({
1395
1485
  params: i.params,
1396
1486
  context: i.context,
1397
1487
  text: e,
1398
1488
  first: t,
1399
1489
  signal: a.signal,
1400
- ...n || q.current ? { model: n || q.current } : {},
1490
+ ...n || Z.current ? { model: n || Z.current } : {},
1401
1491
  ...r ? { answers: {
1402
1492
  id: r.id,
1403
1493
  answers: r.answers
@@ -1405,13 +1495,14 @@ function Lt(e, t = {}) {
1405
1495
  onText: m,
1406
1496
  onReasoning: h,
1407
1497
  onStep: g,
1408
- onQuestions: b
1498
+ onQuestions: S,
1499
+ onCard: _
1409
1500
  });
1410
- return x("done", o.text), i.history = [
1501
+ return w("done", o.text), i.history = [
1411
1502
  ...i.history,
1412
- ...w ? [{
1503
+ ...D ? [{
1413
1504
  role: "user",
1414
- content: w
1505
+ content: D
1415
1506
  }] : [],
1416
1507
  {
1417
1508
  role: "assistant",
@@ -1419,17 +1510,36 @@ function Lt(e, t = {}) {
1419
1510
  }
1420
1511
  ], o.result ?? null;
1421
1512
  } catch (e) {
1422
- return i.history = [...i.history, ...w ? [{
1513
+ return i.history = [...i.history, ...D ? [{
1423
1514
  role: "user",
1424
- content: w
1425
- }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), p(X(e)), null);
1515
+ content: D
1516
+ }] : []], a.signal.aborted ? (w("stopped"), null) : (w("error"), p(he(e)), null);
1426
1517
  } finally {
1427
1518
  O.current = null;
1428
1519
  }
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);
1520
+ }, ue = async (t, n, r) => {
1521
+ let i = y.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = E.current;
1522
+ if (!i || !a || !e.onCardAction) return;
1523
+ let o;
1524
+ try {
1525
+ o = await e.onCardAction(a.params, i, r);
1526
+ } catch (e) {
1527
+ o = {
1528
+ status: "error",
1529
+ text: he(e)
1530
+ };
1531
+ }
1532
+ o && x((e) => e.map((e) => e.id === t ? {
1533
+ ...e,
1534
+ parts: e.parts?.map((e) => e.type === "card" && e.id === n ? {
1535
+ ...e,
1536
+ outcome: o
1537
+ } : e)
1538
+ } : e));
1539
+ }, de = async (e, t, n) => {
1540
+ let r = y.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1431
1541
  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 ? {
1542
+ let i = () => x((r) => r.map((r) => r.id === e ? {
1433
1543
  ...r,
1434
1544
  parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
1435
1545
  ...e,
@@ -1438,37 +1548,37 @@ function Lt(e, t = {}) {
1438
1548
  } : r)), a = `${e}:${t}`, o = C.current.get(a);
1439
1549
  if (o) return C.current.delete(a), i(), o.resolve(n), null;
1440
1550
  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);
1551
+ if (!K || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
1442
1552
  D.current = !0, d(!0), p(null), i();
1443
1553
  try {
1444
- return await Y("", !1, void 0, {
1554
+ return await le("", !1, void 0, {
1445
1555
  id: t,
1446
1556
  answers: n,
1447
- historyText: I(r.questions, n)
1557
+ historyText: B(r.questions, n)
1448
1558
  });
1449
1559
  } finally {
1450
1560
  D.current = !1, d(!1);
1451
1561
  }
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;
1562
+ }, fe = async (t, n, r) => {
1563
+ 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
1564
  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;
1565
+ let f = s ? b(s) : H, m = f ? A[f.provider] : null;
1566
+ if (!m || !f) return p(T.current.noProviderAvailable), null;
1457
1567
  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) => ({
1568
+ let h = (n ?? []).filter((e) => g.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= zt ? `\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(""), _ = Bt(n ?? []), v = d.tools.map((e) => ({
1459
1569
  name: e.name,
1460
1570
  description: e.description,
1461
- inputSchema: U(e.inputSchema)
1462
- })), b = (e, t, n, r) => {
1571
+ inputSchema: ne(e.inputSchema)
1572
+ })), y = (e, t, n, r) => {
1463
1573
  let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1464
- S((e) => [...e, {
1574
+ x((e) => [...e, {
1465
1575
  id: a,
1466
1576
  kind: "thinking",
1467
1577
  label: i.approvalHeader,
1468
1578
  status: "running",
1469
1579
  parts: [{
1470
1580
  type: "questions",
1471
- id: jt,
1581
+ id: Ft,
1472
1582
  questions: [{
1473
1583
  header: i.approvalHeader,
1474
1584
  question: i.approveQuestion.replace("{action}", o),
@@ -1477,7 +1587,7 @@ function Lt(e, t = {}) {
1477
1587
  }]
1478
1588
  }]
1479
1589
  }]);
1480
- let s = `${a}:${jt}`;
1590
+ let s = `${a}:${Ft}`;
1481
1591
  return new Promise((e, t) => {
1482
1592
  let n = () => {
1483
1593
  C.current.delete(s), D(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
@@ -1488,14 +1598,14 @@ function Lt(e, t = {}) {
1488
1598
  }
1489
1599
  r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
1490
1600
  resolve: (t) => {
1491
- r.removeEventListener("abort", n), D(a, "done"), e(Nt(t, i.approve, i.reject));
1601
+ r.removeEventListener("abort", n), D(a, "done"), e(Lt(t, i.approve, i.reject));
1492
1602
  },
1493
1603
  reject: t
1494
1604
  });
1495
1605
  });
1496
- }, x = new Map(d.tools.map((e) => [e.name, e])), w = new AbortController();
1606
+ }, S = new Map(d.tools.map((e) => [e.name, e])), w = new AbortController();
1497
1607
  O.current = w;
1498
- let D = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1608
+ let D = (e, t, n, r) => x((i) => i.map((i) => i.id === e ? {
1499
1609
  ...i,
1500
1610
  status: t,
1501
1611
  ...n === void 0 ? {} : { detail: n },
@@ -1503,9 +1613,9 @@ function Lt(e, t = {}) {
1503
1613
  } : i));
1504
1614
  try {
1505
1615
  let n = d.history, r = t;
1506
- for (let t = 0; t < Pt; t++) {
1616
+ for (let t = 0; t < Rt; t++) {
1507
1617
  let i = crypto.randomUUID();
1508
- S((e) => [...e, {
1618
+ x((e) => [...e, {
1509
1619
  id: i,
1510
1620
  kind: "thinking",
1511
1621
  label: T.current.thinking,
@@ -1513,12 +1623,12 @@ function Lt(e, t = {}) {
1513
1623
  }]);
1514
1624
  let a;
1515
1625
  try {
1516
- a = await h.complete({
1626
+ a = await m.complete({
1517
1627
  prompt: r,
1518
1628
  model: f.model,
1519
1629
  ...u,
1520
1630
  history: n,
1521
- tools: y.length ? y : void 0,
1631
+ tools: v.length ? v : void 0,
1522
1632
  signal: w.signal,
1523
1633
  attachments: t === 0 ? _ : void 0,
1524
1634
  logId: d.logId
@@ -1526,14 +1636,14 @@ function Lt(e, t = {}) {
1526
1636
  } catch (t) {
1527
1637
  return d.history = [...n, ...r ? [{
1528
1638
  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);
1639
+ content: r + h
1640
+ }] : []], w.signal.aborted ? (D(i, "stopped"), e.fallback(d.params, d.context)) : (D(i, "error"), p(he(t)), null);
1531
1641
  }
1532
1642
  if (d.history = [...n, ...r ? [{
1533
1643
  role: "user",
1534
- content: r + g
1644
+ content: r + h
1535
1645
  }] : []], !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 ? {
1646
+ if (a.type === "text") return D(i, "done", a.text), e.conversational && a.text.trim() && x((e) => e.map((e) => e.id === i ? {
1537
1647
  ...e,
1538
1648
  parts: [{
1539
1649
  type: "text",
@@ -1544,7 +1654,7 @@ function Lt(e, t = {}) {
1544
1654
  ...n,
1545
1655
  ...r ? [{
1546
1656
  role: "user",
1547
- content: r + g
1657
+ content: r + h
1548
1658
  }] : [],
1549
1659
  {
1550
1660
  role: "assistant",
@@ -1556,29 +1666,29 @@ function Lt(e, t = {}) {
1556
1666
  params: d.params
1557
1667
  }), p(T.current.invalidResponse), e.fallback(d.params, d.context));
1558
1668
  let o = a.toolCalls.map((e) => {
1559
- let t = x.get(e.name);
1669
+ let t = S.get(e.name);
1560
1670
  return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1561
1671
  });
1562
1672
  D(i, "done", a.text || void 0, a.text ? void 0 : o);
1563
1673
  let s = /* @__PURE__ */ new Map();
1564
1674
  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));
1675
+ let n = S.get(t.name);
1676
+ if (n && It(n, t.input)) try {
1677
+ s.set(t.id, await y(t.id, n, t.input, w.signal));
1568
1678
  } catch {
1569
1679
  return e.fallback(d.params, d.context);
1570
1680
  }
1571
1681
  }
1572
1682
  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);
1683
+ let t = S.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
1574
1684
  if (r && !r.approved) {
1575
- S((t) => [...t, {
1685
+ x((t) => [...t, {
1576
1686
  id: e.id,
1577
1687
  kind: "tool",
1578
1688
  label: n,
1579
1689
  status: "stopped"
1580
1690
  }]);
1581
- let t = K().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1691
+ let t = X().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1582
1692
  return {
1583
1693
  toolCallId: e.id,
1584
1694
  name: e.name,
@@ -1586,7 +1696,7 @@ function Lt(e, t = {}) {
1586
1696
  isError: !0
1587
1697
  };
1588
1698
  }
1589
- if (S((t) => [...t, {
1699
+ if (x((t) => [...t, {
1590
1700
  id: e.id,
1591
1701
  kind: "tool",
1592
1702
  label: n,
@@ -1599,7 +1709,18 @@ function Lt(e, t = {}) {
1599
1709
  };
1600
1710
  try {
1601
1711
  let n = await t.execute(e.input);
1602
- return D(e.id, "done"), {
1712
+ D(e.id, "done");
1713
+ let r = t.card?.(e.input, n);
1714
+ return r && x((t) => [...t, {
1715
+ id: `card-${e.id}`,
1716
+ kind: "thinking",
1717
+ label: "",
1718
+ status: "done",
1719
+ parts: [{
1720
+ ...r,
1721
+ type: "card"
1722
+ }]
1723
+ }]), {
1603
1724
  toolCallId: e.id,
1604
1725
  name: e.name,
1605
1726
  output: n
@@ -1608,7 +1729,7 @@ function Lt(e, t = {}) {
1608
1729
  return D(e.id, "error"), {
1609
1730
  toolCallId: e.id,
1610
1731
  name: e.name,
1611
- output: X(t),
1732
+ output: he(t),
1612
1733
  isError: !0
1613
1734
  };
1614
1735
  }
@@ -1617,7 +1738,7 @@ function Lt(e, t = {}) {
1617
1738
  ...n,
1618
1739
  ...r ? [{
1619
1740
  role: "user",
1620
- content: r + g
1741
+ content: r + h
1621
1742
  }] : [],
1622
1743
  {
1623
1744
  role: "assistant",
@@ -1631,7 +1752,7 @@ function Lt(e, t = {}) {
1631
1752
  ], r = "";
1632
1753
  }
1633
1754
  let i = crypto.randomUUID();
1634
- S((e) => [...e, {
1755
+ x((e) => [...e, {
1635
1756
  id: i,
1636
1757
  kind: "thinking",
1637
1758
  label: T.current.thinking,
@@ -1639,9 +1760,9 @@ function Lt(e, t = {}) {
1639
1760
  }]);
1640
1761
  let a;
1641
1762
  try {
1642
- a = await h.complete({
1763
+ a = await m.complete({
1643
1764
  ...u,
1644
- prompt: me(K().stopCallingTools, e.microPromptIds),
1765
+ prompt: me(X().stopCallingTools, e.microPromptIds),
1645
1766
  model: f.model,
1646
1767
  history: n,
1647
1768
  signal: w.signal,
@@ -1662,9 +1783,9 @@ function Lt(e, t = {}) {
1662
1783
  } finally {
1663
1784
  O.current = null;
1664
1785
  }
1665
- }, he = async (t, n) => {
1786
+ }, pe = async (t, n) => {
1666
1787
  if (D.current) return p(T.current.requestInProgress), null;
1667
- D.current = !0, p(null), S(n?.openingMessage ? [{
1788
+ D.current = !0, p(null), x(n?.openingMessage ? [{
1668
1789
  id: crypto.randomUUID(),
1669
1790
  kind: "user",
1670
1791
  label: "Tu",
@@ -1681,28 +1802,28 @@ function Lt(e, t = {}) {
1681
1802
  history: [],
1682
1803
  logId: crypto.randomUUID(),
1683
1804
  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);
1805
+ }, K) return h(!0), ce(t), await le(n?.openingMessage ?? "", !0);
1806
+ if (G) {
1807
+ ce(t), J.current = !1;
1808
+ let e = n?.model || Z.current;
1809
+ if (re(e)) return h(!0), J.current = !0, await le(n?.openingMessage ?? "", !0, e);
1689
1810
  }
1690
- let s = n?.model || void 0, c = s ? !!M[v(s)?.provider ?? ""] : !!B;
1811
+ let s = n?.model || void 0, c = s ? !!A[b(s)?.provider ?? ""] : !!U;
1691
1812
  if (!r || !c) {
1692
- g(!1);
1813
+ h(!1);
1693
1814
  let n = e.fallback(t, i);
1694
- return S((t) => [...t, {
1815
+ return x((t) => [...t, {
1695
1816
  id: crypto.randomUUID(),
1696
1817
  kind: "tool",
1697
1818
  status: "done",
1698
1819
  label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
1699
1820
  }]), n;
1700
1821
  }
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);
1822
+ h(!0);
1823
+ 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);
1824
+ return await fe(u, l, s);
1704
1825
  } catch (e) {
1705
- return p(X(e)), null;
1826
+ return p(he(e)), null;
1706
1827
  } finally {
1707
1828
  D.current = !1, d(!1);
1708
1829
  }
@@ -1711,7 +1832,7 @@ function Lt(e, t = {}) {
1711
1832
  p(T.current.requestInProgress);
1712
1833
  return;
1713
1834
  }
1714
- D.current = !0, p(null), S(n.activity), d(!0);
1835
+ D.current = !0, p(null), x(n.activity), d(!0);
1715
1836
  try {
1716
1837
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1717
1838
  E.current = {
@@ -1721,9 +1842,9 @@ function Lt(e, t = {}) {
1721
1842
  history: n.history,
1722
1843
  logId: crypto.randomUUID(),
1723
1844
  attachmentsRef: a
1724
- }, (W || H) && de(t), G.current = !1, g(W || H || r && !!B);
1845
+ }, (K || G) && ce(t), J.current = !1, h(K || G || r && !!U);
1725
1846
  } catch (e) {
1726
- p(X(e));
1847
+ p(he(e));
1727
1848
  } finally {
1728
1849
  D.current = !1, d(!1);
1729
1850
  }
@@ -1732,7 +1853,7 @@ function Lt(e, t = {}) {
1732
1853
  if (p(null), !t.trim()) return p("Messaggio vuoto."), null;
1733
1854
  let r = E.current;
1734
1855
  if (!r) return p(T.current.noActiveSession), null;
1735
- D.current = !0, d(!0), S((e) => [...e, {
1856
+ D.current = !0, d(!0), x((e) => [...e, {
1736
1857
  id: crypto.randomUUID(),
1737
1858
  kind: "user",
1738
1859
  label: "Tu",
@@ -1742,16 +1863,16 @@ function Lt(e, t = {}) {
1742
1863
  ...n?.retry ? { retry: !0 } : {}
1743
1864
  }]);
1744
1865
  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);
1866
+ if (K) return await le(t, !1, n?.model || void 0);
1867
+ let i = n?.model || (G ? Z.current : "");
1868
+ if (G && re(i)) {
1869
+ let e = !J.current;
1870
+ return J.current = !0, await le(t, e, i);
1750
1871
  }
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);
1872
+ 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);
1873
+ return await fe(o, a, n?.model || void 0);
1753
1874
  } catch (e) {
1754
- return p(X(e)), null;
1875
+ return p(he(e)), null;
1755
1876
  } finally {
1756
1877
  D.current = !1, d(!1);
1757
1878
  }
@@ -1760,7 +1881,7 @@ function Lt(e, t = {}) {
1760
1881
  if (!t) return null;
1761
1882
  p(null);
1762
1883
  let n = e.fallback(t.params, t.context);
1763
- return S((t) => [...t, {
1884
+ return x((t) => [...t, {
1764
1885
  id: crypto.randomUUID(),
1765
1886
  kind: "tool",
1766
1887
  status: "done",
@@ -1774,48 +1895,49 @@ function Lt(e, t = {}) {
1774
1895
  enabled: r,
1775
1896
  setEnabled: i,
1776
1897
  hasProviders: a,
1777
- selectedModel: W || H && le ? le : R,
1778
- setSelectedModel: W ? J : H ? (e) => {
1779
- oe(e) ? J(e) : (J(""), l(e));
1898
+ selectedModel: K || G && Y ? Y : V,
1899
+ setSelectedModel: K ? se : G ? (e) => {
1900
+ re(e) ? se(e) : (se(""), l(e));
1780
1901
  } : l,
1781
- modelsByProvider: ie,
1902
+ modelsByProvider: te,
1782
1903
  modelsLoading: s,
1783
1904
  running: u,
1784
1905
  error: f,
1785
- canContinue: h,
1786
- remote: W,
1787
- remoteModels: se,
1788
- alongside: H,
1789
- ...V?.catalogGroup ? { catalogGroup: V.catalogGroup } : {},
1906
+ canContinue: m,
1907
+ remote: K,
1908
+ remoteModels: ie,
1909
+ alongside: G,
1910
+ ...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
1790
1911
  activity: _,
1791
- run: he,
1912
+ run: pe,
1792
1913
  resume: ge,
1793
1914
  sendMessage: _e,
1794
- stop: ee,
1915
+ stop: k,
1795
1916
  runFallback: ve,
1796
1917
  snapshot: ye,
1797
- answerQuestions: fe
1918
+ answerQuestions: de,
1919
+ cardAction: ue
1798
1920
  };
1799
1921
  }
1800
1922
  //#endregion
1801
1923
  //#region src/domain/orchestrator/prompt.ts
1802
- function Rt() {
1803
- let e = K();
1924
+ function Ht() {
1925
+ let e = X();
1804
1926
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1805
1927
  }
1806
- function zt(e, t, n) {
1807
- let r = K(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1928
+ function Ut(e, t, n) {
1929
+ let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1808
1930
  return `${r.orchestratorIntro}
1809
1931
 
1810
1932
  ${r.toolsHeading}
1811
1933
  ${t}
1812
1934
  ${i}
1813
- ${Rt()}
1935
+ ${Ht()}
1814
1936
 
1815
1937
  ${r.userRequestHeading}
1816
1938
  ${e}`;
1817
1939
  }
1818
- function Bt(e, t) {
1940
+ function Wt(e, t) {
1819
1941
  return t ? {
1820
1942
  kind: "handoff",
1821
1943
  ...t
@@ -1826,27 +1948,27 @@ function Bt(e, t) {
1826
1948
  }
1827
1949
  //#endregion
1828
1950
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1829
- function Vt(e) {
1830
- return R().filter((t) => !t.onlyWhenAnchored || e === t.id);
1951
+ function Gt(e) {
1952
+ return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
1831
1953
  }
1832
- function Ht(e) {
1954
+ function Kt(e) {
1833
1955
  return {
1834
1956
  buildContext(e) {
1835
1957
  return {
1836
- cliCatalog: Y(Vt(e.scopedSubagentId)),
1958
+ cliCatalog: de(Gt(e.scopedSubagentId)),
1837
1959
  handoff: { current: null },
1838
1960
  collected: {}
1839
1961
  };
1840
1962
  },
1841
1963
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1842
- return zt(e, n, t);
1964
+ return Ut(e, n, t);
1843
1965
  },
1844
1966
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1845
- return `${e}\n\n${Rt()}\n\n${K().toolsHeading}\n${n}`;
1967
+ return `${e}\n\n${Ht()}\n\n${X().toolsHeading}\n${n}`;
1846
1968
  },
1847
1969
  parseResponse(e, t, n) {
1848
1970
  let r = n.handoff.current;
1849
- return n.handoff.current = null, Bt(e, r);
1971
+ return n.handoff.current = null, Wt(e, r);
1850
1972
  },
1851
1973
  fallback() {
1852
1974
  return {
@@ -1858,16 +1980,16 @@ function Ht(e) {
1858
1980
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
1859
1981
  },
1860
1982
  getTools(t, n, r) {
1861
- let i = H({
1983
+ let i = q({
1862
1984
  attachmentsRef: r,
1863
1985
  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) => ({
1986
+ proxyFetch: x
1987
+ }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Gt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1866
1988
  name: `${t.id}_${r.name}`,
1867
1989
  description: `${t.label}: ${r.summary}`,
1868
1990
  inputSchema: r.inputSchema,
1869
- describeInvocation: () => _(e.preparing, { label: t.label }),
1870
- describeIntent: _(e.collecting, { label: t.label }),
1991
+ describeInvocation: () => y(e.preparing, { label: t.label }),
1992
+ describeIntent: y(e.collecting, { label: t.label }),
1871
1993
  async execute(e) {
1872
1994
  let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
1873
1995
  return n.handoff.current = {
@@ -1876,7 +1998,7 @@ function Ht(e) {
1876
1998
  params: i
1877
1999
  }, {
1878
2000
  status: "queued",
1879
- note: _(K().handoffQueued, { label: t.label })
2001
+ note: y(X().handoffQueued, { label: t.label })
1880
2002
  };
1881
2003
  }
1882
2004
  })));
@@ -1886,22 +2008,22 @@ function Ht(e) {
1886
2008
  }
1887
2009
  //#endregion
1888
2010
  //#region src/presentation/deriveHistoryTitle.ts
1889
- function Ut(e, t) {
2011
+ function qt(e, t) {
1890
2012
  return e.deriveHistoryTitle?.(t) ?? e.label;
1891
2013
  }
1892
2014
  //#endregion
1893
2015
  //#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();
2016
+ function Jt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2017
+ 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
2018
  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) => {
2019
+ let t = _[e];
2020
+ t && v.set(e, t);
2021
+ }), (o ?? []).forEach((e) => v.set(e.id, e)), v.set(ye.id, ye);
2022
+ let b = Array.from(v.values()), x = async (i) => {
1901
2023
  f(i), g(null);
1902
2024
  try {
1903
- let o = y.get(i);
1904
- if (!o) throw Error(_(s.unknownDestination, { id: i }));
2025
+ let o = v.get(i);
2026
+ if (!o) throw Error(y(s.unknownDestination, { id: i }));
1905
2027
  if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
1906
2028
  let d = await o.apply(t, {
1907
2029
  scopeId: l?.id ?? "",
@@ -1909,23 +2031,23 @@ function Wt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1909
2031
  storageProvider: l?.storageProvider ?? null,
1910
2032
  proxyFetch: u
1911
2033
  }, 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));
2034
+ m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, qt(e, n));
1913
2035
  } catch (e) {
1914
2036
  g(e instanceof Error ? e.message : String(e));
1915
2037
  } finally {
1916
2038
  f(null);
1917
2039
  }
1918
2040
  };
1919
- return /* @__PURE__ */ N("div", {
2041
+ return /* @__PURE__ */ I("div", {
1920
2042
  className: "space-y-2",
1921
2043
  children: [
1922
- /* @__PURE__ */ M("p", {
2044
+ /* @__PURE__ */ F("p", {
1923
2045
  className: "text-xs font-medium text-muted-foreground",
1924
2046
  children: s.destinationPickerTitle
1925
2047
  }),
1926
- /* @__PURE__ */ M("div", {
2048
+ /* @__PURE__ */ F("div", {
1927
2049
  className: "flex flex-wrap gap-2",
1928
- children: b.map((e) => /* @__PURE__ */ M("button", {
2050
+ children: b.map((e) => /* @__PURE__ */ F("button", {
1929
2051
  type: "button",
1930
2052
  disabled: d !== null,
1931
2053
  onClick: () => void x(e.id),
@@ -1933,7 +2055,7 @@ function Wt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1933
2055
  children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
1934
2056
  }, e.id))
1935
2057
  }),
1936
- h && /* @__PURE__ */ M("p", {
2058
+ h && /* @__PURE__ */ F("p", {
1937
2059
  className: "text-xs text-destructive",
1938
2060
  children: h
1939
2061
  })
@@ -1942,33 +2064,33 @@ function Wt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1942
2064
  }
1943
2065
  //#endregion
1944
2066
  //#region src/presentation/reports/subagentReportRegistry.tsx
1945
- var Gt = {};
1946
- function Kt(e) {
1947
- Object.assign(Gt, e);
2067
+ var Yt = {};
2068
+ function Xt(e) {
2069
+ Object.assign(Yt, e);
1948
2070
  }
1949
- function qt(e) {
1950
- return Gt[e];
2071
+ function Zt(e) {
2072
+ return Yt[e];
1951
2073
  }
1952
2074
  //#endregion
1953
2075
  //#region src/presentation/reports/GenericResultPreview.tsx
1954
- function Jt({ result: e }) {
1955
- let [t, n] = j(!1);
1956
- return /* @__PURE__ */ N("div", {
2076
+ function Qt({ result: e }) {
2077
+ let [t, n] = N(!1);
2078
+ return /* @__PURE__ */ I("div", {
1957
2079
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
1958
2080
  onClick: () => n((e) => !e),
1959
2081
  title: t ? "Clic per comprimere" : "Clic per espandere",
1960
- children: [/* @__PURE__ */ M(s, {
2082
+ children: [/* @__PURE__ */ F(c, {
1961
2083
  language: "json",
1962
2084
  showCopy: t,
1963
2085
  background: "transparent",
1964
2086
  className: "!text-[11px]",
1965
2087
  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" })]
2088
+ }), !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
2089
  });
1968
2090
  }
1969
2091
  //#endregion
1970
2092
  //#region src/presentation/liveAnchorDestination.ts
1971
- function Yt(e, t, n) {
2093
+ function $t(e, t, n) {
1972
2094
  return e.length === 0 ? null : {
1973
2095
  id: "live-component",
1974
2096
  label: "Applica al componente aperto",
@@ -1979,38 +2101,38 @@ function Yt(e, t, n) {
1979
2101
  }
1980
2102
  //#endregion
1981
2103
  //#region src/presentation/subagentControls.ts
1982
- var Xt = {};
1983
- function Zt(e) {
1984
- Object.assign(Xt, e);
2104
+ var en = {};
2105
+ function tn(e) {
2106
+ Object.assign(en, e);
1985
2107
  }
1986
- function Qt(e) {
1987
- return Xt[e];
2108
+ function nn(e) {
2109
+ return en[e];
1988
2110
  }
1989
2111
  //#endregion
1990
2112
  //#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");
2113
+ function rn(e, t = 6e3) {
2114
+ 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
2115
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
1994
2116
  }
1995
- function en(e) {
2117
+ function an(e) {
1996
2118
  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
2119
  }
1998
- function tn(e, t) {
2120
+ function on(e, t) {
1999
2121
  try {
2000
2122
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2001
2123
  } catch {
2002
2124
  return;
2003
2125
  }
2004
2126
  }
2005
- function nn(e, t, n, r, i) {
2006
- let a = tn(e, t), o = (e) => {
2007
- let t = e ? v(e) : null;
2127
+ function sn(e, t, n, r, i) {
2128
+ let a = on(e, t), o = (e) => {
2129
+ let t = e ? b(e) : null;
2008
2130
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2009
2131
  };
2010
2132
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2011
2133
  }
2012
- function rn(e) {
2013
- let t = b()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = At(), i = A({
2134
+ function cn(e) {
2135
+ let t = S()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Pt(), i = M({
2014
2136
  registry: t,
2015
2137
  modelsByProvider: n,
2016
2138
  selectedModel: r
@@ -2020,33 +2142,33 @@ function rn(e) {
2020
2142
  modelsByProvider: n,
2021
2143
  selectedModel: r
2022
2144
  };
2023
- let a = A(/* @__PURE__ */ new Set()), o = T(async (t, n, r) => {
2145
+ let a = M(/* @__PURE__ */ new Set()), o = D(async (t, n, r) => {
2024
2146
  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;
2147
+ let o = Re(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2148
+ if (!o || !s?.autoTitle || o.name || !We(o) || a.current.has(c)) return !1;
2149
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = sn(s, o.params, r ?? d, u, l), p = f ? b(f) : null;
2028
2150
  if (!p) return !1;
2029
2151
  a.current.add(c);
2030
2152
  try {
2031
2153
  let r = await l[p.provider].complete({
2032
- prompt: K().chatTitle.replace("{chat}", $t(o.activity)),
2154
+ prompt: X().chatTitle.replace("{chat}", rn(o.activity)),
2033
2155
  model: p.model,
2034
2156
  history: []
2035
- }), i = r && r.type === "text" ? en(r.text) : "";
2036
- return i ? Ge(e, t, n, i, "model") : !1;
2157
+ }), i = r && r.type === "text" ? an(r.text) : "";
2158
+ return i ? Ke(e, t, n, i, "model") : !1;
2037
2159
  } catch {
2038
2160
  return !1;
2039
2161
  } finally {
2040
2162
  a.current.delete(c);
2041
2163
  }
2042
2164
  }, [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);
2165
+ return k(() => {
2166
+ e && s && !ln.has(e) && (ln.add(e), (async () => {
2167
+ for (let t of Ye(e)) {
2168
+ let n = W(t.subagentId);
2047
2169
  if (n?.autoTitle) {
2048
- if (n.definition.conversational && !Ue(t)) {
2049
- qe(e, t.subagentId, t.entityId);
2170
+ if (n.definition.conversational && !We(t)) {
2171
+ Je(e, t.subagentId, t.entityId);
2050
2172
  continue;
2051
2173
  }
2052
2174
  t.name || await o(t.subagentId, t.entityId);
@@ -2059,23 +2181,23 @@ function rn(e) {
2059
2181
  o
2060
2182
  ]), o;
2061
2183
  }
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) => {
2184
+ var ln = /* @__PURE__ */ new Set(), un = () => ({});
2185
+ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2186
+ let c = Vt(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
2187
  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), {
2188
+ }, [g, _] = N([]), [v, y] = N(null), b = Zt(e.id), x = b?.kind === "selection" ? b : null, [S, C] = N(null), w = M(!1), E = M(0), D = M(null);
2189
+ p && p !== D.current && (D.current = p, E.current = (r?.length ?? 0) + c.activity.length);
2190
+ let O = M(!1), A = c.remote || !c.hasProviders || c.selectedModel !== "";
2191
+ k(() => {
2192
+ !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
2193
  model: o,
2072
2194
  openingMessage: s
2073
2195
  }).then((e) => {
2074
2196
  e && h(e);
2075
2197
  })));
2076
- }, [te]), D(() => {
2198
+ }, [A]), k(() => {
2077
2199
  if (!p || !u) return;
2078
- let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = xe();
2200
+ let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = Se();
2079
2201
  n.forEach((n) => {
2080
2202
  let a = i[n];
2081
2203
  a && (y(null), a.apply(p, {
@@ -2087,95 +2209,95 @@ function sn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2087
2209
  ...t,
2088
2210
  pinnedEntityId: r
2089
2211
  }).then((n) => {
2090
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Ut(e, t));
2212
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, qt(e, t));
2091
2213
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2092
2214
  });
2093
2215
  }, [
2094
2216
  p,
2095
2217
  c.activity,
2096
2218
  u
2097
- ]), D(() => {
2098
- p && x && w(x.defaultSelection(p));
2219
+ ]), k(() => {
2220
+ p && x && C(x.defaultSelection(p));
2099
2221
  }, [p, x]);
2100
- let F = (e, t) => {
2101
- w((n) => n && {
2222
+ let L = (e, t) => {
2223
+ C((n) => n && {
2102
2224
  ...n,
2103
2225
  [e]: t
2104
2226
  });
2105
- }, ne = (e) => h(e), I = k(() => p && x && S ? x.applySelection(p, S) : p, [
2227
+ }, R = (e) => h(e), z = j(() => p && x && S ? x.applySelection(p, S) : p, [
2106
2228
  p,
2107
2229
  x,
2108
2230
  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,
2231
+ ]), ee = j(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = j(() => $t(ee, t, f), [
2232
+ ee,
2111
2233
  t,
2112
2234
  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);
2235
+ ]), te = j(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = cn(u?.id), U = M(!1), W = M(!1);
2236
+ k(() => {
2237
+ let n = !U.current && c.running, i = U.current && !c.running;
2238
+ if (U.current = c.running, !n && !i || !V || !u) return;
2239
+ if (W.current) {
2240
+ i && (W.current = !1);
2119
2241
  return;
2120
2242
  }
2121
2243
  let a = c.snapshot();
2122
2244
  if (!a) return;
2123
2245
  let o = [...r ?? [], ...a.activity];
2124
- e.autoTitle && e.definition.conversational && !Ue({ activity: o }) || (Re({
2246
+ e.autoTitle && e.definition.conversational && !We({ activity: o }) || (ze({
2125
2247
  scopeId: u.id,
2126
2248
  subagentId: e.id,
2127
- entityId: R,
2249
+ entityId: V,
2128
2250
  params: t,
2129
- title: Ut(e, t),
2251
+ title: qt(e, t),
2130
2252
  history: a.history,
2131
2253
  activity: o
2132
- }), i && e.autoTitle && z(e.id, R, c.selectedModel));
2254
+ }), i && e.autoTitle && H(e.id, V, c.selectedModel));
2133
2255
  }, [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({
2256
+ let G = () => {
2257
+ O.current = !0, c.running && c.stop(), l.closeTask(f);
2258
+ }, K = M(nn(e.id) ?? un).current, q = K({
2137
2259
  params: t,
2138
2260
  taskId: f,
2139
2261
  running: c.running,
2140
- close: H
2141
- }), ae = (e) => {
2262
+ close: G
2263
+ }), ne = (e) => {
2142
2264
  _((t) => t.includes(e) ? t : [...t, e]);
2143
2265
  };
2144
- return D(() => {
2145
- P.current || l.openTask({
2266
+ return k(() => {
2267
+ O.current || l.openTask({
2146
2268
  id: f,
2147
- title: Ut(e, t),
2269
+ title: qt(e, t),
2148
2270
  icon: e.icon,
2149
2271
  agent: c,
2150
2272
  onApplied: (e) => h(e),
2151
2273
  precedingActivity: r,
2152
2274
  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, {
2275
+ onDismiss: G,
2276
+ ...V ? { savedToDisk: !0 } : {},
2277
+ panelActions: q.content,
2278
+ composerActions: q.actions,
2279
+ composerCommands: q.commands,
2280
+ panelExtra: p ? /* @__PURE__ */ I(P, { children: [
2281
+ x && S ? /* @__PURE__ */ F(x.Report, {
2160
2282
  result: p,
2161
2283
  selection: S,
2162
- onChange: F
2163
- }) : b?.kind === "editable" ? /* @__PURE__ */ M(b.Report, {
2284
+ onChange: L
2285
+ }) : b?.kind === "editable" ? /* @__PURE__ */ F(b.Report, {
2164
2286
  result: p,
2165
- onResultChange: ne
2166
- }) : /* @__PURE__ */ M(Jt, { result: I }),
2167
- v && /* @__PURE__ */ N("p", {
2287
+ onResultChange: R
2288
+ }) : /* @__PURE__ */ F(Qt, { result: z }),
2289
+ v && /* @__PURE__ */ I("p", {
2168
2290
  className: "text-xs text-destructive",
2169
2291
  children: ["Salvataggio automatico non riuscito: ", v]
2170
2292
  }),
2171
- /* @__PURE__ */ M(Wt, {
2293
+ /* @__PURE__ */ F(Jt, {
2172
2294
  manifest: e,
2173
- result: I,
2295
+ result: z,
2174
2296
  meta: t,
2175
2297
  taskId: f,
2176
2298
  initiallyApplied: g,
2177
- onApplied: ae,
2178
- extraDestinations: ie
2299
+ onApplied: ne,
2300
+ extraDestinations: te
2179
2301
  })
2180
2302
  ] }) : void 0
2181
2303
  });
@@ -2194,31 +2316,31 @@ function sn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2194
2316
  e,
2195
2317
  t,
2196
2318
  p,
2197
- I,
2319
+ z,
2198
2320
  S,
2199
2321
  g,
2200
2322
  n,
2201
2323
  r,
2202
2324
  v,
2203
- W.content,
2204
- W.actions,
2205
- W.commands
2206
- ]), D(() => () => {
2325
+ q.content,
2326
+ q.actions,
2327
+ q.commands
2328
+ ]), k(() => () => {
2207
2329
  l.closeTask(f);
2208
2330
  }, [l.closeTask, f]), null;
2209
2331
  }
2210
2332
  //#endregion
2211
2333
  //#region src/presentation/OrchestratorRunner.tsx
2212
- function cn({ userGoal: e }) {
2213
- let t = Q(), n = Lt(k(() => Ht({
2334
+ function fn({ userGoal: e }) {
2335
+ let t = $(), n = Vt(j(() => Kt({
2214
2336
  unavailable: t.orchestratorUnavailable,
2215
2337
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2216
2338
  preparing: t.orchestratorPreparing,
2217
2339
  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));
2340
+ }), []), { 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) => {
2341
+ e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Qe));
2220
2342
  };
2221
- D(() => {
2343
+ k(() => {
2222
2344
  !o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
2223
2345
  userGoal: e,
2224
2346
  pageContext: r.pageContext,
@@ -2230,9 +2352,9 @@ function cn({ userGoal: e }) {
2230
2352
  }).then((e) => {
2231
2353
  e && m(e);
2232
2354
  }));
2233
- }, [s]), D(() => {
2355
+ }, [s]), k(() => {
2234
2356
  p.current || r.openTask({
2235
- id: Ze,
2357
+ id: Qe,
2236
2358
  title: "Agentico",
2237
2359
  icon: "bot",
2238
2360
  agent: n,
@@ -2240,7 +2362,7 @@ function cn({ userGoal: e }) {
2240
2362
  scopedSubagentId: d.current,
2241
2363
  precedingActivity: f.current?.activity,
2242
2364
  onDismiss: () => {
2243
- p.current = !0, n.running && n.stop(), r.closeTask(Ze);
2365
+ p.current = !0, n.running && n.stop(), r.closeTask(Qe);
2244
2366
  }
2245
2367
  });
2246
2368
  }, [
@@ -2252,13 +2374,13 @@ function cn({ userGoal: e }) {
2252
2374
  n.modelsByProvider,
2253
2375
  n.hasProviders,
2254
2376
  r.openTask
2255
- ]), D(() => () => {
2256
- r.closeTask(Ze);
2377
+ ]), k(() => () => {
2378
+ r.closeTask(Qe);
2257
2379
  }, [r.closeTask]);
2258
- let h = k(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2380
+ let h = j(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2259
2381
  if (!i) return null;
2260
- let g = z(i.subagentId);
2261
- return g ? /* @__PURE__ */ M(sn, {
2382
+ let g = W(i.subagentId);
2383
+ return g ? /* @__PURE__ */ F(dn, {
2262
2384
  manifest: g,
2263
2385
  params: i.params,
2264
2386
  extraDestinations: c.current,
@@ -2269,8 +2391,8 @@ function cn({ userGoal: e }) {
2269
2391
  }
2270
2392
  //#endregion
2271
2393
  //#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) => {
2394
+ function pn({ manifest: e, extraDestinations: n }) {
2395
+ let r = Vt(e.definition, { defaultEnabled: !1 }), i = $(), a = tt(), o = M(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = N(null), [l, u] = N([]), d = Zt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = N(null), [h, g] = N(null), _ = M(!1), v = (t) => {
2274
2396
  if (!e.manualEntry) return;
2275
2397
  let n;
2276
2398
  try {
@@ -2283,7 +2405,7 @@ function ln({ manifest: e, extraDestinations: n }) {
2283
2405
  e && c(e);
2284
2406
  });
2285
2407
  };
2286
- D(() => {
2408
+ k(() => {
2287
2409
  s && f && m(f.defaultSelection(s));
2288
2410
  }, [s, f]);
2289
2411
  let y = (e, t) => {
@@ -2291,18 +2413,18 @@ function ln({ manifest: e, extraDestinations: n }) {
2291
2413
  ...n,
2292
2414
  [e]: t
2293
2415
  });
2294
- }, b = (e) => c(e), x = k(() => s && f && p ? f.applySelection(s, p) : s, [
2416
+ }, b = (e) => c(e), x = j(() => s && f && p ? f.applySelection(s, p) : s, [
2295
2417
  s,
2296
2418
  f,
2297
2419
  p
2298
2420
  ]), S = (e) => {
2299
2421
  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, [
2422
+ }, C = j(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = j(() => h ? $t(C, h, o) : null, [
2301
2423
  C,
2302
2424
  h,
2303
2425
  o
2304
- ]), T = k(() => w ? [w, ...n ?? []] : n, [w, n]);
2305
- return D(() => {
2426
+ ]), T = j(() => w ? [w, ...n ?? []] : n, [w, n]);
2427
+ return k(() => {
2306
2428
  _.current || a.openTask({
2307
2429
  id: o,
2308
2430
  title: e.label,
@@ -2316,18 +2438,18 @@ function ln({ manifest: e, extraDestinations: n }) {
2316
2438
  onDismiss: () => {
2317
2439
  _.current = !0, r.running && r.stop(), a.closeTask(o);
2318
2440
  },
2319
- panelExtra: s ? /* @__PURE__ */ N("div", {
2441
+ panelExtra: s ? /* @__PURE__ */ I("div", {
2320
2442
  className: "space-y-2",
2321
2443
  children: [
2322
- f && p ? /* @__PURE__ */ M(f.Report, {
2444
+ f && p ? /* @__PURE__ */ F(f.Report, {
2323
2445
  result: s,
2324
2446
  selection: p,
2325
2447
  onChange: y
2326
- }) : d?.kind === "editable" ? /* @__PURE__ */ M(d.Report, {
2448
+ }) : d?.kind === "editable" ? /* @__PURE__ */ F(d.Report, {
2327
2449
  result: s,
2328
2450
  onResultChange: b
2329
- }) : /* @__PURE__ */ M(Jt, { result: x }),
2330
- /* @__PURE__ */ M(Wt, {
2451
+ }) : /* @__PURE__ */ F(Qt, { result: x }),
2452
+ /* @__PURE__ */ F(Jt, {
2331
2453
  manifest: e,
2332
2454
  result: x,
2333
2455
  meta: h ?? {},
@@ -2336,7 +2458,7 @@ function ln({ manifest: e, extraDestinations: n }) {
2336
2458
  onApplied: S,
2337
2459
  extraDestinations: T
2338
2460
  }),
2339
- r.hasProviders && /* @__PURE__ */ M(t, {
2461
+ r.hasProviders && /* @__PURE__ */ F(t, {
2340
2462
  label: i.resumeWithAi,
2341
2463
  variant: "outline-secondary",
2342
2464
  className: "text-xs",
@@ -2358,13 +2480,13 @@ function ln({ manifest: e, extraDestinations: n }) {
2358
2480
  p,
2359
2481
  l,
2360
2482
  h
2361
- ]), D(() => () => {
2483
+ ]), k(() => () => {
2362
2484
  a.closeTask(o);
2363
2485
  }, []), null;
2364
2486
  }
2365
2487
  //#endregion
2366
2488
  //#region src/presentation/Agentico.tsx
2367
- function un(e, t) {
2489
+ function mn(e, t) {
2368
2490
  return Object.values(e).flat().map((e) => {
2369
2491
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2370
2492
  return {
@@ -2376,10 +2498,10 @@ function un(e, t) {
2376
2498
  };
2377
2499
  });
2378
2500
  }
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);
2501
+ function hn({ task: e }) {
2502
+ let t = $(), [n, r] = N(""), { agent: i, onApplied: a, manualEntry: o } = e, c = i.running, l = (e) => {
2503
+ if (r(""), o) {
2504
+ o.onSubmit(e.text);
2383
2505
  return;
2384
2506
  }
2385
2507
  i.sendMessage(e.text, {
@@ -2388,16 +2510,16 @@ function dn({ task: e }) {
2388
2510
  }).then((e) => {
2389
2511
  e && a(e);
2390
2512
  });
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, {
2513
+ }, 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, ...mn(i.modelsByProvider, i.catalogGroup)] : mn(i.modelsByProvider);
2514
+ return /* @__PURE__ */ F(s, {
2393
2515
  value: n,
2394
2516
  onChange: r,
2395
- placeholder: s?.prompt ?? t.messagePlaceholder,
2517
+ placeholder: o?.prompt ?? t.messagePlaceholder,
2396
2518
  running: c,
2397
2519
  onStop: i.stop,
2398
2520
  disabled: !n.trim() || f,
2399
2521
  onSubmit: l,
2400
- attachments: !s && !i.remote && !d,
2522
+ attachments: !o && !i.remote && !d,
2401
2523
  models: p,
2402
2524
  selectedModel: u ? "" : i.selectedModel,
2403
2525
  actions: e.composerActions,
@@ -2408,52 +2530,52 @@ function dn({ task: e }) {
2408
2530
  maxHeight: 220
2409
2531
  });
2410
2532
  }
2411
- function fn() {
2412
- let { startOrchestrator: e } = $(), t = Q(), [n, r] = j(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = At(), l = (t) => {
2533
+ function gn() {
2534
+ let { startOrchestrator: e } = tt(), t = $(), [n, r] = N(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Pt(), l = (t) => {
2413
2535
  t.text.trim() && (e(t.text.trim(), {
2414
2536
  attachments: t.files.length > 0 ? t.files : void 0,
2415
2537
  model: t.model || void 0
2416
2538
  }), r(""));
2417
- }, u = i && !s;
2418
- return /* @__PURE__ */ M(o, {
2539
+ }, u = i && !o;
2540
+ return /* @__PURE__ */ F(s, {
2419
2541
  value: n,
2420
2542
  onChange: r,
2421
2543
  placeholder: t.orchestratorStarterPlaceholder,
2422
2544
  disabled: !n.trim() || u,
2423
2545
  onSubmit: l,
2424
2546
  attachments: !0,
2425
- models: un(a),
2426
- selectedModel: s,
2547
+ models: mn(a),
2548
+ selectedModel: o,
2427
2549
  onModelChange: c,
2428
2550
  modelPlaceholder: t.selectModelPlaceholder,
2429
2551
  minHeight: 44,
2430
2552
  maxHeight: 220
2431
2553
  });
2432
2554
  }
2433
- function pn({ chat: e, onClose: t }) {
2434
- let n = Q(), r = x();
2435
- return /* @__PURE__ */ M(p, {
2555
+ function _n({ chat: e, onClose: t }) {
2556
+ let n = $(), r = C();
2557
+ return /* @__PURE__ */ F(h, {
2436
2558
  title: n.renameChat,
2437
2559
  size: "sm",
2438
2560
  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, {
2561
+ onSave: () => (Ke(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Ue(e)), "person"), t(), Promise.resolve(!0)),
2562
+ children: /* @__PURE__ */ I(d, {
2441
2563
  appearance: "empty",
2442
2564
  controller: r,
2443
- defaultValues: { title: He(e) },
2565
+ defaultValues: { title: Ue(e) },
2444
2566
  footer: !1,
2445
- children: [/* @__PURE__ */ M(f, {
2567
+ children: [/* @__PURE__ */ F(p, {
2446
2568
  name: "title",
2447
2569
  label: n.chatTitleLabel,
2448
2570
  placeholder: e.title
2449
- }), /* @__PURE__ */ M("p", {
2571
+ }), /* @__PURE__ */ F("p", {
2450
2572
  className: "text-xs text-muted-foreground",
2451
2573
  children: n.chatTitleHint
2452
2574
  })]
2453
2575
  })
2454
2576
  });
2455
2577
  }
2456
- function mn(e, t, n = Date.now()) {
2578
+ function vn(e, t, n = Date.now()) {
2457
2579
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2458
2580
  numeric: "auto",
2459
2581
  style: "short"
@@ -2465,55 +2587,55 @@ function mn(e, t, n = Date.now()) {
2465
2587
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2466
2588
  return i.format(0, "minute");
2467
2589
  }
2468
- function hn({ card: e }) {
2469
- let t = Q();
2470
- return e.humanSummaryOnly ? /* @__PURE__ */ N("div", {
2590
+ function yn({ card: e }) {
2591
+ let t = $();
2592
+ return e.humanSummaryOnly ? /* @__PURE__ */ I("div", {
2471
2593
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2472
- children: [/* @__PURE__ */ N("p", {
2594
+ children: [/* @__PURE__ */ I("p", {
2473
2595
  className: "text-xs font-medium text-foreground",
2474
2596
  children: [
2475
2597
  "\"",
2476
2598
  e.label,
2477
2599
  "\""
2478
2600
  ]
2479
- }), /* @__PURE__ */ M("p", {
2601
+ }), /* @__PURE__ */ F("p", {
2480
2602
  className: "text-xs text-muted-foreground",
2481
2603
  children: e.humanSummary
2482
2604
  })]
2483
- }) : /* @__PURE__ */ N("div", {
2605
+ }) : /* @__PURE__ */ I("div", {
2484
2606
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2485
2607
  children: [
2486
- /* @__PURE__ */ M("p", {
2608
+ /* @__PURE__ */ F("p", {
2487
2609
  className: "text-xs font-medium text-foreground",
2488
- children: _(t.newInstance, { label: e.label })
2610
+ children: y(t.newInstance, { label: e.label })
2489
2611
  }),
2490
- /* @__PURE__ */ M("p", {
2612
+ /* @__PURE__ */ F("p", {
2491
2613
  className: "text-xs text-muted-foreground",
2492
2614
  children: e.humanSummary
2493
2615
  }),
2494
- e.fields.length > 0 && /* @__PURE__ */ M("ul", {
2616
+ e.fields.length > 0 && /* @__PURE__ */ F("ul", {
2495
2617
  className: "space-y-1",
2496
- children: e.fields.map((e) => /* @__PURE__ */ N("li", {
2618
+ children: e.fields.map((e) => /* @__PURE__ */ I("li", {
2497
2619
  className: "flex items-start gap-1.5 text-xs",
2498
- children: [/* @__PURE__ */ M(n, {
2620
+ children: [/* @__PURE__ */ F(n, {
2499
2621
  variant: e.required ? "primary" : "secondary",
2500
2622
  className: "mt-px shrink-0",
2501
2623
  children: e.required ? "richiesto" : "opzionale"
2502
- }), /* @__PURE__ */ N("span", {
2624
+ }), /* @__PURE__ */ I("span", {
2503
2625
  className: "min-w-0",
2504
- children: [/* @__PURE__ */ M("span", {
2626
+ children: [/* @__PURE__ */ F("span", {
2505
2627
  className: "font-mono text-foreground",
2506
2628
  children: e.key
2507
- }), e.humanDescription ? /* @__PURE__ */ N("span", {
2629
+ }), e.humanDescription ? /* @__PURE__ */ I("span", {
2508
2630
  className: "text-muted-foreground",
2509
2631
  children: [" — ", e.humanDescription]
2510
2632
  }) : null]
2511
2633
  })]
2512
2634
  }, e.key))
2513
2635
  }),
2514
- e.example && /* @__PURE__ */ N("p", {
2636
+ e.example && /* @__PURE__ */ I("p", {
2515
2637
  className: "text-xs text-muted-foreground",
2516
- children: ["Esempio: ", /* @__PURE__ */ M("span", {
2638
+ children: ["Esempio: ", /* @__PURE__ */ F("span", {
2517
2639
  className: "font-mono",
2518
2640
  children: e.example
2519
2641
  })]
@@ -2521,43 +2643,43 @@ function hn({ card: e }) {
2521
2643
  ]
2522
2644
  });
2523
2645
  }
2524
- function gn({ messages: e }) {
2525
- return /* @__PURE__ */ M("div", {
2646
+ function bn({ messages: e }) {
2647
+ return /* @__PURE__ */ F("div", {
2526
2648
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2527
- children: e.map((e, t) => /* @__PURE__ */ M("p", {
2649
+ children: e.map((e, t) => /* @__PURE__ */ F("p", {
2528
2650
  className: "text-xs text-muted-foreground",
2529
2651
  children: e
2530
2652
  }, t))
2531
2653
  });
2532
2654
  }
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) : [], [
2655
+ function xn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2656
+ let c = $(), { locale: d } = w(), [p, m] = N(""), [h, g] = N(0);
2657
+ k(() => Ie(() => g((e) => e + 1)), []);
2658
+ let _ = j(() => r ? Ye(e) : [], [
2537
2659
  e,
2538
2660
  r,
2539
2661
  h
2540
- ]), [v, y] = j(null), b = async (t) => {
2541
- let r = z(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2662
+ ]), [v, y] = N(null), b = async (t) => {
2663
+ let r = W(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2542
2664
  if (!i || window.confirm(i)) {
2543
2665
  try {
2544
2666
  await r?.onArchive?.(t.entityId, t.params);
2545
2667
  } catch {
2546
2668
  return;
2547
2669
  }
2548
- qe(e, t.subagentId, t.entityId), n === Ye(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2670
+ Je(e, t.subagentId, t.entityId), n === Xe(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2549
2671
  }
2550
- }, x = k(() => {
2672
+ }, x = j(() => {
2551
2673
  let e = p.trim().toLowerCase();
2552
2674
  return e ? _.filter((t) => {
2553
- let n = z(t.subagentId)?.label ?? t.subagentId;
2554
- return He(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
2675
+ let n = W(t.subagentId)?.label ?? t.subagentId;
2676
+ return Ue(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
2555
2677
  }) : _;
2556
2678
  }, [_, p]);
2557
- return /* @__PURE__ */ N(ee, { children: [/* @__PURE__ */ M(c, {
2679
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(l, {
2558
2680
  trigger: {
2559
2681
  icon: "history",
2560
- title: u.chatHistory
2682
+ title: c.chatHistory
2561
2683
  },
2562
2684
  triggerClassName: "!h-9 !w-9 !p-0 rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground",
2563
2685
  open: r,
@@ -2565,208 +2687,209 @@ function _n({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2565
2687
  position: "end",
2566
2688
  strategy: "absolute",
2567
2689
  menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
2568
- header: /* @__PURE__ */ N("div", {
2690
+ header: /* @__PURE__ */ I("div", {
2569
2691
  className: "flex items-center gap-2 px-1 pb-1.5",
2570
2692
  children: [
2571
- /* @__PURE__ */ M(d, {
2693
+ /* @__PURE__ */ F(f, {
2572
2694
  name: "search",
2573
2695
  size: 14,
2574
2696
  className: "shrink-0 text-muted-foreground"
2575
2697
  }),
2576
- /* @__PURE__ */ M("input", {
2698
+ /* @__PURE__ */ F("input", {
2577
2699
  autoFocus: !0,
2578
2700
  value: p,
2579
2701
  onChange: (e) => m(e.target.value),
2580
- placeholder: u.searchChats,
2702
+ placeholder: c.searchChats,
2581
2703
  className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
2582
2704
  }),
2583
- /* @__PURE__ */ M(t, {
2705
+ /* @__PURE__ */ F(t, {
2584
2706
  icon: "square-pen",
2585
- ariaLabel: u.newChat,
2586
- title: u.newChat,
2707
+ ariaLabel: c.newChat,
2708
+ title: c.newChat,
2587
2709
  variant: "link",
2588
2710
  className: "shrink-0",
2589
2711
  onClick: o
2590
2712
  })
2591
2713
  ]
2592
2714
  }),
2593
- children: x.length === 0 ? /* @__PURE__ */ M("p", {
2715
+ children: x.length === 0 ? /* @__PURE__ */ F("p", {
2594
2716
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
2595
- children: _.length === 0 ? u.noSavedChats : u.noResults
2717
+ children: _.length === 0 ? c.noSavedChats : c.noResults
2596
2718
  }) : x.map((e) => {
2597
- let t = z(e.subagentId), r = n === Ye(e.subagentId, e.entityId);
2598
- return /* @__PURE__ */ M(l, {
2719
+ let t = W(e.subagentId), r = n === Xe(e.subagentId, e.entityId);
2720
+ return /* @__PURE__ */ F(u, {
2599
2721
  icon: r ? "check" : t?.icon ?? "bot",
2600
2722
  className: r ? "bg-accent font-semibold text-primary" : void 0,
2601
2723
  actions: [{
2602
2724
  icon: "pencil",
2603
- label: u.renameChat,
2725
+ label: c.renameChat,
2604
2726
  onClick: () => {
2605
2727
  i(!1), y(e);
2606
2728
  }
2607
2729
  }, {
2608
2730
  icon: "archive",
2609
- label: u.archiveChat,
2731
+ label: c.archiveChat,
2610
2732
  onClick: () => void b(e)
2611
2733
  }],
2612
2734
  onClick: () => a(e.subagentId, e.entityId, e),
2613
- children: /* @__PURE__ */ N("span", {
2735
+ children: /* @__PURE__ */ I("span", {
2614
2736
  className: "flex min-w-0 flex-1 items-center justify-between gap-2",
2615
- children: [/* @__PURE__ */ M("span", {
2737
+ children: [/* @__PURE__ */ F("span", {
2616
2738
  className: "min-w-0 truncate",
2617
- title: `${t?.label ?? e.subagentId} · ${He(e)}`,
2618
- children: He(e)
2619
- }), /* @__PURE__ */ M("span", {
2739
+ title: `${t?.label ?? e.subagentId} · ${Ue(e)}`,
2740
+ children: Ue(e)
2741
+ }), /* @__PURE__ */ F("span", {
2620
2742
  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)
2743
+ title: `${c.chatStarted.replace("{at}", new Date(qe(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
2744
+ children: vn(qe(e), d)
2623
2745
  })]
2624
2746
  })
2625
2747
  }, `${e.subagentId}:${e.entityId}`);
2626
2748
  })
2627
- }), v && /* @__PURE__ */ M(pn, {
2749
+ }), v && /* @__PURE__ */ F(_n, {
2628
2750
  chat: v,
2629
2751
  onClose: () => y(null)
2630
2752
  })] });
2631
2753
  }
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({
2754
+ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2755
+ 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);
2756
+ cn(w?.id);
2757
+ let A = Ot({
2636
2758
  defaultWidth: e,
2637
2759
  minWidth: n,
2638
2760
  maxWidth: r,
2639
2761
  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),
2762
+ }), j = () => {
2763
+ (!a || a.agent.running || a.savedToDisk || window.confirm(T.unsavedConversationConfirm)) && (m(), O(!1));
2764
+ }, 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 ? {
2765
+ canAnswer: (e) => V.has(e),
2644
2766
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2645
2767
  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(() => {
2768
+ }),
2769
+ onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
2770
+ } : void 0, U = H ? mt(L, H.canAnswer) : null, G = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, K = G?.manualEntry ? G : null, q = M(!0);
2771
+ k(() => {
2649
2772
  let e = E.current;
2650
2773
  if (!e) return;
2651
2774
  let t = () => {
2652
- W.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2775
+ q.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2653
2776
  };
2654
2777
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
2655
- }, [a?.id]), D(() => {
2778
+ }, [a?.id]), k(() => {
2656
2779
  let e = E.current;
2657
- e && (W.current = !0, e.scrollTop = e.scrollHeight);
2780
+ e && (q.current = !0, e.scrollTop = e.scrollHeight);
2658
2781
  }, [a?.id]);
2659
- let ae = F.at(-1)?.detail?.length ?? 0;
2660
- D(() => {
2782
+ let ne = L.at(-1)?.detail?.length ?? 0;
2783
+ k(() => {
2661
2784
  let e = E.current;
2662
- e && W.current && (e.scrollTop = e.scrollHeight);
2785
+ e && q.current && (e.scrollTop = e.scrollHeight);
2663
2786
  }, [
2664
- ne,
2665
- ie,
2666
- ae
2787
+ R,
2788
+ te,
2789
+ ne
2667
2790
  ]);
2668
- let oe = A(null);
2669
- D(() => {
2670
- let e = E.current, t = oe.current;
2791
+ let re = M(null);
2792
+ k(() => {
2793
+ let e = E.current, t = re.current;
2671
2794
  if (!e || !t || typeof ResizeObserver > "u") return;
2672
2795
  let n = new ResizeObserver(() => {
2673
- W.current && (e.scrollTop = e.scrollHeight);
2796
+ q.current && (e.scrollTop = e.scrollHeight);
2674
2797
  });
2675
2798
  return n.observe(t), () => n.disconnect();
2676
2799
  }, [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,
2800
+ let J = s ? /* @__PURE__ */ F(fn, { userGoal: s }, c) : null, ie = f ? W(f.subagentId) : void 0, ae = f && ie ? /* @__PURE__ */ F(dn, {
2801
+ manifest: ie,
2679
2802
  params: f.snapshot.params,
2680
- taskId: Ye(f.subagentId, f.entityId),
2803
+ taskId: Xe(f.subagentId, f.entityId),
2681
2804
  resumeSeed: {
2682
2805
  history: f.snapshot.history,
2683
2806
  activity: f.snapshot.activity
2684
2807
  }
2685
- }, p) : null, K = g ? z(g.subagentId) : void 0, le = g && K ? /* @__PURE__ */ M(ln, {
2686
- manifest: K,
2808
+ }, p) : null, Y = g ? W(g.subagentId) : void 0, oe = g && Y ? /* @__PURE__ */ F(pn, {
2809
+ manifest: Y,
2687
2810
  extraDestinations: g.extraDestinations
2688
- }, _) : null, ue = b ? z(b.subagentId) : void 0, q = b && ue ? /* @__PURE__ */ M(sn, {
2689
- manifest: ue,
2811
+ }, _) : null, X = b ? W(b.subagentId) : void 0, Z = b && X ? /* @__PURE__ */ F(dn, {
2812
+ manifest: X,
2690
2813
  params: b.params,
2691
2814
  extraDestinations: b.extraDestinations
2692
- }, x) : null, J = S ? z(S.subagentId) : void 0, de = S && J ? /* @__PURE__ */ M(sn, {
2693
- manifest: J,
2815
+ }, x) : null, se = S ? W(S.subagentId) : void 0, ce = S && se ? /* @__PURE__ */ F(dn, {
2816
+ manifest: se,
2694
2817
  params: S.params,
2695
2818
  taskId: S.taskId,
2696
2819
  openingMessage: S.openingMessage
2697
2820
  }, C) : null;
2698
- return o ? /* @__PURE__ */ N(ee, { children: [
2699
- G,
2821
+ return o ? /* @__PURE__ */ I(P, { children: [
2822
+ J,
2823
+ ae,
2824
+ oe,
2825
+ Z,
2700
2826
  ce,
2701
- le,
2702
- q,
2703
- de,
2704
- /* @__PURE__ */ N("div", {
2705
- style: { width: P.width },
2827
+ /* @__PURE__ */ I("div", {
2828
+ style: { width: A.width },
2706
2829
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2707
2830
  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
2831
+ /* @__PURE__ */ F(kt, {
2832
+ width: A.width,
2833
+ min: A.min,
2834
+ max: A.max,
2835
+ onResize: A.set,
2836
+ onCommit: A.commit,
2837
+ onReset: A.reset
2715
2838
  }),
2716
- /* @__PURE__ */ N("div", {
2839
+ /* @__PURE__ */ I("div", {
2717
2840
  className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
2718
2841
  children: [
2719
- /* @__PURE__ */ M("span", {
2842
+ /* @__PURE__ */ F("span", {
2720
2843
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2721
2844
  children: a ? a.title : "Agentico"
2722
2845
  }),
2723
- w && /* @__PURE__ */ M(_n, {
2846
+ w && /* @__PURE__ */ F(xn, {
2724
2847
  scopeId: w.id,
2725
2848
  currentTaskId: a?.id ?? null,
2726
- open: O,
2727
- onOpenChange: k,
2728
- onNewChat: te,
2849
+ open: D,
2850
+ onOpenChange: O,
2851
+ onNewChat: j,
2729
2852
  onSelect: (e, t, n) => h(e, t, n),
2730
2853
  onArchivedCurrent: m
2731
2854
  }),
2732
- /* @__PURE__ */ M(Et, {})
2855
+ /* @__PURE__ */ F(At, {})
2733
2856
  ]
2734
2857
  }),
2735
- /* @__PURE__ */ M("div", {
2858
+ /* @__PURE__ */ F("div", {
2736
2859
  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,
2860
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${U ? "min-h-24" : "min-h-0"}`,
2861
+ children: /* @__PURE__ */ F("div", {
2862
+ ref: re,
2740
2863
  className: "pt-2",
2741
- children: a ? /* @__PURE__ */ N(ee, { children: [
2742
- a.manualEntry && F.length === 0 && /* @__PURE__ */ M("p", {
2864
+ children: a ? /* @__PURE__ */ I(P, { children: [
2865
+ a.manualEntry && L.length === 0 && /* @__PURE__ */ F("p", {
2743
2866
  className: "text-xs text-muted-foreground",
2744
2867
  children: a.manualEntry.prompt
2745
2868
  }),
2746
- /* @__PURE__ */ M(mt, {
2747
- activity: re,
2748
- questions: B,
2749
- docked: V,
2750
- pinUserMessages: !V
2869
+ /* @__PURE__ */ F(vt, {
2870
+ activity: ee,
2871
+ questions: H,
2872
+ docked: U,
2873
+ pinUserMessages: !U
2751
2874
  }),
2752
- a.panelExtra && /* @__PURE__ */ M("div", {
2875
+ a.panelExtra && /* @__PURE__ */ F("div", {
2753
2876
  className: "mt-3",
2754
2877
  children: a.panelExtra
2755
2878
  }),
2756
- L.length > 0 && /* @__PURE__ */ M(mt, {
2757
- activity: L,
2758
- questions: B,
2759
- docked: V,
2760
- pinUserMessages: !V
2879
+ B.length > 0 && /* @__PURE__ */ F(vt, {
2880
+ activity: B,
2881
+ questions: H,
2882
+ docked: U,
2883
+ pinUserMessages: !U
2761
2884
  }),
2762
- !a.agent.running && a.agent.error && /* @__PURE__ */ N("div", {
2885
+ !a.agent.running && a.agent.error && /* @__PURE__ */ I("div", {
2763
2886
  className: "mt-2 flex items-center gap-2",
2764
2887
  children: [
2765
- /* @__PURE__ */ M("p", {
2888
+ /* @__PURE__ */ F("p", {
2766
2889
  className: "flex-1 text-xs text-destructive",
2767
2890
  children: a.agent.error
2768
2891
  }),
2769
- /* @__PURE__ */ M(t, {
2892
+ /* @__PURE__ */ F(t, {
2770
2893
  label: T.retry,
2771
2894
  variant: "secondary",
2772
2895
  className: "shrink-0",
@@ -2776,13 +2899,13 @@ function vn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2776
2899
  });
2777
2900
  }
2778
2901
  }),
2779
- !a.agent.remote && /* @__PURE__ */ M(t, {
2902
+ !a.agent.remote && /* @__PURE__ */ F(t, {
2780
2903
  label: T.continueWithoutAi,
2781
2904
  variant: "secondary",
2782
2905
  className: "shrink-0",
2783
2906
  onClick: () => {
2784
- if (U) {
2785
- v(U.id, y);
2907
+ if (K) {
2908
+ v(K.id, y);
2786
2909
  return;
2787
2910
  }
2788
2911
  let e = a.agent.runFallback();
@@ -2791,32 +2914,32 @@ function vn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2791
2914
  })
2792
2915
  ]
2793
2916
  })
2794
- ] }) : d.length > 0 ? /* @__PURE__ */ M(gn, { messages: d }) : u ? /* @__PURE__ */ M(hn, { card: u }) : /* @__PURE__ */ M("p", {
2917
+ ] }) : d.length > 0 ? /* @__PURE__ */ F(bn, { messages: d }) : u ? /* @__PURE__ */ F(yn, { card: u }) : /* @__PURE__ */ F("p", {
2795
2918
  className: "text-xs text-muted-foreground",
2796
2919
  children: l ?? T.orchestratorStarterHint
2797
2920
  })
2798
2921
  })
2799
2922
  }),
2800
- a && V ? /* @__PURE__ */ N("section", {
2923
+ a && U ? /* @__PURE__ */ I("section", {
2801
2924
  "aria-label": T.pendingQuestions,
2802
2925
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
2803
2926
  children: [
2804
- a.panelActions && /* @__PURE__ */ M("div", {
2927
+ a.panelActions && /* @__PURE__ */ F("div", {
2805
2928
  className: "shrink-0 px-4 pt-3",
2806
2929
  children: a.panelActions
2807
2930
  }),
2808
- /* @__PURE__ */ M("div", {
2931
+ /* @__PURE__ */ F("div", {
2809
2932
  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,
2933
+ children: /* @__PURE__ */ F(ht, {
2934
+ entry: U.entry,
2935
+ part: U.part,
2936
+ questions: H,
2814
2937
  autoFocus: !0
2815
- }, `${V.entry.id}:${V.part.id}`)
2938
+ }, `${U.entry.id}:${U.part.id}`)
2816
2939
  }),
2817
- a.agent.running && /* @__PURE__ */ M("div", {
2940
+ a.agent.running && /* @__PURE__ */ F("div", {
2818
2941
  className: "flex shrink-0 justify-end px-4 pb-3",
2819
- children: /* @__PURE__ */ M(t, {
2942
+ children: /* @__PURE__ */ F(t, {
2820
2943
  icon: "square",
2821
2944
  label: T.stop,
2822
2945
  variant: "secondary",
@@ -2824,34 +2947,34 @@ function vn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2824
2947
  })
2825
2948
  })
2826
2949
  ]
2827
- }) : /* @__PURE__ */ N("div", {
2950
+ }) : /* @__PURE__ */ I("div", {
2828
2951
  className: "border-t border-border/60 px-4 py-3",
2829
- children: [a?.panelActions && /* @__PURE__ */ M("div", {
2952
+ children: [a?.panelActions && /* @__PURE__ */ F("div", {
2830
2953
  className: "mb-2",
2831
2954
  children: a.panelActions
2832
- }), a ? /* @__PURE__ */ M(dn, { task: a }, a.id) : /* @__PURE__ */ M(fn, {})]
2955
+ }), a ? /* @__PURE__ */ F(hn, { task: a }, a.id) : /* @__PURE__ */ F(gn, {})]
2833
2956
  })
2834
2957
  ]
2835
2958
  })
2836
- ] }) : /* @__PURE__ */ N(ee, { children: [
2837
- G,
2838
- ce,
2839
- le,
2840
- q,
2841
- de
2959
+ ] }) : /* @__PURE__ */ I(P, { children: [
2960
+ J,
2961
+ ae,
2962
+ oe,
2963
+ Z,
2964
+ ce
2842
2965
  ] });
2843
2966
  }
2844
2967
  //#endregion
2845
2968
  //#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]);
2969
+ function Cn(e, t) {
2970
+ let { setPageContext: n } = tt(), r = M(crypto.randomUUID()).current;
2971
+ k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2849
2972
  }
2850
2973
  //#endregion
2851
2974
  //#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(() => {
2975
+ function wn(e, t, n, r, i = !0, a) {
2976
+ let { registerComponentAnchor: o } = tt(), s = M(crypto.randomUUID()).current, c = M(n);
2977
+ c.current = n, k(() => {
2855
2978
  if (i) return o(s, {
2856
2979
  subagentId: e,
2857
2980
  componentKey: t,
@@ -2868,6 +2991,6 @@ function bn(e, t, n, r, i = !0, a) {
2868
2991
  ]);
2869
2992
  }
2870
2993
  //#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 };
2994
+ export { xt as AGENTICO_MAX_WIDTH, bt as AGENTICO_MIN_WIDTH, yt as AGENTICO_WIDTH, St as AGENTICO_WIDTH_STORAGE_KEY, Sn as Agentico, et as AgenticoProvider, At 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, nn as getSubagentControls, U as getSubagentRegistry, Zt as getSubagentReport, ke as hasEntityChatBackend, ye as jsonExportDestination, Ye as listEntityChats, ee as messagePartsText, Ie as onEntityChatsChange, K as registerCrossAgentTools, xe as registerDestinations, tn as registerSubagentControls, Xt 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, Vt as useAgent, tt as useAgentico, $ as useAgenticoI18n, Cn as useAgenticoPageContext, wn as useSubagentComponentContext };
2872
2995
 
2873
2996
  //# sourceMappingURL=index.mjs.map