@llmnative/agentico 0.1.0 → 0.2.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
@@ -118,25 +118,25 @@ var z = {
118
118
  ].join(" "),
119
119
  multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
120
120
  }, V = z;
121
- function ee(e) {
121
+ function H(e) {
122
122
  V = {
123
123
  ...V,
124
124
  ...e
125
125
  };
126
126
  }
127
- function H() {
127
+ function U() {
128
128
  return V;
129
129
  }
130
- function te() {
130
+ function W() {
131
131
  V = z;
132
132
  }
133
133
  //#endregion
134
134
  //#region src/domain/cli/renderManifestCli.ts
135
- function ne(e, t) {
135
+ function ee(e, t) {
136
136
  return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
137
137
  }
138
- function U(e, t) {
139
- let n = R(t), r = ne(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
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}` : ""}`);
140
140
  return [
141
141
  `COMMAND: ${e} ${t.name}`,
142
142
  ` ${t.summary}`,
@@ -148,46 +148,46 @@ function U(e, t) {
148
148
  ...i,
149
149
  "",
150
150
  " OUTPUT",
151
- W(t.describeOutput(), 4),
151
+ K(t.describeOutput(), 4),
152
152
  (t.example, ""),
153
153
  t.example ? " EXAMPLE" : "",
154
154
  t.example ? ` ${t.example}` : ""
155
155
  ].filter((e) => e !== "").join("\n");
156
156
  }
157
- function W(e, t) {
157
+ function K(e, t) {
158
158
  let n = " ".repeat(t);
159
159
  return e.split("\n").map((e) => e && n + e).join("\n");
160
160
  }
161
- function re(e) {
161
+ function te(e) {
162
162
  return [
163
163
  "NAME",
164
164
  ` ${e.id} — ${e.label}`,
165
165
  "",
166
166
  "DESCRIPTION",
167
- W(e.description, 2),
167
+ K(e.description, 2),
168
168
  "",
169
- ...e.commands.map((t) => U(e.id, t))
169
+ ...e.commands.map((t) => G(e.id, t))
170
170
  ].join("\n");
171
171
  }
172
- function ie(e) {
173
- return e.length === 0 ? H().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
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");
174
174
  }
175
175
  //#endregion
176
176
  //#region src/domain/microPrompts.ts
177
- var ae = {
177
+ var q = {
178
178
  id: "closing-summary",
179
179
  get text() {
180
- return H().closingSummary;
180
+ return U().closingSummary;
181
181
  }
182
- }, oe = { [ae.id]: ae };
183
- function G(e, t) {
182
+ }, re = { [q.id]: q };
183
+ function J(e, t) {
184
184
  if (!t || t.length === 0) return e;
185
- let n = t.map((e) => oe[e]?.text).filter((e) => !!e);
185
+ let n = t.map((e) => re[e]?.text).filter((e) => !!e);
186
186
  return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
187
187
  }
188
188
  //#endregion
189
189
  //#region src/domain/extractErrorMessage.ts
190
- function K(e) {
190
+ function Y(e) {
191
191
  if (e instanceof Error) return e.message;
192
192
  if (typeof e == "object" && e) {
193
193
  let t = e;
@@ -206,13 +206,13 @@ function K(e) {
206
206
  }
207
207
  //#endregion
208
208
  //#region src/domain/extractJsonBlock.ts
209
- function se(e) {
209
+ function ie(e) {
210
210
  let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
211
211
  if (t) return t[1].trim();
212
212
  let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
213
- return ce(n) ?? n;
213
+ return ae(n) ?? n;
214
214
  }
215
- function ce(e) {
215
+ function ae(e) {
216
216
  let t = e.search(/[{[]/);
217
217
  if (t === -1) return null;
218
218
  let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
@@ -233,8 +233,8 @@ function ce(e) {
233
233
  }
234
234
  //#endregion
235
235
  //#region src/domain/jsonExportDestination.ts
236
- var le = "json-export", q = {
237
- id: le,
236
+ var oe = "json-export", X = {
237
+ id: oe,
238
238
  label: "Export as JSON",
239
239
  async apply(e) {
240
240
  let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
@@ -245,23 +245,23 @@ var le = "json-export", q = {
245
245
  URL.revokeObjectURL(n);
246
246
  }
247
247
  }
248
- }, ue = {};
249
- function de(e) {
250
- ue = e;
248
+ }, se = {};
249
+ function ce(e) {
250
+ se = e;
251
251
  }
252
- function J() {
252
+ function le() {
253
253
  return {
254
- [q.id]: q,
255
- ...ue
254
+ [X.id]: X,
255
+ ...se
256
256
  };
257
257
  }
258
258
  //#endregion
259
259
  //#region src/domain/entityChatStore.ts
260
- var fe = "llmnative.agentico.entityChat";
261
- function pe(e) {
262
- fe = e.storageKey;
260
+ var ue = "llmnative.agentico.entityChat";
261
+ function de(e) {
262
+ ue = e.storageKey;
263
263
  }
264
- function me(e) {
264
+ function fe(e) {
265
265
  if (!e || typeof e != "object") return null;
266
266
  let t = e;
267
267
  if (typeof t.entityId != "string") return null;
@@ -273,43 +273,41 @@ function me(e) {
273
273
  scopeId: n
274
274
  };
275
275
  }
276
- function Y() {
276
+ function pe() {
277
277
  try {
278
- let e = localStorage.getItem(fe);
278
+ let e = localStorage.getItem(ue);
279
279
  if (!e) return [];
280
280
  let t = JSON.parse(e);
281
- return Array.isArray(t) ? t.map(me).filter((e) => e !== null) : [];
281
+ return Array.isArray(t) ? t.map(fe).filter((e) => e !== null) : [];
282
282
  } catch {
283
283
  return [];
284
284
  }
285
285
  }
286
- function he(e) {
286
+ function me(e) {
287
287
  try {
288
- localStorage.setItem(fe, JSON.stringify(e));
288
+ localStorage.setItem(ue, JSON.stringify(e));
289
289
  } catch {}
290
290
  }
291
- var X = (e, t, n) => `${e}:${t}:${n}`;
292
- function ge(e, t, n) {
293
- let r = X(e, t, n);
294
- return Y().find((e) => X(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
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;
295
295
  }
296
- function _e(e) {
297
- let t = X(e.scopeId, e.subagentId, e.entityId), n = Y().filter((e) => X(e.scopeId, e.subagentId, e.entityId) !== t);
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);
298
298
  n.push({
299
299
  ...e,
300
300
  savedAt: Date.now()
301
- }), he(n);
301
+ }), me(n);
302
302
  }
303
- function ve(e, t, n) {
304
- let r = X(e, t, n);
305
- he(Y().filter((e) => X(e.scopeId, e.subagentId, e.entityId) !== r));
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));
306
306
  }
307
- function ye(e) {
308
- return Y().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
307
+ function ve(e) {
308
+ return pe().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
309
309
  }
310
- //#endregion
311
- //#region src/i18n/de.ts
312
- var be = {
310
+ var ye = (e, t) => `entitychat-${e}-${t}`, be = {
313
311
  modelLabel: "Modell",
314
312
  modelsLoading: "Wird geladen…",
315
313
  noModelsAvailable: "Keine Modelle verfügbar",
@@ -346,6 +344,7 @@ var be = {
346
344
  messagePlaceholder: "Nachricht schreiben…",
347
345
  unsavedConversationConfirm: "Diese Unterhaltung wurde nicht gespeichert und geht verloren. Fortfahren?",
348
346
  noSavedChats: "Noch keine gespeicherten Chats.",
347
+ archiveChat: "Archivieren",
349
348
  noResults: "Keine Ergebnisse.",
350
349
  retry: "Erneut versuchen",
351
350
  retryMessage: "Erneut versuchen.",
@@ -390,6 +389,7 @@ var be = {
390
389
  messagePlaceholder: "Write a message…",
391
390
  unsavedConversationConfirm: "This conversation has not been saved and will be lost. Continue?",
392
391
  noSavedChats: "No saved chats yet.",
392
+ archiveChat: "Archive",
393
393
  noResults: "No results.",
394
394
  retry: "Retry",
395
395
  retryMessage: "Retry.",
@@ -434,6 +434,7 @@ var be = {
434
434
  messagePlaceholder: "Scrivi un messaggio…",
435
435
  unsavedConversationConfirm: "Questa conversazione non è stata salvata e andrà persa. Continuare?",
436
436
  noSavedChats: "Nessuna chat salvata ancora.",
437
+ archiveChat: "Archivia",
437
438
  noResults: "Nessun risultato.",
438
439
  retry: "Riprova",
439
440
  retryMessage: "Riprova.",
@@ -446,7 +447,7 @@ var be = {
446
447
  it: { agentico: Se },
447
448
  de: { agentico: be }
448
449
  };
449
- function Z() {
450
+ function Q() {
450
451
  let { dict: e } = m(), t = e.agentico;
451
452
  return t ? {
452
453
  ...xe,
@@ -455,8 +456,8 @@ function Z() {
455
456
  }
456
457
  //#endregion
457
458
  //#region src/presentation/AgenticoContext.tsx
458
- var Q = "agentico-orchestrator", we = _(null);
459
- function Te({ children: e, scope: t = null }) {
459
+ var we = "agentico-orchestrator", Te = _(null);
460
+ function Ee({ children: e, scope: t = null }) {
460
461
  let [n, r] = w(null), i = C(null);
461
462
  b(() => {
462
463
  i.current = n;
@@ -511,26 +512,26 @@ function Te({ children: e, scope: t = null }) {
511
512
  agenticoHint: n,
512
513
  userMessage: t.userMessage
513
514
  };
514
- }).filter((e) => e !== null), [B]), ee = S(() => V.map((e) => e.userMessage), [V]), te = S(() => {
515
+ }).filter((e) => e !== null), [B]), H = S(() => V.map((e) => e.userMessage), [V]), W = S(() => {
515
516
  if (V.length === 0) return null;
516
517
  if (V.length === 1) return V[0].agenticoHint;
517
518
  let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
518
- return `${H().multipleCandidates}\n\n${e}`;
519
- }, [V]) ?? F?.text ?? null, ne = V.length > 0 ? null : F?.card ?? null, U = S(() => [...new Set(z.map((e) => e.subagentId))], [z]), W = U.length === 1 ? U[0] : U.length === 0 ? F?.card?.subagentId ?? null : null, re = v((e, t) => {
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) => {
520
521
  u();
521
522
  let n = i.current;
522
523
  if (n?.id === "agentico-orchestrator") return;
523
- let r = W && n?.id.startsWith(`subagent-${W}-`) ? n : void 0;
524
+ let r = K && n?.id.startsWith(`subagent-${K}-`) ? n : void 0;
524
525
  O(r ? {
525
526
  taskId: r.id,
526
527
  activity: [...r.precedingActivity ?? [], ...r.agent.activity]
527
528
  } : null), f(e), m(t?.extraDestinations), g(t?.attachments), y(t?.model), A(t?.scopedSubagentId), T(crypto.randomUUID());
528
- }, [u, W]), ie = v((e, t, n, a, o, s) => {
529
+ }, [u, K]), ne = v((e, t, n, a, o, s) => {
529
530
  if (!n || !a) return;
530
531
  let c = i.current;
531
532
  if (!c || c.id !== n) return;
532
533
  let l = c.agent.snapshot();
533
- l && (_e({
534
+ l && (ge({
534
535
  scopeId: a,
535
536
  subagentId: e,
536
537
  entityId: t,
@@ -542,27 +543,33 @@ function Te({ children: e, scope: t = null }) {
542
543
  ...e,
543
544
  savedToDisk: !0
544
545
  } : e));
545
- }, []), [ae, oe] = w(null), [G, K] = w(null), se = v((e, t, n) => {
546
- u(), oe({
546
+ }, []), [q, re] = w(null), [J, Y] = w(null), ie = v((e, t, n) => {
547
+ u(), re({
547
548
  subagentId: e,
548
549
  entityId: t,
549
550
  snapshot: n
550
- }), K(crypto.randomUUID());
551
- }, [u]), [ce, le] = w(null), [q, ue] = w(null), de = v((e, t) => {
552
- u(), c(Q), le({
551
+ }), Y(crypto.randomUUID());
552
+ }, [u]), [ae, oe] = w(null), [X, se] = w(null), ce = v((e, t) => {
553
+ u(), c(we), oe({
553
554
  subagentId: e,
554
555
  extraDestinations: t
555
- }), ue(crypto.randomUUID());
556
- }, [u, c]), [J, fe] = w(null), [pe, me] = w(null), Y = v((e, t, n) => {
557
- le(null), fe({
556
+ }), se(crypto.randomUUID());
557
+ }, [u, c]), [le, ue] = w(null), [de, fe] = w(null), pe = v((e, t, n) => {
558
+ oe(null), ue({
558
559
  subagentId: e,
559
560
  params: t,
560
561
  extraDestinations: n
561
- }), me(crypto.randomUUID());
562
- }, []), he = v(() => {
562
+ }), fe(crypto.randomUUID());
563
+ }, []), [me, Z] = w(null), [he, _e] = w(null), ve = v((e, t, n) => {
564
+ u(), Z({
565
+ subagentId: e,
566
+ params: t,
567
+ ...n
568
+ }), _e(crypto.randomUUID());
569
+ }, [u]), ye = v(() => {
563
570
  let e = i.current;
564
571
  e && e.onDismiss();
565
- }, []), X = S(() => ({
572
+ }, []), be = S(() => ({
566
573
  scope: t,
567
574
  task: n,
568
575
  isOpen: a,
@@ -570,14 +577,14 @@ function Te({ children: e, scope: t = null }) {
570
577
  closeTask: c,
571
578
  toggleOpen: l,
572
579
  pendingGoal: d,
573
- startOrchestrator: re,
574
- pageContext: te,
575
- pageContextCard: ne,
580
+ startOrchestrator: te,
581
+ pageContext: W,
582
+ pageContextCard: ee,
576
583
  setPageContext: P,
577
- scopedSubagentId: W,
584
+ scopedSubagentId: K,
578
585
  pendingScopedSubagentId: k,
579
586
  componentAnchors: z,
580
- anchoredUserMessages: ee,
587
+ anchoredUserMessages: H,
581
588
  registerComponentAnchor: R,
582
589
  openPanel: u,
583
590
  pendingExtraDestinations: p,
@@ -585,17 +592,20 @@ function Te({ children: e, scope: t = null }) {
585
592
  pendingModel: _,
586
593
  orchestratorRunId: x,
587
594
  pendingCarryOver: D,
588
- commitEntityChat: ie,
589
- resumeEntityChat: se,
590
- pendingResume: ae,
591
- resumeRunId: G,
592
- dismissForeignTask: he,
593
- pendingManualEntry: ce,
594
- manualEntryRunId: q,
595
- startManualEntry: de,
596
- pendingResumeWithAI: J,
597
- resumeWithAIRunId: pe,
598
- resumeWithAI: Y
595
+ commitEntityChat: ne,
596
+ resumeEntityChat: ie,
597
+ pendingResume: q,
598
+ resumeRunId: J,
599
+ dismissForeignTask: ye,
600
+ pendingManualEntry: ae,
601
+ manualEntryRunId: X,
602
+ startManualEntry: ce,
603
+ pendingResumeWithAI: le,
604
+ resumeWithAIRunId: de,
605
+ resumeWithAI: pe,
606
+ startSubagent: ve,
607
+ pendingStart: me,
608
+ startRunId: he
599
609
  }), [
600
610
  t,
601
611
  n,
@@ -604,14 +614,14 @@ function Te({ children: e, scope: t = null }) {
604
614
  c,
605
615
  l,
606
616
  d,
607
- re,
608
617
  te,
609
- ne,
610
- P,
611
618
  W,
619
+ ee,
620
+ P,
621
+ K,
612
622
  k,
613
623
  z,
614
- ee,
624
+ H,
615
625
  R,
616
626
  u,
617
627
  p,
@@ -619,31 +629,34 @@ function Te({ children: e, scope: t = null }) {
619
629
  _,
620
630
  x,
621
631
  D,
632
+ ne,
622
633
  ie,
623
- se,
634
+ q,
635
+ J,
636
+ ye,
624
637
  ae,
625
- G,
626
- he,
638
+ X,
627
639
  ce,
628
- q,
640
+ le,
629
641
  de,
630
- J,
631
642
  pe,
632
- Y
643
+ ve,
644
+ me,
645
+ he
633
646
  ]);
634
- return /* @__PURE__ */ E(we.Provider, {
635
- value: X,
647
+ return /* @__PURE__ */ E(Te.Provider, {
648
+ value: be,
636
649
  children: e
637
650
  });
638
651
  }
639
652
  function $() {
640
- let e = y(we);
653
+ let e = y(Te);
641
654
  if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
642
655
  return e;
643
656
  }
644
657
  //#endregion
645
658
  //#region src/presentation/AgentActivityLog.tsx
646
- function Ee(e) {
659
+ function De(e) {
647
660
  let t = e.search(/[{[]/);
648
661
  if (t === -1) return [{
649
662
  type: "text",
@@ -689,18 +702,18 @@ function Ee(e) {
689
702
  language: "json"
690
703
  });
691
704
  let u = e.slice(s + 1);
692
- return u.trim() && l.push(...Ee(u)), l;
705
+ return u.trim() && l.push(...De(u)), l;
693
706
  }
694
- function De(e) {
707
+ function Oe(e) {
695
708
  let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
696
- for (; i = n.exec(e);) i.index > r && t.push(...Ee(e.slice(r, i.index))), t.push({
709
+ for (; i = n.exec(e);) i.index > r && t.push(...De(e.slice(r, i.index))), t.push({
697
710
  type: "code",
698
711
  content: i[2].replace(/\n$/, ""),
699
712
  language: i[1]
700
713
  }), r = n.lastIndex;
701
- return r < e.length && t.push(...Ee(e.slice(r))), t;
714
+ return r < e.length && t.push(...De(e.slice(r))), t;
702
715
  }
703
- function Oe({ content: e, language: t }) {
716
+ function ke({ content: e, language: t }) {
704
717
  let [n, r] = w(!1);
705
718
  return /* @__PURE__ */ D("div", {
706
719
  className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -715,7 +728,7 @@ function Oe({ content: e, language: t }) {
715
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" })]
716
729
  });
717
730
  }
718
- function ke(e) {
731
+ function Ae(e) {
719
732
  let t = [], n = /\*\*(.+?)\*\*|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)/g, r = 0, i;
720
733
  for (; i = n.exec(e);) i.index > r && t.push({
721
734
  type: "text",
@@ -736,8 +749,8 @@ function ke(e) {
736
749
  content: e.slice(r)
737
750
  }), t;
738
751
  }
739
- function Ae({ text: e }) {
740
- return /* @__PURE__ */ E(T, { children: ke(e).map((e, t) => e.type === "bold" ? /* @__PURE__ */ E("strong", {
752
+ function je({ text: e }) {
753
+ return /* @__PURE__ */ E(T, { children: Ae(e).map((e, t) => e.type === "bold" ? /* @__PURE__ */ E("strong", {
741
754
  className: "font-semibold text-foreground",
742
755
  children: e.content
743
756
  }, t) : e.type === "code" ? /* @__PURE__ */ E("code", {
@@ -751,17 +764,17 @@ function Ae({ text: e }) {
751
764
  children: e.content
752
765
  }, t) : /* @__PURE__ */ E(g.Fragment, { children: e.content }, t)) });
753
766
  }
754
- function je({ text: e }) {
755
- let t = De(e);
756
- return /* @__PURE__ */ E(T, { children: t.map((e, t) => e.type === "code" ? /* @__PURE__ */ E(Oe, {
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, {
757
770
  content: e.content,
758
771
  language: e.language
759
772
  }, t) : e.content.trim() && /* @__PURE__ */ E("p", {
760
773
  className: "whitespace-pre-wrap break-words",
761
- children: /* @__PURE__ */ E(Ae, { text: e.content })
774
+ children: /* @__PURE__ */ E(je, { text: e.content })
762
775
  }, t)) });
763
776
  }
764
- function Me({ status: e }) {
777
+ function Ne({ status: e }) {
765
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, {
766
779
  name: "check",
767
780
  size: 12,
@@ -776,11 +789,11 @@ function Me({ status: e }) {
776
789
  className: "shrink-0 text-destructive"
777
790
  });
778
791
  }
779
- function Ne(e, t) {
792
+ function Pe(e, t) {
780
793
  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;
781
794
  }
782
- var Pe = 96;
783
- function Fe({ entry: e }) {
795
+ var Fe = 96;
796
+ function Ie({ entry: e }) {
784
797
  let t = C(null), [n, r] = w(!1), [i, a] = w(!1);
785
798
  x(() => {
786
799
  let e = t.current;
@@ -794,7 +807,7 @@ function Fe({ entry: e }) {
794
807
  children: [/* @__PURE__ */ D("div", {
795
808
  ref: t,
796
809
  className: `space-y-1 px-2.5 pt-1.5 ${o ? "overflow-hidden" : ""}`,
797
- style: o ? { maxHeight: Pe } : void 0,
810
+ style: o ? { maxHeight: Fe } : void 0,
798
811
  children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ E("div", {
799
812
  className: "flex flex-wrap gap-1",
800
813
  children: e.attachmentNames.map((e, t) => /* @__PURE__ */ D("span", {
@@ -808,7 +821,7 @@ function Fe({ entry: e }) {
808
821
  children: e
809
822
  })]
810
823
  }, t))
811
- }), /* @__PURE__ */ E(je, { text: e.detail ?? "" })]
824
+ }), /* @__PURE__ */ E(Me, { text: e.detail ?? "" })]
812
825
  }), i && /* @__PURE__ */ D("button", {
813
826
  type: "button",
814
827
  onClick: () => r((e) => !e),
@@ -822,10 +835,10 @@ function Fe({ entry: e }) {
822
835
  })
823
836
  });
824
837
  }
825
- function Ie({ entry: e }) {
826
- let t = Z();
827
- if (e.kind === "user") return /* @__PURE__ */ E(Fe, { entry: e });
828
- let n = e.kind === "thinking" && e.detail ? De(e.detail) : [], r = n.filter((e) => e.type === "code"), i = n.filter((e) => e.type === "text" && e.content.trim()), a = e.kind === "thinking" ? Ne(e, t) : e.label;
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;
829
842
  return /* @__PURE__ */ D("li", {
830
843
  className: "text-xs text-muted-foreground",
831
844
  children: [
@@ -833,7 +846,7 @@ function Ie({ entry: e }) {
833
846
  className: "flex items-start gap-1.5",
834
847
  children: [/* @__PURE__ */ E("span", {
835
848
  className: "pt-px",
836
- children: /* @__PURE__ */ E(Me, { status: e.status })
849
+ children: /* @__PURE__ */ E(Ne, { status: e.status })
837
850
  }), /* @__PURE__ */ E("span", {
838
851
  className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
839
852
  children: a
@@ -841,7 +854,7 @@ function Ie({ entry: e }) {
841
854
  }),
842
855
  r.length > 0 && /* @__PURE__ */ E("div", {
843
856
  className: "mt-1 ml-[18px] space-y-1",
844
- children: r.map((e, t) => /* @__PURE__ */ E(Oe, {
857
+ children: r.map((e, t) => /* @__PURE__ */ E(ke, {
845
858
  content: e.content,
846
859
  language: e.language
847
860
  }, t))
@@ -850,22 +863,22 @@ function Ie({ entry: e }) {
850
863
  className: "mt-1 ml-[18px] space-y-2",
851
864
  children: i.map((e, t) => /* @__PURE__ */ E("p", {
852
865
  className: "whitespace-pre-wrap leading-relaxed text-muted-foreground",
853
- children: /* @__PURE__ */ E(Ae, { text: e.content.trim() })
866
+ children: /* @__PURE__ */ E(je, { text: e.content.trim() })
854
867
  }, t))
855
868
  })
856
869
  ]
857
870
  });
858
871
  }
859
- function Le({ activity: e }) {
872
+ function Re({ activity: e }) {
860
873
  return e.length === 0 ? null : /* @__PURE__ */ E("ul", {
861
874
  className: "space-y-0.5",
862
- children: e.map((e) => /* @__PURE__ */ E(Ie, { entry: e }, e.id))
875
+ children: e.map((e) => /* @__PURE__ */ E(Le, { entry: e }, e.id))
863
876
  });
864
877
  }
865
878
  //#endregion
866
879
  //#region src/presentation/AgenticoToggle.tsx
867
- function Re({ className: e = "" }) {
868
- let { isOpen: n, toggleOpen: r, task: i } = $(), a = Z(), o = i?.agent.running ?? !1;
880
+ function ze({ className: e = "" }) {
881
+ let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
869
882
  return /* @__PURE__ */ E(t, {
870
883
  icon: "bot",
871
884
  ariaLabel: n ? a.closePanel : a.openPanel,
@@ -877,21 +890,21 @@ function Re({ className: e = "" }) {
877
890
  }
878
891
  //#endregion
879
892
  //#region src/presentation/useAIModelCatalog.ts
880
- var ze = "llmnative-cms.selectedAIModel";
881
- function Be() {
893
+ var Be = "llmnative-cms.selectedAIModel";
894
+ function Ve() {
882
895
  try {
883
- return localStorage.getItem(ze) ?? "";
896
+ return localStorage.getItem(Be) ?? "";
884
897
  } catch {
885
898
  return "";
886
899
  }
887
900
  }
888
- function Ve(e) {
901
+ function He(e) {
889
902
  try {
890
- e ? localStorage.setItem(ze, e) : localStorage.removeItem(ze);
903
+ e ? localStorage.setItem(Be, e) : localStorage.removeItem(Be);
891
904
  } catch {}
892
905
  }
893
- function He() {
894
- let e = p()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = w({}), [i, a] = w(!1), [o, s] = w(Be);
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);
895
908
  return b(() => {
896
909
  if (!t) {
897
910
  r({});
@@ -902,7 +915,7 @@ function He() {
902
915
  if (n) return;
903
916
  r(e.modelsByProvider);
904
917
  let t = Object.values(e.modelsByProvider).flat();
905
- s((e) => t.some((t) => t.id === e) ? e : (Ve(""), ""));
918
+ s((e) => t.some((t) => t.id === e) ? e : (He(""), ""));
906
919
  }).catch((e) => {
907
920
  console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
908
921
  }).finally(() => {
@@ -916,28 +929,99 @@ function He() {
916
929
  modelsLoading: i,
917
930
  selectedModel: o,
918
931
  setSelectedModel: (e) => {
919
- Ve(e), s(e);
932
+ He(e), s(e);
920
933
  }
921
934
  };
922
935
  }
923
936
  //#endregion
924
937
  //#region src/presentation/useAgent.ts
925
- var Ue = 20, We = 26e4;
926
- function Ge(e) {
927
- return e.filter((e) => !c.isTextAttachment(e.mimeType) || e.base64.length <= We);
938
+ var We = 20, Ge = 26e4;
939
+ function Ke(e) {
940
+ return e.filter((e) => !c.isTextAttachment(e.mimeType) || e.base64.length <= Ge);
928
941
  }
929
- function Ke(e, t = {}) {
930
- let { defaultEnabled: n = !1 } = t, [r, i] = w(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: l, setSelectedModel: u } = He(), [f, m] = w(!1), [h, g] = w(null), [_, v] = w(!1), [y, b] = w([]), x = Z(), S = C(x);
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);
931
944
  S.current = x;
932
945
  let T = C(null), E = C(!1), D = C(null), O = () => {
933
946
  D.current?.abort();
934
- }, k = p()?.registry ?? {}, A = r && l ? d(l) : null, j = A ? k[A.provider] : null, M = async (t, n, r) => {
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,
959
+ kind: "thinking",
960
+ label: S.current.thinking,
961
+ status: "running"
962
+ }]);
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
+ ];
986
+ });
987
+ };
988
+ try {
989
+ let a = await M.turn({
990
+ params: r.params,
991
+ context: r.context,
992
+ text: e,
993
+ first: t,
994
+ signal: i.signal,
995
+ ...n || z.current ? { model: n || z.current } : {},
996
+ onText: (e) => o("running", e),
997
+ onStep: s
998
+ });
999
+ return o("done", a.text), r.history = [
1000
+ ...r.history,
1001
+ ...e ? [{
1002
+ role: "user",
1003
+ content: e
1004
+ }] : [],
1005
+ {
1006
+ role: "assistant",
1007
+ content: a.text
1008
+ }
1009
+ ], a.result ?? null;
1010
+ } catch (t) {
1011
+ return r.history = [...r.history, ...e ? [{
1012
+ role: "user",
1013
+ content: e
1014
+ }] : []], i.signal.aborted ? (o("stopped"), null) : (o("error"), g(Y(t)), null);
1015
+ } finally {
1016
+ D.current = null;
1017
+ }
1018
+ }, W = async (t, n, r) => {
935
1019
  let i = T.current;
936
1020
  if (!i) return g(S.current.noActiveSession), null;
937
1021
  let a = r ? d(r) : A, o = a ? k[a.provider] : null;
938
1022
  if (!o || !a) return g(S.current.noProviderAvailable), null;
939
1023
  n?.length && (i.attachmentsRef.current = [...i.attachmentsRef.current ?? [], ...n]);
940
- let s = (n ?? []).filter((e) => c.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= We ? `\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 = Ge(n ?? []), u = i.tools.map((e) => ({
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) => ({
941
1025
  name: e.name,
942
1026
  description: e.description,
943
1027
  inputSchema: I(e.inputSchema)
@@ -951,7 +1035,7 @@ function Ke(e, t = {}) {
951
1035
  } : i));
952
1036
  try {
953
1037
  let n = i.history, r = t;
954
- for (let t = 0; t < Ue; t++) {
1038
+ for (let t = 0; t < We; t++) {
955
1039
  let c = crypto.randomUUID();
956
1040
  b((e) => [...e, {
957
1041
  id: c,
@@ -974,7 +1058,7 @@ function Ke(e, t = {}) {
974
1058
  return i.history = [...n, ...r ? [{
975
1059
  role: "user",
976
1060
  content: r + s
977
- }] : []], p.signal.aborted ? (m(c, "stopped"), e.fallback(i.params, i.context)) : (m(c, "error"), g(K(t)), null);
1061
+ }] : []], p.signal.aborted ? (m(c, "stopped"), e.fallback(i.params, i.context)) : (m(c, "error"), g(Y(t)), null);
978
1062
  }
979
1063
  if (i.history = [...n, ...r ? [{
980
1064
  role: "user",
@@ -1024,7 +1108,7 @@ function Ke(e, t = {}) {
1024
1108
  return m(e.id, "error"), {
1025
1109
  toolCallId: e.id,
1026
1110
  name: e.name,
1027
- output: K(t),
1111
+ output: Y(t),
1028
1112
  isError: !0
1029
1113
  };
1030
1114
  }
@@ -1056,7 +1140,7 @@ function Ke(e, t = {}) {
1056
1140
  let d;
1057
1141
  try {
1058
1142
  d = await o.complete({
1059
- prompt: G(H().stopCallingTools, e.microPromptIds),
1143
+ prompt: J(U().stopCallingTools, e.microPromptIds),
1060
1144
  model: a.model,
1061
1145
  history: n,
1062
1146
  signal: p.signal,
@@ -1082,13 +1166,15 @@ function Ke(e, t = {}) {
1082
1166
  enabled: r,
1083
1167
  setEnabled: i,
1084
1168
  hasProviders: a,
1085
- selectedModel: l,
1086
- setSelectedModel: u,
1169
+ selectedModel: N ? L : l,
1170
+ setSelectedModel: N ? B : u,
1087
1171
  modelsByProvider: o,
1088
1172
  modelsLoading: s,
1089
1173
  running: f,
1090
1174
  error: h,
1091
1175
  canContinue: _,
1176
+ remote: N,
1177
+ remoteModels: P,
1092
1178
  activity: y,
1093
1179
  run: async (t, n) => {
1094
1180
  if (E.current) return g(S.current.requestInProgress), null;
@@ -1102,14 +1188,14 @@ function Ke(e, t = {}) {
1102
1188
  }] : []), m(!0);
1103
1189
  try {
1104
1190
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1105
- T.current = {
1191
+ if (T.current = {
1106
1192
  params: t,
1107
1193
  context: i,
1108
1194
  tools: o,
1109
1195
  history: [],
1110
1196
  logId: crypto.randomUUID(),
1111
1197
  attachmentsRef: a
1112
- };
1198
+ }, N) return v(!0), V(t), await H(n?.openingMessage ?? "", !0);
1113
1199
  let s = n?.model || void 0, l = s ? !!k[d(s)?.provider ?? ""] : !!j;
1114
1200
  if (!r || !l) {
1115
1201
  v(!1);
@@ -1122,10 +1208,10 @@ function Ke(e, t = {}) {
1122
1208
  }]), n;
1123
1209
  }
1124
1210
  v(!0);
1125
- let u = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => c.fileToAttachment(e))) : void 0, f = G(e.buildPrompt(t, i), e.microPromptIds);
1126
- return await M(f, u, s);
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);
1127
1213
  } catch (e) {
1128
- return g(K(e)), null;
1214
+ return g(Y(e)), null;
1129
1215
  } finally {
1130
1216
  E.current = !1, m(!1);
1131
1217
  }
@@ -1145,9 +1231,9 @@ function Ke(e, t = {}) {
1145
1231
  history: n.history,
1146
1232
  logId: crypto.randomUUID(),
1147
1233
  attachmentsRef: a
1148
- }, v(r && !!j);
1234
+ }, N && V(t), v(N || r && !!j);
1149
1235
  } catch (e) {
1150
- g(K(e));
1236
+ g(Y(e));
1151
1237
  } finally {
1152
1238
  E.current = !1, m(!1);
1153
1239
  }
@@ -1166,10 +1252,11 @@ function Ke(e, t = {}) {
1166
1252
  ...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
1167
1253
  }]);
1168
1254
  try {
1169
- let i = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => c.fileToAttachment(e))) : void 0, a = G(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
1170
- return await M(a, i, n?.model || void 0);
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);
1171
1258
  } catch (e) {
1172
- return g(K(e)), null;
1259
+ return g(Y(e)), null;
1173
1260
  } finally {
1174
1261
  E.current = !1, m(!1);
1175
1262
  }
@@ -1195,23 +1282,23 @@ function Ke(e, t = {}) {
1195
1282
  }
1196
1283
  //#endregion
1197
1284
  //#region src/domain/orchestrator/prompt.ts
1198
- function qe() {
1199
- let e = H();
1285
+ function Je() {
1286
+ let e = U();
1200
1287
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1201
1288
  }
1202
- function Je(e, t, n) {
1203
- let r = H(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1289
+ function Ye(e, t, n) {
1290
+ let r = U(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1204
1291
  return `${r.orchestratorIntro}
1205
1292
 
1206
1293
  ${r.toolsHeading}
1207
1294
  ${t}
1208
1295
  ${i}
1209
- ${qe()}
1296
+ ${Je()}
1210
1297
 
1211
1298
  ${r.userRequestHeading}
1212
1299
  ${e}`;
1213
1300
  }
1214
- function Ye(e, t) {
1301
+ function Xe(e, t) {
1215
1302
  return t ? {
1216
1303
  kind: "handoff",
1217
1304
  ...t
@@ -1222,24 +1309,27 @@ function Ye(e, t) {
1222
1309
  }
1223
1310
  //#endregion
1224
1311
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1225
- function Xe(e) {
1312
+ function Ze(e) {
1313
+ return j().filter((t) => !t.onlyWhenAnchored || e === t.id);
1314
+ }
1315
+ function Qe(e) {
1226
1316
  return {
1227
- buildContext() {
1317
+ buildContext(e) {
1228
1318
  return {
1229
- cliCatalog: ie(j()),
1319
+ cliCatalog: ne(Ze(e.scopedSubagentId)),
1230
1320
  handoff: { current: null },
1231
1321
  collected: {}
1232
1322
  };
1233
1323
  },
1234
1324
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1235
- return Je(e, n, t);
1325
+ return Ye(e, n, t);
1236
1326
  },
1237
1327
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1238
- return `${e}\n\n${qe()}\n\n${H().toolsHeading}\n${n}`;
1328
+ return `${e}\n\n${Je()}\n\n${U().toolsHeading}\n${n}`;
1239
1329
  },
1240
1330
  parseResponse(e, t, n) {
1241
1331
  let r = n.handoff.current;
1242
- return n.handoff.current = null, Ye(e, r);
1332
+ return n.handoff.current = null, Xe(e, r);
1243
1333
  },
1244
1334
  fallback() {
1245
1335
  return {
@@ -1255,7 +1345,7 @@ function Xe(e) {
1255
1345
  attachmentsRef: r,
1256
1346
  collected: n.collected,
1257
1347
  proxyFetch: f
1258
- }), a = t.scopedSubagentId ? M(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = j().flatMap((t) => t.commands.map((r) => ({
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) => ({
1259
1349
  name: `${t.id}_${r.name}`,
1260
1350
  description: `${t.label}: ${r.summary}`,
1261
1351
  inputSchema: r.inputSchema,
@@ -1269,7 +1359,7 @@ function Xe(e) {
1269
1359
  params: i
1270
1360
  }, {
1271
1361
  status: "queued",
1272
- note: u(H().handoffQueued, { label: t.label })
1362
+ note: u(U().handoffQueued, { label: t.label })
1273
1363
  };
1274
1364
  }
1275
1365
  })));
@@ -1279,17 +1369,17 @@ function Xe(e) {
1279
1369
  }
1280
1370
  //#endregion
1281
1371
  //#region src/presentation/deriveHistoryTitle.ts
1282
- function Ze(e, t) {
1372
+ function $e(e, t) {
1283
1373
  return e.deriveHistoryTitle?.(t) ?? e.label;
1284
1374
  }
1285
1375
  //#endregion
1286
1376
  //#region src/presentation/ResultDestinationPicker.tsx
1287
- function Qe({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
1288
- let s = Z(), c = $(), l = c.scope, d = h(), [f, p] = w(null), [m, g] = w(new Set(i ?? [])), [_, v] = w(null), y = J(), b = /* @__PURE__ */ new Map();
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();
1289
1379
  e.destinationIds.forEach((e) => {
1290
1380
  let t = y[e];
1291
1381
  t && b.set(e, t);
1292
- }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(q.id, q);
1382
+ }), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(X.id, X);
1293
1383
  let x = Array.from(b.values()), S = async (i) => {
1294
1384
  p(i), v(null);
1295
1385
  try {
@@ -1302,7 +1392,7 @@ function Qe({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1302
1392
  storageProvider: l?.storageProvider ?? null,
1303
1393
  proxyFetch: d
1304
1394
  }, n);
1305
- g((e) => new Set(e).add(i)), a?.(i), f?.id && c.commitEntityChat(e.id, f.id, r, l?.id, n, Ze(e, 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));
1306
1396
  } catch (e) {
1307
1397
  v(e instanceof Error ? e.message : String(e));
1308
1398
  } finally {
@@ -1335,16 +1425,16 @@ function Qe({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
1335
1425
  }
1336
1426
  //#endregion
1337
1427
  //#region src/presentation/reports/subagentReportRegistry.tsx
1338
- var $e = {};
1339
- function et(e) {
1340
- Object.assign($e, e);
1428
+ var tt = {};
1429
+ function nt(e) {
1430
+ Object.assign(tt, e);
1341
1431
  }
1342
- function tt(e) {
1343
- return $e[e];
1432
+ function rt(e) {
1433
+ return tt[e];
1344
1434
  }
1345
1435
  //#endregion
1346
1436
  //#region src/presentation/reports/GenericResultPreview.tsx
1347
- function nt({ result: e }) {
1437
+ function it({ result: e }) {
1348
1438
  let [t, n] = w(!1);
1349
1439
  return /* @__PURE__ */ D("div", {
1350
1440
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -1361,7 +1451,7 @@ function nt({ result: e }) {
1361
1451
  }
1362
1452
  //#endregion
1363
1453
  //#region src/presentation/liveAnchorDestination.ts
1364
- function rt(e, t, n) {
1454
+ function at(e, t, n) {
1365
1455
  return e.length === 0 ? null : {
1366
1456
  id: "live-component",
1367
1457
  label: "Applica al componente aperto",
@@ -1371,125 +1461,164 @@ function rt(e, t, n) {
1371
1461
  };
1372
1462
  }
1373
1463
  //#endregion
1464
+ //#region src/presentation/subagentControls.ts
1465
+ var ot = {};
1466
+ function st(e) {
1467
+ Object.assign(ot, e);
1468
+ }
1469
+ function ct(e) {
1470
+ return ot[e];
1471
+ }
1472
+ //#endregion
1374
1473
  //#region src/presentation/SubagentRunner.tsx
1375
- function it({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o }) {
1376
- let s = Ke(e.definition, { defaultEnabled: !0 }), c = $(), l = c.scope, u = h(), d = C(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [f, p] = w(null), [m, g] = w([]), [_, v] = w(null), y = tt(e.id), x = y?.kind === "selection" ? y : null, [O, k] = w(null), A = C(!1), j = C(0), M = C(null);
1377
- f && f !== M.current && (M.current = f, j.current = (r?.length ?? 0) + s.activity.length);
1378
- let N = C(!1), P = !s.hasProviders || s.selectedModel !== "";
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);
1477
+ 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 !== "";
1379
1479
  b(() => {
1380
- !A.current && P && (A.current = !0, a ? s.resume(e.toParams(t), a) : (o && s.setSelectedModel(o), s.run(e.toParams(t), { model: o }).then((e) => {
1381
- e && p(e);
1480
+ !j.current && F && (j.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
1481
+ model: o,
1482
+ openingMessage: s
1483
+ }).then((e) => {
1484
+ e && m(e);
1382
1485
  })));
1383
- }, [P]), b(() => {
1384
- if (!f || !l) return;
1385
- let n = e.autoApplyDestinationIds ?? [], r = c.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = J();
1486
+ }, [F]), b(() => {
1487
+ if (!p || !u) return;
1488
+ let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = le();
1386
1489
  n.forEach((n) => {
1387
1490
  let a = i[n];
1388
- a && (v(null), a.apply(f, {
1389
- scopeId: l.id,
1390
- dataProvider: l.dataProvider,
1391
- storageProvider: l.storageProvider,
1392
- proxyFetch: u
1491
+ a && (y(null), a.apply(p, {
1492
+ scopeId: u.id,
1493
+ dataProvider: u.dataProvider,
1494
+ storageProvider: u.storageProvider,
1495
+ proxyFetch: d
1393
1496
  }, {
1394
1497
  ...t,
1395
1498
  pinnedEntityId: r
1396
1499
  }).then((n) => {
1397
- n?.id && c.commitEntityChat(e.id, n.id, d, l.id, t, Ze(e, t));
1398
- }).catch((e) => v(e instanceof Error ? e.message : String(e))));
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))));
1399
1502
  });
1400
1503
  }, [
1401
- f,
1402
- s.activity,
1403
- l
1504
+ p,
1505
+ c.activity,
1506
+ u
1404
1507
  ]), b(() => {
1405
- f && x && k(x.defaultSelection(f));
1406
- }, [f, x]);
1407
- let F = (e, t) => {
1408
- k((n) => n && {
1508
+ p && O && A(O.defaultSelection(p));
1509
+ }, [p, O]);
1510
+ let I = (e, t) => {
1511
+ A((n) => n && {
1409
1512
  ...n,
1410
1513
  [e]: t
1411
1514
  });
1412
- }, I = (e) => p(e), L = S(() => f && x && O ? x.applySelection(f, O) : f, [
1413
- f,
1414
- x,
1415
- O
1416
- ]), R = S(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), z = S(() => rt(R, t, d), [
1417
- R,
1515
+ }, L = (e) => m(e), R = S(() => p && O && k ? O.applySelection(p, k) : p, [
1516
+ 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), [
1520
+ z,
1418
1521
  t,
1419
- d
1420
- ]), B = S(() => z ? [z, ...n ?? []] : n, [z, n]), V = (e) => {
1421
- g((t) => t.includes(e) ? t : [...t, e]);
1522
+ f
1523
+ ]), V = S(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), U = C(!1);
1524
+ b(() => {
1525
+ let n = U.current && !c.running;
1526
+ if (U.current = c.running, !n || !H || !u) return;
1527
+ let i = c.snapshot();
1528
+ i && ge({
1529
+ scopeId: u.id,
1530
+ subagentId: e.id,
1531
+ entityId: H,
1532
+ params: t,
1533
+ title: $e(e, t),
1534
+ history: i.history,
1535
+ activity: [...r ?? [], ...i.activity]
1536
+ });
1537
+ }, [c.running]);
1538
+ let W = () => {
1539
+ P.current = !0, c.running && c.stop(), l.closeTask(f);
1540
+ }, ee = C(ct(e.id) ?? lt).current, G = ee({
1541
+ params: t,
1542
+ taskId: f,
1543
+ running: c.running,
1544
+ close: W
1545
+ }), K = (e) => {
1546
+ _((t) => t.includes(e) ? t : [...t, e]);
1422
1547
  };
1423
1548
  return b(() => {
1424
- N.current || c.openTask({
1425
- id: d,
1426
- title: Ze(e, t),
1549
+ P.current || l.openTask({
1550
+ id: f,
1551
+ title: $e(e, t),
1427
1552
  icon: e.icon,
1428
- agent: s,
1429
- onApplied: (e) => p(e),
1553
+ agent: c,
1554
+ onApplied: (e) => m(e),
1430
1555
  precedingActivity: r,
1431
- panelExtraAnchorIndex: j.current,
1432
- onDismiss: () => {
1433
- N.current = !0, s.running && s.stop(), c.closeTask(d);
1434
- },
1435
- panelExtra: f ? /* @__PURE__ */ D(T, { children: [
1436
- x && O ? /* @__PURE__ */ E(x.Report, {
1437
- result: f,
1438
- selection: O,
1439
- onChange: F
1440
- }) : y?.kind === "editable" ? /* @__PURE__ */ E(y.Report, {
1441
- result: f,
1442
- onResultChange: I
1443
- }) : /* @__PURE__ */ E(nt, { result: L }),
1444
- _ && /* @__PURE__ */ D("p", {
1556
+ panelExtraAnchorIndex: M.current,
1557
+ onDismiss: W,
1558
+ ...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, {
1563
+ result: p,
1564
+ selection: k,
1565
+ onChange: I
1566
+ }) : x?.kind === "editable" ? /* @__PURE__ */ E(x.Report, {
1567
+ result: p,
1568
+ onResultChange: L
1569
+ }) : /* @__PURE__ */ E(it, { result: R }),
1570
+ v && /* @__PURE__ */ D("p", {
1445
1571
  className: "text-xs text-destructive",
1446
- children: ["Salvataggio automatico non riuscito: ", _]
1572
+ children: ["Salvataggio automatico non riuscito: ", v]
1447
1573
  }),
1448
- /* @__PURE__ */ E(Qe, {
1574
+ /* @__PURE__ */ E(et, {
1449
1575
  manifest: e,
1450
- result: L,
1576
+ result: R,
1451
1577
  meta: t,
1452
- taskId: d,
1453
- initiallyApplied: m,
1454
- onApplied: V,
1455
- extraDestinations: B
1578
+ taskId: f,
1579
+ initiallyApplied: g,
1580
+ onApplied: K,
1581
+ extraDestinations: V
1456
1582
  })
1457
1583
  ] }) : void 0
1458
1584
  });
1459
1585
  }, [
1460
- s.activity,
1461
- s.running,
1462
- s.error,
1463
- s.canContinue,
1464
- s.selectedModel,
1465
- s.modelsByProvider,
1466
- s.hasProviders,
1467
- c.openTask,
1468
- c.componentAnchors,
1469
- d,
1586
+ c.activity,
1587
+ c.running,
1588
+ c.error,
1589
+ c.canContinue,
1590
+ c.selectedModel,
1591
+ c.modelsByProvider,
1592
+ c.hasProviders,
1593
+ c.remoteModels,
1594
+ l.openTask,
1595
+ l.componentAnchors,
1596
+ f,
1470
1597
  e,
1471
1598
  t,
1472
- f,
1473
- L,
1474
- O,
1475
- m,
1599
+ p,
1600
+ R,
1601
+ k,
1602
+ g,
1476
1603
  n,
1477
1604
  r,
1478
- _
1605
+ v,
1606
+ G.content,
1607
+ G.actions
1479
1608
  ]), b(() => () => {
1480
- c.closeTask(d);
1481
- }, [c.closeTask, d]), null;
1609
+ l.closeTask(f);
1610
+ }, [l.closeTask, f]), null;
1482
1611
  }
1483
1612
  //#endregion
1484
1613
  //#region src/presentation/OrchestratorRunner.tsx
1485
- function at({ userGoal: e }) {
1486
- let t = Z(), n = Ke(S(() => Xe({
1614
+ function dt({ userGoal: e }) {
1615
+ let t = Q(), n = qe(S(() => Qe({
1487
1616
  unavailable: t.orchestratorUnavailable,
1488
1617
  continueWithoutAi: t.orchestratorContinueWithoutAi,
1489
1618
  preparing: t.orchestratorPreparing,
1490
1619
  collecting: t.orchestratorCollecting
1491
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) => {
1492
- e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Q));
1621
+ e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(we));
1493
1622
  };
1494
1623
  b(() => {
1495
1624
  !o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
@@ -1505,7 +1634,7 @@ function at({ userGoal: e }) {
1505
1634
  }));
1506
1635
  }, [s]), b(() => {
1507
1636
  p.current || r.openTask({
1508
- id: Q,
1637
+ id: we,
1509
1638
  title: "Agentico",
1510
1639
  icon: "bot",
1511
1640
  agent: n,
@@ -1513,7 +1642,7 @@ function at({ userGoal: e }) {
1513
1642
  scopedSubagentId: d.current,
1514
1643
  precedingActivity: f.current?.activity,
1515
1644
  onDismiss: () => {
1516
- p.current = !0, n.running && n.stop(), r.closeTask(Q);
1645
+ p.current = !0, n.running && n.stop(), r.closeTask(we);
1517
1646
  }
1518
1647
  });
1519
1648
  }, [
@@ -1526,12 +1655,12 @@ function at({ userGoal: e }) {
1526
1655
  n.hasProviders,
1527
1656
  r.openTask
1528
1657
  ]), b(() => () => {
1529
- r.closeTask(Q);
1658
+ r.closeTask(we);
1530
1659
  }, [r.closeTask]);
1531
1660
  let h = S(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
1532
1661
  if (!i) return null;
1533
1662
  let g = M(i.subagentId);
1534
- return g ? /* @__PURE__ */ E(it, {
1663
+ return g ? /* @__PURE__ */ E(ut, {
1535
1664
  manifest: g,
1536
1665
  params: i.params,
1537
1666
  extraDestinations: c.current,
@@ -1542,8 +1671,8 @@ function at({ userGoal: e }) {
1542
1671
  }
1543
1672
  //#endregion
1544
1673
  //#region src/presentation/ManualEntryRunner.tsx
1545
- function ot({ manifest: e, extraDestinations: n }) {
1546
- let r = Ke(e.definition, { defaultEnabled: !1 }), i = Z(), a = $(), o = C(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = w(null), [l, u] = w([]), d = tt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = w(null), [h, g] = w(null), _ = C(!1), v = (t) => {
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) => {
1547
1676
  if (!e.manualEntry) return;
1548
1677
  let n;
1549
1678
  try {
@@ -1570,7 +1699,7 @@ function ot({ manifest: e, extraDestinations: n }) {
1570
1699
  p
1571
1700
  ]), O = (e) => {
1572
1701
  u((t) => t.includes(e) ? t : [...t, e]);
1573
- }, k = S(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), A = S(() => h ? rt(k, h, o) : null, [
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, [
1574
1703
  k,
1575
1704
  h,
1576
1705
  o
@@ -1599,8 +1728,8 @@ function ot({ manifest: e, extraDestinations: n }) {
1599
1728
  }) : d?.kind === "editable" ? /* @__PURE__ */ E(d.Report, {
1600
1729
  result: s,
1601
1730
  onResultChange: x
1602
- }) : /* @__PURE__ */ E(nt, { result: T }),
1603
- /* @__PURE__ */ E(Qe, {
1731
+ }) : /* @__PURE__ */ E(it, { result: T }),
1732
+ /* @__PURE__ */ E(et, {
1604
1733
  manifest: e,
1605
1734
  result: T,
1606
1735
  meta: h ?? {},
@@ -1637,8 +1766,8 @@ function ot({ manifest: e, extraDestinations: n }) {
1637
1766
  }
1638
1767
  //#endregion
1639
1768
  //#region src/presentation/Agentico.tsx
1640
- var st = 420;
1641
- function ct(e) {
1769
+ var pt = 420;
1770
+ function mt(e) {
1642
1771
  return Object.values(e).flat().map((e) => ({
1643
1772
  label: e.model,
1644
1773
  value: e.id,
@@ -1646,8 +1775,8 @@ function ct(e) {
1646
1775
  group: e.providerLabel ?? e.provider
1647
1776
  }));
1648
1777
  }
1649
- function lt({ task: e }) {
1650
- let t = Z(), [n, i] = w(""), { agent: a, onApplied: o, manualEntry: s } = e, c = a.running, l = (e) => {
1778
+ function ht({ task: e }) {
1779
+ let t = Q(), [n, i] = w(""), { agent: a, onApplied: o, manualEntry: s } = e, c = a.running, l = (e) => {
1651
1780
  if (i(""), s) {
1652
1781
  s.onSubmit(e.text);
1653
1782
  return;
@@ -1658,26 +1787,27 @@ function lt({ task: e }) {
1658
1787
  }).then((e) => {
1659
1788
  e && o(e);
1660
1789
  });
1661
- }, u = !s && a.hasProviders && !a.selectedModel;
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);
1662
1791
  return /* @__PURE__ */ E(r, {
1663
1792
  value: n,
1664
1793
  onChange: i,
1665
1794
  placeholder: s?.prompt ?? t.messagePlaceholder,
1666
1795
  running: c,
1667
1796
  onStop: a.stop,
1668
- disabled: !n.trim() || u,
1797
+ disabled: !n.trim() || d,
1669
1798
  onSubmit: l,
1670
- attachments: !s,
1671
- models: s ? [] : ct(a.modelsByProvider),
1672
- selectedModel: s ? "" : a.selectedModel,
1799
+ attachments: !s && !a.remote,
1800
+ models: f,
1801
+ selectedModel: u ? "" : a.selectedModel,
1802
+ actions: e.composerActions,
1673
1803
  onModelChange: a.setSelectedModel,
1674
1804
  modelPlaceholder: t.selectModelPlaceholder,
1675
1805
  minHeight: 44,
1676
1806
  maxHeight: 220
1677
1807
  });
1678
1808
  }
1679
- function ut() {
1680
- let { startOrchestrator: e } = $(), t = Z(), [n, i] = w(""), { hasProviders: a, modelsByProvider: o, selectedModel: s, setSelectedModel: c } = He(), l = (t) => {
1809
+ function gt() {
1810
+ let { startOrchestrator: e } = $(), t = Q(), [n, i] = w(""), { hasProviders: a, modelsByProvider: o, selectedModel: s, setSelectedModel: c } = Ue(), l = (t) => {
1681
1811
  t.text.trim() && (e(t.text.trim(), {
1682
1812
  attachments: t.files.length > 0 ? t.files : void 0,
1683
1813
  model: t.model || void 0
@@ -1690,7 +1820,7 @@ function ut() {
1690
1820
  disabled: !n.trim() || u,
1691
1821
  onSubmit: l,
1692
1822
  attachments: !0,
1693
- models: ct(o),
1823
+ models: mt(o),
1694
1824
  selectedModel: s,
1695
1825
  onModelChange: c,
1696
1826
  modelPlaceholder: t.selectModelPlaceholder,
@@ -1698,8 +1828,20 @@ function ut() {
1698
1828
  maxHeight: 220
1699
1829
  });
1700
1830
  }
1701
- function dt({ card: e }) {
1702
- let t = Z();
1831
+ function _t(e, t, n = Date.now()) {
1832
+ let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
1833
+ numeric: "auto",
1834
+ style: "short"
1835
+ });
1836
+ for (let [e, t] of [
1837
+ ["day", 86400],
1838
+ ["hour", 3600],
1839
+ ["minute", 60]
1840
+ ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
1841
+ return i.format(0, "minute");
1842
+ }
1843
+ function vt({ card: e }) {
1844
+ let t = Q();
1703
1845
  return e.humanSummaryOnly ? /* @__PURE__ */ D("div", {
1704
1846
  className: "space-y-2 rounded-lg border border-border/60 p-3",
1705
1847
  children: [/* @__PURE__ */ D("p", {
@@ -1754,7 +1896,7 @@ function dt({ card: e }) {
1754
1896
  ]
1755
1897
  });
1756
1898
  }
1757
- function ft({ messages: e }) {
1899
+ function yt({ messages: e }) {
1758
1900
  return /* @__PURE__ */ E("div", {
1759
1901
  className: "space-y-2 rounded-lg border border-border/60 p-3",
1760
1902
  children: e.map((e, t) => /* @__PURE__ */ E("p", {
@@ -1763,22 +1905,36 @@ function ft({ messages: e }) {
1763
1905
  }, t))
1764
1906
  });
1765
1907
  }
1766
- function pt({ scopeId: e, open: n, onOpenChange: r, onSelect: i, onNewChat: c }) {
1767
- let l = Z(), [u, d] = w(""), f = S(() => n ? ye(e) : [], [e, n]), p = S(() => {
1768
- let e = u.trim().toLowerCase();
1769
- return e ? f.filter((t) => {
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) : [], [
1910
+ e,
1911
+ r,
1912
+ g
1913
+ ]), y = async (t) => {
1914
+ let r = M(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
1915
+ if (!i || window.confirm(i)) {
1916
+ try {
1917
+ await r?.onArchive?.(t.entityId, t.params);
1918
+ } catch {
1919
+ return;
1920
+ }
1921
+ _e(e, t.subagentId, t.entityId), n === ye(t.subagentId, t.entityId) && u(), _((e) => e + 1);
1922
+ }
1923
+ }, b = S(() => {
1924
+ let e = p.trim().toLowerCase();
1925
+ return e ? v.filter((t) => {
1770
1926
  let n = M(t.subagentId)?.label ?? t.subagentId;
1771
1927
  return t.title.toLowerCase().includes(e) || n.toLowerCase().includes(e);
1772
- }) : f;
1773
- }, [f, u]);
1928
+ }) : v;
1929
+ }, [v, p]);
1774
1930
  return /* @__PURE__ */ E(a, {
1775
1931
  trigger: {
1776
1932
  icon: "history",
1777
- title: l.chatHistory
1933
+ title: d.chatHistory
1778
1934
  },
1779
1935
  triggerClassName: "!h-9 !w-9 !p-0 rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground",
1780
- open: n,
1781
- onOpenChange: r,
1936
+ open: r,
1937
+ onOpenChange: i,
1782
1938
  position: "end",
1783
1939
  strategy: "absolute",
1784
1940
  menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
@@ -1792,29 +1948,35 @@ function pt({ scopeId: e, open: n, onOpenChange: r, onSelect: i, onNewChat: c })
1792
1948
  }),
1793
1949
  /* @__PURE__ */ E("input", {
1794
1950
  autoFocus: !0,
1795
- value: u,
1796
- onChange: (e) => d(e.target.value),
1797
- placeholder: l.searchChats,
1951
+ value: p,
1952
+ onChange: (e) => h(e.target.value),
1953
+ placeholder: d.searchChats,
1798
1954
  className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
1799
1955
  }),
1800
1956
  /* @__PURE__ */ E(t, {
1801
1957
  icon: "square-pen",
1802
- ariaLabel: l.newChat,
1803
- title: l.newChat,
1958
+ ariaLabel: d.newChat,
1959
+ title: d.newChat,
1804
1960
  variant: "link",
1805
1961
  className: "shrink-0",
1806
- onClick: c
1962
+ onClick: l
1807
1963
  })
1808
1964
  ]
1809
1965
  }),
1810
- children: p.length === 0 ? /* @__PURE__ */ E("p", {
1966
+ children: b.length === 0 ? /* @__PURE__ */ E("p", {
1811
1967
  className: "px-2 py-3 text-center text-xs text-muted-foreground",
1812
- children: f.length === 0 ? l.noSavedChats : l.noResults
1813
- }) : p.map((e) => {
1814
- let t = M(e.subagentId);
1968
+ children: v.length === 0 ? d.noSavedChats : d.noResults
1969
+ }) : b.map((e) => {
1970
+ let t = M(e.subagentId), r = n === ye(e.subagentId, e.entityId);
1815
1971
  return /* @__PURE__ */ E(o, {
1816
- icon: t?.icon ?? "bot",
1817
- onClick: () => i(e.subagentId, e.entityId, e),
1972
+ icon: r ? "check" : t?.icon ?? "bot",
1973
+ className: r ? "bg-accent font-medium" : void 0,
1974
+ actions: [{
1975
+ icon: "archive",
1976
+ label: d.archiveChat,
1977
+ onClick: () => void y(e)
1978
+ }],
1979
+ onClick: () => c(e.subagentId, e.entityId, e),
1818
1980
  children: /* @__PURE__ */ D("span", {
1819
1981
  className: "flex min-w-0 flex-1 items-center justify-between gap-2",
1820
1982
  children: [/* @__PURE__ */ D("span", {
@@ -1829,52 +1991,74 @@ function pt({ scopeId: e, open: n, onOpenChange: r, onSelect: i, onNewChat: c })
1829
1991
  ]
1830
1992
  }), /* @__PURE__ */ E("span", {
1831
1993
  className: "shrink-0 text-xs text-muted-foreground",
1832
- children: new Date(e.savedAt).toLocaleString()
1994
+ title: new Date(e.savedAt).toLocaleString(f),
1995
+ children: _t(e.savedAt, f)
1833
1996
  })]
1834
1997
  })
1835
1998
  }, `${e.subagentId}:${e.entityId}`);
1836
1999
  })
1837
2000
  });
1838
2001
  }
1839
- function mt() {
1840
- 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: _, scope: v } = $(), y = Z(), x = C(null), [S, O] = w(!1), k = () => {
1841
- (!e || e.agent.running || e.savedToDisk || window.confirm(y.unsavedConversationConfirm)) && (u(), O(!1));
1842
- }, A = e ? [...e.precedingActivity ?? [], ...e.agent.activity] : [], j = A.length, N = Math.max(0, Math.min(e?.panelExtraAnchorIndex ?? j, j)), P = A.slice(0, N), F = A.slice(N), I = !!(e && !e.agent.running && e.agent.error), L = e?.id === "agentico-orchestrator" && e.scopedSubagentId ? M(e.scopedSubagentId) : void 0, R = L?.manualEntry ? L : null, z = C(!0);
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);
1843
2006
  b(() => {
1844
- let e = x.current;
2007
+ let e = O.current;
1845
2008
  if (!e) return;
1846
2009
  let t = () => {
1847
- z.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
2010
+ V.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
1848
2011
  };
1849
2012
  return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
1850
2013
  }, [e?.id]), b(() => {
1851
- let e = x.current;
1852
- e && (z.current = !0, e.scrollTop = e.scrollHeight);
1853
- }, [e?.id]), b(() => {
1854
- let e = x.current;
1855
- e && z.current && (e.scrollTop = e.scrollHeight);
1856
- }, [j, I]);
1857
- let B = r ? /* @__PURE__ */ E(at, { userGoal: r }, i) : null, V = c ? M(c.subagentId) : void 0, ee = c && V ? /* @__PURE__ */ E(it, {
1858
- manifest: V,
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);
2021
+ }, [
2022
+ P,
2023
+ R,
2024
+ H
2025
+ ]);
2026
+ let U = C(null);
2027
+ b(() => {
2028
+ let e = O.current, t = U.current;
2029
+ if (!e || !t || typeof ResizeObserver > "u") return;
2030
+ let n = new ResizeObserver(() => {
2031
+ V.current && (e.scrollTop = e.scrollHeight);
2032
+ });
2033
+ 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,
1859
2037
  params: c.snapshot.params,
1860
- taskId: `entitychat-${c.subagentId}-${c.entityId}`,
2038
+ taskId: ye(c.subagentId, c.entityId),
1861
2039
  resumeSeed: {
1862
2040
  history: c.snapshot.history,
1863
2041
  activity: c.snapshot.activity
1864
2042
  }
1865
- }, l) : null, H = f ? M(f.subagentId) : void 0, te = f && H ? /* @__PURE__ */ E(ot, {
1866
- manifest: H,
2043
+ }, l) : null, K = f ? M(f.subagentId) : void 0, te = f && K ? /* @__PURE__ */ E(ft, {
2044
+ manifest: K,
1867
2045
  extraDestinations: f.extraDestinations
1868
- }, p) : null, ne = g ? M(g.subagentId) : void 0, U = g && ne ? /* @__PURE__ */ E(it, {
2046
+ }, p) : null, ne = g ? M(g.subagentId) : void 0, q = g && ne ? /* @__PURE__ */ E(ut, {
1869
2047
  manifest: ne,
1870
2048
  params: g.params,
1871
2049
  extraDestinations: g.extraDestinations
1872
- }, _) : null;
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;
1873
2056
  return n ? /* @__PURE__ */ D(T, { children: [
1874
- B,
1875
- ee,
2057
+ W,
2058
+ G,
1876
2059
  te,
1877
- U,
2060
+ q,
2061
+ J,
1878
2062
  /* @__PURE__ */ D("div", {
1879
2063
  style: { width: 420 },
1880
2064
  className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
@@ -1886,32 +2070,35 @@ function mt() {
1886
2070
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
1887
2071
  children: e ? e.title : "Agentico"
1888
2072
  }),
1889
- v && /* @__PURE__ */ E(pt, {
1890
- scopeId: v.id,
1891
- open: S,
1892
- onOpenChange: O,
1893
- onNewChat: k,
1894
- onSelect: (e, t, n) => d(e, t, n)
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
1895
2081
  }),
1896
- /* @__PURE__ */ E(Re, {})
2082
+ /* @__PURE__ */ E(ze, {})
1897
2083
  ]
1898
2084
  }),
1899
2085
  /* @__PURE__ */ E("div", {
1900
- ref: x,
2086
+ ref: O,
1901
2087
  className: "flex-1 overflow-y-auto px-3 pb-2",
1902
2088
  children: /* @__PURE__ */ E("div", {
2089
+ ref: U,
1903
2090
  className: "pt-2",
1904
2091
  children: e ? /* @__PURE__ */ D(T, { children: [
1905
- e.manualEntry && A.length === 0 && /* @__PURE__ */ E("p", {
2092
+ e.manualEntry && N.length === 0 && /* @__PURE__ */ E("p", {
1906
2093
  className: "text-xs text-muted-foreground",
1907
2094
  children: e.manualEntry.prompt
1908
2095
  }),
1909
- /* @__PURE__ */ E(Le, { activity: P }),
2096
+ /* @__PURE__ */ E(Re, { activity: I }),
1910
2097
  e.panelExtra && /* @__PURE__ */ E("div", {
1911
2098
  className: "mt-3",
1912
2099
  children: e.panelExtra
1913
2100
  }),
1914
- F.length > 0 && /* @__PURE__ */ E(Le, { activity: F }),
2101
+ L.length > 0 && /* @__PURE__ */ E(Re, { activity: L }),
1915
2102
  !e.agent.running && e.agent.error && /* @__PURE__ */ D("div", {
1916
2103
  className: "mt-2 flex items-center gap-2",
1917
2104
  children: [
@@ -1920,22 +2107,22 @@ function mt() {
1920
2107
  children: e.agent.error
1921
2108
  }),
1922
2109
  /* @__PURE__ */ E(t, {
1923
- label: y.retry,
2110
+ label: S.retry,
1924
2111
  variant: "secondary",
1925
2112
  className: "shrink-0",
1926
2113
  onClick: () => {
1927
- e.agent.sendMessage(y.retryMessage).then((t) => {
2114
+ e.agent.sendMessage(S.retryMessage).then((t) => {
1928
2115
  t && e.onApplied(t);
1929
2116
  });
1930
2117
  }
1931
2118
  }),
1932
- /* @__PURE__ */ E(t, {
1933
- label: y.continueWithoutAi,
2119
+ !e.agent.remote && /* @__PURE__ */ E(t, {
2120
+ label: S.continueWithoutAi,
1934
2121
  variant: "secondary",
1935
2122
  className: "shrink-0",
1936
2123
  onClick: () => {
1937
- if (R) {
1938
- m(R.id, h);
2124
+ if (B) {
2125
+ m(B.id, h);
1939
2126
  return;
1940
2127
  }
1941
2128
  let t = e.agent.runFallback();
@@ -1944,34 +2131,38 @@ function mt() {
1944
2131
  })
1945
2132
  ]
1946
2133
  })
1947
- ] }) : s.length > 0 ? /* @__PURE__ */ E(ft, { messages: s }) : o ? /* @__PURE__ */ E(dt, { card: o }) : /* @__PURE__ */ E("p", {
2134
+ ] }) : s.length > 0 ? /* @__PURE__ */ E(yt, { messages: s }) : o ? /* @__PURE__ */ E(vt, { card: o }) : /* @__PURE__ */ E("p", {
1948
2135
  className: "text-xs text-muted-foreground",
1949
- children: a ?? y.orchestratorStarterHint
2136
+ children: a ?? S.orchestratorStarterHint
1950
2137
  })
1951
2138
  })
1952
2139
  }),
1953
- /* @__PURE__ */ E("div", {
2140
+ /* @__PURE__ */ D("div", {
1954
2141
  className: "border-t border-border/60 px-4 py-3",
1955
- children: e ? /* @__PURE__ */ E(lt, { task: e }, e.id) : /* @__PURE__ */ E(ut, {})
2142
+ children: [e?.panelActions && /* @__PURE__ */ E("div", {
2143
+ className: "mb-2",
2144
+ children: e.panelActions
2145
+ }), e ? /* @__PURE__ */ E(ht, { task: e }, e.id) : /* @__PURE__ */ E(gt, {})]
1956
2146
  })
1957
2147
  ]
1958
2148
  })
1959
2149
  ] }) : /* @__PURE__ */ D(T, { children: [
1960
- B,
1961
- ee,
2150
+ W,
2151
+ G,
1962
2152
  te,
1963
- U
2153
+ q,
2154
+ J
1964
2155
  ] });
1965
2156
  }
1966
2157
  //#endregion
1967
2158
  //#region src/presentation/useAgenticoPageContext.ts
1968
- function ht(e, t) {
2159
+ function St(e, t) {
1969
2160
  let { setPageContext: n } = $(), r = C(crypto.randomUUID()).current;
1970
2161
  b(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
1971
2162
  }
1972
2163
  //#endregion
1973
2164
  //#region src/presentation/useSubagentComponentContext.ts
1974
- function gt(e, t, n, r, i = !0, a) {
2165
+ function Ct(e, t, n, r, i = !0, a) {
1975
2166
  let { registerComponentAnchor: o } = $(), s = C(crypto.randomUUID()).current, c = C(n);
1976
2167
  c.current = n, b(() => {
1977
2168
  if (i) return o(s, {
@@ -1990,6 +2181,6 @@ function gt(e, t, n, r, i = !0, a) {
1990
2181
  ]);
1991
2182
  }
1992
2183
  //#endregion
1993
- export { st as AGENTICO_WIDTH, mt as Agentico, Te as AgenticoProvider, Re as AgenticoToggle, le as JSON_EXPORT_DESTINATION_ID, oe as MICRO_PROMPT_REGISTRY, Q as ORCHESTRATOR_TASK_ID, ae as SUMMARY_MICRO_PROMPT, be as agenticoDe, xe as agenticoEn, Se as agenticoIt, z as agenticoPromptsEn, B as agenticoPromptsIt, Ce as agenticoTranslations, G as applyMicroPrompts, ee as configureAgenticoPrompts, pe as configureEntityChatStore, F as createCrossAgentTools, O as defineSubagent, K as extractErrorMessage, se as extractJsonBlock, M as findSubagentManifest, H as getAgenticoPrompts, J as getDestinationRegistry, ge as getEntityChat, j as getSubagentRegistry, tt as getSubagentReport, q as jsonExportDestination, ye as listEntityChats, P as registerCrossAgentTools, de as registerDestinations, et as registerSubagentReports, A as registerSubagents, ve as removeEntityChat, ie as renderRegistryCli, re as renderSubagentCli, te as resetAgenticoPrompts, _e as saveEntityChat, I as toJsonSchema, L as toMcpTool, Ke as useAgent, $ as useAgentico, Z as useAgenticoI18n, ht as useAgenticoPageContext, gt as useSubagentComponentContext };
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 };
1994
2185
 
1995
2186
  //# sourceMappingURL=index.mjs.map