@llmnative/agentico 0.15.3 → 0.16.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/README.md +1 -0
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -244
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/agentDefinition.d.ts +7 -0
- package/dist/types/presentation/useAgent.d.ts +3 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17,56 +17,56 @@ function L(e, t, n) {
|
|
|
17
17
|
function R(e) {
|
|
18
18
|
return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function re(e, t) {
|
|
21
21
|
return t.map((t, n) => `${t.header ?? e[n]?.header ?? e[n]?.question ?? t.id ?? `${n + 1}`}: ${t.values.join(", ")}`).join("\n");
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/domain/defineSubagent.ts
|
|
25
|
-
function
|
|
25
|
+
function z(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var B = [];
|
|
31
|
+
function V(e) {
|
|
32
|
+
B = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function H() {
|
|
35
|
+
return B.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), B;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function U(e) {
|
|
38
|
+
return B.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var W = [];
|
|
43
|
+
function G(...e) {
|
|
44
|
+
W = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function K(e) {
|
|
47
|
+
return W.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
51
|
-
function
|
|
51
|
+
function ie(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
|
|
58
|
+
function ae(e, t, n, r) {
|
|
59
59
|
return {
|
|
60
60
|
name: e,
|
|
61
61
|
description: t,
|
|
62
|
-
inputSchema:
|
|
63
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: ie(n),
|
|
63
|
+
...r ? { outputSchema: ie(r) } : {}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/domain/subagentUsageCard.ts
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function oe(e) {
|
|
69
|
+
let t = ie(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 ae(e) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/domain/prompts.ts
|
|
83
|
-
var
|
|
83
|
+
var q = {
|
|
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.",
|
|
@@ -110,7 +110,7 @@ var J = {
|
|
|
110
110
|
].join(" "),
|
|
111
111
|
multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on.",
|
|
112
112
|
chatTitle: "Write a title for this chat, as a list of chats shows it: 3 to 6 words saying what it is about, in the language the person writes in. Answer with the title only: no quotes, no final period.\n\n{chat}"
|
|
113
|
-
},
|
|
113
|
+
}, J = {
|
|
114
114
|
orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
|
|
115
115
|
responseRules: [
|
|
116
116
|
"PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
|
|
@@ -140,18 +140,18 @@ var J = {
|
|
|
140
140
|
].join(" "),
|
|
141
141
|
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
|
|
142
142
|
chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
|
|
143
|
-
},
|
|
143
|
+
}, Y = q;
|
|
144
144
|
function se(e) {
|
|
145
|
-
|
|
146
|
-
...
|
|
145
|
+
Y = {
|
|
146
|
+
...Y,
|
|
147
147
|
...e
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
function X() {
|
|
151
|
-
return
|
|
151
|
+
return Y;
|
|
152
152
|
}
|
|
153
153
|
function ce() {
|
|
154
|
-
|
|
154
|
+
Y = q;
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/domain/cli/renderManifestCli.ts
|
|
@@ -159,7 +159,7 @@ function le(e, t) {
|
|
|
159
159
|
return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
|
|
160
160
|
}
|
|
161
161
|
function ue(e, t) {
|
|
162
|
-
let n =
|
|
162
|
+
let n = oe(t), r = le(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
|
|
163
163
|
return [
|
|
164
164
|
`COMMAND: ${e} ${t.name}`,
|
|
165
165
|
` ${t.summary}`,
|
|
@@ -665,7 +665,7 @@ function tt({ children: e, scope: t = null }) {
|
|
|
665
665
|
});
|
|
666
666
|
return [...e.values()];
|
|
667
667
|
}, [N]), R = A(() => L.map((e) => {
|
|
668
|
-
let t =
|
|
668
|
+
let t = U(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
669
669
|
if (!t) return null;
|
|
670
670
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
671
671
|
return {
|
|
@@ -673,21 +673,21 @@ function tt({ children: e, scope: t = null }) {
|
|
|
673
673
|
agenticoHint: n,
|
|
674
674
|
userMessage: t.userMessage
|
|
675
675
|
};
|
|
676
|
-
}).filter((e) => e !== null), [L]),
|
|
676
|
+
}).filter((e) => e !== null), [L]), re = A(() => R.map((e) => e.userMessage), [R]), z = A(() => {
|
|
677
677
|
if (R.length === 0) return null;
|
|
678
678
|
if (R.length === 1) return R[0].agenticoHint;
|
|
679
679
|
let e = R.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
680
680
|
return `${X().multipleCandidates}\n\n${e}`;
|
|
681
|
-
}, [R]) ?? te?.text ?? null,
|
|
681
|
+
}, [R]) ?? te?.text ?? null, B = R.length > 0 ? null : te?.card ?? null, V = A(() => [...new Set(I.map((e) => e.subagentId))], [I]), H = V.length === 1 ? V[0] : V.length === 0 ? te?.card?.subagentId ?? null : null, W = O((e, t) => {
|
|
682
682
|
d();
|
|
683
683
|
let n = i.current;
|
|
684
684
|
if (n?.id === "agentico-orchestrator") return;
|
|
685
|
-
let r =
|
|
685
|
+
let r = H && n?.id.startsWith(`subagent-${H}-`) ? n : void 0;
|
|
686
686
|
C(r ? {
|
|
687
687
|
taskId: r.id,
|
|
688
688
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
689
689
|
} : null), p(e), h(t?.extraDestinations), _(t?.attachments), y(t?.model), T(t?.scopedSubagentId), x(crypto.randomUUID());
|
|
690
|
-
}, [d,
|
|
690
|
+
}, [d, H]), G = O((e, t, n, a, o, s) => {
|
|
691
691
|
if (!n || !a) return;
|
|
692
692
|
let c = i.current;
|
|
693
693
|
if (!c || c.id !== n) return;
|
|
@@ -704,19 +704,19 @@ function tt({ children: e, scope: t = null }) {
|
|
|
704
704
|
...e,
|
|
705
705
|
savedToDisk: !0
|
|
706
706
|
} : e));
|
|
707
|
-
}, []), [
|
|
708
|
-
d(),
|
|
707
|
+
}, []), [K, ie] = M(null), [ae, oe] = M(null), q = O((e, t, n) => {
|
|
708
|
+
d(), ie({
|
|
709
709
|
subagentId: e,
|
|
710
710
|
entityId: t,
|
|
711
711
|
snapshot: n
|
|
712
|
-
}),
|
|
713
|
-
}, [d]), [
|
|
714
|
-
d(), l($e),
|
|
712
|
+
}), oe(crypto.randomUUID());
|
|
713
|
+
}, [d]), [J, Y] = M(null), [se, ce] = M(null), le = O((e, t) => {
|
|
714
|
+
d(), l($e), Y({
|
|
715
715
|
subagentId: e,
|
|
716
716
|
extraDestinations: t
|
|
717
717
|
}), ce(crypto.randomUUID());
|
|
718
718
|
}, [d, l]), [ue, de] = M(null), [fe, pe] = M(null), me = O((e, t, n) => {
|
|
719
|
-
|
|
719
|
+
Y(null), de({
|
|
720
720
|
subagentId: e,
|
|
721
721
|
params: t,
|
|
722
722
|
extraDestinations: n
|
|
@@ -738,14 +738,14 @@ function tt({ children: e, scope: t = null }) {
|
|
|
738
738
|
closeTask: l,
|
|
739
739
|
toggleOpen: u,
|
|
740
740
|
pendingGoal: f,
|
|
741
|
-
startOrchestrator:
|
|
742
|
-
pageContext:
|
|
743
|
-
pageContextCard:
|
|
741
|
+
startOrchestrator: W,
|
|
742
|
+
pageContext: z,
|
|
743
|
+
pageContextCard: B,
|
|
744
744
|
setPageContext: ee,
|
|
745
|
-
scopedSubagentId:
|
|
745
|
+
scopedSubagentId: H,
|
|
746
746
|
pendingScopedSubagentId: w,
|
|
747
747
|
componentAnchors: I,
|
|
748
|
-
anchoredUserMessages:
|
|
748
|
+
anchoredUserMessages: re,
|
|
749
749
|
registerComponentAnchor: ne,
|
|
750
750
|
openPanel: d,
|
|
751
751
|
pendingExtraDestinations: m,
|
|
@@ -753,12 +753,12 @@ function tt({ children: e, scope: t = null }) {
|
|
|
753
753
|
pendingModel: v,
|
|
754
754
|
orchestratorRunId: b,
|
|
755
755
|
pendingCarryOver: S,
|
|
756
|
-
commitEntityChat:
|
|
757
|
-
resumeEntityChat:
|
|
758
|
-
pendingResume:
|
|
759
|
-
resumeRunId:
|
|
756
|
+
commitEntityChat: G,
|
|
757
|
+
resumeEntityChat: q,
|
|
758
|
+
pendingResume: K,
|
|
759
|
+
resumeRunId: ae,
|
|
760
760
|
dismissForeignTask: ye,
|
|
761
|
-
pendingManualEntry:
|
|
761
|
+
pendingManualEntry: J,
|
|
762
762
|
manualEntryRunId: se,
|
|
763
763
|
startManualEntry: le,
|
|
764
764
|
pendingResumeWithAI: ue,
|
|
@@ -775,14 +775,14 @@ function tt({ children: e, scope: t = null }) {
|
|
|
775
775
|
l,
|
|
776
776
|
u,
|
|
777
777
|
f,
|
|
778
|
-
|
|
778
|
+
W,
|
|
779
|
+
z,
|
|
779
780
|
B,
|
|
780
|
-
V,
|
|
781
781
|
ee,
|
|
782
|
-
|
|
782
|
+
H,
|
|
783
783
|
w,
|
|
784
784
|
I,
|
|
785
|
-
|
|
785
|
+
re,
|
|
786
786
|
ne,
|
|
787
787
|
d,
|
|
788
788
|
m,
|
|
@@ -790,12 +790,12 @@ function tt({ children: e, scope: t = null }) {
|
|
|
790
790
|
v,
|
|
791
791
|
b,
|
|
792
792
|
S,
|
|
793
|
-
|
|
794
|
-
J,
|
|
793
|
+
G,
|
|
795
794
|
q,
|
|
796
|
-
|
|
795
|
+
K,
|
|
796
|
+
ae,
|
|
797
797
|
ye,
|
|
798
|
-
|
|
798
|
+
J,
|
|
799
799
|
se,
|
|
800
800
|
le,
|
|
801
801
|
ue,
|
|
@@ -1443,39 +1443,39 @@ function Wt(e, t = {}) {
|
|
|
1443
1443
|
T.current = w;
|
|
1444
1444
|
let E = j(null), D = j(!1), O = j(null), ee = j(null), k = j(null), te = () => {
|
|
1445
1445
|
k.current?.abort();
|
|
1446
|
-
}, N = C()?.registry ?? {}, [P, F] = M(void 0), I = j(void 0),
|
|
1446
|
+
}, N = C()?.registry ?? {}, [P, F] = M(void 0), I = j(void 0), z = (e, t) => {
|
|
1447
1447
|
if (!t) return !1;
|
|
1448
1448
|
if (!e) return !0;
|
|
1449
1449
|
let n = x(t);
|
|
1450
1450
|
return !!n && e.includes(n.provider);
|
|
1451
|
-
},
|
|
1452
|
-
|
|
1453
|
-
},
|
|
1454
|
-
let t =
|
|
1455
|
-
|
|
1456
|
-
let n =
|
|
1451
|
+
}, B = A(() => P ? Object.fromEntries(Object.entries(o).map(([e, t]) => [e, t.filter((e) => P.includes(e.provider))]).filter(([, e]) => e.length)) : o, [P, o]), V = z(P, c) ? c : Object.values(B).flat()[0]?.id ?? "", H = r && V ? x(V) : null, U = H ? N[H.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, ae = !W || !!W.canRewind, oe = !!W?.attachments, q = async (e) => oe && e?.length ? Promise.all(e.map((e) => _.fileToAttachment(e))) : void 0, J = j([]), Y = (e) => !!e && J.current.some((t) => t.value === e), se = j(!1), [ce, le] = M([]), [ue, de] = M(""), fe = j(""), pe = (e) => {
|
|
1452
|
+
fe.current = e, de(e);
|
|
1453
|
+
}, me = (e) => {
|
|
1454
|
+
let t = W?.models?.(e) ?? [];
|
|
1455
|
+
J.current = t, le(t);
|
|
1456
|
+
let n = W?.catalogProviders?.(e);
|
|
1457
1457
|
I.current = n, F(n);
|
|
1458
|
-
let r =
|
|
1459
|
-
|
|
1460
|
-
},
|
|
1461
|
-
let
|
|
1462
|
-
if (!
|
|
1463
|
-
let
|
|
1464
|
-
k.current =
|
|
1465
|
-
let
|
|
1458
|
+
let r = G && !z(n, c) ? t[0]?.value : void 0;
|
|
1459
|
+
pe(W?.defaultModel?.(e) ?? r ?? "");
|
|
1460
|
+
}, he = async (e, t, n, r, i) => {
|
|
1461
|
+
let a = E.current;
|
|
1462
|
+
if (!a || !W) return p(T.current.noActiveSession), null;
|
|
1463
|
+
let o = new AbortController();
|
|
1464
|
+
k.current = o;
|
|
1465
|
+
let s = crypto.randomUUID();
|
|
1466
1466
|
b((e) => [...e, {
|
|
1467
|
-
id:
|
|
1467
|
+
id: s,
|
|
1468
1468
|
kind: "thinking",
|
|
1469
1469
|
label: T.current.thinking,
|
|
1470
1470
|
status: "running",
|
|
1471
1471
|
parts: []
|
|
1472
1472
|
}]);
|
|
1473
|
-
let
|
|
1473
|
+
let c = /* @__PURE__ */ new Map(), l = (e) => Math.max(1, Math.round((Date.now() - (c.get(e) ?? Date.now())) / 1e3)), u = (e) => ({
|
|
1474
1474
|
...e,
|
|
1475
1475
|
streaming: !1,
|
|
1476
|
-
duration: e.duration ??
|
|
1477
|
-
}),
|
|
1478
|
-
if (n.id !==
|
|
1476
|
+
duration: e.duration ?? l(e.id)
|
|
1477
|
+
}), d = (e, t) => b((n) => n.map((n) => {
|
|
1478
|
+
if (n.id !== s) return n;
|
|
1479
1479
|
let r = e(n.parts ?? []), i = R(r);
|
|
1480
1480
|
return {
|
|
1481
1481
|
...n,
|
|
@@ -1483,110 +1483,111 @@ function Wt(e, t = {}) {
|
|
|
1483
1483
|
...t ? { status: t } : {},
|
|
1484
1484
|
...i ? { detail: i } : {}
|
|
1485
1485
|
};
|
|
1486
|
-
})),
|
|
1487
|
-
t?.id && t.id !== "text" && (
|
|
1486
|
+
})), f = (e) => d((t) => L(t, e, u)), m = !1, h = (e, t) => {
|
|
1487
|
+
t?.id && t.id !== "text" && (m = !0), f({
|
|
1488
1488
|
type: "text",
|
|
1489
1489
|
id: t?.id ?? "text",
|
|
1490
1490
|
text: e,
|
|
1491
1491
|
streaming: !t?.done
|
|
1492
1492
|
});
|
|
1493
|
-
},
|
|
1493
|
+
}, g = (e, t) => {
|
|
1494
1494
|
let n = t?.id ?? "reasoning";
|
|
1495
|
-
|
|
1495
|
+
c.has(n) || c.set(n, Date.now()), f({
|
|
1496
1496
|
type: "reasoning",
|
|
1497
1497
|
id: n,
|
|
1498
1498
|
text: e,
|
|
1499
1499
|
streaming: !t?.done,
|
|
1500
|
-
...t?.duration === void 0 ? t?.done ? { duration:
|
|
1500
|
+
...t?.duration === void 0 ? t?.done ? { duration: l(n) } : {} : { duration: t.duration }
|
|
1501
1501
|
});
|
|
1502
|
-
},
|
|
1502
|
+
}, _ = (e) => f({
|
|
1503
1503
|
type: "tool",
|
|
1504
1504
|
id: e.id,
|
|
1505
1505
|
label: e.label,
|
|
1506
1506
|
status: e.status
|
|
1507
|
-
}),
|
|
1507
|
+
}), v = (e) => f({
|
|
1508
1508
|
...e,
|
|
1509
1509
|
type: "card"
|
|
1510
|
-
}),
|
|
1511
|
-
for (let e of
|
|
1510
|
+
}), x = /* @__PURE__ */ new Set(), C = 0, w = () => {
|
|
1511
|
+
for (let e of x) {
|
|
1512
1512
|
let t = S.current.get(e);
|
|
1513
1513
|
S.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
|
|
1514
1514
|
}
|
|
1515
|
-
|
|
1515
|
+
x.clear();
|
|
1516
1516
|
};
|
|
1517
|
-
|
|
1518
|
-
let
|
|
1519
|
-
|
|
1520
|
-
let n = t?.id ?? `questions-${
|
|
1521
|
-
|
|
1517
|
+
o.signal.addEventListener("abort", w);
|
|
1518
|
+
let D = (e, t) => {
|
|
1519
|
+
C += 1;
|
|
1520
|
+
let n = t?.id ?? `questions-${C}`;
|
|
1521
|
+
f({
|
|
1522
1522
|
type: "questions",
|
|
1523
1523
|
id: n,
|
|
1524
1524
|
questions: e
|
|
1525
1525
|
});
|
|
1526
|
-
let r = `${
|
|
1527
|
-
return
|
|
1526
|
+
let r = `${s}:${n}`;
|
|
1527
|
+
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (x.add(r), new Promise((e, t) => {
|
|
1528
1528
|
S.current.set(r, {
|
|
1529
1529
|
resolve: e,
|
|
1530
1530
|
reject: t
|
|
1531
1531
|
});
|
|
1532
1532
|
}));
|
|
1533
|
-
},
|
|
1534
|
-
|
|
1533
|
+
}, te = (e, t) => {
|
|
1534
|
+
d((n) => (t && !m ? L(n, {
|
|
1535
1535
|
type: "text",
|
|
1536
1536
|
id: ne,
|
|
1537
1537
|
text: t,
|
|
1538
1538
|
streaming: !1
|
|
1539
|
-
},
|
|
1539
|
+
}, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
|
|
1540
1540
|
...t,
|
|
1541
1541
|
streaming: !1
|
|
1542
1542
|
} : t.type === "tool" && t.status === "running" && e !== "done" ? {
|
|
1543
1543
|
...t,
|
|
1544
1544
|
status: "stopped"
|
|
1545
|
-
} : t), e),
|
|
1546
|
-
for (let e of
|
|
1547
|
-
|
|
1548
|
-
},
|
|
1545
|
+
} : t), e), o.signal.removeEventListener("abort", w);
|
|
1546
|
+
for (let e of x) S.current.delete(e);
|
|
1547
|
+
x.clear();
|
|
1548
|
+
}, A = e || r?.historyText || "";
|
|
1549
1549
|
try {
|
|
1550
|
-
let
|
|
1550
|
+
let c = O.current;
|
|
1551
1551
|
O.current = null;
|
|
1552
|
-
let
|
|
1553
|
-
params:
|
|
1554
|
-
context:
|
|
1552
|
+
let l = y.current, u = l.findIndex((e) => e.id === ee.current), d = c ? { activity: c.fresh ? c.activity : (u >= 0 ? l.slice(0, u) : l).filter((e) => e.id !== s) } : void 0, f = await W.turn({
|
|
1553
|
+
params: a.params,
|
|
1554
|
+
context: a.context,
|
|
1555
1555
|
text: e,
|
|
1556
1556
|
first: t,
|
|
1557
|
-
signal:
|
|
1558
|
-
...
|
|
1559
|
-
...
|
|
1557
|
+
signal: o.signal,
|
|
1558
|
+
...d ? { rewound: d } : {},
|
|
1559
|
+
...i?.length ? { attachments: i } : {},
|
|
1560
|
+
...n || fe.current ? { model: n || fe.current } : {},
|
|
1560
1561
|
...r ? { answers: {
|
|
1561
1562
|
id: r.id,
|
|
1562
1563
|
answers: r.answers
|
|
1563
1564
|
} } : {},
|
|
1564
|
-
onText:
|
|
1565
|
-
onReasoning:
|
|
1566
|
-
onStep:
|
|
1567
|
-
onQuestions:
|
|
1568
|
-
onCard:
|
|
1565
|
+
onText: h,
|
|
1566
|
+
onReasoning: g,
|
|
1567
|
+
onStep: _,
|
|
1568
|
+
onQuestions: D,
|
|
1569
|
+
onCard: v
|
|
1569
1570
|
});
|
|
1570
|
-
return
|
|
1571
|
-
...
|
|
1572
|
-
...
|
|
1571
|
+
return te("done", f.text), a.history = [
|
|
1572
|
+
...a.history,
|
|
1573
|
+
...A ? [{
|
|
1573
1574
|
role: "user",
|
|
1574
|
-
content:
|
|
1575
|
+
content: A
|
|
1575
1576
|
}] : [],
|
|
1576
1577
|
{
|
|
1577
1578
|
role: "assistant",
|
|
1578
|
-
content:
|
|
1579
|
+
content: f.text
|
|
1579
1580
|
}
|
|
1580
|
-
],
|
|
1581
|
+
], f.result ?? null;
|
|
1581
1582
|
} catch (e) {
|
|
1582
|
-
return
|
|
1583
|
+
return a.history = [...a.history, ...A ? [{
|
|
1583
1584
|
role: "user",
|
|
1584
|
-
content:
|
|
1585
|
-
}] : []],
|
|
1585
|
+
content: A
|
|
1586
|
+
}] : []], o.signal.aborted ? (te("stopped"), null) : (te("error"), p(Z(e)), null);
|
|
1586
1587
|
} finally {
|
|
1587
1588
|
k.current = null;
|
|
1588
1589
|
}
|
|
1589
|
-
},
|
|
1590
|
+
}, _e = async (t, n, r) => {
|
|
1590
1591
|
let i = y.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = E.current;
|
|
1591
1592
|
if (!i || !a || !e.onCardAction) return;
|
|
1592
1593
|
let o;
|
|
@@ -1605,7 +1606,7 @@ function Wt(e, t = {}) {
|
|
|
1605
1606
|
outcome: o
|
|
1606
1607
|
} : e)
|
|
1607
1608
|
} : e));
|
|
1608
|
-
},
|
|
1609
|
+
}, ve = async (e, t, n) => {
|
|
1609
1610
|
let r = y.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1610
1611
|
if (!r || r.type !== "questions") throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1611
1612
|
let i = () => b((r) => r.map((r) => r.id === e ? {
|
|
@@ -1617,27 +1618,27 @@ function Wt(e, t = {}) {
|
|
|
1617
1618
|
} : r)), a = `${e}:${t}`, o = S.current.get(a);
|
|
1618
1619
|
if (o) return S.current.delete(a), i(), o.resolve(n), null;
|
|
1619
1620
|
if (D.current) throw p(T.current.requestInProgress), Error(T.current.requestInProgress);
|
|
1620
|
-
if (!
|
|
1621
|
+
if (!K || !E.current) throw p(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1621
1622
|
D.current = !0, d(!0), p(null), i();
|
|
1622
1623
|
try {
|
|
1623
|
-
return await
|
|
1624
|
+
return await he("", !1, void 0, {
|
|
1624
1625
|
id: t,
|
|
1625
1626
|
answers: n,
|
|
1626
|
-
historyText:
|
|
1627
|
+
historyText: re(r.questions, n)
|
|
1627
1628
|
});
|
|
1628
1629
|
} finally {
|
|
1629
1630
|
D.current = !1, d(!1);
|
|
1630
1631
|
}
|
|
1631
|
-
},
|
|
1632
|
-
let i = I.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r &&
|
|
1632
|
+
}, ye = async (t, n, r) => {
|
|
1633
|
+
let i = I.current, a = Object.values(o).flat().find((e) => !i || i.includes(e.provider))?.id, s = r && z(i, r) ? r : z(i, V) ? void 0 : a, c = s ? x(s) : H, l = c && E.current ? W?.catalogReasoning?.(E.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = E.current;
|
|
1633
1634
|
if (!d) return p(T.current.noActiveSession), null;
|
|
1634
|
-
let f = s ? x(s) :
|
|
1635
|
+
let f = s ? x(s) : H, m = f ? N[f.provider] : null;
|
|
1635
1636
|
if (!m || !f) return p(T.current.noProviderAvailable), null;
|
|
1636
1637
|
n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
|
|
1637
1638
|
let h = (n ?? []).filter((e) => _.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Vt ? `\n\n[File allegato: ${e.name}]\n${_.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(""), g = Ht(n ?? []), v = d.tools.map((e) => ({
|
|
1638
1639
|
name: e.name,
|
|
1639
1640
|
description: e.description,
|
|
1640
|
-
inputSchema:
|
|
1641
|
+
inputSchema: ie(e.inputSchema)
|
|
1641
1642
|
})), y = (e, t, n, r) => {
|
|
1642
1643
|
let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
|
|
1643
1644
|
b((e) => [...e, {
|
|
@@ -1852,7 +1853,7 @@ function Wt(e, t = {}) {
|
|
|
1852
1853
|
} finally {
|
|
1853
1854
|
k.current = null;
|
|
1854
1855
|
}
|
|
1855
|
-
},
|
|
1856
|
+
}, be = async (t, n) => {
|
|
1856
1857
|
if (D.current) return p(T.current.requestInProgress), null;
|
|
1857
1858
|
D.current = !0, p(null), b(n?.openingMessage ? [{
|
|
1858
1859
|
id: crypto.randomUUID(),
|
|
@@ -1871,13 +1872,13 @@ function Wt(e, t = {}) {
|
|
|
1871
1872
|
history: [],
|
|
1872
1873
|
logId: crypto.randomUUID(),
|
|
1873
1874
|
attachmentsRef: a
|
|
1874
|
-
},
|
|
1875
|
-
if (
|
|
1876
|
-
|
|
1877
|
-
let e = n?.model ||
|
|
1878
|
-
if (
|
|
1875
|
+
}, K) return h(!0), me(t), await he(n?.openingMessage ?? "", !0, void 0, void 0, await q(n?.attachments));
|
|
1876
|
+
if (G) {
|
|
1877
|
+
me(t), se.current = !1;
|
|
1878
|
+
let e = n?.model || fe.current;
|
|
1879
|
+
if (Y(e)) return h(!0), se.current = !0, await he(n?.openingMessage ?? "", !0, e, void 0, await q(n?.attachments));
|
|
1879
1880
|
}
|
|
1880
|
-
let s = n?.model || void 0, c = s ? !!N[x(s)?.provider ?? ""] : !!
|
|
1881
|
+
let s = n?.model || void 0, c = s ? !!N[x(s)?.provider ?? ""] : !!U;
|
|
1881
1882
|
if (!r || !c) {
|
|
1882
1883
|
h(!1);
|
|
1883
1884
|
let n = e.fallback(t, i);
|
|
@@ -1890,13 +1891,13 @@ function Wt(e, t = {}) {
|
|
|
1890
1891
|
}
|
|
1891
1892
|
h(!0);
|
|
1892
1893
|
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => _.fileToAttachment(e))) : void 0, u = ge(e.buildPrompt(t, i), e.microPromptIds);
|
|
1893
|
-
return await
|
|
1894
|
+
return await ye(u, l, s);
|
|
1894
1895
|
} catch (e) {
|
|
1895
1896
|
return p(Z(e)), null;
|
|
1896
1897
|
} finally {
|
|
1897
1898
|
D.current = !1, d(!1);
|
|
1898
1899
|
}
|
|
1899
|
-
},
|
|
1900
|
+
}, xe = async (t, n) => {
|
|
1900
1901
|
if (D.current) {
|
|
1901
1902
|
p(T.current.requestInProgress);
|
|
1902
1903
|
return;
|
|
@@ -1911,13 +1912,13 @@ function Wt(e, t = {}) {
|
|
|
1911
1912
|
history: n.history,
|
|
1912
1913
|
logId: crypto.randomUUID(),
|
|
1913
1914
|
attachmentsRef: a
|
|
1914
|
-
}, (
|
|
1915
|
+
}, (K || G) && me(t), se.current = !1, h(K || G || r && !!U);
|
|
1915
1916
|
} catch (e) {
|
|
1916
1917
|
p(Z(e));
|
|
1917
1918
|
} finally {
|
|
1918
1919
|
D.current = !1, d(!1);
|
|
1919
1920
|
}
|
|
1920
|
-
},
|
|
1921
|
+
}, Se = async (t, n) => {
|
|
1921
1922
|
if (D.current) return p(T.current.requestInProgress), null;
|
|
1922
1923
|
if (p(null), !t.trim()) return p("Messaggio vuoto."), null;
|
|
1923
1924
|
let r = E.current;
|
|
@@ -1935,26 +1936,26 @@ function Wt(e, t = {}) {
|
|
|
1935
1936
|
historyAt: r.history.length
|
|
1936
1937
|
}]);
|
|
1937
1938
|
try {
|
|
1938
|
-
if (
|
|
1939
|
-
let i = n?.model || (
|
|
1940
|
-
if (
|
|
1941
|
-
let e = !
|
|
1942
|
-
return
|
|
1939
|
+
if (K) return await he(t, !1, n?.model || void 0, void 0, await q(n?.attachments));
|
|
1940
|
+
let i = n?.model || (G ? fe.current : "");
|
|
1941
|
+
if (G && Y(i)) {
|
|
1942
|
+
let e = !se.current;
|
|
1943
|
+
return se.current = !0, await he(t, e, i, void 0, await q(n?.attachments));
|
|
1943
1944
|
}
|
|
1944
1945
|
O.current &&= {
|
|
1945
1946
|
...O.current,
|
|
1946
1947
|
fresh: !1
|
|
1947
1948
|
};
|
|
1948
1949
|
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => _.fileToAttachment(e))) : void 0, o = ge(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
|
|
1949
|
-
return await
|
|
1950
|
+
return await ye(o, a, n?.model || void 0);
|
|
1950
1951
|
} catch (e) {
|
|
1951
1952
|
return p(Z(e)), null;
|
|
1952
1953
|
} finally {
|
|
1953
1954
|
D.current = !1, d(!1);
|
|
1954
1955
|
}
|
|
1955
|
-
},
|
|
1956
|
+
}, Ce = (e) => {
|
|
1956
1957
|
let t = E.current, n = g.findIndex((t) => t.id === e), r = g[n], i = r?.detail?.trim();
|
|
1957
|
-
if (!
|
|
1958
|
+
if (!ae || !t || !r || r.kind !== "user" || !i) return;
|
|
1958
1959
|
if (r.historyAt !== void 0) return r.historyAt;
|
|
1959
1960
|
let a = g.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
|
|
1960
1961
|
for (let e = 0; e < t.history.length; e += 1) {
|
|
@@ -1965,9 +1966,9 @@ function Wt(e, t = {}) {
|
|
|
1965
1966
|
}
|
|
1966
1967
|
}
|
|
1967
1968
|
return n === g.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
|
|
1968
|
-
},
|
|
1969
|
+
}, we = (e) => Ce(e) !== void 0, Te = async (e, t) => {
|
|
1969
1970
|
if (D.current) return p(T.current.requestInProgress), null;
|
|
1970
|
-
let n = E.current, r = g.findIndex((t) => t.id === e), i = g[r], a =
|
|
1971
|
+
let n = E.current, r = g.findIndex((t) => t.id === e), i = g[r], a = Ce(e);
|
|
1971
1972
|
if (!n || !i || a === void 0) return null;
|
|
1972
1973
|
let o = (t ?? i.detail ?? "").trim();
|
|
1973
1974
|
if (!o) return null;
|
|
@@ -1975,8 +1976,8 @@ function Wt(e, t = {}) {
|
|
|
1975
1976
|
return n.history = n.history.slice(0, a), O.current = {
|
|
1976
1977
|
activity: s,
|
|
1977
1978
|
fresh: !0
|
|
1978
|
-
}, b(s),
|
|
1979
|
-
},
|
|
1979
|
+
}, b(s), Se(o);
|
|
1980
|
+
}, Ee = () => {
|
|
1980
1981
|
let t = E.current;
|
|
1981
1982
|
if (!t) return null;
|
|
1982
1983
|
p(null);
|
|
@@ -1987,7 +1988,7 @@ function Wt(e, t = {}) {
|
|
|
1987
1988
|
status: "done",
|
|
1988
1989
|
label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
|
|
1989
1990
|
}]), n;
|
|
1990
|
-
},
|
|
1991
|
+
}, De = () => E.current ? {
|
|
1991
1992
|
history: E.current.history,
|
|
1992
1993
|
activity: g
|
|
1993
1994
|
} : null;
|
|
@@ -1995,31 +1996,32 @@ function Wt(e, t = {}) {
|
|
|
1995
1996
|
enabled: r,
|
|
1996
1997
|
setEnabled: i,
|
|
1997
1998
|
hasProviders: a,
|
|
1998
|
-
selectedModel:
|
|
1999
|
-
setSelectedModel:
|
|
2000
|
-
|
|
1999
|
+
selectedModel: K || G && ue ? ue : V,
|
|
2000
|
+
setSelectedModel: K ? pe : G ? (e) => {
|
|
2001
|
+
Y(e) ? pe(e) : (pe(""), l(e));
|
|
2001
2002
|
} : l,
|
|
2002
|
-
modelsByProvider:
|
|
2003
|
+
modelsByProvider: B,
|
|
2003
2004
|
modelsLoading: s,
|
|
2004
2005
|
running: u,
|
|
2005
2006
|
error: f,
|
|
2006
2007
|
canContinue: m,
|
|
2007
|
-
remote:
|
|
2008
|
-
remoteModels:
|
|
2009
|
-
alongside:
|
|
2010
|
-
...
|
|
2008
|
+
remote: K,
|
|
2009
|
+
remoteModels: ce,
|
|
2010
|
+
alongside: G,
|
|
2011
|
+
...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
|
|
2011
2012
|
activity: g,
|
|
2012
|
-
run:
|
|
2013
|
-
resume:
|
|
2014
|
-
sendMessage:
|
|
2013
|
+
run: be,
|
|
2014
|
+
resume: xe,
|
|
2015
|
+
sendMessage: Se,
|
|
2015
2016
|
stop: te,
|
|
2016
|
-
runFallback:
|
|
2017
|
-
snapshot:
|
|
2018
|
-
answerQuestions:
|
|
2019
|
-
cardAction:
|
|
2020
|
-
rewind:
|
|
2021
|
-
canRewind:
|
|
2022
|
-
rewindable:
|
|
2017
|
+
runFallback: Ee,
|
|
2018
|
+
snapshot: De,
|
|
2019
|
+
answerQuestions: ve,
|
|
2020
|
+
cardAction: _e,
|
|
2021
|
+
rewind: Te,
|
|
2022
|
+
canRewind: ae,
|
|
2023
|
+
rewindable: we,
|
|
2024
|
+
executorAttachments: oe,
|
|
2023
2025
|
offersFallback: e.offersFallback !== !1
|
|
2024
2026
|
};
|
|
2025
2027
|
}
|
|
@@ -2053,7 +2055,7 @@ function qt(e, t) {
|
|
|
2053
2055
|
//#endregion
|
|
2054
2056
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
2055
2057
|
function Jt(e) {
|
|
2056
|
-
return
|
|
2058
|
+
return H().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
2057
2059
|
}
|
|
2058
2060
|
function Yt(e) {
|
|
2059
2061
|
return {
|
|
@@ -2084,11 +2086,11 @@ function Yt(e) {
|
|
|
2084
2086
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
2085
2087
|
},
|
|
2086
2088
|
getTools(t, n, r) {
|
|
2087
|
-
let i =
|
|
2089
|
+
let i = K({
|
|
2088
2090
|
attachmentsRef: r,
|
|
2089
2091
|
collected: n.collected,
|
|
2090
2092
|
proxyFetch: S
|
|
2091
|
-
}), a = t.scopedSubagentId ?
|
|
2093
|
+
}), a = t.scopedSubagentId ? U(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Jt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
2092
2094
|
name: `${t.id}_${r.name}`,
|
|
2093
2095
|
description: `${t.label}: ${r.summary}`,
|
|
2094
2096
|
inputSchema: r.inputSchema,
|
|
@@ -2248,7 +2250,7 @@ function dn(e) {
|
|
|
2248
2250
|
};
|
|
2249
2251
|
let a = j(/* @__PURE__ */ new Set()), o = O(async (t, n, r) => {
|
|
2250
2252
|
if (!e) return !1;
|
|
2251
|
-
let o = ze(e, t, n), s =
|
|
2253
|
+
let o = ze(e, t, n), s = U(t), c = `${e}:${t}:${n}`;
|
|
2252
2254
|
if (!o || !s?.autoTitle || o.name || !Ge(o) || a.current.has(c)) return !1;
|
|
2253
2255
|
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = un(s, o.params, r ?? d, u, l), p = f ? x(f) : null;
|
|
2254
2256
|
if (!p) return !1;
|
|
@@ -2269,7 +2271,7 @@ function dn(e) {
|
|
|
2269
2271
|
return k(() => {
|
|
2270
2272
|
e && s && !fn.has(e) && (fn.add(e), (async () => {
|
|
2271
2273
|
for (let t of Xe(e)) {
|
|
2272
|
-
let n =
|
|
2274
|
+
let n = U(t.subagentId);
|
|
2273
2275
|
if (n?.autoTitle) {
|
|
2274
2276
|
if (n.definition.conversational && !Ge(t)) {
|
|
2275
2277
|
Ye(e, t.subagentId, t.entityId);
|
|
@@ -2293,7 +2295,7 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2293
2295
|
p && p !== D.current && (D.current = p, T.current = (r?.length ?? 0) + c.activity.length);
|
|
2294
2296
|
let O = j(!1), ee = c.remote || !c.hasProviders || c.selectedModel !== "";
|
|
2295
2297
|
k(() => {
|
|
2296
|
-
!w.current && ee && (w.current = !0, a ? (
|
|
2298
|
+
!w.current && ee && (w.current = !0, a ? (H.current = !0, c.resume(e.toParams(t), a)) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
|
|
2297
2299
|
model: o,
|
|
2298
2300
|
openingMessage: s
|
|
2299
2301
|
}).then((e) => {
|
|
@@ -2336,12 +2338,12 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2336
2338
|
L,
|
|
2337
2339
|
t,
|
|
2338
2340
|
f
|
|
2339
|
-
]),
|
|
2341
|
+
]), re = A(() => R ? [R, ...n ?? []] : n, [R, n]), z = e.chatEntityId?.(t), B = dn(u?.id), V = j(!1), H = j(!1);
|
|
2340
2342
|
k(() => {
|
|
2341
|
-
let n = !
|
|
2342
|
-
if (
|
|
2343
|
-
if (
|
|
2344
|
-
i && (
|
|
2343
|
+
let n = !V.current && c.running, i = V.current && !c.running;
|
|
2344
|
+
if (V.current = c.running, !n && !i || !z || !u) return;
|
|
2345
|
+
if (H.current) {
|
|
2346
|
+
i && (H.current = !1);
|
|
2345
2347
|
return;
|
|
2346
2348
|
}
|
|
2347
2349
|
let a = c.snapshot();
|
|
@@ -2350,21 +2352,21 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2350
2352
|
e.autoTitle && e.definition.conversational && !Ge({ activity: o }) || (Be({
|
|
2351
2353
|
scopeId: u.id,
|
|
2352
2354
|
subagentId: e.id,
|
|
2353
|
-
entityId:
|
|
2355
|
+
entityId: z,
|
|
2354
2356
|
params: t,
|
|
2355
2357
|
title: Xt(e, t),
|
|
2356
2358
|
history: a.history,
|
|
2357
2359
|
activity: o
|
|
2358
|
-
}), i && e.autoTitle &&
|
|
2360
|
+
}), i && e.autoTitle && B(e.id, z, c.selectedModel));
|
|
2359
2361
|
}, [c.running]);
|
|
2360
|
-
let
|
|
2362
|
+
let U = () => {
|
|
2361
2363
|
O.current = !0, c.running && c.stop(), l.closeTask(f);
|
|
2362
|
-
},
|
|
2364
|
+
}, W = j(on(e.id) ?? pn).current, G = W({
|
|
2363
2365
|
params: t,
|
|
2364
2366
|
taskId: f,
|
|
2365
2367
|
running: c.running,
|
|
2366
|
-
close:
|
|
2367
|
-
}),
|
|
2368
|
+
close: U
|
|
2369
|
+
}), K = (e) => {
|
|
2368
2370
|
_((t) => t.includes(e) ? t : [...t, e]);
|
|
2369
2371
|
};
|
|
2370
2372
|
return k(() => {
|
|
@@ -2376,11 +2378,11 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2376
2378
|
onApplied: (e) => h(e),
|
|
2377
2379
|
precedingActivity: r,
|
|
2378
2380
|
panelExtraAnchorIndex: T.current,
|
|
2379
|
-
onDismiss:
|
|
2380
|
-
...
|
|
2381
|
-
panelActions:
|
|
2382
|
-
composerActions:
|
|
2383
|
-
composerCommands:
|
|
2381
|
+
onDismiss: U,
|
|
2382
|
+
...z ? { savedToDisk: !0 } : {},
|
|
2383
|
+
panelActions: G.content,
|
|
2384
|
+
composerActions: G.actions,
|
|
2385
|
+
composerCommands: G.commands,
|
|
2384
2386
|
panelExtra: p ? /* @__PURE__ */ F(N, { children: [
|
|
2385
2387
|
x && S ? /* @__PURE__ */ P(x.Report, {
|
|
2386
2388
|
result: p,
|
|
@@ -2400,8 +2402,8 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2400
2402
|
meta: t,
|
|
2401
2403
|
taskId: f,
|
|
2402
2404
|
initiallyApplied: g,
|
|
2403
|
-
onApplied:
|
|
2404
|
-
extraDestinations:
|
|
2405
|
+
onApplied: K,
|
|
2406
|
+
extraDestinations: re
|
|
2405
2407
|
})
|
|
2406
2408
|
] }) : void 0
|
|
2407
2409
|
});
|
|
@@ -2426,9 +2428,9 @@ function mn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2426
2428
|
n,
|
|
2427
2429
|
r,
|
|
2428
2430
|
v,
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2431
|
+
G.content,
|
|
2432
|
+
G.actions,
|
|
2433
|
+
G.commands
|
|
2432
2434
|
]), k(() => () => {
|
|
2433
2435
|
l.closeTask(f);
|
|
2434
2436
|
}, [l.closeTask, f]), null;
|
|
@@ -2483,7 +2485,7 @@ function hn({ userGoal: e }) {
|
|
|
2483
2485
|
}, [r.closeTask]);
|
|
2484
2486
|
let h = A(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
|
|
2485
2487
|
if (!i) return null;
|
|
2486
|
-
let g =
|
|
2488
|
+
let g = U(i.subagentId);
|
|
2487
2489
|
return g ? /* @__PURE__ */ P(mn, {
|
|
2488
2490
|
manifest: g,
|
|
2489
2491
|
params: i.params,
|
|
@@ -2652,7 +2654,7 @@ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
2652
2654
|
onStop: l.stop,
|
|
2653
2655
|
disabled: !o.trim() || _,
|
|
2654
2656
|
onSubmit: m,
|
|
2655
|
-
attachments: !d &&
|
|
2657
|
+
attachments: !d && (l.remote || g ? l.executorAttachments : !0),
|
|
2656
2658
|
models: v,
|
|
2657
2659
|
selectedModel: h ? "" : l.selectedModel,
|
|
2658
2660
|
actions: e.composerActions,
|
|
@@ -2793,7 +2795,7 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2793
2795
|
r,
|
|
2794
2796
|
h
|
|
2795
2797
|
]), [v, y] = M(null), b = async (t) => {
|
|
2796
|
-
let r =
|
|
2798
|
+
let r = U(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
2797
2799
|
if (!i || window.confirm(i)) {
|
|
2798
2800
|
try {
|
|
2799
2801
|
await r?.onArchive?.(t.entityId, t.params);
|
|
@@ -2805,7 +2807,7 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2805
2807
|
}, x = A(() => {
|
|
2806
2808
|
let e = p.trim().toLowerCase();
|
|
2807
2809
|
return e ? _.filter((t) => {
|
|
2808
|
-
let n =
|
|
2810
|
+
let n = U(t.subagentId)?.label ?? t.subagentId;
|
|
2809
2811
|
return We(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
2810
2812
|
}) : _;
|
|
2811
2813
|
}, [_, p]);
|
|
@@ -2849,7 +2851,7 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2849
2851
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
2850
2852
|
children: _.length === 0 ? c.noSavedChats : c.noResults
|
|
2851
2853
|
}) : x.map((e) => {
|
|
2852
|
-
let t =
|
|
2854
|
+
let t = U(e.subagentId), r = n === Ze(e.subagentId, e.entityId);
|
|
2853
2855
|
return /* @__PURE__ */ P(u, {
|
|
2854
2856
|
icon: r ? "check" : t?.icon ?? "bot",
|
|
2855
2857
|
className: r ? "bg-accent font-semibold text-primary" : void 0,
|
|
@@ -2896,32 +2898,32 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2896
2898
|
onWidthChange: i
|
|
2897
2899
|
}), R = () => {
|
|
2898
2900
|
(!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(), ee(!1));
|
|
2899
|
-
},
|
|
2901
|
+
}, re = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], z = re.length, B = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? z, z)), V = re.slice(0, B), H = re.slice(B), W = !!(a && !a.agent.running && a.agent.error), G = (e, t) => {
|
|
2900
2902
|
a && (A(null), a.agent.rewind(e.id, t).then((e) => {
|
|
2901
2903
|
e && a.onApplied(e);
|
|
2902
2904
|
}));
|
|
2903
|
-
},
|
|
2905
|
+
}, K = (e) => {
|
|
2904
2906
|
let t = a?.agent.activity ?? [], n = t.slice(t.findIndex((t) => t.id === e.id) + 1).flatMap((e) => [...e.kind === "tool" && e.status === "done" ? [e.label] : [], ...(e.parts ?? []).flatMap((e) => e.type === "tool" && e.status === "done" ? [e.label] : [])]);
|
|
2905
2907
|
return [...new Set(n.filter(Boolean))];
|
|
2906
|
-
},
|
|
2907
|
-
let n =
|
|
2908
|
+
}, ie = (e, t) => {
|
|
2909
|
+
let n = K(e);
|
|
2908
2910
|
n.length ? I({
|
|
2909
2911
|
entry: e,
|
|
2910
2912
|
steps: n,
|
|
2911
2913
|
...t === void 0 ? {} : { text: t }
|
|
2912
|
-
}) :
|
|
2913
|
-
},
|
|
2914
|
+
}) : G(e, t);
|
|
2915
|
+
}, ae = a ? {
|
|
2914
2916
|
available: (e) => a.agent.activity.some((t) => t.id === e.id) && a.agent.rewindable(e.id),
|
|
2915
2917
|
disabled: a.agent.running,
|
|
2916
|
-
onRetry: (e) =>
|
|
2918
|
+
onRetry: (e) => ie(e),
|
|
2917
2919
|
onEdit: (e) => A(e)
|
|
2918
|
-
} : void 0,
|
|
2919
|
-
canAnswer: (e) =>
|
|
2920
|
+
} : void 0, oe = new Set(a?.agent.activity.map((e) => e.id) ?? []), q = a ? {
|
|
2921
|
+
canAnswer: (e) => oe.has(e),
|
|
2920
2922
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
2921
2923
|
e && a.onApplied(e);
|
|
2922
2924
|
}),
|
|
2923
2925
|
onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
|
|
2924
|
-
} : void 0,
|
|
2926
|
+
} : void 0, J = q ? gt(re, q.canAnswer) : null, Y = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? U(a.scopedSubagentId) : void 0, se = Y?.manualEntry ? Y : null, X = j(!0);
|
|
2925
2927
|
k(() => {
|
|
2926
2928
|
let e = D.current;
|
|
2927
2929
|
if (!e) return;
|
|
@@ -2933,13 +2935,13 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2933
2935
|
let e = D.current;
|
|
2934
2936
|
e && (X.current = !0, e.scrollTop = e.scrollHeight);
|
|
2935
2937
|
}, [a?.id]);
|
|
2936
|
-
let ce =
|
|
2938
|
+
let ce = re.at(-1)?.detail?.length ?? 0;
|
|
2937
2939
|
k(() => {
|
|
2938
2940
|
let e = D.current;
|
|
2939
2941
|
e && X.current && (e.scrollTop = e.scrollHeight);
|
|
2940
2942
|
}, [
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
+
z,
|
|
2944
|
+
W,
|
|
2943
2945
|
ce
|
|
2944
2946
|
]);
|
|
2945
2947
|
let le = j(null);
|
|
@@ -2951,7 +2953,7 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2951
2953
|
});
|
|
2952
2954
|
return n.observe(t), () => n.disconnect();
|
|
2953
2955
|
}, [a?.id, o]);
|
|
2954
|
-
let ue = s ? /* @__PURE__ */ P(hn, { userGoal: s }, c) : null, de = f ?
|
|
2956
|
+
let ue = s ? /* @__PURE__ */ P(hn, { userGoal: s }, c) : null, de = f ? U(f.subagentId) : void 0, fe = f && de ? /* @__PURE__ */ P(mn, {
|
|
2955
2957
|
manifest: de,
|
|
2956
2958
|
params: f.snapshot.params,
|
|
2957
2959
|
taskId: Ze(f.subagentId, f.entityId),
|
|
@@ -2959,14 +2961,14 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
2959
2961
|
history: f.snapshot.history,
|
|
2960
2962
|
activity: f.snapshot.activity
|
|
2961
2963
|
}
|
|
2962
|
-
}, p) : null, pe = _ ?
|
|
2964
|
+
}, p) : null, pe = _ ? U(_.subagentId) : void 0, me = _ && pe ? /* @__PURE__ */ P(gn, {
|
|
2963
2965
|
manifest: pe,
|
|
2964
2966
|
extraDestinations: _.extraDestinations
|
|
2965
|
-
}, v) : null, he = x ?
|
|
2967
|
+
}, v) : null, he = x ? U(x.subagentId) : void 0, ge = x && he ? /* @__PURE__ */ P(mn, {
|
|
2966
2968
|
manifest: he,
|
|
2967
2969
|
params: x.params,
|
|
2968
2970
|
extraDestinations: x.extraDestinations
|
|
2969
|
-
}, S) : null, Z = C ?
|
|
2971
|
+
}, S) : null, Z = C ? U(C.subagentId) : void 0, _e = C && Z ? /* @__PURE__ */ P(mn, {
|
|
2970
2972
|
manifest: Z,
|
|
2971
2973
|
params: C.params,
|
|
2972
2974
|
taskId: C.taskId,
|
|
@@ -3011,32 +3013,32 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3011
3013
|
}),
|
|
3012
3014
|
/* @__PURE__ */ P("div", {
|
|
3013
3015
|
ref: D,
|
|
3014
|
-
className: `flex-1 overflow-y-auto px-3 pb-2 ${
|
|
3016
|
+
className: `flex-1 overflow-y-auto px-3 pb-2 ${J ? "min-h-24" : "min-h-0"}`,
|
|
3015
3017
|
children: /* @__PURE__ */ P("div", {
|
|
3016
3018
|
ref: le,
|
|
3017
3019
|
className: "pt-2",
|
|
3018
3020
|
children: a ? /* @__PURE__ */ F(N, { children: [
|
|
3019
|
-
a.manualEntry &&
|
|
3021
|
+
a.manualEntry && re.length === 0 && /* @__PURE__ */ P("p", {
|
|
3020
3022
|
className: "text-xs text-muted-foreground",
|
|
3021
3023
|
children: a.manualEntry.prompt
|
|
3022
3024
|
}),
|
|
3023
3025
|
/* @__PURE__ */ P(bt, {
|
|
3024
|
-
activity:
|
|
3025
|
-
questions:
|
|
3026
|
-
docked:
|
|
3027
|
-
pinUserMessages: !
|
|
3028
|
-
messageActions:
|
|
3026
|
+
activity: V,
|
|
3027
|
+
questions: q,
|
|
3028
|
+
docked: J,
|
|
3029
|
+
pinUserMessages: !J,
|
|
3030
|
+
messageActions: ae
|
|
3029
3031
|
}),
|
|
3030
3032
|
a.panelExtra && /* @__PURE__ */ P("div", {
|
|
3031
3033
|
className: "mt-3",
|
|
3032
3034
|
children: a.panelExtra
|
|
3033
3035
|
}),
|
|
3034
|
-
|
|
3035
|
-
activity:
|
|
3036
|
-
questions:
|
|
3037
|
-
docked:
|
|
3038
|
-
pinUserMessages: !
|
|
3039
|
-
messageActions:
|
|
3036
|
+
H.length > 0 && /* @__PURE__ */ P(bt, {
|
|
3037
|
+
activity: H,
|
|
3038
|
+
questions: q,
|
|
3039
|
+
docked: J,
|
|
3040
|
+
pinUserMessages: !J,
|
|
3041
|
+
messageActions: ae
|
|
3040
3042
|
}),
|
|
3041
3043
|
!a.agent.running && a.agent.error && /* @__PURE__ */ F("div", {
|
|
3042
3044
|
className: "mt-2 flex items-center gap-2",
|
|
@@ -3052,7 +3054,7 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3052
3054
|
onClick: () => {
|
|
3053
3055
|
let e = [...a.agent.activity].reverse().find((e) => e.kind === "user");
|
|
3054
3056
|
if (e && a.agent.rewindable(e.id)) {
|
|
3055
|
-
|
|
3057
|
+
ie(e);
|
|
3056
3058
|
return;
|
|
3057
3059
|
}
|
|
3058
3060
|
a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
|
|
@@ -3081,7 +3083,7 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3081
3083
|
})
|
|
3082
3084
|
})
|
|
3083
3085
|
}),
|
|
3084
|
-
a &&
|
|
3086
|
+
a && J ? /* @__PURE__ */ F("section", {
|
|
3085
3087
|
"aria-label": E.pendingQuestions,
|
|
3086
3088
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
3087
3089
|
children: [
|
|
@@ -3092,11 +3094,11 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3092
3094
|
/* @__PURE__ */ P("div", {
|
|
3093
3095
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
3094
3096
|
children: /* @__PURE__ */ P(_t, {
|
|
3095
|
-
entry:
|
|
3096
|
-
part:
|
|
3097
|
-
questions:
|
|
3097
|
+
entry: J.entry,
|
|
3098
|
+
part: J.part,
|
|
3099
|
+
questions: q,
|
|
3098
3100
|
autoFocus: !0
|
|
3099
|
-
}, `${
|
|
3101
|
+
}, `${J.entry.id}:${J.part.id}`)
|
|
3100
3102
|
}),
|
|
3101
3103
|
a.agent.running && /* @__PURE__ */ P("div", {
|
|
3102
3104
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
@@ -3117,13 +3119,13 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3117
3119
|
task: a,
|
|
3118
3120
|
editing: te,
|
|
3119
3121
|
onCancelEdit: () => A(null),
|
|
3120
|
-
onSendEdit: (e, t) =>
|
|
3122
|
+
onSendEdit: (e, t) => ie(e, t)
|
|
3121
3123
|
}, a.id) : /* @__PURE__ */ P(yn, {})]
|
|
3122
3124
|
}),
|
|
3123
3125
|
ne && /* @__PURE__ */ F(g, {
|
|
3124
3126
|
title: E.rewindTitle,
|
|
3125
3127
|
onClose: () => I(null),
|
|
3126
|
-
onYes: async () => (
|
|
3128
|
+
onYes: async () => (G(ne.entry, ne.text), !0),
|
|
3127
3129
|
children: [/* @__PURE__ */ P("p", {
|
|
3128
3130
|
className: "text-sm",
|
|
3129
3131
|
children: E.rewindText
|
|
@@ -3169,6 +3171,6 @@ function Dn(e, t, n, r, i = !0, a) {
|
|
|
3169
3171
|
]);
|
|
3170
3172
|
}
|
|
3171
3173
|
//#endregion
|
|
3172
|
-
export { Ct as AGENTICO_MAX_WIDTH, St as AGENTICO_MIN_WIDTH, xt as AGENTICO_WIDTH, wt as AGENTICO_WIDTH_STORAGE_KEY, Tn as Agentico, tt as AgenticoProvider, Mt as AgenticoToggle, I as DEFAULT_REASONING_PART_ID, ne as DEFAULT_TEXT_PART_ID, ye as JSON_EXPORT_DESTINATION_ID, he as MICRO_PROMPT_REGISTRY, $e as ORCHESTRATOR_TASK_ID, me as SUMMARY_MICRO_PROMPT, Ee as agenticoDe, we as agenticoEn, Te as agenticoIt,
|
|
3174
|
+
export { Ct as AGENTICO_MAX_WIDTH, St as AGENTICO_MIN_WIDTH, xt as AGENTICO_WIDTH, wt as AGENTICO_WIDTH_STORAGE_KEY, Tn as Agentico, tt as AgenticoProvider, Mt as AgenticoToggle, I as DEFAULT_REASONING_PART_ID, ne as DEFAULT_TEXT_PART_ID, ye as JSON_EXPORT_DESTINATION_ID, he as MICRO_PROMPT_REGISTRY, $e as ORCHESTRATOR_TASK_ID, me as SUMMARY_MICRO_PROMPT, Ee as agenticoDe, we as agenticoEn, Te as agenticoIt, q as agenticoPromptsEn, J as agenticoPromptsIt, Qe as agenticoTranslations, ge as applyMicroPrompts, Ge as chatHasPersonMessage, Je as chatStartedAt, We as chatTitle, se as configureAgenticoPrompts, ke as configureEntityChatStore, K as createCrossAgentTools, z as defineSubagent, Ze as entityChatTaskId, Z as extractErrorMessage, _e as extractJsonBlock, U as findSubagentManifest, re as formatQuestionAnswers, X as getAgenticoPrompts, Ce as getDestinationRegistry, ze as getEntityChat, on as getSubagentControls, H as getSubagentRegistry, en as getSubagentReport, Ae as hasEntityChatBackend, be as jsonExportDestination, Xe as listEntityChats, R as messagePartsText, Le as onEntityChatsChange, G as registerCrossAgentTools, Se as registerDestinations, an as registerSubagentControls, $t as registerSubagentReports, V as registerSubagents, Ye as removeEntityChat, qe as renameEntityChat, pe as renderRegistryCli, fe as renderSubagentCli, ce as resetAgenticoPrompts, Be as saveEntityChat, Ne as syncEntityChats, ie as toJsonSchema, ae as toMcpTool, L as upsertMessagePart, Wt as useAgent, nt as useAgentico, $ as useAgenticoI18n, En as useAgenticoPageContext, Dn as useSubagentComponentContext };
|
|
3173
3175
|
|
|
3174
3176
|
//# sourceMappingURL=index.mjs.map
|