@llmnative/agentico 0.11.0 → 0.13.0

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