@llmnative/agentico 0.17.2 → 0.19.0

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