@llmnative/agentico 0.17.2 → 0.18.0

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