@llmnative/agentico 0.5.0 → 0.7.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
@@ -40,33 +40,33 @@ function B(e) {
40
40
  //#endregion
41
41
  //#region src/domain/crossAgentTools.ts
42
42
  var V = [];
43
- function H(...e) {
43
+ function ee(...e) {
44
44
  V = e;
45
45
  }
46
- function U(e) {
46
+ function H(e) {
47
47
  return V.flatMap((t) => t(e));
48
48
  }
49
49
  //#endregion
50
50
  //#region src/domain/mcpTool.ts
51
- function W(t) {
51
+ function U(t) {
52
52
  let { $schema: n, ...r } = e(t, {
53
53
  target: "jsonSchema7",
54
54
  $refStrategy: "none"
55
55
  });
56
56
  return r;
57
57
  }
58
- function G(e, t, n, r) {
58
+ function W(e, t, n, r) {
59
59
  return {
60
60
  name: e,
61
61
  description: t,
62
- inputSchema: W(n),
63
- ...r ? { outputSchema: W(r) } : {}
62
+ inputSchema: U(n),
63
+ ...r ? { outputSchema: U(r) } : {}
64
64
  };
65
65
  }
66
66
  //#endregion
67
67
  //#region src/domain/subagentUsageCard.ts
68
- function K(e) {
69
- let t = W(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
68
+ function G(e) {
69
+ let t = U(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
70
70
  return Object.entries(n).map(([t, n]) => {
71
71
  let i = typeof n.description == "string" ? n.description : "";
72
72
  return {
@@ -80,7 +80,7 @@ function K(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/domain/prompts.ts
83
- var q = {
83
+ var K = {
84
84
  orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
85
85
  responseRules: [
86
86
  "BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
@@ -99,6 +99,7 @@ var q = {
99
99
  userRequestHeading: "## User request",
100
100
  noToolsAvailable: "No tools available.",
101
101
  stopCallingTools: "Stop calling tools. Answer NOW with the final result, in the required format, using everything collected so far.",
102
+ toolRejected: "Not done: the person rejected this action{reason}. Do not call it again unless they ask for it.",
102
103
  handoffQueued: "{label} has been queued for the real execution — the result is not available in this conversation yet.",
103
104
  closingSummary: [
104
105
  "When you are done answering (with or without tools in this turn),",
@@ -108,7 +109,7 @@ var q = {
108
109
  "block requested above, never before it and never instead of it."
109
110
  ].join(" "),
110
111
  multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on."
111
- }, ee = {
112
+ }, q = {
112
113
  orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
113
114
  responseRules: [
114
115
  "PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
@@ -127,6 +128,7 @@ var q = {
127
128
  userRequestHeading: "## Richiesta dell'utente",
128
129
  noToolsAvailable: "Nessun tool disponibile.",
129
130
  stopCallingTools: "Basta chiamare tool. Rispondi ORA con il risultato finale, nel formato richiesto, usando tutte le informazioni raccolte finora.",
131
+ toolRejected: "Non fatto: la persona ha rifiutato questa azione{reason}. Non richiamarla se non te lo chiede.",
130
132
  handoffQueued: "{label} è stato messo in coda per l'esecuzione reale — il risultato non è ancora disponibile in questa conversazione.",
131
133
  closingSummary: [
132
134
  "Quando hai finito di rispondere (con o senza aver usato dei tool in questo turno),",
@@ -136,7 +138,7 @@ var q = {
136
138
  "richiesto sopra, mai prima e mai al posto suo."
137
139
  ].join(" "),
138
140
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
139
- }, J = q;
141
+ }, J = K;
140
142
  function te(e) {
141
143
  J = {
142
144
  ...J,
@@ -147,7 +149,7 @@ function Y() {
147
149
  return J;
148
150
  }
149
151
  function ne() {
150
- J = q;
152
+ J = K;
151
153
  }
152
154
  //#endregion
153
155
  //#region src/domain/cli/renderManifestCli.ts
@@ -155,7 +157,7 @@ function re(e, t) {
155
157
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
156
158
  }
157
159
  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}` : ""}`);
160
+ let n = G(t), r = re(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
159
161
  return [
160
162
  `COMMAND: ${e} ${t.name}`,
161
163
  ` ${t.summary}`,
@@ -349,6 +351,10 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
349
351
  modelRequestError: "Fehler bei der Anfrage an das Modell",
350
352
  noProviderResponse: "Keine Antwort vom AI-Provider.",
351
353
  noActiveSession: "Keine aktive Sitzung — zuerst run() aufrufen.",
354
+ approvalHeader: "Freigabe",
355
+ approve: "Freigeben",
356
+ reject: "Ablehnen",
357
+ approveQuestion: "Freigeben? {action}",
352
358
  requestInProgress: "Eine andere Anfrage läuft bereits.",
353
359
  invalidResponse: "Ungültige AI-Antwort.",
354
360
  responseReceived: "Antwort erhalten",
@@ -401,6 +407,10 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
401
407
  modelRequestError: "Error in the request to the model",
402
408
  noProviderResponse: "No response from the AI provider.",
403
409
  noActiveSession: "No active session — call run() first.",
410
+ approvalHeader: "Approval",
411
+ approve: "Approve",
412
+ reject: "Reject",
413
+ approveQuestion: "Approve? {action}",
404
414
  requestInProgress: "Another request is already running.",
405
415
  invalidResponse: "Invalid AI response.",
406
416
  responseReceived: "Response received",
@@ -453,6 +463,10 @@ var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
453
463
  modelRequestError: "Errore nella richiesta al modello",
454
464
  noProviderResponse: "Nessuna risposta dal provider AI.",
455
465
  noActiveSession: "Nessuna sessione attiva — chiama prima run().",
466
+ approvalHeader: "Approvazione",
467
+ approve: "Approva",
468
+ reject: "Rifiuta",
469
+ approveQuestion: "Approvi? {action}",
456
470
  requestInProgress: "Un'altra richiesta è già in corso.",
457
471
  invalidResponse: "Risposta AI non valida.",
458
472
  responseReceived: "Risposta ricevuta",
@@ -552,21 +566,21 @@ function Pe({ children: e, scope: t = null }) {
552
566
  agenticoHint: n,
553
567
  userMessage: t.userMessage
554
568
  };
555
- }).filter((e) => e !== null), [z]), H = T(() => V.map((e) => e.userMessage), [V]), U = T(() => {
569
+ }).filter((e) => e !== null), [z]), ee = T(() => V.map((e) => e.userMessage), [V]), H = T(() => {
556
570
  if (V.length === 0) return null;
557
571
  if (V.length === 1) return V[0].agenticoHint;
558
572
  let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
559
573
  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) => {
574
+ }, [V]) ?? P?.text ?? null, U = V.length > 0 ? null : P?.card ?? null, W = T(() => [...new Set(R.map((e) => e.subagentId))], [R]), G = W.length === 1 ? W[0] : W.length === 0 ? P?.card?.subagentId ?? null : null, K = x((e, t) => {
561
575
  u();
562
576
  let n = i.current;
563
577
  if (n?.id === "agentico-orchestrator") return;
564
- let r = K && n?.id.startsWith(`subagent-${K}-`) ? n : void 0;
578
+ let r = G && n?.id.startsWith(`subagent-${G}-`) ? n : void 0;
565
579
  w(r ? {
566
580
  taskId: r.id,
567
581
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
568
582
  } : 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) => {
583
+ }, [u, G]), q = x((e, t, n, a, o, s) => {
570
584
  if (!n || !a) return;
571
585
  let c = i.current;
572
586
  if (!c || c.id !== n) return;
@@ -617,14 +631,14 @@ function Pe({ children: e, scope: t = null }) {
617
631
  closeTask: c,
618
632
  toggleOpen: l,
619
633
  pendingGoal: d,
620
- startOrchestrator: q,
621
- pageContext: U,
622
- pageContextCard: W,
634
+ startOrchestrator: K,
635
+ pageContext: H,
636
+ pageContextCard: U,
623
637
  setPageContext: N,
624
- scopedSubagentId: K,
638
+ scopedSubagentId: G,
625
639
  pendingScopedSubagentId: O,
626
640
  componentAnchors: R,
627
- anchoredUserMessages: H,
641
+ anchoredUserMessages: ee,
628
642
  registerComponentAnchor: L,
629
643
  openPanel: u,
630
644
  pendingExtraDestinations: p,
@@ -632,7 +646,7 @@ function Pe({ children: e, scope: t = null }) {
632
646
  pendingModel: _,
633
647
  orchestratorRunId: y,
634
648
  pendingCarryOver: S,
635
- commitEntityChat: ee,
649
+ commitEntityChat: q,
636
650
  resumeEntityChat: ie,
637
651
  pendingResume: J,
638
652
  resumeRunId: ne,
@@ -654,14 +668,14 @@ function Pe({ children: e, scope: t = null }) {
654
668
  c,
655
669
  l,
656
670
  d,
657
- q,
671
+ K,
672
+ H,
658
673
  U,
659
- W,
660
674
  N,
661
- K,
675
+ G,
662
676
  O,
663
677
  R,
664
- H,
678
+ ee,
665
679
  L,
666
680
  u,
667
681
  p,
@@ -669,7 +683,7 @@ function Pe({ children: e, scope: t = null }) {
669
683
  _,
670
684
  y,
671
685
  S,
672
- ee,
686
+ q,
673
687
  ie,
674
688
  J,
675
689
  ne,
@@ -1162,12 +1176,25 @@ function dt() {
1162
1176
  };
1163
1177
  }
1164
1178
  //#endregion
1179
+ //#region src/domain/approval.ts
1180
+ var ft = "approval";
1181
+ function pt(e, t) {
1182
+ return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
1183
+ }
1184
+ function mt(e, t, n) {
1185
+ let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
1186
+ return {
1187
+ approved: r.includes(t) && !r.includes(n),
1188
+ ...i ? { reason: i } : {}
1189
+ };
1190
+ }
1191
+ //#endregion
1165
1192
  //#region src/presentation/useAgent.ts
1166
- var ft = 20, pt = 26e4;
1167
- function mt(e) {
1168
- return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= pt);
1193
+ var ht = 20, gt = 26e4;
1194
+ function _t(e) {
1195
+ return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= gt);
1169
1196
  }
1170
- function ht(e, t = {}) {
1197
+ function vt(e, t = {}) {
1171
1198
  let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = dt(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
1172
1199
  b((t) => {
1173
1200
  let n = typeof e == "function" ? e(t) : e;
@@ -1177,10 +1204,10 @@ function ht(e, t = {}) {
1177
1204
  T.current = w;
1178
1205
  let O = E(null), k = E(!1), A = E(null), M = () => {
1179
1206
  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) ?? "");
1207
+ }, I = _()?.registry ?? {}, L = r && c ? h(c) : null, R = L ? I[L.provider] : null, z = e.executor, B = !!z, [V, ee] = D([]), [H, W] = D(""), G = E(""), K = (e) => {
1208
+ G.current = e, W(e);
1209
+ }, q = (e) => {
1210
+ ee(z?.models?.(e) ?? []), K(z?.defaultModel?.(e) ?? "");
1184
1211
  }, J = async (e, t, n, r) => {
1185
1212
  let i = O.current;
1186
1213
  if (!i || !z) return m(T.current.noActiveSession), null;
@@ -1274,7 +1301,7 @@ function ht(e, t = {}) {
1274
1301
  text: e,
1275
1302
  first: t,
1276
1303
  signal: a.signal,
1277
- ...n || K.current ? { model: n || K.current } : {},
1304
+ ...n || G.current ? { model: n || G.current } : {},
1278
1305
  ...r ? { answers: {
1279
1306
  id: r.id,
1280
1307
  answers: r.answers
@@ -1332,13 +1359,47 @@ function ht(e, t = {}) {
1332
1359
  let a = r ? h(r) : L, o = a ? I[a.provider] : null;
1333
1360
  if (!o || !a) return m(T.current.noProviderAvailable), null;
1334
1361
  n?.length && (i.attachmentsRef.current = [...i.attachmentsRef.current ?? [], ...n]);
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) => ({
1362
+ let s = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= gt ? `\n\n[File allegato: ${e.name}]\n${d.decodeBase64Text(e.base64)}` : `\n\n[File allegato: ${e.name} — troppo grande per essere incollato qui. Usa uno dei tool di lettura file disponibili (es. list_csv_columns/extract_csv_column) per leggerne il contenuto prima di chiedere altro all'utente.]`).join(""), c = _t(n ?? []), l = i.tools.map((e) => ({
1336
1363
  name: e.name,
1337
1364
  description: e.description,
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 ? {
1365
+ inputSchema: U(e.inputSchema)
1366
+ })), u = (e, t, n, r) => {
1367
+ let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
1368
+ S((e) => [...e, {
1369
+ id: a,
1370
+ kind: "thinking",
1371
+ label: i.approvalHeader,
1372
+ status: "running",
1373
+ parts: [{
1374
+ type: "questions",
1375
+ id: ft,
1376
+ questions: [{
1377
+ header: i.approvalHeader,
1378
+ question: i.approveQuestion.replace("{action}", o),
1379
+ options: [{ label: i.approve }, { label: i.reject }],
1380
+ custom: !0
1381
+ }]
1382
+ }]
1383
+ }]);
1384
+ let s = `${a}:${ft}`;
1385
+ return new Promise((e, t) => {
1386
+ let n = () => {
1387
+ C.current.delete(s), g(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
1388
+ };
1389
+ if (r.aborted) {
1390
+ n();
1391
+ return;
1392
+ }
1393
+ r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
1394
+ resolve: (t) => {
1395
+ r.removeEventListener("abort", n), g(a, "done"), e(mt(t, i.approve, i.reject));
1396
+ },
1397
+ reject: t
1398
+ });
1399
+ });
1400
+ }, f = new Map(i.tools.map((e) => [e.name, e])), p = new AbortController();
1401
+ A.current = p;
1402
+ let g = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
1342
1403
  ...i,
1343
1404
  status: t,
1344
1405
  ...n === void 0 ? {} : { detail: n },
@@ -1346,7 +1407,7 @@ function ht(e, t = {}) {
1346
1407
  } : i));
1347
1408
  try {
1348
1409
  let n = i.history, r = t;
1349
- for (let t = 0; t < ft; t++) {
1410
+ for (let t = 0; t < ht; t++) {
1350
1411
  let d = crypto.randomUUID();
1351
1412
  S((e) => [...e, {
1352
1413
  id: d,
@@ -1361,7 +1422,7 @@ function ht(e, t = {}) {
1361
1422
  model: a.model,
1362
1423
  history: n,
1363
1424
  tools: l.length ? l : void 0,
1364
- signal: f.signal,
1425
+ signal: p.signal,
1365
1426
  attachments: t === 0 ? c : void 0,
1366
1427
  logId: i.logId
1367
1428
  });
@@ -1369,13 +1430,20 @@ function ht(e, t = {}) {
1369
1430
  return i.history = [...n, ...r ? [{
1370
1431
  role: "user",
1371
1432
  content: r + s
1372
- }] : []], f.signal.aborted ? (p(d, "stopped"), e.fallback(i.params, i.context)) : (p(d, "error"), m(Z(t)), null);
1433
+ }] : []], p.signal.aborted ? (g(d, "stopped"), e.fallback(i.params, i.context)) : (g(d, "error"), m(Z(t)), null);
1373
1434
  }
1374
1435
  if (i.history = [...n, ...r ? [{
1375
1436
  role: "user",
1376
1437
  content: r + s
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 = [
1438
+ }] : []], !h) return p.signal.aborted ? (g(d, "stopped"), e.fallback(i.params, i.context)) : (g(d, "error"), m(T.current.noProviderResponse), null);
1439
+ if (h.type === "text") return g(d, "done", h.text), e.conversational && h.text.trim() && S((e) => e.map((e) => e.id === d ? {
1440
+ ...e,
1441
+ parts: [{
1442
+ type: "text",
1443
+ id: "text",
1444
+ text: h.text
1445
+ }]
1446
+ } : e)), i.history = [
1379
1447
  ...n,
1380
1448
  ...r ? [{
1381
1449
  role: "user",
@@ -1390,19 +1458,43 @@ function ht(e, t = {}) {
1390
1458
  responsePreview: h.text.length > 2e3 ? `${h.text.slice(0, 1e3)}\n…[troncato qui nel log, ${h.text.length} caratteri totali]…\n${h.text.slice(-1e3)}` : h.text,
1391
1459
  params: i.params
1392
1460
  }), m(T.current.invalidResponse), e.fallback(i.params, i.context));
1393
- let g = h.toolCalls.map((e) => {
1394
- let t = u.get(e.name);
1461
+ let _ = h.toolCalls.map((e) => {
1462
+ let t = f.get(e.name);
1395
1463
  return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
1396
1464
  });
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}`;
1465
+ g(d, "done", h.text || void 0, h.text ? void 0 : _);
1466
+ let v = /* @__PURE__ */ new Map();
1467
+ for (let t of h.toolCalls) {
1468
+ let n = f.get(t.name);
1469
+ if (n && pt(n, t.input)) try {
1470
+ v.set(t.id, await u(t.id, n, t.input, p.signal));
1471
+ } catch {
1472
+ return e.fallback(i.params, i.context);
1473
+ }
1474
+ }
1475
+ let y = await Promise.all(h.toolCalls.map(async (e) => {
1476
+ let t = f.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = v.get(e.id);
1477
+ if (r && !r.approved) {
1478
+ S((t) => [...t, {
1479
+ id: e.id,
1480
+ kind: "tool",
1481
+ label: n,
1482
+ status: "stopped"
1483
+ }]);
1484
+ let t = Y().toolRejected.replace("{reason}", r.reason ? ` (${r.reason})` : "");
1485
+ return {
1486
+ toolCallId: e.id,
1487
+ name: e.name,
1488
+ output: t,
1489
+ isError: !0
1490
+ };
1491
+ }
1400
1492
  if (S((t) => [...t, {
1401
1493
  id: e.id,
1402
1494
  kind: "tool",
1403
1495
  label: n,
1404
1496
  status: "running"
1405
- }]), !t) return p(e.id, "error"), {
1497
+ }]), !t) return g(e.id, "error"), {
1406
1498
  toolCallId: e.id,
1407
1499
  name: e.name,
1408
1500
  output: `Tool sconosciuto: ${e.name}`,
@@ -1410,13 +1502,13 @@ function ht(e, t = {}) {
1410
1502
  };
1411
1503
  try {
1412
1504
  let n = await t.execute(e.input);
1413
- return p(e.id, "done"), {
1505
+ return g(e.id, "done"), {
1414
1506
  toolCallId: e.id,
1415
1507
  name: e.name,
1416
1508
  output: n
1417
1509
  };
1418
1510
  } catch (t) {
1419
- return p(e.id, "error"), {
1511
+ return g(e.id, "error"), {
1420
1512
  toolCallId: e.id,
1421
1513
  name: e.name,
1422
1514
  output: Z(t),
@@ -1437,7 +1529,7 @@ function ht(e, t = {}) {
1437
1529
  },
1438
1530
  {
1439
1531
  role: "tool_result",
1440
- results: _
1532
+ results: y
1441
1533
  }
1442
1534
  ], r = "";
1443
1535
  }
@@ -1454,21 +1546,21 @@ function ht(e, t = {}) {
1454
1546
  prompt: X(Y().stopCallingTools, e.microPromptIds),
1455
1547
  model: a.model,
1456
1548
  history: n,
1457
- signal: f.signal,
1549
+ signal: p.signal,
1458
1550
  logId: i.logId
1459
1551
  });
1460
1552
  } catch {
1461
1553
  h = null;
1462
1554
  }
1463
1555
  if (h?.type === "text") {
1464
- p(d, "done", h.text), i.history = [...n, {
1556
+ g(d, "done", h.text), i.history = [...n, {
1465
1557
  role: "assistant",
1466
1558
  content: h.text
1467
1559
  }];
1468
1560
  let t = e.parseResponse(h.text, i.params, i.context);
1469
1561
  if (t) return t;
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);
1562
+ } else g(d, p.signal.aborted ? "stopped" : "error"), i.history = n;
1563
+ return p.signal.aborted || m(T.current.tooManyToolTurns), e.fallback(i.params, i.context);
1472
1564
  } finally {
1473
1565
  A.current = null;
1474
1566
  }
@@ -1477,8 +1569,8 @@ function ht(e, t = {}) {
1477
1569
  enabled: r,
1478
1570
  setEnabled: i,
1479
1571
  hasProviders: a,
1480
- selectedModel: B ? U : c,
1481
- setSelectedModel: B ? q : l,
1572
+ selectedModel: B ? H : c,
1573
+ setSelectedModel: B ? K : l,
1482
1574
  modelsByProvider: o,
1483
1575
  modelsLoading: s,
1484
1576
  running: u,
@@ -1506,7 +1598,7 @@ function ht(e, t = {}) {
1506
1598
  history: [],
1507
1599
  logId: crypto.randomUUID(),
1508
1600
  attachmentsRef: a
1509
- }, B) return v(!0), ee(t), await J(n?.openingMessage ?? "", !0);
1601
+ }, B) return v(!0), q(t), await J(n?.openingMessage ?? "", !0);
1510
1602
  let s = n?.model || void 0, c = s ? !!I[h(s)?.provider ?? ""] : !!R;
1511
1603
  if (!r || !c) {
1512
1604
  v(!1);
@@ -1542,7 +1634,7 @@ function ht(e, t = {}) {
1542
1634
  history: n.history,
1543
1635
  logId: crypto.randomUUID(),
1544
1636
  attachmentsRef: a
1545
- }, B && ee(t), v(B || r && !!R);
1637
+ }, B && q(t), v(B || r && !!R);
1546
1638
  } catch (e) {
1547
1639
  m(Z(e));
1548
1640
  } finally {
@@ -1594,23 +1686,23 @@ function ht(e, t = {}) {
1594
1686
  }
1595
1687
  //#endregion
1596
1688
  //#region src/domain/orchestrator/prompt.ts
1597
- function gt() {
1689
+ function yt() {
1598
1690
  let e = Y();
1599
1691
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1600
1692
  }
1601
- function _t(e, t, n) {
1693
+ function bt(e, t, n) {
1602
1694
  let r = Y(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1603
1695
  return `${r.orchestratorIntro}
1604
1696
 
1605
1697
  ${r.toolsHeading}
1606
1698
  ${t}
1607
1699
  ${i}
1608
- ${gt()}
1700
+ ${yt()}
1609
1701
 
1610
1702
  ${r.userRequestHeading}
1611
1703
  ${e}`;
1612
1704
  }
1613
- function vt(e, t) {
1705
+ function xt(e, t) {
1614
1706
  return t ? {
1615
1707
  kind: "handoff",
1616
1708
  ...t
@@ -1621,27 +1713,27 @@ function vt(e, t) {
1621
1713
  }
1622
1714
  //#endregion
1623
1715
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1624
- function yt(e) {
1716
+ function St(e) {
1625
1717
  return z().filter((t) => !t.onlyWhenAnchored || e === t.id);
1626
1718
  }
1627
- function bt(e) {
1719
+ function Ct(e) {
1628
1720
  return {
1629
1721
  buildContext(e) {
1630
1722
  return {
1631
- cliCatalog: se(yt(e.scopedSubagentId)),
1723
+ cliCatalog: se(St(e.scopedSubagentId)),
1632
1724
  handoff: { current: null },
1633
1725
  collected: {}
1634
1726
  };
1635
1727
  },
1636
1728
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1637
- return _t(e, n, t);
1729
+ return bt(e, n, t);
1638
1730
  },
1639
1731
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1640
- return `${e}\n\n${gt()}\n\n${Y().toolsHeading}\n${n}`;
1732
+ return `${e}\n\n${yt()}\n\n${Y().toolsHeading}\n${n}`;
1641
1733
  },
1642
1734
  parseResponse(e, t, n) {
1643
1735
  let r = n.handoff.current;
1644
- return n.handoff.current = null, vt(e, r);
1736
+ return n.handoff.current = null, xt(e, r);
1645
1737
  },
1646
1738
  fallback() {
1647
1739
  return {
@@ -1653,11 +1745,11 @@ function bt(e) {
1653
1745
  return t.kind === "chat" ? t.message : e.continueWithoutAi;
1654
1746
  },
1655
1747
  getTools(t, n, r) {
1656
- let i = U({
1748
+ let i = H({
1657
1749
  attachmentsRef: r,
1658
1750
  collected: n.collected,
1659
1751
  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) => ({
1752
+ }), a = t.scopedSubagentId ? B(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = St(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
1661
1753
  name: `${t.id}_${r.name}`,
1662
1754
  description: `${t.label}: ${r.summary}`,
1663
1755
  inputSchema: r.inputSchema,
@@ -1681,12 +1773,12 @@ function bt(e) {
1681
1773
  }
1682
1774
  //#endregion
1683
1775
  //#region src/presentation/deriveHistoryTitle.ts
1684
- function xt(e, t) {
1776
+ function wt(e, t) {
1685
1777
  return e.deriveHistoryTitle?.(t) ?? e.label;
1686
1778
  }
1687
1779
  //#endregion
1688
1780
  //#region src/presentation/ResultDestinationPicker.tsx
1689
- function St({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1781
+ function Tt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1690
1782
  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();
1691
1783
  e.destinationIds.forEach((e) => {
1692
1784
  let t = v[e];
@@ -1704,7 +1796,7 @@ function St({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1704
1796
  storageProvider: l?.storageProvider ?? null,
1705
1797
  proxyFetch: u
1706
1798
  }, 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));
1799
+ h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, wt(e, n));
1708
1800
  } catch (e) {
1709
1801
  _(e instanceof Error ? e.message : String(e));
1710
1802
  } finally {
@@ -1737,16 +1829,16 @@ function St({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1737
1829
  }
1738
1830
  //#endregion
1739
1831
  //#region src/presentation/reports/subagentReportRegistry.tsx
1740
- var Ct = {};
1741
- function wt(e) {
1742
- Object.assign(Ct, e);
1832
+ var Et = {};
1833
+ function Dt(e) {
1834
+ Object.assign(Et, e);
1743
1835
  }
1744
- function Tt(e) {
1745
- return Ct[e];
1836
+ function Ot(e) {
1837
+ return Et[e];
1746
1838
  }
1747
1839
  //#endregion
1748
1840
  //#region src/presentation/reports/GenericResultPreview.tsx
1749
- function Et({ result: e }) {
1841
+ function kt({ result: e }) {
1750
1842
  let [t, n] = D(!1);
1751
1843
  return /* @__PURE__ */ A("div", {
1752
1844
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -1763,7 +1855,7 @@ function Et({ result: e }) {
1763
1855
  }
1764
1856
  //#endregion
1765
1857
  //#region src/presentation/liveAnchorDestination.ts
1766
- function Dt(e, t, n) {
1858
+ function At(e, t, n) {
1767
1859
  return e.length === 0 ? null : {
1768
1860
  id: "live-component",
1769
1861
  label: "Applica al componente aperto",
@@ -1774,33 +1866,35 @@ function Dt(e, t, n) {
1774
1866
  }
1775
1867
  //#endregion
1776
1868
  //#region src/presentation/subagentControls.ts
1777
- var Ot = {};
1778
- function kt(e) {
1779
- Object.assign(Ot, e);
1869
+ var jt = {};
1870
+ function Mt(e) {
1871
+ Object.assign(jt, e);
1780
1872
  }
1781
- function At(e) {
1782
- return Ot[e];
1873
+ function Nt(e) {
1874
+ return jt[e];
1783
1875
  }
1784
1876
  //#endregion
1785
1877
  //#region src/presentation/SubagentRunner.tsx
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);
1789
- p && p !== N.current && (N.current = p, M.current = (r?.length ?? 0) + c.activity.length);
1790
- let P = E(!1), F = c.remote || !c.hasProviders || c.selectedModel !== "";
1878
+ var Pt = () => ({});
1879
+ function Ft({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
1880
+ let c = vt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), h = (t) => {
1881
+ e.definition.conversational || m(t);
1882
+ }, [g, _] = D([]), [v, b] = D(null), x = Ot(e.id), S = x?.kind === "selection" ? x : null, [w, j] = D(null), M = E(!1), N = E(0), P = E(null);
1883
+ p && p !== P.current && (P.current = p, N.current = (r?.length ?? 0) + c.activity.length);
1884
+ let F = E(!1), I = c.remote || !c.hasProviders || c.selectedModel !== "";
1791
1885
  C(() => {
1792
- !j.current && F && (j.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1886
+ !M.current && I && (M.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1793
1887
  model: o,
1794
1888
  openingMessage: s
1795
1889
  }).then((e) => {
1796
- e && m(e);
1890
+ e && h(e);
1797
1891
  })));
1798
- }, [F]), C(() => {
1892
+ }, [I]), C(() => {
1799
1893
  if (!p || !u) return;
1800
1894
  let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = ge();
1801
1895
  n.forEach((n) => {
1802
1896
  let a = i[n];
1803
- a && (v(null), a.apply(p, {
1897
+ a && (b(null), a.apply(p, {
1804
1898
  scopeId: u.id,
1805
1899
  dataProvider: u.dataProvider,
1806
1900
  storageProvider: u.storageProvider,
@@ -1809,30 +1903,30 @@ function Mt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1809
1903
  ...t,
1810
1904
  pinnedEntityId: r
1811
1905
  }).then((n) => {
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))));
1906
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, wt(e, t));
1907
+ }).catch((e) => b(e instanceof Error ? e.message : String(e))));
1814
1908
  });
1815
1909
  }, [
1816
1910
  p,
1817
1911
  c.activity,
1818
1912
  u
1819
1913
  ]), C(() => {
1820
- p && x && w(x.defaultSelection(p));
1821
- }, [p, x]);
1822
- let I = (e, t) => {
1823
- w((n) => n && {
1914
+ p && S && j(S.defaultSelection(p));
1915
+ }, [p, S]);
1916
+ let L = (e, t) => {
1917
+ j((n) => n && {
1824
1918
  ...n,
1825
1919
  [e]: t
1826
1920
  });
1827
- }, L = (e) => m(e), R = T(() => p && x && S ? x.applySelection(p, S) : p, [
1921
+ }, R = (e) => h(e), z = T(() => p && S && w ? S.applySelection(p, w) : p, [
1828
1922
  p,
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), [
1832
- z,
1923
+ S,
1924
+ w
1925
+ ]), B = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), V = T(() => At(B, t, f), [
1926
+ B,
1833
1927
  t,
1834
1928
  f
1835
- ]), V = T(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), U = E(!1);
1929
+ ]), ee = T(() => V ? [V, ...n ?? []] : n, [V, n]), H = e.chatEntityId?.(t), U = E(!1);
1836
1930
  C(() => {
1837
1931
  let n = U.current && !c.running;
1838
1932
  if (U.current = c.running, !n || !H || !u) return;
@@ -1842,56 +1936,56 @@ function Mt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1842
1936
  subagentId: e.id,
1843
1937
  entityId: H,
1844
1938
  params: t,
1845
- title: xt(e, t),
1939
+ title: wt(e, t),
1846
1940
  history: i.history,
1847
1941
  activity: [...r ?? [], ...i.activity]
1848
1942
  });
1849
1943
  }, [c.running]);
1850
1944
  let W = () => {
1851
- P.current = !0, c.running && c.stop(), l.closeTask(f);
1852
- }, G = E(At(e.id) ?? jt).current, K = G({
1945
+ F.current = !0, c.running && c.stop(), l.closeTask(f);
1946
+ }, G = E(Nt(e.id) ?? Pt).current, K = G({
1853
1947
  params: t,
1854
1948
  taskId: f,
1855
1949
  running: c.running,
1856
1950
  close: W
1857
1951
  }), q = (e) => {
1858
- g((t) => t.includes(e) ? t : [...t, e]);
1952
+ _((t) => t.includes(e) ? t : [...t, e]);
1859
1953
  };
1860
1954
  return C(() => {
1861
- P.current || l.openTask({
1955
+ F.current || l.openTask({
1862
1956
  id: f,
1863
- title: xt(e, t),
1957
+ title: wt(e, t),
1864
1958
  icon: e.icon,
1865
1959
  agent: c,
1866
- onApplied: (e) => m(e),
1960
+ onApplied: (e) => h(e),
1867
1961
  precedingActivity: r,
1868
- panelExtraAnchorIndex: M.current,
1962
+ panelExtraAnchorIndex: N.current,
1869
1963
  onDismiss: W,
1870
1964
  ...H ? { savedToDisk: !0 } : {},
1871
1965
  panelActions: K.content,
1872
1966
  composerActions: K.actions,
1873
1967
  composerCommands: K.commands,
1874
1968
  panelExtra: p ? /* @__PURE__ */ A(O, { children: [
1875
- x && S ? /* @__PURE__ */ k(x.Report, {
1969
+ S && w ? /* @__PURE__ */ k(S.Report, {
1876
1970
  result: p,
1877
- selection: S,
1878
- onChange: I
1879
- }) : b?.kind === "editable" ? /* @__PURE__ */ k(b.Report, {
1971
+ selection: w,
1972
+ onChange: L
1973
+ }) : x?.kind === "editable" ? /* @__PURE__ */ k(x.Report, {
1880
1974
  result: p,
1881
- onResultChange: L
1882
- }) : /* @__PURE__ */ k(Et, { result: R }),
1883
- _ && /* @__PURE__ */ A("p", {
1975
+ onResultChange: R
1976
+ }) : /* @__PURE__ */ k(kt, { result: z }),
1977
+ v && /* @__PURE__ */ A("p", {
1884
1978
  className: "text-xs text-destructive",
1885
- children: ["Salvataggio automatico non riuscito: ", _]
1979
+ children: ["Salvataggio automatico non riuscito: ", v]
1886
1980
  }),
1887
- /* @__PURE__ */ k(St, {
1981
+ /* @__PURE__ */ k(Tt, {
1888
1982
  manifest: e,
1889
- result: R,
1983
+ result: z,
1890
1984
  meta: t,
1891
1985
  taskId: f,
1892
- initiallyApplied: h,
1986
+ initiallyApplied: g,
1893
1987
  onApplied: q,
1894
- extraDestinations: V
1988
+ extraDestinations: ee
1895
1989
  })
1896
1990
  ] }) : void 0
1897
1991
  });
@@ -1910,12 +2004,12 @@ function Mt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1910
2004
  e,
1911
2005
  t,
1912
2006
  p,
1913
- R,
1914
- S,
1915
- h,
2007
+ z,
2008
+ w,
2009
+ g,
1916
2010
  n,
1917
2011
  r,
1918
- _,
2012
+ v,
1919
2013
  K.content,
1920
2014
  K.actions,
1921
2015
  K.commands
@@ -1925,8 +2019,8 @@ function Mt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
1925
2019
  }
1926
2020
  //#endregion
1927
2021
  //#region src/presentation/OrchestratorRunner.tsx
1928
- function Nt({ userGoal: e }) {
1929
- let t = Q(), n = ht(T(() => bt({
2022
+ function It({ userGoal: e }) {
2023
+ let t = Q(), n = vt(T(() => Ct({
1930
2024
  unavailable: t.orchestratorUnavailable,
1931
2025
  continueWithoutAi: t.orchestratorContinueWithoutAi,
1932
2026
  preparing: t.orchestratorPreparing,
@@ -1974,7 +2068,7 @@ function Nt({ userGoal: e }) {
1974
2068
  let h = T(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
1975
2069
  if (!i) return null;
1976
2070
  let g = B(i.subagentId);
1977
- return g ? /* @__PURE__ */ k(Mt, {
2071
+ return g ? /* @__PURE__ */ k(Ft, {
1978
2072
  manifest: g,
1979
2073
  params: i.params,
1980
2074
  extraDestinations: c.current,
@@ -1985,8 +2079,8 @@ function Nt({ userGoal: e }) {
1985
2079
  }
1986
2080
  //#endregion
1987
2081
  //#region src/presentation/ManualEntryRunner.tsx
1988
- function Pt({ manifest: e, extraDestinations: n }) {
1989
- 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) => {
2082
+ function Lt({ manifest: e, extraDestinations: n }) {
2083
+ let r = vt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = Ot(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
1990
2084
  if (!e.manualEntry) return;
1991
2085
  let n;
1992
2086
  try {
@@ -2013,7 +2107,7 @@ function Pt({ manifest: e, extraDestinations: n }) {
2013
2107
  p
2014
2108
  ]), S = (e) => {
2015
2109
  u((t) => t.includes(e) ? t : [...t, e]);
2016
- }, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? Dt(w, h, o) : null, [
2110
+ }, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? At(w, h, o) : null, [
2017
2111
  w,
2018
2112
  h,
2019
2113
  o
@@ -2042,8 +2136,8 @@ function Pt({ manifest: e, extraDestinations: n }) {
2042
2136
  }) : d?.kind === "editable" ? /* @__PURE__ */ k(d.Report, {
2043
2137
  result: s,
2044
2138
  onResultChange: b
2045
- }) : /* @__PURE__ */ k(Et, { result: x }),
2046
- /* @__PURE__ */ k(St, {
2139
+ }) : /* @__PURE__ */ k(kt, { result: x }),
2140
+ /* @__PURE__ */ k(Tt, {
2047
2141
  manifest: e,
2048
2142
  result: x,
2049
2143
  meta: h ?? {},
@@ -2080,7 +2174,7 @@ function Pt({ manifest: e, extraDestinations: n }) {
2080
2174
  }
2081
2175
  //#endregion
2082
2176
  //#region src/presentation/Agentico.tsx
2083
- function Ft(e) {
2177
+ function Rt(e) {
2084
2178
  return Object.values(e).flat().map((e) => ({
2085
2179
  label: e.model,
2086
2180
  value: e.id,
@@ -2088,7 +2182,7 @@ function Ft(e) {
2088
2182
  group: e.providerLabel ?? e.provider
2089
2183
  }));
2090
2184
  }
2091
- function It({ task: e }) {
2185
+ function zt({ task: e }) {
2092
2186
  let t = Q(), [n, r] = D(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
2093
2187
  if (r(""), s) {
2094
2188
  s.onSubmit(e.text);
@@ -2100,7 +2194,7 @@ function It({ task: e }) {
2100
2194
  }).then((e) => {
2101
2195
  e && a(e);
2102
2196
  });
2103
- }, 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);
2197
+ }, u = !!s || i.remote && i.remoteModels.length === 0, d = !u && !i.remote && i.hasProviders && !i.selectedModel, f = u ? [] : i.remote ? i.remoteModels : Rt(i.modelsByProvider);
2104
2198
  return /* @__PURE__ */ k(o, {
2105
2199
  value: n,
2106
2200
  onChange: r,
@@ -2120,7 +2214,7 @@ function It({ task: e }) {
2120
2214
  maxHeight: 220
2121
2215
  });
2122
2216
  }
2123
- function Lt() {
2217
+ function Bt() {
2124
2218
  let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = dt(), l = (t) => {
2125
2219
  t.text.trim() && (e(t.text.trim(), {
2126
2220
  attachments: t.files.length > 0 ? t.files : void 0,
@@ -2134,7 +2228,7 @@ function Lt() {
2134
2228
  disabled: !n.trim() || u,
2135
2229
  onSubmit: l,
2136
2230
  attachments: !0,
2137
- models: Ft(a),
2231
+ models: Rt(a),
2138
2232
  selectedModel: s,
2139
2233
  onModelChange: c,
2140
2234
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2142,7 +2236,7 @@ function Lt() {
2142
2236
  maxHeight: 220
2143
2237
  });
2144
2238
  }
2145
- function Rt(e, t, n = Date.now()) {
2239
+ function Vt(e, t, n = Date.now()) {
2146
2240
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2147
2241
  numeric: "auto",
2148
2242
  style: "short"
@@ -2154,7 +2248,7 @@ function Rt(e, t, n = Date.now()) {
2154
2248
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2155
2249
  return i.format(0, "minute");
2156
2250
  }
2157
- function zt({ card: e }) {
2251
+ function Ht({ card: e }) {
2158
2252
  let t = Q();
2159
2253
  return e.humanSummaryOnly ? /* @__PURE__ */ A("div", {
2160
2254
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2210,7 +2304,7 @@ function zt({ card: e }) {
2210
2304
  ]
2211
2305
  });
2212
2306
  }
2213
- function Bt({ messages: e }) {
2307
+ function Ut({ messages: e }) {
2214
2308
  return /* @__PURE__ */ k("div", {
2215
2309
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2216
2310
  children: e.map((e, t) => /* @__PURE__ */ k("p", {
@@ -2219,7 +2313,7 @@ function Bt({ messages: e }) {
2219
2313
  }, t))
2220
2314
  });
2221
2315
  }
2222
- function Vt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2316
+ function Wt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2223
2317
  let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? Ee(e) : [], [
2224
2318
  e,
2225
2319
  r,
@@ -2306,14 +2400,14 @@ function Vt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2306
2400
  }), /* @__PURE__ */ k("span", {
2307
2401
  className: "shrink-0 text-xs text-muted-foreground",
2308
2402
  title: new Date(e.savedAt).toLocaleString(f),
2309
- children: Rt(e.savedAt, f)
2403
+ children: Vt(e.savedAt, f)
2310
2404
  })]
2311
2405
  })
2312
2406
  }, `${e.subagentId}:${e.entityId}`);
2313
2407
  })
2314
2408
  });
2315
2409
  }
2316
- function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2410
+ function Gt({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2317
2411
  let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: w, scope: T } = $(), j = Q(), M = E(null), [N, P] = D(!1), F = at({
2318
2412
  defaultWidth: e,
2319
2413
  minWidth: n,
@@ -2321,12 +2415,12 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2321
2415
  onWidthChange: i
2322
2416
  }), I = () => {
2323
2417
  (!a || a.agent.running || a.savedToDisk || window.confirm(j.unsavedConversationConfirm)) && (m(), P(!1));
2324
- }, 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 ? {
2325
- canAnswer: (e) => W.has(e),
2418
+ }, L = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], R = L.length, z = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? R, R)), V = L.slice(0, z), ee = L.slice(z), H = !!(a && !a.agent.running && a.agent.error), U = new Set(a?.agent.activity.map((e) => e.id) ?? []), W = a ? {
2419
+ canAnswer: (e) => U.has(e),
2326
2420
  onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
2327
2421
  e && a.onApplied(e);
2328
2422
  })
2329
- } : 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);
2423
+ } : void 0, G = W ? Ge(L, W.canAnswer) : null, K = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? B(a.scopedSubagentId) : void 0, q = K?.manualEntry ? K : null, J = E(!0);
2330
2424
  C(() => {
2331
2425
  let e = M.current;
2332
2426
  if (!e) return;
@@ -2344,7 +2438,7 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2344
2438
  e && J.current && (e.scrollTop = e.scrollHeight);
2345
2439
  }, [
2346
2440
  R,
2347
- U,
2441
+ H,
2348
2442
  te
2349
2443
  ]);
2350
2444
  let Y = E(null);
@@ -2356,7 +2450,7 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2356
2450
  });
2357
2451
  return n.observe(t), () => n.disconnect();
2358
2452
  }, [a?.id, o]);
2359
- let ne = s ? /* @__PURE__ */ k(Nt, { userGoal: s }, c) : null, re = f ? B(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ k(Mt, {
2453
+ let ne = s ? /* @__PURE__ */ k(It, { userGoal: s }, c) : null, re = f ? B(f.subagentId) : void 0, ie = f && re ? /* @__PURE__ */ k(Ft, {
2360
2454
  manifest: re,
2361
2455
  params: f.snapshot.params,
2362
2456
  taskId: De(f.subagentId, f.entityId),
@@ -2364,14 +2458,14 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2364
2458
  history: f.snapshot.history,
2365
2459
  activity: f.snapshot.activity
2366
2460
  }
2367
- }, p) : null, ae = g ? B(g.subagentId) : void 0, oe = g && ae ? /* @__PURE__ */ k(Pt, {
2461
+ }, p) : null, ae = g ? B(g.subagentId) : void 0, oe = g && ae ? /* @__PURE__ */ k(Lt, {
2368
2462
  manifest: ae,
2369
2463
  extraDestinations: g.extraDestinations
2370
- }, _) : null, se = b ? B(b.subagentId) : void 0, ce = b && se ? /* @__PURE__ */ k(Mt, {
2464
+ }, _) : null, se = b ? B(b.subagentId) : void 0, ce = b && se ? /* @__PURE__ */ k(Ft, {
2371
2465
  manifest: se,
2372
2466
  params: b.params,
2373
2467
  extraDestinations: b.extraDestinations
2374
- }, x) : null, le = S ? B(S.subagentId) : void 0, X = S && le ? /* @__PURE__ */ k(Mt, {
2468
+ }, x) : null, le = S ? B(S.subagentId) : void 0, X = S && le ? /* @__PURE__ */ k(Ft, {
2375
2469
  manifest: le,
2376
2470
  params: S.params,
2377
2471
  taskId: S.taskId,
@@ -2402,7 +2496,7 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2402
2496
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2403
2497
  children: a ? a.title : "Agentico"
2404
2498
  }),
2405
- T && /* @__PURE__ */ k(Vt, {
2499
+ T && /* @__PURE__ */ k(Wt, {
2406
2500
  scopeId: T.id,
2407
2501
  currentTaskId: a?.id ?? null,
2408
2502
  open: N,
@@ -2416,7 +2510,7 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2416
2510
  }),
2417
2511
  /* @__PURE__ */ k("div", {
2418
2512
  ref: M,
2419
- className: `flex-1 overflow-y-auto px-3 pb-2 ${K ? "min-h-24" : "min-h-0"}`,
2513
+ className: `flex-1 overflow-y-auto px-3 pb-2 ${G ? "min-h-24" : "min-h-0"}`,
2420
2514
  children: /* @__PURE__ */ k("div", {
2421
2515
  ref: Y,
2422
2516
  className: "pt-2",
@@ -2427,19 +2521,19 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2427
2521
  }),
2428
2522
  /* @__PURE__ */ k(Ye, {
2429
2523
  activity: V,
2430
- questions: G,
2431
- docked: K,
2432
- pinUserMessages: !K
2524
+ questions: W,
2525
+ docked: G,
2526
+ pinUserMessages: !G
2433
2527
  }),
2434
2528
  a.panelExtra && /* @__PURE__ */ k("div", {
2435
2529
  className: "mt-3",
2436
2530
  children: a.panelExtra
2437
2531
  }),
2438
- H.length > 0 && /* @__PURE__ */ k(Ye, {
2439
- activity: H,
2440
- questions: G,
2441
- docked: K,
2442
- pinUserMessages: !K
2532
+ ee.length > 0 && /* @__PURE__ */ k(Ye, {
2533
+ activity: ee,
2534
+ questions: W,
2535
+ docked: G,
2536
+ pinUserMessages: !G
2443
2537
  }),
2444
2538
  !a.agent.running && a.agent.error && /* @__PURE__ */ A("div", {
2445
2539
  className: "mt-2 flex items-center gap-2",
@@ -2463,8 +2557,8 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2463
2557
  variant: "secondary",
2464
2558
  className: "shrink-0",
2465
2559
  onClick: () => {
2466
- if (ee) {
2467
- v(ee.id, y);
2560
+ if (q) {
2561
+ v(q.id, y);
2468
2562
  return;
2469
2563
  }
2470
2564
  let e = a.agent.runFallback();
@@ -2473,13 +2567,13 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2473
2567
  })
2474
2568
  ]
2475
2569
  })
2476
- ] }) : d.length > 0 ? /* @__PURE__ */ k(Bt, { messages: d }) : u ? /* @__PURE__ */ k(zt, { card: u }) : /* @__PURE__ */ k("p", {
2570
+ ] }) : d.length > 0 ? /* @__PURE__ */ k(Ut, { messages: d }) : u ? /* @__PURE__ */ k(Ht, { card: u }) : /* @__PURE__ */ k("p", {
2477
2571
  className: "text-xs text-muted-foreground",
2478
2572
  children: l ?? j.orchestratorStarterHint
2479
2573
  })
2480
2574
  })
2481
2575
  }),
2482
- a && K ? /* @__PURE__ */ A("section", {
2576
+ a && G ? /* @__PURE__ */ A("section", {
2483
2577
  "aria-label": j.pendingQuestions,
2484
2578
  className: "flex min-h-0 shrink flex-col border-t border-border/60",
2485
2579
  children: [
@@ -2490,11 +2584,11 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2490
2584
  /* @__PURE__ */ k("div", {
2491
2585
  className: "min-h-0 overflow-y-auto px-4 py-3",
2492
2586
  children: /* @__PURE__ */ k(Ke, {
2493
- entry: K.entry,
2494
- part: K.part,
2495
- questions: G,
2587
+ entry: G.entry,
2588
+ part: G.part,
2589
+ questions: W,
2496
2590
  autoFocus: !0
2497
- }, `${K.entry.id}:${K.part.id}`)
2591
+ }, `${G.entry.id}:${G.part.id}`)
2498
2592
  }),
2499
2593
  a.agent.running && /* @__PURE__ */ k("div", {
2500
2594
  className: "flex shrink-0 justify-end px-4 pb-3",
@@ -2511,7 +2605,7 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2511
2605
  children: [a?.panelActions && /* @__PURE__ */ k("div", {
2512
2606
  className: "mb-2",
2513
2607
  children: a.panelActions
2514
- }), a ? /* @__PURE__ */ k(It, { task: a }, a.id) : /* @__PURE__ */ k(Lt, {})]
2608
+ }), a ? /* @__PURE__ */ k(zt, { task: a }, a.id) : /* @__PURE__ */ k(Bt, {})]
2515
2609
  })
2516
2610
  ]
2517
2611
  })
@@ -2525,13 +2619,13 @@ function Ht({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2525
2619
  }
2526
2620
  //#endregion
2527
2621
  //#region src/presentation/useAgenticoPageContext.ts
2528
- function Ut(e, t) {
2622
+ function Kt(e, t) {
2529
2623
  let { setPageContext: n } = $(), r = E(crypto.randomUUID()).current;
2530
2624
  C(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2531
2625
  }
2532
2626
  //#endregion
2533
2627
  //#region src/presentation/useSubagentComponentContext.ts
2534
- function Wt(e, t, n, r, i = !0, a) {
2628
+ function qt(e, t, n, r, i = !0, a) {
2535
2629
  let { registerComponentAnchor: o } = $(), s = E(crypto.randomUUID()).current, c = E(n);
2536
2630
  c.current = n, C(() => {
2537
2631
  if (i) return o(s, {
@@ -2550,6 +2644,6 @@ function Wt(e, t, n, r, i = !0, a) {
2550
2644
  ]);
2551
2645
  }
2552
2646
  //#endregion
2553
- 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 };
2647
+ export { Qe as AGENTICO_MAX_WIDTH, Ze as AGENTICO_MIN_WIDTH, Xe as AGENTICO_WIDTH, $e as AGENTICO_WIDTH_STORAGE_KEY, Gt as Agentico, Pe as AgenticoProvider, st as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, fe as JSON_EXPORT_DESTINATION_ID, le as MICRO_PROMPT_REGISTRY, Me as ORCHESTRATOR_TASK_ID, ce as SUMMARY_MICRO_PROMPT, Oe as agenticoDe, ke as agenticoEn, Ae as agenticoIt, K as agenticoPromptsEn, q as agenticoPromptsIt, je as agenticoTranslations, X as applyMicroPrompts, te as configureAgenticoPrompts, ve as configureEntityChatStore, H as createCrossAgentTools, I as defineSubagent, De as entityChatTaskId, Z as extractErrorMessage, ue as extractJsonBlock, B as findSubagentManifest, F as formatQuestionAnswers, Y as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, Nt as getSubagentControls, z as getSubagentRegistry, Ot as getSubagentReport, pe as jsonExportDestination, Ee as listEntityChats, P as messagePartsText, ee as registerCrossAgentTools, he as registerDestinations, Mt as registerSubagentControls, Dt as registerSubagentReports, R as registerSubagents, Te as removeEntityChat, se as renderRegistryCli, oe as renderSubagentCli, ne as resetAgenticoPrompts, we as saveEntityChat, U as toJsonSchema, W as toMcpTool, N as upsertMessagePart, vt as useAgent, $ as useAgentico, Q as useAgenticoI18n, Kt as useAgenticoPageContext, qt as useSubagentComponentContext };
2554
2648
 
2555
2649
  //# sourceMappingURL=index.mjs.map