@llmnative/agentico 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { createContext as b, useCallback as x, useContext as S, useEffect as C,
4
4
  import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
5
5
  //#region src/domain/messageParts.ts
6
6
  var j = "text", M = "reasoning";
7
- function N(e, t, n) {
7
+ function ee(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 N(e, t, n) {
14
14
  ...i.slice(a)
15
15
  ] : [...i, t];
16
16
  }
17
- function P(e) {
17
+ function N(e) {
18
18
  return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
19
19
  }
20
- function F(e, t) {
20
+ function P(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 I(e) {
25
+ function te(e) {
26
26
  return e;
27
27
  }
28
28
  //#endregion
29
29
  //#region src/domain/subagentRegistry.ts
30
- var L = [];
31
- function R(e) {
32
- L = e;
30
+ var F = [];
31
+ function I(e) {
32
+ F = e;
33
33
  }
34
- function z() {
35
- return L.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), L;
34
+ function L() {
35
+ return F.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), F;
36
36
  }
37
- function B(e) {
38
- return L.find((t) => t.id === e);
37
+ function R(e) {
38
+ return F.find((t) => t.id === e);
39
39
  }
40
40
  //#endregion
41
41
  //#region src/domain/crossAgentTools.ts
42
- var V = [];
43
- function ee(...e) {
44
- V = e;
42
+ var z = [];
43
+ function ne(...e) {
44
+ z = e;
45
45
  }
46
- function H(e) {
47
- return V.flatMap((t) => t(e));
46
+ function B(e) {
47
+ return z.flatMap((t) => t(e));
48
48
  }
49
49
  //#endregion
50
50
  //#region src/domain/mcpTool.ts
51
- function U(t) {
51
+ function V(t) {
52
52
  let { $schema: n, ...r } = e(t, {
53
53
  target: "jsonSchema7",
54
54
  $refStrategy: "none"
55
55
  });
56
56
  return r;
57
57
  }
58
- function W(e, t, n, r) {
58
+ function H(e, t, n, r) {
59
59
  return {
60
60
  name: e,
61
61
  description: t,
62
- inputSchema: U(n),
63
- ...r ? { outputSchema: U(r) } : {}
62
+ inputSchema: V(n),
63
+ ...r ? { outputSchema: V(r) } : {}
64
64
  };
65
65
  }
66
66
  //#endregion
67
67
  //#region src/domain/subagentUsageCard.ts
68
- function G(e) {
69
- let t = U(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function U(e) {
69
+ let t = V(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 G(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/domain/prompts.ts
83
- var K = {
83
+ var W = {
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.",
@@ -109,7 +109,7 @@ var K = {
109
109
  "block requested above, never before it and never instead of it."
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
- }, q = {
112
+ }, G = {
113
113
  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.",
114
114
  responseRules: [
115
115
  "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.",
@@ -138,26 +138,26 @@ var K = {
138
138
  "richiesto sopra, mai prima e mai al posto suo."
139
139
  ].join(" "),
140
140
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
141
- }, J = K;
142
- function te(e) {
143
- J = {
144
- ...J,
141
+ }, K = W;
142
+ function re(e) {
143
+ K = {
144
+ ...K,
145
145
  ...e
146
146
  };
147
147
  }
148
- function Y() {
149
- return J;
148
+ function q() {
149
+ return K;
150
150
  }
151
- function ne() {
152
- J = K;
151
+ function ie() {
152
+ K = W;
153
153
  }
154
154
  //#endregion
155
155
  //#region src/domain/cli/renderManifestCli.ts
156
- function re(e, t) {
156
+ function J(e, t) {
157
157
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
158
158
  }
159
- function ie(e, t) {
160
- let n = G(t), r = re(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
159
+ function ae(e, t) {
160
+ let n = U(t), r = J(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
161
161
  return [
162
162
  `COMMAND: ${e} ${t.name}`,
163
163
  ` ${t.summary}`,
@@ -169,46 +169,46 @@ function ie(e, t) {
169
169
  ...i,
170
170
  "",
171
171
  " OUTPUT",
172
- ae(t.describeOutput(), 4),
172
+ oe(t.describeOutput(), 4),
173
173
  (t.example, ""),
174
174
  t.example ? " EXAMPLE" : "",
175
175
  t.example ? ` ${t.example}` : ""
176
176
  ].filter((e) => e !== "").join("\n");
177
177
  }
178
- function ae(e, t) {
178
+ function oe(e, t) {
179
179
  let n = " ".repeat(t);
180
180
  return e.split("\n").map((e) => e && n + e).join("\n");
181
181
  }
182
- function oe(e) {
182
+ function se(e) {
183
183
  return [
184
184
  "NAME",
185
185
  ` ${e.id} — ${e.label}`,
186
186
  "",
187
187
  "DESCRIPTION",
188
- ae(e.description, 2),
188
+ oe(e.description, 2),
189
189
  "",
190
- ...e.commands.map((t) => ie(e.id, t))
190
+ ...e.commands.map((t) => ae(e.id, t))
191
191
  ].join("\n");
192
192
  }
193
- function se(e) {
194
- return e.length === 0 ? Y().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
193
+ function ce(e) {
194
+ return e.length === 0 ? q().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
195
195
  }
196
196
  //#endregion
197
197
  //#region src/domain/microPrompts.ts
198
- var ce = {
198
+ var Y = {
199
199
  id: "closing-summary",
200
200
  get text() {
201
- return Y().closingSummary;
201
+ return q().closingSummary;
202
202
  }
203
- }, le = { [ce.id]: ce };
204
- function X(e, t) {
203
+ }, X = { [Y.id]: Y };
204
+ function le(e, t) {
205
205
  if (!t || t.length === 0) return e;
206
- let n = t.map((e) => le[e]?.text).filter((e) => !!e);
206
+ let n = t.map((e) => X[e]?.text).filter((e) => !!e);
207
207
  return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
208
208
  }
209
209
  //#endregion
210
210
  //#region src/domain/extractErrorMessage.ts
211
- function Z(e) {
211
+ function ue(e) {
212
212
  if (e instanceof Error) return e.message;
213
213
  if (typeof e == "object" && e) {
214
214
  let t = e;
@@ -227,13 +227,13 @@ function Z(e) {
227
227
  }
228
228
  //#endregion
229
229
  //#region src/domain/extractJsonBlock.ts
230
- function ue(e) {
230
+ function de(e) {
231
231
  let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
232
232
  if (t) return t[1].trim();
233
233
  let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
234
- return de(n) ?? n;
234
+ return fe(n) ?? n;
235
235
  }
236
- function de(e) {
236
+ function fe(e) {
237
237
  let t = e.search(/[{[]/);
238
238
  if (t === -1) return null;
239
239
  let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
@@ -254,8 +254,8 @@ function de(e) {
254
254
  }
255
255
  //#endregion
256
256
  //#region src/domain/jsonExportDestination.ts
257
- var fe = "json-export", pe = {
258
- id: fe,
257
+ var pe = "json-export", Z = {
258
+ id: pe,
259
259
  label: "Export as JSON",
260
260
  async apply(e) {
261
261
  let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
@@ -272,7 +272,7 @@ function he(e) {
272
272
  }
273
273
  function ge() {
274
274
  return {
275
- [pe.id]: pe,
275
+ [Z.id]: Z,
276
276
  ...me
277
277
  };
278
278
  }
@@ -315,20 +315,22 @@ function Ce(e, t, n) {
315
315
  return be().find((e) => Se(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
316
316
  }
317
317
  function we(e) {
318
- let t = Se(e.scopeId, e.subagentId, e.entityId), n = be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== t);
319
- n.push({
318
+ let t = Se(e.scopeId, e.subagentId, e.entityId), n = be(), r = n.find((e) => Se(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r);
319
+ a.push({
320
320
  ...e,
321
- savedAt: Date.now()
322
- }), xe(n);
321
+ savedAt: i,
322
+ startedAt: r ? Te(r) : i
323
+ }), xe(a);
323
324
  }
324
- function Te(e, t, n) {
325
+ var Te = (e) => e.startedAt ?? e.savedAt;
326
+ function Ee(e, t, n) {
325
327
  let r = Se(e, t, n);
326
328
  xe(be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== r));
327
329
  }
328
- function Ee(e) {
329
- return be().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
330
+ function De(e) {
331
+ return be().filter((t) => t.scopeId === e).sort((e, t) => Te(t) - Te(e));
330
332
  }
331
- var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
333
+ var Oe = (e, t) => `entitychat-${e}-${t}`, ke = {
332
334
  modelLabel: "Modell",
333
335
  modelsLoading: "Wird geladen…",
334
336
  noModelsAvailable: "Keine Modelle verfügbar",
@@ -367,6 +369,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
367
369
  stepsLabel: "Schritte des Agenten",
368
370
  newInstance: "Neue Instanz von \"{label}\"",
369
371
  chatHistory: "Chatverlauf",
372
+ chatStarted: "Begonnen am {at}",
373
+ chatLastMessage: "letzte Nachricht am {at}",
370
374
  newChat: "Neuer Chat",
371
375
  searchChats: "Chats durchsuchen…",
372
376
  messagePlaceholder: "Nachricht schreiben…",
@@ -384,7 +388,7 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
384
388
  resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
385
389
  pendingQuestions: "Fragen des Agenten",
386
390
  stop: "Stoppen"
387
- }, ke = {
391
+ }, Ae = {
388
392
  modelLabel: "Model",
389
393
  modelsLoading: "Loading…",
390
394
  noModelsAvailable: "No models available",
@@ -423,6 +427,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
423
427
  stepsLabel: "Steps of the agent",
424
428
  newInstance: "New \"{label}\" instance",
425
429
  chatHistory: "Chat history",
430
+ chatStarted: "Started {at}",
431
+ chatLastMessage: "last message {at}",
426
432
  newChat: "New chat",
427
433
  searchChats: "Search chats…",
428
434
  messagePlaceholder: "Write a message…",
@@ -440,7 +446,7 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
440
446
  resizePanelHint: "Drag to resize, double-click to reset",
441
447
  pendingQuestions: "Questions of the agent",
442
448
  stop: "Stop"
443
- }, Ae = {
449
+ }, je = {
444
450
  modelLabel: "Modello",
445
451
  modelsLoading: "Caricamento…",
446
452
  noModelsAvailable: "Nessun modello disponibile",
@@ -479,6 +485,8 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
479
485
  stepsLabel: "Passi dell'agente",
480
486
  newInstance: "Nuova istanza di \"{label}\"",
481
487
  chatHistory: "Storico chat",
488
+ chatStarted: "Iniziata il {at}",
489
+ chatLastMessage: "ultimo messaggio il {at}",
482
490
  newChat: "Nuova chat",
483
491
  searchChats: "Cerca nelle chat…",
484
492
  messagePlaceholder: "Scrivi un messaggio…",
@@ -496,22 +504,22 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
496
504
  resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
497
505
  pendingQuestions: "Domande dell'agente",
498
506
  stop: "Ferma"
499
- }, je = {
500
- en: { agentico: ke },
501
- it: { agentico: Ae },
502
- de: { agentico: Oe }
507
+ }, Me = {
508
+ en: { agentico: Ae },
509
+ it: { agentico: je },
510
+ de: { agentico: ke }
503
511
  };
504
512
  function Q() {
505
513
  let { dict: e } = v(), t = e.agentico;
506
514
  return t ? {
507
- ...ke,
515
+ ...Ae,
508
516
  ...t
509
- } : ke;
517
+ } : Ae;
510
518
  }
511
519
  //#endregion
512
520
  //#region src/presentation/AgenticoContext.tsx
513
- var Me = "agentico-orchestrator", Ne = b(null);
514
- function Pe({ children: e, scope: t = null }) {
521
+ var Ne = "agentico-orchestrator", Pe = b(null);
522
+ function Fe({ children: e, scope: t = null }) {
515
523
  let [n, r] = D(null), i = E(null);
516
524
  C(() => {
517
525
  i.current = n;
@@ -526,7 +534,7 @@ function Pe({ children: e, scope: t = null }) {
526
534
  r(n);
527
535
  }, []), c = x((e) => {
528
536
  r((t) => t && t.id === e ? null : t);
529
- }, []), l = x(() => o((e) => !e), []), u = x(() => o(!0), []), [d, f] = D(null), [p, m] = D(void 0), [h, g] = D(void 0), [_, v] = D(void 0), [y, b] = D(null), [S, w] = D(null), [O, A] = D(void 0), [j, M] = D([]), N = x((e, t, n = null) => {
537
+ }, []), l = x(() => o((e) => !e), []), u = x(() => o(!0), []), [d, f] = D(null), [p, m] = D(void 0), [h, g] = D(void 0), [_, v] = D(void 0), [y, b] = D(null), [S, w] = D(null), [O, A] = D(void 0), [j, M] = D([]), ee = x((e, t, n = null) => {
530
538
  M((r) => {
531
539
  let i = r.filter((t) => t.id !== e);
532
540
  return t ? [...i, {
@@ -535,30 +543,30 @@ function Pe({ children: e, scope: t = null }) {
535
543
  card: n
536
544
  }] : i;
537
545
  });
538
- }, []), P = j.length > 0 ? j[j.length - 1] : null, [F, I] = D([]), L = x((e, t) => {
539
- I((n) => {
546
+ }, []), N = j.length > 0 ? j[j.length - 1] : null, [P, te] = D([]), F = x((e, t) => {
547
+ te((n) => {
540
548
  let r = n.filter((t) => t.id !== e);
541
549
  return t ? [...r, {
542
550
  id: e,
543
551
  ...t
544
552
  }] : r;
545
553
  });
546
- }, []), R = T(() => F.map((e) => ({
554
+ }, []), I = T(() => P.map((e) => ({
547
555
  subagentId: e.subagentId,
548
556
  componentKey: e.componentKey,
549
557
  onResult: e.onResult,
550
558
  pinnedEntityId: e.pinnedEntityId
551
- })), [F]), z = T(() => {
559
+ })), [P]), L = T(() => {
552
560
  let e = /* @__PURE__ */ new Map();
553
- for (let t of F) e.set(t.subagentId, {
561
+ for (let t of P) e.set(t.subagentId, {
554
562
  subagentId: t.subagentId,
555
563
  componentKey: t.componentKey,
556
564
  onResult: t.onResult,
557
565
  contextInfo: t.contextInfo
558
566
  });
559
567
  return [...e.values()];
560
- }, [F]), V = T(() => z.map((e) => {
561
- let t = B(e.subagentId)?.componentContexts?.[e.componentKey];
568
+ }, [P]), z = T(() => L.map((e) => {
569
+ let t = R(e.subagentId)?.componentContexts?.[e.componentKey];
562
570
  if (!t) return null;
563
571
  let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
564
572
  return {
@@ -566,21 +574,21 @@ function Pe({ children: e, scope: t = null }) {
566
574
  agenticoHint: n,
567
575
  userMessage: t.userMessage
568
576
  };
569
- }).filter((e) => e !== null), [z]), ee = T(() => V.map((e) => e.userMessage), [V]), H = T(() => {
570
- if (V.length === 0) return null;
571
- if (V.length === 1) return V[0].agenticoHint;
572
- let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
573
- return `${Y().multipleCandidates}\n\n${e}`;
574
- }, [V]) ?? P?.text ?? null, U = V.length > 0 ? null : P?.card ?? null, W = T(() => [...new Set(R.map((e) => e.subagentId))], [R]), G = W.length === 1 ? W[0] : W.length === 0 ? P?.card?.subagentId ?? null : null, K = x((e, t) => {
577
+ }).filter((e) => e !== null), [L]), ne = T(() => z.map((e) => e.userMessage), [z]), B = T(() => {
578
+ if (z.length === 0) return null;
579
+ if (z.length === 1) return z[0].agenticoHint;
580
+ let e = z.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
581
+ return `${q().multipleCandidates}\n\n${e}`;
582
+ }, [z]) ?? N?.text ?? null, V = z.length > 0 ? null : N?.card ?? null, H = T(() => [...new Set(I.map((e) => e.subagentId))], [I]), U = H.length === 1 ? H[0] : H.length === 0 ? N?.card?.subagentId ?? null : null, W = x((e, t) => {
575
583
  u();
576
584
  let n = i.current;
577
585
  if (n?.id === "agentico-orchestrator") return;
578
- let r = G && n?.id.startsWith(`subagent-${G}-`) ? n : void 0;
586
+ let r = U && n?.id.startsWith(`subagent-${U}-`) ? n : void 0;
579
587
  w(r ? {
580
588
  taskId: r.id,
581
589
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
582
590
  } : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), A(t?.scopedSubagentId), b(crypto.randomUUID());
583
- }, [u, G]), q = x((e, t, n, a, o, s) => {
591
+ }, [u, U]), G = x((e, t, n, a, o, s) => {
584
592
  if (!n || !a) return;
585
593
  let c = i.current;
586
594
  if (!c || c.id !== n) return;
@@ -597,24 +605,24 @@ function Pe({ children: e, scope: t = null }) {
597
605
  ...e,
598
606
  savedToDisk: !0
599
607
  } : e));
600
- }, []), [J, te] = D(null), [ne, re] = D(null), ie = x((e, t, n) => {
601
- u(), te({
608
+ }, []), [K, re] = D(null), [ie, J] = D(null), ae = x((e, t, n) => {
609
+ u(), re({
602
610
  subagentId: e,
603
611
  entityId: t,
604
612
  snapshot: n
605
- }), re(crypto.randomUUID());
606
- }, [u]), [ae, oe] = D(null), [se, ce] = D(null), le = x((e, t) => {
607
- u(), c(Me), oe({
613
+ }), J(crypto.randomUUID());
614
+ }, [u]), [oe, se] = D(null), [ce, Y] = D(null), X = x((e, t) => {
615
+ u(), c(Ne), se({
608
616
  subagentId: e,
609
617
  extraDestinations: t
610
- }), ce(crypto.randomUUID());
611
- }, [u, c]), [X, Z] = D(null), [ue, de] = D(null), fe = x((e, t, n) => {
612
- oe(null), Z({
618
+ }), Y(crypto.randomUUID());
619
+ }, [u, c]), [le, ue] = D(null), [de, fe] = D(null), pe = x((e, t, n) => {
620
+ se(null), ue({
613
621
  subagentId: e,
614
622
  params: t,
615
623
  extraDestinations: n
616
- }), de(crypto.randomUUID());
617
- }, []), [pe, me] = D(null), [he, ge] = D(null), _e = x((e, t, n) => {
624
+ }), fe(crypto.randomUUID());
625
+ }, []), [Z, me] = D(null), [he, ge] = D(null), _e = x((e, t, n) => {
618
626
  u(), me({
619
627
  subagentId: e,
620
628
  params: t,
@@ -631,34 +639,34 @@ function Pe({ children: e, scope: t = null }) {
631
639
  closeTask: c,
632
640
  toggleOpen: l,
633
641
  pendingGoal: d,
634
- startOrchestrator: K,
635
- pageContext: H,
636
- pageContextCard: U,
637
- setPageContext: N,
638
- scopedSubagentId: G,
642
+ startOrchestrator: W,
643
+ pageContext: B,
644
+ pageContextCard: V,
645
+ setPageContext: ee,
646
+ scopedSubagentId: U,
639
647
  pendingScopedSubagentId: O,
640
- componentAnchors: R,
641
- anchoredUserMessages: ee,
642
- registerComponentAnchor: L,
648
+ componentAnchors: I,
649
+ anchoredUserMessages: ne,
650
+ registerComponentAnchor: F,
643
651
  openPanel: u,
644
652
  pendingExtraDestinations: p,
645
653
  pendingAttachments: h,
646
654
  pendingModel: _,
647
655
  orchestratorRunId: y,
648
656
  pendingCarryOver: S,
649
- commitEntityChat: q,
650
- resumeEntityChat: ie,
651
- pendingResume: J,
652
- resumeRunId: ne,
657
+ commitEntityChat: G,
658
+ resumeEntityChat: ae,
659
+ pendingResume: K,
660
+ resumeRunId: ie,
653
661
  dismissForeignTask: ve,
654
- pendingManualEntry: ae,
655
- manualEntryRunId: se,
656
- startManualEntry: le,
657
- pendingResumeWithAI: X,
658
- resumeWithAIRunId: ue,
659
- resumeWithAI: fe,
662
+ pendingManualEntry: oe,
663
+ manualEntryRunId: ce,
664
+ startManualEntry: X,
665
+ pendingResumeWithAI: le,
666
+ resumeWithAIRunId: de,
667
+ resumeWithAI: pe,
660
668
  startSubagent: _e,
661
- pendingStart: pe,
669
+ pendingStart: Z,
662
670
  startRunId: he
663
671
  }), [
664
672
  t,
@@ -668,49 +676,49 @@ function Pe({ children: e, scope: t = null }) {
668
676
  c,
669
677
  l,
670
678
  d,
671
- K,
672
- H,
679
+ W,
680
+ B,
681
+ V,
682
+ ee,
673
683
  U,
674
- N,
675
- G,
676
684
  O,
677
- R,
678
- ee,
679
- L,
685
+ I,
686
+ ne,
687
+ F,
680
688
  u,
681
689
  p,
682
690
  h,
683
691
  _,
684
692
  y,
685
693
  S,
686
- q,
694
+ G,
695
+ ae,
696
+ K,
687
697
  ie,
688
- J,
689
- ne,
690
698
  ve,
691
- ae,
692
- se,
693
- le,
699
+ oe,
700
+ ce,
694
701
  X,
695
- ue,
696
- fe,
697
- _e,
702
+ le,
703
+ de,
698
704
  pe,
705
+ _e,
706
+ Z,
699
707
  he
700
708
  ]);
701
- return /* @__PURE__ */ k(Ne.Provider, {
709
+ return /* @__PURE__ */ k(Pe.Provider, {
702
710
  value: ye,
703
711
  children: e
704
712
  });
705
713
  }
706
714
  function $() {
707
- let e = S(Ne);
715
+ let e = S(Pe);
708
716
  if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
709
717
  return e;
710
718
  }
711
719
  //#endregion
712
720
  //#region src/presentation/AgentActivityLog.tsx
713
- function Fe(e) {
721
+ function Ie(e) {
714
722
  let t = e.search(/[{[]/);
715
723
  if (t === -1) return [{
716
724
  type: "text",
@@ -756,18 +764,18 @@ function Fe(e) {
756
764
  language: "json"
757
765
  });
758
766
  let u = e.slice(s + 1);
759
- return u.trim() && l.push(...Fe(u)), l;
767
+ return u.trim() && l.push(...Ie(u)), l;
760
768
  }
761
- function Ie(e) {
769
+ function Le(e) {
762
770
  let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
763
- for (; i = n.exec(e);) i.index > r && t.push(...Fe(e.slice(r, i.index))), t.push({
771
+ for (; i = n.exec(e);) i.index > r && t.push(...Ie(e.slice(r, i.index))), t.push({
764
772
  type: "code",
765
773
  content: i[2].replace(/\n$/, ""),
766
774
  language: i[1]
767
775
  }), r = n.lastIndex;
768
- return r < e.length && t.push(...Fe(e.slice(r))), t;
776
+ return r < e.length && t.push(...Ie(e.slice(r))), t;
769
777
  }
770
- function Le({ content: e, language: t }) {
778
+ function Re({ content: e, language: t }) {
771
779
  let [n, r] = D(!1);
772
780
  return /* @__PURE__ */ A("div", {
773
781
  className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -782,9 +790,9 @@ function Le({ content: e, language: t }) {
782
790
  }), !n && /* @__PURE__ */ k("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
783
791
  });
784
792
  }
785
- function Re({ text: e, tone: t }) {
786
- let n = Ie(e);
787
- return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(Le, {
793
+ function ze({ text: e, tone: t }) {
794
+ let n = Le(e);
795
+ return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(Re, {
788
796
  content: e.content,
789
797
  language: e.language
790
798
  }, n) : e.content.trim() && /* @__PURE__ */ k(r, {
@@ -793,7 +801,7 @@ function Re({ text: e, tone: t }) {
793
801
  className: "break-words text-xs leading-relaxed"
794
802
  }, n)) });
795
803
  }
796
- function ze({ status: e }) {
804
+ function Be({ status: e }) {
797
805
  return e === "running" ? /* @__PURE__ */ k("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ k(u, {
798
806
  name: "check",
799
807
  size: 12,
@@ -808,11 +816,11 @@ function ze({ status: e }) {
808
816
  className: "shrink-0 text-destructive"
809
817
  });
810
818
  }
811
- function Be(e, t) {
819
+ function Ve(e, t) {
812
820
  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;
813
821
  }
814
- var Ve = 96;
815
- function He({ entry: e, pinned: t = !0 }) {
822
+ var He = 96;
823
+ function Ue({ entry: e, pinned: t = !0 }) {
816
824
  let n = E(null), [r, i] = D(!1), [a, o] = D(!1);
817
825
  w(() => {
818
826
  let e = n.current;
@@ -826,7 +834,7 @@ function He({ entry: e, pinned: t = !0 }) {
826
834
  children: [/* @__PURE__ */ A("div", {
827
835
  ref: n,
828
836
  className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
829
- style: s ? { maxHeight: Ve } : void 0,
837
+ style: s ? { maxHeight: He } : void 0,
830
838
  children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ k("div", {
831
839
  className: "flex flex-wrap gap-1",
832
840
  children: e.attachmentNames.map((e, t) => /* @__PURE__ */ A("span", {
@@ -840,7 +848,7 @@ function He({ entry: e, pinned: t = !0 }) {
840
848
  children: e
841
849
  })]
842
850
  }, t))
843
- }), /* @__PURE__ */ k(Re, { text: e.detail ?? "" })]
851
+ }), /* @__PURE__ */ k(ze, { text: e.detail ?? "" })]
844
852
  }), a && /* @__PURE__ */ A("button", {
845
853
  type: "button",
846
854
  onClick: () => i((e) => !e),
@@ -854,13 +862,13 @@ function He({ entry: e, pinned: t = !0 }) {
854
862
  })
855
863
  });
856
864
  }
857
- var Ue = {
865
+ var We = {
858
866
  running: "loader-circle",
859
867
  done: "check",
860
868
  error: "x",
861
869
  stopped: "circle-slash"
862
870
  };
863
- function We({ steps: e }) {
871
+ function Ge({ steps: e }) {
864
872
  let t = Q(), n = e.filter((e) => e.status === "running").at(-1), r = e.some((e) => e.status === "error"), i = n?.label ?? (e.length === 1 ? t.oneStep : m(t.steps, { count: e.length }));
865
873
  return /* @__PURE__ */ k(f, {
866
874
  ariaLabel: t.stepsLabel,
@@ -876,12 +884,12 @@ function We({ steps: e }) {
876
884
  className: e.status === "error" ? "text-destructive" : void 0,
877
885
  children: e.label
878
886
  }),
879
- icon: Ue[e.status]
887
+ icon: We[e.status]
880
888
  }))
881
889
  }]
882
890
  });
883
891
  }
884
- function Ge(e, t) {
892
+ function Ke(e, t) {
885
893
  let n = e.at(-1);
886
894
  if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
887
895
  let r = [...n.parts].reverse().find((e) => e.type === "questions");
@@ -890,7 +898,7 @@ function Ge(e, t) {
890
898
  part: r
891
899
  };
892
900
  }
893
- function Ke({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
901
+ function qe({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
894
902
  let o = !!n?.canAnswer(e.id);
895
903
  return /* @__PURE__ */ k(i, {
896
904
  questions: t.questions,
@@ -901,7 +909,7 @@ function Ke({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
901
909
  className: a ?? "text-xs"
902
910
  });
903
911
  }
904
- function qe({ entry: e, questions: t, hiddenPartId: n }) {
912
+ function Je({ entry: e, questions: t, hiddenPartId: n }) {
905
913
  let i = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), o = [];
906
914
  for (let e of i) {
907
915
  let t = o.at(-1);
@@ -916,7 +924,7 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
916
924
  return /* @__PURE__ */ k("div", {
917
925
  className: "space-y-2",
918
926
  children: o.map((n) => {
919
- if ("steps" in n) return /* @__PURE__ */ k(We, { steps: n.steps }, n.key);
927
+ if ("steps" in n) return /* @__PURE__ */ k(Ge, { steps: n.steps }, n.key);
920
928
  let { part: i } = n;
921
929
  return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ k(r, {
922
930
  content: i.text,
@@ -927,7 +935,7 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
927
935
  streaming: i.streaming,
928
936
  duration: i.duration,
929
937
  className: "my-0"
930
- }, n.key) : /* @__PURE__ */ k(Ke, {
938
+ }, n.key) : /* @__PURE__ */ k(qe, {
931
939
  entry: e,
932
940
  part: i,
933
941
  questions: t
@@ -935,13 +943,13 @@ function qe({ entry: e, questions: t, hiddenPartId: n }) {
935
943
  })
936
944
  });
937
945
  }
938
- function Je({ entry: e, questions: t, hiddenPartId: n }) {
946
+ function Ye({ entry: e, questions: t, hiddenPartId: n }) {
939
947
  let i = Q();
940
948
  if (e.kind === "thinking" && e.parts) {
941
949
  let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
942
950
  return /* @__PURE__ */ A("li", {
943
951
  className: "text-xs text-muted-foreground",
944
- children: [e.parts.length > 0 && /* @__PURE__ */ k(qe, {
952
+ children: [e.parts.length > 0 && /* @__PURE__ */ k(Je, {
945
953
  entry: e,
946
954
  questions: t,
947
955
  hiddenPartId: n
@@ -949,15 +957,15 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
949
957
  className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
950
958
  children: [/* @__PURE__ */ k("span", {
951
959
  className: "pt-px",
952
- children: /* @__PURE__ */ k(ze, { status: e.status })
960
+ children: /* @__PURE__ */ k(Be, { status: e.status })
953
961
  }), /* @__PURE__ */ k("span", {
954
962
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
955
- children: Be(e, i)
963
+ children: Ve(e, i)
956
964
  })]
957
965
  })]
958
966
  });
959
967
  }
960
- let a = e.kind === "thinking" && e.detail ? Ie(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? Be(e, i) : e.label;
968
+ let a = e.kind === "thinking" && e.detail ? Le(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? Ve(e, i) : e.label;
961
969
  return /* @__PURE__ */ A("li", {
962
970
  className: "text-xs text-muted-foreground",
963
971
  children: [
@@ -965,7 +973,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
965
973
  className: "flex items-start gap-1.5",
966
974
  children: [/* @__PURE__ */ k("span", {
967
975
  className: "pt-px",
968
- children: /* @__PURE__ */ k(ze, { status: e.status })
976
+ children: /* @__PURE__ */ k(Be, { status: e.status })
969
977
  }), /* @__PURE__ */ k("span", {
970
978
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
971
979
  children: c
@@ -973,7 +981,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
973
981
  }),
974
982
  o.length > 0 && /* @__PURE__ */ k("div", {
975
983
  className: "mt-1 ml-[18px] space-y-1",
976
- children: o.map((e, t) => /* @__PURE__ */ k(Le, {
984
+ children: o.map((e, t) => /* @__PURE__ */ k(Re, {
977
985
  content: e.content,
978
986
  language: e.language
979
987
  }, t))
@@ -989,7 +997,7 @@ function Je({ entry: e, questions: t, hiddenPartId: n }) {
989
997
  ]
990
998
  });
991
999
  }
992
- function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1000
+ function Xe({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
993
1001
  if (e.length === 0) return null;
994
1002
  let i = [];
995
1003
  for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
@@ -998,12 +1006,12 @@ function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
998
1006
  } : { entries: [t] }) : i[i.length - 1].entries.push(t);
999
1007
  return /* @__PURE__ */ k("ul", {
1000
1008
  className: "space-y-0.5",
1001
- children: i.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(He, {
1009
+ children: i.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(Ue, {
1002
1010
  entry: e.user,
1003
1011
  pinned: r
1004
1012
  }), e.entries.length > 0 && /* @__PURE__ */ k("ul", {
1005
1013
  className: "space-y-0.5",
1006
- children: e.entries.map((e) => /* @__PURE__ */ k(Je, {
1014
+ children: e.entries.map((e) => /* @__PURE__ */ k(Ye, {
1007
1015
  entry: e,
1008
1016
  questions: t,
1009
1017
  hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
@@ -1013,55 +1021,55 @@ function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
1013
1021
  }
1014
1022
  //#endregion
1015
1023
  //#region src/presentation/panelWidth.ts
1016
- var Xe = 420, Ze = 320, Qe = "60vw", $e = "agentico:panel-width";
1017
- function et(e, t) {
1024
+ var Ze = 420, Qe = 320, $e = "60vw", et = "agentico:panel-width";
1025
+ function tt(e, t) {
1018
1026
  if (typeof e == "number") return e;
1019
1027
  let n = Number.parseFloat(e);
1020
1028
  return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1021
1029
  }
1022
- function tt(e, t, n) {
1030
+ function nt(e, t, n) {
1023
1031
  return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1024
1032
  }
1025
- function nt() {
1033
+ function rt() {
1026
1034
  try {
1027
- let e = window.localStorage.getItem($e), t = e === null ? NaN : Number(e);
1035
+ let e = window.localStorage.getItem(et), t = e === null ? NaN : Number(e);
1028
1036
  return Number.isFinite(t) && t > 0 ? t : null;
1029
1037
  } catch {
1030
1038
  return null;
1031
1039
  }
1032
1040
  }
1033
- function rt(e) {
1041
+ function it(e) {
1034
1042
  try {
1035
- e === null ? window.localStorage.removeItem($e) : window.localStorage.setItem($e, String(e));
1043
+ e === null ? window.localStorage.removeItem(et) : window.localStorage.setItem(et, String(e));
1036
1044
  } catch {}
1037
1045
  }
1038
- function it() {
1046
+ function at() {
1039
1047
  return typeof window > "u" ? Infinity : window.innerWidth;
1040
1048
  }
1041
- function at({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = Qe, onWidthChange: r }) {
1042
- let [i, a] = D(it), [o, s] = D(() => nt() ?? e);
1049
+ function ot({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = $e, onWidthChange: r }) {
1050
+ let [i, a] = D(at), [o, s] = D(() => rt() ?? e);
1043
1051
  C(() => {
1044
1052
  if (typeof window > "u") return;
1045
1053
  let e = () => a(window.innerWidth);
1046
1054
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1047
1055
  }, []);
1048
- let c = t, l = Math.max(c, et(n, i)), u = tt(o, c, l);
1056
+ let c = t, l = Math.max(c, tt(n, i)), u = nt(o, c, l);
1049
1057
  return C(() => {
1050
1058
  r?.(u);
1051
1059
  }, [u]), {
1052
1060
  width: u,
1053
1061
  min: c,
1054
1062
  max: l,
1055
- set: x((e) => s(tt(e, c, l)), [c, l]),
1056
- commit: x((e) => rt(tt(e, c, l)), [c, l]),
1063
+ set: x((e) => s(nt(e, c, l)), [c, l]),
1064
+ commit: x((e) => it(nt(e, c, l)), [c, l]),
1057
1065
  reset: x(() => {
1058
- s(e), rt(null);
1066
+ s(e), it(null);
1059
1067
  }, [e])
1060
1068
  };
1061
1069
  }
1062
1070
  //#endregion
1063
1071
  //#region src/presentation/AgenticoResizeHandle.tsx
1064
- function ot({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1072
+ function st({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1065
1073
  let o = Q(), s = E(null), [c, l] = D(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
1066
1074
  let t = s.current;
1067
1075
  if (t && t.pointerId === e.pointerId) {
@@ -1119,7 +1127,7 @@ function ot({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
1119
1127
  }
1120
1128
  //#endregion
1121
1129
  //#region src/presentation/AgenticoToggle.tsx
1122
- function st({ className: e = "" }) {
1130
+ function ct({ className: e = "" }) {
1123
1131
  let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
1124
1132
  return /* @__PURE__ */ k(t, {
1125
1133
  icon: "bot",
@@ -1132,21 +1140,21 @@ function st({ className: e = "" }) {
1132
1140
  }
1133
1141
  //#endregion
1134
1142
  //#region src/presentation/useAIModelCatalog.ts
1135
- var ct = "llmnative-cms.selectedAIModel";
1136
- function lt() {
1143
+ var lt = "llmnative-cms.selectedAIModel";
1144
+ function ut() {
1137
1145
  try {
1138
- return localStorage.getItem(ct) ?? "";
1146
+ return localStorage.getItem(lt) ?? "";
1139
1147
  } catch {
1140
1148
  return "";
1141
1149
  }
1142
1150
  }
1143
- function ut(e) {
1151
+ function dt(e) {
1144
1152
  try {
1145
- e ? localStorage.setItem(ct, e) : localStorage.removeItem(ct);
1153
+ e ? localStorage.setItem(lt, e) : localStorage.removeItem(lt);
1146
1154
  } catch {}
1147
1155
  }
1148
- function dt() {
1149
- let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(lt);
1156
+ function ft() {
1157
+ let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(ut);
1150
1158
  return C(() => {
1151
1159
  if (!t) {
1152
1160
  r({});
@@ -1157,7 +1165,7 @@ function dt() {
1157
1165
  if (n) return;
1158
1166
  r(e.modelsByProvider);
1159
1167
  let t = Object.values(e.modelsByProvider).flat();
1160
- s((e) => t.some((t) => t.id === e) ? e : (ut(""), ""));
1168
+ s((e) => t.some((t) => t.id === e) ? e : (dt(""), ""));
1161
1169
  }).catch((e) => {
1162
1170
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
1163
1171
  }).finally(() => {
@@ -1171,17 +1179,17 @@ function dt() {
1171
1179
  modelsLoading: i,
1172
1180
  selectedModel: o,
1173
1181
  setSelectedModel: (e) => {
1174
- ut(e), s(e);
1182
+ dt(e), s(e);
1175
1183
  }
1176
1184
  };
1177
1185
  }
1178
1186
  //#endregion
1179
1187
  //#region src/domain/approval.ts
1180
- var ft = "approval";
1181
- function pt(e, t) {
1188
+ var pt = "approval";
1189
+ function mt(e, t) {
1182
1190
  return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1183
1191
  }
1184
- function mt(e, t, n) {
1192
+ function ht(e, t, n) {
1185
1193
  let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1186
1194
  return {
1187
1195
  approved: r.includes(t) && !r.includes(n),
@@ -1190,34 +1198,44 @@ function mt(e, t, n) {
1190
1198
  }
1191
1199
  //#endregion
1192
1200
  //#region src/presentation/useAgent.ts
1193
- var ht = 20, gt = 26e4;
1194
- function _t(e) {
1195
- return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= gt);
1201
+ var gt = 20, _t = 26e4;
1202
+ function vt(e) {
1203
+ return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= _t);
1196
1204
  }
1197
- function vt(e, t = {}) {
1198
- let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = dt(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
1205
+ function yt(e, t = {}) {
1206
+ let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = ft(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
1199
1207
  b((t) => {
1200
1208
  let n = typeof e == "function" ? e(t) : e;
1201
1209
  return x.current = n, n;
1202
1210
  });
1203
- }, C = E(/* @__PURE__ */ new Map()), w = Q(), T = E(w);
1204
- T.current = w;
1205
- let O = E(null), k = E(!1), A = E(null), M = () => {
1206
- A.current?.abort();
1207
- }, I = _()?.registry ?? {}, L = r && c ? h(c) : null, R = L ? I[L.provider] : null, z = e.executor, B = !!z, [V, ee] = D([]), [H, W] = D(""), G = E(""), K = (e) => {
1208
- G.current = e, W(e);
1209
- }, q = (e) => {
1210
- ee(z?.models?.(e) ?? []), K(z?.defaultModel?.(e) ?? "");
1211
- }, J = async (e, t, n, r) => {
1212
- let i = O.current;
1213
- if (!i || !z) return m(T.current.noActiveSession), null;
1211
+ }, C = E(/* @__PURE__ */ new Map()), w = Q(), O = E(w);
1212
+ O.current = w;
1213
+ let k = E(null), A = E(!1), M = E(null), te = () => {
1214
+ M.current?.abort();
1215
+ }, F = _()?.registry ?? {}, [I, L] = D(void 0), R = E(void 0), z = (e, t) => {
1216
+ if (!t) return !1;
1217
+ if (!e) return !0;
1218
+ let n = h(t);
1219
+ return !!n && e.includes(n.provider);
1220
+ }, ne = T(() => I ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => I.includes(e.provider))]).filter(([, e]) => e.length)) : o, [I, o]), B = z(I, c) ? c : Object.values(ne).flat()[0]?.id ?? "", H = r && B ? h(B) : null, U = H ? F[H.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, re = E([]), ie = (e) => !!e && re.current.some((t) => t.value === e), J = E(!1), [ae, oe] = D([]), [se, ce] = D(""), Y = E(""), X = (e) => {
1221
+ Y.current = e, ce(e);
1222
+ }, de = (e) => {
1223
+ let t = W?.models?.(e) ?? [];
1224
+ re.current = t, oe(t);
1225
+ let n = W?.catalogProviders?.(e);
1226
+ R.current = n, L(n);
1227
+ let r = G && !z(n, c) ? t[0]?.value : void 0;
1228
+ X(W?.defaultModel?.(e) ?? r ?? "");
1229
+ }, fe = async (e, t, n, r) => {
1230
+ let i = k.current;
1231
+ if (!i || !W) return m(O.current.noActiveSession), null;
1214
1232
  let a = new AbortController();
1215
- A.current = a;
1233
+ M.current = a;
1216
1234
  let o = crypto.randomUUID();
1217
1235
  S((e) => [...e, {
1218
1236
  id: o,
1219
1237
  kind: "thinking",
1220
- label: T.current.thinking,
1238
+ label: O.current.thinking,
1221
1239
  status: "running",
1222
1240
  parts: []
1223
1241
  }]);
@@ -1227,14 +1245,14 @@ function vt(e, t = {}) {
1227
1245
  duration: e.duration ?? c(e.id)
1228
1246
  }), u = (e, t) => S((n) => n.map((n) => {
1229
1247
  if (n.id !== o) return n;
1230
- let r = e(n.parts ?? []), i = P(r);
1248
+ let r = e(n.parts ?? []), i = N(r);
1231
1249
  return {
1232
1250
  ...n,
1233
1251
  parts: r,
1234
1252
  ...t ? { status: t } : {},
1235
1253
  ...i ? { detail: i } : {}
1236
1254
  };
1237
- })), d = (e) => u((t) => N(t, e, l)), f = !1, p = (e, t) => {
1255
+ })), d = (e) => u((t) => ee(t, e, l)), f = !1, p = (e, t) => {
1238
1256
  t?.id && t.id !== "text" && (f = !0), d({
1239
1257
  type: "text",
1240
1258
  id: t?.id ?? "text",
@@ -1279,7 +1297,7 @@ function vt(e, t = {}) {
1279
1297
  });
1280
1298
  }));
1281
1299
  }, x = (e, t) => {
1282
- u((n) => (t && !f ? N(n, {
1300
+ u((n) => (t && !f ? ee(n, {
1283
1301
  type: "text",
1284
1302
  id: j,
1285
1303
  text: t,
@@ -1295,13 +1313,13 @@ function vt(e, t = {}) {
1295
1313
  _.clear();
1296
1314
  }, w = e || r?.historyText || "";
1297
1315
  try {
1298
- let o = await z.turn({
1316
+ let o = await W.turn({
1299
1317
  params: i.params,
1300
1318
  context: i.context,
1301
1319
  text: e,
1302
1320
  first: t,
1303
1321
  signal: a.signal,
1304
- ...n || G.current ? { model: n || G.current } : {},
1322
+ ...n || Y.current ? { model: n || Y.current } : {},
1305
1323
  ...r ? { answers: {
1306
1324
  id: r.id,
1307
1325
  answers: r.answers
@@ -1326,13 +1344,13 @@ function vt(e, t = {}) {
1326
1344
  return i.history = [...i.history, ...w ? [{
1327
1345
  role: "user",
1328
1346
  content: w
1329
- }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(Z(e)), null);
1347
+ }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(ue(e)), null);
1330
1348
  } finally {
1331
- A.current = null;
1349
+ M.current = null;
1332
1350
  }
1333
- }, te = async (e, t, n) => {
1351
+ }, pe = async (e, t, n) => {
1334
1352
  let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1335
- if (!r || r.type !== "questions") throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
1353
+ if (!r || r.type !== "questions") throw m(O.current.noActiveSession), Error(O.current.noActiveSession);
1336
1354
  let i = () => S((r) => r.map((r) => r.id === e ? {
1337
1355
  ...r,
1338
1356
  parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
@@ -1341,30 +1359,30 @@ function vt(e, t = {}) {
1341
1359
  } : e)
1342
1360
  } : r)), a = `${e}:${t}`, o = C.current.get(a);
1343
1361
  if (o) return C.current.delete(a), i(), o.resolve(n), null;
1344
- if (k.current) throw m(T.current.requestInProgress), Error(T.current.requestInProgress);
1345
- if (!B || !O.current) throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
1346
- k.current = !0, f(!0), m(null), i();
1362
+ if (A.current) throw m(O.current.requestInProgress), Error(O.current.requestInProgress);
1363
+ if (!K || !k.current) throw m(O.current.noActiveSession), Error(O.current.noActiveSession);
1364
+ A.current = !0, f(!0), m(null), i();
1347
1365
  try {
1348
- return await J("", !1, void 0, {
1366
+ return await fe("", !1, void 0, {
1349
1367
  id: t,
1350
1368
  answers: n,
1351
- historyText: F(r.questions, n)
1369
+ historyText: P(r.questions, n)
1352
1370
  });
1353
1371
  } finally {
1354
- k.current = !1, f(!1);
1372
+ A.current = !1, f(!1);
1355
1373
  }
1356
- }, ne = async (t, n, r) => {
1357
- let i = O.current;
1358
- if (!i) return m(T.current.noActiveSession), null;
1359
- let a = r ? h(r) : L, o = a ? I[a.provider] : null;
1360
- if (!o || !a) return m(T.current.noProviderAvailable), null;
1361
- n?.length && (i.attachmentsRef.current = [...i.attachmentsRef.current ?? [], ...n]);
1362
- let s = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= gt ? `\n\n[File allegato: ${e.name}]\n${d.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(""), c = _t(n ?? []), l = i.tools.map((e) => ({
1374
+ }, Z = async (t, n, r) => {
1375
+ let i = R.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && z(i, r) ? r : z(i, B) ? void 0 : a, c = k.current;
1376
+ if (!c) return m(O.current.noActiveSession), null;
1377
+ let l = s ? h(s) : H, u = l ? F[l.provider] : null;
1378
+ if (!u || !l) return m(O.current.noProviderAvailable), null;
1379
+ n?.length && (c.attachmentsRef.current = [...c.attachmentsRef.current ?? [], ...n]);
1380
+ let f = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= _t ? `\n\n[File allegato: ${e.name}]\n${d.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(""), p = vt(n ?? []), g = c.tools.map((e) => ({
1363
1381
  name: e.name,
1364
1382
  description: e.description,
1365
- inputSchema: U(e.inputSchema)
1366
- })), u = (e, t, n, r) => {
1367
- let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1383
+ inputSchema: V(e.inputSchema)
1384
+ })), _ = (e, t, n, r) => {
1385
+ let i = O.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1368
1386
  S((e) => [...e, {
1369
1387
  id: a,
1370
1388
  kind: "thinking",
@@ -1372,7 +1390,7 @@ function vt(e, t = {}) {
1372
1390
  status: "running",
1373
1391
  parts: [{
1374
1392
  type: "questions",
1375
- id: ft,
1393
+ id: pt,
1376
1394
  questions: [{
1377
1395
  header: i.approvalHeader,
1378
1396
  question: i.approveQuestion.replace("{action}", o),
@@ -1381,10 +1399,10 @@ function vt(e, t = {}) {
1381
1399
  }]
1382
1400
  }]
1383
1401
  }]);
1384
- let s = `${a}:${ft}`;
1402
+ let s = `${a}:${pt}`;
1385
1403
  return new Promise((e, t) => {
1386
1404
  let n = () => {
1387
- C.current.delete(s), g(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1405
+ C.current.delete(s), b(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1388
1406
  };
1389
1407
  if (r.aborted) {
1390
1408
  n();
@@ -1392,88 +1410,88 @@ function vt(e, t = {}) {
1392
1410
  }
1393
1411
  r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
1394
1412
  resolve: (t) => {
1395
- r.removeEventListener("abort", n), g(a, "done"), e(mt(t, i.approve, i.reject));
1413
+ r.removeEventListener("abort", n), b(a, "done"), e(ht(t, i.approve, i.reject));
1396
1414
  },
1397
1415
  reject: t
1398
1416
  });
1399
1417
  });
1400
- }, f = new Map(i.tools.map((e) => [e.name, e])), p = new AbortController();
1401
- A.current = p;
1402
- let g = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1418
+ }, v = new Map(c.tools.map((e) => [e.name, e])), y = new AbortController();
1419
+ M.current = y;
1420
+ let b = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1403
1421
  ...i,
1404
1422
  status: t,
1405
1423
  ...n === void 0 ? {} : { detail: n },
1406
1424
  ...r === void 0 ? {} : { toolNames: r }
1407
1425
  } : i));
1408
1426
  try {
1409
- let n = i.history, r = t;
1410
- for (let t = 0; t < ht; t++) {
1411
- let d = crypto.randomUUID();
1427
+ let n = c.history, r = t;
1428
+ for (let t = 0; t < gt; t++) {
1429
+ let i = crypto.randomUUID();
1412
1430
  S((e) => [...e, {
1413
- id: d,
1431
+ id: i,
1414
1432
  kind: "thinking",
1415
- label: T.current.thinking,
1433
+ label: O.current.thinking,
1416
1434
  status: "running"
1417
1435
  }]);
1418
- let h;
1436
+ let a;
1419
1437
  try {
1420
- h = await o.complete({
1438
+ a = await u.complete({
1421
1439
  prompt: r,
1422
- model: a.model,
1440
+ model: l.model,
1423
1441
  history: n,
1424
- tools: l.length ? l : void 0,
1425
- signal: p.signal,
1426
- attachments: t === 0 ? c : void 0,
1427
- logId: i.logId
1442
+ tools: g.length ? g : void 0,
1443
+ signal: y.signal,
1444
+ attachments: t === 0 ? p : void 0,
1445
+ logId: c.logId
1428
1446
  });
1429
1447
  } catch (t) {
1430
- return i.history = [...n, ...r ? [{
1448
+ return c.history = [...n, ...r ? [{
1431
1449
  role: "user",
1432
- content: r + s
1433
- }] : []], p.signal.aborted ? (g(d, "stopped"), e.fallback(i.params, i.context)) : (g(d, "error"), m(Z(t)), null);
1450
+ content: r + f
1451
+ }] : []], y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), m(ue(t)), null);
1434
1452
  }
1435
- if (i.history = [...n, ...r ? [{
1453
+ if (c.history = [...n, ...r ? [{
1436
1454
  role: "user",
1437
- content: r + s
1438
- }] : []], !h) return p.signal.aborted ? (g(d, "stopped"), e.fallback(i.params, i.context)) : (g(d, "error"), m(T.current.noProviderResponse), null);
1439
- if (h.type === "text") return g(d, "done", h.text), e.conversational && h.text.trim() && S((e) => e.map((e) => e.id === d ? {
1455
+ content: r + f
1456
+ }] : []], !a) return y.signal.aborted ? (b(i, "stopped"), e.fallback(c.params, c.context)) : (b(i, "error"), m(O.current.noProviderResponse), null);
1457
+ if (a.type === "text") return b(i, "done", a.text), e.conversational && a.text.trim() && S((e) => e.map((e) => e.id === i ? {
1440
1458
  ...e,
1441
1459
  parts: [{
1442
1460
  type: "text",
1443
1461
  id: "text",
1444
- text: h.text
1462
+ text: a.text
1445
1463
  }]
1446
- } : e)), i.history = [
1464
+ } : e)), c.history = [
1447
1465
  ...n,
1448
1466
  ...r ? [{
1449
1467
  role: "user",
1450
- content: r + s
1468
+ content: r + f
1451
1469
  }] : [],
1452
1470
  {
1453
1471
  role: "assistant",
1454
- content: h.text
1472
+ content: a.text
1455
1473
  }
1456
- ], e.parseResponse(h.text, i.params, i.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1457
- responseLength: h.text.length,
1458
- responsePreview: h.text.length > 2e3 ? `${h.text.slice(0, 1e3)}\n…[troncato qui nel log, ${h.text.length} caratteri totali]…\n${h.text.slice(-1e3)}` : h.text,
1459
- params: i.params
1460
- }), m(T.current.invalidResponse), e.fallback(i.params, i.context));
1461
- let _ = h.toolCalls.map((e) => {
1462
- let t = f.get(e.name);
1474
+ ], e.parseResponse(a.text, c.params, c.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1475
+ responseLength: a.text.length,
1476
+ 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,
1477
+ params: c.params
1478
+ }), m(O.current.invalidResponse), e.fallback(c.params, c.context));
1479
+ let o = a.toolCalls.map((e) => {
1480
+ let t = v.get(e.name);
1463
1481
  return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1464
1482
  });
1465
- g(d, "done", h.text || void 0, h.text ? void 0 : _);
1466
- let v = /* @__PURE__ */ new Map();
1467
- for (let t of h.toolCalls) {
1468
- let n = f.get(t.name);
1469
- if (n && pt(n, t.input)) try {
1470
- v.set(t.id, await u(t.id, n, t.input, p.signal));
1483
+ b(i, "done", a.text || void 0, a.text ? void 0 : o);
1484
+ let s = /* @__PURE__ */ new Map();
1485
+ for (let t of a.toolCalls) {
1486
+ let n = v.get(t.name);
1487
+ if (n && mt(n, t.input)) try {
1488
+ s.set(t.id, await _(t.id, n, t.input, y.signal));
1471
1489
  } catch {
1472
- return e.fallback(i.params, i.context);
1490
+ return e.fallback(c.params, c.context);
1473
1491
  }
1474
1492
  }
1475
- let y = await Promise.all(h.toolCalls.map(async (e) => {
1476
- let t = f.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = v.get(e.id);
1493
+ let d = await Promise.all(a.toolCalls.map(async (e) => {
1494
+ let t = v.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
1477
1495
  if (r && !r.approved) {
1478
1496
  S((t) => [...t, {
1479
1497
  id: e.id,
@@ -1481,7 +1499,7 @@ function vt(e, t = {}) {
1481
1499
  label: n,
1482
1500
  status: "stopped"
1483
1501
  }]);
1484
- let t = Y().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1502
+ let t = q().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1485
1503
  return {
1486
1504
  toolCallId: e.id,
1487
1505
  name: e.name,
@@ -1494,7 +1512,7 @@ function vt(e, t = {}) {
1494
1512
  kind: "tool",
1495
1513
  label: n,
1496
1514
  status: "running"
1497
- }]), !t) return g(e.id, "error"), {
1515
+ }]), !t) return b(e.id, "error"), {
1498
1516
  toolCallId: e.id,
1499
1517
  name: e.name,
1500
1518
  output: `Tool sconosciuto: ${e.name}`,
@@ -1502,16 +1520,16 @@ function vt(e, t = {}) {
1502
1520
  };
1503
1521
  try {
1504
1522
  let n = await t.execute(e.input);
1505
- return g(e.id, "done"), {
1523
+ return b(e.id, "done"), {
1506
1524
  toolCallId: e.id,
1507
1525
  name: e.name,
1508
1526
  output: n
1509
1527
  };
1510
1528
  } catch (t) {
1511
- return g(e.id, "error"), {
1529
+ return b(e.id, "error"), {
1512
1530
  toolCallId: e.id,
1513
1531
  name: e.name,
1514
- output: Z(t),
1532
+ output: ue(t),
1515
1533
  isError: !0
1516
1534
  };
1517
1535
  }
@@ -1520,189 +1538,203 @@ function vt(e, t = {}) {
1520
1538
  ...n,
1521
1539
  ...r ? [{
1522
1540
  role: "user",
1523
- content: r + s
1541
+ content: r + f
1524
1542
  }] : [],
1525
1543
  {
1526
1544
  role: "assistant",
1527
- content: h.text,
1528
- toolCalls: h.toolCalls
1545
+ content: a.text,
1546
+ toolCalls: a.toolCalls
1529
1547
  },
1530
1548
  {
1531
1549
  role: "tool_result",
1532
- results: y
1550
+ results: d
1533
1551
  }
1534
1552
  ], r = "";
1535
1553
  }
1536
- let d = crypto.randomUUID();
1554
+ let i = crypto.randomUUID();
1537
1555
  S((e) => [...e, {
1538
- id: d,
1556
+ id: i,
1539
1557
  kind: "thinking",
1540
- label: T.current.thinking,
1558
+ label: O.current.thinking,
1541
1559
  status: "running"
1542
1560
  }]);
1543
- let h;
1561
+ let a;
1544
1562
  try {
1545
- h = await o.complete({
1546
- prompt: X(Y().stopCallingTools, e.microPromptIds),
1547
- model: a.model,
1563
+ a = await u.complete({
1564
+ prompt: le(q().stopCallingTools, e.microPromptIds),
1565
+ model: l.model,
1548
1566
  history: n,
1549
- signal: p.signal,
1550
- logId: i.logId
1567
+ signal: y.signal,
1568
+ logId: c.logId
1551
1569
  });
1552
1570
  } catch {
1553
- h = null;
1571
+ a = null;
1554
1572
  }
1555
- if (h?.type === "text") {
1556
- g(d, "done", h.text), i.history = [...n, {
1573
+ if (a?.type === "text") {
1574
+ b(i, "done", a.text), c.history = [...n, {
1557
1575
  role: "assistant",
1558
- content: h.text
1576
+ content: a.text
1559
1577
  }];
1560
- let t = e.parseResponse(h.text, i.params, i.context);
1578
+ let t = e.parseResponse(a.text, c.params, c.context);
1561
1579
  if (t) return t;
1562
- } else g(d, p.signal.aborted ? "stopped" : "error"), i.history = n;
1563
- return p.signal.aborted || m(T.current.tooManyToolTurns), e.fallback(i.params, i.context);
1580
+ } else b(i, y.signal.aborted ? "stopped" : "error"), c.history = n;
1581
+ return y.signal.aborted || m(O.current.tooManyToolTurns), e.fallback(c.params, c.context);
1564
1582
  } finally {
1565
- A.current = null;
1583
+ M.current = null;
1566
1584
  }
1567
- };
1585
+ }, me = async (t, n) => {
1586
+ if (A.current) return m(O.current.requestInProgress), null;
1587
+ A.current = !0, m(null), S(n?.openingMessage ? [{
1588
+ id: crypto.randomUUID(),
1589
+ kind: "user",
1590
+ label: "Tu",
1591
+ status: "done",
1592
+ detail: n.openingMessage,
1593
+ ...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1594
+ }] : []), f(!0);
1595
+ try {
1596
+ let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1597
+ if (k.current = {
1598
+ params: t,
1599
+ context: i,
1600
+ tools: o,
1601
+ history: [],
1602
+ logId: crypto.randomUUID(),
1603
+ attachmentsRef: a
1604
+ }, K) return v(!0), de(t), await fe(n?.openingMessage ?? "", !0);
1605
+ if (G) {
1606
+ de(t), J.current = !1;
1607
+ let e = n?.model || Y.current;
1608
+ if (ie(e)) return v(!0), J.current = !0, await fe(n?.openingMessage ?? "", !0, e);
1609
+ }
1610
+ let s = n?.model || void 0, c = s ? !!F[h(s)?.provider ?? ""] : !!U;
1611
+ if (!r || !c) {
1612
+ v(!1);
1613
+ let n = e.fallback(t, i);
1614
+ return S((t) => [...t, {
1615
+ id: crypto.randomUUID(),
1616
+ kind: "tool",
1617
+ status: "done",
1618
+ label: e.describeFallback?.(n) ?? O.current.aiDisabledFallback
1619
+ }]), n;
1620
+ }
1621
+ v(!0);
1622
+ let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, u = le(e.buildPrompt(t, i), e.microPromptIds);
1623
+ return await Z(u, l, s);
1624
+ } catch (e) {
1625
+ return m(ue(e)), null;
1626
+ } finally {
1627
+ A.current = !1, f(!1);
1628
+ }
1629
+ }, he = async (t, n) => {
1630
+ if (A.current) {
1631
+ m(O.current.requestInProgress);
1632
+ return;
1633
+ }
1634
+ A.current = !0, m(null), S(n.activity), f(!0);
1635
+ try {
1636
+ let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1637
+ k.current = {
1638
+ params: t,
1639
+ context: i,
1640
+ tools: o,
1641
+ history: n.history,
1642
+ logId: crypto.randomUUID(),
1643
+ attachmentsRef: a
1644
+ }, (K || G) && de(t), J.current = !1, v(K || G || r && !!U);
1645
+ } catch (e) {
1646
+ m(ue(e));
1647
+ } finally {
1648
+ A.current = !1, f(!1);
1649
+ }
1650
+ }, ge = async (t, n) => {
1651
+ if (A.current) return m(O.current.requestInProgress), null;
1652
+ if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
1653
+ let r = k.current;
1654
+ if (!r) return m(O.current.noActiveSession), null;
1655
+ A.current = !0, f(!0), S((e) => [...e, {
1656
+ id: crypto.randomUUID(),
1657
+ kind: "user",
1658
+ label: "Tu",
1659
+ status: "done",
1660
+ detail: t,
1661
+ ...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1662
+ }]);
1663
+ try {
1664
+ if (K) return await fe(t, !1, n?.model || void 0);
1665
+ let i = n?.model || (G ? Y.current : "");
1666
+ if (G && ie(i)) {
1667
+ let e = !J.current;
1668
+ return J.current = !0, await fe(t, e, i);
1669
+ }
1670
+ let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, o = le(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1671
+ return await Z(o, a, n?.model || void 0);
1672
+ } catch (e) {
1673
+ return m(ue(e)), null;
1674
+ } finally {
1675
+ A.current = !1, f(!1);
1676
+ }
1677
+ }, _e = () => {
1678
+ let t = k.current;
1679
+ if (!t) return null;
1680
+ m(null);
1681
+ let n = e.fallback(t.params, t.context);
1682
+ return S((t) => [...t, {
1683
+ id: crypto.randomUUID(),
1684
+ kind: "tool",
1685
+ status: "done",
1686
+ label: e.describeFallback?.(n) ?? O.current.continueWithoutAiFallback
1687
+ }]), n;
1688
+ }, ve = () => k.current ? {
1689
+ history: k.current.history,
1690
+ activity: y
1691
+ } : null;
1568
1692
  return {
1569
1693
  enabled: r,
1570
1694
  setEnabled: i,
1571
1695
  hasProviders: a,
1572
- selectedModel: B ? H : c,
1573
- setSelectedModel: B ? K : l,
1574
- modelsByProvider: o,
1696
+ selectedModel: K || G && se ? se : B,
1697
+ setSelectedModel: K ? X : G ? (e) => {
1698
+ ie(e) ? X(e) : (X(""), l(e));
1699
+ } : l,
1700
+ modelsByProvider: ne,
1575
1701
  modelsLoading: s,
1576
1702
  running: u,
1577
1703
  error: p,
1578
1704
  canContinue: g,
1579
- remote: B,
1580
- remoteModels: V,
1705
+ remote: K,
1706
+ remoteModels: ae,
1707
+ alongside: G,
1708
+ ...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
1581
1709
  activity: y,
1582
- run: async (t, n) => {
1583
- if (k.current) return m(T.current.requestInProgress), null;
1584
- k.current = !0, m(null), S(n?.openingMessage ? [{
1585
- id: crypto.randomUUID(),
1586
- kind: "user",
1587
- label: "Tu",
1588
- status: "done",
1589
- detail: n.openingMessage,
1590
- ...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1591
- }] : []), f(!0);
1592
- try {
1593
- let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1594
- if (O.current = {
1595
- params: t,
1596
- context: i,
1597
- tools: o,
1598
- history: [],
1599
- logId: crypto.randomUUID(),
1600
- attachmentsRef: a
1601
- }, B) return v(!0), q(t), await J(n?.openingMessage ?? "", !0);
1602
- let s = n?.model || void 0, c = s ? !!I[h(s)?.provider ?? ""] : !!R;
1603
- if (!r || !c) {
1604
- v(!1);
1605
- let n = e.fallback(t, i);
1606
- return S((t) => [...t, {
1607
- id: crypto.randomUUID(),
1608
- kind: "tool",
1609
- status: "done",
1610
- label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
1611
- }]), n;
1612
- }
1613
- v(!0);
1614
- let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, u = X(e.buildPrompt(t, i), e.microPromptIds);
1615
- return await ne(u, l, s);
1616
- } catch (e) {
1617
- return m(Z(e)), null;
1618
- } finally {
1619
- k.current = !1, f(!1);
1620
- }
1621
- },
1622
- resume: async (t, n) => {
1623
- if (k.current) {
1624
- m(T.current.requestInProgress);
1625
- return;
1626
- }
1627
- k.current = !0, m(null), S(n.activity), f(!0);
1628
- try {
1629
- let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1630
- O.current = {
1631
- params: t,
1632
- context: i,
1633
- tools: o,
1634
- history: n.history,
1635
- logId: crypto.randomUUID(),
1636
- attachmentsRef: a
1637
- }, B && q(t), v(B || r && !!R);
1638
- } catch (e) {
1639
- m(Z(e));
1640
- } finally {
1641
- k.current = !1, f(!1);
1642
- }
1643
- },
1644
- sendMessage: async (t, n) => {
1645
- if (k.current) return m(T.current.requestInProgress), null;
1646
- if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
1647
- let r = O.current;
1648
- if (!r) return m(T.current.noActiveSession), null;
1649
- k.current = !0, f(!0), S((e) => [...e, {
1650
- id: crypto.randomUUID(),
1651
- kind: "user",
1652
- label: "Tu",
1653
- status: "done",
1654
- detail: t,
1655
- ...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1656
- }]);
1657
- try {
1658
- if (B) return await J(t, !1, n?.model || void 0);
1659
- let i = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, a = X(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1660
- return await ne(a, i, n?.model || void 0);
1661
- } catch (e) {
1662
- return m(Z(e)), null;
1663
- } finally {
1664
- k.current = !1, f(!1);
1665
- }
1666
- },
1667
- stop: M,
1668
- runFallback: () => {
1669
- let t = O.current;
1670
- if (!t) return null;
1671
- m(null);
1672
- let n = e.fallback(t.params, t.context);
1673
- return S((t) => [...t, {
1674
- id: crypto.randomUUID(),
1675
- kind: "tool",
1676
- status: "done",
1677
- label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
1678
- }]), n;
1679
- },
1680
- snapshot: () => O.current ? {
1681
- history: O.current.history,
1682
- activity: y
1683
- } : null,
1684
- answerQuestions: te
1710
+ run: me,
1711
+ resume: he,
1712
+ sendMessage: ge,
1713
+ stop: te,
1714
+ runFallback: _e,
1715
+ snapshot: ve,
1716
+ answerQuestions: pe
1685
1717
  };
1686
1718
  }
1687
1719
  //#endregion
1688
1720
  //#region src/domain/orchestrator/prompt.ts
1689
- function yt() {
1690
- let e = Y();
1721
+ function bt() {
1722
+ let e = q();
1691
1723
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1692
1724
  }
1693
- function bt(e, t, n) {
1694
- let r = Y(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1725
+ function xt(e, t, n) {
1726
+ let r = q(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1695
1727
  return `${r.orchestratorIntro}
1696
1728
 
1697
1729
  ${r.toolsHeading}
1698
1730
  ${t}
1699
1731
  ${i}
1700
- ${yt()}
1732
+ ${bt()}
1701
1733
 
1702
1734
  ${r.userRequestHeading}
1703
1735
  ${e}`;
1704
1736
  }
1705
- function xt(e, t) {
1737
+ function St(e, t) {
1706
1738
  return t ? {
1707
1739
  kind: "handoff",
1708
1740
  ...t
@@ -1713,27 +1745,27 @@ function xt(e, t) {
1713
1745
  }
1714
1746
  //#endregion
1715
1747
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1716
- function St(e) {
1717
- return z().filter((t) => !t.onlyWhenAnchored || e === t.id);
1718
- }
1719
1748
  function Ct(e) {
1749
+ return L().filter((t) => !t.onlyWhenAnchored || e === t.id);
1750
+ }
1751
+ function wt(e) {
1720
1752
  return {
1721
1753
  buildContext(e) {
1722
1754
  return {
1723
- cliCatalog: se(St(e.scopedSubagentId)),
1755
+ cliCatalog: ce(Ct(e.scopedSubagentId)),
1724
1756
  handoff: { current: null },
1725
1757
  collected: {}
1726
1758
  };
1727
1759
  },
1728
1760
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1729
- return bt(e, n, t);
1761
+ return xt(e, n, t);
1730
1762
  },
1731
1763
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1732
- return `${e}\n\n${yt()}\n\n${Y().toolsHeading}\n${n}`;
1764
+ return `${e}\n\n${bt()}\n\n${q().toolsHeading}\n${n}`;
1733
1765
  },
1734
1766
  parseResponse(e, t, n) {
1735
1767
  let r = n.handoff.current;
1736
- return n.handoff.current = null, xt(e, r);
1768
+ return n.handoff.current = null, St(e, r);
1737
1769
  },
1738
1770
  fallback() {
1739
1771
  return {
@@ -1745,11 +1777,11 @@ function Ct(e) {
1745
1777
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
1746
1778
  },
1747
1779
  getTools(t, n, r) {
1748
- let i = H({
1780
+ let i = B({
1749
1781
  attachmentsRef: r,
1750
1782
  collected: n.collected,
1751
1783
  proxyFetch: g
1752
- }), a = t.scopedSubagentId ? B(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = St(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1784
+ }), a = t.scopedSubagentId ? R(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Ct(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1753
1785
  name: `${t.id}_${r.name}`,
1754
1786
  description: `${t.label}: ${r.summary}`,
1755
1787
  inputSchema: r.inputSchema,
@@ -1763,7 +1795,7 @@ function Ct(e) {
1763
1795
  params: i
1764
1796
  }, {
1765
1797
  status: "queued",
1766
- note: m(Y().handoffQueued, { label: t.label })
1798
+ note: m(q().handoffQueued, { label: t.label })
1767
1799
  };
1768
1800
  }
1769
1801
  })));
@@ -1773,17 +1805,17 @@ function Ct(e) {
1773
1805
  }
1774
1806
  //#endregion
1775
1807
  //#region src/presentation/deriveHistoryTitle.ts
1776
- function wt(e, t) {
1808
+ function Tt(e, t) {
1777
1809
  return e.deriveHistoryTitle?.(t) ?? e.label;
1778
1810
  }
1779
1811
  //#endregion
1780
1812
  //#region src/presentation/ResultDestinationPicker.tsx
1781
- function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1813
+ function Et({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1782
1814
  let s = Q(), c = $(), l = c.scope, u = y(), [d, f] = D(null), [p, h] = D(new Set(i ?? [])), [g, _] = D(null), v = ge(), b = /* @__PURE__ */ new Map();
1783
1815
  e.destinationIds.forEach((e) => {
1784
1816
  let t = v[e];
1785
1817
  t && b.set(e, t);
1786
- }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(pe.id, pe);
1818
+ }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(Z.id, Z);
1787
1819
  let x = Array.from(b.values()), S = async (i) => {
1788
1820
  f(i), _(null);
1789
1821
  try {
@@ -1796,7 +1828,7 @@ function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1796
1828
  storageProvider: l?.storageProvider ?? null,
1797
1829
  proxyFetch: u
1798
1830
  }, n);
1799
- h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, wt(e, n));
1831
+ h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Tt(e, n));
1800
1832
  } catch (e) {
1801
1833
  _(e instanceof Error ? e.message : String(e));
1802
1834
  } finally {
@@ -1829,16 +1861,16 @@ function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1829
1861
  }
1830
1862
  //#endregion
1831
1863
  //#region src/presentation/reports/subagentReportRegistry.tsx
1832
- var Et = {};
1833
- function Dt(e) {
1834
- Object.assign(Et, e);
1835
- }
1864
+ var Dt = {};
1836
1865
  function Ot(e) {
1837
- return Et[e];
1866
+ Object.assign(Dt, e);
1867
+ }
1868
+ function kt(e) {
1869
+ return Dt[e];
1838
1870
  }
1839
1871
  //#endregion
1840
1872
  //#region src/presentation/reports/GenericResultPreview.tsx
1841
- function kt({ result: e }) {
1873
+ function At({ result: e }) {
1842
1874
  let [t, n] = D(!1);
1843
1875
  return /* @__PURE__ */ A("div", {
1844
1876
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -1855,7 +1887,7 @@ function kt({ result: e }) {
1855
1887
  }
1856
1888
  //#endregion
1857
1889
  //#region src/presentation/liveAnchorDestination.ts
1858
- function At(e, t, n) {
1890
+ function jt(e, t, n) {
1859
1891
  return e.length === 0 ? null : {
1860
1892
  id: "live-component",
1861
1893
  label: "Applica al componente aperto",
@@ -1866,30 +1898,30 @@ function At(e, t, n) {
1866
1898
  }
1867
1899
  //#endregion
1868
1900
  //#region src/presentation/subagentControls.ts
1869
- var jt = {};
1870
- function Mt(e) {
1871
- Object.assign(jt, e);
1872
- }
1901
+ var Mt = {};
1873
1902
  function Nt(e) {
1874
- return jt[e];
1903
+ Object.assign(Mt, e);
1904
+ }
1905
+ function Pt(e) {
1906
+ return Mt[e];
1875
1907
  }
1876
1908
  //#endregion
1877
1909
  //#region src/presentation/SubagentRunner.tsx
1878
- var Pt = () => ({});
1879
- function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
1880
- let c = vt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), h = (t) => {
1910
+ var Ft = () => ({});
1911
+ function It({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
1912
+ let c = yt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), h = (t) => {
1881
1913
  e.definition.conversational || m(t);
1882
- }, [g, _] = D([]), [v, b] = D(null), x = Ot(e.id), S = x?.kind === "selection" ? x : null, [w, j] = D(null), M = E(!1), N = E(0), P = E(null);
1883
- p && p !== P.current && (P.current = p, N.current = (r?.length ?? 0) + c.activity.length);
1884
- let F = E(!1), I = c.remote || !c.hasProviders || c.selectedModel !== "";
1914
+ }, [g, _] = D([]), [v, b] = D(null), x = kt(e.id), S = x?.kind === "selection" ? x : null, [w, j] = D(null), M = E(!1), ee = E(0), N = E(null);
1915
+ p && p !== N.current && (N.current = p, ee.current = (r?.length ?? 0) + c.activity.length);
1916
+ let P = E(!1), te = c.remote || !c.hasProviders || c.selectedModel !== "";
1885
1917
  C(() => {
1886
- !M.current && I && (M.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1918
+ !M.current && te && (M.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1887
1919
  model: o,
1888
1920
  openingMessage: s
1889
1921
  }).then((e) => {
1890
1922
  e && h(e);
1891
1923
  })));
1892
- }, [I]), C(() => {
1924
+ }, [te]), C(() => {
1893
1925
  if (!p || !u) return;
1894
1926
  let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = ge();
1895
1927
  n.forEach((n) => {
@@ -1903,7 +1935,7 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1903
1935
  ...t,
1904
1936
  pinnedEntityId: r
1905
1937
  }).then((n) => {
1906
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, wt(e, t));
1938
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Tt(e, t));
1907
1939
  }).catch((e) => b(e instanceof Error ? e.message : String(e))));
1908
1940
  });
1909
1941
  }, [
@@ -1913,79 +1945,79 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1913
1945
  ]), C(() => {
1914
1946
  p && S && j(S.defaultSelection(p));
1915
1947
  }, [p, S]);
1916
- let L = (e, t) => {
1948
+ let F = (e, t) => {
1917
1949
  j((n) => n && {
1918
1950
  ...n,
1919
1951
  [e]: t
1920
1952
  });
1921
- }, R = (e) => h(e), z = T(() => p && S && w ? S.applySelection(p, w) : p, [
1953
+ }, I = (e) => h(e), L = T(() => p && S && w ? S.applySelection(p, w) : p, [
1922
1954
  p,
1923
1955
  S,
1924
1956
  w
1925
- ]), B = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), V = T(() => At(B, t, f), [
1926
- B,
1957
+ ]), R = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), z = T(() => jt(R, t, f), [
1958
+ R,
1927
1959
  t,
1928
1960
  f
1929
- ]), ee = T(() => V ? [V, ...n ?? []] : n, [V, n]), H = e.chatEntityId?.(t), U = E(!1);
1961
+ ]), ne = T(() => z ? [z, ...n ?? []] : n, [z, n]), B = e.chatEntityId?.(t), V = E(!1);
1930
1962
  C(() => {
1931
- let n = U.current && !c.running;
1932
- if (U.current = c.running, !n || !H || !u) return;
1963
+ let n = V.current && !c.running;
1964
+ if (V.current = c.running, !n || !B || !u) return;
1933
1965
  let i = c.snapshot();
1934
1966
  i && we({
1935
1967
  scopeId: u.id,
1936
1968
  subagentId: e.id,
1937
- entityId: H,
1969
+ entityId: B,
1938
1970
  params: t,
1939
- title: wt(e, t),
1971
+ title: Tt(e, t),
1940
1972
  history: i.history,
1941
1973
  activity: [...r ?? [], ...i.activity]
1942
1974
  });
1943
1975
  }, [c.running]);
1944
- let W = () => {
1945
- F.current = !0, c.running && c.stop(), l.closeTask(f);
1946
- }, G = E(Nt(e.id) ?? Pt).current, K = G({
1976
+ let H = () => {
1977
+ P.current = !0, c.running && c.stop(), l.closeTask(f);
1978
+ }, U = E(Pt(e.id) ?? Ft).current, W = U({
1947
1979
  params: t,
1948
1980
  taskId: f,
1949
1981
  running: c.running,
1950
- close: W
1951
- }), q = (e) => {
1982
+ close: H
1983
+ }), G = (e) => {
1952
1984
  _((t) => t.includes(e) ? t : [...t, e]);
1953
1985
  };
1954
1986
  return C(() => {
1955
- F.current || l.openTask({
1987
+ P.current || l.openTask({
1956
1988
  id: f,
1957
- title: wt(e, t),
1989
+ title: Tt(e, t),
1958
1990
  icon: e.icon,
1959
1991
  agent: c,
1960
1992
  onApplied: (e) => h(e),
1961
1993
  precedingActivity: r,
1962
- panelExtraAnchorIndex: N.current,
1963
- onDismiss: W,
1964
- ...H ? { savedToDisk: !0 } : {},
1965
- panelActions: K.content,
1966
- composerActions: K.actions,
1967
- composerCommands: K.commands,
1994
+ panelExtraAnchorIndex: ee.current,
1995
+ onDismiss: H,
1996
+ ...B ? { savedToDisk: !0 } : {},
1997
+ panelActions: W.content,
1998
+ composerActions: W.actions,
1999
+ composerCommands: W.commands,
1968
2000
  panelExtra: p ? /* @__PURE__ */ A(O, { children: [
1969
2001
  S && w ? /* @__PURE__ */ k(S.Report, {
1970
2002
  result: p,
1971
2003
  selection: w,
1972
- onChange: L
2004
+ onChange: F
1973
2005
  }) : x?.kind === "editable" ? /* @__PURE__ */ k(x.Report, {
1974
2006
  result: p,
1975
- onResultChange: R
1976
- }) : /* @__PURE__ */ k(kt, { result: z }),
2007
+ onResultChange: I
2008
+ }) : /* @__PURE__ */ k(At, { result: L }),
1977
2009
  v && /* @__PURE__ */ A("p", {
1978
2010
  className: "text-xs text-destructive",
1979
2011
  children: ["Salvataggio automatico non riuscito: ", v]
1980
2012
  }),
1981
- /* @__PURE__ */ k(Tt, {
2013
+ /* @__PURE__ */ k(Et, {
1982
2014
  manifest: e,
1983
- result: z,
2015
+ result: L,
1984
2016
  meta: t,
1985
2017
  taskId: f,
1986
2018
  initiallyApplied: g,
1987
- onApplied: q,
1988
- extraDestinations: ee
2019
+ onApplied: G,
2020
+ extraDestinations: ne
1989
2021
  })
1990
2022
  ] }) : void 0
1991
2023
  });
@@ -2004,29 +2036,29 @@ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2004
2036
  e,
2005
2037
  t,
2006
2038
  p,
2007
- z,
2039
+ L,
2008
2040
  w,
2009
2041
  g,
2010
2042
  n,
2011
2043
  r,
2012
2044
  v,
2013
- K.content,
2014
- K.actions,
2015
- K.commands
2045
+ W.content,
2046
+ W.actions,
2047
+ W.commands
2016
2048
  ]), C(() => () => {
2017
2049
  l.closeTask(f);
2018
2050
  }, [l.closeTask, f]), null;
2019
2051
  }
2020
2052
  //#endregion
2021
2053
  //#region src/presentation/OrchestratorRunner.tsx
2022
- function It({ userGoal: e }) {
2023
- let t = Q(), n = vt(T(() => Ct({
2054
+ function Lt({ userGoal: e }) {
2055
+ let t = Q(), n = yt(T(() => wt({
2024
2056
  unavailable: t.orchestratorUnavailable,
2025
2057
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2026
2058
  preparing: t.orchestratorPreparing,
2027
2059
  collecting: t.orchestratorCollecting
2028
2060
  }), []), { defaultEnabled: !0 }), r = $(), [i, a] = D(null), o = E(!1), s = !n.hasProviders || n.selectedModel !== "", c = E(r.pendingExtraDestinations), l = E(r.pendingAttachments), u = E(r.pendingModel), d = E(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), f = E(r.pendingCarryOver), p = E(!1), m = (e) => {
2029
- e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Me));
2061
+ e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Ne));
2030
2062
  };
2031
2063
  C(() => {
2032
2064
  !o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
@@ -2042,7 +2074,7 @@ function It({ userGoal: e }) {
2042
2074
  }));
2043
2075
  }, [s]), C(() => {
2044
2076
  p.current || r.openTask({
2045
- id: Me,
2077
+ id: Ne,
2046
2078
  title: "Agentico",
2047
2079
  icon: "bot",
2048
2080
  agent: n,
@@ -2050,7 +2082,7 @@ function It({ userGoal: e }) {
2050
2082
  scopedSubagentId: d.current,
2051
2083
  precedingActivity: f.current?.activity,
2052
2084
  onDismiss: () => {
2053
- p.current = !0, n.running && n.stop(), r.closeTask(Me);
2085
+ p.current = !0, n.running && n.stop(), r.closeTask(Ne);
2054
2086
  }
2055
2087
  });
2056
2088
  }, [
@@ -2063,12 +2095,12 @@ function It({ userGoal: e }) {
2063
2095
  n.hasProviders,
2064
2096
  r.openTask
2065
2097
  ]), C(() => () => {
2066
- r.closeTask(Me);
2098
+ r.closeTask(Ne);
2067
2099
  }, [r.closeTask]);
2068
2100
  let h = T(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2069
2101
  if (!i) return null;
2070
- let g = B(i.subagentId);
2071
- return g ? /* @__PURE__ */ k(Ft, {
2102
+ let g = R(i.subagentId);
2103
+ return g ? /* @__PURE__ */ k(It, {
2072
2104
  manifest: g,
2073
2105
  params: i.params,
2074
2106
  extraDestinations: c.current,
@@ -2079,8 +2111,8 @@ function It({ userGoal: e }) {
2079
2111
  }
2080
2112
  //#endregion
2081
2113
  //#region src/presentation/ManualEntryRunner.tsx
2082
- function Lt({ manifest: e, extraDestinations: n }) {
2083
- let r = vt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = Ot(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
2114
+ function Rt({ manifest: e, extraDestinations: n }) {
2115
+ let r = yt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = kt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
2084
2116
  if (!e.manualEntry) return;
2085
2117
  let n;
2086
2118
  try {
@@ -2107,7 +2139,7 @@ function Lt({ manifest: e, extraDestinations: n }) {
2107
2139
  p
2108
2140
  ]), S = (e) => {
2109
2141
  u((t) => t.includes(e) ? t : [...t, e]);
2110
- }, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? At(w, h, o) : null, [
2142
+ }, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? jt(w, h, o) : null, [
2111
2143
  w,
2112
2144
  h,
2113
2145
  o
@@ -2136,8 +2168,8 @@ function Lt({ manifest: e, extraDestinations: n }) {
2136
2168
  }) : d?.kind === "editable" ? /* @__PURE__ */ k(d.Report, {
2137
2169
  result: s,
2138
2170
  onResultChange: b
2139
- }) : /* @__PURE__ */ k(kt, { result: x }),
2140
- /* @__PURE__ */ k(Tt, {
2171
+ }) : /* @__PURE__ */ k(At, { result: x }),
2172
+ /* @__PURE__ */ k(Et, {
2141
2173
  manifest: e,
2142
2174
  result: x,
2143
2175
  meta: h ?? {},
@@ -2174,15 +2206,19 @@ function Lt({ manifest: e, extraDestinations: n }) {
2174
2206
  }
2175
2207
  //#endregion
2176
2208
  //#region src/presentation/Agentico.tsx
2177
- function Rt(e) {
2178
- return Object.values(e).flat().map((e) => ({
2179
- label: e.model,
2180
- value: e.id,
2181
- pricing: e.pricing ?? null,
2182
- group: e.providerLabel ?? e.provider
2183
- }));
2184
- }
2185
- function zt({ task: e }) {
2209
+ function zt(e, t) {
2210
+ return Object.values(e).flat().map((e) => {
2211
+ let n = t?.(e.provider, e.providerLabel ?? e.provider);
2212
+ return {
2213
+ label: e.model,
2214
+ value: e.id,
2215
+ pricing: e.pricing ?? null,
2216
+ group: n?.group ?? e.providerLabel ?? e.provider,
2217
+ ...n?.badge ? { groupBadge: n.badge } : {}
2218
+ };
2219
+ });
2220
+ }
2221
+ function Bt({ task: e }) {
2186
2222
  let t = Q(), [n, r] = D(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
2187
2223
  if (r(""), s) {
2188
2224
  s.onSubmit(e.text);
@@ -2194,17 +2230,17 @@ function zt({ task: e }) {
2194
2230
  }).then((e) => {
2195
2231
  e && a(e);
2196
2232
  });
2197
- }, u = !!s || i.remote && i.remoteModels.length === 0, d = !u && !i.remote && i.hasProviders && !i.selectedModel, f = u ? [] : i.remote ? i.remoteModels : Rt(i.modelsByProvider);
2233
+ }, u = !!s || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...zt(i.modelsByProvider, i.catalogGroup)] : zt(i.modelsByProvider);
2198
2234
  return /* @__PURE__ */ k(o, {
2199
2235
  value: n,
2200
2236
  onChange: r,
2201
2237
  placeholder: s?.prompt ?? t.messagePlaceholder,
2202
2238
  running: c,
2203
2239
  onStop: i.stop,
2204
- disabled: !n.trim() || d,
2240
+ disabled: !n.trim() || f,
2205
2241
  onSubmit: l,
2206
- attachments: !s && !i.remote,
2207
- models: f,
2242
+ attachments: !s && !i.remote && !d,
2243
+ models: p,
2208
2244
  selectedModel: u ? "" : i.selectedModel,
2209
2245
  actions: e.composerActions,
2210
2246
  commands: e.composerCommands,
@@ -2214,8 +2250,8 @@ function zt({ task: e }) {
2214
2250
  maxHeight: 220
2215
2251
  });
2216
2252
  }
2217
- function Bt() {
2218
- let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = dt(), l = (t) => {
2253
+ function Vt() {
2254
+ let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = ft(), l = (t) => {
2219
2255
  t.text.trim() && (e(t.text.trim(), {
2220
2256
  attachments: t.files.length > 0 ? t.files : void 0,
2221
2257
  model: t.model || void 0
@@ -2228,7 +2264,7 @@ function Bt() {
2228
2264
  disabled: !n.trim() || u,
2229
2265
  onSubmit: l,
2230
2266
  attachments: !0,
2231
- models: Rt(a),
2267
+ models: zt(a),
2232
2268
  selectedModel: s,
2233
2269
  onModelChange: c,
2234
2270
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2236,7 +2272,7 @@ function Bt() {
2236
2272
  maxHeight: 220
2237
2273
  });
2238
2274
  }
2239
- function Vt(e, t, n = Date.now()) {
2275
+ function Ht(e, t, n = Date.now()) {
2240
2276
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2241
2277
  numeric: "auto",
2242
2278
  style: "short"
@@ -2248,7 +2284,7 @@ function Vt(e, t, n = Date.now()) {
2248
2284
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2249
2285
  return i.format(0, "minute");
2250
2286
  }
2251
- function Ht({ card: e }) {
2287
+ function Ut({ card: e }) {
2252
2288
  let t = Q();
2253
2289
  return e.humanSummaryOnly ? /* @__PURE__ */ A("div", {
2254
2290
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2304,7 +2340,7 @@ function Ht({ card: e }) {
2304
2340
  ]
2305
2341
  });
2306
2342
  }
2307
- function Ut({ messages: e }) {
2343
+ function Wt({ messages: e }) {
2308
2344
  return /* @__PURE__ */ k("div", {
2309
2345
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2310
2346
  children: e.map((e, t) => /* @__PURE__ */ k("p", {
@@ -2313,25 +2349,25 @@ function Ut({ messages: e }) {
2313
2349
  }, t))
2314
2350
  });
2315
2351
  }
2316
- function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2317
- let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? Ee(e) : [], [
2352
+ function Gt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2353
+ let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? De(e) : [], [
2318
2354
  e,
2319
2355
  r,
2320
2356
  h
2321
2357
  ]), y = async (t) => {
2322
- let r = B(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2358
+ let r = R(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2323
2359
  if (!i || window.confirm(i)) {
2324
2360
  try {
2325
2361
  await r?.onArchive?.(t.entityId, t.params);
2326
2362
  } catch {
2327
2363
  return;
2328
2364
  }
2329
- Te(e, t.subagentId, t.entityId), n === De(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2365
+ Ee(e, t.subagentId, t.entityId), n === Oe(t.subagentId, t.entityId) && s(), g((e) => e + 1);
2330
2366
  }
2331
2367
  }, b = T(() => {
2332
2368
  let e = p.trim().toLowerCase();
2333
2369
  return e ? _.filter((t) => {
2334
- let n = B(t.subagentId)?.label ?? t.subagentId;
2370
+ let n = R(t.subagentId)?.label ?? t.subagentId;
2335
2371
  return t.title.toLowerCase().includes(e) || n.toLowerCase().includes(e);
2336
2372
  }) : _;
2337
2373
  }, [_, p]);
@@ -2375,7 +2411,7 @@ function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2375
2411
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
2376
2412
  children: _.length === 0 ? d.noSavedChats : d.noResults
2377
2413
  }) : b.map((e) => {
2378
- let t = B(e.subagentId), r = n === De(e.subagentId, e.entityId);
2414
+ let t = R(e.subagentId), r = n === Oe(e.subagentId, e.entityId);
2379
2415
  return /* @__PURE__ */ k(l, {
2380
2416
  icon: r ? "check" : t?.icon ?? "bot",
2381
2417
  className: r ? "bg-accent font-medium" : void 0,
@@ -2399,95 +2435,95 @@ function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2399
2435
  ]
2400
2436
  }), /* @__PURE__ */ k("span", {
2401
2437
  className: "shrink-0 text-xs text-muted-foreground",
2402
- title: new Date(e.savedAt).toLocaleString(f),
2403
- children: Vt(e.savedAt, f)
2438
+ title: `${d.chatStarted.replace("{at}", new Date(Te(e)).toLocaleString(f))} · ${d.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(f))}`,
2439
+ children: Ht(Te(e), f)
2404
2440
  })]
2405
2441
  })
2406
2442
  }, `${e.subagentId}:${e.entityId}`);
2407
2443
  })
2408
2444
  });
2409
2445
  }
2410
- function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2411
- let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [N, P] = D(!1), F = at({
2446
+ function Kt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2447
+ let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [ee, N] = D(!1), P = ot({
2412
2448
  defaultWidth: e,
2413
2449
  minWidth: n,
2414
2450
  maxWidth: r,
2415
2451
  onWidthChange: i
2416
- }), I = () => {
2417
- (!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(), P(!1));
2418
- }, L = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], R = L.length, z = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? R, R)), V = L.slice(0, z), ee = L.slice(z), H = !!(a && !a.agent.running && a.agent.error), U = new Set(a?.agent.activity.map((e) => e.id) ?? []), W = a ? {
2419
- canAnswer: (e) => U.has(e),
2452
+ }), te = () => {
2453
+ (!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(), N(!1));
2454
+ }, F = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], I = F.length, L = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? I, I)), z = F.slice(0, L), ne = F.slice(L), B = !!(a && !a.agent.running && a.agent.error), V = new Set(a?.agent.activity.map((e) => e.id) ?? []), H = a ? {
2455
+ canAnswer: (e) => V.has(e),
2420
2456
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2421
2457
  e && a.onApplied(e);
2422
2458
  })
2423
- } : void 0, G = W ? Ge(L, W.canAnswer) : null, K = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? B(a.scopedSubagentId) : void 0, q = K?.manualEntry ? K : null, J = E(!0);
2459
+ } : void 0, U = H ? Ke(F, H.canAnswer) : null, W = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? R(a.scopedSubagentId) : void 0, G = W?.manualEntry ? W : null, K = E(!0);
2424
2460
  C(() => {
2425
2461
  let e = M.current;
2426
2462
  if (!e) return;
2427
2463
  let t = () => {
2428
- J.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2464
+ K.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2429
2465
  };
2430
2466
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
2431
2467
  }, [a?.id]), C(() => {
2432
2468
  let e = M.current;
2433
- e && (J.current = !0, e.scrollTop = e.scrollHeight);
2469
+ e && (K.current = !0, e.scrollTop = e.scrollHeight);
2434
2470
  }, [a?.id]);
2435
- let te = L.at(-1)?.detail?.length ?? 0;
2471
+ let re = F.at(-1)?.detail?.length ?? 0;
2436
2472
  C(() => {
2437
2473
  let e = M.current;
2438
- e && J.current && (e.scrollTop = e.scrollHeight);
2474
+ e && K.current && (e.scrollTop = e.scrollHeight);
2439
2475
  }, [
2440
- R,
2441
- H,
2442
- te
2476
+ I,
2477
+ B,
2478
+ re
2443
2479
  ]);
2444
- let Y = E(null);
2480
+ let q = E(null);
2445
2481
  C(() => {
2446
- let e = M.current, t = Y.current;
2482
+ let e = M.current, t = q.current;
2447
2483
  if (!e || !t || typeof ResizeObserver > "u") return;
2448
2484
  let n = new ResizeObserver(() => {
2449
- J.current && (e.scrollTop = e.scrollHeight);
2485
+ K.current && (e.scrollTop = e.scrollHeight);
2450
2486
  });
2451
2487
  return n.observe(t), () => n.disconnect();
2452
2488
  }, [a?.id, o]);
2453
- let ne = s ? /* @__PURE__ */ k(It, { userGoal: s }, c) : null, re = f ? B(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ k(Ft, {
2454
- manifest: re,
2489
+ let ie = s ? /* @__PURE__ */ k(Lt, { userGoal: s }, c) : null, J = f ? R(f.subagentId) : void 0, ae = f && J ? /* @__PURE__ */ k(It, {
2490
+ manifest: J,
2455
2491
  params: f.snapshot.params,
2456
- taskId: De(f.subagentId, f.entityId),
2492
+ taskId: Oe(f.subagentId, f.entityId),
2457
2493
  resumeSeed: {
2458
2494
  history: f.snapshot.history,
2459
2495
  activity: f.snapshot.activity
2460
2496
  }
2461
- }, p) : null, ae = g ? B(g.subagentId) : void 0, oe = g && ae ? /* @__PURE__ */ k(Lt, {
2462
- manifest: ae,
2497
+ }, p) : null, oe = g ? R(g.subagentId) : void 0, se = g && oe ? /* @__PURE__ */ k(Rt, {
2498
+ manifest: oe,
2463
2499
  extraDestinations: g.extraDestinations
2464
- }, _) : null, se = b ? B(b.subagentId) : void 0, ce = b && se ? /* @__PURE__ */ k(Ft, {
2465
- manifest: se,
2500
+ }, _) : null, ce = b ? R(b.subagentId) : void 0, Y = b && ce ? /* @__PURE__ */ k(It, {
2501
+ manifest: ce,
2466
2502
  params: b.params,
2467
2503
  extraDestinations: b.extraDestinations
2468
- }, x) : null, le = S ? B(S.subagentId) : void 0, X = S && le ? /* @__PURE__ */ k(Ft, {
2469
- manifest: le,
2504
+ }, x) : null, X = S ? R(S.subagentId) : void 0, le = S && X ? /* @__PURE__ */ k(It, {
2505
+ manifest: X,
2470
2506
  params: S.params,
2471
2507
  taskId: S.taskId,
2472
2508
  openingMessage: S.openingMessage
2473
2509
  }, w) : null;
2474
2510
  return o ? /* @__PURE__ */ A(O, { children: [
2475
- ne,
2476
2511
  ie,
2477
- oe,
2478
- ce,
2479
- X,
2512
+ ae,
2513
+ se,
2514
+ Y,
2515
+ le,
2480
2516
  /* @__PURE__ */ A("div", {
2481
- style: { width: F.width },
2517
+ style: { width: P.width },
2482
2518
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2483
2519
  children: [
2484
- /* @__PURE__ */ k(ot, {
2485
- width: F.width,
2486
- min: F.min,
2487
- max: F.max,
2488
- onResize: F.set,
2489
- onCommit: F.commit,
2490
- onReset: F.reset
2520
+ /* @__PURE__ */ k(st, {
2521
+ width: P.width,
2522
+ min: P.min,
2523
+ max: P.max,
2524
+ onResize: P.set,
2525
+ onCommit: P.commit,
2526
+ onReset: P.reset
2491
2527
  }),
2492
2528
  /* @__PURE__ */ A("div", {
2493
2529
  className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
@@ -2496,44 +2532,44 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2496
2532
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2497
2533
  children: a ? a.title : "Agentico"
2498
2534
  }),
2499
- T && /* @__PURE__ */ k(Wt, {
2535
+ T && /* @__PURE__ */ k(Gt, {
2500
2536
  scopeId: T.id,
2501
2537
  currentTaskId: a?.id ?? null,
2502
- open: N,
2503
- onOpenChange: P,
2504
- onNewChat: I,
2538
+ open: ee,
2539
+ onOpenChange: N,
2540
+ onNewChat: te,
2505
2541
  onSelect: (e, t, n) => h(e, t, n),
2506
2542
  onArchivedCurrent: m
2507
2543
  }),
2508
- /* @__PURE__ */ k(st, {})
2544
+ /* @__PURE__ */ k(ct, {})
2509
2545
  ]
2510
2546
  }),
2511
2547
  /* @__PURE__ */ k("div", {
2512
2548
  ref: M,
2513
- className: `flex-1 overflow-y-auto px-3 pb-2 ${G ? "min-h-24" : "min-h-0"}`,
2549
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${U ? "min-h-24" : "min-h-0"}`,
2514
2550
  children: /* @__PURE__ */ k("div", {
2515
- ref: Y,
2551
+ ref: q,
2516
2552
  className: "pt-2",
2517
2553
  children: a ? /* @__PURE__ */ A(O, { children: [
2518
- a.manualEntry && L.length === 0 && /* @__PURE__ */ k("p", {
2554
+ a.manualEntry && F.length === 0 && /* @__PURE__ */ k("p", {
2519
2555
  className: "text-xs text-muted-foreground",
2520
2556
  children: a.manualEntry.prompt
2521
2557
  }),
2522
- /* @__PURE__ */ k(Ye, {
2523
- activity: V,
2524
- questions: W,
2525
- docked: G,
2526
- pinUserMessages: !G
2558
+ /* @__PURE__ */ k(Xe, {
2559
+ activity: z,
2560
+ questions: H,
2561
+ docked: U,
2562
+ pinUserMessages: !U
2527
2563
  }),
2528
2564
  a.panelExtra && /* @__PURE__ */ k("div", {
2529
2565
  className: "mt-3",
2530
2566
  children: a.panelExtra
2531
2567
  }),
2532
- ee.length > 0 && /* @__PURE__ */ k(Ye, {
2533
- activity: ee,
2534
- questions: W,
2535
- docked: G,
2536
- pinUserMessages: !G
2568
+ ne.length > 0 && /* @__PURE__ */ k(Xe, {
2569
+ activity: ne,
2570
+ questions: H,
2571
+ docked: U,
2572
+ pinUserMessages: !U
2537
2573
  }),
2538
2574
  !a.agent.running && a.agent.error && /* @__PURE__ */ A("div", {
2539
2575
  className: "mt-2 flex items-center gap-2",
@@ -2557,8 +2593,8 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2557
2593
  variant: "secondary",
2558
2594
  className: "shrink-0",
2559
2595
  onClick: () => {
2560
- if (q) {
2561
- v(q.id, y);
2596
+ if (G) {
2597
+ v(G.id, y);
2562
2598
  return;
2563
2599
  }
2564
2600
  let e = a.agent.runFallback();
@@ -2567,13 +2603,13 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2567
2603
  })
2568
2604
  ]
2569
2605
  })
2570
- ] }) : d.length > 0 ? /* @__PURE__ */ k(Ut, { messages: d }) : u ? /* @__PURE__ */ k(Ht, { card: u }) : /* @__PURE__ */ k("p", {
2606
+ ] }) : d.length > 0 ? /* @__PURE__ */ k(Wt, { messages: d }) : u ? /* @__PURE__ */ k(Ut, { card: u }) : /* @__PURE__ */ k("p", {
2571
2607
  className: "text-xs text-muted-foreground",
2572
2608
  children: l ?? j.orchestratorStarterHint
2573
2609
  })
2574
2610
  })
2575
2611
  }),
2576
- a && G ? /* @__PURE__ */ A("section", {
2612
+ a && U ? /* @__PURE__ */ A("section", {
2577
2613
  "aria-label": j.pendingQuestions,
2578
2614
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
2579
2615
  children: [
@@ -2583,12 +2619,12 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2583
2619
  }),
2584
2620
  /* @__PURE__ */ k("div", {
2585
2621
  className: "min-h-0 overflow-y-auto px-4 py-3",
2586
- children: /* @__PURE__ */ k(Ke, {
2587
- entry: G.entry,
2588
- part: G.part,
2589
- questions: W,
2622
+ children: /* @__PURE__ */ k(qe, {
2623
+ entry: U.entry,
2624
+ part: U.part,
2625
+ questions: H,
2590
2626
  autoFocus: !0
2591
- }, `${G.entry.id}:${G.part.id}`)
2627
+ }, `${U.entry.id}:${U.part.id}`)
2592
2628
  }),
2593
2629
  a.agent.running && /* @__PURE__ */ k("div", {
2594
2630
  className: "flex shrink-0 justify-end px-4 pb-3",
@@ -2605,27 +2641,27 @@ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2605
2641
  children: [a?.panelActions && /* @__PURE__ */ k("div", {
2606
2642
  className: "mb-2",
2607
2643
  children: a.panelActions
2608
- }), a ? /* @__PURE__ */ k(zt, { task: a }, a.id) : /* @__PURE__ */ k(Bt, {})]
2644
+ }), a ? /* @__PURE__ */ k(Bt, { task: a }, a.id) : /* @__PURE__ */ k(Vt, {})]
2609
2645
  })
2610
2646
  ]
2611
2647
  })
2612
2648
  ] }) : /* @__PURE__ */ A(O, { children: [
2613
- ne,
2614
2649
  ie,
2615
- oe,
2616
- ce,
2617
- X
2650
+ ae,
2651
+ se,
2652
+ Y,
2653
+ le
2618
2654
  ] });
2619
2655
  }
2620
2656
  //#endregion
2621
2657
  //#region src/presentation/useAgenticoPageContext.ts
2622
- function Kt(e, t) {
2658
+ function qt(e, t) {
2623
2659
  let { setPageContext: n } = $(), r = E(crypto.randomUUID()).current;
2624
2660
  C(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2625
2661
  }
2626
2662
  //#endregion
2627
2663
  //#region src/presentation/useSubagentComponentContext.ts
2628
- function qt(e, t, n, r, i = !0, a) {
2664
+ function Jt(e, t, n, r, i = !0, a) {
2629
2665
  let { registerComponentAnchor: o } = $(), s = E(crypto.randomUUID()).current, c = E(n);
2630
2666
  c.current = n, C(() => {
2631
2667
  if (i) return o(s, {
@@ -2644,6 +2680,6 @@ function qt(e, t, n, r, i = !0, a) {
2644
2680
  ]);
2645
2681
  }
2646
2682
  //#endregion
2647
- export { Qe as AGENTICO_MAX_WIDTH, Ze as AGENTICO_MIN_WIDTH, Xe as AGENTICO_WIDTH, $e as AGENTICO_WIDTH_STORAGE_KEY, Gt as Agentico, Pe as AgenticoProvider, st as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, fe as JSON_EXPORT_DESTINATION_ID, le as MICRO_PROMPT_REGISTRY, Me as ORCHESTRATOR_TASK_ID, ce as SUMMARY_MICRO_PROMPT, Oe as agenticoDe, ke as agenticoEn, Ae as agenticoIt, K as agenticoPromptsEn, q as agenticoPromptsIt, je as agenticoTranslations, X as applyMicroPrompts, te as configureAgenticoPrompts, ve as configureEntityChatStore, H as createCrossAgentTools, I as defineSubagent, De as entityChatTaskId, Z as extractErrorMessage, ue as extractJsonBlock, B as findSubagentManifest, F as formatQuestionAnswers, Y as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, Nt as getSubagentControls, z as getSubagentRegistry, Ot as getSubagentReport, pe as jsonExportDestination, Ee as listEntityChats, P as messagePartsText, ee as registerCrossAgentTools, he as registerDestinations, Mt as registerSubagentControls, Dt as registerSubagentReports, R as registerSubagents, Te as removeEntityChat, se as renderRegistryCli, oe as renderSubagentCli, ne as resetAgenticoPrompts, we as saveEntityChat, U as toJsonSchema, W as toMcpTool, N as upsertMessagePart, vt as useAgent, $ as useAgentico, Q as useAgenticoI18n, Kt as useAgenticoPageContext, qt as useSubagentComponentContext };
2683
+ export { $e as AGENTICO_MAX_WIDTH, Qe as AGENTICO_MIN_WIDTH, Ze as AGENTICO_WIDTH, et as AGENTICO_WIDTH_STORAGE_KEY, Kt as Agentico, Fe as AgenticoProvider, ct as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, pe as JSON_EXPORT_DESTINATION_ID, X as MICRO_PROMPT_REGISTRY, Ne as ORCHESTRATOR_TASK_ID, Y as SUMMARY_MICRO_PROMPT, ke as agenticoDe, Ae as agenticoEn, je as agenticoIt, W as agenticoPromptsEn, G as agenticoPromptsIt, Me as agenticoTranslations, le as applyMicroPrompts, Te as chatStartedAt, re as configureAgenticoPrompts, ve as configureEntityChatStore, B as createCrossAgentTools, te as defineSubagent, Oe as entityChatTaskId, ue as extractErrorMessage, de as extractJsonBlock, R as findSubagentManifest, P as formatQuestionAnswers, q as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, Pt as getSubagentControls, L as getSubagentRegistry, kt as getSubagentReport, Z as jsonExportDestination, De as listEntityChats, N as messagePartsText, ne as registerCrossAgentTools, he as registerDestinations, Nt as registerSubagentControls, Ot as registerSubagentReports, I as registerSubagents, Ee as removeEntityChat, ce as renderRegistryCli, se as renderSubagentCli, ie as resetAgenticoPrompts, we as saveEntityChat, V as toJsonSchema, H as toMcpTool, ee as upsertMessagePart, yt as useAgent, $ as useAgentico, Q as useAgenticoI18n, qt as useAgenticoPageContext, Jt as useSubagentComponentContext };
2648
2684
 
2649
2685
  //# sourceMappingURL=index.mjs.map