@llmnative/agentico 0.2.0 → 0.4.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,53 +1,72 @@
1
1
  import { zodToJsonSchema as e } from "zod-to-json-schema";
2
- import { ActionButton as t, Badge as n, Chatbot as r, Code as i, Dropdown as a, DropdownItem as o, Icon as s, PromptUtils as c, getAIModelCatalog as l, interpolate as u, parseAIModelRef as d, proxyFetch as f, useAIProviderRegistry as p, useI18n as m, useProxy as h } from "@llmnative/react";
3
- import g, { createContext as _, useCallback as v, useContext as y, useEffect as b, useLayoutEffect as x, useMemo as S, useRef as C, useState as w } from "react";
4
- import { Fragment as T, jsx as E, jsxs as D } 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, 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";
5
+ //#region src/domain/messageParts.ts
6
+ var j = "text", M = "reasoning";
7
+ function N(e, t, n) {
8
+ let r = e.findIndex((e) => e.type === t.type && e.id === t.id);
9
+ if (r >= 0) return e.map((e, n) => n === r ? t : e);
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");
11
+ return (t.type === "tool" || t.type === "reasoning") && a >= 0 ? [
12
+ ...i.slice(0, a),
13
+ t,
14
+ ...i.slice(a)
15
+ ] : [...i, t];
16
+ }
17
+ function P(e) {
18
+ return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
19
+ }
20
+ function F(e, t) {
21
+ return t.map((t, n) => `${t.header ?? e[n]?.header ?? e[n]?.question ?? t.id ?? `${n + 1}`}: ${t.values.join(", ")}`).join("\n");
22
+ }
23
+ //#endregion
5
24
  //#region src/domain/defineSubagent.ts
6
- function O(e) {
25
+ function I(e) {
7
26
  return e;
8
27
  }
9
28
  //#endregion
10
29
  //#region src/domain/subagentRegistry.ts
11
- var k = [];
12
- function A(e) {
13
- k = e;
30
+ var L = [];
31
+ function R(e) {
32
+ L = e;
14
33
  }
15
- function j() {
16
- return k.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), k;
34
+ function z() {
35
+ return L.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), L;
17
36
  }
18
- function M(e) {
19
- return k.find((t) => t.id === e);
37
+ function B(e) {
38
+ return L.find((t) => t.id === e);
20
39
  }
21
40
  //#endregion
22
41
  //#region src/domain/crossAgentTools.ts
23
- var N = [];
24
- function P(...e) {
25
- N = e;
42
+ var V = [];
43
+ function H(...e) {
44
+ V = e;
26
45
  }
27
- function F(e) {
28
- return N.flatMap((t) => t(e));
46
+ function U(e) {
47
+ return V.flatMap((t) => t(e));
29
48
  }
30
49
  //#endregion
31
50
  //#region src/domain/mcpTool.ts
32
- function I(t) {
51
+ function W(t) {
33
52
  let { $schema: n, ...r } = e(t, {
34
53
  target: "jsonSchema7",
35
54
  $refStrategy: "none"
36
55
  });
37
56
  return r;
38
57
  }
39
- function L(e, t, n, r) {
58
+ function G(e, t, n, r) {
40
59
  return {
41
60
  name: e,
42
61
  description: t,
43
- inputSchema: I(n),
44
- ...r ? { outputSchema: I(r) } : {}
62
+ inputSchema: W(n),
63
+ ...r ? { outputSchema: W(r) } : {}
45
64
  };
46
65
  }
47
66
  //#endregion
48
67
  //#region src/domain/subagentUsageCard.ts
49
- function R(e) {
50
- let t = I(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function K(e) {
69
+ let t = W(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
51
70
  return Object.entries(n).map(([t, n]) => {
52
71
  let i = typeof n.description == "string" ? n.description : "";
53
72
  return {
@@ -61,7 +80,7 @@ function R(e) {
61
80
  }
62
81
  //#endregion
63
82
  //#region src/domain/prompts.ts
64
- var z = {
83
+ var q = {
65
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.",
66
85
  responseRules: [
67
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.",
@@ -89,7 +108,7 @@ var z = {
89
108
  "block requested above, never before it and never instead of it."
90
109
  ].join(" "),
91
110
  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."
92
- }, B = {
111
+ }, ee = {
93
112
  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.",
94
113
  responseRules: [
95
114
  "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.",
@@ -117,26 +136,26 @@ var z = {
117
136
  "richiesto sopra, mai prima e mai al posto suo."
118
137
  ].join(" "),
119
138
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
120
- }, V = z;
121
- function H(e) {
122
- V = {
123
- ...V,
139
+ }, J = q;
140
+ function te(e) {
141
+ J = {
142
+ ...J,
124
143
  ...e
125
144
  };
126
145
  }
127
- function U() {
128
- return V;
146
+ function Y() {
147
+ return J;
129
148
  }
130
- function W() {
131
- V = z;
149
+ function ne() {
150
+ J = q;
132
151
  }
133
152
  //#endregion
134
153
  //#region src/domain/cli/renderManifestCli.ts
135
- function ee(e, t) {
154
+ function re(e, t) {
136
155
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
137
156
  }
138
- function G(e, t) {
139
- let n = R(t), r = ee(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
157
+ function ie(e, t) {
158
+ let n = K(t), r = re(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
140
159
  return [
141
160
  `COMMAND: ${e} ${t.name}`,
142
161
  ` ${t.summary}`,
@@ -148,46 +167,46 @@ function G(e, t) {
148
167
  ...i,
149
168
  "",
150
169
  " OUTPUT",
151
- K(t.describeOutput(), 4),
170
+ ae(t.describeOutput(), 4),
152
171
  (t.example, ""),
153
172
  t.example ? " EXAMPLE" : "",
154
173
  t.example ? ` ${t.example}` : ""
155
174
  ].filter((e) => e !== "").join("\n");
156
175
  }
157
- function K(e, t) {
176
+ function ae(e, t) {
158
177
  let n = " ".repeat(t);
159
178
  return e.split("\n").map((e) => e && n + e).join("\n");
160
179
  }
161
- function te(e) {
180
+ function oe(e) {
162
181
  return [
163
182
  "NAME",
164
183
  ` ${e.id} — ${e.label}`,
165
184
  "",
166
185
  "DESCRIPTION",
167
- K(e.description, 2),
186
+ ae(e.description, 2),
168
187
  "",
169
- ...e.commands.map((t) => G(e.id, t))
188
+ ...e.commands.map((t) => ie(e.id, t))
170
189
  ].join("\n");
171
190
  }
172
- function ne(e) {
173
- return e.length === 0 ? U().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
191
+ function se(e) {
192
+ return e.length === 0 ? Y().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
174
193
  }
175
194
  //#endregion
176
195
  //#region src/domain/microPrompts.ts
177
- var q = {
196
+ var ce = {
178
197
  id: "closing-summary",
179
198
  get text() {
180
- return U().closingSummary;
199
+ return Y().closingSummary;
181
200
  }
182
- }, re = { [q.id]: q };
183
- function J(e, t) {
201
+ }, le = { [ce.id]: ce };
202
+ function X(e, t) {
184
203
  if (!t || t.length === 0) return e;
185
- let n = t.map((e) => re[e]?.text).filter((e) => !!e);
204
+ let n = t.map((e) => le[e]?.text).filter((e) => !!e);
186
205
  return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
187
206
  }
188
207
  //#endregion
189
208
  //#region src/domain/extractErrorMessage.ts
190
- function Y(e) {
209
+ function Z(e) {
191
210
  if (e instanceof Error) return e.message;
192
211
  if (typeof e == "object" && e) {
193
212
  let t = e;
@@ -206,13 +225,13 @@ function Y(e) {
206
225
  }
207
226
  //#endregion
208
227
  //#region src/domain/extractJsonBlock.ts
209
- function ie(e) {
228
+ function ue(e) {
210
229
  let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
211
230
  if (t) return t[1].trim();
212
231
  let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
213
- return ae(n) ?? n;
232
+ return de(n) ?? n;
214
233
  }
215
- function ae(e) {
234
+ function de(e) {
216
235
  let t = e.search(/[{[]/);
217
236
  if (t === -1) return null;
218
237
  let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
@@ -233,8 +252,8 @@ function ae(e) {
233
252
  }
234
253
  //#endregion
235
254
  //#region src/domain/jsonExportDestination.ts
236
- var oe = "json-export", X = {
237
- id: oe,
255
+ var fe = "json-export", pe = {
256
+ id: fe,
238
257
  label: "Export as JSON",
239
258
  async apply(e) {
240
259
  let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
@@ -245,23 +264,23 @@ var oe = "json-export", X = {
245
264
  URL.revokeObjectURL(n);
246
265
  }
247
266
  }
248
- }, se = {};
249
- function ce(e) {
250
- se = e;
267
+ }, me = {};
268
+ function he(e) {
269
+ me = e;
251
270
  }
252
- function le() {
271
+ function ge() {
253
272
  return {
254
- [X.id]: X,
255
- ...se
273
+ [pe.id]: pe,
274
+ ...me
256
275
  };
257
276
  }
258
277
  //#endregion
259
278
  //#region src/domain/entityChatStore.ts
260
- var ue = "llmnative.agentico.entityChat";
261
- function de(e) {
262
- ue = e.storageKey;
279
+ var _e = "llmnative.agentico.entityChat";
280
+ function ve(e) {
281
+ _e = e.storageKey;
263
282
  }
264
- function fe(e) {
283
+ function ye(e) {
265
284
  if (!e || typeof e != "object") return null;
266
285
  let t = e;
267
286
  if (typeof t.entityId != "string") return null;
@@ -273,41 +292,41 @@ function fe(e) {
273
292
  scopeId: n
274
293
  };
275
294
  }
276
- function pe() {
295
+ function be() {
277
296
  try {
278
- let e = localStorage.getItem(ue);
297
+ let e = localStorage.getItem(_e);
279
298
  if (!e) return [];
280
299
  let t = JSON.parse(e);
281
- return Array.isArray(t) ? t.map(fe).filter((e) => e !== null) : [];
300
+ return Array.isArray(t) ? t.map(ye).filter((e) => e !== null) : [];
282
301
  } catch {
283
302
  return [];
284
303
  }
285
304
  }
286
- function me(e) {
305
+ function xe(e) {
287
306
  try {
288
- localStorage.setItem(ue, JSON.stringify(e));
307
+ localStorage.setItem(_e, JSON.stringify(e));
289
308
  } catch {}
290
309
  }
291
- var Z = (e, t, n) => `${e}:${t}:${n}`;
292
- function he(e, t, n) {
293
- let r = Z(e, t, n);
294
- return pe().find((e) => Z(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
310
+ var Se = (e, t, n) => `${e}:${t}:${n}`;
311
+ function Ce(e, t, n) {
312
+ let r = Se(e, t, n);
313
+ return be().find((e) => Se(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
295
314
  }
296
- function ge(e) {
297
- let t = Z(e.scopeId, e.subagentId, e.entityId), n = pe().filter((e) => Z(e.scopeId, e.subagentId, e.entityId) !== t);
315
+ function we(e) {
316
+ let t = Se(e.scopeId, e.subagentId, e.entityId), n = be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== t);
298
317
  n.push({
299
318
  ...e,
300
319
  savedAt: Date.now()
301
- }), me(n);
320
+ }), xe(n);
302
321
  }
303
- function _e(e, t, n) {
304
- let r = Z(e, t, n);
305
- me(pe().filter((e) => Z(e.scopeId, e.subagentId, e.entityId) !== r));
322
+ function Te(e, t, n) {
323
+ let r = Se(e, t, n);
324
+ xe(be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== r));
306
325
  }
307
- function ve(e) {
308
- return pe().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
326
+ function Ee(e) {
327
+ return be().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
309
328
  }
310
- var ye = (e, t) => `entitychat-${e}-${t}`, be = {
329
+ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
311
330
  modelLabel: "Modell",
312
331
  modelsLoading: "Wird geladen…",
313
332
  noModelsAvailable: "Keine Modelle verfügbar",
@@ -337,6 +356,9 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
337
356
  tooManyToolTurns: "Zu viele aufeinanderfolgende Werkzeugaufrufe — das bisher gesammelte deterministische Ergebnis wird verwendet.",
338
357
  aiDisabledFallback: "AI deaktiviert — das deterministische Ergebnis wird verwendet.",
339
358
  continueWithoutAiFallback: "Weiter ohne AI — das deterministische Ergebnis wird verwendet.",
359
+ oneStep: "1 Schritt",
360
+ steps: "{count} Schritte",
361
+ stepsLabel: "Schritte des Agenten",
340
362
  newInstance: "Neue Instanz von \"{label}\"",
341
363
  chatHistory: "Chatverlauf",
342
364
  newChat: "Neuer Chat",
@@ -351,8 +373,12 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
351
373
  continueWithoutAi: "Ohne AI fortfahren",
352
374
  resumeWithAi: "Mit AI fortsetzen",
353
375
  openPanel: "Agentenbereich öffnen",
354
- closePanel: "Agentenbereich schließen"
355
- }, xe = {
376
+ closePanel: "Agentenbereich schließen",
377
+ resizePanel: "Agent-Bereich in der Größe ändern",
378
+ resizePanelHint: "Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",
379
+ pendingQuestions: "Fragen des Agenten",
380
+ stop: "Stoppen"
381
+ }, ke = {
356
382
  modelLabel: "Model",
357
383
  modelsLoading: "Loading…",
358
384
  noModelsAvailable: "No models available",
@@ -382,6 +408,9 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
382
408
  tooManyToolTurns: "Too many consecutive tool-calling turns — using the deterministic result collected so far.",
383
409
  aiDisabledFallback: "AI disabled — using the deterministic result.",
384
410
  continueWithoutAiFallback: "Continuing without AI — using the deterministic result.",
411
+ oneStep: "1 step",
412
+ steps: "{count} steps",
413
+ stepsLabel: "Steps of the agent",
385
414
  newInstance: "New \"{label}\" instance",
386
415
  chatHistory: "Chat history",
387
416
  newChat: "New chat",
@@ -396,8 +425,12 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
396
425
  continueWithoutAi: "Continue without AI",
397
426
  resumeWithAi: "Resume with AI",
398
427
  openPanel: "Open agent panel",
399
- closePanel: "Close agent panel"
400
- }, Se = {
428
+ closePanel: "Close agent panel",
429
+ resizePanel: "Resize the agent panel",
430
+ resizePanelHint: "Drag to resize, double-click to reset",
431
+ pendingQuestions: "Questions of the agent",
432
+ stop: "Stop"
433
+ }, Ae = {
401
434
  modelLabel: "Modello",
402
435
  modelsLoading: "Caricamento…",
403
436
  noModelsAvailable: "Nessun modello disponibile",
@@ -427,6 +460,9 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
427
460
  tooManyToolTurns: "Troppi turni di tool-calling consecutivi — uso il risultato deterministico raccolto finora.",
428
461
  aiDisabledFallback: "AI disabilitata — uso il risultato deterministico.",
429
462
  continueWithoutAiFallback: "Continuo senza AI — uso il risultato deterministico.",
463
+ oneStep: "1 passo",
464
+ steps: "{count} passi",
465
+ stepsLabel: "Passi dell'agente",
430
466
  newInstance: "Nuova istanza di \"{label}\"",
431
467
  chatHistory: "Storico chat",
432
468
  newChat: "Nuova chat",
@@ -441,28 +477,32 @@ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
441
477
  continueWithoutAi: "Continua senza AI",
442
478
  resumeWithAi: "Riprendi con AI",
443
479
  openPanel: "Apri pannello agente",
444
- closePanel: "Chiudi pannello agente"
445
- }, Ce = {
446
- en: { agentico: xe },
447
- it: { agentico: Se },
448
- de: { agentico: be }
480
+ closePanel: "Chiudi pannello agente",
481
+ resizePanel: "Ridimensiona il pannello dell'agente",
482
+ resizePanelHint: "Trascina per ridimensionare, doppio clic per ripristinare",
483
+ pendingQuestions: "Domande dell'agente",
484
+ stop: "Ferma"
485
+ }, je = {
486
+ en: { agentico: ke },
487
+ it: { agentico: Ae },
488
+ de: { agentico: Oe }
449
489
  };
450
490
  function Q() {
451
- let { dict: e } = m(), t = e.agentico;
491
+ let { dict: e } = v(), t = e.agentico;
452
492
  return t ? {
453
- ...xe,
493
+ ...ke,
454
494
  ...t
455
- } : xe;
495
+ } : ke;
456
496
  }
457
497
  //#endregion
458
498
  //#region src/presentation/AgenticoContext.tsx
459
- var we = "agentico-orchestrator", Te = _(null);
460
- function Ee({ children: e, scope: t = null }) {
461
- let [n, r] = w(null), i = C(null);
462
- b(() => {
499
+ var Me = "agentico-orchestrator", Ne = b(null);
500
+ function Pe({ children: e, scope: t = null }) {
501
+ let [n, r] = D(null), i = E(null);
502
+ C(() => {
463
503
  i.current = n;
464
504
  }, [n]);
465
- let [a, o] = w(!1), s = v((e) => {
505
+ let [a, o] = D(!1), s = x((e) => {
466
506
  let t = i.current;
467
507
  t && t.id !== e.id && t.onDismiss();
468
508
  let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
@@ -470,10 +510,10 @@ function Ee({ children: e, scope: t = null }) {
470
510
  savedToDisk: !0
471
511
  } : e;
472
512
  r(n);
473
- }, []), c = v((e) => {
513
+ }, []), c = x((e) => {
474
514
  r((t) => t && t.id === e ? null : t);
475
- }, []), l = v(() => o((e) => !e), []), u = v(() => o(!0), []), [d, f] = w(null), [p, m] = w(void 0), [h, g] = w(void 0), [_, y] = w(void 0), [x, T] = w(null), [D, O] = w(null), [k, A] = w(void 0), [j, N] = w([]), P = v((e, t, n = null) => {
476
- N((r) => {
515
+ }, []), l = x(() => o((e) => !e), []), u = x(() => o(!0), []), [d, f] = D(null), [p, m] = D(void 0), [h, g] = D(void 0), [_, v] = D(void 0), [y, b] = D(null), [S, w] = D(null), [O, A] = D(void 0), [j, M] = D([]), N = x((e, t, n = null) => {
516
+ M((r) => {
477
517
  let i = r.filter((t) => t.id !== e);
478
518
  return t ? [...i, {
479
519
  id: e,
@@ -481,30 +521,30 @@ function Ee({ children: e, scope: t = null }) {
481
521
  card: n
482
522
  }] : i;
483
523
  });
484
- }, []), F = j.length > 0 ? j[j.length - 1] : null, [I, L] = w([]), R = v((e, t) => {
485
- L((n) => {
524
+ }, []), P = j.length > 0 ? j[j.length - 1] : null, [F, I] = D([]), L = x((e, t) => {
525
+ I((n) => {
486
526
  let r = n.filter((t) => t.id !== e);
487
527
  return t ? [...r, {
488
528
  id: e,
489
529
  ...t
490
530
  }] : r;
491
531
  });
492
- }, []), z = S(() => I.map((e) => ({
532
+ }, []), R = T(() => F.map((e) => ({
493
533
  subagentId: e.subagentId,
494
534
  componentKey: e.componentKey,
495
535
  onResult: e.onResult,
496
536
  pinnedEntityId: e.pinnedEntityId
497
- })), [I]), B = S(() => {
537
+ })), [F]), z = T(() => {
498
538
  let e = /* @__PURE__ */ new Map();
499
- for (let t of I) e.set(t.subagentId, {
539
+ for (let t of F) e.set(t.subagentId, {
500
540
  subagentId: t.subagentId,
501
541
  componentKey: t.componentKey,
502
542
  onResult: t.onResult,
503
543
  contextInfo: t.contextInfo
504
544
  });
505
545
  return [...e.values()];
506
- }, [I]), V = S(() => B.map((e) => {
507
- let t = M(e.subagentId)?.componentContexts?.[e.componentKey];
546
+ }, [F]), V = T(() => z.map((e) => {
547
+ let t = B(e.subagentId)?.componentContexts?.[e.componentKey];
508
548
  if (!t) return null;
509
549
  let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
510
550
  return {
@@ -512,26 +552,26 @@ function Ee({ children: e, scope: t = null }) {
512
552
  agenticoHint: n,
513
553
  userMessage: t.userMessage
514
554
  };
515
- }).filter((e) => e !== null), [B]), H = S(() => V.map((e) => e.userMessage), [V]), W = S(() => {
555
+ }).filter((e) => e !== null), [z]), H = T(() => V.map((e) => e.userMessage), [V]), U = T(() => {
516
556
  if (V.length === 0) return null;
517
557
  if (V.length === 1) return V[0].agenticoHint;
518
558
  let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
519
- return `${U().multipleCandidates}\n\n${e}`;
520
- }, [V]) ?? F?.text ?? null, ee = V.length > 0 ? null : F?.card ?? null, G = S(() => [...new Set(z.map((e) => e.subagentId))], [z]), K = G.length === 1 ? G[0] : G.length === 0 ? F?.card?.subagentId ?? null : null, te = v((e, t) => {
559
+ return `${Y().multipleCandidates}\n\n${e}`;
560
+ }, [V]) ?? P?.text ?? null, W = V.length > 0 ? null : P?.card ?? null, G = T(() => [...new Set(R.map((e) => e.subagentId))], [R]), K = G.length === 1 ? G[0] : G.length === 0 ? P?.card?.subagentId ?? null : null, q = x((e, t) => {
521
561
  u();
522
562
  let n = i.current;
523
563
  if (n?.id === "agentico-orchestrator") return;
524
564
  let r = K && n?.id.startsWith(`subagent-${K}-`) ? n : void 0;
525
- O(r ? {
565
+ w(r ? {
526
566
  taskId: r.id,
527
567
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
528
- } : null), f(e), m(t?.extraDestinations), g(t?.attachments), y(t?.model), A(t?.scopedSubagentId), T(crypto.randomUUID());
529
- }, [u, K]), ne = v((e, t, n, a, o, s) => {
568
+ } : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), A(t?.scopedSubagentId), b(crypto.randomUUID());
569
+ }, [u, K]), ee = x((e, t, n, a, o, s) => {
530
570
  if (!n || !a) return;
531
571
  let c = i.current;
532
572
  if (!c || c.id !== n) return;
533
573
  let l = c.agent.snapshot();
534
- l && (ge({
574
+ l && (we({
535
575
  scopeId: a,
536
576
  subagentId: e,
537
577
  entityId: t,
@@ -543,33 +583,33 @@ function Ee({ children: e, scope: t = null }) {
543
583
  ...e,
544
584
  savedToDisk: !0
545
585
  } : e));
546
- }, []), [q, re] = w(null), [J, Y] = w(null), ie = v((e, t, n) => {
547
- u(), re({
586
+ }, []), [J, te] = D(null), [ne, re] = D(null), ie = x((e, t, n) => {
587
+ u(), te({
548
588
  subagentId: e,
549
589
  entityId: t,
550
590
  snapshot: n
551
- }), Y(crypto.randomUUID());
552
- }, [u]), [ae, oe] = w(null), [X, se] = w(null), ce = v((e, t) => {
553
- u(), c(we), oe({
591
+ }), re(crypto.randomUUID());
592
+ }, [u]), [ae, oe] = D(null), [se, ce] = D(null), le = x((e, t) => {
593
+ u(), c(Me), oe({
554
594
  subagentId: e,
555
595
  extraDestinations: t
556
- }), se(crypto.randomUUID());
557
- }, [u, c]), [le, ue] = w(null), [de, fe] = w(null), pe = v((e, t, n) => {
558
- oe(null), ue({
596
+ }), ce(crypto.randomUUID());
597
+ }, [u, c]), [X, Z] = D(null), [ue, de] = D(null), fe = x((e, t, n) => {
598
+ oe(null), Z({
559
599
  subagentId: e,
560
600
  params: t,
561
601
  extraDestinations: n
562
- }), fe(crypto.randomUUID());
563
- }, []), [me, Z] = w(null), [he, _e] = w(null), ve = v((e, t, n) => {
564
- u(), Z({
602
+ }), de(crypto.randomUUID());
603
+ }, []), [pe, me] = D(null), [he, ge] = D(null), _e = x((e, t, n) => {
604
+ u(), me({
565
605
  subagentId: e,
566
606
  params: t,
567
607
  ...n
568
- }), _e(crypto.randomUUID());
569
- }, [u]), ye = v(() => {
608
+ }), ge(crypto.randomUUID());
609
+ }, [u]), ve = x(() => {
570
610
  let e = i.current;
571
611
  e && e.onDismiss();
572
- }, []), be = S(() => ({
612
+ }, []), ye = T(() => ({
573
613
  scope: t,
574
614
  task: n,
575
615
  isOpen: a,
@@ -577,34 +617,34 @@ function Ee({ children: e, scope: t = null }) {
577
617
  closeTask: c,
578
618
  toggleOpen: l,
579
619
  pendingGoal: d,
580
- startOrchestrator: te,
581
- pageContext: W,
582
- pageContextCard: ee,
583
- setPageContext: P,
620
+ startOrchestrator: q,
621
+ pageContext: U,
622
+ pageContextCard: W,
623
+ setPageContext: N,
584
624
  scopedSubagentId: K,
585
- pendingScopedSubagentId: k,
586
- componentAnchors: z,
625
+ pendingScopedSubagentId: O,
626
+ componentAnchors: R,
587
627
  anchoredUserMessages: H,
588
- registerComponentAnchor: R,
628
+ registerComponentAnchor: L,
589
629
  openPanel: u,
590
630
  pendingExtraDestinations: p,
591
631
  pendingAttachments: h,
592
632
  pendingModel: _,
593
- orchestratorRunId: x,
594
- pendingCarryOver: D,
595
- commitEntityChat: ne,
633
+ orchestratorRunId: y,
634
+ pendingCarryOver: S,
635
+ commitEntityChat: ee,
596
636
  resumeEntityChat: ie,
597
- pendingResume: q,
598
- resumeRunId: J,
599
- dismissForeignTask: ye,
637
+ pendingResume: J,
638
+ resumeRunId: ne,
639
+ dismissForeignTask: ve,
600
640
  pendingManualEntry: ae,
601
- manualEntryRunId: X,
602
- startManualEntry: ce,
603
- pendingResumeWithAI: le,
604
- resumeWithAIRunId: de,
605
- resumeWithAI: pe,
606
- startSubagent: ve,
607
- pendingStart: me,
641
+ manualEntryRunId: se,
642
+ startManualEntry: le,
643
+ pendingResumeWithAI: X,
644
+ resumeWithAIRunId: ue,
645
+ resumeWithAI: fe,
646
+ startSubagent: _e,
647
+ pendingStart: pe,
608
648
  startRunId: he
609
649
  }), [
610
650
  t,
@@ -614,49 +654,49 @@ function Ee({ children: e, scope: t = null }) {
614
654
  c,
615
655
  l,
616
656
  d,
617
- te,
657
+ q,
658
+ U,
618
659
  W,
619
- ee,
620
- P,
660
+ N,
621
661
  K,
622
- k,
623
- z,
624
- H,
662
+ O,
625
663
  R,
664
+ H,
665
+ L,
626
666
  u,
627
667
  p,
628
668
  h,
629
669
  _,
630
- x,
631
- D,
632
- ne,
670
+ y,
671
+ S,
672
+ ee,
633
673
  ie,
634
- q,
635
674
  J,
636
- ye,
675
+ ne,
676
+ ve,
637
677
  ae,
638
- X,
639
- ce,
678
+ se,
640
679
  le,
641
- de,
680
+ X,
681
+ ue,
682
+ fe,
683
+ _e,
642
684
  pe,
643
- ve,
644
- me,
645
685
  he
646
686
  ]);
647
- return /* @__PURE__ */ E(Te.Provider, {
648
- value: be,
687
+ return /* @__PURE__ */ k(Ne.Provider, {
688
+ value: ye,
649
689
  children: e
650
690
  });
651
691
  }
652
692
  function $() {
653
- let e = y(Te);
693
+ let e = S(Ne);
654
694
  if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
655
695
  return e;
656
696
  }
657
697
  //#endregion
658
698
  //#region src/presentation/AgentActivityLog.tsx
659
- function De(e) {
699
+ function Fe(e) {
660
700
  let t = e.search(/[{[]/);
661
701
  if (t === -1) return [{
662
702
  type: "text",
@@ -702,184 +742,372 @@ function De(e) {
702
742
  language: "json"
703
743
  });
704
744
  let u = e.slice(s + 1);
705
- return u.trim() && l.push(...De(u)), l;
745
+ return u.trim() && l.push(...Fe(u)), l;
706
746
  }
707
- function Oe(e) {
747
+ function Ie(e) {
708
748
  let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
709
- for (; i = n.exec(e);) i.index > r && t.push(...De(e.slice(r, i.index))), t.push({
749
+ for (; i = n.exec(e);) i.index > r && t.push(...Fe(e.slice(r, i.index))), t.push({
710
750
  type: "code",
711
751
  content: i[2].replace(/\n$/, ""),
712
752
  language: i[1]
713
753
  }), r = n.lastIndex;
714
- return r < e.length && t.push(...De(e.slice(r))), t;
754
+ return r < e.length && t.push(...Fe(e.slice(r))), t;
715
755
  }
716
- function ke({ content: e, language: t }) {
717
- let [n, r] = w(!1);
718
- return /* @__PURE__ */ D("div", {
756
+ function Le({ content: e, language: t }) {
757
+ let [n, r] = D(!1);
758
+ return /* @__PURE__ */ A("div", {
719
759
  className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
720
760
  onClick: () => r((e) => !e),
721
761
  title: n ? "Clic per comprimere" : "Clic per espandere",
722
- children: [/* @__PURE__ */ E(i, {
762
+ children: [/* @__PURE__ */ k(s, {
723
763
  language: t,
724
764
  showCopy: n,
725
765
  background: "transparent",
726
766
  className: "!text-[11px]",
727
767
  children: e
728
- }), !n && /* @__PURE__ */ E("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
768
+ }), !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" })]
729
769
  });
730
770
  }
731
- function Ae(e) {
732
- let t = [], n = /\*\*(.+?)\*\*|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)/g, r = 0, i;
733
- for (; i = n.exec(e);) i.index > r && t.push({
734
- type: "text",
735
- content: e.slice(r, i.index)
736
- }), i[1] === void 0 ? i[2] === void 0 ? i[3] !== void 0 && t.push({
737
- type: "link",
738
- content: i[3],
739
- href: i[4]
740
- }) : t.push({
741
- type: "code",
742
- content: i[2]
743
- }) : t.push({
744
- type: "bold",
745
- content: i[1]
746
- }), r = n.lastIndex;
747
- return r < e.length && t.push({
748
- type: "text",
749
- content: e.slice(r)
750
- }), t;
751
- }
752
- function je({ text: e }) {
753
- return /* @__PURE__ */ E(T, { children: Ae(e).map((e, t) => e.type === "bold" ? /* @__PURE__ */ E("strong", {
754
- className: "font-semibold text-foreground",
755
- children: e.content
756
- }, t) : e.type === "code" ? /* @__PURE__ */ E("code", {
757
- className: "rounded bg-muted px-1 py-0.5 font-mono text-[11px] break-words",
758
- children: e.content
759
- }, t) : e.type === "link" ? /* @__PURE__ */ E("a", {
760
- href: e.href,
761
- target: "_blank",
762
- rel: "noreferrer",
763
- className: "text-primary underline underline-offset-2",
764
- children: e.content
765
- }, t) : /* @__PURE__ */ E(g.Fragment, { children: e.content }, t)) });
766
- }
767
- function Me({ text: e }) {
768
- let t = Oe(e);
769
- return /* @__PURE__ */ E(T, { children: t.map((e, t) => e.type === "code" ? /* @__PURE__ */ E(ke, {
771
+ function Re({ text: e, tone: t }) {
772
+ let n = Ie(e);
773
+ return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(Le, {
770
774
  content: e.content,
771
775
  language: e.language
772
- }, t) : e.content.trim() && /* @__PURE__ */ E("p", {
773
- className: "whitespace-pre-wrap break-words",
774
- children: /* @__PURE__ */ E(je, { text: e.content })
775
- }, t)) });
776
- }
777
- function Ne({ status: e }) {
778
- return e === "running" ? /* @__PURE__ */ E("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ E(s, {
776
+ }, n) : e.content.trim() && /* @__PURE__ */ k(r, {
777
+ content: e.content.trim(),
778
+ tone: t,
779
+ className: "break-words text-xs leading-relaxed"
780
+ }, n)) });
781
+ }
782
+ function ze({ status: e }) {
783
+ 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, {
779
784
  name: "check",
780
785
  size: 12,
781
786
  className: "shrink-0 text-green-600"
782
- }) : e === "stopped" ? /* @__PURE__ */ E(s, {
787
+ }) : e === "stopped" ? /* @__PURE__ */ k(u, {
783
788
  name: "circle-slash",
784
789
  size: 12,
785
790
  className: "shrink-0 text-muted-foreground"
786
- }) : /* @__PURE__ */ E(s, {
791
+ }) : /* @__PURE__ */ k(u, {
787
792
  name: "x",
788
793
  size: 12,
789
794
  className: "shrink-0 text-destructive"
790
795
  });
791
796
  }
792
- function Pe(e, t) {
797
+ function Be(e, t) {
793
798
  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;
794
799
  }
795
- var Fe = 96;
796
- function Ie({ entry: e }) {
797
- let t = C(null), [n, r] = w(!1), [i, a] = w(!1);
798
- x(() => {
799
- let e = t.current;
800
- e && a(e.scrollHeight > 97);
800
+ var Ve = 96;
801
+ function He({ entry: e, pinned: t = !0 }) {
802
+ let n = E(null), [r, i] = D(!1), [a, o] = D(!1);
803
+ w(() => {
804
+ let e = n.current;
805
+ e && o(e.scrollHeight > 97);
801
806
  }, [e.detail, e.attachmentNames]);
802
- let o = i && !n;
803
- return /* @__PURE__ */ E("li", {
804
- className: "sticky top-0 z-10 flex justify-end border-b border-border/40 bg-background py-1.5",
805
- children: /* @__PURE__ */ D("div", {
807
+ let s = a && !r;
808
+ return /* @__PURE__ */ k("div", {
809
+ className: `${t ? "sticky top-0 z-20 border-b border-border/40" : ""} flex justify-end bg-background py-1.5`,
810
+ children: /* @__PURE__ */ A("div", {
806
811
  className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
807
- children: [/* @__PURE__ */ D("div", {
808
- ref: t,
809
- className: `space-y-1 px-2.5 pt-1.5 ${o ? "overflow-hidden" : ""}`,
810
- style: o ? { maxHeight: Fe } : void 0,
811
- children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ E("div", {
812
+ children: [/* @__PURE__ */ A("div", {
813
+ ref: n,
814
+ className: `space-y-1 px-2.5 pt-1.5 ${s ? "overflow-hidden" : ""}`,
815
+ style: s ? { maxHeight: Ve } : void 0,
816
+ children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ k("div", {
812
817
  className: "flex flex-wrap gap-1",
813
- children: e.attachmentNames.map((e, t) => /* @__PURE__ */ D("span", {
818
+ children: e.attachmentNames.map((e, t) => /* @__PURE__ */ A("span", {
814
819
  className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
815
- children: [/* @__PURE__ */ E(s, {
820
+ children: [/* @__PURE__ */ k(u, {
816
821
  name: "paperclip",
817
822
  size: 10,
818
823
  className: "shrink-0"
819
- }), /* @__PURE__ */ E("span", {
824
+ }), /* @__PURE__ */ k("span", {
820
825
  className: "max-w-[160px] truncate",
821
826
  children: e
822
827
  })]
823
828
  }, t))
824
- }), /* @__PURE__ */ E(Me, { text: e.detail ?? "" })]
825
- }), i && /* @__PURE__ */ D("button", {
829
+ }), /* @__PURE__ */ k(Re, { text: e.detail ?? "" })]
830
+ }), a && /* @__PURE__ */ A("button", {
826
831
  type: "button",
827
- onClick: () => r((e) => !e),
832
+ onClick: () => i((e) => !e),
828
833
  className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
829
- title: n ? "Comprimi" : "Espandi",
830
- children: [o && /* @__PURE__ */ E("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ E(s, {
831
- name: n ? "chevron-up" : "chevron-down",
834
+ title: r ? "Comprimi" : "Espandi",
835
+ 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, {
836
+ name: r ? "chevron-up" : "chevron-down",
832
837
  size: 12
833
838
  })]
834
839
  })]
835
840
  })
836
841
  });
837
842
  }
838
- function Le({ entry: e }) {
839
- let t = Q();
840
- if (e.kind === "user") return /* @__PURE__ */ E(Ie, { entry: e });
841
- let n = e.kind === "thinking" && e.detail ? Oe(e.detail) : [], r = n.filter((e) => e.type === "code"), i = n.filter((e) => e.type === "text" && e.content.trim()), a = e.kind === "thinking" ? Pe(e, t) : e.label;
842
- return /* @__PURE__ */ D("li", {
843
+ var Ue = {
844
+ running: "loader-circle",
845
+ done: "check",
846
+ error: "x",
847
+ stopped: "circle-slash"
848
+ };
849
+ function We({ steps: e }) {
850
+ 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 }));
851
+ return /* @__PURE__ */ k(f, {
852
+ ariaLabel: t.stepsLabel,
853
+ selectedId: null,
854
+ itemClassName: "py-0.5 text-xs text-muted-foreground",
855
+ nodes: [{
856
+ id: `steps-${e[0]?.id ?? ""}`,
857
+ label: i,
858
+ icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
859
+ children: e.map((e) => ({
860
+ id: e.id,
861
+ label: /* @__PURE__ */ k("span", {
862
+ className: e.status === "error" ? "text-destructive" : void 0,
863
+ children: e.label
864
+ }),
865
+ icon: Ue[e.status]
866
+ }))
867
+ }]
868
+ });
869
+ }
870
+ function Ge(e, t) {
871
+ let n = e.at(-1);
872
+ if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
873
+ let r = [...n.parts].reverse().find((e) => e.type === "questions");
874
+ return !r || r.answers || !t(n.id) ? null : {
875
+ entry: n,
876
+ part: r
877
+ };
878
+ }
879
+ function Ke({ entry: e, part: t, questions: n, autoFocus: r, className: a }) {
880
+ let o = !!n?.canAnswer(e.id);
881
+ return /* @__PURE__ */ k(i, {
882
+ questions: t.questions,
883
+ ...t.answers ? { answers: t.answers } : {},
884
+ disabled: !t.answers && !o,
885
+ onSubmit: n && o ? (r) => n.onAnswer(e.id, t.id, r) : void 0,
886
+ autoFocus: r,
887
+ className: a ?? "text-xs"
888
+ });
889
+ }
890
+ function qe({ entry: e, questions: t, hiddenPartId: n }) {
891
+ let i = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), o = [];
892
+ for (let e of i) {
893
+ let t = o.at(-1);
894
+ e.type === "tool" ? t && "steps" in t ? t.steps.push(e) : o.push({
895
+ key: `tool-${e.id}`,
896
+ steps: [e]
897
+ }) : o.push({
898
+ key: `${e.type}-${e.id}`,
899
+ part: e
900
+ });
901
+ }
902
+ return /* @__PURE__ */ k("div", {
903
+ className: "space-y-2",
904
+ children: o.map((n) => {
905
+ if ("steps" in n) return /* @__PURE__ */ k(We, { steps: n.steps }, n.key);
906
+ let { part: i } = n;
907
+ return i.type === "text" ? i.text.trim() ? /* @__PURE__ */ k(r, {
908
+ content: i.text,
909
+ streaming: i.streaming,
910
+ className: "break-words text-xs leading-relaxed text-foreground"
911
+ }, n.key) : null : i.type === "reasoning" ? /* @__PURE__ */ k(a, {
912
+ content: i.text,
913
+ streaming: i.streaming,
914
+ duration: i.duration,
915
+ className: "my-0"
916
+ }, n.key) : /* @__PURE__ */ k(Ke, {
917
+ entry: e,
918
+ part: i,
919
+ questions: t
920
+ }, n.key);
921
+ })
922
+ });
923
+ }
924
+ function Je({ entry: e, questions: t, hiddenPartId: n }) {
925
+ let i = Q();
926
+ if (e.kind === "thinking" && e.parts) {
927
+ let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
928
+ return /* @__PURE__ */ A("li", {
929
+ className: "text-xs text-muted-foreground",
930
+ children: [e.parts.length > 0 && /* @__PURE__ */ k(qe, {
931
+ entry: e,
932
+ questions: t,
933
+ hiddenPartId: n
934
+ }), r && /* @__PURE__ */ A("div", {
935
+ className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
936
+ children: [/* @__PURE__ */ k("span", {
937
+ className: "pt-px",
938
+ children: /* @__PURE__ */ k(ze, { status: e.status })
939
+ }), /* @__PURE__ */ k("span", {
940
+ className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
941
+ children: Be(e, i)
942
+ })]
943
+ })]
944
+ });
945
+ }
946
+ let a = e.kind === "thinking" && e.detail ? Ie(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? Be(e, i) : e.label;
947
+ return /* @__PURE__ */ A("li", {
843
948
  className: "text-xs text-muted-foreground",
844
949
  children: [
845
- /* @__PURE__ */ D("div", {
950
+ /* @__PURE__ */ A("div", {
846
951
  className: "flex items-start gap-1.5",
847
- children: [/* @__PURE__ */ E("span", {
952
+ children: [/* @__PURE__ */ k("span", {
848
953
  className: "pt-px",
849
- children: /* @__PURE__ */ E(Ne, { status: e.status })
850
- }), /* @__PURE__ */ E("span", {
954
+ children: /* @__PURE__ */ k(ze, { status: e.status })
955
+ }), /* @__PURE__ */ k("span", {
851
956
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
852
- children: a
957
+ children: c
853
958
  })]
854
959
  }),
855
- r.length > 0 && /* @__PURE__ */ E("div", {
960
+ o.length > 0 && /* @__PURE__ */ k("div", {
856
961
  className: "mt-1 ml-[18px] space-y-1",
857
- children: r.map((e, t) => /* @__PURE__ */ E(ke, {
962
+ children: o.map((e, t) => /* @__PURE__ */ k(Le, {
858
963
  content: e.content,
859
964
  language: e.language
860
965
  }, t))
861
966
  }),
862
- i.length > 0 && /* @__PURE__ */ E("div", {
967
+ s.length > 0 && /* @__PURE__ */ k("div", {
863
968
  className: "mt-1 ml-[18px] space-y-2",
864
- children: i.map((e, t) => /* @__PURE__ */ E("p", {
865
- className: "whitespace-pre-wrap leading-relaxed text-muted-foreground",
866
- children: /* @__PURE__ */ E(je, { text: e.content.trim() })
969
+ children: s.map((e, t) => /* @__PURE__ */ k(r, {
970
+ content: e.content.trim(),
971
+ tone: "muted",
972
+ className: "break-words text-xs leading-relaxed"
867
973
  }, t))
868
974
  })
869
975
  ]
870
976
  });
871
977
  }
872
- function Re({ activity: e }) {
873
- return e.length === 0 ? null : /* @__PURE__ */ E("ul", {
978
+ function Ye({ activity: e, questions: t, docked: n, pinUserMessages: r = !0 }) {
979
+ if (e.length === 0) return null;
980
+ let i = [];
981
+ for (let t of e) t.kind === "user" || i.length === 0 ? i.push(t.kind === "user" ? {
982
+ user: t,
983
+ entries: []
984
+ } : { entries: [t] }) : i[i.length - 1].entries.push(t);
985
+ return /* @__PURE__ */ k("ul", {
874
986
  className: "space-y-0.5",
875
- children: e.map((e) => /* @__PURE__ */ E(Le, { entry: e }, e.id))
987
+ children: i.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(He, {
988
+ entry: e.user,
989
+ pinned: r
990
+ }), e.entries.length > 0 && /* @__PURE__ */ k("ul", {
991
+ className: "space-y-0.5",
992
+ children: e.entries.map((e) => /* @__PURE__ */ k(Je, {
993
+ entry: e,
994
+ questions: t,
995
+ hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
996
+ }, e.id))
997
+ })] }, e.user?.id ?? e.entries[0]?.id))
998
+ });
999
+ }
1000
+ //#endregion
1001
+ //#region src/presentation/panelWidth.ts
1002
+ var Xe = 420, Ze = 320, Qe = "60vw", $e = "agentico:panel-width";
1003
+ function et(e, t) {
1004
+ if (typeof e == "number") return e;
1005
+ let n = Number.parseFloat(e);
1006
+ return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
1007
+ }
1008
+ function tt(e, t, n) {
1009
+ return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
1010
+ }
1011
+ function nt() {
1012
+ try {
1013
+ let e = window.localStorage.getItem($e), t = e === null ? NaN : Number(e);
1014
+ return Number.isFinite(t) && t > 0 ? t : null;
1015
+ } catch {
1016
+ return null;
1017
+ }
1018
+ }
1019
+ function rt(e) {
1020
+ try {
1021
+ e === null ? window.localStorage.removeItem($e) : window.localStorage.setItem($e, String(e));
1022
+ } catch {}
1023
+ }
1024
+ function it() {
1025
+ return typeof window > "u" ? Infinity : window.innerWidth;
1026
+ }
1027
+ function at({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = Qe, onWidthChange: r }) {
1028
+ let [i, a] = D(it), [o, s] = D(() => nt() ?? e);
1029
+ C(() => {
1030
+ if (typeof window > "u") return;
1031
+ let e = () => a(window.innerWidth);
1032
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1033
+ }, []);
1034
+ let c = t, l = Math.max(c, et(n, i)), u = tt(o, c, l);
1035
+ return C(() => {
1036
+ r?.(u);
1037
+ }, [u]), {
1038
+ width: u,
1039
+ min: c,
1040
+ max: l,
1041
+ set: x((e) => s(tt(e, c, l)), [c, l]),
1042
+ commit: x((e) => rt(tt(e, c, l)), [c, l]),
1043
+ reset: x(() => {
1044
+ s(e), rt(null);
1045
+ }, [e])
1046
+ };
1047
+ }
1048
+ //#endregion
1049
+ //#region src/presentation/AgenticoResizeHandle.tsx
1050
+ function ot({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
1051
+ 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) => {
1052
+ let t = s.current;
1053
+ if (t && t.pointerId === e.pointerId) {
1054
+ s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
1055
+ try {
1056
+ e.currentTarget.releasePointerCapture(e.pointerId);
1057
+ } catch {}
1058
+ i(t.last);
1059
+ }
1060
+ };
1061
+ return /* @__PURE__ */ k("div", {
1062
+ role: "separator",
1063
+ "aria-orientation": "vertical",
1064
+ "aria-label": o.resizePanel,
1065
+ "aria-valuenow": e,
1066
+ "aria-valuemin": t,
1067
+ "aria-valuemax": n,
1068
+ tabIndex: 0,
1069
+ title: o.resizePanelHint,
1070
+ "data-dragging": c || void 0,
1071
+ className: "group absolute inset-y-0 -left-1 z-30 flex w-2 cursor-col-resize touch-none select-none justify-center outline-none",
1072
+ onPointerDown: (t) => {
1073
+ if (t.button === 0) {
1074
+ t.preventDefault(), s.current = {
1075
+ pointerId: t.pointerId,
1076
+ startX: t.clientX,
1077
+ startWidth: e,
1078
+ last: e
1079
+ }, l(!0), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
1080
+ try {
1081
+ t.currentTarget.setPointerCapture(t.pointerId);
1082
+ } catch {}
1083
+ }
1084
+ },
1085
+ onPointerMove: (e) => {
1086
+ let t = s.current;
1087
+ t && t.pointerId === e.pointerId && (t.last = u(t.startWidth + (t.startX - e.clientX)), r(t.last));
1088
+ },
1089
+ onPointerUp: d,
1090
+ onPointerCancel: d,
1091
+ onLostPointerCapture: d,
1092
+ onDoubleClick: a,
1093
+ onKeyDown: (a) => {
1094
+ let o = a.shiftKey ? 64 : 16, s = null;
1095
+ if (a.key === "ArrowLeft" ? s = e + o : a.key === "ArrowRight" ? s = e - o : a.key === "Home" ? s = t : a.key === "End" && (s = n), s === null) return;
1096
+ a.preventDefault();
1097
+ let c = u(s);
1098
+ r(c), i(c);
1099
+ },
1100
+ children: /* @__PURE__ */ k("span", {
1101
+ "aria-hidden": !0,
1102
+ className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
1103
+ })
876
1104
  });
877
1105
  }
878
1106
  //#endregion
879
1107
  //#region src/presentation/AgenticoToggle.tsx
880
- function ze({ className: e = "" }) {
1108
+ function st({ className: e = "" }) {
881
1109
  let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
882
- return /* @__PURE__ */ E(t, {
1110
+ return /* @__PURE__ */ k(t, {
883
1111
  icon: "bot",
884
1112
  ariaLabel: n ? a.closePanel : a.openPanel,
885
1113
  title: n ? a.closePanel : a.openPanel,
@@ -890,32 +1118,32 @@ function ze({ className: e = "" }) {
890
1118
  }
891
1119
  //#endregion
892
1120
  //#region src/presentation/useAIModelCatalog.ts
893
- var Be = "llmnative-cms.selectedAIModel";
894
- function Ve() {
1121
+ var ct = "llmnative-cms.selectedAIModel";
1122
+ function lt() {
895
1123
  try {
896
- return localStorage.getItem(Be) ?? "";
1124
+ return localStorage.getItem(ct) ?? "";
897
1125
  } catch {
898
1126
  return "";
899
1127
  }
900
1128
  }
901
- function He(e) {
1129
+ function ut(e) {
902
1130
  try {
903
- e ? localStorage.setItem(Be, e) : localStorage.removeItem(Be);
1131
+ e ? localStorage.setItem(ct, e) : localStorage.removeItem(ct);
904
1132
  } catch {}
905
1133
  }
906
- function Ue() {
907
- let e = p()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = w({}), [i, a] = w(!1), [o, s] = w(Ve);
908
- return b(() => {
1134
+ function dt() {
1135
+ let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(lt);
1136
+ return C(() => {
909
1137
  if (!t) {
910
1138
  r({});
911
1139
  return;
912
1140
  }
913
1141
  let n = !1;
914
- return a(!0), l(e).then((e) => {
1142
+ return a(!0), p(e).then((e) => {
915
1143
  if (n) return;
916
1144
  r(e.modelsByProvider);
917
1145
  let t = Object.values(e.modelsByProvider).flat();
918
- s((e) => t.some((t) => t.id === e) ? e : (He(""), ""));
1146
+ s((e) => t.some((t) => t.id === e) ? e : (ut(""), ""));
919
1147
  }).catch((e) => {
920
1148
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
921
1149
  }).finally(() => {
@@ -929,105 +1157,188 @@ function Ue() {
929
1157
  modelsLoading: i,
930
1158
  selectedModel: o,
931
1159
  setSelectedModel: (e) => {
932
- He(e), s(e);
1160
+ ut(e), s(e);
933
1161
  }
934
1162
  };
935
1163
  }
936
1164
  //#endregion
937
1165
  //#region src/presentation/useAgent.ts
938
- var We = 20, Ge = 26e4;
939
- function Ke(e) {
940
- return e.filter((e) => !c.isTextAttachment(e.mimeType) || e.base64.length <= Ge);
941
- }
942
- function qe(e, t = {}) {
943
- let { defaultEnabled: n = !1 } = t, [r, i] = w(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: l, setSelectedModel: u } = Ue(), [f, m] = w(!1), [h, g] = w(null), [_, v] = w(!1), [y, b] = w([]), x = Q(), S = C(x);
944
- S.current = x;
945
- let T = C(null), E = C(!1), D = C(null), O = () => {
946
- D.current?.abort();
947
- }, k = p()?.registry ?? {}, A = r && l ? d(l) : null, j = A ? k[A.provider] : null, M = e.executor, N = !!M, [P, F] = w([]), [L, R] = w(""), z = C(""), B = (e) => {
948
- z.current = e, R(e);
949
- }, V = (e) => {
950
- F(M?.models?.(e) ?? []), B(M?.defaultModel?.(e) ?? "");
951
- }, H = async (e, t, n) => {
952
- let r = T.current;
953
- if (!r || !M) return g(S.current.noActiveSession), null;
954
- let i = new AbortController();
955
- D.current = i;
956
- let a = crypto.randomUUID();
957
- b((e) => [...e, {
958
- id: a,
1166
+ var ft = 20, pt = 26e4;
1167
+ function mt(e) {
1168
+ return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= pt);
1169
+ }
1170
+ function ht(e, t = {}) {
1171
+ let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = dt(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
1172
+ b((t) => {
1173
+ let n = typeof e == "function" ? e(t) : e;
1174
+ return x.current = n, n;
1175
+ });
1176
+ }, C = E(/* @__PURE__ */ new Map()), w = Q(), T = E(w);
1177
+ T.current = w;
1178
+ let O = E(null), k = E(!1), A = E(null), M = () => {
1179
+ A.current?.abort();
1180
+ }, I = _()?.registry ?? {}, L = r && c ? h(c) : null, R = L ? I[L.provider] : null, z = e.executor, B = !!z, [V, H] = D([]), [U, G] = D(""), K = E(""), q = (e) => {
1181
+ K.current = e, G(e);
1182
+ }, ee = (e) => {
1183
+ H(z?.models?.(e) ?? []), q(z?.defaultModel?.(e) ?? "");
1184
+ }, J = async (e, t, n, r) => {
1185
+ let i = O.current;
1186
+ if (!i || !z) return m(T.current.noActiveSession), null;
1187
+ let a = new AbortController();
1188
+ A.current = a;
1189
+ let o = crypto.randomUUID();
1190
+ S((e) => [...e, {
1191
+ id: o,
959
1192
  kind: "thinking",
960
- label: S.current.thinking,
961
- status: "running"
1193
+ label: T.current.thinking,
1194
+ status: "running",
1195
+ parts: []
962
1196
  }]);
963
- let o = (e, t) => b((n) => n.map((n) => n.id === a ? {
964
- ...n,
965
- status: e,
966
- ...t === void 0 ? {} : { detail: t }
967
- } : n)), s = (e) => {
968
- let t = `step-${a}-${e.id}`;
969
- b((n) => {
970
- if (n.some((e) => e.id === t)) return n.map((n) => n.id === t ? {
971
- ...n,
972
- label: e.label,
973
- status: e.status
974
- } : n);
975
- let r = n.findIndex((e) => e.id === a), i = {
976
- id: t,
977
- kind: "tool",
978
- label: e.label,
979
- status: e.status
980
- };
981
- return r < 0 ? [...n, i] : [
982
- ...n.slice(0, r),
983
- i,
984
- ...n.slice(r)
985
- ];
1197
+ let s = /* @__PURE__ */ new Map(), c = (e) => Math.max(1, Math.round((Date.now() - (s.get(e) ?? Date.now())) / 1e3)), l = (e) => ({
1198
+ ...e,
1199
+ streaming: !1,
1200
+ duration: e.duration ?? c(e.id)
1201
+ }), u = (e, t) => S((n) => n.map((n) => {
1202
+ if (n.id !== o) return n;
1203
+ let r = e(n.parts ?? []), i = P(r);
1204
+ return {
1205
+ ...n,
1206
+ parts: r,
1207
+ ...t ? { status: t } : {},
1208
+ ...i ? { detail: i } : {}
1209
+ };
1210
+ })), d = (e) => u((t) => N(t, e, l)), f = !1, p = (e, t) => {
1211
+ t?.id && t.id !== "text" && (f = !0), d({
1212
+ type: "text",
1213
+ id: t?.id ?? "text",
1214
+ text: e,
1215
+ streaming: !t?.done
986
1216
  });
1217
+ }, h = (e, t) => {
1218
+ let n = t?.id ?? "reasoning";
1219
+ s.has(n) || s.set(n, Date.now()), d({
1220
+ type: "reasoning",
1221
+ id: n,
1222
+ text: e,
1223
+ streaming: !t?.done,
1224
+ ...t?.duration === void 0 ? t?.done ? { duration: c(n) } : {} : { duration: t.duration }
1225
+ });
1226
+ }, g = (e) => d({
1227
+ type: "tool",
1228
+ id: e.id,
1229
+ label: e.label,
1230
+ status: e.status
1231
+ }), _ = /* @__PURE__ */ new Set(), v = 0, y = () => {
1232
+ for (let e of _) {
1233
+ let t = C.current.get(e);
1234
+ C.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
1235
+ }
1236
+ _.clear();
987
1237
  };
1238
+ a.signal.addEventListener("abort", y);
1239
+ let b = (e, t) => {
1240
+ v += 1;
1241
+ let n = t?.id ?? `questions-${v}`;
1242
+ d({
1243
+ type: "questions",
1244
+ id: n,
1245
+ questions: e
1246
+ });
1247
+ let r = `${o}:${n}`;
1248
+ return a.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (_.add(r), new Promise((e, t) => {
1249
+ C.current.set(r, {
1250
+ resolve: e,
1251
+ reject: t
1252
+ });
1253
+ }));
1254
+ }, x = (e, t) => {
1255
+ u((n) => (t && !f ? N(n, {
1256
+ type: "text",
1257
+ id: j,
1258
+ text: t,
1259
+ streaming: !1
1260
+ }, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
1261
+ ...t,
1262
+ streaming: !1
1263
+ } : t.type === "tool" && t.status === "running" && e !== "done" ? {
1264
+ ...t,
1265
+ status: "stopped"
1266
+ } : t), e), a.signal.removeEventListener("abort", y);
1267
+ for (let e of _) C.current.delete(e);
1268
+ _.clear();
1269
+ }, w = e || r?.historyText || "";
988
1270
  try {
989
- let a = await M.turn({
990
- params: r.params,
991
- context: r.context,
1271
+ let o = await z.turn({
1272
+ params: i.params,
1273
+ context: i.context,
992
1274
  text: e,
993
1275
  first: t,
994
- signal: i.signal,
995
- ...n || z.current ? { model: n || z.current } : {},
996
- onText: (e) => o("running", e),
997
- onStep: s
1276
+ signal: a.signal,
1277
+ ...n || K.current ? { model: n || K.current } : {},
1278
+ ...r ? { answers: {
1279
+ id: r.id,
1280
+ answers: r.answers
1281
+ } } : {},
1282
+ onText: p,
1283
+ onReasoning: h,
1284
+ onStep: g,
1285
+ onQuestions: b
998
1286
  });
999
- return o("done", a.text), r.history = [
1000
- ...r.history,
1001
- ...e ? [{
1287
+ return x("done", o.text), i.history = [
1288
+ ...i.history,
1289
+ ...w ? [{
1002
1290
  role: "user",
1003
- content: e
1291
+ content: w
1004
1292
  }] : [],
1005
1293
  {
1006
1294
  role: "assistant",
1007
- content: a.text
1295
+ content: o.text
1008
1296
  }
1009
- ], a.result ?? null;
1010
- } catch (t) {
1011
- return r.history = [...r.history, ...e ? [{
1297
+ ], o.result ?? null;
1298
+ } catch (e) {
1299
+ return i.history = [...i.history, ...w ? [{
1012
1300
  role: "user",
1013
- content: e
1014
- }] : []], i.signal.aborted ? (o("stopped"), null) : (o("error"), g(Y(t)), null);
1301
+ content: w
1302
+ }] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(Z(e)), null);
1303
+ } finally {
1304
+ A.current = null;
1305
+ }
1306
+ }, te = async (e, t, n) => {
1307
+ let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
1308
+ if (!r || r.type !== "questions") throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
1309
+ let i = () => S((r) => r.map((r) => r.id === e ? {
1310
+ ...r,
1311
+ parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
1312
+ ...e,
1313
+ answers: n
1314
+ } : e)
1315
+ } : r)), a = `${e}:${t}`, o = C.current.get(a);
1316
+ if (o) return C.current.delete(a), i(), o.resolve(n), null;
1317
+ if (k.current) throw m(T.current.requestInProgress), Error(T.current.requestInProgress);
1318
+ if (!B || !O.current) throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
1319
+ k.current = !0, f(!0), m(null), i();
1320
+ try {
1321
+ return await J("", !1, void 0, {
1322
+ id: t,
1323
+ answers: n,
1324
+ historyText: F(r.questions, n)
1325
+ });
1015
1326
  } finally {
1016
- D.current = null;
1327
+ k.current = !1, f(!1);
1017
1328
  }
1018
- }, W = async (t, n, r) => {
1019
- let i = T.current;
1020
- if (!i) return g(S.current.noActiveSession), null;
1021
- let a = r ? d(r) : A, o = a ? k[a.provider] : null;
1022
- if (!o || !a) return g(S.current.noProviderAvailable), null;
1329
+ }, ne = async (t, n, r) => {
1330
+ let i = O.current;
1331
+ if (!i) return m(T.current.noActiveSession), null;
1332
+ let a = r ? h(r) : L, o = a ? I[a.provider] : null;
1333
+ if (!o || !a) return m(T.current.noProviderAvailable), null;
1023
1334
  n?.length && (i.attachmentsRef.current = [...i.attachmentsRef.current ?? [], ...n]);
1024
- let s = (n ?? []).filter((e) => c.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Ge ? `\n\n[File allegato: ${e.name}]\n${c.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(""), l = Ke(n ?? []), u = i.tools.map((e) => ({
1335
+ let s = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= pt ? `\n\n[File allegato: ${e.name}]\n${d.decodeBase64Text(e.base64)}` : `\n\n[File allegato: ${e.name} — troppo grande per essere incollato qui. Usa uno dei tool di lettura file disponibili (es. list_csv_columns/extract_csv_column) per leggerne il contenuto prima di chiedere altro all'utente.]`).join(""), c = mt(n ?? []), l = i.tools.map((e) => ({
1025
1336
  name: e.name,
1026
1337
  description: e.description,
1027
- inputSchema: I(e.inputSchema)
1028
- })), f = new Map(i.tools.map((e) => [e.name, e])), p = new AbortController();
1029
- D.current = p;
1030
- let m = (e, t, n, r) => b((i) => i.map((i) => i.id === e ? {
1338
+ inputSchema: W(e.inputSchema)
1339
+ })), u = new Map(i.tools.map((e) => [e.name, e])), f = new AbortController();
1340
+ A.current = f;
1341
+ let p = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1031
1342
  ...i,
1032
1343
  status: t,
1033
1344
  ...n === void 0 ? {} : { detail: n },
@@ -1035,36 +1346,36 @@ function qe(e, t = {}) {
1035
1346
  } : i));
1036
1347
  try {
1037
1348
  let n = i.history, r = t;
1038
- for (let t = 0; t < We; t++) {
1039
- let c = crypto.randomUUID();
1040
- b((e) => [...e, {
1041
- id: c,
1349
+ for (let t = 0; t < ft; t++) {
1350
+ let d = crypto.randomUUID();
1351
+ S((e) => [...e, {
1352
+ id: d,
1042
1353
  kind: "thinking",
1043
- label: S.current.thinking,
1354
+ label: T.current.thinking,
1044
1355
  status: "running"
1045
1356
  }]);
1046
- let d;
1357
+ let h;
1047
1358
  try {
1048
- d = await o.complete({
1359
+ h = await o.complete({
1049
1360
  prompt: r,
1050
1361
  model: a.model,
1051
1362
  history: n,
1052
- tools: u.length ? u : void 0,
1053
- signal: p.signal,
1054
- attachments: t === 0 ? l : void 0,
1363
+ tools: l.length ? l : void 0,
1364
+ signal: f.signal,
1365
+ attachments: t === 0 ? c : void 0,
1055
1366
  logId: i.logId
1056
1367
  });
1057
1368
  } catch (t) {
1058
1369
  return i.history = [...n, ...r ? [{
1059
1370
  role: "user",
1060
1371
  content: r + s
1061
- }] : []], p.signal.aborted ? (m(c, "stopped"), e.fallback(i.params, i.context)) : (m(c, "error"), g(Y(t)), null);
1372
+ }] : []], f.signal.aborted ? (p(d, "stopped"), e.fallback(i.params, i.context)) : (p(d, "error"), m(Z(t)), null);
1062
1373
  }
1063
1374
  if (i.history = [...n, ...r ? [{
1064
1375
  role: "user",
1065
1376
  content: r + s
1066
- }] : []], !d) return p.signal.aborted ? (m(c, "stopped"), e.fallback(i.params, i.context)) : (m(c, "error"), g(S.current.noProviderResponse), null);
1067
- if (d.type === "text") return m(c, "done", d.text), i.history = [
1377
+ }] : []], !h) return f.signal.aborted ? (p(d, "stopped"), e.fallback(i.params, i.context)) : (p(d, "error"), m(T.current.noProviderResponse), null);
1378
+ if (h.type === "text") return p(d, "done", h.text), i.history = [
1068
1379
  ...n,
1069
1380
  ...r ? [{
1070
1381
  role: "user",
@@ -1072,26 +1383,26 @@ function qe(e, t = {}) {
1072
1383
  }] : [],
1073
1384
  {
1074
1385
  role: "assistant",
1075
- content: d.text
1386
+ content: h.text
1076
1387
  }
1077
- ], e.parseResponse(d.text, i.params, i.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1078
- responseLength: d.text.length,
1079
- responsePreview: d.text.length > 2e3 ? `${d.text.slice(0, 1e3)}\n…[troncato qui nel log, ${d.text.length} caratteri totali]…\n${d.text.slice(-1e3)}` : d.text,
1388
+ ], e.parseResponse(h.text, i.params, i.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
1389
+ responseLength: h.text.length,
1390
+ responsePreview: h.text.length > 2e3 ? `${h.text.slice(0, 1e3)}\n…[troncato qui nel log, ${h.text.length} caratteri totali]…\n${h.text.slice(-1e3)}` : h.text,
1080
1391
  params: i.params
1081
- }), g(S.current.invalidResponse), e.fallback(i.params, i.context));
1082
- let h = d.toolCalls.map((e) => {
1083
- let t = f.get(e.name);
1392
+ }), m(T.current.invalidResponse), e.fallback(i.params, i.context));
1393
+ let g = h.toolCalls.map((e) => {
1394
+ let t = u.get(e.name);
1084
1395
  return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1085
1396
  });
1086
- m(c, "done", d.text || void 0, d.text ? void 0 : h);
1087
- let _ = await Promise.all(d.toolCalls.map(async (e) => {
1088
- let t = f.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1089
- if (b((t) => [...t, {
1397
+ p(d, "done", h.text || void 0, h.text ? void 0 : g);
1398
+ let _ = await Promise.all(h.toolCalls.map(async (e) => {
1399
+ let t = u.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1400
+ if (S((t) => [...t, {
1090
1401
  id: e.id,
1091
1402
  kind: "tool",
1092
1403
  label: n,
1093
1404
  status: "running"
1094
- }]), !t) return m(e.id, "error"), {
1405
+ }]), !t) return p(e.id, "error"), {
1095
1406
  toolCallId: e.id,
1096
1407
  name: e.name,
1097
1408
  output: `Tool sconosciuto: ${e.name}`,
@@ -1099,16 +1410,16 @@ function qe(e, t = {}) {
1099
1410
  };
1100
1411
  try {
1101
1412
  let n = await t.execute(e.input);
1102
- return m(e.id, "done"), {
1413
+ return p(e.id, "done"), {
1103
1414
  toolCallId: e.id,
1104
1415
  name: e.name,
1105
1416
  output: n
1106
1417
  };
1107
1418
  } catch (t) {
1108
- return m(e.id, "error"), {
1419
+ return p(e.id, "error"), {
1109
1420
  toolCallId: e.id,
1110
1421
  name: e.name,
1111
- output: Y(t),
1422
+ output: Z(t),
1112
1423
  isError: !0
1113
1424
  };
1114
1425
  }
@@ -1121,8 +1432,8 @@ function qe(e, t = {}) {
1121
1432
  }] : [],
1122
1433
  {
1123
1434
  role: "assistant",
1124
- content: d.text,
1125
- toolCalls: d.toolCalls
1435
+ content: h.text,
1436
+ toolCalls: h.toolCalls
1126
1437
  },
1127
1438
  {
1128
1439
  role: "tool_result",
@@ -1130,120 +1441,120 @@ function qe(e, t = {}) {
1130
1441
  }
1131
1442
  ], r = "";
1132
1443
  }
1133
- let c = crypto.randomUUID();
1134
- b((e) => [...e, {
1135
- id: c,
1444
+ let d = crypto.randomUUID();
1445
+ S((e) => [...e, {
1446
+ id: d,
1136
1447
  kind: "thinking",
1137
- label: S.current.thinking,
1448
+ label: T.current.thinking,
1138
1449
  status: "running"
1139
1450
  }]);
1140
- let d;
1451
+ let h;
1141
1452
  try {
1142
- d = await o.complete({
1143
- prompt: J(U().stopCallingTools, e.microPromptIds),
1453
+ h = await o.complete({
1454
+ prompt: X(Y().stopCallingTools, e.microPromptIds),
1144
1455
  model: a.model,
1145
1456
  history: n,
1146
- signal: p.signal,
1457
+ signal: f.signal,
1147
1458
  logId: i.logId
1148
1459
  });
1149
1460
  } catch {
1150
- d = null;
1461
+ h = null;
1151
1462
  }
1152
- if (d?.type === "text") {
1153
- m(c, "done", d.text), i.history = [...n, {
1463
+ if (h?.type === "text") {
1464
+ p(d, "done", h.text), i.history = [...n, {
1154
1465
  role: "assistant",
1155
- content: d.text
1466
+ content: h.text
1156
1467
  }];
1157
- let t = e.parseResponse(d.text, i.params, i.context);
1468
+ let t = e.parseResponse(h.text, i.params, i.context);
1158
1469
  if (t) return t;
1159
- } else m(c, p.signal.aborted ? "stopped" : "error"), i.history = n;
1160
- return p.signal.aborted || g(S.current.tooManyToolTurns), e.fallback(i.params, i.context);
1470
+ } else p(d, f.signal.aborted ? "stopped" : "error"), i.history = n;
1471
+ return f.signal.aborted || m(T.current.tooManyToolTurns), e.fallback(i.params, i.context);
1161
1472
  } finally {
1162
- D.current = null;
1473
+ A.current = null;
1163
1474
  }
1164
1475
  };
1165
1476
  return {
1166
1477
  enabled: r,
1167
1478
  setEnabled: i,
1168
1479
  hasProviders: a,
1169
- selectedModel: N ? L : l,
1170
- setSelectedModel: N ? B : u,
1480
+ selectedModel: B ? U : c,
1481
+ setSelectedModel: B ? q : l,
1171
1482
  modelsByProvider: o,
1172
1483
  modelsLoading: s,
1173
- running: f,
1174
- error: h,
1175
- canContinue: _,
1176
- remote: N,
1177
- remoteModels: P,
1484
+ running: u,
1485
+ error: p,
1486
+ canContinue: g,
1487
+ remote: B,
1488
+ remoteModels: V,
1178
1489
  activity: y,
1179
1490
  run: async (t, n) => {
1180
- if (E.current) return g(S.current.requestInProgress), null;
1181
- E.current = !0, g(null), b(n?.openingMessage ? [{
1491
+ if (k.current) return m(T.current.requestInProgress), null;
1492
+ k.current = !0, m(null), S(n?.openingMessage ? [{
1182
1493
  id: crypto.randomUUID(),
1183
1494
  kind: "user",
1184
1495
  label: "Tu",
1185
1496
  status: "done",
1186
1497
  detail: n.openingMessage,
1187
1498
  ...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1188
- }] : []), m(!0);
1499
+ }] : []), f(!0);
1189
1500
  try {
1190
1501
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1191
- if (T.current = {
1502
+ if (O.current = {
1192
1503
  params: t,
1193
1504
  context: i,
1194
1505
  tools: o,
1195
1506
  history: [],
1196
1507
  logId: crypto.randomUUID(),
1197
1508
  attachmentsRef: a
1198
- }, N) return v(!0), V(t), await H(n?.openingMessage ?? "", !0);
1199
- let s = n?.model || void 0, l = s ? !!k[d(s)?.provider ?? ""] : !!j;
1200
- if (!r || !l) {
1509
+ }, B) return v(!0), ee(t), await J(n?.openingMessage ?? "", !0);
1510
+ let s = n?.model || void 0, c = s ? !!I[h(s)?.provider ?? ""] : !!R;
1511
+ if (!r || !c) {
1201
1512
  v(!1);
1202
1513
  let n = e.fallback(t, i);
1203
- return b((t) => [...t, {
1514
+ return S((t) => [...t, {
1204
1515
  id: crypto.randomUUID(),
1205
1516
  kind: "tool",
1206
1517
  status: "done",
1207
- label: e.describeFallback?.(n) ?? S.current.aiDisabledFallback
1518
+ label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
1208
1519
  }]), n;
1209
1520
  }
1210
1521
  v(!0);
1211
- let u = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => c.fileToAttachment(e))) : void 0, f = J(e.buildPrompt(t, i), e.microPromptIds);
1212
- return await W(f, u, s);
1522
+ let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, u = X(e.buildPrompt(t, i), e.microPromptIds);
1523
+ return await ne(u, l, s);
1213
1524
  } catch (e) {
1214
- return g(Y(e)), null;
1525
+ return m(Z(e)), null;
1215
1526
  } finally {
1216
- E.current = !1, m(!1);
1527
+ k.current = !1, f(!1);
1217
1528
  }
1218
1529
  },
1219
1530
  resume: async (t, n) => {
1220
- if (E.current) {
1221
- g(S.current.requestInProgress);
1531
+ if (k.current) {
1532
+ m(T.current.requestInProgress);
1222
1533
  return;
1223
1534
  }
1224
- E.current = !0, g(null), b(n.activity), m(!0);
1535
+ k.current = !0, m(null), S(n.activity), f(!0);
1225
1536
  try {
1226
1537
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1227
- T.current = {
1538
+ O.current = {
1228
1539
  params: t,
1229
1540
  context: i,
1230
1541
  tools: o,
1231
1542
  history: n.history,
1232
1543
  logId: crypto.randomUUID(),
1233
1544
  attachmentsRef: a
1234
- }, N && V(t), v(N || r && !!j);
1545
+ }, B && ee(t), v(B || r && !!R);
1235
1546
  } catch (e) {
1236
- g(Y(e));
1547
+ m(Z(e));
1237
1548
  } finally {
1238
- E.current = !1, m(!1);
1549
+ k.current = !1, f(!1);
1239
1550
  }
1240
1551
  },
1241
1552
  sendMessage: async (t, n) => {
1242
- if (E.current) return g(S.current.requestInProgress), null;
1243
- if (g(null), !t.trim()) return g("Messaggio vuoto."), null;
1244
- let r = T.current;
1245
- if (!r) return g(S.current.noActiveSession), null;
1246
- E.current = !0, m(!0), b((e) => [...e, {
1553
+ if (k.current) return m(T.current.requestInProgress), null;
1554
+ if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
1555
+ let r = O.current;
1556
+ if (!r) return m(T.current.noActiveSession), null;
1557
+ k.current = !0, f(!0), S((e) => [...e, {
1247
1558
  id: crypto.randomUUID(),
1248
1559
  kind: "user",
1249
1560
  label: "Tu",
@@ -1252,53 +1563,54 @@ function qe(e, t = {}) {
1252
1563
  ...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1253
1564
  }]);
1254
1565
  try {
1255
- if (N) return await H(t, !1, n?.model || void 0);
1256
- let i = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => c.fileToAttachment(e))) : void 0, a = J(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1257
- return await W(a, i, n?.model || void 0);
1566
+ if (B) return await J(t, !1, n?.model || void 0);
1567
+ let i = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, a = X(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1568
+ return await ne(a, i, n?.model || void 0);
1258
1569
  } catch (e) {
1259
- return g(Y(e)), null;
1570
+ return m(Z(e)), null;
1260
1571
  } finally {
1261
- E.current = !1, m(!1);
1572
+ k.current = !1, f(!1);
1262
1573
  }
1263
1574
  },
1264
- stop: O,
1575
+ stop: M,
1265
1576
  runFallback: () => {
1266
- let t = T.current;
1577
+ let t = O.current;
1267
1578
  if (!t) return null;
1268
- g(null);
1579
+ m(null);
1269
1580
  let n = e.fallback(t.params, t.context);
1270
- return b((t) => [...t, {
1581
+ return S((t) => [...t, {
1271
1582
  id: crypto.randomUUID(),
1272
1583
  kind: "tool",
1273
1584
  status: "done",
1274
- label: e.describeFallback?.(n) ?? S.current.continueWithoutAiFallback
1585
+ label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
1275
1586
  }]), n;
1276
1587
  },
1277
- snapshot: () => T.current ? {
1278
- history: T.current.history,
1588
+ snapshot: () => O.current ? {
1589
+ history: O.current.history,
1279
1590
  activity: y
1280
- } : null
1591
+ } : null,
1592
+ answerQuestions: te
1281
1593
  };
1282
1594
  }
1283
1595
  //#endregion
1284
1596
  //#region src/domain/orchestrator/prompt.ts
1285
- function Je() {
1286
- let e = U();
1597
+ function gt() {
1598
+ let e = Y();
1287
1599
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1288
1600
  }
1289
- function Ye(e, t, n) {
1290
- let r = U(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1601
+ function _t(e, t, n) {
1602
+ let r = Y(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1291
1603
  return `${r.orchestratorIntro}
1292
1604
 
1293
1605
  ${r.toolsHeading}
1294
1606
  ${t}
1295
1607
  ${i}
1296
- ${Je()}
1608
+ ${gt()}
1297
1609
 
1298
1610
  ${r.userRequestHeading}
1299
1611
  ${e}`;
1300
1612
  }
1301
- function Xe(e, t) {
1613
+ function vt(e, t) {
1302
1614
  return t ? {
1303
1615
  kind: "handoff",
1304
1616
  ...t
@@ -1309,27 +1621,27 @@ function Xe(e, t) {
1309
1621
  }
1310
1622
  //#endregion
1311
1623
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1312
- function Ze(e) {
1313
- return j().filter((t) => !t.onlyWhenAnchored || e === t.id);
1624
+ function yt(e) {
1625
+ return z().filter((t) => !t.onlyWhenAnchored || e === t.id);
1314
1626
  }
1315
- function Qe(e) {
1627
+ function bt(e) {
1316
1628
  return {
1317
1629
  buildContext(e) {
1318
1630
  return {
1319
- cliCatalog: ne(Ze(e.scopedSubagentId)),
1631
+ cliCatalog: se(yt(e.scopedSubagentId)),
1320
1632
  handoff: { current: null },
1321
1633
  collected: {}
1322
1634
  };
1323
1635
  },
1324
1636
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1325
- return Ye(e, n, t);
1637
+ return _t(e, n, t);
1326
1638
  },
1327
1639
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1328
- return `${e}\n\n${Je()}\n\n${U().toolsHeading}\n${n}`;
1640
+ return `${e}\n\n${gt()}\n\n${Y().toolsHeading}\n${n}`;
1329
1641
  },
1330
1642
  parseResponse(e, t, n) {
1331
1643
  let r = n.handoff.current;
1332
- return n.handoff.current = null, Xe(e, r);
1644
+ return n.handoff.current = null, vt(e, r);
1333
1645
  },
1334
1646
  fallback() {
1335
1647
  return {
@@ -1341,16 +1653,16 @@ function Qe(e) {
1341
1653
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
1342
1654
  },
1343
1655
  getTools(t, n, r) {
1344
- let i = F({
1656
+ let i = U({
1345
1657
  attachmentsRef: r,
1346
1658
  collected: n.collected,
1347
- proxyFetch: f
1348
- }), a = t.scopedSubagentId ? M(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Ze(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1659
+ proxyFetch: g
1660
+ }), a = t.scopedSubagentId ? B(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = yt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1349
1661
  name: `${t.id}_${r.name}`,
1350
1662
  description: `${t.label}: ${r.summary}`,
1351
1663
  inputSchema: r.inputSchema,
1352
- describeInvocation: () => u(e.preparing, { label: t.label }),
1353
- describeIntent: u(e.collecting, { label: t.label }),
1664
+ describeInvocation: () => m(e.preparing, { label: t.label }),
1665
+ describeIntent: m(e.collecting, { label: t.label }),
1354
1666
  async execute(e) {
1355
1667
  let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
1356
1668
  return n.handoff.current = {
@@ -1359,7 +1671,7 @@ function Qe(e) {
1359
1671
  params: i
1360
1672
  }, {
1361
1673
  status: "queued",
1362
- note: u(U().handoffQueued, { label: t.label })
1674
+ note: m(Y().handoffQueued, { label: t.label })
1363
1675
  };
1364
1676
  }
1365
1677
  })));
@@ -1369,89 +1681,89 @@ function Qe(e) {
1369
1681
  }
1370
1682
  //#endregion
1371
1683
  //#region src/presentation/deriveHistoryTitle.ts
1372
- function $e(e, t) {
1684
+ function xt(e, t) {
1373
1685
  return e.deriveHistoryTitle?.(t) ?? e.label;
1374
1686
  }
1375
1687
  //#endregion
1376
1688
  //#region src/presentation/ResultDestinationPicker.tsx
1377
- function et({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1378
- let s = Q(), c = $(), l = c.scope, d = h(), [f, p] = w(null), [m, g] = w(new Set(i ?? [])), [_, v] = w(null), y = le(), b = /* @__PURE__ */ new Map();
1689
+ function St({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1690
+ 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();
1379
1691
  e.destinationIds.forEach((e) => {
1380
- let t = y[e];
1692
+ let t = v[e];
1381
1693
  t && b.set(e, t);
1382
- }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(X.id, X);
1694
+ }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(pe.id, pe);
1383
1695
  let x = Array.from(b.values()), S = async (i) => {
1384
- p(i), v(null);
1696
+ f(i), _(null);
1385
1697
  try {
1386
1698
  let o = b.get(i);
1387
- if (!o) throw Error(u(s.unknownDestination, { id: i }));
1699
+ if (!o) throw Error(m(s.unknownDestination, { id: i }));
1388
1700
  if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
1389
- let f = await o.apply(t, {
1701
+ let d = await o.apply(t, {
1390
1702
  scopeId: l?.id ?? "",
1391
1703
  dataProvider: l?.dataProvider,
1392
1704
  storageProvider: l?.storageProvider ?? null,
1393
- proxyFetch: d
1705
+ proxyFetch: u
1394
1706
  }, n);
1395
- g((e) => new Set(e).add(i)), a?.(i), f?.id && c.commitEntityChat(e.id, f.id, r, l?.id, n, $e(e, n));
1707
+ h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, xt(e, n));
1396
1708
  } catch (e) {
1397
- v(e instanceof Error ? e.message : String(e));
1709
+ _(e instanceof Error ? e.message : String(e));
1398
1710
  } finally {
1399
- p(null);
1711
+ f(null);
1400
1712
  }
1401
1713
  };
1402
- return /* @__PURE__ */ D("div", {
1714
+ return /* @__PURE__ */ A("div", {
1403
1715
  className: "space-y-2",
1404
1716
  children: [
1405
- /* @__PURE__ */ E("p", {
1717
+ /* @__PURE__ */ k("p", {
1406
1718
  className: "text-xs font-medium text-muted-foreground",
1407
1719
  children: s.destinationPickerTitle
1408
1720
  }),
1409
- /* @__PURE__ */ E("div", {
1721
+ /* @__PURE__ */ k("div", {
1410
1722
  className: "flex flex-wrap gap-2",
1411
- children: x.map((e) => /* @__PURE__ */ E("button", {
1723
+ children: x.map((e) => /* @__PURE__ */ k("button", {
1412
1724
  type: "button",
1413
- disabled: f !== null,
1725
+ disabled: d !== null,
1414
1726
  onClick: () => void S(e.id),
1415
1727
  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",
1416
- children: f === e.id ? s.destinationApplying : `${m.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
1728
+ children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
1417
1729
  }, e.id))
1418
1730
  }),
1419
- _ && /* @__PURE__ */ E("p", {
1731
+ g && /* @__PURE__ */ k("p", {
1420
1732
  className: "text-xs text-destructive",
1421
- children: _
1733
+ children: g
1422
1734
  })
1423
1735
  ]
1424
1736
  });
1425
1737
  }
1426
1738
  //#endregion
1427
1739
  //#region src/presentation/reports/subagentReportRegistry.tsx
1428
- var tt = {};
1429
- function nt(e) {
1430
- Object.assign(tt, e);
1740
+ var Ct = {};
1741
+ function wt(e) {
1742
+ Object.assign(Ct, e);
1431
1743
  }
1432
- function rt(e) {
1433
- return tt[e];
1744
+ function Tt(e) {
1745
+ return Ct[e];
1434
1746
  }
1435
1747
  //#endregion
1436
1748
  //#region src/presentation/reports/GenericResultPreview.tsx
1437
- function it({ result: e }) {
1438
- let [t, n] = w(!1);
1439
- return /* @__PURE__ */ D("div", {
1749
+ function Et({ result: e }) {
1750
+ let [t, n] = D(!1);
1751
+ return /* @__PURE__ */ A("div", {
1440
1752
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
1441
1753
  onClick: () => n((e) => !e),
1442
1754
  title: t ? "Clic per comprimere" : "Clic per espandere",
1443
- children: [/* @__PURE__ */ E(i, {
1755
+ children: [/* @__PURE__ */ k(s, {
1444
1756
  language: "json",
1445
1757
  showCopy: t,
1446
1758
  background: "transparent",
1447
1759
  className: "!text-[11px]",
1448
1760
  children: JSON.stringify(e, null, 2)
1449
- }), !t && /* @__PURE__ */ E("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
1761
+ }), !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" })]
1450
1762
  });
1451
1763
  }
1452
1764
  //#endregion
1453
1765
  //#region src/presentation/liveAnchorDestination.ts
1454
- function at(e, t, n) {
1766
+ function Dt(e, t, n) {
1455
1767
  return e.length === 0 ? null : {
1456
1768
  id: "live-component",
1457
1769
  label: "Applica al componente aperto",
@@ -1462,33 +1774,33 @@ function at(e, t, n) {
1462
1774
  }
1463
1775
  //#endregion
1464
1776
  //#region src/presentation/subagentControls.ts
1465
- var ot = {};
1466
- function st(e) {
1467
- Object.assign(ot, e);
1777
+ var Ot = {};
1778
+ function kt(e) {
1779
+ Object.assign(Ot, e);
1468
1780
  }
1469
- function ct(e) {
1470
- return ot[e];
1781
+ function At(e) {
1782
+ return Ot[e];
1471
1783
  }
1472
1784
  //#endregion
1473
1785
  //#region src/presentation/SubagentRunner.tsx
1474
- var lt = () => ({});
1475
- function ut({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
1476
- let c = qe(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = h(), f = C(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = w(null), [g, _] = w([]), [v, y] = w(null), x = rt(e.id), O = x?.kind === "selection" ? x : null, [k, A] = w(null), j = C(!1), M = C(0), N = C(null);
1786
+ var jt = () => ({});
1787
+ function Mt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
1788
+ let c = ht(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), [h, g] = D([]), [_, v] = D(null), b = Tt(e.id), x = b?.kind === "selection" ? b : null, [S, w] = D(null), j = E(!1), M = E(0), N = E(null);
1477
1789
  p && p !== N.current && (N.current = p, M.current = (r?.length ?? 0) + c.activity.length);
1478
- let P = C(!1), F = c.remote || !c.hasProviders || c.selectedModel !== "";
1479
- b(() => {
1790
+ let P = E(!1), F = c.remote || !c.hasProviders || c.selectedModel !== "";
1791
+ C(() => {
1480
1792
  !j.current && F && (j.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1481
1793
  model: o,
1482
1794
  openingMessage: s
1483
1795
  }).then((e) => {
1484
1796
  e && m(e);
1485
1797
  })));
1486
- }, [F]), b(() => {
1798
+ }, [F]), C(() => {
1487
1799
  if (!p || !u) return;
1488
- let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = le();
1800
+ let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = ge();
1489
1801
  n.forEach((n) => {
1490
1802
  let a = i[n];
1491
- a && (y(null), a.apply(p, {
1803
+ a && (v(null), a.apply(p, {
1492
1804
  scopeId: u.id,
1493
1805
  dataProvider: u.dataProvider,
1494
1806
  storageProvider: u.storageProvider,
@@ -1497,58 +1809,58 @@ function ut({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1497
1809
  ...t,
1498
1810
  pinnedEntityId: r
1499
1811
  }).then((n) => {
1500
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, $e(e, t));
1501
- }).catch((e) => y(e instanceof Error ? e.message : String(e))));
1812
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, xt(e, t));
1813
+ }).catch((e) => v(e instanceof Error ? e.message : String(e))));
1502
1814
  });
1503
1815
  }, [
1504
1816
  p,
1505
1817
  c.activity,
1506
1818
  u
1507
- ]), b(() => {
1508
- p && O && A(O.defaultSelection(p));
1509
- }, [p, O]);
1819
+ ]), C(() => {
1820
+ p && x && w(x.defaultSelection(p));
1821
+ }, [p, x]);
1510
1822
  let I = (e, t) => {
1511
- A((n) => n && {
1823
+ w((n) => n && {
1512
1824
  ...n,
1513
1825
  [e]: t
1514
1826
  });
1515
- }, L = (e) => m(e), R = S(() => p && O && k ? O.applySelection(p, k) : p, [
1827
+ }, L = (e) => m(e), R = T(() => p && x && S ? x.applySelection(p, S) : p, [
1516
1828
  p,
1517
- O,
1518
- k
1519
- ]), z = S(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = S(() => at(z, t, f), [
1829
+ x,
1830
+ S
1831
+ ]), z = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = T(() => Dt(z, t, f), [
1520
1832
  z,
1521
1833
  t,
1522
1834
  f
1523
- ]), V = S(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), U = C(!1);
1524
- b(() => {
1835
+ ]), V = T(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), U = E(!1);
1836
+ C(() => {
1525
1837
  let n = U.current && !c.running;
1526
1838
  if (U.current = c.running, !n || !H || !u) return;
1527
1839
  let i = c.snapshot();
1528
- i && ge({
1840
+ i && we({
1529
1841
  scopeId: u.id,
1530
1842
  subagentId: e.id,
1531
1843
  entityId: H,
1532
1844
  params: t,
1533
- title: $e(e, t),
1845
+ title: xt(e, t),
1534
1846
  history: i.history,
1535
1847
  activity: [...r ?? [], ...i.activity]
1536
1848
  });
1537
1849
  }, [c.running]);
1538
1850
  let W = () => {
1539
1851
  P.current = !0, c.running && c.stop(), l.closeTask(f);
1540
- }, ee = C(ct(e.id) ?? lt).current, G = ee({
1852
+ }, G = E(At(e.id) ?? jt).current, K = G({
1541
1853
  params: t,
1542
1854
  taskId: f,
1543
1855
  running: c.running,
1544
1856
  close: W
1545
- }), K = (e) => {
1546
- _((t) => t.includes(e) ? t : [...t, e]);
1857
+ }), q = (e) => {
1858
+ g((t) => t.includes(e) ? t : [...t, e]);
1547
1859
  };
1548
- return b(() => {
1860
+ return C(() => {
1549
1861
  P.current || l.openTask({
1550
1862
  id: f,
1551
- title: $e(e, t),
1863
+ title: xt(e, t),
1552
1864
  icon: e.icon,
1553
1865
  agent: c,
1554
1866
  onApplied: (e) => m(e),
@@ -1556,28 +1868,28 @@ function ut({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1556
1868
  panelExtraAnchorIndex: M.current,
1557
1869
  onDismiss: W,
1558
1870
  ...H ? { savedToDisk: !0 } : {},
1559
- panelActions: G.content,
1560
- composerActions: G.actions,
1561
- panelExtra: p ? /* @__PURE__ */ D(T, { children: [
1562
- O && k ? /* @__PURE__ */ E(O.Report, {
1871
+ panelActions: K.content,
1872
+ composerActions: K.actions,
1873
+ panelExtra: p ? /* @__PURE__ */ A(O, { children: [
1874
+ x && S ? /* @__PURE__ */ k(x.Report, {
1563
1875
  result: p,
1564
- selection: k,
1876
+ selection: S,
1565
1877
  onChange: I
1566
- }) : x?.kind === "editable" ? /* @__PURE__ */ E(x.Report, {
1878
+ }) : b?.kind === "editable" ? /* @__PURE__ */ k(b.Report, {
1567
1879
  result: p,
1568
1880
  onResultChange: L
1569
- }) : /* @__PURE__ */ E(it, { result: R }),
1570
- v && /* @__PURE__ */ D("p", {
1881
+ }) : /* @__PURE__ */ k(Et, { result: R }),
1882
+ _ && /* @__PURE__ */ A("p", {
1571
1883
  className: "text-xs text-destructive",
1572
- children: ["Salvataggio automatico non riuscito: ", v]
1884
+ children: ["Salvataggio automatico non riuscito: ", _]
1573
1885
  }),
1574
- /* @__PURE__ */ E(et, {
1886
+ /* @__PURE__ */ k(St, {
1575
1887
  manifest: e,
1576
1888
  result: R,
1577
1889
  meta: t,
1578
1890
  taskId: f,
1579
- initiallyApplied: g,
1580
- onApplied: K,
1891
+ initiallyApplied: h,
1892
+ onApplied: q,
1581
1893
  extraDestinations: V
1582
1894
  })
1583
1895
  ] }) : void 0
@@ -1598,29 +1910,29 @@ function ut({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1598
1910
  t,
1599
1911
  p,
1600
1912
  R,
1601
- k,
1602
- g,
1913
+ S,
1914
+ h,
1603
1915
  n,
1604
1916
  r,
1605
- v,
1606
- G.content,
1607
- G.actions
1608
- ]), b(() => () => {
1917
+ _,
1918
+ K.content,
1919
+ K.actions
1920
+ ]), C(() => () => {
1609
1921
  l.closeTask(f);
1610
1922
  }, [l.closeTask, f]), null;
1611
1923
  }
1612
1924
  //#endregion
1613
1925
  //#region src/presentation/OrchestratorRunner.tsx
1614
- function dt({ userGoal: e }) {
1615
- let t = Q(), n = qe(S(() => Qe({
1926
+ function Nt({ userGoal: e }) {
1927
+ let t = Q(), n = ht(T(() => bt({
1616
1928
  unavailable: t.orchestratorUnavailable,
1617
1929
  continueWithoutAi: t.orchestratorContinueWithoutAi,
1618
1930
  preparing: t.orchestratorPreparing,
1619
1931
  collecting: t.orchestratorCollecting
1620
- }), []), { defaultEnabled: !0 }), r = $(), [i, a] = w(null), o = C(!1), s = !n.hasProviders || n.selectedModel !== "", c = C(r.pendingExtraDestinations), l = C(r.pendingAttachments), u = C(r.pendingModel), d = C(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), f = C(r.pendingCarryOver), p = C(!1), m = (e) => {
1621
- e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(we));
1932
+ }), []), { 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) => {
1933
+ e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Me));
1622
1934
  };
1623
- b(() => {
1935
+ C(() => {
1624
1936
  !o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
1625
1937
  userGoal: e,
1626
1938
  pageContext: r.pageContext,
@@ -1632,9 +1944,9 @@ function dt({ userGoal: e }) {
1632
1944
  }).then((e) => {
1633
1945
  e && m(e);
1634
1946
  }));
1635
- }, [s]), b(() => {
1947
+ }, [s]), C(() => {
1636
1948
  p.current || r.openTask({
1637
- id: we,
1949
+ id: Me,
1638
1950
  title: "Agentico",
1639
1951
  icon: "bot",
1640
1952
  agent: n,
@@ -1642,7 +1954,7 @@ function dt({ userGoal: e }) {
1642
1954
  scopedSubagentId: d.current,
1643
1955
  precedingActivity: f.current?.activity,
1644
1956
  onDismiss: () => {
1645
- p.current = !0, n.running && n.stop(), r.closeTask(we);
1957
+ p.current = !0, n.running && n.stop(), r.closeTask(Me);
1646
1958
  }
1647
1959
  });
1648
1960
  }, [
@@ -1654,13 +1966,13 @@ function dt({ userGoal: e }) {
1654
1966
  n.modelsByProvider,
1655
1967
  n.hasProviders,
1656
1968
  r.openTask
1657
- ]), b(() => () => {
1658
- r.closeTask(we);
1969
+ ]), C(() => () => {
1970
+ r.closeTask(Me);
1659
1971
  }, [r.closeTask]);
1660
- let h = S(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
1972
+ let h = T(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
1661
1973
  if (!i) return null;
1662
- let g = M(i.subagentId);
1663
- return g ? /* @__PURE__ */ E(ut, {
1974
+ let g = B(i.subagentId);
1975
+ return g ? /* @__PURE__ */ k(Mt, {
1664
1976
  manifest: g,
1665
1977
  params: i.params,
1666
1978
  extraDestinations: c.current,
@@ -1671,8 +1983,8 @@ function dt({ userGoal: e }) {
1671
1983
  }
1672
1984
  //#endregion
1673
1985
  //#region src/presentation/ManualEntryRunner.tsx
1674
- function ft({ manifest: e, extraDestinations: n }) {
1675
- let r = qe(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = C(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = w(null), [l, u] = w([]), d = rt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = w(null), [h, g] = w(null), _ = C(!1), v = (t) => {
1986
+ function Pt({ manifest: e, extraDestinations: n }) {
1987
+ let r = ht(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = Tt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
1676
1988
  if (!e.manualEntry) return;
1677
1989
  let n;
1678
1990
  try {
@@ -1685,7 +1997,7 @@ function ft({ manifest: e, extraDestinations: n }) {
1685
1997
  e && c(e);
1686
1998
  });
1687
1999
  };
1688
- b(() => {
2000
+ C(() => {
1689
2001
  s && f && m(f.defaultSelection(s));
1690
2002
  }, [s, f]);
1691
2003
  let y = (e, t) => {
@@ -1693,18 +2005,18 @@ function ft({ manifest: e, extraDestinations: n }) {
1693
2005
  ...n,
1694
2006
  [e]: t
1695
2007
  });
1696
- }, x = (e) => c(e), T = S(() => s && f && p ? f.applySelection(s, p) : s, [
2008
+ }, b = (e) => c(e), x = T(() => s && f && p ? f.applySelection(s, p) : s, [
1697
2009
  s,
1698
2010
  f,
1699
2011
  p
1700
- ]), O = (e) => {
2012
+ ]), S = (e) => {
1701
2013
  u((t) => t.includes(e) ? t : [...t, e]);
1702
- }, k = S(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), A = S(() => h ? at(k, h, o) : null, [
1703
- k,
2014
+ }, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? Dt(w, h, o) : null, [
2015
+ w,
1704
2016
  h,
1705
2017
  o
1706
- ]), j = S(() => A ? [A, ...n ?? []] : n, [A, n]);
1707
- return b(() => {
2018
+ ]), j = T(() => O ? [O, ...n ?? []] : n, [O, n]);
2019
+ return C(() => {
1708
2020
  _.current || a.openTask({
1709
2021
  id: o,
1710
2022
  title: e.label,
@@ -1718,27 +2030,27 @@ function ft({ manifest: e, extraDestinations: n }) {
1718
2030
  onDismiss: () => {
1719
2031
  _.current = !0, r.running && r.stop(), a.closeTask(o);
1720
2032
  },
1721
- panelExtra: s ? /* @__PURE__ */ D("div", {
2033
+ panelExtra: s ? /* @__PURE__ */ A("div", {
1722
2034
  className: "space-y-2",
1723
2035
  children: [
1724
- f && p ? /* @__PURE__ */ E(f.Report, {
2036
+ f && p ? /* @__PURE__ */ k(f.Report, {
1725
2037
  result: s,
1726
2038
  selection: p,
1727
2039
  onChange: y
1728
- }) : d?.kind === "editable" ? /* @__PURE__ */ E(d.Report, {
2040
+ }) : d?.kind === "editable" ? /* @__PURE__ */ k(d.Report, {
1729
2041
  result: s,
1730
- onResultChange: x
1731
- }) : /* @__PURE__ */ E(it, { result: T }),
1732
- /* @__PURE__ */ E(et, {
2042
+ onResultChange: b
2043
+ }) : /* @__PURE__ */ k(Et, { result: x }),
2044
+ /* @__PURE__ */ k(St, {
1733
2045
  manifest: e,
1734
- result: T,
2046
+ result: x,
1735
2047
  meta: h ?? {},
1736
2048
  taskId: o,
1737
2049
  initiallyApplied: l,
1738
- onApplied: O,
2050
+ onApplied: S,
1739
2051
  extraDestinations: j
1740
2052
  }),
1741
- r.hasProviders && /* @__PURE__ */ E(t, {
2053
+ r.hasProviders && /* @__PURE__ */ k(t, {
1742
2054
  label: i.resumeWithAi,
1743
2055
  variant: "outline-secondary",
1744
2056
  className: "text-xs",
@@ -1756,18 +2068,17 @@ function ft({ manifest: e, extraDestinations: n }) {
1756
2068
  r.hasProviders,
1757
2069
  a.componentAnchors,
1758
2070
  s,
1759
- T,
2071
+ x,
1760
2072
  p,
1761
2073
  l,
1762
2074
  h
1763
- ]), b(() => () => {
2075
+ ]), C(() => () => {
1764
2076
  a.closeTask(o);
1765
2077
  }, []), null;
1766
2078
  }
1767
2079
  //#endregion
1768
2080
  //#region src/presentation/Agentico.tsx
1769
- var pt = 420;
1770
- function mt(e) {
2081
+ function Ft(e) {
1771
2082
  return Object.values(e).flat().map((e) => ({
1772
2083
  label: e.model,
1773
2084
  value: e.id,
@@ -1775,52 +2086,52 @@ function mt(e) {
1775
2086
  group: e.providerLabel ?? e.provider
1776
2087
  }));
1777
2088
  }
1778
- function ht({ task: e }) {
1779
- let t = Q(), [n, i] = w(""), { agent: a, onApplied: o, manualEntry: s } = e, c = a.running, l = (e) => {
1780
- if (i(""), s) {
2089
+ function It({ task: e }) {
2090
+ let t = Q(), [n, r] = D(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
2091
+ if (r(""), s) {
1781
2092
  s.onSubmit(e.text);
1782
2093
  return;
1783
2094
  }
1784
- a.sendMessage(e.text, {
2095
+ i.sendMessage(e.text, {
1785
2096
  attachments: e.files,
1786
2097
  model: e.model
1787
2098
  }).then((e) => {
1788
- e && o(e);
2099
+ e && a(e);
1789
2100
  });
1790
- }, u = !!s || a.remote && a.remoteModels.length === 0, d = !u && !a.remote && a.hasProviders && !a.selectedModel, f = u ? [] : a.remote ? a.remoteModels : mt(a.modelsByProvider);
1791
- return /* @__PURE__ */ E(r, {
2101
+ }, u = !!s || i.remote && i.remoteModels.length === 0, d = !u && !i.remote && i.hasProviders && !i.selectedModel, f = u ? [] : i.remote ? i.remoteModels : Ft(i.modelsByProvider);
2102
+ return /* @__PURE__ */ k(o, {
1792
2103
  value: n,
1793
- onChange: i,
2104
+ onChange: r,
1794
2105
  placeholder: s?.prompt ?? t.messagePlaceholder,
1795
2106
  running: c,
1796
- onStop: a.stop,
2107
+ onStop: i.stop,
1797
2108
  disabled: !n.trim() || d,
1798
2109
  onSubmit: l,
1799
- attachments: !s && !a.remote,
2110
+ attachments: !s && !i.remote,
1800
2111
  models: f,
1801
- selectedModel: u ? "" : a.selectedModel,
2112
+ selectedModel: u ? "" : i.selectedModel,
1802
2113
  actions: e.composerActions,
1803
- onModelChange: a.setSelectedModel,
2114
+ onModelChange: i.setSelectedModel,
1804
2115
  modelPlaceholder: t.selectModelPlaceholder,
1805
2116
  minHeight: 44,
1806
2117
  maxHeight: 220
1807
2118
  });
1808
2119
  }
1809
- function gt() {
1810
- let { startOrchestrator: e } = $(), t = Q(), [n, i] = w(""), { hasProviders: a, modelsByProvider: o, selectedModel: s, setSelectedModel: c } = Ue(), l = (t) => {
2120
+ function Lt() {
2121
+ let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = dt(), l = (t) => {
1811
2122
  t.text.trim() && (e(t.text.trim(), {
1812
2123
  attachments: t.files.length > 0 ? t.files : void 0,
1813
2124
  model: t.model || void 0
1814
- }), i(""));
1815
- }, u = a && !s;
1816
- return /* @__PURE__ */ E(r, {
2125
+ }), r(""));
2126
+ }, u = i && !s;
2127
+ return /* @__PURE__ */ k(o, {
1817
2128
  value: n,
1818
- onChange: i,
2129
+ onChange: r,
1819
2130
  placeholder: t.orchestratorStarterPlaceholder,
1820
2131
  disabled: !n.trim() || u,
1821
2132
  onSubmit: l,
1822
2133
  attachments: !0,
1823
- models: mt(o),
2134
+ models: Ft(a),
1824
2135
  selectedModel: s,
1825
2136
  onModelChange: c,
1826
2137
  modelPlaceholder: t.selectModelPlaceholder,
@@ -1828,7 +2139,7 @@ function gt() {
1828
2139
  maxHeight: 220
1829
2140
  });
1830
2141
  }
1831
- function _t(e, t, n = Date.now()) {
2142
+ function Rt(e, t, n = Date.now()) {
1832
2143
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
1833
2144
  numeric: "auto",
1834
2145
  style: "short"
@@ -1840,55 +2151,55 @@ function _t(e, t, n = Date.now()) {
1840
2151
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
1841
2152
  return i.format(0, "minute");
1842
2153
  }
1843
- function vt({ card: e }) {
2154
+ function zt({ card: e }) {
1844
2155
  let t = Q();
1845
- return e.humanSummaryOnly ? /* @__PURE__ */ D("div", {
2156
+ return e.humanSummaryOnly ? /* @__PURE__ */ A("div", {
1846
2157
  className: "space-y-2 rounded-lg border border-border/60 p-3",
1847
- children: [/* @__PURE__ */ D("p", {
2158
+ children: [/* @__PURE__ */ A("p", {
1848
2159
  className: "text-xs font-medium text-foreground",
1849
2160
  children: [
1850
2161
  "\"",
1851
2162
  e.label,
1852
2163
  "\""
1853
2164
  ]
1854
- }), /* @__PURE__ */ E("p", {
2165
+ }), /* @__PURE__ */ k("p", {
1855
2166
  className: "text-xs text-muted-foreground",
1856
2167
  children: e.humanSummary
1857
2168
  })]
1858
- }) : /* @__PURE__ */ D("div", {
2169
+ }) : /* @__PURE__ */ A("div", {
1859
2170
  className: "space-y-2 rounded-lg border border-border/60 p-3",
1860
2171
  children: [
1861
- /* @__PURE__ */ E("p", {
2172
+ /* @__PURE__ */ k("p", {
1862
2173
  className: "text-xs font-medium text-foreground",
1863
- children: u(t.newInstance, { label: e.label })
2174
+ children: m(t.newInstance, { label: e.label })
1864
2175
  }),
1865
- /* @__PURE__ */ E("p", {
2176
+ /* @__PURE__ */ k("p", {
1866
2177
  className: "text-xs text-muted-foreground",
1867
2178
  children: e.humanSummary
1868
2179
  }),
1869
- e.fields.length > 0 && /* @__PURE__ */ E("ul", {
2180
+ e.fields.length > 0 && /* @__PURE__ */ k("ul", {
1870
2181
  className: "space-y-1",
1871
- children: e.fields.map((e) => /* @__PURE__ */ D("li", {
2182
+ children: e.fields.map((e) => /* @__PURE__ */ A("li", {
1872
2183
  className: "flex items-start gap-1.5 text-xs",
1873
- children: [/* @__PURE__ */ E(n, {
2184
+ children: [/* @__PURE__ */ k(n, {
1874
2185
  variant: e.required ? "primary" : "secondary",
1875
2186
  className: "mt-px shrink-0",
1876
2187
  children: e.required ? "richiesto" : "opzionale"
1877
- }), /* @__PURE__ */ D("span", {
2188
+ }), /* @__PURE__ */ A("span", {
1878
2189
  className: "min-w-0",
1879
- children: [/* @__PURE__ */ E("span", {
2190
+ children: [/* @__PURE__ */ k("span", {
1880
2191
  className: "font-mono text-foreground",
1881
2192
  children: e.key
1882
- }), e.humanDescription ? /* @__PURE__ */ D("span", {
2193
+ }), e.humanDescription ? /* @__PURE__ */ A("span", {
1883
2194
  className: "text-muted-foreground",
1884
2195
  children: [" — ", e.humanDescription]
1885
2196
  }) : null]
1886
2197
  })]
1887
2198
  }, e.key))
1888
2199
  }),
1889
- e.example && /* @__PURE__ */ D("p", {
2200
+ e.example && /* @__PURE__ */ A("p", {
1890
2201
  className: "text-xs text-muted-foreground",
1891
- children: ["Esempio: ", /* @__PURE__ */ E("span", {
2202
+ children: ["Esempio: ", /* @__PURE__ */ k("span", {
1892
2203
  className: "font-mono",
1893
2204
  children: e.example
1894
2205
  })]
@@ -1896,38 +2207,38 @@ function vt({ card: e }) {
1896
2207
  ]
1897
2208
  });
1898
2209
  }
1899
- function yt({ messages: e }) {
1900
- return /* @__PURE__ */ E("div", {
2210
+ function Bt({ messages: e }) {
2211
+ return /* @__PURE__ */ k("div", {
1901
2212
  className: "space-y-2 rounded-lg border border-border/60 p-3",
1902
- children: e.map((e, t) => /* @__PURE__ */ E("p", {
2213
+ children: e.map((e, t) => /* @__PURE__ */ k("p", {
1903
2214
  className: "text-xs text-muted-foreground",
1904
2215
  children: e
1905
2216
  }, t))
1906
2217
  });
1907
2218
  }
1908
- function bt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: c, onNewChat: l, onArchivedCurrent: u }) {
1909
- let d = Q(), { locale: f } = m(), [p, h] = w(""), [g, _] = w(0), v = S(() => r ? ve(e) : [], [
2219
+ function Vt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2220
+ let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? Ee(e) : [], [
1910
2221
  e,
1911
2222
  r,
1912
- g
2223
+ h
1913
2224
  ]), y = async (t) => {
1914
- let r = M(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
2225
+ let r = B(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
1915
2226
  if (!i || window.confirm(i)) {
1916
2227
  try {
1917
2228
  await r?.onArchive?.(t.entityId, t.params);
1918
2229
  } catch {
1919
2230
  return;
1920
2231
  }
1921
- _e(e, t.subagentId, t.entityId), n === ye(t.subagentId, t.entityId) && u(), _((e) => e + 1);
2232
+ Te(e, t.subagentId, t.entityId), n === De(t.subagentId, t.entityId) && s(), g((e) => e + 1);
1922
2233
  }
1923
- }, b = S(() => {
2234
+ }, b = T(() => {
1924
2235
  let e = p.trim().toLowerCase();
1925
- return e ? v.filter((t) => {
1926
- let n = M(t.subagentId)?.label ?? t.subagentId;
2236
+ return e ? _.filter((t) => {
2237
+ let n = B(t.subagentId)?.label ?? t.subagentId;
1927
2238
  return t.title.toLowerCase().includes(e) || n.toLowerCase().includes(e);
1928
- }) : v;
1929
- }, [v, p]);
1930
- return /* @__PURE__ */ E(a, {
2239
+ }) : _;
2240
+ }, [_, p]);
2241
+ return /* @__PURE__ */ k(c, {
1931
2242
  trigger: {
1932
2243
  icon: "history",
1933
2244
  title: d.chatHistory
@@ -1938,37 +2249,37 @@ function bt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
1938
2249
  position: "end",
1939
2250
  strategy: "absolute",
1940
2251
  menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
1941
- header: /* @__PURE__ */ D("div", {
2252
+ header: /* @__PURE__ */ A("div", {
1942
2253
  className: "flex items-center gap-2 px-1 pb-1.5",
1943
2254
  children: [
1944
- /* @__PURE__ */ E(s, {
2255
+ /* @__PURE__ */ k(u, {
1945
2256
  name: "search",
1946
2257
  size: 14,
1947
2258
  className: "shrink-0 text-muted-foreground"
1948
2259
  }),
1949
- /* @__PURE__ */ E("input", {
2260
+ /* @__PURE__ */ k("input", {
1950
2261
  autoFocus: !0,
1951
2262
  value: p,
1952
- onChange: (e) => h(e.target.value),
2263
+ onChange: (e) => m(e.target.value),
1953
2264
  placeholder: d.searchChats,
1954
2265
  className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
1955
2266
  }),
1956
- /* @__PURE__ */ E(t, {
2267
+ /* @__PURE__ */ k(t, {
1957
2268
  icon: "square-pen",
1958
2269
  ariaLabel: d.newChat,
1959
2270
  title: d.newChat,
1960
2271
  variant: "link",
1961
2272
  className: "shrink-0",
1962
- onClick: l
2273
+ onClick: o
1963
2274
  })
1964
2275
  ]
1965
2276
  }),
1966
- children: b.length === 0 ? /* @__PURE__ */ E("p", {
2277
+ children: b.length === 0 ? /* @__PURE__ */ k("p", {
1967
2278
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
1968
- children: v.length === 0 ? d.noSavedChats : d.noResults
2279
+ children: _.length === 0 ? d.noSavedChats : d.noResults
1969
2280
  }) : b.map((e) => {
1970
- let t = M(e.subagentId), r = n === ye(e.subagentId, e.entityId);
1971
- return /* @__PURE__ */ E(o, {
2281
+ let t = B(e.subagentId), r = n === De(e.subagentId, e.entityId);
2282
+ return /* @__PURE__ */ k(l, {
1972
2283
  icon: r ? "check" : t?.icon ?? "bot",
1973
2284
  className: r ? "bg-accent font-medium" : void 0,
1974
2285
  actions: [{
@@ -1976,195 +2287,250 @@ function bt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
1976
2287
  label: d.archiveChat,
1977
2288
  onClick: () => void y(e)
1978
2289
  }],
1979
- onClick: () => c(e.subagentId, e.entityId, e),
1980
- children: /* @__PURE__ */ D("span", {
2290
+ onClick: () => a(e.subagentId, e.entityId, e),
2291
+ children: /* @__PURE__ */ A("span", {
1981
2292
  className: "flex min-w-0 flex-1 items-center justify-between gap-2",
1982
- children: [/* @__PURE__ */ D("span", {
2293
+ children: [/* @__PURE__ */ A("span", {
1983
2294
  className: "min-w-0 truncate",
1984
2295
  children: [
1985
- /* @__PURE__ */ E("span", {
2296
+ /* @__PURE__ */ k("span", {
1986
2297
  className: "text-muted-foreground",
1987
2298
  children: t?.label ?? e.subagentId
1988
2299
  }),
1989
2300
  " · ",
1990
2301
  e.title || e.entityId
1991
2302
  ]
1992
- }), /* @__PURE__ */ E("span", {
2303
+ }), /* @__PURE__ */ k("span", {
1993
2304
  className: "shrink-0 text-xs text-muted-foreground",
1994
2305
  title: new Date(e.savedAt).toLocaleString(f),
1995
- children: _t(e.savedAt, f)
2306
+ children: Rt(e.savedAt, f)
1996
2307
  })]
1997
2308
  })
1998
2309
  }, `${e.subagentId}:${e.entityId}`);
1999
2310
  })
2000
2311
  });
2001
2312
  }
2002
- function xt() {
2003
- let { task: e, isOpen: n, pendingGoal: r, orchestratorRunId: i, pageContext: a, pageContextCard: o, anchoredUserMessages: s, pendingResume: c, resumeRunId: l, dismissForeignTask: u, resumeEntityChat: d, pendingManualEntry: f, manualEntryRunId: p, startManualEntry: m, pendingExtraDestinations: h, pendingResumeWithAI: g, resumeWithAIRunId: _, pendingStart: v, startRunId: y, scope: x } = $(), S = Q(), O = C(null), [k, A] = w(!1), j = () => {
2004
- (!e || e.agent.running || e.savedToDisk || window.confirm(S.unsavedConversationConfirm)) && (u(), A(!1));
2005
- }, N = e ? [...e.precedingActivity ?? [], ...e.agent.activity] : [], P = N.length, F = Math.max(0, Math.min(e?.panelExtraAnchorIndex ?? P, P)), I = N.slice(0, F), L = N.slice(F), R = !!(e && !e.agent.running && e.agent.error), z = e?.id === "agentico-orchestrator" && e.scopedSubagentId ? M(e.scopedSubagentId) : void 0, B = z?.manualEntry ? z : null, V = C(!0);
2006
- b(() => {
2007
- let e = O.current;
2313
+ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2314
+ let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [N, P] = D(!1), F = at({
2315
+ defaultWidth: e,
2316
+ minWidth: n,
2317
+ maxWidth: r,
2318
+ onWidthChange: i
2319
+ }), I = () => {
2320
+ (!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(), P(!1));
2321
+ }, L = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], R = L.length, z = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? R, R)), V = L.slice(0, z), H = L.slice(z), U = !!(a && !a.agent.running && a.agent.error), W = new Set(a?.agent.activity.map((e) => e.id) ?? []), G = a ? {
2322
+ canAnswer: (e) => W.has(e),
2323
+ onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2324
+ e && a.onApplied(e);
2325
+ })
2326
+ } : void 0, K = G ? Ge(L, G.canAnswer) : null, q = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? B(a.scopedSubagentId) : void 0, ee = q?.manualEntry ? q : null, J = E(!0);
2327
+ C(() => {
2328
+ let e = M.current;
2008
2329
  if (!e) return;
2009
2330
  let t = () => {
2010
- V.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2331
+ J.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2011
2332
  };
2012
2333
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
2013
- }, [e?.id]), b(() => {
2014
- let e = O.current;
2015
- e && (V.current = !0, e.scrollTop = e.scrollHeight);
2016
- }, [e?.id]);
2017
- let H = N.at(-1)?.detail?.length ?? 0;
2018
- b(() => {
2019
- let e = O.current;
2020
- e && V.current && (e.scrollTop = e.scrollHeight);
2334
+ }, [a?.id]), C(() => {
2335
+ let e = M.current;
2336
+ e && (J.current = !0, e.scrollTop = e.scrollHeight);
2337
+ }, [a?.id]);
2338
+ let te = L.at(-1)?.detail?.length ?? 0;
2339
+ C(() => {
2340
+ let e = M.current;
2341
+ e && J.current && (e.scrollTop = e.scrollHeight);
2021
2342
  }, [
2022
- P,
2023
2343
  R,
2024
- H
2344
+ U,
2345
+ te
2025
2346
  ]);
2026
- let U = C(null);
2027
- b(() => {
2028
- let e = O.current, t = U.current;
2347
+ let Y = E(null);
2348
+ C(() => {
2349
+ let e = M.current, t = Y.current;
2029
2350
  if (!e || !t || typeof ResizeObserver > "u") return;
2030
2351
  let n = new ResizeObserver(() => {
2031
- V.current && (e.scrollTop = e.scrollHeight);
2352
+ J.current && (e.scrollTop = e.scrollHeight);
2032
2353
  });
2033
2354
  return n.observe(t), () => n.disconnect();
2034
- }, [e?.id, n]);
2035
- let W = r ? /* @__PURE__ */ E(dt, { userGoal: r }, i) : null, ee = c ? M(c.subagentId) : void 0, G = c && ee ? /* @__PURE__ */ E(ut, {
2036
- manifest: ee,
2037
- params: c.snapshot.params,
2038
- taskId: ye(c.subagentId, c.entityId),
2355
+ }, [a?.id, o]);
2356
+ let ne = s ? /* @__PURE__ */ k(Nt, { userGoal: s }, c) : null, re = f ? B(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ k(Mt, {
2357
+ manifest: re,
2358
+ params: f.snapshot.params,
2359
+ taskId: De(f.subagentId, f.entityId),
2039
2360
  resumeSeed: {
2040
- history: c.snapshot.history,
2041
- activity: c.snapshot.activity
2361
+ history: f.snapshot.history,
2362
+ activity: f.snapshot.activity
2042
2363
  }
2043
- }, l) : null, K = f ? M(f.subagentId) : void 0, te = f && K ? /* @__PURE__ */ E(ft, {
2044
- manifest: K,
2045
- extraDestinations: f.extraDestinations
2046
- }, p) : null, ne = g ? M(g.subagentId) : void 0, q = g && ne ? /* @__PURE__ */ E(ut, {
2047
- manifest: ne,
2048
- params: g.params,
2364
+ }, p) : null, ae = g ? B(g.subagentId) : void 0, oe = g && ae ? /* @__PURE__ */ k(Pt, {
2365
+ manifest: ae,
2049
2366
  extraDestinations: g.extraDestinations
2050
- }, _) : null, re = v ? M(v.subagentId) : void 0, J = v && re ? /* @__PURE__ */ E(ut, {
2051
- manifest: re,
2052
- params: v.params,
2053
- taskId: v.taskId,
2054
- openingMessage: v.openingMessage
2055
- }, y) : null;
2056
- return n ? /* @__PURE__ */ D(T, { children: [
2057
- W,
2058
- G,
2059
- te,
2060
- q,
2061
- J,
2062
- /* @__PURE__ */ D("div", {
2063
- style: { width: 420 },
2367
+ }, _) : null, se = b ? B(b.subagentId) : void 0, ce = b && se ? /* @__PURE__ */ k(Mt, {
2368
+ manifest: se,
2369
+ params: b.params,
2370
+ extraDestinations: b.extraDestinations
2371
+ }, x) : null, le = S ? B(S.subagentId) : void 0, X = S && le ? /* @__PURE__ */ k(Mt, {
2372
+ manifest: le,
2373
+ params: S.params,
2374
+ taskId: S.taskId,
2375
+ openingMessage: S.openingMessage
2376
+ }, w) : null;
2377
+ return o ? /* @__PURE__ */ A(O, { children: [
2378
+ ne,
2379
+ ie,
2380
+ oe,
2381
+ ce,
2382
+ X,
2383
+ /* @__PURE__ */ A("div", {
2384
+ style: { width: F.width },
2064
2385
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
2065
2386
  children: [
2066
- /* @__PURE__ */ D("div", {
2387
+ /* @__PURE__ */ k(ot, {
2388
+ width: F.width,
2389
+ min: F.min,
2390
+ max: F.max,
2391
+ onResize: F.set,
2392
+ onCommit: F.commit,
2393
+ onReset: F.reset
2394
+ }),
2395
+ /* @__PURE__ */ A("div", {
2067
2396
  className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
2068
2397
  children: [
2069
- /* @__PURE__ */ E("span", {
2398
+ /* @__PURE__ */ k("span", {
2070
2399
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2071
- children: e ? e.title : "Agentico"
2400
+ children: a ? a.title : "Agentico"
2072
2401
  }),
2073
- x && /* @__PURE__ */ E(bt, {
2074
- scopeId: x.id,
2075
- currentTaskId: e?.id ?? null,
2076
- open: k,
2077
- onOpenChange: A,
2078
- onNewChat: j,
2079
- onSelect: (e, t, n) => d(e, t, n),
2080
- onArchivedCurrent: u
2402
+ T && /* @__PURE__ */ k(Vt, {
2403
+ scopeId: T.id,
2404
+ currentTaskId: a?.id ?? null,
2405
+ open: N,
2406
+ onOpenChange: P,
2407
+ onNewChat: I,
2408
+ onSelect: (e, t, n) => h(e, t, n),
2409
+ onArchivedCurrent: m
2081
2410
  }),
2082
- /* @__PURE__ */ E(ze, {})
2411
+ /* @__PURE__ */ k(st, {})
2083
2412
  ]
2084
2413
  }),
2085
- /* @__PURE__ */ E("div", {
2086
- ref: O,
2087
- className: "flex-1 overflow-y-auto px-3 pb-2",
2088
- children: /* @__PURE__ */ E("div", {
2089
- ref: U,
2414
+ /* @__PURE__ */ k("div", {
2415
+ ref: M,
2416
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${K ? "min-h-24" : "min-h-0"}`,
2417
+ children: /* @__PURE__ */ k("div", {
2418
+ ref: Y,
2090
2419
  className: "pt-2",
2091
- children: e ? /* @__PURE__ */ D(T, { children: [
2092
- e.manualEntry && N.length === 0 && /* @__PURE__ */ E("p", {
2420
+ children: a ? /* @__PURE__ */ A(O, { children: [
2421
+ a.manualEntry && L.length === 0 && /* @__PURE__ */ k("p", {
2093
2422
  className: "text-xs text-muted-foreground",
2094
- children: e.manualEntry.prompt
2423
+ children: a.manualEntry.prompt
2424
+ }),
2425
+ /* @__PURE__ */ k(Ye, {
2426
+ activity: V,
2427
+ questions: G,
2428
+ docked: K,
2429
+ pinUserMessages: !K
2095
2430
  }),
2096
- /* @__PURE__ */ E(Re, { activity: I }),
2097
- e.panelExtra && /* @__PURE__ */ E("div", {
2431
+ a.panelExtra && /* @__PURE__ */ k("div", {
2098
2432
  className: "mt-3",
2099
- children: e.panelExtra
2433
+ children: a.panelExtra
2100
2434
  }),
2101
- L.length > 0 && /* @__PURE__ */ E(Re, { activity: L }),
2102
- !e.agent.running && e.agent.error && /* @__PURE__ */ D("div", {
2435
+ H.length > 0 && /* @__PURE__ */ k(Ye, {
2436
+ activity: H,
2437
+ questions: G,
2438
+ docked: K,
2439
+ pinUserMessages: !K
2440
+ }),
2441
+ !a.agent.running && a.agent.error && /* @__PURE__ */ A("div", {
2103
2442
  className: "mt-2 flex items-center gap-2",
2104
2443
  children: [
2105
- /* @__PURE__ */ E("p", {
2444
+ /* @__PURE__ */ k("p", {
2106
2445
  className: "flex-1 text-xs text-destructive",
2107
- children: e.agent.error
2446
+ children: a.agent.error
2108
2447
  }),
2109
- /* @__PURE__ */ E(t, {
2110
- label: S.retry,
2448
+ /* @__PURE__ */ k(t, {
2449
+ label: j.retry,
2111
2450
  variant: "secondary",
2112
2451
  className: "shrink-0",
2113
2452
  onClick: () => {
2114
- e.agent.sendMessage(S.retryMessage).then((t) => {
2115
- t && e.onApplied(t);
2453
+ a.agent.sendMessage(j.retryMessage).then((e) => {
2454
+ e && a.onApplied(e);
2116
2455
  });
2117
2456
  }
2118
2457
  }),
2119
- !e.agent.remote && /* @__PURE__ */ E(t, {
2120
- label: S.continueWithoutAi,
2458
+ !a.agent.remote && /* @__PURE__ */ k(t, {
2459
+ label: j.continueWithoutAi,
2121
2460
  variant: "secondary",
2122
2461
  className: "shrink-0",
2123
2462
  onClick: () => {
2124
- if (B) {
2125
- m(B.id, h);
2463
+ if (ee) {
2464
+ v(ee.id, y);
2126
2465
  return;
2127
2466
  }
2128
- let t = e.agent.runFallback();
2129
- t && e.onApplied(t);
2467
+ let e = a.agent.runFallback();
2468
+ e && a.onApplied(e);
2130
2469
  }
2131
2470
  })
2132
2471
  ]
2133
2472
  })
2134
- ] }) : s.length > 0 ? /* @__PURE__ */ E(yt, { messages: s }) : o ? /* @__PURE__ */ E(vt, { card: o }) : /* @__PURE__ */ E("p", {
2473
+ ] }) : d.length > 0 ? /* @__PURE__ */ k(Bt, { messages: d }) : u ? /* @__PURE__ */ k(zt, { card: u }) : /* @__PURE__ */ k("p", {
2135
2474
  className: "text-xs text-muted-foreground",
2136
- children: a ?? S.orchestratorStarterHint
2475
+ children: l ?? j.orchestratorStarterHint
2137
2476
  })
2138
2477
  })
2139
2478
  }),
2140
- /* @__PURE__ */ D("div", {
2479
+ a && K ? /* @__PURE__ */ A("section", {
2480
+ "aria-label": j.pendingQuestions,
2481
+ className: "flex min-h-0 shrink flex-col border-t border-border/60",
2482
+ children: [
2483
+ a.panelActions && /* @__PURE__ */ k("div", {
2484
+ className: "shrink-0 px-4 pt-3",
2485
+ children: a.panelActions
2486
+ }),
2487
+ /* @__PURE__ */ k("div", {
2488
+ className: "min-h-0 overflow-y-auto px-4 py-3",
2489
+ children: /* @__PURE__ */ k(Ke, {
2490
+ entry: K.entry,
2491
+ part: K.part,
2492
+ questions: G,
2493
+ autoFocus: !0
2494
+ }, `${K.entry.id}:${K.part.id}`)
2495
+ }),
2496
+ a.agent.running && /* @__PURE__ */ k("div", {
2497
+ className: "flex shrink-0 justify-end px-4 pb-3",
2498
+ children: /* @__PURE__ */ k(t, {
2499
+ icon: "square",
2500
+ label: j.stop,
2501
+ variant: "secondary",
2502
+ onClick: a.agent.stop
2503
+ })
2504
+ })
2505
+ ]
2506
+ }) : /* @__PURE__ */ A("div", {
2141
2507
  className: "border-t border-border/60 px-4 py-3",
2142
- children: [e?.panelActions && /* @__PURE__ */ E("div", {
2508
+ children: [a?.panelActions && /* @__PURE__ */ k("div", {
2143
2509
  className: "mb-2",
2144
- children: e.panelActions
2145
- }), e ? /* @__PURE__ */ E(ht, { task: e }, e.id) : /* @__PURE__ */ E(gt, {})]
2510
+ children: a.panelActions
2511
+ }), a ? /* @__PURE__ */ k(It, { task: a }, a.id) : /* @__PURE__ */ k(Lt, {})]
2146
2512
  })
2147
2513
  ]
2148
2514
  })
2149
- ] }) : /* @__PURE__ */ D(T, { children: [
2150
- W,
2151
- G,
2152
- te,
2153
- q,
2154
- J
2515
+ ] }) : /* @__PURE__ */ A(O, { children: [
2516
+ ne,
2517
+ ie,
2518
+ oe,
2519
+ ce,
2520
+ X
2155
2521
  ] });
2156
2522
  }
2157
2523
  //#endregion
2158
2524
  //#region src/presentation/useAgenticoPageContext.ts
2159
- function St(e, t) {
2160
- let { setPageContext: n } = $(), r = C(crypto.randomUUID()).current;
2161
- b(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2525
+ function Ut(e, t) {
2526
+ let { setPageContext: n } = $(), r = E(crypto.randomUUID()).current;
2527
+ C(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2162
2528
  }
2163
2529
  //#endregion
2164
2530
  //#region src/presentation/useSubagentComponentContext.ts
2165
- function Ct(e, t, n, r, i = !0, a) {
2166
- let { registerComponentAnchor: o } = $(), s = C(crypto.randomUUID()).current, c = C(n);
2167
- c.current = n, b(() => {
2531
+ function Wt(e, t, n, r, i = !0, a) {
2532
+ let { registerComponentAnchor: o } = $(), s = E(crypto.randomUUID()).current, c = E(n);
2533
+ c.current = n, C(() => {
2168
2534
  if (i) return o(s, {
2169
2535
  subagentId: e,
2170
2536
  componentKey: t,
@@ -2181,6 +2547,6 @@ function Ct(e, t, n, r, i = !0, a) {
2181
2547
  ]);
2182
2548
  }
2183
2549
  //#endregion
2184
- export { pt as AGENTICO_WIDTH, xt as Agentico, Ee as AgenticoProvider, ze as AgenticoToggle, oe as JSON_EXPORT_DESTINATION_ID, re as MICRO_PROMPT_REGISTRY, we as ORCHESTRATOR_TASK_ID, q as SUMMARY_MICRO_PROMPT, be as agenticoDe, xe as agenticoEn, Se as agenticoIt, z as agenticoPromptsEn, B as agenticoPromptsIt, Ce as agenticoTranslations, J as applyMicroPrompts, H as configureAgenticoPrompts, de as configureEntityChatStore, F as createCrossAgentTools, O as defineSubagent, ye as entityChatTaskId, Y as extractErrorMessage, ie as extractJsonBlock, M as findSubagentManifest, U as getAgenticoPrompts, le as getDestinationRegistry, he as getEntityChat, ct as getSubagentControls, j as getSubagentRegistry, rt as getSubagentReport, X as jsonExportDestination, ve as listEntityChats, P as registerCrossAgentTools, ce as registerDestinations, st as registerSubagentControls, nt as registerSubagentReports, A as registerSubagents, _e as removeEntityChat, ne as renderRegistryCli, te as renderSubagentCli, W as resetAgenticoPrompts, ge as saveEntityChat, I as toJsonSchema, L as toMcpTool, qe as useAgent, $ as useAgentico, Q as useAgenticoI18n, St as useAgenticoPageContext, Ct as useSubagentComponentContext };
2550
+ export { Qe as AGENTICO_MAX_WIDTH, Ze as AGENTICO_MIN_WIDTH, Xe as AGENTICO_WIDTH, $e as AGENTICO_WIDTH_STORAGE_KEY, Ht as Agentico, Pe as AgenticoProvider, st as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, fe as JSON_EXPORT_DESTINATION_ID, le as MICRO_PROMPT_REGISTRY, Me as ORCHESTRATOR_TASK_ID, ce as SUMMARY_MICRO_PROMPT, Oe as agenticoDe, ke as agenticoEn, Ae as agenticoIt, q as agenticoPromptsEn, ee as agenticoPromptsIt, je as agenticoTranslations, X as applyMicroPrompts, te as configureAgenticoPrompts, ve as configureEntityChatStore, U as createCrossAgentTools, I as defineSubagent, De as entityChatTaskId, Z as extractErrorMessage, ue as extractJsonBlock, B as findSubagentManifest, F as formatQuestionAnswers, Y as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, At as getSubagentControls, z as getSubagentRegistry, Tt as getSubagentReport, pe as jsonExportDestination, Ee as listEntityChats, P as messagePartsText, H as registerCrossAgentTools, he as registerDestinations, kt as registerSubagentControls, wt as registerSubagentReports, R as registerSubagents, Te as removeEntityChat, se as renderRegistryCli, oe as renderSubagentCli, ne as resetAgenticoPrompts, we as saveEntityChat, W as toJsonSchema, G as toMcpTool, N as upsertMessagePart, ht as useAgent, $ as useAgentico, Q as useAgenticoI18n, Ut as useAgenticoPageContext, Wt as useSubagentComponentContext };
2185
2551
 
2186
2552
  //# sourceMappingURL=index.mjs.map