@llmnative/agentico 0.9.0 → 0.10.0

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