@llmnative/agentico 0.16.1 → 0.17.2

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