@llmnative/agentico 0.18.0 → 0.20.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 +2 -0
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +795 -664
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/entityChatStore.d.ts +5 -0
- package/dist/types/domain/threadEvents.d.ts +22 -0
- package/dist/types/i18n/types.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/presentation/AgenticoContext.d.ts +7 -0
- package/dist/types/presentation/imagePreview.d.ts +11 -0
- package/dist/types/presentation/useAgent.d.ts +3 -0
- package/llms.txt +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { zodToJsonSchema as e } from "zod-to-json-schema";
|
|
2
|
-
import { ActionButton as t, Badge as n, Card as r, ChatMarkdown as i, ChatQuestions as a, ChatReasoning as o, Chatbot as s, Code as c, Dropdown as l, DropdownItem as u, Form as d, Icon as f, Identicon as p, ImageAvatar as m, Input as h, LoadingButton as g, Modal as _, ModalYesNo as v, PromptUtils as y, Tree as b, getAIModelCatalog as x, interpolate as S, parseAIModelRef as C, proxyFetch as w, useAIProviderRegistry as T, useFormController as
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { ActionButton as t, Badge as n, Card as r, ChatMarkdown as i, ChatQuestions as a, ChatReasoning as o, Chatbot as s, Code as c, Dropdown as l, DropdownItem as u, Form as d, Icon as f, Identicon as p, ImageAvatar as m, Input as h, LoadingButton as g, Modal as _, ModalYesNo as v, PromptUtils as y, Tree as b, getAIModelCatalog as x, interpolate as S, parseAIModelRef as C, proxyFetch as w, useAIProviderRegistry as T, useFormController as ee, useI18n as E, useProxy as D } from "@llmnative/react";
|
|
3
|
+
import O, { createContext as te, useCallback as k, useContext as A, useEffect as j, useLayoutEffect as ne, useMemo as M, useRef as N, useState as P } from "react";
|
|
4
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
5
5
|
//#region src/domain/messageParts.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
6
|
+
var re = "text", R = "reasoning";
|
|
7
|
+
function ie(e, t, n) {
|
|
8
8
|
let r = e.findIndex((e) => e.type === t.type && e.id === t.id);
|
|
9
9
|
if (r >= 0) return e.map((e, n) => n === r ? t : e);
|
|
10
10
|
let i = t.type === "reasoning" || !n ? e : e.map((e) => e.type === "reasoning" && e.streaming ? n(e) : e), a = i.findIndex((e) => e.type === "text" && e.id === "text");
|
|
@@ -14,37 +14,37 @@ function B(e, t, n) {
|
|
|
14
14
|
...i.slice(a)
|
|
15
15
|
] : [...i, t];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function z(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 B(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 V(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var H = [];
|
|
31
|
+
function U(e) {
|
|
32
|
+
H = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function ae() {
|
|
35
|
+
return H.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), H;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function W(e) {
|
|
38
|
+
return H.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var G = [];
|
|
43
|
+
function K(...e) {
|
|
44
|
+
G = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function q(e) {
|
|
47
|
+
return G.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
@@ -158,7 +158,7 @@ function pe() {
|
|
|
158
158
|
function me(e, t) {
|
|
159
159
|
return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function he(e, t) {
|
|
162
162
|
let n = ce(t), r = me(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}`,
|
|
@@ -171,38 +171,38 @@ function Y(e, t) {
|
|
|
171
171
|
...i,
|
|
172
172
|
"",
|
|
173
173
|
" OUTPUT",
|
|
174
|
-
|
|
174
|
+
Y(t.describeOutput(), 4),
|
|
175
175
|
(t.example, ""),
|
|
176
176
|
t.example ? " EXAMPLE" : "",
|
|
177
177
|
t.example ? ` ${t.example}` : ""
|
|
178
178
|
].filter((e) => e !== "").join("\n");
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function Y(e, t) {
|
|
181
181
|
let n = " ".repeat(t);
|
|
182
182
|
return e.split("\n").map((e) => e && n + e).join("\n");
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function ge(e) {
|
|
185
185
|
return [
|
|
186
186
|
"NAME",
|
|
187
187
|
` ${e.id} — ${e.label}`,
|
|
188
188
|
"",
|
|
189
189
|
"DESCRIPTION",
|
|
190
|
-
|
|
190
|
+
Y(e.description, 2),
|
|
191
191
|
"",
|
|
192
|
-
...e.commands.map((t) =>
|
|
192
|
+
...e.commands.map((t) => he(e.id, t))
|
|
193
193
|
].join("\n");
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function _e(e) {
|
|
196
196
|
return e.length === 0 ? J().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/domain/microPrompts.ts
|
|
200
|
-
var
|
|
200
|
+
var X = {
|
|
201
201
|
id: "closing-summary",
|
|
202
202
|
get text() {
|
|
203
203
|
return J().closingSummary;
|
|
204
204
|
}
|
|
205
|
-
}, ve = { [
|
|
205
|
+
}, ve = { [X.id]: X };
|
|
206
206
|
function ye(e, t) {
|
|
207
207
|
if (!t || t.length === 0) return e;
|
|
208
208
|
let n = t.map((e) => ve[e]?.text).filter((e) => !!e);
|
|
@@ -330,6 +330,7 @@ var Oe = {
|
|
|
330
330
|
eventMore: "More",
|
|
331
331
|
eventLess: "Less",
|
|
332
332
|
eventOpen: "Open",
|
|
333
|
+
eventRunning: "In progress",
|
|
333
334
|
showEvents: "Show what the agents did",
|
|
334
335
|
hideEvents: "Conversation only",
|
|
335
336
|
cardView: "View",
|
|
@@ -411,6 +412,7 @@ var Oe = {
|
|
|
411
412
|
eventMore: "Di più",
|
|
412
413
|
eventLess: "Meno",
|
|
413
414
|
eventOpen: "Apri",
|
|
415
|
+
eventRunning: "In corso",
|
|
414
416
|
showEvents: "Mostra cosa hanno fatto gli agenti",
|
|
415
417
|
hideEvents: "Solo la conversazione",
|
|
416
418
|
cardView: "Vedi",
|
|
@@ -492,6 +494,7 @@ var Oe = {
|
|
|
492
494
|
eventMore: "Mehr",
|
|
493
495
|
eventLess: "Weniger",
|
|
494
496
|
eventOpen: "Öffnen",
|
|
497
|
+
eventRunning: "Läuft",
|
|
495
498
|
showEvents: "Zeigen, was die Agenten getan haben",
|
|
496
499
|
hideEvents: "Nur das Gespräch",
|
|
497
500
|
cardView: "Ansehen",
|
|
@@ -642,7 +645,7 @@ var et = (e, t) => `entitychat-${e}-${t}`;
|
|
|
642
645
|
//#endregion
|
|
643
646
|
//#region src/domain/chatThread.ts
|
|
644
647
|
function tt(e) {
|
|
645
|
-
return
|
|
648
|
+
return W(e.subagentId)?.thread?.(e.params) || void 0;
|
|
646
649
|
}
|
|
647
650
|
function nt(e, t, n) {
|
|
648
651
|
let r = $e(e), i = n ? r.find((e) => et(e.subagentId, e.entityId) === n) : void 0, a = i ? Q(i) : Infinity;
|
|
@@ -660,14 +663,34 @@ function rt(e, t) {
|
|
|
660
663
|
return n;
|
|
661
664
|
}
|
|
662
665
|
//#endregion
|
|
666
|
+
//#region src/presentation/imagePreview.ts
|
|
667
|
+
var it = 480, at = 4;
|
|
668
|
+
async function ot(e, t) {
|
|
669
|
+
if (e.type.startsWith("image/") && typeof document < "u" && typeof createImageBitmap == "function") try {
|
|
670
|
+
let n = await createImageBitmap(e), r = Math.min(1, t / Math.max(n.width, n.height)), i = document.createElement("canvas");
|
|
671
|
+
i.width = Math.max(1, Math.round(n.width * r)), i.height = Math.max(1, Math.round(n.height * r));
|
|
672
|
+
let a = i.getContext("2d");
|
|
673
|
+
return a ? (a.fillStyle = "#fff", a.fillRect(0, 0, i.width, i.height), a.drawImage(n, 0, 0, i.width, i.height), n.close?.(), i.toDataURL("image/jpeg", .8)) : void 0;
|
|
674
|
+
} catch {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
async function st(e, t = 480, n = 4) {
|
|
679
|
+
let r = e.filter((e) => e.type.startsWith("image/")).slice(0, n);
|
|
680
|
+
return (await Promise.all(r.map(async (e) => ({
|
|
681
|
+
name: e.name,
|
|
682
|
+
src: await ot(e, t)
|
|
683
|
+
})))).filter((e) => !!e.src);
|
|
684
|
+
}
|
|
685
|
+
//#endregion
|
|
663
686
|
//#region src/i18n/index.ts
|
|
664
|
-
var
|
|
687
|
+
var ct = {
|
|
665
688
|
en: { agentico: Oe },
|
|
666
689
|
it: { agentico: ke },
|
|
667
690
|
de: { agentico: Ae }
|
|
668
691
|
};
|
|
669
692
|
function $() {
|
|
670
|
-
let { dict: e } =
|
|
693
|
+
let { dict: e } = E(), t = e.agentico;
|
|
671
694
|
return t ? {
|
|
672
695
|
...Oe,
|
|
673
696
|
...t
|
|
@@ -675,13 +698,13 @@ function $() {
|
|
|
675
698
|
}
|
|
676
699
|
//#endregion
|
|
677
700
|
//#region src/presentation/AgenticoContext.tsx
|
|
678
|
-
var
|
|
679
|
-
function
|
|
680
|
-
let [i, a] =
|
|
701
|
+
var lt = "agentico-orchestrator", ut = te(null);
|
|
702
|
+
function dt({ children: e, scope: t = null, person: n = null, threadEvents: r = null }) {
|
|
703
|
+
let [i, a] = P(null), o = N(null);
|
|
681
704
|
j(() => {
|
|
682
705
|
o.current = i;
|
|
683
706
|
}, [i]);
|
|
684
|
-
let [s, c] =
|
|
707
|
+
let [s, c] = P(!1), l = t?.id;
|
|
685
708
|
j(() => {
|
|
686
709
|
l && Le(l).catch(() => void 0);
|
|
687
710
|
}, [l]);
|
|
@@ -695,8 +718,13 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
695
718
|
a(n);
|
|
696
719
|
}, []), d = k((e) => {
|
|
697
720
|
a((t) => t && t.id === e ? null : t);
|
|
698
|
-
}, []), f = k(() => c((e) => !e), []), p = k(() => c(!0), []), [m, h] =
|
|
699
|
-
|
|
721
|
+
}, []), f = k(() => c((e) => !e), []), p = k(() => c(!0), []), [m, h] = P(null), g = k((e) => {
|
|
722
|
+
c(!0), h((t) => ({
|
|
723
|
+
text: e,
|
|
724
|
+
nonce: (t?.nonce ?? 0) + 1
|
|
725
|
+
}));
|
|
726
|
+
}, []), [_, v] = P(null), [y, b] = P(void 0), [x, S] = P(void 0), [C, w] = P(void 0), [T, ee] = P(null), [E, D] = P(null), [O, te] = P(void 0), [A, ne] = P([]), F = k((e, t, n = null) => {
|
|
727
|
+
ne((r) => {
|
|
700
728
|
let i = r.filter((t) => t.id !== e);
|
|
701
729
|
return t ? [...i, {
|
|
702
730
|
id: e,
|
|
@@ -704,30 +732,30 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
704
732
|
card: n
|
|
705
733
|
}] : i;
|
|
706
734
|
});
|
|
707
|
-
}, []),
|
|
708
|
-
|
|
735
|
+
}, []), L = A.length > 0 ? A[A.length - 1] : null, [re, R] = P([]), ie = k((e, t) => {
|
|
736
|
+
R((n) => {
|
|
709
737
|
let r = n.filter((t) => t.id !== e);
|
|
710
738
|
return t ? [...r, {
|
|
711
739
|
id: e,
|
|
712
740
|
...t
|
|
713
741
|
}] : r;
|
|
714
742
|
});
|
|
715
|
-
}, []),
|
|
743
|
+
}, []), z = M(() => re.map((e) => ({
|
|
716
744
|
subagentId: e.subagentId,
|
|
717
745
|
componentKey: e.componentKey,
|
|
718
746
|
onResult: e.onResult,
|
|
719
747
|
pinnedEntityId: e.pinnedEntityId
|
|
720
|
-
})), [
|
|
748
|
+
})), [re]), B = M(() => {
|
|
721
749
|
let e = /* @__PURE__ */ new Map();
|
|
722
|
-
for (let t of
|
|
750
|
+
for (let t of re) e.set(t.subagentId, {
|
|
723
751
|
subagentId: t.subagentId,
|
|
724
752
|
componentKey: t.componentKey,
|
|
725
753
|
onResult: t.onResult,
|
|
726
754
|
contextInfo: t.contextInfo
|
|
727
755
|
});
|
|
728
756
|
return [...e.values()];
|
|
729
|
-
}, [
|
|
730
|
-
let t =
|
|
757
|
+
}, [re]), V = M(() => B.map((e) => {
|
|
758
|
+
let t = W(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
731
759
|
if (!t) return null;
|
|
732
760
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
733
761
|
return {
|
|
@@ -735,21 +763,21 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
735
763
|
agenticoHint: n,
|
|
736
764
|
userMessage: t.userMessage
|
|
737
765
|
};
|
|
738
|
-
}).filter((e) => e !== null), [
|
|
739
|
-
if (
|
|
740
|
-
if (
|
|
741
|
-
let e =
|
|
766
|
+
}).filter((e) => e !== null), [B]), H = M(() => V.map((e) => e.userMessage), [V]), U = M(() => {
|
|
767
|
+
if (V.length === 0) return null;
|
|
768
|
+
if (V.length === 1) return V[0].agenticoHint;
|
|
769
|
+
let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
742
770
|
return `${J().multipleCandidates}\n\n${e}`;
|
|
743
|
-
}, [
|
|
771
|
+
}, [V]) ?? L?.text ?? null, ae = V.length > 0 ? null : L?.card ?? null, G = M(() => [...new Set(z.map((e) => e.subagentId))], [z]), K = G.length === 1 ? G[0] : G.length === 0 ? L?.card?.subagentId ?? null : null, q = k((e, t) => {
|
|
744
772
|
p();
|
|
745
773
|
let n = o.current;
|
|
746
774
|
if (n?.id === "agentico-orchestrator") return;
|
|
747
|
-
let r =
|
|
748
|
-
|
|
775
|
+
let r = K && n?.id.startsWith(`subagent-${K}-`) ? n : void 0;
|
|
776
|
+
D(r ? {
|
|
749
777
|
taskId: r.id,
|
|
750
778
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
751
|
-
} : null),
|
|
752
|
-
}, [p,
|
|
779
|
+
} : null), v(e), b(t?.extraDestinations), S(t?.attachments), w(t?.model), te(t?.scopedSubagentId), ee(crypto.randomUUID());
|
|
780
|
+
}, [p, K]), oe = k((e, t, n, r, i, s) => {
|
|
753
781
|
if (!n || !r) return;
|
|
754
782
|
let c = o.current;
|
|
755
783
|
if (!c || c.id !== n) return;
|
|
@@ -766,128 +794,132 @@ function st({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
766
794
|
...e,
|
|
767
795
|
savedToDisk: !0
|
|
768
796
|
} : e));
|
|
769
|
-
}, []), [
|
|
770
|
-
p(),
|
|
797
|
+
}, []), [se, ce] = P(null), [le, ue] = P(null), de = k((e, t, n) => {
|
|
798
|
+
p(), ce({
|
|
771
799
|
subagentId: e,
|
|
772
800
|
entityId: t,
|
|
773
801
|
snapshot: n
|
|
774
|
-
}),
|
|
775
|
-
}, [p]), [
|
|
776
|
-
p(), d(
|
|
802
|
+
}), ue(crypto.randomUUID());
|
|
803
|
+
}, [p]), [fe, pe] = P(null), [me, he] = P(null), Y = k((e, t) => {
|
|
804
|
+
p(), d(lt), pe({
|
|
777
805
|
subagentId: e,
|
|
778
806
|
extraDestinations: t
|
|
779
|
-
}),
|
|
780
|
-
}, [p, d]), [
|
|
781
|
-
|
|
807
|
+
}), he(crypto.randomUUID());
|
|
808
|
+
}, [p, d]), [ge, _e] = P(null), [X, ve] = P(null), ye = k((e, t, n) => {
|
|
809
|
+
pe(null), _e({
|
|
782
810
|
subagentId: e,
|
|
783
811
|
params: t,
|
|
784
812
|
extraDestinations: n
|
|
785
|
-
}),
|
|
786
|
-
}, []), [
|
|
787
|
-
p(),
|
|
813
|
+
}), ve(crypto.randomUUID());
|
|
814
|
+
}, []), [be, xe] = P(null), [Se, Ce] = P(null), we = k((e, t, n) => {
|
|
815
|
+
p(), xe({
|
|
788
816
|
subagentId: e,
|
|
789
817
|
params: t,
|
|
790
818
|
...n
|
|
791
|
-
}),
|
|
792
|
-
}, [p]),
|
|
819
|
+
}), Ce(crypto.randomUUID());
|
|
820
|
+
}, [p]), Te = k(() => {
|
|
793
821
|
let e = o.current;
|
|
794
822
|
e && e.onDismiss();
|
|
795
|
-
}, []),
|
|
823
|
+
}, []), Ee = M(() => ({
|
|
796
824
|
scope: t,
|
|
797
825
|
person: n,
|
|
798
826
|
threadEvents: r,
|
|
827
|
+
compose: g,
|
|
828
|
+
draft: m,
|
|
799
829
|
task: i,
|
|
800
830
|
isOpen: s,
|
|
801
831
|
openTask: u,
|
|
802
832
|
closeTask: d,
|
|
803
833
|
toggleOpen: f,
|
|
804
|
-
pendingGoal:
|
|
805
|
-
startOrchestrator:
|
|
806
|
-
pageContext:
|
|
807
|
-
pageContextCard:
|
|
808
|
-
setPageContext:
|
|
809
|
-
scopedSubagentId:
|
|
810
|
-
pendingScopedSubagentId:
|
|
811
|
-
componentAnchors:
|
|
812
|
-
anchoredUserMessages:
|
|
813
|
-
registerComponentAnchor:
|
|
834
|
+
pendingGoal: _,
|
|
835
|
+
startOrchestrator: q,
|
|
836
|
+
pageContext: U,
|
|
837
|
+
pageContextCard: ae,
|
|
838
|
+
setPageContext: F,
|
|
839
|
+
scopedSubagentId: K,
|
|
840
|
+
pendingScopedSubagentId: O,
|
|
841
|
+
componentAnchors: z,
|
|
842
|
+
anchoredUserMessages: H,
|
|
843
|
+
registerComponentAnchor: ie,
|
|
814
844
|
openPanel: p,
|
|
815
|
-
pendingExtraDestinations:
|
|
816
|
-
pendingAttachments:
|
|
817
|
-
pendingModel:
|
|
818
|
-
orchestratorRunId:
|
|
819
|
-
pendingCarryOver:
|
|
820
|
-
commitEntityChat:
|
|
821
|
-
resumeEntityChat:
|
|
822
|
-
pendingResume:
|
|
823
|
-
resumeRunId:
|
|
824
|
-
dismissForeignTask:
|
|
825
|
-
pendingManualEntry:
|
|
826
|
-
manualEntryRunId:
|
|
827
|
-
startManualEntry:
|
|
828
|
-
pendingResumeWithAI:
|
|
845
|
+
pendingExtraDestinations: y,
|
|
846
|
+
pendingAttachments: x,
|
|
847
|
+
pendingModel: C,
|
|
848
|
+
orchestratorRunId: T,
|
|
849
|
+
pendingCarryOver: E,
|
|
850
|
+
commitEntityChat: oe,
|
|
851
|
+
resumeEntityChat: de,
|
|
852
|
+
pendingResume: se,
|
|
853
|
+
resumeRunId: le,
|
|
854
|
+
dismissForeignTask: Te,
|
|
855
|
+
pendingManualEntry: fe,
|
|
856
|
+
manualEntryRunId: me,
|
|
857
|
+
startManualEntry: Y,
|
|
858
|
+
pendingResumeWithAI: ge,
|
|
829
859
|
resumeWithAIRunId: X,
|
|
830
|
-
resumeWithAI:
|
|
831
|
-
startSubagent:
|
|
832
|
-
pendingStart:
|
|
833
|
-
startRunId:
|
|
860
|
+
resumeWithAI: ye,
|
|
861
|
+
startSubagent: we,
|
|
862
|
+
pendingStart: be,
|
|
863
|
+
startRunId: Se
|
|
834
864
|
}), [
|
|
835
865
|
t,
|
|
836
866
|
n,
|
|
837
867
|
r,
|
|
868
|
+
g,
|
|
869
|
+
m,
|
|
838
870
|
i,
|
|
839
871
|
s,
|
|
840
872
|
u,
|
|
841
873
|
d,
|
|
842
874
|
f,
|
|
843
|
-
|
|
844
|
-
G,
|
|
845
|
-
H,
|
|
846
|
-
re,
|
|
847
|
-
te,
|
|
848
|
-
W,
|
|
849
|
-
E,
|
|
850
|
-
R,
|
|
851
|
-
V,
|
|
852
|
-
L,
|
|
853
|
-
p,
|
|
854
|
-
g,
|
|
855
|
-
v,
|
|
856
|
-
b,
|
|
857
|
-
S,
|
|
858
|
-
w,
|
|
875
|
+
_,
|
|
859
876
|
q,
|
|
860
|
-
|
|
877
|
+
U,
|
|
878
|
+
ae,
|
|
879
|
+
F,
|
|
880
|
+
K,
|
|
881
|
+
O,
|
|
882
|
+
z,
|
|
883
|
+
H,
|
|
861
884
|
ie,
|
|
885
|
+
p,
|
|
886
|
+
y,
|
|
887
|
+
x,
|
|
888
|
+
C,
|
|
889
|
+
T,
|
|
890
|
+
E,
|
|
862
891
|
oe,
|
|
863
|
-
Se,
|
|
864
|
-
le,
|
|
865
892
|
de,
|
|
866
|
-
|
|
893
|
+
se,
|
|
894
|
+
le,
|
|
895
|
+
Te,
|
|
896
|
+
fe,
|
|
867
897
|
me,
|
|
868
|
-
|
|
898
|
+
Y,
|
|
869
899
|
ge,
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
900
|
+
X,
|
|
901
|
+
ye,
|
|
902
|
+
we,
|
|
903
|
+
be,
|
|
904
|
+
Se
|
|
873
905
|
]);
|
|
874
|
-
return /* @__PURE__ */ I(
|
|
875
|
-
value:
|
|
906
|
+
return /* @__PURE__ */ I(ut.Provider, {
|
|
907
|
+
value: Ee,
|
|
876
908
|
children: e
|
|
877
909
|
});
|
|
878
910
|
}
|
|
879
|
-
function
|
|
880
|
-
let e = A(
|
|
911
|
+
function ft() {
|
|
912
|
+
let e = A(ut);
|
|
881
913
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
882
914
|
return e;
|
|
883
915
|
}
|
|
884
916
|
//#endregion
|
|
885
917
|
//#region src/presentation/ThreadEvents.tsx
|
|
886
|
-
var
|
|
887
|
-
function
|
|
888
|
-
let [e, t] =
|
|
918
|
+
var pt = "llmnative.agentico.threadEvents";
|
|
919
|
+
function mt() {
|
|
920
|
+
let [e, t] = P(() => {
|
|
889
921
|
try {
|
|
890
|
-
return localStorage.getItem(
|
|
922
|
+
return localStorage.getItem(pt) !== "off";
|
|
891
923
|
} catch {
|
|
892
924
|
return !0;
|
|
893
925
|
}
|
|
@@ -895,12 +927,12 @@ function ut() {
|
|
|
895
927
|
return [e, (e) => {
|
|
896
928
|
t(e);
|
|
897
929
|
try {
|
|
898
|
-
localStorage.setItem(
|
|
930
|
+
localStorage.setItem(pt, e ? "on" : "off");
|
|
899
931
|
} catch {}
|
|
900
932
|
}];
|
|
901
933
|
}
|
|
902
|
-
function
|
|
903
|
-
let { threadEvents: i } =
|
|
934
|
+
function ht(e, t, n, r = !0) {
|
|
935
|
+
let { threadEvents: i } = ft(), [a, o] = P([]);
|
|
904
936
|
return j(() => {
|
|
905
937
|
if (!i || !e || !r) {
|
|
906
938
|
o([]);
|
|
@@ -924,83 +956,123 @@ function dt(e, t, n, r = !0) {
|
|
|
924
956
|
r
|
|
925
957
|
]), a;
|
|
926
958
|
}
|
|
927
|
-
function
|
|
928
|
-
let t = $(), { locale: r } =
|
|
959
|
+
function gt({ event: e }) {
|
|
960
|
+
let t = $(), { locale: r } = E(), [a, o] = P(!!e.open), { threadEvents: s, task: c, compose: l } = ft(), [u, d] = P(null), p = async (t) => {
|
|
961
|
+
if (s?.onAction) {
|
|
962
|
+
d(t);
|
|
963
|
+
try {
|
|
964
|
+
await s.onAction(e, t, {
|
|
965
|
+
compose: l,
|
|
966
|
+
send: async (e) => {
|
|
967
|
+
if (!c || c.agent.running) {
|
|
968
|
+
l(e);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
let t = await c.agent.sendMessage(e);
|
|
972
|
+
t && c.onApplied(t);
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
} finally {
|
|
976
|
+
d(null);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}, m = new Date(e.at).toLocaleString(r, {
|
|
929
980
|
dateStyle: "short",
|
|
930
981
|
timeStyle: "short"
|
|
931
982
|
});
|
|
932
983
|
return /* @__PURE__ */ L("li", {
|
|
933
984
|
className: "flex items-start gap-2 py-1 text-xs",
|
|
934
985
|
"aria-label": `${e.author.name}: ${e.title}`,
|
|
986
|
+
"aria-busy": e.running || void 0,
|
|
935
987
|
children: [/* @__PURE__ */ I("span", {
|
|
936
988
|
className: "flex w-6 shrink-0 justify-center pt-px",
|
|
937
|
-
children: /* @__PURE__ */ I(
|
|
989
|
+
children: /* @__PURE__ */ I(Dt, { author: e.author })
|
|
938
990
|
}), /* @__PURE__ */ L("div", {
|
|
939
|
-
className:
|
|
940
|
-
children: [
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
991
|
+
className: `min-w-0 flex-1 rounded-md border px-2 py-1 ${e.running ? "border-primary/40 bg-primary/5" : "border-border/60 bg-muted/30"}`,
|
|
992
|
+
children: [
|
|
993
|
+
/* @__PURE__ */ L("div", {
|
|
994
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5",
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ I("span", {
|
|
997
|
+
className: "font-medium text-foreground",
|
|
998
|
+
children: e.author.name
|
|
999
|
+
}),
|
|
1000
|
+
e.running ? /* @__PURE__ */ I(f, {
|
|
1001
|
+
name: "loader-circle",
|
|
1002
|
+
size: 12,
|
|
1003
|
+
className: "shrink-0 animate-spin text-primary",
|
|
1004
|
+
"aria-label": t.eventRunning
|
|
1005
|
+
}) : e.icon && /* @__PURE__ */ I(f, {
|
|
1006
|
+
name: e.icon,
|
|
1007
|
+
size: 12,
|
|
1008
|
+
className: "shrink-0 text-muted-foreground"
|
|
1009
|
+
}),
|
|
1010
|
+
/* @__PURE__ */ I("span", {
|
|
1011
|
+
className: "min-w-0 break-words text-muted-foreground",
|
|
1012
|
+
children: e.title
|
|
1013
|
+
}),
|
|
1014
|
+
e.badge && /* @__PURE__ */ I(n, {
|
|
1015
|
+
variant: e.badge.variant ?? "light",
|
|
1016
|
+
children: e.badge.label
|
|
1017
|
+
}),
|
|
1018
|
+
/* @__PURE__ */ L("span", {
|
|
1019
|
+
className: "ms-auto flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground",
|
|
1020
|
+
children: [
|
|
1021
|
+
/* @__PURE__ */ I("time", {
|
|
1022
|
+
dateTime: new Date(e.at).toISOString(),
|
|
1023
|
+
children: m
|
|
1024
|
+
}),
|
|
1025
|
+
e.body && /* @__PURE__ */ I("button", {
|
|
1026
|
+
type: "button",
|
|
1027
|
+
onClick: () => o((e) => !e),
|
|
1028
|
+
"aria-expanded": a,
|
|
1029
|
+
title: a ? t.eventLess : t.eventMore,
|
|
1030
|
+
className: "rounded hover:text-foreground",
|
|
1031
|
+
children: /* @__PURE__ */ I(f, {
|
|
1032
|
+
name: a ? "chevron-up" : "chevron-down",
|
|
1033
|
+
size: 12
|
|
1034
|
+
})
|
|
1035
|
+
}),
|
|
1036
|
+
e.href && /* @__PURE__ */ I("a", {
|
|
1037
|
+
href: e.href,
|
|
1038
|
+
target: "_blank",
|
|
1039
|
+
rel: "noreferrer",
|
|
1040
|
+
title: t.eventOpen,
|
|
1041
|
+
"aria-label": t.eventOpen,
|
|
1042
|
+
className: "rounded hover:text-foreground",
|
|
1043
|
+
children: /* @__PURE__ */ I(f, {
|
|
1044
|
+
name: "external-link",
|
|
1045
|
+
size: 12
|
|
1046
|
+
})
|
|
988
1047
|
})
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1048
|
+
]
|
|
1049
|
+
})
|
|
1050
|
+
]
|
|
1051
|
+
}),
|
|
1052
|
+
a && e.body && /* @__PURE__ */ I(i, {
|
|
1053
|
+
content: e.body,
|
|
1054
|
+
tone: "muted",
|
|
1055
|
+
className: "mt-1 break-words text-xs leading-relaxed"
|
|
1056
|
+
}),
|
|
1057
|
+
e.actions && e.actions.length > 0 && s?.onAction && /* @__PURE__ */ I("div", {
|
|
1058
|
+
className: "mt-1.5 flex flex-wrap gap-1.5",
|
|
1059
|
+
children: e.actions.map((e) => /* @__PURE__ */ I(g, {
|
|
1060
|
+
label: e.label,
|
|
1061
|
+
...e.icon ? { icon: e.icon } : {},
|
|
1062
|
+
variant: e.primary ? "primary" : "outline-primary",
|
|
1063
|
+
className: "px-2 py-0.5 text-xs",
|
|
1064
|
+
loading: u === e.id,
|
|
1065
|
+
disabled: u !== null || !!c?.agent.running,
|
|
1066
|
+
onClick: () => p(e.id)
|
|
1067
|
+
}, e.id))
|
|
1068
|
+
})
|
|
1069
|
+
]
|
|
998
1070
|
})]
|
|
999
1071
|
});
|
|
1000
1072
|
}
|
|
1001
1073
|
//#endregion
|
|
1002
1074
|
//#region src/presentation/AgentActivityLog.tsx
|
|
1003
|
-
function
|
|
1075
|
+
function _t(e) {
|
|
1004
1076
|
let t = e.search(/[{[]/);
|
|
1005
1077
|
if (t === -1) return [{
|
|
1006
1078
|
type: "text",
|
|
@@ -1046,19 +1118,19 @@ function pt(e) {
|
|
|
1046
1118
|
language: "json"
|
|
1047
1119
|
});
|
|
1048
1120
|
let u = e.slice(s + 1);
|
|
1049
|
-
return u.trim() && l.push(...
|
|
1121
|
+
return u.trim() && l.push(..._t(u)), l;
|
|
1050
1122
|
}
|
|
1051
|
-
function
|
|
1123
|
+
function vt(e) {
|
|
1052
1124
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
1053
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
1125
|
+
for (; i = n.exec(e);) i.index > r && t.push(..._t(e.slice(r, i.index))), t.push({
|
|
1054
1126
|
type: "code",
|
|
1055
1127
|
content: i[2].replace(/\n$/, ""),
|
|
1056
1128
|
language: i[1]
|
|
1057
1129
|
}), r = n.lastIndex;
|
|
1058
|
-
return r < e.length && t.push(...
|
|
1130
|
+
return r < e.length && t.push(..._t(e.slice(r))), t;
|
|
1059
1131
|
}
|
|
1060
|
-
function
|
|
1061
|
-
let [n, r] =
|
|
1132
|
+
function yt({ content: e, language: t }) {
|
|
1133
|
+
let [n, r] = P(!1);
|
|
1062
1134
|
return /* @__PURE__ */ L("div", {
|
|
1063
1135
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
1064
1136
|
onClick: () => r((e) => !e),
|
|
@@ -1072,9 +1144,9 @@ function ht({ content: e, language: t }) {
|
|
|
1072
1144
|
}), !n && /* @__PURE__ */ I("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
1073
1145
|
});
|
|
1074
1146
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let n =
|
|
1077
|
-
return /* @__PURE__ */ I(
|
|
1147
|
+
function bt({ text: e, tone: t }) {
|
|
1148
|
+
let n = vt(e);
|
|
1149
|
+
return /* @__PURE__ */ I(F, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ I(yt, {
|
|
1078
1150
|
content: e.content,
|
|
1079
1151
|
language: e.language
|
|
1080
1152
|
}, n) : e.content.trim() && /* @__PURE__ */ I(i, {
|
|
@@ -1083,8 +1155,8 @@ function gt({ text: e, tone: t }) {
|
|
|
1083
1155
|
className: "break-words text-xs leading-relaxed"
|
|
1084
1156
|
}, n)) });
|
|
1085
1157
|
}
|
|
1086
|
-
function
|
|
1087
|
-
let [e] =
|
|
1158
|
+
function xt() {
|
|
1159
|
+
let [e] = P(() => Date.now()), [t, n] = P(e);
|
|
1088
1160
|
j(() => {
|
|
1089
1161
|
let e = setInterval(() => n(Date.now()), 1e3);
|
|
1090
1162
|
return () => clearInterval(e);
|
|
@@ -1100,7 +1172,7 @@ function _t() {
|
|
|
1100
1172
|
]
|
|
1101
1173
|
});
|
|
1102
1174
|
}
|
|
1103
|
-
function
|
|
1175
|
+
function St({ status: e }) {
|
|
1104
1176
|
return e === "running" ? /* @__PURE__ */ I("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ I(f, {
|
|
1105
1177
|
name: "check",
|
|
1106
1178
|
size: 12,
|
|
@@ -1115,11 +1187,37 @@ function vt({ status: e }) {
|
|
|
1115
1187
|
className: "shrink-0 text-destructive"
|
|
1116
1188
|
});
|
|
1117
1189
|
}
|
|
1118
|
-
function
|
|
1190
|
+
function Ct(e, t) {
|
|
1119
1191
|
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;
|
|
1120
1192
|
}
|
|
1121
|
-
var
|
|
1122
|
-
function
|
|
1193
|
+
var wt = 96, Tt = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
|
|
1194
|
+
function Et({ previews: e }) {
|
|
1195
|
+
let [t, n] = P(null);
|
|
1196
|
+
return /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("div", {
|
|
1197
|
+
className: "flex flex-wrap gap-1.5",
|
|
1198
|
+
children: e.map((e) => /* @__PURE__ */ I("button", {
|
|
1199
|
+
type: "button",
|
|
1200
|
+
onClick: () => n(e),
|
|
1201
|
+
title: e.name,
|
|
1202
|
+
className: "overflow-hidden rounded-md border border-border/60 bg-background",
|
|
1203
|
+
children: /* @__PURE__ */ I("img", {
|
|
1204
|
+
src: e.src,
|
|
1205
|
+
alt: e.name,
|
|
1206
|
+
className: "block max-h-40 max-w-full object-contain"
|
|
1207
|
+
})
|
|
1208
|
+
}, e.name))
|
|
1209
|
+
}), t && /* @__PURE__ */ I(_, {
|
|
1210
|
+
title: t.name,
|
|
1211
|
+
size: "lg",
|
|
1212
|
+
onClose: () => n(null),
|
|
1213
|
+
children: /* @__PURE__ */ I("img", {
|
|
1214
|
+
src: t.src,
|
|
1215
|
+
alt: t.name,
|
|
1216
|
+
className: "mx-auto block max-h-[70vh] max-w-full object-contain"
|
|
1217
|
+
})
|
|
1218
|
+
})] });
|
|
1219
|
+
}
|
|
1220
|
+
function Dt({ author: e, size: t = 20 }) {
|
|
1123
1221
|
return e.avatarUrl ? /* @__PURE__ */ I(m, {
|
|
1124
1222
|
src: e.avatarUrl,
|
|
1125
1223
|
title: e.name,
|
|
@@ -1132,8 +1230,8 @@ function St({ author: e, size: t = 20 }) {
|
|
|
1132
1230
|
title: e.name
|
|
1133
1231
|
});
|
|
1134
1232
|
}
|
|
1135
|
-
var
|
|
1136
|
-
function
|
|
1233
|
+
var Ot = "w-6";
|
|
1234
|
+
function kt(e) {
|
|
1137
1235
|
if (!e || e.kind !== "thinking" || !e.parts) return [];
|
|
1138
1236
|
let t = [];
|
|
1139
1237
|
for (let n of e.parts) {
|
|
@@ -1142,7 +1240,7 @@ function wt(e) {
|
|
|
1142
1240
|
}
|
|
1143
1241
|
return t;
|
|
1144
1242
|
}
|
|
1145
|
-
function
|
|
1243
|
+
function At({ parts: e, open: t, onToggle: n }) {
|
|
1146
1244
|
let r = $(), i = e.filter((e) => e.type === "reasoning"), a = e.filter((e) => e.type === "tool"), o = i.some((e) => e.streaming), s = a.filter((e) => e.status === "running").at(-1), c = Math.round(i.reduce((e, t) => e + (t.duration ?? 0), 0)), l = [...i.length ? [o ? r.reasoningNow : c > 0 ? S(r.reasonedFor, { seconds: c }) : r.reasoned] : [], ...a.length ? [s?.label ?? (a.length === 1 ? r.oneStep : S(r.steps, { count: a.length }))] : []], u = o || !!s, d = a.some((e) => e.status === "error");
|
|
1147
1245
|
return /* @__PURE__ */ L("button", {
|
|
1148
1246
|
type: "button",
|
|
@@ -1168,9 +1266,9 @@ function Tt({ parts: e, open: t, onToggle: n }) {
|
|
|
1168
1266
|
]
|
|
1169
1267
|
});
|
|
1170
1268
|
}
|
|
1171
|
-
function
|
|
1172
|
-
let o = $(), s =
|
|
1173
|
-
|
|
1269
|
+
function jt({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a = !1 }) {
|
|
1270
|
+
let o = $(), s = N(null), [c, l] = P(!1), [u, d] = P(!1);
|
|
1271
|
+
ne(() => {
|
|
1174
1272
|
let e = s.current;
|
|
1175
1273
|
e && d(e.scrollHeight > 97);
|
|
1176
1274
|
}, [e.detail, e.attachmentNames]);
|
|
@@ -1198,21 +1296,25 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
|
|
|
1198
1296
|
children: [/* @__PURE__ */ L("div", {
|
|
1199
1297
|
ref: s,
|
|
1200
1298
|
className: `space-y-1 px-2.5 pt-1.5 ${p ? "overflow-hidden" : ""}`,
|
|
1201
|
-
style: p ? { maxHeight:
|
|
1202
|
-
children: [
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
className: "
|
|
1206
|
-
children:
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1299
|
+
style: p ? { maxHeight: wt } : void 0,
|
|
1300
|
+
children: [
|
|
1301
|
+
e.attachmentPreviews && e.attachmentPreviews.length > 0 && /* @__PURE__ */ I(Et, { previews: e.attachmentPreviews }),
|
|
1302
|
+
e.attachmentNames && e.attachmentNames.some((t) => !e.attachmentPreviews?.some((e) => e.name === t)) && /* @__PURE__ */ I("div", {
|
|
1303
|
+
className: "flex flex-wrap gap-1",
|
|
1304
|
+
children: e.attachmentNames.filter((t) => !e.attachmentPreviews?.some((e) => e.name === t)).map((e, t) => /* @__PURE__ */ L("span", {
|
|
1305
|
+
className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
|
|
1306
|
+
children: [/* @__PURE__ */ I(f, {
|
|
1307
|
+
name: "paperclip",
|
|
1308
|
+
size: 10,
|
|
1309
|
+
className: "shrink-0"
|
|
1310
|
+
}), /* @__PURE__ */ I("span", {
|
|
1311
|
+
className: "max-w-[160px] truncate",
|
|
1312
|
+
children: e
|
|
1313
|
+
})]
|
|
1314
|
+
}, t))
|
|
1315
|
+
}),
|
|
1316
|
+
/* @__PURE__ */ I(bt, { text: e.detail ?? "" })
|
|
1317
|
+
]
|
|
1216
1318
|
}), u && /* @__PURE__ */ L("button", {
|
|
1217
1319
|
type: "button",
|
|
1218
1320
|
onClick: () => l((e) => !e),
|
|
@@ -1227,9 +1329,9 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
|
|
|
1227
1329
|
return a ? /* @__PURE__ */ L("div", {
|
|
1228
1330
|
className: `${n ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start gap-2 bg-background py-1.5`,
|
|
1229
1331
|
children: [/* @__PURE__ */ L("span", {
|
|
1230
|
-
className: `flex shrink-0 flex-col items-center ${
|
|
1332
|
+
className: `flex shrink-0 flex-col items-center ${Ot}`,
|
|
1231
1333
|
children: [
|
|
1232
|
-
e.author ? /* @__PURE__ */ I(
|
|
1334
|
+
e.author ? /* @__PURE__ */ I(Dt, { author: e.author }) : /* @__PURE__ */ I("span", {
|
|
1233
1335
|
className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground",
|
|
1234
1336
|
"aria-hidden": !0,
|
|
1235
1337
|
children: /* @__PURE__ */ I(f, {
|
|
@@ -1255,13 +1357,13 @@ function Et({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
|
|
|
1255
1357
|
}), g(!1)]
|
|
1256
1358
|
});
|
|
1257
1359
|
}
|
|
1258
|
-
var
|
|
1360
|
+
var Mt = {
|
|
1259
1361
|
running: "loader-circle",
|
|
1260
1362
|
done: "check",
|
|
1261
1363
|
error: "x",
|
|
1262
1364
|
stopped: "circle-slash"
|
|
1263
1365
|
};
|
|
1264
|
-
function
|
|
1366
|
+
function Nt({ steps: e }) {
|
|
1265
1367
|
let t = $(), n = e.filter((e) => e.status === "running").at(-1), r = e.some((e) => e.status === "error"), i = n?.label ?? (e.length === 1 ? t.oneStep : S(t.steps, { count: e.length }));
|
|
1266
1368
|
return /* @__PURE__ */ I(b, {
|
|
1267
1369
|
ariaLabel: t.stepsLabel,
|
|
@@ -1277,17 +1379,17 @@ function Ot({ steps: e }) {
|
|
|
1277
1379
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
1278
1380
|
children: e.label
|
|
1279
1381
|
}),
|
|
1280
|
-
icon:
|
|
1382
|
+
icon: Mt[e.status]
|
|
1281
1383
|
}))
|
|
1282
1384
|
}]
|
|
1283
1385
|
});
|
|
1284
1386
|
}
|
|
1285
|
-
function
|
|
1286
|
-
let s = $(), [c, l] =
|
|
1387
|
+
function Pt({ entry: e, part: a, questions: o }) {
|
|
1388
|
+
let s = $(), [c, l] = P(!1), u = !!(o?.onCardAction && o.canAnswer(e.id) && !a.outcome), d = a.outcome?.status === "done" ? "text-success" : a.outcome?.status === "error" ? "text-destructive" : "text-muted-foreground";
|
|
1287
1389
|
return /* @__PURE__ */ L(r, {
|
|
1288
1390
|
headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
|
|
1289
1391
|
bodyClassName: "px-3 py-2",
|
|
1290
|
-
header: /* @__PURE__ */ L(
|
|
1392
|
+
header: /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("span", {
|
|
1291
1393
|
className: "min-w-0 text-xs font-semibold text-foreground",
|
|
1292
1394
|
children: a.title
|
|
1293
1395
|
}), a.badge && /* @__PURE__ */ I(n, {
|
|
@@ -1327,7 +1429,7 @@ function kt({ entry: e, part: a, questions: o }) {
|
|
|
1327
1429
|
]
|
|
1328
1430
|
}), a.outcome && /* @__PURE__ */ L("p", {
|
|
1329
1431
|
className: `text-xs ${d}`,
|
|
1330
|
-
children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ L(
|
|
1432
|
+
children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ L(F, { children: [" ", /* @__PURE__ */ I("a", {
|
|
1331
1433
|
className: "underline",
|
|
1332
1434
|
href: a.outcome.link.url,
|
|
1333
1435
|
target: "_blank",
|
|
@@ -1356,7 +1458,7 @@ function kt({ entry: e, part: a, questions: o }) {
|
|
|
1356
1458
|
})]
|
|
1357
1459
|
});
|
|
1358
1460
|
}
|
|
1359
|
-
function
|
|
1461
|
+
function Ft(e, t) {
|
|
1360
1462
|
let n = e.at(-1);
|
|
1361
1463
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
1362
1464
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -1365,7 +1467,7 @@ function At(e, t) {
|
|
|
1365
1467
|
part: r
|
|
1366
1468
|
};
|
|
1367
1469
|
}
|
|
1368
|
-
function
|
|
1470
|
+
function It({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
1369
1471
|
let o = !!n?.canAnswer(e.id);
|
|
1370
1472
|
return /* @__PURE__ */ I(a, {
|
|
1371
1473
|
questions: t.questions,
|
|
@@ -1376,7 +1478,7 @@ function jt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
|
1376
1478
|
className: i ?? "text-xs"
|
|
1377
1479
|
});
|
|
1378
1480
|
}
|
|
1379
|
-
function
|
|
1481
|
+
function Lt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
1380
1482
|
let a = (e.parts ?? []).filter((e) => (e.type !== "questions" || e.id !== n) && !r?.has(e.id)), s = [];
|
|
1381
1483
|
for (let e of a) {
|
|
1382
1484
|
let t = s.at(-1);
|
|
@@ -1391,7 +1493,7 @@ function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1391
1493
|
return /* @__PURE__ */ I("div", {
|
|
1392
1494
|
className: "space-y-2",
|
|
1393
1495
|
children: s.map((n) => {
|
|
1394
|
-
if ("steps" in n) return /* @__PURE__ */ I(
|
|
1496
|
+
if ("steps" in n) return /* @__PURE__ */ I(Nt, { steps: n.steps }, n.key);
|
|
1395
1497
|
let { part: r } = n;
|
|
1396
1498
|
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ I(i, {
|
|
1397
1499
|
content: r.text,
|
|
@@ -1402,11 +1504,11 @@ function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1402
1504
|
streaming: r.streaming,
|
|
1403
1505
|
duration: r.duration,
|
|
1404
1506
|
className: "my-0"
|
|
1405
|
-
}, n.key) : r.type === "card" ? /* @__PURE__ */ I(
|
|
1507
|
+
}, n.key) : r.type === "card" ? /* @__PURE__ */ I(Pt, {
|
|
1406
1508
|
entry: e,
|
|
1407
1509
|
part: r,
|
|
1408
1510
|
questions: t
|
|
1409
|
-
}, n.key) : /* @__PURE__ */ I(
|
|
1511
|
+
}, n.key) : /* @__PURE__ */ I(It, {
|
|
1410
1512
|
entry: e,
|
|
1411
1513
|
part: r,
|
|
1412
1514
|
questions: t
|
|
@@ -1414,13 +1516,13 @@ function Mt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1414
1516
|
})
|
|
1415
1517
|
});
|
|
1416
1518
|
}
|
|
1417
|
-
function
|
|
1519
|
+
function Rt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
1418
1520
|
let a = $();
|
|
1419
1521
|
if (e.kind === "thinking" && e.parts) {
|
|
1420
1522
|
let i = e.status === "error" || e.status === "stopped" || e.status === "running", o = r ? e.parts.filter((e) => !r.has(e.id)).length : e.parts.length;
|
|
1421
1523
|
return /* @__PURE__ */ L("li", {
|
|
1422
1524
|
className: "text-xs text-muted-foreground",
|
|
1423
|
-
children: [o > 0 && /* @__PURE__ */ I(
|
|
1525
|
+
children: [o > 0 && /* @__PURE__ */ I(Lt, {
|
|
1424
1526
|
entry: e,
|
|
1425
1527
|
questions: t,
|
|
1426
1528
|
hiddenPartId: n,
|
|
@@ -1429,15 +1531,15 @@ function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1429
1531
|
className: `flex items-start gap-1.5 ${o > 0 ? "mt-1" : ""}`,
|
|
1430
1532
|
children: [/* @__PURE__ */ I("span", {
|
|
1431
1533
|
className: "pt-px",
|
|
1432
|
-
children: /* @__PURE__ */ I(
|
|
1534
|
+
children: /* @__PURE__ */ I(St, { status: e.status })
|
|
1433
1535
|
}), /* @__PURE__ */ L("span", {
|
|
1434
1536
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1435
|
-
children: [
|
|
1537
|
+
children: [Ct(e, a), e.status === "running" && /* @__PURE__ */ I(xt, {})]
|
|
1436
1538
|
})]
|
|
1437
1539
|
})]
|
|
1438
1540
|
});
|
|
1439
1541
|
}
|
|
1440
|
-
let o = e.kind === "thinking" && e.detail ?
|
|
1542
|
+
let o = e.kind === "thinking" && e.detail ? vt(e.detail) : [], s = o.filter((e) => e.type === "code"), c = o.filter((e) => e.type === "text" && e.content.trim()), l = e.kind === "thinking" ? Ct(e, a) : e.label;
|
|
1441
1543
|
return /* @__PURE__ */ L("li", {
|
|
1442
1544
|
className: "text-xs text-muted-foreground",
|
|
1443
1545
|
children: [
|
|
@@ -1445,7 +1547,7 @@ function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1445
1547
|
className: "flex items-start gap-1.5",
|
|
1446
1548
|
children: [/* @__PURE__ */ I("span", {
|
|
1447
1549
|
className: "pt-px",
|
|
1448
|
-
children: /* @__PURE__ */ I(
|
|
1550
|
+
children: /* @__PURE__ */ I(St, { status: e.status })
|
|
1449
1551
|
}), /* @__PURE__ */ I("span", {
|
|
1450
1552
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1451
1553
|
children: l
|
|
@@ -1453,7 +1555,7 @@ function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1453
1555
|
}),
|
|
1454
1556
|
s.length > 0 && /* @__PURE__ */ I("div", {
|
|
1455
1557
|
className: "mt-1 ml-[18px] space-y-1",
|
|
1456
|
-
children: s.map((e, t) => /* @__PURE__ */ I(
|
|
1558
|
+
children: s.map((e, t) => /* @__PURE__ */ I(yt, {
|
|
1457
1559
|
content: e.content,
|
|
1458
1560
|
language: e.language
|
|
1459
1561
|
}, t))
|
|
@@ -1469,7 +1571,7 @@ function Nt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1469
1571
|
]
|
|
1470
1572
|
});
|
|
1471
1573
|
}
|
|
1472
|
-
function
|
|
1574
|
+
function zt({ parts: e }) {
|
|
1473
1575
|
return /* @__PURE__ */ I("div", {
|
|
1474
1576
|
className: "mb-1 space-y-1 border-l-2 border-border pl-2 text-xs text-muted-foreground",
|
|
1475
1577
|
children: e.map((e) => e.type === "reasoning" ? /* @__PURE__ */ I(i, {
|
|
@@ -1480,7 +1582,7 @@ function Pt({ parts: e }) {
|
|
|
1480
1582
|
}, e.id) : e.type === "tool" ? /* @__PURE__ */ L("div", {
|
|
1481
1583
|
className: "flex items-start gap-1.5",
|
|
1482
1584
|
children: [/* @__PURE__ */ I(f, {
|
|
1483
|
-
name:
|
|
1585
|
+
name: Mt[e.status],
|
|
1484
1586
|
size: 12,
|
|
1485
1587
|
className: `mt-0.5 shrink-0 ${e.status === "running" ? "animate-spin" : ""}`
|
|
1486
1588
|
}), /* @__PURE__ */ I("span", {
|
|
@@ -1490,13 +1592,13 @@ function Pt({ parts: e }) {
|
|
|
1490
1592
|
}, e.id) : null)
|
|
1491
1593
|
});
|
|
1492
1594
|
}
|
|
1493
|
-
function
|
|
1494
|
-
let i =
|
|
1595
|
+
function Bt({ speaker: e, entries: t, questions: n, docked: r }) {
|
|
1596
|
+
let i = kt(t[0]), a = i.length ? new Set(i.map((e) => e.id)) : void 0, [o, s] = P(!1);
|
|
1495
1597
|
return /* @__PURE__ */ L("div", {
|
|
1496
1598
|
className: "flex items-start gap-2 pt-1.5",
|
|
1497
1599
|
children: [/* @__PURE__ */ I("span", {
|
|
1498
|
-
className: `flex shrink-0 justify-center pt-px ${
|
|
1499
|
-
children: /* @__PURE__ */ I(
|
|
1600
|
+
className: `flex shrink-0 justify-center pt-px ${Ot}`,
|
|
1601
|
+
children: /* @__PURE__ */ I(Dt, { author: e })
|
|
1500
1602
|
}), /* @__PURE__ */ L("div", {
|
|
1501
1603
|
className: "min-w-0 flex-1",
|
|
1502
1604
|
children: [
|
|
@@ -1505,16 +1607,16 @@ function Ft({ speaker: e, entries: t, questions: n, docked: r }) {
|
|
|
1505
1607
|
children: [/* @__PURE__ */ I("span", {
|
|
1506
1608
|
className: "truncate text-xs font-medium text-foreground",
|
|
1507
1609
|
children: e.name
|
|
1508
|
-
}), i.length > 0 && /* @__PURE__ */ I(
|
|
1610
|
+
}), i.length > 0 && /* @__PURE__ */ I(At, {
|
|
1509
1611
|
parts: i,
|
|
1510
1612
|
open: o,
|
|
1511
1613
|
onToggle: () => s((e) => !e)
|
|
1512
1614
|
})]
|
|
1513
1615
|
}),
|
|
1514
|
-
o && i.length > 0 && /* @__PURE__ */ I(
|
|
1616
|
+
o && i.length > 0 && /* @__PURE__ */ I(zt, { parts: i }),
|
|
1515
1617
|
/* @__PURE__ */ I("ul", {
|
|
1516
1618
|
className: "space-y-0.5",
|
|
1517
|
-
children: t.map((e, t) => /* @__PURE__ */ I(
|
|
1619
|
+
children: t.map((e, t) => /* @__PURE__ */ I(Rt, {
|
|
1518
1620
|
entry: e,
|
|
1519
1621
|
questions: n,
|
|
1520
1622
|
hiddenPartId: r?.entry.id === e.id ? r.part.id : void 0,
|
|
@@ -1525,7 +1627,7 @@ function Ft({ speaker: e, entries: t, questions: n, docked: r }) {
|
|
|
1525
1627
|
})]
|
|
1526
1628
|
});
|
|
1527
1629
|
}
|
|
1528
|
-
function
|
|
1630
|
+
function Vt({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i, speaker: a, showAuthors: o, events: s }) {
|
|
1529
1631
|
if (e.length === 0 && !s?.length) return null;
|
|
1530
1632
|
let c = o ?? (!!a || e.some((e) => e.kind === "user" && e.author)), l = [];
|
|
1531
1633
|
for (let t of e) t.kind === "user" || l.length === 0 ? l.push(t.kind === "user" ? {
|
|
@@ -1535,79 +1637,79 @@ function It({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, mes
|
|
|
1535
1637
|
let u = rt(l.map((e) => (e.user ?? e.entries[0])?.at), s ?? []);
|
|
1536
1638
|
return /* @__PURE__ */ L("ul", {
|
|
1537
1639
|
className: "space-y-0.5",
|
|
1538
|
-
children: [l.map((e, o) => /* @__PURE__ */ L(
|
|
1640
|
+
children: [l.map((e, o) => /* @__PURE__ */ L(O.Fragment, { children: [u[o].map((e) => /* @__PURE__ */ I(gt, { event: e }, e.id)), /* @__PURE__ */ L("li", { children: [e.user && /* @__PURE__ */ I(jt, {
|
|
1539
1641
|
entry: e.user,
|
|
1540
1642
|
pinned: r,
|
|
1541
1643
|
actions: i,
|
|
1542
|
-
cut:
|
|
1644
|
+
cut: Tt(e.entries),
|
|
1543
1645
|
showAuthor: c
|
|
1544
|
-
}), a && e.entries.length > 0 ? /* @__PURE__ */ I(
|
|
1646
|
+
}), a && e.entries.length > 0 ? /* @__PURE__ */ I(Bt, {
|
|
1545
1647
|
speaker: a,
|
|
1546
1648
|
entries: e.entries,
|
|
1547
1649
|
questions: t,
|
|
1548
1650
|
docked: n
|
|
1549
1651
|
}) : e.entries.length > 0 && /* @__PURE__ */ I("ul", {
|
|
1550
1652
|
className: "space-y-0.5",
|
|
1551
|
-
children: e.entries.map((e) => /* @__PURE__ */ I(
|
|
1653
|
+
children: e.entries.map((e) => /* @__PURE__ */ I(Rt, {
|
|
1552
1654
|
entry: e,
|
|
1553
1655
|
questions: t,
|
|
1554
1656
|
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
1555
1657
|
}, e.id))
|
|
1556
|
-
})] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */ I(
|
|
1658
|
+
})] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */ I(gt, { event: e }, e.id))]
|
|
1557
1659
|
});
|
|
1558
1660
|
}
|
|
1559
1661
|
//#endregion
|
|
1560
1662
|
//#region src/presentation/panelWidth.ts
|
|
1561
|
-
var
|
|
1562
|
-
function
|
|
1663
|
+
var Ht = 420, Ut = 320, Wt = "60vw", Gt = "agentico:panel-width";
|
|
1664
|
+
function Kt(e, t) {
|
|
1563
1665
|
if (typeof e == "number") return e;
|
|
1564
1666
|
let n = Number.parseFloat(e);
|
|
1565
1667
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1566
1668
|
}
|
|
1567
|
-
function
|
|
1669
|
+
function qt(e, t, n) {
|
|
1568
1670
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1569
1671
|
}
|
|
1570
|
-
function
|
|
1672
|
+
function Jt() {
|
|
1571
1673
|
try {
|
|
1572
|
-
let e = window.localStorage.getItem(
|
|
1674
|
+
let e = window.localStorage.getItem(Gt), t = e === null ? NaN : Number(e);
|
|
1573
1675
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1574
1676
|
} catch {
|
|
1575
1677
|
return null;
|
|
1576
1678
|
}
|
|
1577
1679
|
}
|
|
1578
|
-
function
|
|
1680
|
+
function Yt(e) {
|
|
1579
1681
|
try {
|
|
1580
|
-
e === null ? window.localStorage.removeItem(
|
|
1682
|
+
e === null ? window.localStorage.removeItem(Gt) : window.localStorage.setItem(Gt, String(e));
|
|
1581
1683
|
} catch {}
|
|
1582
1684
|
}
|
|
1583
|
-
function
|
|
1685
|
+
function Xt() {
|
|
1584
1686
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1585
1687
|
}
|
|
1586
|
-
function
|
|
1587
|
-
let [i, a] =
|
|
1688
|
+
function Zt({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = Wt, onWidthChange: r }) {
|
|
1689
|
+
let [i, a] = P(Xt), [o, s] = P(() => Jt() ?? e);
|
|
1588
1690
|
j(() => {
|
|
1589
1691
|
if (typeof window > "u") return;
|
|
1590
1692
|
let e = () => a(window.innerWidth);
|
|
1591
1693
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1592
1694
|
}, []);
|
|
1593
|
-
let c = t, l = Math.max(c,
|
|
1695
|
+
let c = t, l = Math.max(c, Kt(n, i)), u = qt(o, c, l);
|
|
1594
1696
|
return j(() => {
|
|
1595
1697
|
r?.(u);
|
|
1596
1698
|
}, [u]), {
|
|
1597
1699
|
width: u,
|
|
1598
1700
|
min: c,
|
|
1599
1701
|
max: l,
|
|
1600
|
-
set: k((e) => s(
|
|
1601
|
-
commit: k((e) =>
|
|
1702
|
+
set: k((e) => s(qt(e, c, l)), [c, l]),
|
|
1703
|
+
commit: k((e) => Yt(qt(e, c, l)), [c, l]),
|
|
1602
1704
|
reset: k(() => {
|
|
1603
|
-
s(e),
|
|
1705
|
+
s(e), Yt(null);
|
|
1604
1706
|
}, [e])
|
|
1605
1707
|
};
|
|
1606
1708
|
}
|
|
1607
1709
|
//#endregion
|
|
1608
1710
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1609
|
-
function
|
|
1610
|
-
let o = $(), s =
|
|
1711
|
+
function Qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1712
|
+
let o = $(), s = N(null), [c, l] = P(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1611
1713
|
let t = s.current;
|
|
1612
1714
|
if (t && t.pointerId === e.pointerId) {
|
|
1613
1715
|
s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
|
|
@@ -1664,8 +1766,8 @@ function qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1664
1766
|
}
|
|
1665
1767
|
//#endregion
|
|
1666
1768
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1667
|
-
function
|
|
1668
|
-
let { isOpen: n, toggleOpen: r, task: i } =
|
|
1769
|
+
function $t({ className: e = "" }) {
|
|
1770
|
+
let { isOpen: n, toggleOpen: r, task: i } = ft(), a = $(), o = i?.agent.running ?? !1;
|
|
1669
1771
|
return /* @__PURE__ */ I(t, {
|
|
1670
1772
|
icon: "bot",
|
|
1671
1773
|
ariaLabel: n ? a.closePanel : a.openPanel,
|
|
@@ -1677,21 +1779,21 @@ function Jt({ className: e = "" }) {
|
|
|
1677
1779
|
}
|
|
1678
1780
|
//#endregion
|
|
1679
1781
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1680
|
-
var
|
|
1681
|
-
function
|
|
1782
|
+
var en = "llmnative-cms.selectedAIModel";
|
|
1783
|
+
function tn() {
|
|
1682
1784
|
try {
|
|
1683
|
-
return localStorage.getItem(
|
|
1785
|
+
return localStorage.getItem(en) ?? "";
|
|
1684
1786
|
} catch {
|
|
1685
1787
|
return "";
|
|
1686
1788
|
}
|
|
1687
1789
|
}
|
|
1688
|
-
function
|
|
1790
|
+
function nn(e) {
|
|
1689
1791
|
try {
|
|
1690
|
-
e ? localStorage.setItem(
|
|
1792
|
+
e ? localStorage.setItem(en, e) : localStorage.removeItem(en);
|
|
1691
1793
|
} catch {}
|
|
1692
1794
|
}
|
|
1693
|
-
function
|
|
1694
|
-
let e = T()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] =
|
|
1795
|
+
function rn() {
|
|
1796
|
+
let e = T()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = P({}), [i, a] = P(!1), [o, s] = P(tn);
|
|
1695
1797
|
return j(() => {
|
|
1696
1798
|
if (!t) {
|
|
1697
1799
|
r({});
|
|
@@ -1702,7 +1804,7 @@ function Qt() {
|
|
|
1702
1804
|
if (n) return;
|
|
1703
1805
|
r(e.modelsByProvider);
|
|
1704
1806
|
let t = Object.values(e.modelsByProvider).flat();
|
|
1705
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1807
|
+
s((e) => t.some((t) => t.id === e) ? e : (nn(""), ""));
|
|
1706
1808
|
}).catch((e) => {
|
|
1707
1809
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
1708
1810
|
}).finally(() => {
|
|
@@ -1716,17 +1818,17 @@ function Qt() {
|
|
|
1716
1818
|
modelsLoading: i,
|
|
1717
1819
|
selectedModel: o,
|
|
1718
1820
|
setSelectedModel: (e) => {
|
|
1719
|
-
|
|
1821
|
+
nn(e), s(e);
|
|
1720
1822
|
}
|
|
1721
1823
|
};
|
|
1722
1824
|
}
|
|
1723
1825
|
//#endregion
|
|
1724
1826
|
//#region src/domain/approval.ts
|
|
1725
|
-
var
|
|
1726
|
-
function
|
|
1827
|
+
var an = "approval";
|
|
1828
|
+
function on(e, t) {
|
|
1727
1829
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1728
1830
|
}
|
|
1729
|
-
function
|
|
1831
|
+
function sn(e, t, n) {
|
|
1730
1832
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1731
1833
|
return {
|
|
1732
1834
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1735,11 +1837,11 @@ function tn(e, t, n) {
|
|
|
1735
1837
|
}
|
|
1736
1838
|
//#endregion
|
|
1737
1839
|
//#region src/presentation/useAgent.ts
|
|
1738
|
-
var
|
|
1739
|
-
function
|
|
1740
|
-
return e.filter((e) => !y.isTextAttachment(e.mimeType) || e.base64.length <=
|
|
1840
|
+
var cn = 20, ln = 26e4;
|
|
1841
|
+
function un(e) {
|
|
1842
|
+
return e.filter((e) => !y.isTextAttachment(e.mimeType) || e.base64.length <= ln);
|
|
1741
1843
|
}
|
|
1742
|
-
function
|
|
1844
|
+
function dn(e) {
|
|
1743
1845
|
return e.map((e) => e.status !== "running" && !e.parts?.some((e) => e.type === "tool" && e.status === "running" || (e.type === "text" || e.type === "reasoning") && e.streaming) ? e : {
|
|
1744
1846
|
...e,
|
|
1745
1847
|
status: e.status === "running" ? "stopped" : e.status,
|
|
@@ -1752,10 +1854,10 @@ function on(e) {
|
|
|
1752
1854
|
} : e) } : {}
|
|
1753
1855
|
});
|
|
1754
1856
|
}
|
|
1755
|
-
function
|
|
1756
|
-
let { defaultEnabled: n = !1 } = t, r =
|
|
1857
|
+
function fn(e, t = {}) {
|
|
1858
|
+
let { defaultEnabled: n = !1 } = t, r = N(t.author);
|
|
1757
1859
|
r.current = t.author;
|
|
1758
|
-
let [i, a] =
|
|
1860
|
+
let [i, a] = P(n), { hasProviders: o, modelsByProvider: s, modelsLoading: c, selectedModel: l, setSelectedModel: u } = rn(), [d, f] = P(!1), [p, m] = P(null), [h, g] = P(!1), [_, v] = P([]), b = N([]), x = (e, t) => {
|
|
1759
1861
|
v((n) => {
|
|
1760
1862
|
let r = typeof e == "function" ? e(n) : e;
|
|
1761
1863
|
if (t?.stamp !== !1) {
|
|
@@ -1770,29 +1872,36 @@ function sn(e, t = {}) {
|
|
|
1770
1872
|
}
|
|
1771
1873
|
return b.current = r, r;
|
|
1772
1874
|
});
|
|
1773
|
-
}, S =
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1875
|
+
}, S = (e, t) => {
|
|
1876
|
+
t?.some((e) => e.type.startsWith("image/")) && st(t).then((t) => {
|
|
1877
|
+
t.length && x((n) => n.map((n) => n.id === e ? {
|
|
1878
|
+
...n,
|
|
1879
|
+
attachmentPreviews: t
|
|
1880
|
+
} : n));
|
|
1881
|
+
});
|
|
1882
|
+
}, w = N(/* @__PURE__ */ new Map()), ee = $(), E = N(ee);
|
|
1883
|
+
E.current = ee;
|
|
1884
|
+
let D = N(null), O = N(!1), te = N(null), k = N(null), A = N(null), j = () => {
|
|
1885
|
+
A.current?.abort();
|
|
1886
|
+
}, ne = T()?.registry ?? {}, [F, I] = P(void 0), L = N(void 0), R = (e, t) => {
|
|
1778
1887
|
if (!t) return !1;
|
|
1779
1888
|
if (!e) return !0;
|
|
1780
1889
|
let n = C(t);
|
|
1781
1890
|
return !!n && e.includes(n.provider);
|
|
1782
|
-
},
|
|
1783
|
-
Y.current = e,
|
|
1784
|
-
},
|
|
1785
|
-
let t =
|
|
1786
|
-
|
|
1787
|
-
let n =
|
|
1788
|
-
|
|
1789
|
-
let r =
|
|
1790
|
-
|
|
1791
|
-
},
|
|
1891
|
+
}, V = M(() => F ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, t.filter((e) => F.includes(e.provider))]).filter(([, e]) => e.length)) : s, [F, s]), H = R(F, l) ? l : Object.values(V).flat()[0]?.id ?? "", U = i && H ? C(H) : null, ae = U ? ne[U.provider] : null, W = e.executor, G = !!W?.alongside, K = !!W && !G, q = !W || !!W.canRewind, se = !!W?.attachments, ce = async (e) => se && e?.length ? Promise.all(e.map((e) => y.fileToAttachment(e))) : void 0, le = N([]), ue = (e) => !!e && le.current.some((t) => t.value === e), de = N(!1), [fe, pe] = P([]), [me, he] = P(""), Y = N(""), ge = (e) => {
|
|
1892
|
+
Y.current = e, he(e);
|
|
1893
|
+
}, _e = (e) => {
|
|
1894
|
+
let t = W?.models?.(e) ?? [];
|
|
1895
|
+
le.current = t, pe(t);
|
|
1896
|
+
let n = W?.catalogProviders?.(e);
|
|
1897
|
+
L.current = n, I(n);
|
|
1898
|
+
let r = G && !R(n, l) ? t[0]?.value : void 0;
|
|
1899
|
+
ge(W?.defaultModel?.(e) ?? r ?? "");
|
|
1900
|
+
}, X = async (e, t, n, r, i) => {
|
|
1792
1901
|
let a = D.current;
|
|
1793
|
-
if (!a || !
|
|
1902
|
+
if (!a || !W) return m(E.current.noActiveSession), null;
|
|
1794
1903
|
let o = new AbortController();
|
|
1795
|
-
|
|
1904
|
+
A.current = o;
|
|
1796
1905
|
let s = crypto.randomUUID();
|
|
1797
1906
|
x((e) => [...e, {
|
|
1798
1907
|
id: s,
|
|
@@ -1807,14 +1916,14 @@ function sn(e, t = {}) {
|
|
|
1807
1916
|
duration: e.duration ?? l(e.id)
|
|
1808
1917
|
}), d = (e, t) => x((n) => n.map((n) => {
|
|
1809
1918
|
if (n.id !== s) return n;
|
|
1810
|
-
let r = e(n.parts ?? []), i =
|
|
1919
|
+
let r = e(n.parts ?? []), i = z(r);
|
|
1811
1920
|
return {
|
|
1812
1921
|
...n,
|
|
1813
1922
|
parts: r,
|
|
1814
1923
|
...t ? { status: t } : {},
|
|
1815
1924
|
...i ? { detail: i } : {}
|
|
1816
1925
|
};
|
|
1817
|
-
})), f = (e) => d((t) =>
|
|
1926
|
+
})), f = (e) => d((t) => ie(t, e, u)), p = !1, h = (e, t) => {
|
|
1818
1927
|
t?.id && t.id !== "text" && (p = !0), f({
|
|
1819
1928
|
type: "text",
|
|
1820
1929
|
id: t?.id ?? "text",
|
|
@@ -1838,17 +1947,17 @@ function sn(e, t = {}) {
|
|
|
1838
1947
|
}), v = (e) => f({
|
|
1839
1948
|
...e,
|
|
1840
1949
|
type: "card"
|
|
1841
|
-
}), y = /* @__PURE__ */ new Set(),
|
|
1950
|
+
}), y = /* @__PURE__ */ new Set(), S = 0, C = () => {
|
|
1842
1951
|
for (let e of y) {
|
|
1843
|
-
let t =
|
|
1844
|
-
|
|
1952
|
+
let t = w.current.get(e);
|
|
1953
|
+
w.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
|
|
1845
1954
|
}
|
|
1846
1955
|
y.clear();
|
|
1847
1956
|
};
|
|
1848
|
-
o.signal.addEventListener("abort",
|
|
1957
|
+
o.signal.addEventListener("abort", C);
|
|
1849
1958
|
let T = (e, t) => {
|
|
1850
|
-
|
|
1851
|
-
let n = t?.id ?? `questions-${
|
|
1959
|
+
S += 1;
|
|
1960
|
+
let n = t?.id ?? `questions-${S}`;
|
|
1852
1961
|
f({
|
|
1853
1962
|
type: "questions",
|
|
1854
1963
|
id: n,
|
|
@@ -1856,15 +1965,15 @@ function sn(e, t = {}) {
|
|
|
1856
1965
|
});
|
|
1857
1966
|
let r = `${s}:${n}`;
|
|
1858
1967
|
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (y.add(r), new Promise((e, t) => {
|
|
1859
|
-
|
|
1968
|
+
w.current.set(r, {
|
|
1860
1969
|
resolve: e,
|
|
1861
1970
|
reject: t
|
|
1862
1971
|
});
|
|
1863
1972
|
}));
|
|
1864
|
-
},
|
|
1865
|
-
d((n) => (t && !p ?
|
|
1973
|
+
}, ee = (e, t) => {
|
|
1974
|
+
d((n) => (t && !p ? ie(n, {
|
|
1866
1975
|
type: "text",
|
|
1867
|
-
id:
|
|
1976
|
+
id: re,
|
|
1868
1977
|
text: t,
|
|
1869
1978
|
streaming: !1
|
|
1870
1979
|
}, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
|
|
@@ -1873,14 +1982,14 @@ function sn(e, t = {}) {
|
|
|
1873
1982
|
} : t.type === "tool" && t.status === "running" && e !== "done" ? {
|
|
1874
1983
|
...t,
|
|
1875
1984
|
status: "stopped"
|
|
1876
|
-
} : t), e), o.signal.removeEventListener("abort",
|
|
1877
|
-
for (let e of y)
|
|
1985
|
+
} : t), e), o.signal.removeEventListener("abort", C);
|
|
1986
|
+
for (let e of y) w.current.delete(e);
|
|
1878
1987
|
y.clear();
|
|
1879
|
-
},
|
|
1988
|
+
}, O = e || r?.historyText || "";
|
|
1880
1989
|
try {
|
|
1881
|
-
let c =
|
|
1882
|
-
|
|
1883
|
-
let l = b.current, u = l.findIndex((e) => e.id ===
|
|
1990
|
+
let c = te.current;
|
|
1991
|
+
te.current = null;
|
|
1992
|
+
let l = b.current, u = l.findIndex((e) => e.id === k.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({
|
|
1884
1993
|
params: a.params,
|
|
1885
1994
|
context: a.context,
|
|
1886
1995
|
text: e,
|
|
@@ -1899,11 +2008,11 @@ function sn(e, t = {}) {
|
|
|
1899
2008
|
onQuestions: T,
|
|
1900
2009
|
onCard: v
|
|
1901
2010
|
});
|
|
1902
|
-
return
|
|
2011
|
+
return ee("done", f.text), a.history = [
|
|
1903
2012
|
...a.history,
|
|
1904
|
-
...
|
|
2013
|
+
...O ? [{
|
|
1905
2014
|
role: "user",
|
|
1906
|
-
content:
|
|
2015
|
+
content: O
|
|
1907
2016
|
}] : [],
|
|
1908
2017
|
{
|
|
1909
2018
|
role: "assistant",
|
|
@@ -1911,14 +2020,14 @@ function sn(e, t = {}) {
|
|
|
1911
2020
|
}
|
|
1912
2021
|
], f.result ?? null;
|
|
1913
2022
|
} catch (e) {
|
|
1914
|
-
return a.history = [...a.history, ...
|
|
2023
|
+
return a.history = [...a.history, ...O ? [{
|
|
1915
2024
|
role: "user",
|
|
1916
|
-
content:
|
|
1917
|
-
}] : []], o.signal.aborted ? (
|
|
2025
|
+
content: O
|
|
2026
|
+
}] : []], o.signal.aborted ? (ee("stopped"), null) : (ee("error"), m(be(e)), null);
|
|
1918
2027
|
} finally {
|
|
1919
|
-
|
|
2028
|
+
A.current = null;
|
|
1920
2029
|
}
|
|
1921
|
-
},
|
|
2030
|
+
}, ve = async (t, n, r) => {
|
|
1922
2031
|
let i = b.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = D.current;
|
|
1923
2032
|
if (!i || !a || !e.onCardAction) return;
|
|
1924
2033
|
let o;
|
|
@@ -1937,7 +2046,7 @@ function sn(e, t = {}) {
|
|
|
1937
2046
|
outcome: o
|
|
1938
2047
|
} : e)
|
|
1939
2048
|
} : e));
|
|
1940
|
-
},
|
|
2049
|
+
}, xe = async (e, t, n) => {
|
|
1941
2050
|
let r = b.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1942
2051
|
if (!r || r.type !== "questions") throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
|
|
1943
2052
|
let i = () => x((r) => r.map((r) => r.id === e ? {
|
|
@@ -1946,27 +2055,27 @@ function sn(e, t = {}) {
|
|
|
1946
2055
|
...e,
|
|
1947
2056
|
answers: n
|
|
1948
2057
|
} : e)
|
|
1949
|
-
} : r)), a = `${e}:${t}`, o =
|
|
1950
|
-
if (o) return
|
|
2058
|
+
} : r)), a = `${e}:${t}`, o = w.current.get(a);
|
|
2059
|
+
if (o) return w.current.delete(a), i(), o.resolve(n), null;
|
|
1951
2060
|
if (O.current) throw m(E.current.requestInProgress), Error(E.current.requestInProgress);
|
|
1952
|
-
if (!
|
|
2061
|
+
if (!K || !D.current) throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
|
|
1953
2062
|
O.current = !0, f(!0), m(null), i();
|
|
1954
2063
|
try {
|
|
1955
|
-
return await
|
|
2064
|
+
return await X("", !1, void 0, {
|
|
1956
2065
|
id: t,
|
|
1957
2066
|
answers: n,
|
|
1958
|
-
historyText:
|
|
2067
|
+
historyText: B(r.questions, n)
|
|
1959
2068
|
});
|
|
1960
2069
|
} finally {
|
|
1961
2070
|
O.current = !1, f(!1);
|
|
1962
2071
|
}
|
|
1963
|
-
},
|
|
1964
|
-
let i =
|
|
2072
|
+
}, Se = async (t, n, r) => {
|
|
2073
|
+
let i = L.current, a = Object.values(s).flat().find((e) => !i || i.includes(e.provider))?.id, o = r && R(i, r) ? r : R(i, H) ? void 0 : a, c = o ? C(o) : U, l = c && D.current ? W?.catalogReasoning?.(D.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = D.current;
|
|
1965
2074
|
if (!d) return m(E.current.noActiveSession), null;
|
|
1966
|
-
let f = o ? C(o) : U, p = f ?
|
|
2075
|
+
let f = o ? C(o) : U, p = f ? ne[f.provider] : null;
|
|
1967
2076
|
if (!p || !f) return m(E.current.noProviderAvailable), null;
|
|
1968
2077
|
n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
|
|
1969
|
-
let h = (n ?? []).filter((e) => y.isTextAttachment(e.mimeType)).map((e) => e.base64.length <=
|
|
2078
|
+
let h = (n ?? []).filter((e) => y.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= ln ? `\n\n[File allegato: ${e.name}]\n${y.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 = un(n ?? []), _ = d.tools.map((e) => ({
|
|
1970
2079
|
name: e.name,
|
|
1971
2080
|
description: e.description,
|
|
1972
2081
|
inputSchema: oe(e.inputSchema)
|
|
@@ -1979,7 +2088,7 @@ function sn(e, t = {}) {
|
|
|
1979
2088
|
status: "running",
|
|
1980
2089
|
parts: [{
|
|
1981
2090
|
type: "questions",
|
|
1982
|
-
id:
|
|
2091
|
+
id: an,
|
|
1983
2092
|
questions: [{
|
|
1984
2093
|
header: i.approvalHeader,
|
|
1985
2094
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -1988,24 +2097,24 @@ function sn(e, t = {}) {
|
|
|
1988
2097
|
}]
|
|
1989
2098
|
}]
|
|
1990
2099
|
}]);
|
|
1991
|
-
let s = `${a}:${
|
|
2100
|
+
let s = `${a}:${an}`;
|
|
1992
2101
|
return new Promise((e, t) => {
|
|
1993
2102
|
let n = () => {
|
|
1994
|
-
|
|
2103
|
+
w.current.delete(s), T(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
1995
2104
|
};
|
|
1996
2105
|
if (r.aborted) {
|
|
1997
2106
|
n();
|
|
1998
2107
|
return;
|
|
1999
2108
|
}
|
|
2000
|
-
r.addEventListener("abort", n, { once: !0 }),
|
|
2109
|
+
r.addEventListener("abort", n, { once: !0 }), w.current.set(s, {
|
|
2001
2110
|
resolve: (t) => {
|
|
2002
|
-
r.removeEventListener("abort", n), T(a, "done"), e(
|
|
2111
|
+
r.removeEventListener("abort", n), T(a, "done"), e(sn(t, i.approve, i.reject));
|
|
2003
2112
|
},
|
|
2004
2113
|
reject: t
|
|
2005
2114
|
});
|
|
2006
2115
|
});
|
|
2007
|
-
}, b = new Map(d.tools.map((e) => [e.name, e])),
|
|
2008
|
-
|
|
2116
|
+
}, b = new Map(d.tools.map((e) => [e.name, e])), S = new AbortController();
|
|
2117
|
+
A.current = S;
|
|
2009
2118
|
let T = (e, t, n, r) => x((i) => i.map((i) => i.id === e ? {
|
|
2010
2119
|
...i,
|
|
2011
2120
|
status: t,
|
|
@@ -2014,7 +2123,7 @@ function sn(e, t = {}) {
|
|
|
2014
2123
|
} : i));
|
|
2015
2124
|
try {
|
|
2016
2125
|
let n = d.history, r = t;
|
|
2017
|
-
for (let t = 0; t <
|
|
2126
|
+
for (let t = 0; t < cn; t++) {
|
|
2018
2127
|
let i = crypto.randomUUID();
|
|
2019
2128
|
x((e) => [...e, {
|
|
2020
2129
|
id: i,
|
|
@@ -2030,7 +2139,7 @@ function sn(e, t = {}) {
|
|
|
2030
2139
|
...u,
|
|
2031
2140
|
history: n,
|
|
2032
2141
|
tools: _.length ? _ : void 0,
|
|
2033
|
-
signal:
|
|
2142
|
+
signal: S.signal,
|
|
2034
2143
|
attachments: t === 0 ? g : void 0,
|
|
2035
2144
|
logId: d.logId
|
|
2036
2145
|
});
|
|
@@ -2038,12 +2147,12 @@ function sn(e, t = {}) {
|
|
|
2038
2147
|
return d.history = [...n, ...r ? [{
|
|
2039
2148
|
role: "user",
|
|
2040
2149
|
content: r + h
|
|
2041
|
-
}] : []],
|
|
2150
|
+
}] : []], S.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(be(t)), null);
|
|
2042
2151
|
}
|
|
2043
2152
|
if (d.history = [...n, ...r ? [{
|
|
2044
2153
|
role: "user",
|
|
2045
2154
|
content: r + h
|
|
2046
|
-
}] : []], !a) return
|
|
2155
|
+
}] : []], !a) return S.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(E.current.noProviderResponse), null);
|
|
2047
2156
|
if (a.type === "text") return T(i, "done", a.text), e.conversational && a.text.trim() && x((e) => e.map((e) => e.id === i ? {
|
|
2048
2157
|
...e,
|
|
2049
2158
|
parts: [{
|
|
@@ -2074,8 +2183,8 @@ function sn(e, t = {}) {
|
|
|
2074
2183
|
let s = /* @__PURE__ */ new Map();
|
|
2075
2184
|
for (let t of a.toolCalls) {
|
|
2076
2185
|
let n = b.get(t.name);
|
|
2077
|
-
if (n &&
|
|
2078
|
-
s.set(t.id, await v(t.id, n, t.input,
|
|
2186
|
+
if (n && on(n, t.input)) try {
|
|
2187
|
+
s.set(t.id, await v(t.id, n, t.input, S.signal));
|
|
2079
2188
|
} catch {
|
|
2080
2189
|
return e.fallback(d.params, d.context);
|
|
2081
2190
|
}
|
|
@@ -2166,7 +2275,7 @@ function sn(e, t = {}) {
|
|
|
2166
2275
|
prompt: ye(J().stopCallingTools, e.microPromptIds),
|
|
2167
2276
|
model: f.model,
|
|
2168
2277
|
history: n,
|
|
2169
|
-
signal:
|
|
2278
|
+
signal: S.signal,
|
|
2170
2279
|
logId: d.logId
|
|
2171
2280
|
});
|
|
2172
2281
|
} catch {
|
|
@@ -2179,15 +2288,17 @@ function sn(e, t = {}) {
|
|
|
2179
2288
|
}];
|
|
2180
2289
|
let t = e.parseResponse(a.text, d.params, d.context);
|
|
2181
2290
|
if (t) return t;
|
|
2182
|
-
} else T(i,
|
|
2183
|
-
return
|
|
2291
|
+
} else T(i, S.signal.aborted ? "stopped" : "error"), d.history = n;
|
|
2292
|
+
return S.signal.aborted || m(E.current.tooManyToolTurns), e.fallback(d.params, d.context);
|
|
2184
2293
|
} finally {
|
|
2185
|
-
|
|
2294
|
+
A.current = null;
|
|
2186
2295
|
}
|
|
2187
|
-
},
|
|
2296
|
+
}, Ce = async (t, n) => {
|
|
2188
2297
|
if (O.current) return m(E.current.requestInProgress), null;
|
|
2189
|
-
O.current = !0, m(null)
|
|
2190
|
-
|
|
2298
|
+
O.current = !0, m(null);
|
|
2299
|
+
let a = crypto.randomUUID();
|
|
2300
|
+
n?.openingMessage && S(a, n.attachments), x(n?.openingMessage ? [{
|
|
2301
|
+
id: a,
|
|
2191
2302
|
kind: "user",
|
|
2192
2303
|
label: "Tu",
|
|
2193
2304
|
status: "done",
|
|
@@ -2204,13 +2315,13 @@ function sn(e, t = {}) {
|
|
|
2204
2315
|
history: [],
|
|
2205
2316
|
logId: crypto.randomUUID(),
|
|
2206
2317
|
attachmentsRef: a
|
|
2207
|
-
},
|
|
2208
|
-
if (
|
|
2209
|
-
|
|
2318
|
+
}, K) return g(!0), _e(t), await X(n?.openingMessage ?? "", !0, void 0, void 0, await ce(n?.attachments));
|
|
2319
|
+
if (G) {
|
|
2320
|
+
_e(t), de.current = !1;
|
|
2210
2321
|
let e = n?.model || Y.current;
|
|
2211
|
-
if (
|
|
2322
|
+
if (ue(e)) return g(!0), de.current = !0, await X(n?.openingMessage ?? "", !0, e, void 0, await ce(n?.attachments));
|
|
2212
2323
|
}
|
|
2213
|
-
let s = n?.model || void 0, c = s ? !!
|
|
2324
|
+
let s = n?.model || void 0, c = s ? !!ne[C(s)?.provider ?? ""] : !!ae;
|
|
2214
2325
|
if (!i || !c) {
|
|
2215
2326
|
g(!1);
|
|
2216
2327
|
let n = e.fallback(t, r);
|
|
@@ -2223,18 +2334,18 @@ function sn(e, t = {}) {
|
|
|
2223
2334
|
}
|
|
2224
2335
|
g(!0);
|
|
2225
2336
|
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, u = ye(e.buildPrompt(t, r), e.microPromptIds);
|
|
2226
|
-
return await
|
|
2337
|
+
return await Se(u, l, s);
|
|
2227
2338
|
} catch (e) {
|
|
2228
2339
|
return m(be(e)), null;
|
|
2229
2340
|
} finally {
|
|
2230
2341
|
O.current = !1, f(!1);
|
|
2231
2342
|
}
|
|
2232
|
-
},
|
|
2343
|
+
}, we = async (t, n) => {
|
|
2233
2344
|
if (O.current) {
|
|
2234
2345
|
m(E.current.requestInProgress);
|
|
2235
2346
|
return;
|
|
2236
2347
|
}
|
|
2237
|
-
O.current = !0, m(null), x(
|
|
2348
|
+
O.current = !0, m(null), x(dn(n.activity), { stamp: !1 }), f(!0);
|
|
2238
2349
|
try {
|
|
2239
2350
|
let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
|
|
2240
2351
|
D.current = {
|
|
@@ -2244,20 +2355,20 @@ function sn(e, t = {}) {
|
|
|
2244
2355
|
history: n.history,
|
|
2245
2356
|
logId: crypto.randomUUID(),
|
|
2246
2357
|
attachmentsRef: a
|
|
2247
|
-
}, (
|
|
2358
|
+
}, (K || G) && _e(t), de.current = !1, g(K || G || i && !!ae);
|
|
2248
2359
|
} catch (e) {
|
|
2249
2360
|
m(be(e));
|
|
2250
2361
|
} finally {
|
|
2251
2362
|
O.current = !1, f(!1);
|
|
2252
2363
|
}
|
|
2253
|
-
},
|
|
2364
|
+
}, Te = async (t, n) => {
|
|
2254
2365
|
if (O.current) return m(E.current.requestInProgress), null;
|
|
2255
2366
|
if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
|
|
2256
2367
|
let i = D.current;
|
|
2257
2368
|
if (!i) return m(E.current.noActiveSession), null;
|
|
2258
2369
|
O.current = !0, f(!0);
|
|
2259
2370
|
let a = crypto.randomUUID();
|
|
2260
|
-
|
|
2371
|
+
k.current = a, S(a, n?.attachments), x((e) => [...e, {
|
|
2261
2372
|
id: a,
|
|
2262
2373
|
kind: "user",
|
|
2263
2374
|
label: "Tu",
|
|
@@ -2269,26 +2380,26 @@ function sn(e, t = {}) {
|
|
|
2269
2380
|
historyAt: i.history.length
|
|
2270
2381
|
}]);
|
|
2271
2382
|
try {
|
|
2272
|
-
if (
|
|
2273
|
-
let r = n?.model || (
|
|
2274
|
-
if (
|
|
2275
|
-
let e = !
|
|
2276
|
-
return
|
|
2383
|
+
if (K) return await X(t, !1, n?.model || void 0, void 0, await ce(n?.attachments));
|
|
2384
|
+
let r = n?.model || (G ? Y.current : "");
|
|
2385
|
+
if (G && ue(r)) {
|
|
2386
|
+
let e = !de.current;
|
|
2387
|
+
return de.current = !0, await X(t, e, r, void 0, await ce(n?.attachments));
|
|
2277
2388
|
}
|
|
2278
|
-
|
|
2279
|
-
...
|
|
2389
|
+
te.current &&= {
|
|
2390
|
+
...te.current,
|
|
2280
2391
|
fresh: !1
|
|
2281
2392
|
};
|
|
2282
2393
|
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, o = ye(e.buildFollowUpPrompt(t, i.params, i.context), e.microPromptIds);
|
|
2283
|
-
return await
|
|
2394
|
+
return await Se(o, a, n?.model || void 0);
|
|
2284
2395
|
} catch (e) {
|
|
2285
2396
|
return m(be(e)), null;
|
|
2286
2397
|
} finally {
|
|
2287
2398
|
O.current = !1, f(!1);
|
|
2288
2399
|
}
|
|
2289
|
-
},
|
|
2400
|
+
}, Ee = (e) => {
|
|
2290
2401
|
let t = D.current, n = _.findIndex((t) => t.id === e), r = _[n], i = r?.detail?.trim();
|
|
2291
|
-
if (!
|
|
2402
|
+
if (!q || !t || !r || r.kind !== "user" || !i) return;
|
|
2292
2403
|
if (r.historyAt !== void 0) return r.historyAt;
|
|
2293
2404
|
let a = _.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
|
|
2294
2405
|
for (let e = 0; e < t.history.length; e += 1) {
|
|
@@ -2299,18 +2410,18 @@ function sn(e, t = {}) {
|
|
|
2299
2410
|
}
|
|
2300
2411
|
}
|
|
2301
2412
|
return n === _.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
|
|
2302
|
-
},
|
|
2413
|
+
}, De = (e) => Ee(e) !== void 0, Oe = async (e, t) => {
|
|
2303
2414
|
if (O.current) return m(E.current.requestInProgress), null;
|
|
2304
|
-
let n = D.current, r = _.findIndex((t) => t.id === e), i = _[r], a =
|
|
2415
|
+
let n = D.current, r = _.findIndex((t) => t.id === e), i = _[r], a = Ee(e);
|
|
2305
2416
|
if (!n || !i || a === void 0) return null;
|
|
2306
2417
|
let o = (t ?? i.detail ?? "").trim();
|
|
2307
2418
|
if (!o) return null;
|
|
2308
2419
|
let s = _.slice(0, r);
|
|
2309
|
-
return n.history = n.history.slice(0, a),
|
|
2420
|
+
return n.history = n.history.slice(0, a), te.current = {
|
|
2310
2421
|
activity: s,
|
|
2311
2422
|
fresh: !0
|
|
2312
|
-
}, x(s),
|
|
2313
|
-
},
|
|
2423
|
+
}, x(s), Te(o);
|
|
2424
|
+
}, ke = () => {
|
|
2314
2425
|
let t = D.current;
|
|
2315
2426
|
if (!t) return null;
|
|
2316
2427
|
m(null);
|
|
@@ -2321,7 +2432,7 @@ function sn(e, t = {}) {
|
|
|
2321
2432
|
status: "done",
|
|
2322
2433
|
label: e.describeFallback?.(n) ?? E.current.continueWithoutAiFallback
|
|
2323
2434
|
}]), n;
|
|
2324
|
-
},
|
|
2435
|
+
}, Ae = () => D.current ? {
|
|
2325
2436
|
history: D.current.history,
|
|
2326
2437
|
activity: _
|
|
2327
2438
|
} : null;
|
|
@@ -2329,54 +2440,54 @@ function sn(e, t = {}) {
|
|
|
2329
2440
|
enabled: i,
|
|
2330
2441
|
setEnabled: a,
|
|
2331
2442
|
hasProviders: o,
|
|
2332
|
-
selectedModel:
|
|
2333
|
-
setSelectedModel:
|
|
2334
|
-
|
|
2443
|
+
selectedModel: K || G && me ? me : H,
|
|
2444
|
+
setSelectedModel: K ? ge : G ? (e) => {
|
|
2445
|
+
ue(e) ? ge(e) : (ge(""), u(e));
|
|
2335
2446
|
} : u,
|
|
2336
|
-
modelsByProvider:
|
|
2447
|
+
modelsByProvider: V,
|
|
2337
2448
|
modelsLoading: c,
|
|
2338
2449
|
running: d,
|
|
2339
2450
|
error: p,
|
|
2340
2451
|
canContinue: h,
|
|
2341
|
-
remote:
|
|
2342
|
-
remoteModels:
|
|
2343
|
-
alongside:
|
|
2344
|
-
...
|
|
2452
|
+
remote: K,
|
|
2453
|
+
remoteModels: fe,
|
|
2454
|
+
alongside: G,
|
|
2455
|
+
...W?.catalogGroup ? { catalogGroup: W.catalogGroup } : {},
|
|
2345
2456
|
activity: _,
|
|
2346
|
-
run:
|
|
2347
|
-
resume:
|
|
2348
|
-
sendMessage:
|
|
2349
|
-
stop:
|
|
2350
|
-
runFallback:
|
|
2351
|
-
snapshot:
|
|
2352
|
-
answerQuestions:
|
|
2353
|
-
cardAction:
|
|
2354
|
-
rewind:
|
|
2355
|
-
canRewind:
|
|
2356
|
-
rewindable:
|
|
2357
|
-
executorAttachments:
|
|
2457
|
+
run: Ce,
|
|
2458
|
+
resume: we,
|
|
2459
|
+
sendMessage: Te,
|
|
2460
|
+
stop: j,
|
|
2461
|
+
runFallback: ke,
|
|
2462
|
+
snapshot: Ae,
|
|
2463
|
+
answerQuestions: xe,
|
|
2464
|
+
cardAction: ve,
|
|
2465
|
+
rewind: Oe,
|
|
2466
|
+
canRewind: q,
|
|
2467
|
+
rewindable: De,
|
|
2468
|
+
executorAttachments: se,
|
|
2358
2469
|
offersFallback: e.offersFallback !== !1
|
|
2359
2470
|
};
|
|
2360
2471
|
}
|
|
2361
2472
|
//#endregion
|
|
2362
2473
|
//#region src/domain/orchestrator/prompt.ts
|
|
2363
|
-
function
|
|
2474
|
+
function pn() {
|
|
2364
2475
|
let e = J();
|
|
2365
2476
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
2366
2477
|
}
|
|
2367
|
-
function
|
|
2478
|
+
function mn(e, t, n) {
|
|
2368
2479
|
let r = J(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
2369
2480
|
return `${r.orchestratorIntro}
|
|
2370
2481
|
|
|
2371
2482
|
${r.toolsHeading}
|
|
2372
2483
|
${t}
|
|
2373
2484
|
${i}
|
|
2374
|
-
${
|
|
2485
|
+
${pn()}
|
|
2375
2486
|
|
|
2376
2487
|
${r.userRequestHeading}
|
|
2377
2488
|
${e}`;
|
|
2378
2489
|
}
|
|
2379
|
-
function
|
|
2490
|
+
function hn(e, t) {
|
|
2380
2491
|
return t ? {
|
|
2381
2492
|
kind: "handoff",
|
|
2382
2493
|
...t
|
|
@@ -2387,27 +2498,27 @@ function un(e, t) {
|
|
|
2387
2498
|
}
|
|
2388
2499
|
//#endregion
|
|
2389
2500
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
2390
|
-
function
|
|
2391
|
-
return
|
|
2501
|
+
function gn(e) {
|
|
2502
|
+
return ae().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
2392
2503
|
}
|
|
2393
|
-
function
|
|
2504
|
+
function _n(e) {
|
|
2394
2505
|
return {
|
|
2395
2506
|
buildContext(e) {
|
|
2396
2507
|
return {
|
|
2397
|
-
cliCatalog:
|
|
2508
|
+
cliCatalog: _e(gn(e.scopedSubagentId)),
|
|
2398
2509
|
handoff: { current: null },
|
|
2399
2510
|
collected: {}
|
|
2400
2511
|
};
|
|
2401
2512
|
},
|
|
2402
2513
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
2403
|
-
return
|
|
2514
|
+
return mn(e, n, t);
|
|
2404
2515
|
},
|
|
2405
2516
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
2406
|
-
return `${e}\n\n${
|
|
2517
|
+
return `${e}\n\n${pn()}\n\n${J().toolsHeading}\n${n}`;
|
|
2407
2518
|
},
|
|
2408
2519
|
parseResponse(e, t, n) {
|
|
2409
2520
|
let r = n.handoff.current;
|
|
2410
|
-
return n.handoff.current = null,
|
|
2521
|
+
return n.handoff.current = null, hn(e, r);
|
|
2411
2522
|
},
|
|
2412
2523
|
fallback() {
|
|
2413
2524
|
return {
|
|
@@ -2419,11 +2530,11 @@ function fn(e) {
|
|
|
2419
2530
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
2420
2531
|
},
|
|
2421
2532
|
getTools(t, n, r) {
|
|
2422
|
-
let i =
|
|
2533
|
+
let i = q({
|
|
2423
2534
|
attachmentsRef: r,
|
|
2424
2535
|
collected: n.collected,
|
|
2425
2536
|
proxyFetch: w
|
|
2426
|
-
}), a = t.scopedSubagentId ?
|
|
2537
|
+
}), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = gn(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
2427
2538
|
name: `${t.id}_${r.name}`,
|
|
2428
2539
|
description: `${t.label}: ${r.summary}`,
|
|
2429
2540
|
inputSchema: r.inputSchema,
|
|
@@ -2447,13 +2558,13 @@ function fn(e) {
|
|
|
2447
2558
|
}
|
|
2448
2559
|
//#endregion
|
|
2449
2560
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
2450
|
-
function
|
|
2561
|
+
function vn(e, t) {
|
|
2451
2562
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
2452
2563
|
}
|
|
2453
2564
|
//#endregion
|
|
2454
2565
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
2455
|
-
function
|
|
2456
|
-
let s = $(), c =
|
|
2566
|
+
function yn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
2567
|
+
let s = $(), c = ft(), l = c.scope, u = D(), [d, f] = P(null), [p, m] = P(new Set(i ?? [])), [h, g] = P(null), _ = De(), v = /* @__PURE__ */ new Map();
|
|
2457
2568
|
e.destinationIds.forEach((e) => {
|
|
2458
2569
|
let t = _[e];
|
|
2459
2570
|
t && v.set(e, t);
|
|
@@ -2470,7 +2581,7 @@ function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2470
2581
|
storageProvider: l?.storageProvider ?? null,
|
|
2471
2582
|
proxyFetch: u
|
|
2472
2583
|
}, n);
|
|
2473
|
-
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n,
|
|
2584
|
+
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, vn(e, n));
|
|
2474
2585
|
} catch (e) {
|
|
2475
2586
|
g(e instanceof Error ? e.message : String(e));
|
|
2476
2587
|
} finally {
|
|
@@ -2503,17 +2614,17 @@ function mn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2503
2614
|
}
|
|
2504
2615
|
//#endregion
|
|
2505
2616
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
2506
|
-
var
|
|
2507
|
-
function
|
|
2508
|
-
Object.assign(
|
|
2617
|
+
var bn = {};
|
|
2618
|
+
function xn(e) {
|
|
2619
|
+
Object.assign(bn, e);
|
|
2509
2620
|
}
|
|
2510
|
-
function
|
|
2511
|
-
return
|
|
2621
|
+
function Sn(e) {
|
|
2622
|
+
return bn[e];
|
|
2512
2623
|
}
|
|
2513
2624
|
//#endregion
|
|
2514
2625
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
2515
|
-
function
|
|
2516
|
-
let [t, n] =
|
|
2626
|
+
function Cn({ result: e }) {
|
|
2627
|
+
let [t, n] = P(!1);
|
|
2517
2628
|
return /* @__PURE__ */ L("div", {
|
|
2518
2629
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
2519
2630
|
onClick: () => n((e) => !e),
|
|
@@ -2529,7 +2640,7 @@ function vn({ result: e }) {
|
|
|
2529
2640
|
}
|
|
2530
2641
|
//#endregion
|
|
2531
2642
|
//#region src/presentation/liveAnchorDestination.ts
|
|
2532
|
-
function
|
|
2643
|
+
function wn(e, t, n) {
|
|
2533
2644
|
return e.length === 0 ? null : {
|
|
2534
2645
|
id: "live-component",
|
|
2535
2646
|
label: "Applica al componente aperto",
|
|
@@ -2540,38 +2651,38 @@ function yn(e, t, n) {
|
|
|
2540
2651
|
}
|
|
2541
2652
|
//#endregion
|
|
2542
2653
|
//#region src/presentation/subagentControls.ts
|
|
2543
|
-
var
|
|
2544
|
-
function
|
|
2545
|
-
Object.assign(
|
|
2654
|
+
var Tn = {};
|
|
2655
|
+
function En(e) {
|
|
2656
|
+
Object.assign(Tn, e);
|
|
2546
2657
|
}
|
|
2547
|
-
function
|
|
2548
|
-
return
|
|
2658
|
+
function Dn(e) {
|
|
2659
|
+
return Tn[e];
|
|
2549
2660
|
}
|
|
2550
2661
|
//#endregion
|
|
2551
2662
|
//#region src/presentation/chatTitles.ts
|
|
2552
|
-
function
|
|
2663
|
+
function On(e, t = 6e3) {
|
|
2553
2664
|
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Xe(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
|
|
2554
2665
|
return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
|
|
2555
2666
|
}
|
|
2556
|
-
function
|
|
2667
|
+
function kn(e) {
|
|
2557
2668
|
return (e.trim().split("\n").map((e) => e.trim()).find(Boolean) ?? "").replace(/^(title|titolo)\s*:\s*/i, "").replace(/^#+\s*/, "").replace(/^["'«“]+|["'»”]+$/g, "").replace(/[.。]+$/, "").trim().slice(0, 80);
|
|
2558
2669
|
}
|
|
2559
|
-
function
|
|
2670
|
+
function An(e, t) {
|
|
2560
2671
|
try {
|
|
2561
2672
|
return e.definition.executor?.catalogProviders?.(e.toParams(t));
|
|
2562
2673
|
} catch {
|
|
2563
2674
|
return;
|
|
2564
2675
|
}
|
|
2565
2676
|
}
|
|
2566
|
-
function
|
|
2567
|
-
let a =
|
|
2677
|
+
function jn(e, t, n, r, i) {
|
|
2678
|
+
let a = An(e, t), o = (e) => {
|
|
2568
2679
|
let t = e ? C(e) : null;
|
|
2569
2680
|
return !(!t || !i[t.provider] || a && !a.includes(t.provider));
|
|
2570
2681
|
};
|
|
2571
2682
|
return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
|
|
2572
2683
|
}
|
|
2573
|
-
function
|
|
2574
|
-
let t = T()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } =
|
|
2684
|
+
function Mn(e) {
|
|
2685
|
+
let t = T()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = rn(), i = N({
|
|
2575
2686
|
registry: t,
|
|
2576
2687
|
modelsByProvider: n,
|
|
2577
2688
|
selectedModel: r
|
|
@@ -2581,19 +2692,19 @@ function Dn(e) {
|
|
|
2581
2692
|
modelsByProvider: n,
|
|
2582
2693
|
selectedModel: r
|
|
2583
2694
|
};
|
|
2584
|
-
let a =
|
|
2695
|
+
let a = N(/* @__PURE__ */ new Set()), o = k(async (t, n, r) => {
|
|
2585
2696
|
if (!e) return !1;
|
|
2586
|
-
let o = Ue(e, t, n), s =
|
|
2697
|
+
let o = Ue(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
|
|
2587
2698
|
if (!o || !s?.autoTitle || o.name || !Ye(o) || a.current.has(c)) return !1;
|
|
2588
|
-
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f =
|
|
2699
|
+
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = jn(s, o.params, r ?? d, u, l), p = f ? C(f) : null;
|
|
2589
2700
|
if (!p) return !1;
|
|
2590
2701
|
a.current.add(c);
|
|
2591
2702
|
try {
|
|
2592
2703
|
let r = await l[p.provider].complete({
|
|
2593
|
-
prompt: J().chatTitle.replace("{chat}",
|
|
2704
|
+
prompt: J().chatTitle.replace("{chat}", On(o.activity)),
|
|
2594
2705
|
model: p.model,
|
|
2595
2706
|
history: []
|
|
2596
|
-
}), i = r && r.type === "text" ?
|
|
2707
|
+
}), i = r && r.type === "text" ? kn(r.text) : "";
|
|
2597
2708
|
return i ? Ze(e, t, n, i, "model") : !1;
|
|
2598
2709
|
} catch {
|
|
2599
2710
|
return !1;
|
|
@@ -2602,9 +2713,9 @@ function Dn(e) {
|
|
|
2602
2713
|
}
|
|
2603
2714
|
}, [e]), s = Object.keys(n).length > 0;
|
|
2604
2715
|
return j(() => {
|
|
2605
|
-
e && s && !
|
|
2716
|
+
e && s && !Nn.has(e) && (Nn.add(e), (async () => {
|
|
2606
2717
|
for (let t of $e(e)) {
|
|
2607
|
-
let n =
|
|
2718
|
+
let n = W(t.subagentId);
|
|
2608
2719
|
if (n?.autoTitle) {
|
|
2609
2720
|
if (n.definition.conversational && !Ye(t)) {
|
|
2610
2721
|
Qe(e, t.subagentId, t.entityId);
|
|
@@ -2620,18 +2731,18 @@ function Dn(e) {
|
|
|
2620
2731
|
o
|
|
2621
2732
|
]), o;
|
|
2622
2733
|
}
|
|
2623
|
-
var
|
|
2624
|
-
function
|
|
2625
|
-
let c =
|
|
2734
|
+
var Nn = /* @__PURE__ */ new Set(), Pn = () => ({});
|
|
2735
|
+
function Fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
2736
|
+
let c = ft(), l = fn(e.definition, {
|
|
2626
2737
|
defaultEnabled: !0,
|
|
2627
2738
|
...c.person ? { author: c.person } : {}
|
|
2628
|
-
}), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p =
|
|
2739
|
+
}), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p = D(), m = N(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [h, g] = P(null), _ = (t) => {
|
|
2629
2740
|
e.definition.conversational || g(t);
|
|
2630
|
-
}, [v, y] =
|
|
2631
|
-
h && h !==
|
|
2632
|
-
let te =
|
|
2741
|
+
}, [v, y] = P([]), [b, x] = P(null), S = Sn(e.id), C = S?.kind === "selection" ? S : null, [w, T] = P(null), ee = N(!1), E = N(0), O = N(null);
|
|
2742
|
+
h && h !== O.current && (O.current = h, E.current = (r?.length ?? 0) + l.activity.length);
|
|
2743
|
+
let te = N(!1), k = l.remote || !l.hasProviders || l.selectedModel !== "";
|
|
2633
2744
|
j(() => {
|
|
2634
|
-
!
|
|
2745
|
+
!ee.current && k && (ee.current = !0, a ? (U.current = !0, l.resume(e.toParams(t), a)) : (o && l.setSelectedModel(o), l.run(e.toParams(t), {
|
|
2635
2746
|
model: o,
|
|
2636
2747
|
openingMessage: s
|
|
2637
2748
|
}).then((e) => {
|
|
@@ -2651,7 +2762,7 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2651
2762
|
...t,
|
|
2652
2763
|
pinnedEntityId: r
|
|
2653
2764
|
}).then((n) => {
|
|
2654
|
-
n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t,
|
|
2765
|
+
n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t, vn(e, t));
|
|
2655
2766
|
}).catch((e) => x(e instanceof Error ? e.message : String(e))));
|
|
2656
2767
|
});
|
|
2657
2768
|
}, [
|
|
@@ -2666,20 +2777,20 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2666
2777
|
...n,
|
|
2667
2778
|
[e]: t
|
|
2668
2779
|
});
|
|
2669
|
-
},
|
|
2780
|
+
}, ne = (e) => _(e), re = M(() => h && C && w ? C.applySelection(h, w) : h, [
|
|
2670
2781
|
h,
|
|
2671
2782
|
C,
|
|
2672
2783
|
w
|
|
2673
|
-
]),
|
|
2674
|
-
|
|
2784
|
+
]), R = M(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), ie = M(() => wn(R, t, m), [
|
|
2785
|
+
R,
|
|
2675
2786
|
t,
|
|
2676
2787
|
m
|
|
2677
|
-
]),
|
|
2788
|
+
]), z = M(() => ie ? [ie, ...n ?? []] : n, [ie, n]), B = e.chatEntityId?.(t), V = Mn(f?.id), H = N(!1), U = N(!1);
|
|
2678
2789
|
j(() => {
|
|
2679
|
-
let n = !
|
|
2680
|
-
if (
|
|
2681
|
-
if (
|
|
2682
|
-
i && (
|
|
2790
|
+
let n = !H.current && l.running, i = H.current && !l.running;
|
|
2791
|
+
if (H.current = l.running, !n && !i || !B || !f) return;
|
|
2792
|
+
if (U.current) {
|
|
2793
|
+
i && (U.current = !1);
|
|
2683
2794
|
return;
|
|
2684
2795
|
}
|
|
2685
2796
|
let a = l.snapshot();
|
|
@@ -2688,60 +2799,76 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2688
2799
|
e.autoTitle && e.definition.conversational && !Ye({ activity: o }) || (We({
|
|
2689
2800
|
scopeId: f.id,
|
|
2690
2801
|
subagentId: e.id,
|
|
2691
|
-
entityId:
|
|
2802
|
+
entityId: B,
|
|
2692
2803
|
params: t,
|
|
2693
|
-
title:
|
|
2804
|
+
title: vn(e, t),
|
|
2694
2805
|
history: a.history,
|
|
2695
2806
|
activity: o
|
|
2696
|
-
}), i && e.autoTitle &&
|
|
2807
|
+
}), i && e.autoTitle && V(e.id, B, l.selectedModel));
|
|
2697
2808
|
}, [l.running]);
|
|
2809
|
+
let ae = l.activity.flatMap((e) => (e.parts ?? []).flatMap((e) => e.type === "card" && e.outcome ? [`${e.id}:${e.outcome.status}`] : [])).join(","), W = N(ae);
|
|
2810
|
+
j(() => {
|
|
2811
|
+
if (ae === W.current || (W.current = ae, !ae || !B || !f || l.running || U.current)) return;
|
|
2812
|
+
let n = l.snapshot();
|
|
2813
|
+
if (!n) return;
|
|
2814
|
+
let i = [...r ?? [], ...n.activity];
|
|
2815
|
+
e.autoTitle && e.definition.conversational && !Ye({ activity: i }) || We({
|
|
2816
|
+
scopeId: f.id,
|
|
2817
|
+
subagentId: e.id,
|
|
2818
|
+
entityId: B,
|
|
2819
|
+
params: t,
|
|
2820
|
+
title: vn(e, t),
|
|
2821
|
+
history: n.history,
|
|
2822
|
+
activity: i
|
|
2823
|
+
});
|
|
2824
|
+
}, [ae]);
|
|
2698
2825
|
let G = () => {
|
|
2699
2826
|
te.current = !0, l.running && l.stop(), c.closeTask(m);
|
|
2700
|
-
}, K =
|
|
2827
|
+
}, K = N(Dn(e.id) ?? Pn).current, q = K({
|
|
2701
2828
|
params: t,
|
|
2702
2829
|
taskId: m,
|
|
2703
2830
|
running: l.running,
|
|
2704
2831
|
close: G
|
|
2705
|
-
}),
|
|
2832
|
+
}), oe = (e) => {
|
|
2706
2833
|
y((t) => t.includes(e) ? t : [...t, e]);
|
|
2707
2834
|
};
|
|
2708
2835
|
return j(() => {
|
|
2709
2836
|
te.current || c.openTask({
|
|
2710
2837
|
id: m,
|
|
2711
|
-
title:
|
|
2838
|
+
title: vn(e, t),
|
|
2712
2839
|
icon: e.icon,
|
|
2713
2840
|
agent: l,
|
|
2714
2841
|
onApplied: (e) => _(e),
|
|
2715
2842
|
precedingActivity: r,
|
|
2716
|
-
panelExtraAnchorIndex:
|
|
2843
|
+
panelExtraAnchorIndex: E.current,
|
|
2717
2844
|
onDismiss: G,
|
|
2718
2845
|
...u ? { thread: u } : {},
|
|
2719
2846
|
...d ? { speaker: d } : {},
|
|
2720
|
-
...
|
|
2847
|
+
...B ? { savedToDisk: !0 } : {},
|
|
2721
2848
|
panelActions: q.content,
|
|
2722
2849
|
composerActions: q.actions,
|
|
2723
2850
|
composerCommands: q.commands,
|
|
2724
|
-
panelExtra: h ? /* @__PURE__ */ L(
|
|
2851
|
+
panelExtra: h ? /* @__PURE__ */ L(F, { children: [
|
|
2725
2852
|
C && w ? /* @__PURE__ */ I(C.Report, {
|
|
2726
2853
|
result: h,
|
|
2727
2854
|
selection: w,
|
|
2728
2855
|
onChange: A
|
|
2729
2856
|
}) : S?.kind === "editable" ? /* @__PURE__ */ I(S.Report, {
|
|
2730
2857
|
result: h,
|
|
2731
|
-
onResultChange:
|
|
2732
|
-
}) : /* @__PURE__ */ I(
|
|
2858
|
+
onResultChange: ne
|
|
2859
|
+
}) : /* @__PURE__ */ I(Cn, { result: re }),
|
|
2733
2860
|
b && /* @__PURE__ */ L("p", {
|
|
2734
2861
|
className: "text-xs text-destructive",
|
|
2735
2862
|
children: ["Salvataggio automatico non riuscito: ", b]
|
|
2736
2863
|
}),
|
|
2737
|
-
/* @__PURE__ */ I(
|
|
2864
|
+
/* @__PURE__ */ I(yn, {
|
|
2738
2865
|
manifest: e,
|
|
2739
|
-
result:
|
|
2866
|
+
result: re,
|
|
2740
2867
|
meta: t,
|
|
2741
2868
|
taskId: m,
|
|
2742
2869
|
initiallyApplied: v,
|
|
2743
|
-
onApplied:
|
|
2744
|
-
extraDestinations:
|
|
2870
|
+
onApplied: oe,
|
|
2871
|
+
extraDestinations: z
|
|
2745
2872
|
})
|
|
2746
2873
|
] }) : void 0
|
|
2747
2874
|
});
|
|
@@ -2760,7 +2887,7 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2760
2887
|
e,
|
|
2761
2888
|
t,
|
|
2762
2889
|
h,
|
|
2763
|
-
|
|
2890
|
+
re,
|
|
2764
2891
|
w,
|
|
2765
2892
|
v,
|
|
2766
2893
|
n,
|
|
@@ -2775,17 +2902,17 @@ function An({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2775
2902
|
}
|
|
2776
2903
|
//#endregion
|
|
2777
2904
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2778
|
-
function
|
|
2779
|
-
let t = $(), n =
|
|
2905
|
+
function In({ userGoal: e }) {
|
|
2906
|
+
let t = $(), n = M(() => _n({
|
|
2780
2907
|
unavailable: t.orchestratorUnavailable,
|
|
2781
2908
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2782
2909
|
preparing: t.orchestratorPreparing,
|
|
2783
2910
|
collecting: t.orchestratorCollecting
|
|
2784
|
-
}), []), r =
|
|
2911
|
+
}), []), r = ft(), i = fn(n, {
|
|
2785
2912
|
defaultEnabled: !0,
|
|
2786
2913
|
...r.person ? { author: r.person } : {}
|
|
2787
|
-
}), [a, o] =
|
|
2788
|
-
e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(
|
|
2914
|
+
}), [a, o] = P(null), s = N(!1), c = !i.hasProviders || i.selectedModel !== "", l = N(r.pendingExtraDestinations), u = N(r.pendingAttachments), d = N(r.pendingModel), f = N(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), p = N(r.pendingCarryOver), m = N(!1), h = (e) => {
|
|
2915
|
+
e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(lt));
|
|
2789
2916
|
};
|
|
2790
2917
|
j(() => {
|
|
2791
2918
|
!s.current && c && (s.current = !0, d.current && i.setSelectedModel(d.current), i.run({
|
|
@@ -2801,7 +2928,7 @@ function jn({ userGoal: e }) {
|
|
|
2801
2928
|
}));
|
|
2802
2929
|
}, [c]), j(() => {
|
|
2803
2930
|
m.current || r.openTask({
|
|
2804
|
-
id:
|
|
2931
|
+
id: lt,
|
|
2805
2932
|
title: "Agentico",
|
|
2806
2933
|
icon: "bot",
|
|
2807
2934
|
agent: i,
|
|
@@ -2809,7 +2936,7 @@ function jn({ userGoal: e }) {
|
|
|
2809
2936
|
scopedSubagentId: f.current,
|
|
2810
2937
|
precedingActivity: p.current?.activity,
|
|
2811
2938
|
onDismiss: () => {
|
|
2812
|
-
m.current = !0, i.running && i.stop(), r.closeTask(
|
|
2939
|
+
m.current = !0, i.running && i.stop(), r.closeTask(lt);
|
|
2813
2940
|
}
|
|
2814
2941
|
});
|
|
2815
2942
|
}, [
|
|
@@ -2822,12 +2949,12 @@ function jn({ userGoal: e }) {
|
|
|
2822
2949
|
i.hasProviders,
|
|
2823
2950
|
r.openTask
|
|
2824
2951
|
]), j(() => () => {
|
|
2825
|
-
r.closeTask(
|
|
2952
|
+
r.closeTask(lt);
|
|
2826
2953
|
}, [r.closeTask]);
|
|
2827
|
-
let g =
|
|
2954
|
+
let g = M(() => [...p.current?.activity ?? [], ...i.activity], [i.activity]);
|
|
2828
2955
|
if (!a) return null;
|
|
2829
|
-
let _ =
|
|
2830
|
-
return _ ? /* @__PURE__ */ I(
|
|
2956
|
+
let _ = W(a.subagentId);
|
|
2957
|
+
return _ ? /* @__PURE__ */ I(Fn, {
|
|
2831
2958
|
manifest: _,
|
|
2832
2959
|
params: a.params,
|
|
2833
2960
|
extraDestinations: l.current,
|
|
@@ -2838,11 +2965,11 @@ function jn({ userGoal: e }) {
|
|
|
2838
2965
|
}
|
|
2839
2966
|
//#endregion
|
|
2840
2967
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2841
|
-
function
|
|
2842
|
-
let r =
|
|
2968
|
+
function Ln({ manifest: e, extraDestinations: n }) {
|
|
2969
|
+
let r = ft(), i = fn(e.definition, {
|
|
2843
2970
|
defaultEnabled: !1,
|
|
2844
2971
|
...r.person ? { author: r.person } : {}
|
|
2845
|
-
}), a = $(), o =
|
|
2972
|
+
}), a = $(), o = N(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = P(null), [l, u] = P([]), d = Sn(e.id), f = d?.kind === "selection" ? d : null, [p, m] = P(null), [h, g] = P(null), _ = N(!1), v = (t) => {
|
|
2846
2973
|
if (!e.manualEntry) return;
|
|
2847
2974
|
let n;
|
|
2848
2975
|
try {
|
|
@@ -2863,17 +2990,17 @@ function Mn({ manifest: e, extraDestinations: n }) {
|
|
|
2863
2990
|
...n,
|
|
2864
2991
|
[e]: t
|
|
2865
2992
|
});
|
|
2866
|
-
}, b = (e) => c(e), x =
|
|
2993
|
+
}, b = (e) => c(e), x = M(() => s && f && p ? f.applySelection(s, p) : s, [
|
|
2867
2994
|
s,
|
|
2868
2995
|
f,
|
|
2869
2996
|
p
|
|
2870
2997
|
]), S = (e) => {
|
|
2871
2998
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
2872
|
-
}, C =
|
|
2999
|
+
}, C = M(() => r.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [r.componentAnchors, e.id]), w = M(() => h ? wn(C, h, o) : null, [
|
|
2873
3000
|
C,
|
|
2874
3001
|
h,
|
|
2875
3002
|
o
|
|
2876
|
-
]), T =
|
|
3003
|
+
]), T = M(() => w ? [w, ...n ?? []] : n, [w, n]);
|
|
2877
3004
|
return j(() => {
|
|
2878
3005
|
_.current || r.openTask({
|
|
2879
3006
|
id: o,
|
|
@@ -2898,8 +3025,8 @@ function Mn({ manifest: e, extraDestinations: n }) {
|
|
|
2898
3025
|
}) : d?.kind === "editable" ? /* @__PURE__ */ I(d.Report, {
|
|
2899
3026
|
result: s,
|
|
2900
3027
|
onResultChange: b
|
|
2901
|
-
}) : /* @__PURE__ */ I(
|
|
2902
|
-
/* @__PURE__ */ I(
|
|
3028
|
+
}) : /* @__PURE__ */ I(Cn, { result: x }),
|
|
3029
|
+
/* @__PURE__ */ I(yn, {
|
|
2903
3030
|
manifest: e,
|
|
2904
3031
|
result: x,
|
|
2905
3032
|
meta: h ?? {},
|
|
@@ -2936,7 +3063,7 @@ function Mn({ manifest: e, extraDestinations: n }) {
|
|
|
2936
3063
|
}
|
|
2937
3064
|
//#endregion
|
|
2938
3065
|
//#region src/presentation/EarlierSessions.tsx
|
|
2939
|
-
function
|
|
3066
|
+
function Rn({ title: e, meta: t, action: n }) {
|
|
2940
3067
|
return /* @__PURE__ */ L("div", {
|
|
2941
3068
|
role: "separator",
|
|
2942
3069
|
"aria-label": e,
|
|
@@ -2958,37 +3085,37 @@ function Nn({ title: e, meta: t, action: n }) {
|
|
|
2958
3085
|
]
|
|
2959
3086
|
});
|
|
2960
3087
|
}
|
|
2961
|
-
function
|
|
2962
|
-
let i =
|
|
2963
|
-
return /* @__PURE__ */ I(
|
|
3088
|
+
function zn({ chat: e, thread: t, from: n, showEvents: r }) {
|
|
3089
|
+
let i = ht(t, n, e.savedAt, r);
|
|
3090
|
+
return /* @__PURE__ */ I(Vt, {
|
|
2964
3091
|
activity: e.activity,
|
|
2965
3092
|
pinUserMessages: !1,
|
|
2966
|
-
speaker:
|
|
3093
|
+
speaker: W(e.subagentId)?.speaker?.(e.params),
|
|
2967
3094
|
events: i
|
|
2968
3095
|
});
|
|
2969
3096
|
}
|
|
2970
|
-
function
|
|
2971
|
-
let l = $(), { locale: u } =
|
|
3097
|
+
function Bn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onContinue: o, busy: s = !1, showEvents: c = !0 }) {
|
|
3098
|
+
let l = $(), { locale: u } = E(), [d, f] = P(0);
|
|
2972
3099
|
j(() => Ve(() => f((e) => e + 1)), []);
|
|
2973
|
-
let p =
|
|
3100
|
+
let p = M(() => nt(e, n, r), [
|
|
2974
3101
|
e,
|
|
2975
3102
|
n,
|
|
2976
3103
|
r,
|
|
2977
3104
|
d
|
|
2978
|
-
]), [m, h] =
|
|
3105
|
+
]), [m, h] = P(0);
|
|
2979
3106
|
j(() => h(0), [r, n]);
|
|
2980
|
-
let g = m < p.length, _ =
|
|
3107
|
+
let g = m < p.length, _ = N(null), v = () => {
|
|
2981
3108
|
let e = i.current;
|
|
2982
3109
|
e && (_.current = {
|
|
2983
3110
|
height: e.scrollHeight,
|
|
2984
3111
|
top: e.scrollTop
|
|
2985
3112
|
}), a?.(), h((e) => Math.min(e + 1, p.length));
|
|
2986
|
-
}, y =
|
|
2987
|
-
y.current = v,
|
|
3113
|
+
}, y = N(v);
|
|
3114
|
+
y.current = v, ne(() => {
|
|
2988
3115
|
let e = i.current, t = _.current;
|
|
2989
3116
|
_.current = null, e && t && (e.scrollTop = t.top + (e.scrollHeight - t.height));
|
|
2990
3117
|
}, [m, i]);
|
|
2991
|
-
let b =
|
|
3118
|
+
let b = N(null);
|
|
2992
3119
|
if (j(() => {
|
|
2993
3120
|
let e = i.current, t = b.current;
|
|
2994
3121
|
if (!e || !t || !g || typeof IntersectionObserver > "u") return;
|
|
@@ -3031,7 +3158,7 @@ function Fn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
|
|
|
3031
3158
|
}),
|
|
3032
3159
|
C.map((e) => /* @__PURE__ */ L("section", {
|
|
3033
3160
|
"aria-label": Je(e),
|
|
3034
|
-
children: [/* @__PURE__ */ I(
|
|
3161
|
+
children: [/* @__PURE__ */ I(Rn, {
|
|
3035
3162
|
title: Je(e),
|
|
3036
3163
|
meta: S(l.sessionOf, { at: x(Q(e)) }),
|
|
3037
3164
|
action: /* @__PURE__ */ I(t, {
|
|
@@ -3041,19 +3168,19 @@ function Fn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
|
|
|
3041
3168
|
disabled: s,
|
|
3042
3169
|
onClick: () => o(e)
|
|
3043
3170
|
})
|
|
3044
|
-
}), /* @__PURE__ */ I(
|
|
3171
|
+
}), /* @__PURE__ */ I(zn, {
|
|
3045
3172
|
chat: e,
|
|
3046
3173
|
thread: n,
|
|
3047
3174
|
from: w(e),
|
|
3048
3175
|
showEvents: c
|
|
3049
3176
|
})]
|
|
3050
3177
|
}, `${e.subagentId}:${e.entityId}`)),
|
|
3051
|
-
m > 0 && /* @__PURE__ */ I(
|
|
3178
|
+
m > 0 && /* @__PURE__ */ I(Rn, { title: l.thisSession })
|
|
3052
3179
|
] });
|
|
3053
3180
|
}
|
|
3054
3181
|
//#endregion
|
|
3055
3182
|
//#region src/presentation/Agentico.tsx
|
|
3056
|
-
function
|
|
3183
|
+
function Vn(e, t) {
|
|
3057
3184
|
return Object.values(e).flat().map((e) => {
|
|
3058
3185
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
3059
3186
|
return {
|
|
@@ -3065,12 +3192,16 @@ function In(e, t) {
|
|
|
3065
3192
|
};
|
|
3066
3193
|
});
|
|
3067
3194
|
}
|
|
3068
|
-
function
|
|
3069
|
-
let a = $(), [o, c] =
|
|
3195
|
+
function Hn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
3196
|
+
let a = $(), [o, c] = P(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
|
|
3070
3197
|
j(() => {
|
|
3071
3198
|
n && c(n.detail ?? "");
|
|
3072
3199
|
}, [n]);
|
|
3073
|
-
let m = (
|
|
3200
|
+
let { draft: m } = ft(), h = N(m?.nonce ?? 0);
|
|
3201
|
+
j(() => {
|
|
3202
|
+
m && m.nonce !== h.current && (h.current = m.nonce, c(m.text));
|
|
3203
|
+
}, [m]);
|
|
3204
|
+
let g = (e) => {
|
|
3074
3205
|
if (c(""), n && i) {
|
|
3075
3206
|
i(n, e.text);
|
|
3076
3207
|
return;
|
|
@@ -3085,8 +3216,8 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
3085
3216
|
}).then((e) => {
|
|
3086
3217
|
e && u(e);
|
|
3087
3218
|
});
|
|
3088
|
-
},
|
|
3089
|
-
return /* @__PURE__ */ L(
|
|
3219
|
+
}, _ = !!d || l.remote && l.remoteModels.length === 0, v = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), y = !_ && !l.remote && !v && l.hasProviders && !l.selectedModel, b = _ ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...Vn(l.modelsByProvider, l.catalogGroup)] : Vn(l.modelsByProvider);
|
|
3220
|
+
return /* @__PURE__ */ L(F, { children: [n && /* @__PURE__ */ L("div", {
|
|
3090
3221
|
className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
|
|
3091
3222
|
children: [
|
|
3092
3223
|
/* @__PURE__ */ I(f, {
|
|
@@ -3113,11 +3244,11 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
3113
3244
|
placeholder: d?.prompt ?? a.messagePlaceholder,
|
|
3114
3245
|
running: p,
|
|
3115
3246
|
onStop: l.stop,
|
|
3116
|
-
disabled: !o.trim() ||
|
|
3117
|
-
onSubmit:
|
|
3118
|
-
attachments: !d && (l.remote ||
|
|
3119
|
-
models:
|
|
3120
|
-
selectedModel:
|
|
3247
|
+
disabled: !o.trim() || y,
|
|
3248
|
+
onSubmit: g,
|
|
3249
|
+
attachments: !d && (l.remote || v ? l.executorAttachments : !0),
|
|
3250
|
+
models: b,
|
|
3251
|
+
selectedModel: _ ? "" : l.selectedModel,
|
|
3121
3252
|
actions: e.composerActions,
|
|
3122
3253
|
commands: e.composerCommands,
|
|
3123
3254
|
onModelChange: l.setSelectedModel,
|
|
@@ -3126,8 +3257,8 @@ function Ln({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
3126
3257
|
maxHeight: 220
|
|
3127
3258
|
})] });
|
|
3128
3259
|
}
|
|
3129
|
-
function
|
|
3130
|
-
let { startOrchestrator: e } =
|
|
3260
|
+
function Un() {
|
|
3261
|
+
let { startOrchestrator: e } = ft(), t = $(), [n, r] = P(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = rn(), l = (t) => {
|
|
3131
3262
|
t.text.trim() && (e(t.text.trim(), {
|
|
3132
3263
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
3133
3264
|
model: t.model || void 0
|
|
@@ -3140,7 +3271,7 @@ function Rn() {
|
|
|
3140
3271
|
disabled: !n.trim() || u,
|
|
3141
3272
|
onSubmit: l,
|
|
3142
3273
|
attachments: !0,
|
|
3143
|
-
models:
|
|
3274
|
+
models: Vn(a),
|
|
3144
3275
|
selectedModel: o,
|
|
3145
3276
|
onModelChange: c,
|
|
3146
3277
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -3148,8 +3279,8 @@ function Rn() {
|
|
|
3148
3279
|
maxHeight: 220
|
|
3149
3280
|
});
|
|
3150
3281
|
}
|
|
3151
|
-
function
|
|
3152
|
-
let n = $(), r =
|
|
3282
|
+
function Wn({ chat: e, onClose: t }) {
|
|
3283
|
+
let n = $(), r = ee();
|
|
3153
3284
|
return /* @__PURE__ */ I(_, {
|
|
3154
3285
|
title: n.renameChat,
|
|
3155
3286
|
size: "sm",
|
|
@@ -3171,7 +3302,7 @@ function zn({ chat: e, onClose: t }) {
|
|
|
3171
3302
|
})
|
|
3172
3303
|
});
|
|
3173
3304
|
}
|
|
3174
|
-
function
|
|
3305
|
+
function Gn(e, t, n = Date.now()) {
|
|
3175
3306
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
3176
3307
|
numeric: "auto",
|
|
3177
3308
|
style: "short"
|
|
@@ -3183,7 +3314,7 @@ function Bn(e, t, n = Date.now()) {
|
|
|
3183
3314
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
3184
3315
|
return i.format(0, "minute");
|
|
3185
3316
|
}
|
|
3186
|
-
function
|
|
3317
|
+
function Kn({ card: e }) {
|
|
3187
3318
|
let t = $();
|
|
3188
3319
|
return e.humanSummaryOnly ? /* @__PURE__ */ L("div", {
|
|
3189
3320
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
@@ -3239,7 +3370,7 @@ function Vn({ card: e }) {
|
|
|
3239
3370
|
]
|
|
3240
3371
|
});
|
|
3241
3372
|
}
|
|
3242
|
-
function
|
|
3373
|
+
function qn({ messages: e }) {
|
|
3243
3374
|
return /* @__PURE__ */ I("div", {
|
|
3244
3375
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
3245
3376
|
children: e.map((e, t) => /* @__PURE__ */ I("p", {
|
|
@@ -3248,15 +3379,15 @@ function Hn({ messages: e }) {
|
|
|
3248
3379
|
}, t))
|
|
3249
3380
|
});
|
|
3250
3381
|
}
|
|
3251
|
-
function
|
|
3252
|
-
let c = $(), { locale: d } =
|
|
3382
|
+
function Jn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
3383
|
+
let c = $(), { locale: d } = E(), [p, m] = P(""), [h, g] = P(0);
|
|
3253
3384
|
j(() => Ve(() => g((e) => e + 1)), []);
|
|
3254
|
-
let _ =
|
|
3385
|
+
let _ = M(() => r ? $e(e) : [], [
|
|
3255
3386
|
e,
|
|
3256
3387
|
r,
|
|
3257
3388
|
h
|
|
3258
|
-
]), [v, y] =
|
|
3259
|
-
let r =
|
|
3389
|
+
]), [v, y] = P(null), b = async (t) => {
|
|
3390
|
+
let r = W(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
3260
3391
|
if (!i || window.confirm(i)) {
|
|
3261
3392
|
try {
|
|
3262
3393
|
await r?.onArchive?.(t.entityId, t.params);
|
|
@@ -3265,14 +3396,14 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3265
3396
|
}
|
|
3266
3397
|
Qe(e, t.subagentId, t.entityId), n === et(t.subagentId, t.entityId) && s(), g((e) => e + 1);
|
|
3267
3398
|
}
|
|
3268
|
-
}, x =
|
|
3399
|
+
}, x = M(() => {
|
|
3269
3400
|
let e = p.trim().toLowerCase();
|
|
3270
3401
|
return e ? _.filter((t) => {
|
|
3271
|
-
let n =
|
|
3402
|
+
let n = W(t.subagentId)?.label ?? t.subagentId;
|
|
3272
3403
|
return Je(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
3273
3404
|
}) : _;
|
|
3274
3405
|
}, [_, p]);
|
|
3275
|
-
return /* @__PURE__ */ L(
|
|
3406
|
+
return /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(l, {
|
|
3276
3407
|
trigger: {
|
|
3277
3408
|
icon: "history",
|
|
3278
3409
|
title: c.chatHistory
|
|
@@ -3312,7 +3443,7 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3312
3443
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
3313
3444
|
children: _.length === 0 ? c.noSavedChats : c.noResults
|
|
3314
3445
|
}) : x.map((e) => {
|
|
3315
|
-
let t =
|
|
3446
|
+
let t = W(e.subagentId), r = n === et(e.subagentId, e.entityId);
|
|
3316
3447
|
return /* @__PURE__ */ I(u, {
|
|
3317
3448
|
icon: r ? "check" : t?.icon ?? "bot",
|
|
3318
3449
|
className: r ? "bg-accent font-semibold text-primary" : void 0,
|
|
@@ -3337,45 +3468,45 @@ function Un({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3337
3468
|
}), /* @__PURE__ */ I("span", {
|
|
3338
3469
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
3339
3470
|
title: `${c.chatStarted.replace("{at}", new Date(Q(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
|
|
3340
|
-
children:
|
|
3471
|
+
children: Gn(Q(e), d)
|
|
3341
3472
|
})]
|
|
3342
3473
|
})
|
|
3343
3474
|
}, `${e.subagentId}:${e.entityId}`);
|
|
3344
3475
|
})
|
|
3345
|
-
}), v && /* @__PURE__ */ I(
|
|
3476
|
+
}), v && /* @__PURE__ */ I(Wn, {
|
|
3346
3477
|
chat: v,
|
|
3347
3478
|
onClose: () => y(null)
|
|
3348
3479
|
})] });
|
|
3349
3480
|
}
|
|
3350
|
-
function
|
|
3351
|
-
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: y, pendingExtraDestinations: b, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T, threadEvents:
|
|
3481
|
+
function Yn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
|
|
3482
|
+
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: y, pendingExtraDestinations: b, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T, threadEvents: ee } = ft(), E = $(), D = N(null), [O, te] = P(!1), [k, A] = P(null), [ne, re] = P(null);
|
|
3352
3483
|
j(() => {
|
|
3353
|
-
A(null),
|
|
3354
|
-
}, [a?.id]),
|
|
3355
|
-
let
|
|
3484
|
+
A(null), re(null);
|
|
3485
|
+
}, [a?.id]), Mn(T?.id);
|
|
3486
|
+
let R = Zt({
|
|
3356
3487
|
defaultWidth: e,
|
|
3357
3488
|
minWidth: n,
|
|
3358
3489
|
maxWidth: r,
|
|
3359
3490
|
onWidthChange: i
|
|
3360
|
-
}),
|
|
3361
|
-
(!a || a.agent.running || a.savedToDisk || window.confirm(
|
|
3362
|
-
},
|
|
3363
|
-
|
|
3491
|
+
}), ie = () => {
|
|
3492
|
+
(!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(), te(!1));
|
|
3493
|
+
}, z = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], B = z.length, V = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? B, B)), H = z.slice(0, V), U = z.slice(V), ae = !!(a && !a.agent.running && a.agent.error), [G, K] = mt(), q = N({ at: Date.now() });
|
|
3494
|
+
q.current.id !== a?.id && (q.current = {
|
|
3364
3495
|
id: a?.id,
|
|
3365
3496
|
at: Date.now()
|
|
3366
3497
|
});
|
|
3367
|
-
let oe =
|
|
3368
|
-
if (!T || !a?.thread) return
|
|
3498
|
+
let oe = M(() => {
|
|
3499
|
+
if (!T || !a?.thread) return q.current.at;
|
|
3369
3500
|
let e = nt(T.id, a.thread, a.id)[0];
|
|
3370
3501
|
if (e) return e.savedAt;
|
|
3371
3502
|
let t = $e(T.id).find((e) => et(e.subagentId, e.entityId) === a.id);
|
|
3372
|
-
return t ? Q(t) :
|
|
3503
|
+
return t ? Q(t) : z.find((e) => e.at !== void 0)?.at ?? q.current.at;
|
|
3373
3504
|
}, [
|
|
3374
3505
|
T?.id,
|
|
3375
3506
|
a?.thread,
|
|
3376
3507
|
a?.id,
|
|
3377
|
-
|
|
3378
|
-
]), se =
|
|
3508
|
+
B === 0
|
|
3509
|
+
]), se = ht(a?.thread, oe, Infinity, G), ce = U.find((e) => e.at !== void 0)?.at, le = U.length === 0 || ce === void 0 ? se : se.filter((e) => e.at < ce), ue = U.length === 0 || ce === void 0 ? [] : se.filter((e) => e.at >= ce), de = (e, t) => {
|
|
3379
3510
|
a && (A(null), a.agent.rewind(e.id, t).then((e) => {
|
|
3380
3511
|
e && a.onApplied(e);
|
|
3381
3512
|
}));
|
|
@@ -3384,7 +3515,7 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3384
3515
|
return [...new Set(n.filter(Boolean))];
|
|
3385
3516
|
}, J = (e, t) => {
|
|
3386
3517
|
let n = fe(e);
|
|
3387
|
-
n.length ?
|
|
3518
|
+
n.length ? re({
|
|
3388
3519
|
entry: e,
|
|
3389
3520
|
steps: n,
|
|
3390
3521
|
...t === void 0 ? {} : { text: t }
|
|
@@ -3394,43 +3525,43 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3394
3525
|
disabled: a.agent.running,
|
|
3395
3526
|
onRetry: (e) => J(e),
|
|
3396
3527
|
onEdit: (e) => A(e)
|
|
3397
|
-
} : void 0, me = new Set(a?.agent.activity.map((e) => e.id) ?? []),
|
|
3528
|
+
} : void 0, me = new Set(a?.agent.activity.map((e) => e.id) ?? []), he = a ? {
|
|
3398
3529
|
canAnswer: (e) => me.has(e),
|
|
3399
3530
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
3400
3531
|
e && a.onApplied(e);
|
|
3401
3532
|
}),
|
|
3402
3533
|
onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
|
|
3403
|
-
} : void 0,
|
|
3534
|
+
} : void 0, Y = he ? Ft(z, he.canAnswer) : null, ge = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? W(a.scopedSubagentId) : void 0, _e = ge?.manualEntry ? ge : null, X = N(!0);
|
|
3404
3535
|
j(() => {
|
|
3405
|
-
let e =
|
|
3536
|
+
let e = D.current;
|
|
3406
3537
|
if (!e) return;
|
|
3407
3538
|
let t = () => {
|
|
3408
|
-
|
|
3539
|
+
X.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
3409
3540
|
};
|
|
3410
3541
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
3411
3542
|
}, [a?.id]), j(() => {
|
|
3412
|
-
let e =
|
|
3413
|
-
e && (
|
|
3543
|
+
let e = D.current;
|
|
3544
|
+
e && (X.current = !0, e.scrollTop = e.scrollHeight);
|
|
3414
3545
|
}, [a?.id]);
|
|
3415
|
-
let ve =
|
|
3546
|
+
let ve = z.at(-1)?.detail?.length ?? 0;
|
|
3416
3547
|
j(() => {
|
|
3417
|
-
let e =
|
|
3418
|
-
e &&
|
|
3548
|
+
let e = D.current;
|
|
3549
|
+
e && X.current && (e.scrollTop = e.scrollHeight);
|
|
3419
3550
|
}, [
|
|
3420
|
-
|
|
3421
|
-
|
|
3551
|
+
B,
|
|
3552
|
+
ae,
|
|
3422
3553
|
ve
|
|
3423
3554
|
]);
|
|
3424
|
-
let ye =
|
|
3555
|
+
let ye = N(null);
|
|
3425
3556
|
j(() => {
|
|
3426
|
-
let e =
|
|
3557
|
+
let e = D.current, t = ye.current;
|
|
3427
3558
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
3428
3559
|
let n = new ResizeObserver(() => {
|
|
3429
|
-
|
|
3560
|
+
X.current && (e.scrollTop = e.scrollHeight);
|
|
3430
3561
|
});
|
|
3431
3562
|
return n.observe(t), () => n.disconnect();
|
|
3432
3563
|
}, [a?.id, o]);
|
|
3433
|
-
let be = s ? /* @__PURE__ */ I(
|
|
3564
|
+
let be = s ? /* @__PURE__ */ I(In, { userGoal: s }, c) : null, xe = f ? W(f.subagentId) : void 0, Se = f && xe ? /* @__PURE__ */ I(Fn, {
|
|
3434
3565
|
manifest: xe,
|
|
3435
3566
|
params: f.snapshot.params,
|
|
3436
3567
|
taskId: et(f.subagentId, f.entityId),
|
|
@@ -3438,36 +3569,36 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3438
3569
|
history: f.snapshot.history,
|
|
3439
3570
|
activity: f.snapshot.activity
|
|
3440
3571
|
}
|
|
3441
|
-
}, p) : null, Ce = g ?
|
|
3572
|
+
}, p) : null, Ce = g ? W(g.subagentId) : void 0, we = g && Ce ? /* @__PURE__ */ I(Ln, {
|
|
3442
3573
|
manifest: Ce,
|
|
3443
3574
|
extraDestinations: g.extraDestinations
|
|
3444
|
-
}, _) : null, Te = x ?
|
|
3575
|
+
}, _) : null, Te = x ? W(x.subagentId) : void 0, Ee = x && Te ? /* @__PURE__ */ I(Fn, {
|
|
3445
3576
|
manifest: Te,
|
|
3446
3577
|
params: x.params,
|
|
3447
3578
|
extraDestinations: x.extraDestinations
|
|
3448
|
-
}, S) : null, De = C ?
|
|
3579
|
+
}, S) : null, De = C ? W(C.subagentId) : void 0, Oe = C && De ? /* @__PURE__ */ I(Fn, {
|
|
3449
3580
|
manifest: De,
|
|
3450
3581
|
params: C.params,
|
|
3451
3582
|
taskId: C.taskId,
|
|
3452
3583
|
openingMessage: C.openingMessage
|
|
3453
3584
|
}, w) : null;
|
|
3454
|
-
return o ? /* @__PURE__ */ L(
|
|
3585
|
+
return o ? /* @__PURE__ */ L(F, { children: [
|
|
3455
3586
|
be,
|
|
3456
3587
|
Se,
|
|
3457
3588
|
we,
|
|
3458
3589
|
Ee,
|
|
3459
3590
|
Oe,
|
|
3460
3591
|
/* @__PURE__ */ L("div", {
|
|
3461
|
-
style: { width:
|
|
3592
|
+
style: { width: R.width },
|
|
3462
3593
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
3463
3594
|
children: [
|
|
3464
|
-
/* @__PURE__ */ I(
|
|
3465
|
-
width:
|
|
3466
|
-
min:
|
|
3467
|
-
max:
|
|
3468
|
-
onResize:
|
|
3469
|
-
onCommit:
|
|
3470
|
-
onReset:
|
|
3595
|
+
/* @__PURE__ */ I(Qt, {
|
|
3596
|
+
width: R.width,
|
|
3597
|
+
min: R.min,
|
|
3598
|
+
max: R.max,
|
|
3599
|
+
onResize: R.set,
|
|
3600
|
+
onCommit: R.commit,
|
|
3601
|
+
onReset: R.reset
|
|
3471
3602
|
}),
|
|
3472
3603
|
/* @__PURE__ */ L("div", {
|
|
3473
3604
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
@@ -3476,54 +3607,54 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3476
3607
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
3477
3608
|
children: a ? a.title : "Agentico"
|
|
3478
3609
|
}),
|
|
3479
|
-
a?.thread &&
|
|
3480
|
-
icon:
|
|
3481
|
-
ariaLabel:
|
|
3482
|
-
title:
|
|
3610
|
+
a?.thread && ee && /* @__PURE__ */ I(t, {
|
|
3611
|
+
icon: G ? "activity" : "message-square",
|
|
3612
|
+
ariaLabel: G ? E.hideEvents : E.showEvents,
|
|
3613
|
+
title: G ? E.hideEvents : E.showEvents,
|
|
3483
3614
|
variant: "link",
|
|
3484
|
-
className: `p-1 ${
|
|
3485
|
-
onClick: () =>
|
|
3615
|
+
className: `p-1 ${G ? "text-primary" : "text-muted-foreground"}`,
|
|
3616
|
+
onClick: () => K(!G)
|
|
3486
3617
|
}),
|
|
3487
|
-
T && /* @__PURE__ */ I(
|
|
3618
|
+
T && /* @__PURE__ */ I(Jn, {
|
|
3488
3619
|
scopeId: T.id,
|
|
3489
3620
|
currentTaskId: a?.id ?? null,
|
|
3490
|
-
open:
|
|
3621
|
+
open: O,
|
|
3491
3622
|
onOpenChange: te,
|
|
3492
|
-
onNewChat:
|
|
3623
|
+
onNewChat: ie,
|
|
3493
3624
|
onSelect: (e, t, n) => h(e, t, n),
|
|
3494
3625
|
onArchivedCurrent: m
|
|
3495
3626
|
}),
|
|
3496
|
-
/* @__PURE__ */ I(
|
|
3627
|
+
/* @__PURE__ */ I($t, {})
|
|
3497
3628
|
]
|
|
3498
3629
|
}),
|
|
3499
3630
|
/* @__PURE__ */ I("div", {
|
|
3500
|
-
ref:
|
|
3501
|
-
className: `flex-1 overflow-y-auto px-3 pb-2 ${
|
|
3631
|
+
ref: D,
|
|
3632
|
+
className: `flex-1 overflow-y-auto px-3 pb-2 ${Y ? "min-h-24" : "min-h-0"}`,
|
|
3502
3633
|
children: /* @__PURE__ */ I("div", {
|
|
3503
3634
|
ref: ye,
|
|
3504
3635
|
className: "pt-2",
|
|
3505
|
-
children: a ? /* @__PURE__ */ L(
|
|
3506
|
-
T && a.thread && /* @__PURE__ */ I(
|
|
3636
|
+
children: a ? /* @__PURE__ */ L(F, { children: [
|
|
3637
|
+
T && a.thread && /* @__PURE__ */ I(Bn, {
|
|
3507
3638
|
scopeId: T.id,
|
|
3508
3639
|
thread: a.thread,
|
|
3509
3640
|
taskId: a.id,
|
|
3510
|
-
scrollRef:
|
|
3641
|
+
scrollRef: D,
|
|
3511
3642
|
busy: a.agent.running,
|
|
3512
|
-
showEvents:
|
|
3643
|
+
showEvents: G,
|
|
3513
3644
|
onLoad: () => {
|
|
3514
|
-
|
|
3645
|
+
X.current = !1;
|
|
3515
3646
|
},
|
|
3516
3647
|
onContinue: (e) => h(e.subagentId, e.entityId, e)
|
|
3517
3648
|
}),
|
|
3518
|
-
a.manualEntry &&
|
|
3649
|
+
a.manualEntry && z.length === 0 && /* @__PURE__ */ I("p", {
|
|
3519
3650
|
className: "text-xs text-muted-foreground",
|
|
3520
3651
|
children: a.manualEntry.prompt
|
|
3521
3652
|
}),
|
|
3522
|
-
/* @__PURE__ */ I(
|
|
3523
|
-
activity:
|
|
3524
|
-
questions:
|
|
3525
|
-
docked:
|
|
3526
|
-
pinUserMessages: !
|
|
3653
|
+
/* @__PURE__ */ I(Vt, {
|
|
3654
|
+
activity: H,
|
|
3655
|
+
questions: he,
|
|
3656
|
+
docked: Y,
|
|
3657
|
+
pinUserMessages: !Y,
|
|
3527
3658
|
messageActions: pe,
|
|
3528
3659
|
speaker: a.speaker,
|
|
3529
3660
|
events: le
|
|
@@ -3532,11 +3663,11 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3532
3663
|
className: "mt-3",
|
|
3533
3664
|
children: a.panelExtra
|
|
3534
3665
|
}),
|
|
3535
|
-
|
|
3536
|
-
activity:
|
|
3537
|
-
questions:
|
|
3538
|
-
docked:
|
|
3539
|
-
pinUserMessages: !
|
|
3666
|
+
U.length > 0 && /* @__PURE__ */ I(Vt, {
|
|
3667
|
+
activity: U,
|
|
3668
|
+
questions: he,
|
|
3669
|
+
docked: Y,
|
|
3670
|
+
pinUserMessages: !Y,
|
|
3540
3671
|
messageActions: pe,
|
|
3541
3672
|
speaker: a.speaker,
|
|
3542
3673
|
events: ue
|
|
@@ -3549,7 +3680,7 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3549
3680
|
children: a.agent.error
|
|
3550
3681
|
}),
|
|
3551
3682
|
/* @__PURE__ */ I(t, {
|
|
3552
|
-
label:
|
|
3683
|
+
label: E.retry,
|
|
3553
3684
|
variant: "secondary",
|
|
3554
3685
|
className: "shrink-0",
|
|
3555
3686
|
onClick: () => {
|
|
@@ -3558,18 +3689,18 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3558
3689
|
J(e);
|
|
3559
3690
|
return;
|
|
3560
3691
|
}
|
|
3561
|
-
a.agent.sendMessage(
|
|
3692
|
+
a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
|
|
3562
3693
|
e && a.onApplied(e);
|
|
3563
3694
|
});
|
|
3564
3695
|
}
|
|
3565
3696
|
}),
|
|
3566
3697
|
!a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ I(t, {
|
|
3567
|
-
label:
|
|
3698
|
+
label: E.continueWithoutAi,
|
|
3568
3699
|
variant: "secondary",
|
|
3569
3700
|
className: "shrink-0",
|
|
3570
3701
|
onClick: () => {
|
|
3571
|
-
if (
|
|
3572
|
-
y(
|
|
3702
|
+
if (_e) {
|
|
3703
|
+
y(_e.id, b);
|
|
3573
3704
|
return;
|
|
3574
3705
|
}
|
|
3575
3706
|
let e = a.agent.runFallback();
|
|
@@ -3578,14 +3709,14 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3578
3709
|
})
|
|
3579
3710
|
]
|
|
3580
3711
|
})
|
|
3581
|
-
] }) : d.length > 0 ? /* @__PURE__ */ I(
|
|
3712
|
+
] }) : d.length > 0 ? /* @__PURE__ */ I(qn, { messages: d }) : u ? /* @__PURE__ */ I(Kn, { card: u }) : /* @__PURE__ */ I("p", {
|
|
3582
3713
|
className: "text-xs text-muted-foreground",
|
|
3583
|
-
children: l ??
|
|
3714
|
+
children: l ?? E.orchestratorStarterHint
|
|
3584
3715
|
})
|
|
3585
3716
|
})
|
|
3586
3717
|
}),
|
|
3587
|
-
a &&
|
|
3588
|
-
"aria-label":
|
|
3718
|
+
a && Y ? /* @__PURE__ */ L("section", {
|
|
3719
|
+
"aria-label": E.pendingQuestions,
|
|
3589
3720
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
3590
3721
|
children: [
|
|
3591
3722
|
a.panelActions && /* @__PURE__ */ I("div", {
|
|
@@ -3594,18 +3725,18 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3594
3725
|
}),
|
|
3595
3726
|
/* @__PURE__ */ I("div", {
|
|
3596
3727
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
3597
|
-
children: /* @__PURE__ */ I(
|
|
3598
|
-
entry:
|
|
3599
|
-
part:
|
|
3600
|
-
questions:
|
|
3728
|
+
children: /* @__PURE__ */ I(It, {
|
|
3729
|
+
entry: Y.entry,
|
|
3730
|
+
part: Y.part,
|
|
3731
|
+
questions: he,
|
|
3601
3732
|
autoFocus: !0
|
|
3602
|
-
}, `${
|
|
3733
|
+
}, `${Y.entry.id}:${Y.part.id}`)
|
|
3603
3734
|
}),
|
|
3604
3735
|
a.agent.running && /* @__PURE__ */ I("div", {
|
|
3605
3736
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
3606
3737
|
children: /* @__PURE__ */ I(t, {
|
|
3607
3738
|
icon: "square",
|
|
3608
|
-
label:
|
|
3739
|
+
label: E.stop,
|
|
3609
3740
|
variant: "secondary",
|
|
3610
3741
|
onClick: a.agent.stop
|
|
3611
3742
|
})
|
|
@@ -3616,28 +3747,28 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3616
3747
|
children: [a?.panelActions && /* @__PURE__ */ I("div", {
|
|
3617
3748
|
className: "mb-2",
|
|
3618
3749
|
children: a.panelActions
|
|
3619
|
-
}), a ? /* @__PURE__ */ I(
|
|
3750
|
+
}), a ? /* @__PURE__ */ I(Hn, {
|
|
3620
3751
|
task: a,
|
|
3621
3752
|
editing: k,
|
|
3622
3753
|
onCancelEdit: () => A(null),
|
|
3623
3754
|
onSendEdit: (e, t) => J(e, t)
|
|
3624
|
-
}, a.id) : /* @__PURE__ */ I(
|
|
3755
|
+
}, a.id) : /* @__PURE__ */ I(Un, {})]
|
|
3625
3756
|
}),
|
|
3626
|
-
|
|
3627
|
-
title:
|
|
3628
|
-
onClose: () =>
|
|
3629
|
-
onYes: async () => (de(
|
|
3757
|
+
ne && /* @__PURE__ */ L(v, {
|
|
3758
|
+
title: E.rewindTitle,
|
|
3759
|
+
onClose: () => re(null),
|
|
3760
|
+
onYes: async () => (de(ne.entry, ne.text), !0),
|
|
3630
3761
|
children: [/* @__PURE__ */ I("p", {
|
|
3631
3762
|
className: "text-sm",
|
|
3632
|
-
children:
|
|
3763
|
+
children: E.rewindText
|
|
3633
3764
|
}), /* @__PURE__ */ I("ul", {
|
|
3634
3765
|
className: "mt-2 list-disc space-y-0.5 ps-5 text-sm text-muted-foreground",
|
|
3635
|
-
children:
|
|
3766
|
+
children: ne.steps.slice(0, 8).map((e) => /* @__PURE__ */ I("li", { children: e }, e))
|
|
3636
3767
|
})]
|
|
3637
3768
|
})
|
|
3638
3769
|
]
|
|
3639
3770
|
})
|
|
3640
|
-
] }) : /* @__PURE__ */ L(
|
|
3771
|
+
] }) : /* @__PURE__ */ L(F, { children: [
|
|
3641
3772
|
be,
|
|
3642
3773
|
Se,
|
|
3643
3774
|
we,
|
|
@@ -3647,14 +3778,14 @@ function Wn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3647
3778
|
}
|
|
3648
3779
|
//#endregion
|
|
3649
3780
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
3650
|
-
function
|
|
3651
|
-
let { setPageContext: n } =
|
|
3781
|
+
function Xn(e, t) {
|
|
3782
|
+
let { setPageContext: n } = ft(), r = N(crypto.randomUUID()).current;
|
|
3652
3783
|
j(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
3653
3784
|
}
|
|
3654
3785
|
//#endregion
|
|
3655
3786
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
3656
|
-
function
|
|
3657
|
-
let { registerComponentAnchor: o } =
|
|
3787
|
+
function Zn(e, t, n, r, i = !0, a) {
|
|
3788
|
+
let { registerComponentAnchor: o } = ft(), s = N(crypto.randomUUID()).current, c = N(n);
|
|
3658
3789
|
c.current = n, j(() => {
|
|
3659
3790
|
if (i) return o(s, {
|
|
3660
3791
|
subagentId: e,
|
|
@@ -3672,6 +3803,6 @@ function Kn(e, t, n, r, i = !0, a) {
|
|
|
3672
3803
|
]);
|
|
3673
3804
|
}
|
|
3674
3805
|
//#endregion
|
|
3675
|
-
export {
|
|
3806
|
+
export { Wt as AGENTICO_MAX_WIDTH, Ut as AGENTICO_MIN_WIDTH, Ht as AGENTICO_WIDTH, Gt as AGENTICO_WIDTH_STORAGE_KEY, Yn as Agentico, dt as AgenticoProvider, $t as AgenticoToggle, R as DEFAULT_REASONING_PART_ID, re as DEFAULT_TEXT_PART_ID, Ce as JSON_EXPORT_DESTINATION_ID, ve as MICRO_PROMPT_REGISTRY, lt as ORCHESTRATOR_TASK_ID, at as PREVIEW_LIMIT, it as PREVIEW_MAX, X as SUMMARY_MICRO_PROMPT, Ae as agenticoDe, Oe as agenticoEn, ke as agenticoIt, le as agenticoPromptsEn, ue as agenticoPromptsIt, ct as agenticoTranslations, ye as applyMicroPrompts, Ye as chatHasPersonMessage, Q as chatStartedAt, tt as chatThreadOf, Je as chatTitle, fe as configureAgenticoPrompts, Ne as configureEntityChatStore, q as createCrossAgentTools, V as defineSubagent, nt as earlierSessions, et as entityChatTaskId, be as extractErrorMessage, xe as extractJsonBlock, W as findSubagentManifest, B as formatQuestionAnswers, J as getAgenticoPrompts, De as getDestinationRegistry, Ue as getEntityChat, Dn as getSubagentControls, ae as getSubagentRegistry, Sn as getSubagentReport, Pe as hasEntityChatBackend, st as imagePreviews, we as jsonExportDestination, $e as listEntityChats, z as messagePartsText, Ve as onEntityChatsChange, rt as placeEvents, K as registerCrossAgentTools, Ee as registerDestinations, En as registerSubagentControls, xn as registerSubagentReports, U as registerSubagents, Qe as removeEntityChat, Ze as renameEntityChat, _e as renderRegistryCli, ge as renderSubagentCli, pe as resetAgenticoPrompts, We as saveEntityChat, Le as syncEntityChats, oe as toJsonSchema, se as toMcpTool, ie as upsertMessagePart, fn as useAgent, ft as useAgentico, $ as useAgenticoI18n, Xn as useAgenticoPageContext, Zn as useSubagentComponentContext };
|
|
3676
3807
|
|
|
3677
3808
|
//# sourceMappingURL=index.mjs.map
|