@llmnative/agentico 0.16.1 → 0.17.1
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 +117 -116
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1248 -1046
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/chatThread.d.ts +8 -0
- package/dist/types/domain/entityChatStore.d.ts +7 -0
- package/dist/types/domain/subagentManifest.d.ts +10 -0
- package/dist/types/i18n/types.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/presentation/AgentActivityLog.d.ts +12 -1
- package/dist/types/presentation/AgenticoContext.d.ts +11 -2
- package/dist/types/presentation/EarlierSessions.d.ts +17 -0
- package/dist/types/presentation/useAgent.d.ts +5 -0
- package/llms.txt +57 -56
- 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,
|
|
3
|
-
import { createContext as
|
|
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 E, useI18n as D, useProxy as O } from "@llmnative/react";
|
|
3
|
+
import { createContext as k, useCallback as A, useContext as j, useEffect as M, useLayoutEffect as N, useMemo as P, useRef as F, useState as I } from "react";
|
|
4
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
5
5
|
//#region src/domain/messageParts.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
6
|
+
var B = "text", V = "reasoning";
|
|
7
|
+
function H(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,59 +14,59 @@ function L(e, t, n) {
|
|
|
14
14
|
...i.slice(a)
|
|
15
15
|
] : [...i, t];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function ee(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 te(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 ne(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var U = [];
|
|
31
|
+
function W(e) {
|
|
32
|
+
U = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function re() {
|
|
35
|
+
return U.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), U;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function G(e) {
|
|
38
|
+
return U.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var K = [];
|
|
43
|
+
function q(...e) {
|
|
44
|
+
K = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function ie(e) {
|
|
47
|
+
return K.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
51
|
-
function
|
|
51
|
+
function ae(t) {
|
|
52
52
|
let { $schema: n, ...r } = e(t, {
|
|
53
53
|
target: "jsonSchema7",
|
|
54
54
|
$refStrategy: "none"
|
|
55
55
|
});
|
|
56
56
|
return r;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function oe(e, t, n, r) {
|
|
59
59
|
return {
|
|
60
60
|
name: e,
|
|
61
61
|
description: t,
|
|
62
|
-
inputSchema:
|
|
63
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: ae(n),
|
|
63
|
+
...r ? { outputSchema: ae(r) } : {}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/domain/subagentUsageCard.ts
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function J(e) {
|
|
69
|
+
let t = ae(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
|
|
70
70
|
return Object.entries(n).map(([t, n]) => {
|
|
71
71
|
let i = typeof n.description == "string" ? n.description : "";
|
|
72
72
|
return {
|
|
@@ -80,7 +80,7 @@ function oe(e) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/domain/prompts.ts
|
|
83
|
-
var
|
|
83
|
+
var se = {
|
|
84
84
|
orchestratorIntro: "You are Agentico, the orchestrator of this application's tools. Your job is to understand what the user wants to achieve and, once every required parameter is collected, start the right tool among those listed below — do not carry it out yourself \"in words\", invoke it as a tool.",
|
|
85
85
|
responseRules: [
|
|
86
86
|
"BEFORE asking for any parameter, check the \"Page context\" below (if present): if a parameter required by the command is already there or can be deduced from it with reasonable certainty, USE it directly — do not ask the user again. Only ask for parameters that cannot be derived from the context.",
|
|
@@ -110,7 +110,7 @@ var q = {
|
|
|
110
110
|
].join(" "),
|
|
111
111
|
multipleCandidates: "Several subagents are candidates on this page — ask the user which one they mean if their message does not make it clear, before going on.",
|
|
112
112
|
chatTitle: "Write a title for this chat, as a list of chats shows it: 3 to 6 words saying what it is about, in the language the person writes in. Answer with the title only: no quotes, no final period.\n\n{chat}"
|
|
113
|
-
},
|
|
113
|
+
}, ce = {
|
|
114
114
|
orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
|
|
115
115
|
responseRules: [
|
|
116
116
|
"PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
|
|
@@ -140,8 +140,8 @@ var q = {
|
|
|
140
140
|
].join(" "),
|
|
141
141
|
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
|
|
142
142
|
chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
|
|
143
|
-
}, Y =
|
|
144
|
-
function
|
|
143
|
+
}, Y = se;
|
|
144
|
+
function le(e) {
|
|
145
145
|
Y = {
|
|
146
146
|
...Y,
|
|
147
147
|
...e
|
|
@@ -150,16 +150,16 @@ function se(e) {
|
|
|
150
150
|
function X() {
|
|
151
151
|
return Y;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
Y =
|
|
153
|
+
function ue() {
|
|
154
|
+
Y = se;
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/domain/cli/renderManifestCli.ts
|
|
158
|
-
function
|
|
158
|
+
function de(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
|
|
162
|
-
let n =
|
|
161
|
+
function fe(e, t) {
|
|
162
|
+
let n = J(t), r = de(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
|
|
163
163
|
return [
|
|
164
164
|
`COMMAND: ${e} ${t.name}`,
|
|
165
165
|
` ${t.summary}`,
|
|
@@ -171,46 +171,46 @@ function ue(e, t) {
|
|
|
171
171
|
...i,
|
|
172
172
|
"",
|
|
173
173
|
" OUTPUT",
|
|
174
|
-
|
|
174
|
+
pe(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 pe(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 me(e) {
|
|
185
185
|
return [
|
|
186
186
|
"NAME",
|
|
187
187
|
` ${e.id} — ${e.label}`,
|
|
188
188
|
"",
|
|
189
189
|
"DESCRIPTION",
|
|
190
|
-
|
|
190
|
+
pe(e.description, 2),
|
|
191
191
|
"",
|
|
192
|
-
...e.commands.map((t) =>
|
|
192
|
+
...e.commands.map((t) => fe(e.id, t))
|
|
193
193
|
].join("\n");
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function he(e) {
|
|
196
196
|
return e.length === 0 ? X().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 Z = {
|
|
201
201
|
id: "closing-summary",
|
|
202
202
|
get text() {
|
|
203
203
|
return X().closingSummary;
|
|
204
204
|
}
|
|
205
|
-
},
|
|
206
|
-
function
|
|
205
|
+
}, ge = { [Z.id]: Z };
|
|
206
|
+
function _e(e, t) {
|
|
207
207
|
if (!t || t.length === 0) return e;
|
|
208
|
-
let n = t.map((e) =>
|
|
208
|
+
let n = t.map((e) => ge[e]?.text).filter((e) => !!e);
|
|
209
209
|
return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
|
|
210
210
|
}
|
|
211
211
|
//#endregion
|
|
212
212
|
//#region src/domain/extractErrorMessage.ts
|
|
213
|
-
function
|
|
213
|
+
function ve(e) {
|
|
214
214
|
if (e instanceof Error) return e.message;
|
|
215
215
|
if (typeof e == "object" && e) {
|
|
216
216
|
let t = e;
|
|
@@ -229,13 +229,13 @@ function Z(e) {
|
|
|
229
229
|
}
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region src/domain/extractJsonBlock.ts
|
|
232
|
-
function
|
|
232
|
+
function ye(e) {
|
|
233
233
|
let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
|
|
234
234
|
if (t) return t[1].trim();
|
|
235
235
|
let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
|
|
236
|
-
return
|
|
236
|
+
return be(n) ?? n;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function be(e) {
|
|
239
239
|
let t = e.search(/[{[]/);
|
|
240
240
|
if (t === -1) return null;
|
|
241
241
|
let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
|
|
@@ -256,8 +256,8 @@ function ve(e) {
|
|
|
256
256
|
}
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/domain/jsonExportDestination.ts
|
|
259
|
-
var
|
|
260
|
-
id:
|
|
259
|
+
var xe = "json-export", Se = {
|
|
260
|
+
id: xe,
|
|
261
261
|
label: "Export as JSON",
|
|
262
262
|
async apply(e) {
|
|
263
263
|
let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
|
|
@@ -268,19 +268,19 @@ var ye = "json-export", be = {
|
|
|
268
268
|
URL.revokeObjectURL(n);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
},
|
|
272
|
-
function
|
|
273
|
-
|
|
271
|
+
}, Ce = {};
|
|
272
|
+
function we(e) {
|
|
273
|
+
Ce = e;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Te() {
|
|
276
276
|
return {
|
|
277
|
-
[
|
|
278
|
-
...
|
|
277
|
+
[Se.id]: Se,
|
|
278
|
+
...Ce
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/i18n/en.ts
|
|
283
|
-
var
|
|
283
|
+
var Ee = {
|
|
284
284
|
modelLabel: "Model",
|
|
285
285
|
modelsLoading: "Loading…",
|
|
286
286
|
noModelsAvailable: "No models available",
|
|
@@ -319,6 +319,10 @@ var we = {
|
|
|
319
319
|
stepsLabel: "Steps of the agent",
|
|
320
320
|
newInstance: "New \"{label}\" instance",
|
|
321
321
|
chatHistory: "Chat history",
|
|
322
|
+
earlierSession: "Earlier session",
|
|
323
|
+
thisSession: "This session",
|
|
324
|
+
continueSession: "Continue this session",
|
|
325
|
+
sessionOf: "Session of {at}",
|
|
322
326
|
cardView: "View",
|
|
323
327
|
cardClose: "Close",
|
|
324
328
|
renameChat: "Rename",
|
|
@@ -348,7 +352,7 @@ var we = {
|
|
|
348
352
|
rewindTitle: "Go back to this message?",
|
|
349
353
|
rewindText: "What came after it leaves the chat and the memory of the agent. What its steps did stays done:",
|
|
350
354
|
stop: "Stop"
|
|
351
|
-
},
|
|
355
|
+
}, De = {
|
|
352
356
|
modelLabel: "Modello",
|
|
353
357
|
modelsLoading: "Caricamento…",
|
|
354
358
|
noModelsAvailable: "Nessun modello disponibile",
|
|
@@ -387,6 +391,10 @@ var we = {
|
|
|
387
391
|
stepsLabel: "Passi dell'agente",
|
|
388
392
|
newInstance: "Nuova istanza di \"{label}\"",
|
|
389
393
|
chatHistory: "Storico chat",
|
|
394
|
+
earlierSession: "Sessione precedente",
|
|
395
|
+
thisSession: "Questa sessione",
|
|
396
|
+
continueSession: "Continua questa sessione",
|
|
397
|
+
sessionOf: "Sessione del {at}",
|
|
390
398
|
cardView: "Vedi",
|
|
391
399
|
cardClose: "Chiudi",
|
|
392
400
|
renameChat: "Rinomina",
|
|
@@ -416,7 +424,7 @@ var we = {
|
|
|
416
424
|
rewindTitle: "Tornare a questo messaggio?",
|
|
417
425
|
rewindText: "Ciò che è venuto dopo lascia la chat e la memoria dell'agente. Ciò che hanno fatto i suoi passi resta fatto:",
|
|
418
426
|
stop: "Ferma"
|
|
419
|
-
},
|
|
427
|
+
}, Oe = {
|
|
420
428
|
modelLabel: "Modell",
|
|
421
429
|
modelsLoading: "Wird geladen…",
|
|
422
430
|
noModelsAvailable: "Keine Modelle verfügbar",
|
|
@@ -455,6 +463,10 @@ var we = {
|
|
|
455
463
|
stepsLabel: "Schritte des Agenten",
|
|
456
464
|
newInstance: "Neue Instanz von \"{label}\"",
|
|
457
465
|
chatHistory: "Chatverlauf",
|
|
466
|
+
earlierSession: "Vorherige Sitzung",
|
|
467
|
+
thisSession: "Diese Sitzung",
|
|
468
|
+
continueSession: "Diese Sitzung fortsetzen",
|
|
469
|
+
sessionOf: "Sitzung vom {at}",
|
|
458
470
|
cardView: "Ansehen",
|
|
459
471
|
cardClose: "Schließen",
|
|
460
472
|
renameChat: "Umbenennen",
|
|
@@ -484,39 +496,39 @@ var we = {
|
|
|
484
496
|
rewindTitle: "Zu dieser Nachricht zurückgehen?",
|
|
485
497
|
rewindText: "Was danach kam, verlässt den Chat und das Gedächtnis des Agenten. Was seine Schritte getan haben, bleibt getan:",
|
|
486
498
|
stop: "Stoppen"
|
|
487
|
-
},
|
|
488
|
-
function
|
|
489
|
-
|
|
499
|
+
}, ke = "llmnative.agentico.entityChat", Ae;
|
|
500
|
+
function je(e) {
|
|
501
|
+
ke = e.storageKey, Ae = e.backend;
|
|
490
502
|
}
|
|
491
|
-
var
|
|
492
|
-
function
|
|
493
|
-
if (!
|
|
503
|
+
var Me = () => !!Ae, Ne = ({ synced: e, ...t }) => t;
|
|
504
|
+
function Pe(e) {
|
|
505
|
+
if (!Ae) return;
|
|
494
506
|
let t = Q(e.scopeId, e.subagentId, e.entityId);
|
|
495
|
-
Promise.resolve(
|
|
496
|
-
let e =
|
|
497
|
-
n && !n.synced &&
|
|
507
|
+
Promise.resolve(Ae.save(Ne(e))).then(() => {
|
|
508
|
+
let e = Le(), n = e.find((e) => Q(e.scopeId, e.subagentId, e.entityId) === t);
|
|
509
|
+
n && !n.synced && Be(e.map((e) => e === n ? {
|
|
498
510
|
...e,
|
|
499
511
|
synced: !0
|
|
500
512
|
} : e));
|
|
501
513
|
}, () => void 0);
|
|
502
514
|
}
|
|
503
|
-
async function
|
|
504
|
-
if (!
|
|
505
|
-
let t = (await
|
|
515
|
+
async function Fe(e) {
|
|
516
|
+
if (!Ae) return;
|
|
517
|
+
let t = (await Ae.load(e)).map(Ie).filter((t) => t !== null && t.scopeId === e), n = (e) => e.changedAt ?? e.savedAt, r = Le(), i = r.filter((t) => t.scopeId !== e), a = r.filter((t) => t.scopeId === e), o = t.map((e) => {
|
|
506
518
|
let t = a.find((t) => Q(t.scopeId, t.subagentId, t.entityId) === Q(e.scopeId, e.subagentId, e.entityId));
|
|
507
|
-
return t && n(t) > n(e) ? (
|
|
519
|
+
return t && n(t) > n(e) ? (Pe(t), t) : {
|
|
508
520
|
...e,
|
|
509
521
|
synced: !0
|
|
510
522
|
};
|
|
511
523
|
}), s = a.filter((e) => !e.synced && !t.some((t) => Q(t.scopeId, t.subagentId, t.entityId) === Q(e.scopeId, e.subagentId, e.entityId)));
|
|
512
|
-
|
|
524
|
+
Be([
|
|
513
525
|
...i,
|
|
514
526
|
...o,
|
|
515
527
|
...s
|
|
516
528
|
]);
|
|
517
|
-
for (let e of s)
|
|
529
|
+
for (let e of s) Pe(e);
|
|
518
530
|
}
|
|
519
|
-
function
|
|
531
|
+
function Ie(e) {
|
|
520
532
|
if (!e || typeof e != "object") return null;
|
|
521
533
|
let t = e;
|
|
522
534
|
if (typeof t.entityId != "string") return null;
|
|
@@ -528,57 +540,57 @@ function Pe(e) {
|
|
|
528
540
|
scopeId: n
|
|
529
541
|
};
|
|
530
542
|
}
|
|
531
|
-
function
|
|
543
|
+
function Le() {
|
|
532
544
|
try {
|
|
533
|
-
let e = localStorage.getItem(
|
|
545
|
+
let e = localStorage.getItem(ke);
|
|
534
546
|
if (!e) return [];
|
|
535
547
|
let t = JSON.parse(e);
|
|
536
|
-
return Array.isArray(t) ? t.map(
|
|
548
|
+
return Array.isArray(t) ? t.map(Ie).filter((e) => e !== null) : [];
|
|
537
549
|
} catch {
|
|
538
550
|
return [];
|
|
539
551
|
}
|
|
540
552
|
}
|
|
541
|
-
var
|
|
542
|
-
function
|
|
543
|
-
return
|
|
544
|
-
|
|
553
|
+
var Re = /* @__PURE__ */ new Set();
|
|
554
|
+
function ze(e) {
|
|
555
|
+
return Re.add(e), () => {
|
|
556
|
+
Re.delete(e);
|
|
545
557
|
};
|
|
546
558
|
}
|
|
547
|
-
function
|
|
559
|
+
function Be(e) {
|
|
548
560
|
try {
|
|
549
|
-
localStorage.setItem(
|
|
561
|
+
localStorage.setItem(ke, JSON.stringify(e));
|
|
550
562
|
} catch {}
|
|
551
|
-
for (let e of [...
|
|
563
|
+
for (let e of [...Re]) e();
|
|
552
564
|
}
|
|
553
565
|
var Q = (e, t, n) => `${e}:${t}:${n}`;
|
|
554
|
-
function
|
|
566
|
+
function Ve(e, t, n) {
|
|
555
567
|
let r = Q(e, t, n);
|
|
556
|
-
return
|
|
568
|
+
return Le().find((e) => Q(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
|
|
557
569
|
}
|
|
558
|
-
function
|
|
559
|
-
let t = Q(e.scopeId, e.subagentId, e.entityId), n =
|
|
570
|
+
function He(e) {
|
|
571
|
+
let t = Q(e.scopeId, e.subagentId, e.entityId), n = Le(), r = n.find((e) => Q(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r), o = {
|
|
560
572
|
...e,
|
|
561
573
|
savedAt: i,
|
|
562
574
|
changedAt: i,
|
|
563
|
-
startedAt: r ?
|
|
575
|
+
startedAt: r ? Xe(r) : i,
|
|
564
576
|
...r?.name ? {
|
|
565
577
|
name: r.name,
|
|
566
578
|
namedBy: r.namedBy
|
|
567
579
|
} : {},
|
|
568
580
|
...r?.synced ? { synced: !0 } : {}
|
|
569
581
|
};
|
|
570
|
-
a.push(o),
|
|
571
|
-
}
|
|
572
|
-
var
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
].map((e) => e.retryMessage.trim().toLowerCase())),
|
|
577
|
-
let t = (e.activity.find(
|
|
582
|
+
a.push(o), Be(a), Pe(o);
|
|
583
|
+
}
|
|
584
|
+
var Ue = new Set([
|
|
585
|
+
Ee,
|
|
586
|
+
De,
|
|
587
|
+
Oe
|
|
588
|
+
].map((e) => e.retryMessage.trim().toLowerCase())), We = (e) => e.kind === "user" && !!e.detail?.trim() && !e.retry && !Ue.has(e.detail.trim().toLowerCase()), Ge = (e) => {
|
|
589
|
+
let t = (e.activity.find(We)?.detail ?? "").trim().split("\n")[0].trim();
|
|
578
590
|
return t.length > 80 ? `${t.slice(0, 80).trimEnd()}…` : t;
|
|
579
|
-
},
|
|
580
|
-
function
|
|
581
|
-
let a = Q(e, t, n), o =
|
|
591
|
+
}, Ke = (e) => e.name || Ge(e) || e.title || e.entityId, qe = (e) => e.activity.some(We), Je = (e) => e.kind === "user" && !We(e) && !!e.detail?.trim();
|
|
592
|
+
function Ye(e, t, n, r, i = "person") {
|
|
593
|
+
let a = Q(e, t, n), o = Le(), s = o.find((e) => Q(e.scopeId, e.subagentId, e.entityId) === a);
|
|
582
594
|
if (!s || i === "model" && s.namedBy === "person") return !1;
|
|
583
595
|
let c = r.trim().replace(/\s+/g, " ").slice(0, 120), { name: l, namedBy: u, ...d } = s, f = c ? {
|
|
584
596
|
...d,
|
|
@@ -589,52 +601,64 @@ function qe(e, t, n, r, i = "person") {
|
|
|
589
601
|
...d,
|
|
590
602
|
changedAt: Date.now()
|
|
591
603
|
};
|
|
592
|
-
return
|
|
604
|
+
return Be(o.map((e) => e === s ? f : e)), Pe(f), !0;
|
|
593
605
|
}
|
|
594
|
-
var
|
|
595
|
-
function
|
|
606
|
+
var Xe = (e) => e.startedAt ?? e.savedAt;
|
|
607
|
+
function Ze(e, t, n) {
|
|
596
608
|
let r = Q(e, t, n);
|
|
597
|
-
|
|
609
|
+
Be(Le().filter((e) => Q(e.scopeId, e.subagentId, e.entityId) !== r)), Ae && Promise.resolve(Ae.remove(e, t, n)).catch(() => void 0);
|
|
610
|
+
}
|
|
611
|
+
function Qe(e) {
|
|
612
|
+
return Le().filter((t) => t.scopeId === e).sort((e, t) => Xe(t) - Xe(e));
|
|
598
613
|
}
|
|
599
|
-
|
|
600
|
-
|
|
614
|
+
var $e = (e, t) => `entitychat-${e}-${t}`;
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region src/domain/chatThread.ts
|
|
617
|
+
function et(e) {
|
|
618
|
+
return G(e.subagentId)?.thread?.(e.params) || void 0;
|
|
619
|
+
}
|
|
620
|
+
function tt(e, t, n) {
|
|
621
|
+
let r = Qe(e), i = n ? r.find((e) => $e(e.subagentId, e.entityId) === n) : void 0, a = i ? Xe(i) : Infinity;
|
|
622
|
+
return r.filter((e) => e !== i && Xe(e) < a && et(e) === t).sort((e, t) => Xe(t) - Xe(e));
|
|
601
623
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region src/i18n/index.ts
|
|
626
|
+
var nt = {
|
|
627
|
+
en: { agentico: Ee },
|
|
628
|
+
it: { agentico: De },
|
|
629
|
+
de: { agentico: Oe }
|
|
606
630
|
};
|
|
607
631
|
function $() {
|
|
608
|
-
let { dict: e } =
|
|
632
|
+
let { dict: e } = D(), t = e.agentico;
|
|
609
633
|
return t ? {
|
|
610
|
-
...
|
|
634
|
+
...Ee,
|
|
611
635
|
...t
|
|
612
|
-
} :
|
|
636
|
+
} : Ee;
|
|
613
637
|
}
|
|
614
638
|
//#endregion
|
|
615
639
|
//#region src/presentation/AgenticoContext.tsx
|
|
616
|
-
var
|
|
617
|
-
function
|
|
618
|
-
let [
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}, [
|
|
622
|
-
let [
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}, [
|
|
626
|
-
let
|
|
627
|
-
let t =
|
|
640
|
+
var rt = "agentico-orchestrator", it = k(null);
|
|
641
|
+
function at({ children: e, scope: t = null, person: n = null }) {
|
|
642
|
+
let [r, i] = I(null), a = F(null);
|
|
643
|
+
M(() => {
|
|
644
|
+
a.current = r;
|
|
645
|
+
}, [r]);
|
|
646
|
+
let [o, s] = I(!1), c = t?.id;
|
|
647
|
+
M(() => {
|
|
648
|
+
c && Fe(c).catch(() => void 0);
|
|
649
|
+
}, [c]);
|
|
650
|
+
let l = A((e) => {
|
|
651
|
+
let t = a.current;
|
|
628
652
|
t && t.id !== e.id && t.onDismiss();
|
|
629
653
|
let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
|
|
630
654
|
...e,
|
|
631
655
|
savedToDisk: !0
|
|
632
656
|
} : e;
|
|
633
|
-
|
|
634
|
-
}, []),
|
|
635
|
-
|
|
636
|
-
}, []),
|
|
637
|
-
|
|
657
|
+
i(n);
|
|
658
|
+
}, []), u = A((e) => {
|
|
659
|
+
i((t) => t && t.id === e ? null : t);
|
|
660
|
+
}, []), d = A(() => s((e) => !e), []), f = A(() => s(!0), []), [p, m] = I(null), [h, g] = I(void 0), [_, v] = I(void 0), [y, b] = I(void 0), [x, S] = I(null), [C, w] = I(null), [T, E] = I(void 0), [D, O] = I([]), k = A((e, t, n = null) => {
|
|
661
|
+
O((r) => {
|
|
638
662
|
let i = r.filter((t) => t.id !== e);
|
|
639
663
|
return t ? [...i, {
|
|
640
664
|
id: e,
|
|
@@ -642,20 +666,20 @@ function tt({ children: e, scope: t = null }) {
|
|
|
642
666
|
card: n
|
|
643
667
|
}] : i;
|
|
644
668
|
});
|
|
645
|
-
}, []),
|
|
646
|
-
|
|
669
|
+
}, []), j = D.length > 0 ? D[D.length - 1] : null, [N, L] = I([]), z = A((e, t) => {
|
|
670
|
+
L((n) => {
|
|
647
671
|
let r = n.filter((t) => t.id !== e);
|
|
648
672
|
return t ? [...r, {
|
|
649
673
|
id: e,
|
|
650
674
|
...t
|
|
651
675
|
}] : r;
|
|
652
676
|
});
|
|
653
|
-
}, []),
|
|
677
|
+
}, []), B = P(() => N.map((e) => ({
|
|
654
678
|
subagentId: e.subagentId,
|
|
655
679
|
componentKey: e.componentKey,
|
|
656
680
|
onResult: e.onResult,
|
|
657
681
|
pinnedEntityId: e.pinnedEntityId
|
|
658
|
-
})), [N]),
|
|
682
|
+
})), [N]), V = P(() => {
|
|
659
683
|
let e = /* @__PURE__ */ new Map();
|
|
660
684
|
for (let t of N) e.set(t.subagentId, {
|
|
661
685
|
subagentId: t.subagentId,
|
|
@@ -664,8 +688,8 @@ function tt({ children: e, scope: t = null }) {
|
|
|
664
688
|
contextInfo: t.contextInfo
|
|
665
689
|
});
|
|
666
690
|
return [...e.values()];
|
|
667
|
-
}, [N]),
|
|
668
|
-
let t =
|
|
691
|
+
}, [N]), H = P(() => V.map((e) => {
|
|
692
|
+
let t = G(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
669
693
|
if (!t) return null;
|
|
670
694
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
671
695
|
return {
|
|
@@ -673,151 +697,153 @@ function tt({ children: e, scope: t = null }) {
|
|
|
673
697
|
agenticoHint: n,
|
|
674
698
|
userMessage: t.userMessage
|
|
675
699
|
};
|
|
676
|
-
}).filter((e) => e !== null), [
|
|
677
|
-
if (
|
|
678
|
-
if (
|
|
679
|
-
let e =
|
|
700
|
+
}).filter((e) => e !== null), [V]), ee = P(() => H.map((e) => e.userMessage), [H]), te = P(() => {
|
|
701
|
+
if (H.length === 0) return null;
|
|
702
|
+
if (H.length === 1) return H[0].agenticoHint;
|
|
703
|
+
let e = H.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
680
704
|
return `${X().multipleCandidates}\n\n${e}`;
|
|
681
|
-
}, [
|
|
682
|
-
|
|
683
|
-
let n =
|
|
705
|
+
}, [H]) ?? j?.text ?? null, ne = H.length > 0 ? null : j?.card ?? null, U = P(() => [...new Set(B.map((e) => e.subagentId))], [B]), W = U.length === 1 ? U[0] : U.length === 0 ? j?.card?.subagentId ?? null : null, re = A((e, t) => {
|
|
706
|
+
f();
|
|
707
|
+
let n = a.current;
|
|
684
708
|
if (n?.id === "agentico-orchestrator") return;
|
|
685
|
-
let r =
|
|
686
|
-
|
|
709
|
+
let r = W && n?.id.startsWith(`subagent-${W}-`) ? n : void 0;
|
|
710
|
+
w(r ? {
|
|
687
711
|
taskId: r.id,
|
|
688
712
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
689
|
-
} : null),
|
|
690
|
-
}, [
|
|
691
|
-
if (!n || !
|
|
692
|
-
let c =
|
|
713
|
+
} : null), m(e), g(t?.extraDestinations), v(t?.attachments), b(t?.model), E(t?.scopedSubagentId), S(crypto.randomUUID());
|
|
714
|
+
}, [f, W]), K = A((e, t, n, r, o, s) => {
|
|
715
|
+
if (!n || !r) return;
|
|
716
|
+
let c = a.current;
|
|
693
717
|
if (!c || c.id !== n) return;
|
|
694
718
|
let l = c.agent.snapshot();
|
|
695
|
-
l && (
|
|
696
|
-
scopeId:
|
|
719
|
+
l && (He({
|
|
720
|
+
scopeId: r,
|
|
697
721
|
subagentId: e,
|
|
698
722
|
entityId: t,
|
|
699
723
|
params: o,
|
|
700
724
|
title: s,
|
|
701
725
|
history: l.history,
|
|
702
726
|
activity: [...c.precedingActivity ?? [], ...l.activity]
|
|
703
|
-
}),
|
|
727
|
+
}), i((e) => e && e.id === n ? {
|
|
704
728
|
...e,
|
|
705
729
|
savedToDisk: !0
|
|
706
730
|
} : e));
|
|
707
|
-
}, []), [
|
|
708
|
-
|
|
731
|
+
}, []), [q, ie] = I(null), [ae, oe] = I(null), J = A((e, t, n) => {
|
|
732
|
+
f(), ie({
|
|
709
733
|
subagentId: e,
|
|
710
734
|
entityId: t,
|
|
711
735
|
snapshot: n
|
|
712
736
|
}), oe(crypto.randomUUID());
|
|
713
|
-
}, [
|
|
714
|
-
|
|
737
|
+
}, [f]), [se, ce] = I(null), [Y, le] = I(null), ue = A((e, t) => {
|
|
738
|
+
f(), u(rt), ce({
|
|
715
739
|
subagentId: e,
|
|
716
740
|
extraDestinations: t
|
|
717
|
-
}),
|
|
718
|
-
}, [
|
|
719
|
-
|
|
741
|
+
}), le(crypto.randomUUID());
|
|
742
|
+
}, [f, u]), [de, fe] = I(null), [pe, me] = I(null), he = A((e, t, n) => {
|
|
743
|
+
ce(null), fe({
|
|
720
744
|
subagentId: e,
|
|
721
745
|
params: t,
|
|
722
746
|
extraDestinations: n
|
|
723
|
-
}),
|
|
724
|
-
}, []), [
|
|
725
|
-
|
|
747
|
+
}), me(crypto.randomUUID());
|
|
748
|
+
}, []), [Z, ge] = I(null), [_e, ve] = I(null), ye = A((e, t, n) => {
|
|
749
|
+
f(), ge({
|
|
726
750
|
subagentId: e,
|
|
727
751
|
params: t,
|
|
728
752
|
...n
|
|
729
|
-
}),
|
|
730
|
-
}, [
|
|
731
|
-
let e =
|
|
753
|
+
}), ve(crypto.randomUUID());
|
|
754
|
+
}, [f]), be = A(() => {
|
|
755
|
+
let e = a.current;
|
|
732
756
|
e && e.onDismiss();
|
|
733
|
-
}, []),
|
|
757
|
+
}, []), xe = P(() => ({
|
|
734
758
|
scope: t,
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
+
person: n,
|
|
760
|
+
task: r,
|
|
761
|
+
isOpen: o,
|
|
762
|
+
openTask: l,
|
|
763
|
+
closeTask: u,
|
|
764
|
+
toggleOpen: d,
|
|
765
|
+
pendingGoal: p,
|
|
766
|
+
startOrchestrator: re,
|
|
767
|
+
pageContext: te,
|
|
768
|
+
pageContextCard: ne,
|
|
769
|
+
setPageContext: k,
|
|
770
|
+
scopedSubagentId: W,
|
|
771
|
+
pendingScopedSubagentId: T,
|
|
772
|
+
componentAnchors: B,
|
|
773
|
+
anchoredUserMessages: ee,
|
|
774
|
+
registerComponentAnchor: z,
|
|
775
|
+
openPanel: f,
|
|
776
|
+
pendingExtraDestinations: h,
|
|
777
|
+
pendingAttachments: _,
|
|
778
|
+
pendingModel: y,
|
|
779
|
+
orchestratorRunId: x,
|
|
780
|
+
pendingCarryOver: C,
|
|
781
|
+
commitEntityChat: K,
|
|
782
|
+
resumeEntityChat: J,
|
|
783
|
+
pendingResume: q,
|
|
759
784
|
resumeRunId: ae,
|
|
760
|
-
dismissForeignTask:
|
|
761
|
-
pendingManualEntry:
|
|
762
|
-
manualEntryRunId:
|
|
763
|
-
startManualEntry:
|
|
764
|
-
pendingResumeWithAI:
|
|
765
|
-
resumeWithAIRunId:
|
|
766
|
-
resumeWithAI:
|
|
767
|
-
startSubagent:
|
|
768
|
-
pendingStart:
|
|
769
|
-
startRunId:
|
|
785
|
+
dismissForeignTask: be,
|
|
786
|
+
pendingManualEntry: se,
|
|
787
|
+
manualEntryRunId: Y,
|
|
788
|
+
startManualEntry: ue,
|
|
789
|
+
pendingResumeWithAI: de,
|
|
790
|
+
resumeWithAIRunId: pe,
|
|
791
|
+
resumeWithAI: he,
|
|
792
|
+
startSubagent: ye,
|
|
793
|
+
pendingStart: Z,
|
|
794
|
+
startRunId: _e
|
|
770
795
|
}), [
|
|
771
796
|
t,
|
|
772
797
|
n,
|
|
773
|
-
|
|
774
|
-
|
|
798
|
+
r,
|
|
799
|
+
o,
|
|
775
800
|
l,
|
|
776
801
|
u,
|
|
777
|
-
|
|
802
|
+
d,
|
|
803
|
+
p,
|
|
804
|
+
re,
|
|
805
|
+
te,
|
|
806
|
+
ne,
|
|
807
|
+
k,
|
|
778
808
|
W,
|
|
779
|
-
|
|
809
|
+
T,
|
|
780
810
|
B,
|
|
781
811
|
ee,
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
g,
|
|
790
|
-
v,
|
|
791
|
-
b,
|
|
792
|
-
S,
|
|
793
|
-
G,
|
|
794
|
-
q,
|
|
812
|
+
z,
|
|
813
|
+
f,
|
|
814
|
+
h,
|
|
815
|
+
_,
|
|
816
|
+
y,
|
|
817
|
+
x,
|
|
818
|
+
C,
|
|
795
819
|
K,
|
|
796
|
-
ae,
|
|
797
|
-
ye,
|
|
798
820
|
J,
|
|
821
|
+
q,
|
|
822
|
+
ae,
|
|
823
|
+
be,
|
|
799
824
|
se,
|
|
800
|
-
|
|
825
|
+
Y,
|
|
801
826
|
ue,
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
ve,
|
|
827
|
+
de,
|
|
828
|
+
pe,
|
|
805
829
|
he,
|
|
806
|
-
|
|
830
|
+
ye,
|
|
831
|
+
Z,
|
|
832
|
+
_e
|
|
807
833
|
]);
|
|
808
|
-
return /* @__PURE__ */
|
|
809
|
-
value:
|
|
834
|
+
return /* @__PURE__ */ R(it.Provider, {
|
|
835
|
+
value: xe,
|
|
810
836
|
children: e
|
|
811
837
|
});
|
|
812
838
|
}
|
|
813
|
-
function
|
|
814
|
-
let e =
|
|
839
|
+
function ot() {
|
|
840
|
+
let e = j(it);
|
|
815
841
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
816
842
|
return e;
|
|
817
843
|
}
|
|
818
844
|
//#endregion
|
|
819
845
|
//#region src/presentation/AgentActivityLog.tsx
|
|
820
|
-
function
|
|
846
|
+
function st(e) {
|
|
821
847
|
let t = e.search(/[{[]/);
|
|
822
848
|
if (t === -1) return [{
|
|
823
849
|
type: "text",
|
|
@@ -863,51 +889,51 @@ function rt(e) {
|
|
|
863
889
|
language: "json"
|
|
864
890
|
});
|
|
865
891
|
let u = e.slice(s + 1);
|
|
866
|
-
return u.trim() && l.push(...
|
|
892
|
+
return u.trim() && l.push(...st(u)), l;
|
|
867
893
|
}
|
|
868
|
-
function
|
|
894
|
+
function ct(e) {
|
|
869
895
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
870
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
896
|
+
for (; i = n.exec(e);) i.index > r && t.push(...st(e.slice(r, i.index))), t.push({
|
|
871
897
|
type: "code",
|
|
872
898
|
content: i[2].replace(/\n$/, ""),
|
|
873
899
|
language: i[1]
|
|
874
900
|
}), r = n.lastIndex;
|
|
875
|
-
return r < e.length && t.push(...
|
|
901
|
+
return r < e.length && t.push(...st(e.slice(r))), t;
|
|
876
902
|
}
|
|
877
|
-
function
|
|
878
|
-
let [n, r] =
|
|
879
|
-
return /* @__PURE__ */
|
|
903
|
+
function lt({ content: e, language: t }) {
|
|
904
|
+
let [n, r] = I(!1);
|
|
905
|
+
return /* @__PURE__ */ z("div", {
|
|
880
906
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
881
907
|
onClick: () => r((e) => !e),
|
|
882
908
|
title: n ? "Clic per comprimere" : "Clic per espandere",
|
|
883
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ R(c, {
|
|
884
910
|
language: t,
|
|
885
911
|
showCopy: n,
|
|
886
912
|
background: "transparent",
|
|
887
913
|
className: "!text-[11px]",
|
|
888
914
|
children: e
|
|
889
|
-
}), !n && /* @__PURE__ */
|
|
915
|
+
}), !n && /* @__PURE__ */ R("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
890
916
|
});
|
|
891
917
|
}
|
|
892
|
-
function
|
|
893
|
-
let n =
|
|
894
|
-
return /* @__PURE__ */
|
|
918
|
+
function ut({ text: e, tone: t }) {
|
|
919
|
+
let n = ct(e);
|
|
920
|
+
return /* @__PURE__ */ R(L, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ R(lt, {
|
|
895
921
|
content: e.content,
|
|
896
922
|
language: e.language
|
|
897
|
-
}, n) : e.content.trim() && /* @__PURE__ */
|
|
923
|
+
}, n) : e.content.trim() && /* @__PURE__ */ R(i, {
|
|
898
924
|
content: e.content.trim(),
|
|
899
925
|
tone: t,
|
|
900
926
|
className: "break-words text-xs leading-relaxed"
|
|
901
927
|
}, n)) });
|
|
902
928
|
}
|
|
903
|
-
function
|
|
904
|
-
let [e] =
|
|
905
|
-
|
|
929
|
+
function dt() {
|
|
930
|
+
let [e] = I(() => Date.now()), [t, n] = I(e);
|
|
931
|
+
M(() => {
|
|
906
932
|
let e = setInterval(() => n(Date.now()), 1e3);
|
|
907
933
|
return () => clearInterval(e);
|
|
908
934
|
}, []);
|
|
909
935
|
let r = Math.floor((t - e) / 1e3);
|
|
910
|
-
return r < 10 ? null : /* @__PURE__ */
|
|
936
|
+
return r < 10 ? null : /* @__PURE__ */ z("span", {
|
|
911
937
|
className: "tabular-nums",
|
|
912
938
|
children: [
|
|
913
939
|
" · ",
|
|
@@ -917,98 +943,137 @@ function st() {
|
|
|
917
943
|
]
|
|
918
944
|
});
|
|
919
945
|
}
|
|
920
|
-
function
|
|
921
|
-
return e === "running" ? /* @__PURE__ */
|
|
946
|
+
function ft({ status: e }) {
|
|
947
|
+
return e === "running" ? /* @__PURE__ */ R("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ R(f, {
|
|
922
948
|
name: "check",
|
|
923
949
|
size: 12,
|
|
924
950
|
className: "shrink-0 text-green-600"
|
|
925
|
-
}) : e === "stopped" ? /* @__PURE__ */
|
|
951
|
+
}) : e === "stopped" ? /* @__PURE__ */ R(f, {
|
|
926
952
|
name: "circle-slash",
|
|
927
953
|
size: 12,
|
|
928
954
|
className: "shrink-0 text-muted-foreground"
|
|
929
|
-
}) : /* @__PURE__ */
|
|
955
|
+
}) : /* @__PURE__ */ R(f, {
|
|
930
956
|
name: "x",
|
|
931
957
|
size: 12,
|
|
932
958
|
className: "shrink-0 text-destructive"
|
|
933
959
|
});
|
|
934
960
|
}
|
|
935
|
-
function
|
|
961
|
+
function pt(e, t) {
|
|
936
962
|
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;
|
|
937
963
|
}
|
|
938
|
-
var
|
|
939
|
-
function
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
964
|
+
var mt = 96, ht = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
|
|
965
|
+
function gt({ author: e, size: t = 20 }) {
|
|
966
|
+
return e.avatarUrl ? /* @__PURE__ */ R(m, {
|
|
967
|
+
src: e.avatarUrl,
|
|
968
|
+
title: e.name,
|
|
969
|
+
alt: e.name,
|
|
970
|
+
width: t,
|
|
971
|
+
height: t
|
|
972
|
+
}) : /* @__PURE__ */ R(p, {
|
|
973
|
+
value: e.name,
|
|
974
|
+
size: t,
|
|
975
|
+
title: e.name
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
function _t({ speaker: e }) {
|
|
979
|
+
return /* @__PURE__ */ z("div", {
|
|
980
|
+
className: "flex items-center gap-1.5 pt-1 text-xs font-medium text-foreground",
|
|
981
|
+
children: [/* @__PURE__ */ R(gt, {
|
|
982
|
+
author: e,
|
|
983
|
+
size: 18
|
|
984
|
+
}), /* @__PURE__ */ R("span", {
|
|
985
|
+
className: "truncate",
|
|
986
|
+
children: e.name
|
|
987
|
+
})]
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function vt({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a = !1 }) {
|
|
991
|
+
let o = $(), s = F(null), [c, l] = I(!1), [u, d] = I(!1);
|
|
992
|
+
N(() => {
|
|
993
|
+
let e = s.current;
|
|
994
|
+
e && d(e.scrollHeight > 97);
|
|
944
995
|
}, [e.detail, e.attachmentNames]);
|
|
945
|
-
let
|
|
946
|
-
return /* @__PURE__ */
|
|
996
|
+
let p = u && !c;
|
|
997
|
+
return /* @__PURE__ */ z("div", {
|
|
947
998
|
className: `${n ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start justify-end gap-1 bg-background py-1.5`,
|
|
948
|
-
children: [
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
className: "p-1 text-muted-foreground hover:text-foreground",
|
|
956
|
-
disabled: r.disabled,
|
|
957
|
-
onClick: () => r.onRetry(e)
|
|
958
|
-
}), /* @__PURE__ */ P("span", {
|
|
959
|
-
className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
|
|
960
|
-
children: /* @__PURE__ */ P(t, {
|
|
961
|
-
icon: "pencil",
|
|
962
|
-
ariaLabel: a.editMessage,
|
|
963
|
-
title: a.editMessage,
|
|
999
|
+
children: [
|
|
1000
|
+
r?.available(e) && /* @__PURE__ */ z("span", {
|
|
1001
|
+
className: "flex shrink-0 items-center",
|
|
1002
|
+
children: [i && /* @__PURE__ */ R(t, {
|
|
1003
|
+
icon: "rotate-ccw",
|
|
1004
|
+
ariaLabel: o.retry,
|
|
1005
|
+
title: o.retry,
|
|
964
1006
|
variant: "link",
|
|
965
1007
|
className: "p-1 text-muted-foreground hover:text-foreground",
|
|
966
1008
|
disabled: r.disabled,
|
|
967
|
-
onClick: () => r.
|
|
1009
|
+
onClick: () => r.onRetry(e)
|
|
1010
|
+
}), /* @__PURE__ */ R("span", {
|
|
1011
|
+
className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
|
|
1012
|
+
children: /* @__PURE__ */ R(t, {
|
|
1013
|
+
icon: "pencil",
|
|
1014
|
+
ariaLabel: o.editMessage,
|
|
1015
|
+
title: o.editMessage,
|
|
1016
|
+
variant: "link",
|
|
1017
|
+
className: "p-1 text-muted-foreground hover:text-foreground",
|
|
1018
|
+
disabled: r.disabled,
|
|
1019
|
+
onClick: () => r.onEdit(e)
|
|
1020
|
+
})
|
|
1021
|
+
})]
|
|
1022
|
+
}),
|
|
1023
|
+
a && /* @__PURE__ */ R("span", {
|
|
1024
|
+
className: "mt-0.5 shrink-0",
|
|
1025
|
+
children: e.author ? /* @__PURE__ */ R(gt, { author: e.author }) : /* @__PURE__ */ R("span", {
|
|
1026
|
+
className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground",
|
|
1027
|
+
"aria-hidden": !0,
|
|
1028
|
+
children: /* @__PURE__ */ R(f, {
|
|
1029
|
+
name: "user",
|
|
1030
|
+
size: 12
|
|
1031
|
+
})
|
|
968
1032
|
})
|
|
969
|
-
})
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1033
|
+
}),
|
|
1034
|
+
/* @__PURE__ */ z("div", {
|
|
1035
|
+
className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
|
|
1036
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1037
|
+
ref: s,
|
|
1038
|
+
className: `space-y-1 px-2.5 pt-1.5 ${p ? "overflow-hidden" : ""}`,
|
|
1039
|
+
style: p ? { maxHeight: mt } : void 0,
|
|
1040
|
+
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ R("div", {
|
|
1041
|
+
className: "flex flex-wrap gap-1",
|
|
1042
|
+
children: e.attachmentNames.map((e, t) => /* @__PURE__ */ z("span", {
|
|
1043
|
+
className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
|
|
1044
|
+
children: [/* @__PURE__ */ R(f, {
|
|
1045
|
+
name: "paperclip",
|
|
1046
|
+
size: 10,
|
|
1047
|
+
className: "shrink-0"
|
|
1048
|
+
}), /* @__PURE__ */ R("span", {
|
|
1049
|
+
className: "max-w-[160px] truncate",
|
|
1050
|
+
children: e
|
|
1051
|
+
})]
|
|
1052
|
+
}, t))
|
|
1053
|
+
}), /* @__PURE__ */ R(ut, { text: e.detail ?? "" })]
|
|
1054
|
+
}), u && /* @__PURE__ */ z("button", {
|
|
1055
|
+
type: "button",
|
|
1056
|
+
onClick: () => l((e) => !e),
|
|
1057
|
+
className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
|
|
1058
|
+
title: c ? "Comprimi" : "Espandi",
|
|
1059
|
+
children: [p && /* @__PURE__ */ R("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ R(f, {
|
|
1060
|
+
name: c ? "chevron-up" : "chevron-down",
|
|
1061
|
+
size: 12
|
|
1062
|
+
})]
|
|
998
1063
|
})]
|
|
999
|
-
})
|
|
1000
|
-
|
|
1064
|
+
})
|
|
1065
|
+
]
|
|
1001
1066
|
});
|
|
1002
1067
|
}
|
|
1003
|
-
var
|
|
1068
|
+
var yt = {
|
|
1004
1069
|
running: "loader-circle",
|
|
1005
1070
|
done: "check",
|
|
1006
1071
|
error: "x",
|
|
1007
1072
|
stopped: "circle-slash"
|
|
1008
1073
|
};
|
|
1009
|
-
function
|
|
1010
|
-
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 :
|
|
1011
|
-
return /* @__PURE__ */
|
|
1074
|
+
function bt({ steps: e }) {
|
|
1075
|
+
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 }));
|
|
1076
|
+
return /* @__PURE__ */ R(b, {
|
|
1012
1077
|
ariaLabel: t.stepsLabel,
|
|
1013
1078
|
selectedId: null,
|
|
1014
1079
|
itemClassName: "py-0.5 text-xs text-muted-foreground",
|
|
@@ -1018,40 +1083,40 @@ function mt({ steps: e }) {
|
|
|
1018
1083
|
icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
|
|
1019
1084
|
children: e.map((e) => ({
|
|
1020
1085
|
id: e.id,
|
|
1021
|
-
label: /* @__PURE__ */
|
|
1086
|
+
label: /* @__PURE__ */ R("span", {
|
|
1022
1087
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
1023
1088
|
children: e.label
|
|
1024
1089
|
}),
|
|
1025
|
-
icon:
|
|
1090
|
+
icon: yt[e.status]
|
|
1026
1091
|
}))
|
|
1027
1092
|
}]
|
|
1028
1093
|
});
|
|
1029
1094
|
}
|
|
1030
|
-
function
|
|
1031
|
-
let s = $(), [c, l] =
|
|
1032
|
-
return /* @__PURE__ */
|
|
1095
|
+
function xt({ entry: e, part: a, questions: o }) {
|
|
1096
|
+
let s = $(), [c, l] = I(!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";
|
|
1097
|
+
return /* @__PURE__ */ z(r, {
|
|
1033
1098
|
headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
|
|
1034
1099
|
bodyClassName: "px-3 py-2",
|
|
1035
|
-
header: /* @__PURE__ */
|
|
1100
|
+
header: /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("span", {
|
|
1036
1101
|
className: "min-w-0 text-xs font-semibold text-foreground",
|
|
1037
1102
|
children: a.title
|
|
1038
|
-
}), a.badge && /* @__PURE__ */
|
|
1103
|
+
}), a.badge && /* @__PURE__ */ R(n, {
|
|
1039
1104
|
variant: a.badge.variant ?? "info",
|
|
1040
1105
|
children: a.badge.label
|
|
1041
1106
|
})] }),
|
|
1042
|
-
footer: /* @__PURE__ */
|
|
1107
|
+
footer: /* @__PURE__ */ z("div", {
|
|
1043
1108
|
className: "space-y-1.5 px-3 py-2",
|
|
1044
|
-
children: [/* @__PURE__ */
|
|
1109
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1045
1110
|
className: "flex items-center gap-1",
|
|
1046
1111
|
children: [
|
|
1047
|
-
a.details && /* @__PURE__ */
|
|
1112
|
+
a.details && /* @__PURE__ */ R(t, {
|
|
1048
1113
|
icon: "eye",
|
|
1049
1114
|
ariaLabel: s.cardView,
|
|
1050
1115
|
title: s.cardView,
|
|
1051
1116
|
variant: "outline-secondary",
|
|
1052
1117
|
onClick: () => l(!0)
|
|
1053
1118
|
}),
|
|
1054
|
-
(a.actions ?? []).filter((e) => e.variant !== "primary" && e.icon).map((t) => /* @__PURE__ */
|
|
1119
|
+
(a.actions ?? []).filter((e) => e.variant !== "primary" && e.icon).map((t) => /* @__PURE__ */ R(g, {
|
|
1055
1120
|
icon: t.icon,
|
|
1056
1121
|
ariaLabel: t.label,
|
|
1057
1122
|
title: t.label,
|
|
@@ -1059,9 +1124,9 @@ function ht({ entry: e, part: a, questions: o }) {
|
|
|
1059
1124
|
disabled: !u,
|
|
1060
1125
|
onClick: () => o.onCardAction(e.id, a.id, t.id)
|
|
1061
1126
|
}, t.id)),
|
|
1062
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ R("span", {
|
|
1063
1128
|
className: "ms-auto flex items-center gap-1",
|
|
1064
|
-
children: (a.actions ?? []).filter((e) => e.variant === "primary" || !e.icon).map((t) => /* @__PURE__ */
|
|
1129
|
+
children: (a.actions ?? []).filter((e) => e.variant === "primary" || !e.icon).map((t) => /* @__PURE__ */ R(g, {
|
|
1065
1130
|
...t.icon ? { icon: t.icon } : {},
|
|
1066
1131
|
label: t.label,
|
|
1067
1132
|
variant: t.variant ?? "outline-primary",
|
|
@@ -1070,9 +1135,9 @@ function ht({ entry: e, part: a, questions: o }) {
|
|
|
1070
1135
|
}, t.id))
|
|
1071
1136
|
})
|
|
1072
1137
|
]
|
|
1073
|
-
}), a.outcome && /* @__PURE__ */
|
|
1138
|
+
}), a.outcome && /* @__PURE__ */ z("p", {
|
|
1074
1139
|
className: `text-xs ${d}`,
|
|
1075
|
-
children: [a.outcome.text, a.outcome.link && /* @__PURE__ */
|
|
1140
|
+
children: [a.outcome.text, a.outcome.link && /* @__PURE__ */ z(L, { children: [" ", /* @__PURE__ */ R("a", {
|
|
1076
1141
|
className: "underline",
|
|
1077
1142
|
href: a.outcome.link.url,
|
|
1078
1143
|
target: "_blank",
|
|
@@ -1081,27 +1146,27 @@ function ht({ entry: e, part: a, questions: o }) {
|
|
|
1081
1146
|
})] })]
|
|
1082
1147
|
})]
|
|
1083
1148
|
}),
|
|
1084
|
-
children: [a.body ? /* @__PURE__ */
|
|
1149
|
+
children: [a.body ? /* @__PURE__ */ R(i, {
|
|
1085
1150
|
content: a.body,
|
|
1086
1151
|
className: "break-words text-xs leading-relaxed text-foreground"
|
|
1087
|
-
}) : null, c && a.details && /* @__PURE__ */
|
|
1152
|
+
}) : null, c && a.details && /* @__PURE__ */ R(_, {
|
|
1088
1153
|
title: a.title,
|
|
1089
1154
|
position: "right",
|
|
1090
1155
|
size: "lg",
|
|
1091
1156
|
onClose: () => l(!1),
|
|
1092
|
-
footer: /* @__PURE__ */
|
|
1157
|
+
footer: /* @__PURE__ */ R(t, {
|
|
1093
1158
|
label: s.cardClose,
|
|
1094
1159
|
variant: "outline-secondary",
|
|
1095
1160
|
onClick: () => l(!1)
|
|
1096
1161
|
}),
|
|
1097
|
-
children: /* @__PURE__ */
|
|
1162
|
+
children: /* @__PURE__ */ R(i, {
|
|
1098
1163
|
content: a.details,
|
|
1099
1164
|
className: "break-words text-sm leading-relaxed text-foreground"
|
|
1100
1165
|
})
|
|
1101
1166
|
})]
|
|
1102
1167
|
});
|
|
1103
1168
|
}
|
|
1104
|
-
function
|
|
1169
|
+
function St(e, t) {
|
|
1105
1170
|
let n = e.at(-1);
|
|
1106
1171
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
1107
1172
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -1110,9 +1175,9 @@ function gt(e, t) {
|
|
|
1110
1175
|
part: r
|
|
1111
1176
|
};
|
|
1112
1177
|
}
|
|
1113
|
-
function
|
|
1178
|
+
function Ct({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
1114
1179
|
let o = !!n?.canAnswer(e.id);
|
|
1115
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ R(a, {
|
|
1116
1181
|
questions: t.questions,
|
|
1117
1182
|
...t.answers ? { answers: t.answers } : {},
|
|
1118
1183
|
disabled: !t.answers && !o,
|
|
@@ -1121,7 +1186,7 @@ function _t({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
|
1121
1186
|
className: i ?? "text-xs"
|
|
1122
1187
|
});
|
|
1123
1188
|
}
|
|
1124
|
-
function
|
|
1189
|
+
function wt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
1125
1190
|
let r = (e.parts ?? []).filter((e) => e.type !== "questions" || e.id !== n), a = [];
|
|
1126
1191
|
for (let e of r) {
|
|
1127
1192
|
let t = a.at(-1);
|
|
@@ -1133,25 +1198,25 @@ function vt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1133
1198
|
part: e
|
|
1134
1199
|
});
|
|
1135
1200
|
}
|
|
1136
|
-
return /* @__PURE__ */
|
|
1201
|
+
return /* @__PURE__ */ R("div", {
|
|
1137
1202
|
className: "space-y-2",
|
|
1138
1203
|
children: a.map((n) => {
|
|
1139
|
-
if ("steps" in n) return /* @__PURE__ */
|
|
1204
|
+
if ("steps" in n) return /* @__PURE__ */ R(bt, { steps: n.steps }, n.key);
|
|
1140
1205
|
let { part: r } = n;
|
|
1141
|
-
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */
|
|
1206
|
+
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ R(i, {
|
|
1142
1207
|
content: r.text,
|
|
1143
1208
|
streaming: r.streaming,
|
|
1144
1209
|
className: "break-words text-xs leading-relaxed text-foreground"
|
|
1145
|
-
}, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */
|
|
1210
|
+
}, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */ R(o, {
|
|
1146
1211
|
content: r.text,
|
|
1147
1212
|
streaming: r.streaming,
|
|
1148
1213
|
duration: r.duration,
|
|
1149
1214
|
className: "my-0"
|
|
1150
|
-
}, n.key) : r.type === "card" ? /* @__PURE__ */
|
|
1215
|
+
}, n.key) : r.type === "card" ? /* @__PURE__ */ R(xt, {
|
|
1151
1216
|
entry: e,
|
|
1152
1217
|
part: r,
|
|
1153
1218
|
questions: t
|
|
1154
|
-
}, n.key) : /* @__PURE__ */
|
|
1219
|
+
}, n.key) : /* @__PURE__ */ R(Ct, {
|
|
1155
1220
|
entry: e,
|
|
1156
1221
|
part: r,
|
|
1157
1222
|
questions: t
|
|
@@ -1159,52 +1224,52 @@ function vt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1159
1224
|
})
|
|
1160
1225
|
});
|
|
1161
1226
|
}
|
|
1162
|
-
function
|
|
1227
|
+
function Tt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
1163
1228
|
let r = $();
|
|
1164
1229
|
if (e.kind === "thinking" && e.parts) {
|
|
1165
1230
|
let i = e.status === "error" || e.status === "stopped" || e.status === "running";
|
|
1166
|
-
return /* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ z("li", {
|
|
1167
1232
|
className: "text-xs text-muted-foreground",
|
|
1168
|
-
children: [e.parts.length > 0 && /* @__PURE__ */
|
|
1233
|
+
children: [e.parts.length > 0 && /* @__PURE__ */ R(wt, {
|
|
1169
1234
|
entry: e,
|
|
1170
1235
|
questions: t,
|
|
1171
1236
|
hiddenPartId: n
|
|
1172
|
-
}), i && /* @__PURE__ */
|
|
1237
|
+
}), i && /* @__PURE__ */ z("div", {
|
|
1173
1238
|
className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1239
|
+
children: [/* @__PURE__ */ R("span", {
|
|
1175
1240
|
className: "pt-px",
|
|
1176
|
-
children: /* @__PURE__ */
|
|
1177
|
-
}), /* @__PURE__ */
|
|
1241
|
+
children: /* @__PURE__ */ R(ft, { status: e.status })
|
|
1242
|
+
}), /* @__PURE__ */ z("span", {
|
|
1178
1243
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1179
|
-
children: [
|
|
1244
|
+
children: [pt(e, r), e.status === "running" && /* @__PURE__ */ R(dt, {})]
|
|
1180
1245
|
})]
|
|
1181
1246
|
})]
|
|
1182
1247
|
});
|
|
1183
1248
|
}
|
|
1184
|
-
let a = e.kind === "thinking" && e.detail ?
|
|
1185
|
-
return /* @__PURE__ */
|
|
1249
|
+
let a = e.kind === "thinking" && e.detail ? ct(e.detail) : [], o = a.filter((e) => e.type === "code"), s = a.filter((e) => e.type === "text" && e.content.trim()), c = e.kind === "thinking" ? pt(e, r) : e.label;
|
|
1250
|
+
return /* @__PURE__ */ z("li", {
|
|
1186
1251
|
className: "text-xs text-muted-foreground",
|
|
1187
1252
|
children: [
|
|
1188
|
-
/* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ z("div", {
|
|
1189
1254
|
className: "flex items-start gap-1.5",
|
|
1190
|
-
children: [/* @__PURE__ */
|
|
1255
|
+
children: [/* @__PURE__ */ R("span", {
|
|
1191
1256
|
className: "pt-px",
|
|
1192
|
-
children: /* @__PURE__ */
|
|
1193
|
-
}), /* @__PURE__ */
|
|
1257
|
+
children: /* @__PURE__ */ R(ft, { status: e.status })
|
|
1258
|
+
}), /* @__PURE__ */ R("span", {
|
|
1194
1259
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1195
1260
|
children: c
|
|
1196
1261
|
})]
|
|
1197
1262
|
}),
|
|
1198
|
-
o.length > 0 && /* @__PURE__ */
|
|
1263
|
+
o.length > 0 && /* @__PURE__ */ R("div", {
|
|
1199
1264
|
className: "mt-1 ml-[18px] space-y-1",
|
|
1200
|
-
children: o.map((e, t) => /* @__PURE__ */
|
|
1265
|
+
children: o.map((e, t) => /* @__PURE__ */ R(lt, {
|
|
1201
1266
|
content: e.content,
|
|
1202
1267
|
language: e.language
|
|
1203
1268
|
}, t))
|
|
1204
1269
|
}),
|
|
1205
|
-
s.length > 0 && /* @__PURE__ */
|
|
1270
|
+
s.length > 0 && /* @__PURE__ */ R("div", {
|
|
1206
1271
|
className: "mt-1 ml-[18px] space-y-2",
|
|
1207
|
-
children: s.map((e, t) => /* @__PURE__ */
|
|
1272
|
+
children: s.map((e, t) => /* @__PURE__ */ R(i, {
|
|
1208
1273
|
content: e.content.trim(),
|
|
1209
1274
|
tone: "muted",
|
|
1210
1275
|
className: "break-words text-xs leading-relaxed"
|
|
@@ -1213,82 +1278,87 @@ function yt({ entry: e, questions: t, hiddenPartId: n }) {
|
|
|
1213
1278
|
]
|
|
1214
1279
|
});
|
|
1215
1280
|
}
|
|
1216
|
-
function
|
|
1281
|
+
function Et({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i, speaker: a, showAuthors: o }) {
|
|
1217
1282
|
if (e.length === 0) return null;
|
|
1218
|
-
let a = [];
|
|
1219
|
-
for (let t of e) t.kind === "user" ||
|
|
1283
|
+
let s = o ?? (!!a || e.some((e) => e.kind === "user" && e.author)), c = [];
|
|
1284
|
+
for (let t of e) t.kind === "user" || c.length === 0 ? c.push(t.kind === "user" ? {
|
|
1220
1285
|
user: t,
|
|
1221
1286
|
entries: []
|
|
1222
|
-
} : { entries: [t] }) :
|
|
1223
|
-
return /* @__PURE__ */
|
|
1287
|
+
} : { entries: [t] }) : c[c.length - 1].entries.push(t);
|
|
1288
|
+
return /* @__PURE__ */ R("ul", {
|
|
1224
1289
|
className: "space-y-0.5",
|
|
1225
|
-
children:
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1290
|
+
children: c.map((e) => /* @__PURE__ */ z("li", { children: [
|
|
1291
|
+
e.user && /* @__PURE__ */ R(vt, {
|
|
1292
|
+
entry: e.user,
|
|
1293
|
+
pinned: r,
|
|
1294
|
+
actions: i,
|
|
1295
|
+
cut: ht(e.entries),
|
|
1296
|
+
showAuthor: s
|
|
1297
|
+
}),
|
|
1298
|
+
a && e.entries.length > 0 && /* @__PURE__ */ R(_t, { speaker: a }),
|
|
1299
|
+
e.entries.length > 0 && /* @__PURE__ */ R("ul", {
|
|
1300
|
+
className: "space-y-0.5",
|
|
1301
|
+
children: e.entries.map((e) => /* @__PURE__ */ R(Tt, {
|
|
1302
|
+
entry: e,
|
|
1303
|
+
questions: t,
|
|
1304
|
+
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
1305
|
+
}, e.id))
|
|
1306
|
+
})
|
|
1307
|
+
] }, e.user?.id ?? e.entries[0]?.id))
|
|
1238
1308
|
});
|
|
1239
1309
|
}
|
|
1240
1310
|
//#endregion
|
|
1241
1311
|
//#region src/presentation/panelWidth.ts
|
|
1242
|
-
var
|
|
1243
|
-
function
|
|
1312
|
+
var Dt = 420, Ot = 320, kt = "60vw", At = "agentico:panel-width";
|
|
1313
|
+
function jt(e, t) {
|
|
1244
1314
|
if (typeof e == "number") return e;
|
|
1245
1315
|
let n = Number.parseFloat(e);
|
|
1246
1316
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1247
1317
|
}
|
|
1248
|
-
function
|
|
1318
|
+
function Mt(e, t, n) {
|
|
1249
1319
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1250
1320
|
}
|
|
1251
|
-
function
|
|
1321
|
+
function Nt() {
|
|
1252
1322
|
try {
|
|
1253
|
-
let e = window.localStorage.getItem(
|
|
1323
|
+
let e = window.localStorage.getItem(At), t = e === null ? NaN : Number(e);
|
|
1254
1324
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1255
1325
|
} catch {
|
|
1256
1326
|
return null;
|
|
1257
1327
|
}
|
|
1258
1328
|
}
|
|
1259
|
-
function
|
|
1329
|
+
function Pt(e) {
|
|
1260
1330
|
try {
|
|
1261
|
-
e === null ? window.localStorage.removeItem(
|
|
1331
|
+
e === null ? window.localStorage.removeItem(At) : window.localStorage.setItem(At, String(e));
|
|
1262
1332
|
} catch {}
|
|
1263
1333
|
}
|
|
1264
|
-
function
|
|
1334
|
+
function Ft() {
|
|
1265
1335
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1266
1336
|
}
|
|
1267
|
-
function
|
|
1268
|
-
let [i, a] =
|
|
1269
|
-
|
|
1337
|
+
function It({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = kt, onWidthChange: r }) {
|
|
1338
|
+
let [i, a] = I(Ft), [o, s] = I(() => Nt() ?? e);
|
|
1339
|
+
M(() => {
|
|
1270
1340
|
if (typeof window > "u") return;
|
|
1271
1341
|
let e = () => a(window.innerWidth);
|
|
1272
1342
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1273
1343
|
}, []);
|
|
1274
|
-
let c = t, l = Math.max(c,
|
|
1275
|
-
return
|
|
1344
|
+
let c = t, l = Math.max(c, jt(n, i)), u = Mt(o, c, l);
|
|
1345
|
+
return M(() => {
|
|
1276
1346
|
r?.(u);
|
|
1277
1347
|
}, [u]), {
|
|
1278
1348
|
width: u,
|
|
1279
1349
|
min: c,
|
|
1280
1350
|
max: l,
|
|
1281
|
-
set:
|
|
1282
|
-
commit:
|
|
1283
|
-
reset:
|
|
1284
|
-
s(e),
|
|
1351
|
+
set: A((e) => s(Mt(e, c, l)), [c, l]),
|
|
1352
|
+
commit: A((e) => Pt(Mt(e, c, l)), [c, l]),
|
|
1353
|
+
reset: A(() => {
|
|
1354
|
+
s(e), Pt(null);
|
|
1285
1355
|
}, [e])
|
|
1286
1356
|
};
|
|
1287
1357
|
}
|
|
1288
1358
|
//#endregion
|
|
1289
1359
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1290
|
-
function
|
|
1291
|
-
let o = $(), s =
|
|
1360
|
+
function Lt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1361
|
+
let o = $(), s = F(null), [c, l] = I(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1292
1362
|
let t = s.current;
|
|
1293
1363
|
if (t && t.pointerId === e.pointerId) {
|
|
1294
1364
|
s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
|
|
@@ -1298,7 +1368,7 @@ function jt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1298
1368
|
i(t.last);
|
|
1299
1369
|
}
|
|
1300
1370
|
};
|
|
1301
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ R("div", {
|
|
1302
1372
|
role: "separator",
|
|
1303
1373
|
"aria-orientation": "vertical",
|
|
1304
1374
|
"aria-label": o.resizePanel,
|
|
@@ -1337,7 +1407,7 @@ function jt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1337
1407
|
let c = u(s);
|
|
1338
1408
|
r(c), i(c);
|
|
1339
1409
|
},
|
|
1340
|
-
children: /* @__PURE__ */
|
|
1410
|
+
children: /* @__PURE__ */ R("span", {
|
|
1341
1411
|
"aria-hidden": !0,
|
|
1342
1412
|
className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
|
|
1343
1413
|
})
|
|
@@ -1345,9 +1415,9 @@ function jt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1345
1415
|
}
|
|
1346
1416
|
//#endregion
|
|
1347
1417
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1348
|
-
function
|
|
1349
|
-
let { isOpen: n, toggleOpen: r, task: i } =
|
|
1350
|
-
return /* @__PURE__ */
|
|
1418
|
+
function Rt({ className: e = "" }) {
|
|
1419
|
+
let { isOpen: n, toggleOpen: r, task: i } = ot(), a = $(), o = i?.agent.running ?? !1;
|
|
1420
|
+
return /* @__PURE__ */ R(t, {
|
|
1351
1421
|
icon: "bot",
|
|
1352
1422
|
ariaLabel: n ? a.closePanel : a.openPanel,
|
|
1353
1423
|
title: n ? a.closePanel : a.openPanel,
|
|
@@ -1358,32 +1428,32 @@ function Mt({ className: e = "" }) {
|
|
|
1358
1428
|
}
|
|
1359
1429
|
//#endregion
|
|
1360
1430
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1361
|
-
var
|
|
1362
|
-
function
|
|
1431
|
+
var zt = "llmnative-cms.selectedAIModel";
|
|
1432
|
+
function Bt() {
|
|
1363
1433
|
try {
|
|
1364
|
-
return localStorage.getItem(
|
|
1434
|
+
return localStorage.getItem(zt) ?? "";
|
|
1365
1435
|
} catch {
|
|
1366
1436
|
return "";
|
|
1367
1437
|
}
|
|
1368
1438
|
}
|
|
1369
|
-
function
|
|
1439
|
+
function Vt(e) {
|
|
1370
1440
|
try {
|
|
1371
|
-
e ? localStorage.setItem(
|
|
1441
|
+
e ? localStorage.setItem(zt, e) : localStorage.removeItem(zt);
|
|
1372
1442
|
} catch {}
|
|
1373
1443
|
}
|
|
1374
|
-
function
|
|
1375
|
-
let e =
|
|
1376
|
-
return
|
|
1444
|
+
function Ht() {
|
|
1445
|
+
let e = T()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = I({}), [i, a] = I(!1), [o, s] = I(Bt);
|
|
1446
|
+
return M(() => {
|
|
1377
1447
|
if (!t) {
|
|
1378
1448
|
r({});
|
|
1379
1449
|
return;
|
|
1380
1450
|
}
|
|
1381
1451
|
let n = !1;
|
|
1382
|
-
return a(!0),
|
|
1452
|
+
return a(!0), x(e).then((e) => {
|
|
1383
1453
|
if (n) return;
|
|
1384
1454
|
r(e.modelsByProvider);
|
|
1385
1455
|
let t = Object.values(e.modelsByProvider).flat();
|
|
1386
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1456
|
+
s((e) => t.some((t) => t.id === e) ? e : (Vt(""), ""));
|
|
1387
1457
|
}).catch((e) => {
|
|
1388
1458
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
1389
1459
|
}).finally(() => {
|
|
@@ -1397,17 +1467,17 @@ function It() {
|
|
|
1397
1467
|
modelsLoading: i,
|
|
1398
1468
|
selectedModel: o,
|
|
1399
1469
|
setSelectedModel: (e) => {
|
|
1400
|
-
|
|
1470
|
+
Vt(e), s(e);
|
|
1401
1471
|
}
|
|
1402
1472
|
};
|
|
1403
1473
|
}
|
|
1404
1474
|
//#endregion
|
|
1405
1475
|
//#region src/domain/approval.ts
|
|
1406
|
-
var
|
|
1407
|
-
function
|
|
1476
|
+
var Ut = "approval";
|
|
1477
|
+
function Wt(e, t) {
|
|
1408
1478
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1409
1479
|
}
|
|
1410
|
-
function
|
|
1480
|
+
function Gt(e, t, n) {
|
|
1411
1481
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1412
1482
|
return {
|
|
1413
1483
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1416,11 +1486,11 @@ function zt(e, t, n) {
|
|
|
1416
1486
|
}
|
|
1417
1487
|
//#endregion
|
|
1418
1488
|
//#region src/presentation/useAgent.ts
|
|
1419
|
-
var
|
|
1420
|
-
function
|
|
1421
|
-
return e.filter((e) => !
|
|
1489
|
+
var Kt = 20, qt = 26e4;
|
|
1490
|
+
function Jt(e) {
|
|
1491
|
+
return e.filter((e) => !y.isTextAttachment(e.mimeType) || e.base64.length <= qt);
|
|
1422
1492
|
}
|
|
1423
|
-
function
|
|
1493
|
+
function Yt(e) {
|
|
1424
1494
|
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 : {
|
|
1425
1495
|
...e,
|
|
1426
1496
|
status: e.status === "running" ? "stopped" : e.status,
|
|
@@ -1433,40 +1503,42 @@ function Ut(e) {
|
|
|
1433
1503
|
} : e) } : {}
|
|
1434
1504
|
});
|
|
1435
1505
|
}
|
|
1436
|
-
function
|
|
1437
|
-
let { defaultEnabled: n = !1 } = t,
|
|
1506
|
+
function Xt(e, t = {}) {
|
|
1507
|
+
let { defaultEnabled: n = !1 } = t, r = F(t.author);
|
|
1508
|
+
r.current = t.author;
|
|
1509
|
+
let [i, a] = I(n), { hasProviders: o, modelsByProvider: s, modelsLoading: c, selectedModel: l, setSelectedModel: u } = Ht(), [d, f] = I(!1), [p, m] = I(null), [h, g] = I(!1), [_, v] = I([]), b = F([]), x = (e) => {
|
|
1438
1510
|
v((t) => {
|
|
1439
1511
|
let n = typeof e == "function" ? e(t) : e;
|
|
1440
|
-
return
|
|
1512
|
+
return b.current = n, n;
|
|
1441
1513
|
});
|
|
1442
|
-
}, S =
|
|
1443
|
-
|
|
1444
|
-
let
|
|
1445
|
-
|
|
1446
|
-
}, N =
|
|
1514
|
+
}, S = F(/* @__PURE__ */ new Map()), w = $(), E = F(w);
|
|
1515
|
+
E.current = w;
|
|
1516
|
+
let D = F(null), O = F(!1), k = F(null), A = F(null), j = F(null), M = () => {
|
|
1517
|
+
j.current?.abort();
|
|
1518
|
+
}, N = T()?.registry ?? {}, [L, R] = I(void 0), z = F(void 0), V = (e, t) => {
|
|
1447
1519
|
if (!t) return !1;
|
|
1448
1520
|
if (!e) return !0;
|
|
1449
|
-
let n =
|
|
1521
|
+
let n = C(t);
|
|
1450
1522
|
return !!n && e.includes(n.provider);
|
|
1451
|
-
},
|
|
1452
|
-
|
|
1453
|
-
},
|
|
1454
|
-
let t =
|
|
1455
|
-
|
|
1456
|
-
let n =
|
|
1457
|
-
|
|
1458
|
-
let r =
|
|
1459
|
-
|
|
1460
|
-
},
|
|
1461
|
-
let a =
|
|
1462
|
-
if (!a || !
|
|
1523
|
+
}, ne = P(() => L ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, t.filter((e) => L.includes(e.provider))]).filter(([, e]) => e.length)) : s, [L, s]), U = V(L, l) ? l : Object.values(ne).flat()[0]?.id ?? "", W = i && U ? C(U) : null, re = W ? N[W.provider] : null, G = e.executor, K = !!G?.alongside, q = !!G && !K, ie = !G || !!G.canRewind, oe = !!G?.attachments, J = async (e) => oe && e?.length ? Promise.all(e.map((e) => y.fileToAttachment(e))) : void 0, se = F([]), ce = (e) => !!e && se.current.some((t) => t.value === e), Y = F(!1), [le, ue] = I([]), [de, fe] = I(""), pe = F(""), me = (e) => {
|
|
1524
|
+
pe.current = e, fe(e);
|
|
1525
|
+
}, he = (e) => {
|
|
1526
|
+
let t = G?.models?.(e) ?? [];
|
|
1527
|
+
se.current = t, ue(t);
|
|
1528
|
+
let n = G?.catalogProviders?.(e);
|
|
1529
|
+
z.current = n, R(n);
|
|
1530
|
+
let r = K && !V(n, l) ? t[0]?.value : void 0;
|
|
1531
|
+
me(G?.defaultModel?.(e) ?? r ?? "");
|
|
1532
|
+
}, Z = async (e, t, n, r, i) => {
|
|
1533
|
+
let a = D.current;
|
|
1534
|
+
if (!a || !G) return m(E.current.noActiveSession), null;
|
|
1463
1535
|
let o = new AbortController();
|
|
1464
|
-
|
|
1536
|
+
j.current = o;
|
|
1465
1537
|
let s = crypto.randomUUID();
|
|
1466
|
-
|
|
1538
|
+
x((e) => [...e, {
|
|
1467
1539
|
id: s,
|
|
1468
1540
|
kind: "thinking",
|
|
1469
|
-
label:
|
|
1541
|
+
label: E.current.thinking,
|
|
1470
1542
|
status: "running",
|
|
1471
1543
|
parts: []
|
|
1472
1544
|
}]);
|
|
@@ -1474,17 +1546,17 @@ function Wt(e, t = {}) {
|
|
|
1474
1546
|
...e,
|
|
1475
1547
|
streaming: !1,
|
|
1476
1548
|
duration: e.duration ?? l(e.id)
|
|
1477
|
-
}), d = (e, t) =>
|
|
1549
|
+
}), d = (e, t) => x((n) => n.map((n) => {
|
|
1478
1550
|
if (n.id !== s) return n;
|
|
1479
|
-
let r = e(n.parts ?? []), i =
|
|
1551
|
+
let r = e(n.parts ?? []), i = ee(r);
|
|
1480
1552
|
return {
|
|
1481
1553
|
...n,
|
|
1482
1554
|
parts: r,
|
|
1483
1555
|
...t ? { status: t } : {},
|
|
1484
1556
|
...i ? { detail: i } : {}
|
|
1485
1557
|
};
|
|
1486
|
-
})), f = (e) => d((t) =>
|
|
1487
|
-
t?.id && t.id !== "text" && (
|
|
1558
|
+
})), f = (e) => d((t) => H(t, e, u)), p = !1, h = (e, t) => {
|
|
1559
|
+
t?.id && t.id !== "text" && (p = !0), f({
|
|
1488
1560
|
type: "text",
|
|
1489
1561
|
id: t?.id ?? "text",
|
|
1490
1562
|
text: e,
|
|
@@ -1507,15 +1579,15 @@ function Wt(e, t = {}) {
|
|
|
1507
1579
|
}), v = (e) => f({
|
|
1508
1580
|
...e,
|
|
1509
1581
|
type: "card"
|
|
1510
|
-
}),
|
|
1511
|
-
for (let e of
|
|
1582
|
+
}), y = /* @__PURE__ */ new Set(), C = 0, w = () => {
|
|
1583
|
+
for (let e of y) {
|
|
1512
1584
|
let t = S.current.get(e);
|
|
1513
1585
|
S.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
|
|
1514
1586
|
}
|
|
1515
|
-
|
|
1587
|
+
y.clear();
|
|
1516
1588
|
};
|
|
1517
1589
|
o.signal.addEventListener("abort", w);
|
|
1518
|
-
let
|
|
1590
|
+
let T = (e, t) => {
|
|
1519
1591
|
C += 1;
|
|
1520
1592
|
let n = t?.id ?? `questions-${C}`;
|
|
1521
1593
|
f({
|
|
@@ -1524,16 +1596,16 @@ function Wt(e, t = {}) {
|
|
|
1524
1596
|
questions: e
|
|
1525
1597
|
});
|
|
1526
1598
|
let r = `${s}:${n}`;
|
|
1527
|
-
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (
|
|
1599
|
+
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (y.add(r), new Promise((e, t) => {
|
|
1528
1600
|
S.current.set(r, {
|
|
1529
1601
|
resolve: e,
|
|
1530
1602
|
reject: t
|
|
1531
1603
|
});
|
|
1532
1604
|
}));
|
|
1533
|
-
},
|
|
1534
|
-
d((n) => (t && !
|
|
1605
|
+
}, O = (e, t) => {
|
|
1606
|
+
d((n) => (t && !p ? H(n, {
|
|
1535
1607
|
type: "text",
|
|
1536
|
-
id:
|
|
1608
|
+
id: B,
|
|
1537
1609
|
text: t,
|
|
1538
1610
|
streaming: !1
|
|
1539
1611
|
}, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
|
|
@@ -1543,13 +1615,13 @@ function Wt(e, t = {}) {
|
|
|
1543
1615
|
...t,
|
|
1544
1616
|
status: "stopped"
|
|
1545
1617
|
} : t), e), o.signal.removeEventListener("abort", w);
|
|
1546
|
-
for (let e of
|
|
1547
|
-
|
|
1548
|
-
},
|
|
1618
|
+
for (let e of y) S.current.delete(e);
|
|
1619
|
+
y.clear();
|
|
1620
|
+
}, M = e || r?.historyText || "";
|
|
1549
1621
|
try {
|
|
1550
|
-
let c =
|
|
1551
|
-
|
|
1552
|
-
let l =
|
|
1622
|
+
let c = k.current;
|
|
1623
|
+
k.current = null;
|
|
1624
|
+
let l = b.current, u = l.findIndex((e) => e.id === A.current), d = c ? { activity: c.fresh ? c.activity : (u >= 0 ? l.slice(0, u) : l).filter((e) => e.id !== s) } : void 0, f = await G.turn({
|
|
1553
1625
|
params: a.params,
|
|
1554
1626
|
context: a.context,
|
|
1555
1627
|
text: e,
|
|
@@ -1557,7 +1629,7 @@ function Wt(e, t = {}) {
|
|
|
1557
1629
|
signal: o.signal,
|
|
1558
1630
|
...d ? { rewound: d } : {},
|
|
1559
1631
|
...i?.length ? { attachments: i } : {},
|
|
1560
|
-
...n ||
|
|
1632
|
+
...n || pe.current ? { model: n || pe.current } : {},
|
|
1561
1633
|
...r ? { answers: {
|
|
1562
1634
|
id: r.id,
|
|
1563
1635
|
answers: r.answers
|
|
@@ -1565,14 +1637,14 @@ function Wt(e, t = {}) {
|
|
|
1565
1637
|
onText: h,
|
|
1566
1638
|
onReasoning: g,
|
|
1567
1639
|
onStep: _,
|
|
1568
|
-
onQuestions:
|
|
1640
|
+
onQuestions: T,
|
|
1569
1641
|
onCard: v
|
|
1570
1642
|
});
|
|
1571
|
-
return
|
|
1643
|
+
return O("done", f.text), a.history = [
|
|
1572
1644
|
...a.history,
|
|
1573
|
-
...
|
|
1645
|
+
...M ? [{
|
|
1574
1646
|
role: "user",
|
|
1575
|
-
content:
|
|
1647
|
+
content: M
|
|
1576
1648
|
}] : [],
|
|
1577
1649
|
{
|
|
1578
1650
|
role: "assistant",
|
|
@@ -1580,15 +1652,15 @@ function Wt(e, t = {}) {
|
|
|
1580
1652
|
}
|
|
1581
1653
|
], f.result ?? null;
|
|
1582
1654
|
} catch (e) {
|
|
1583
|
-
return a.history = [...a.history, ...
|
|
1655
|
+
return a.history = [...a.history, ...M ? [{
|
|
1584
1656
|
role: "user",
|
|
1585
|
-
content:
|
|
1586
|
-
}] : []], o.signal.aborted ? (
|
|
1657
|
+
content: M
|
|
1658
|
+
}] : []], o.signal.aborted ? (O("stopped"), null) : (O("error"), m(ve(e)), null);
|
|
1587
1659
|
} finally {
|
|
1588
|
-
|
|
1660
|
+
j.current = null;
|
|
1589
1661
|
}
|
|
1590
|
-
},
|
|
1591
|
-
let i =
|
|
1662
|
+
}, ge = async (t, n, r) => {
|
|
1663
|
+
let i = b.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = D.current;
|
|
1592
1664
|
if (!i || !a || !e.onCardAction) return;
|
|
1593
1665
|
let o;
|
|
1594
1666
|
try {
|
|
@@ -1596,20 +1668,20 @@ function Wt(e, t = {}) {
|
|
|
1596
1668
|
} catch (e) {
|
|
1597
1669
|
o = {
|
|
1598
1670
|
status: "error",
|
|
1599
|
-
text:
|
|
1671
|
+
text: ve(e)
|
|
1600
1672
|
};
|
|
1601
1673
|
}
|
|
1602
|
-
o &&
|
|
1674
|
+
o && x((e) => e.map((e) => e.id === t ? {
|
|
1603
1675
|
...e,
|
|
1604
1676
|
parts: e.parts?.map((e) => e.type === "card" && e.id === n ? {
|
|
1605
1677
|
...e,
|
|
1606
1678
|
outcome: o
|
|
1607
1679
|
} : e)
|
|
1608
1680
|
} : e));
|
|
1609
|
-
},
|
|
1610
|
-
let r =
|
|
1611
|
-
if (!r || r.type !== "questions") throw
|
|
1612
|
-
let i = () =>
|
|
1681
|
+
}, ye = async (e, t, n) => {
|
|
1682
|
+
let r = b.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1683
|
+
if (!r || r.type !== "questions") throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
|
|
1684
|
+
let i = () => x((r) => r.map((r) => r.id === e ? {
|
|
1613
1685
|
...r,
|
|
1614
1686
|
parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
|
|
1615
1687
|
...e,
|
|
@@ -1617,38 +1689,38 @@ function Wt(e, t = {}) {
|
|
|
1617
1689
|
} : e)
|
|
1618
1690
|
} : r)), a = `${e}:${t}`, o = S.current.get(a);
|
|
1619
1691
|
if (o) return S.current.delete(a), i(), o.resolve(n), null;
|
|
1620
|
-
if (
|
|
1621
|
-
if (!
|
|
1622
|
-
|
|
1692
|
+
if (O.current) throw m(E.current.requestInProgress), Error(E.current.requestInProgress);
|
|
1693
|
+
if (!q || !D.current) throw m(E.current.noActiveSession), Error(E.current.noActiveSession);
|
|
1694
|
+
O.current = !0, f(!0), m(null), i();
|
|
1623
1695
|
try {
|
|
1624
|
-
return await
|
|
1696
|
+
return await Z("", !1, void 0, {
|
|
1625
1697
|
id: t,
|
|
1626
1698
|
answers: n,
|
|
1627
|
-
historyText:
|
|
1699
|
+
historyText: te(r.questions, n)
|
|
1628
1700
|
});
|
|
1629
1701
|
} finally {
|
|
1630
|
-
|
|
1702
|
+
O.current = !1, f(!1);
|
|
1631
1703
|
}
|
|
1632
|
-
},
|
|
1633
|
-
let i =
|
|
1634
|
-
if (!d) return
|
|
1635
|
-
let f =
|
|
1636
|
-
if (!
|
|
1704
|
+
}, be = async (t, n, r) => {
|
|
1705
|
+
let i = z.current, a = Object.values(s).flat().find((e) => !i || i.includes(e.provider))?.id, o = r && V(i, r) ? r : V(i, U) ? void 0 : a, c = o ? C(o) : W, l = c && D.current ? G?.catalogReasoning?.(D.current.params, c.provider) : void 0, u = l ? { reasoning: l } : {}, d = D.current;
|
|
1706
|
+
if (!d) return m(E.current.noActiveSession), null;
|
|
1707
|
+
let f = o ? C(o) : W, p = f ? N[f.provider] : null;
|
|
1708
|
+
if (!p || !f) return m(E.current.noProviderAvailable), null;
|
|
1637
1709
|
n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
|
|
1638
|
-
let h = (n ?? []).filter((e) =>
|
|
1710
|
+
let h = (n ?? []).filter((e) => y.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= qt ? `\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 = Jt(n ?? []), _ = d.tools.map((e) => ({
|
|
1639
1711
|
name: e.name,
|
|
1640
1712
|
description: e.description,
|
|
1641
|
-
inputSchema:
|
|
1642
|
-
})),
|
|
1643
|
-
let i =
|
|
1644
|
-
|
|
1713
|
+
inputSchema: ae(e.inputSchema)
|
|
1714
|
+
})), v = (e, t, n, r) => {
|
|
1715
|
+
let i = E.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
|
|
1716
|
+
x((e) => [...e, {
|
|
1645
1717
|
id: a,
|
|
1646
1718
|
kind: "thinking",
|
|
1647
1719
|
label: i.approvalHeader,
|
|
1648
1720
|
status: "running",
|
|
1649
1721
|
parts: [{
|
|
1650
1722
|
type: "questions",
|
|
1651
|
-
id:
|
|
1723
|
+
id: Ut,
|
|
1652
1724
|
questions: [{
|
|
1653
1725
|
header: i.approvalHeader,
|
|
1654
1726
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -1657,10 +1729,10 @@ function Wt(e, t = {}) {
|
|
|
1657
1729
|
}]
|
|
1658
1730
|
}]
|
|
1659
1731
|
}]);
|
|
1660
|
-
let s = `${a}:${
|
|
1732
|
+
let s = `${a}:${Ut}`;
|
|
1661
1733
|
return new Promise((e, t) => {
|
|
1662
1734
|
let n = () => {
|
|
1663
|
-
S.current.delete(s),
|
|
1735
|
+
S.current.delete(s), T(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
1664
1736
|
};
|
|
1665
1737
|
if (r.aborted) {
|
|
1666
1738
|
n();
|
|
@@ -1668,14 +1740,14 @@ function Wt(e, t = {}) {
|
|
|
1668
1740
|
}
|
|
1669
1741
|
r.addEventListener("abort", n, { once: !0 }), S.current.set(s, {
|
|
1670
1742
|
resolve: (t) => {
|
|
1671
|
-
r.removeEventListener("abort", n),
|
|
1743
|
+
r.removeEventListener("abort", n), T(a, "done"), e(Gt(t, i.approve, i.reject));
|
|
1672
1744
|
},
|
|
1673
1745
|
reject: t
|
|
1674
1746
|
});
|
|
1675
1747
|
});
|
|
1676
|
-
},
|
|
1677
|
-
|
|
1678
|
-
let
|
|
1748
|
+
}, b = new Map(d.tools.map((e) => [e.name, e])), w = new AbortController();
|
|
1749
|
+
j.current = w;
|
|
1750
|
+
let T = (e, t, n, r) => x((i) => i.map((i) => i.id === e ? {
|
|
1679
1751
|
...i,
|
|
1680
1752
|
status: t,
|
|
1681
1753
|
...n === void 0 ? {} : { detail: n },
|
|
@@ -1683,22 +1755,22 @@ function Wt(e, t = {}) {
|
|
|
1683
1755
|
} : i));
|
|
1684
1756
|
try {
|
|
1685
1757
|
let n = d.history, r = t;
|
|
1686
|
-
for (let t = 0; t <
|
|
1758
|
+
for (let t = 0; t < Kt; t++) {
|
|
1687
1759
|
let i = crypto.randomUUID();
|
|
1688
|
-
|
|
1760
|
+
x((e) => [...e, {
|
|
1689
1761
|
id: i,
|
|
1690
1762
|
kind: "thinking",
|
|
1691
|
-
label:
|
|
1763
|
+
label: E.current.thinking,
|
|
1692
1764
|
status: "running"
|
|
1693
1765
|
}]);
|
|
1694
1766
|
let a;
|
|
1695
1767
|
try {
|
|
1696
|
-
a = await
|
|
1768
|
+
a = await p.complete({
|
|
1697
1769
|
prompt: r,
|
|
1698
1770
|
model: f.model,
|
|
1699
1771
|
...u,
|
|
1700
1772
|
history: n,
|
|
1701
|
-
tools:
|
|
1773
|
+
tools: _.length ? _ : void 0,
|
|
1702
1774
|
signal: w.signal,
|
|
1703
1775
|
attachments: t === 0 ? g : void 0,
|
|
1704
1776
|
logId: d.logId
|
|
@@ -1707,13 +1779,13 @@ function Wt(e, t = {}) {
|
|
|
1707
1779
|
return d.history = [...n, ...r ? [{
|
|
1708
1780
|
role: "user",
|
|
1709
1781
|
content: r + h
|
|
1710
|
-
}] : []], w.signal.aborted ? (
|
|
1782
|
+
}] : []], w.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(ve(t)), null);
|
|
1711
1783
|
}
|
|
1712
1784
|
if (d.history = [...n, ...r ? [{
|
|
1713
1785
|
role: "user",
|
|
1714
1786
|
content: r + h
|
|
1715
|
-
}] : []], !a) return w.signal.aborted ? (
|
|
1716
|
-
if (a.type === "text") return
|
|
1787
|
+
}] : []], !a) return w.signal.aborted ? (T(i, "stopped"), e.fallback(d.params, d.context)) : (T(i, "error"), m(E.current.noProviderResponse), null);
|
|
1788
|
+
if (a.type === "text") return T(i, "done", a.text), e.conversational && a.text.trim() && x((e) => e.map((e) => e.id === i ? {
|
|
1717
1789
|
...e,
|
|
1718
1790
|
parts: [{
|
|
1719
1791
|
type: "text",
|
|
@@ -1734,25 +1806,25 @@ function Wt(e, t = {}) {
|
|
|
1734
1806
|
responseLength: a.text.length,
|
|
1735
1807
|
responsePreview: a.text.length > 2e3 ? `${a.text.slice(0, 1e3)}\n…[troncato qui nel log, ${a.text.length} caratteri totali]…\n${a.text.slice(-1e3)}` : a.text,
|
|
1736
1808
|
params: d.params
|
|
1737
|
-
}),
|
|
1809
|
+
}), m(E.current.invalidResponse), e.fallback(d.params, d.context));
|
|
1738
1810
|
let o = a.toolCalls.map((e) => {
|
|
1739
|
-
let t =
|
|
1811
|
+
let t = b.get(e.name);
|
|
1740
1812
|
return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
1741
1813
|
});
|
|
1742
|
-
|
|
1814
|
+
T(i, "done", a.text || void 0, a.text ? void 0 : o);
|
|
1743
1815
|
let s = /* @__PURE__ */ new Map();
|
|
1744
1816
|
for (let t of a.toolCalls) {
|
|
1745
|
-
let n =
|
|
1746
|
-
if (n &&
|
|
1747
|
-
s.set(t.id, await
|
|
1817
|
+
let n = b.get(t.name);
|
|
1818
|
+
if (n && Wt(n, t.input)) try {
|
|
1819
|
+
s.set(t.id, await v(t.id, n, t.input, w.signal));
|
|
1748
1820
|
} catch {
|
|
1749
1821
|
return e.fallback(d.params, d.context);
|
|
1750
1822
|
}
|
|
1751
1823
|
}
|
|
1752
1824
|
let c = await Promise.all(a.toolCalls.map(async (e) => {
|
|
1753
|
-
let t =
|
|
1825
|
+
let t = b.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
|
|
1754
1826
|
if (r && !r.approved) {
|
|
1755
|
-
|
|
1827
|
+
x((t) => [...t, {
|
|
1756
1828
|
id: e.id,
|
|
1757
1829
|
kind: "tool",
|
|
1758
1830
|
label: n,
|
|
@@ -1766,12 +1838,12 @@ function Wt(e, t = {}) {
|
|
|
1766
1838
|
isError: !0
|
|
1767
1839
|
};
|
|
1768
1840
|
}
|
|
1769
|
-
if (
|
|
1841
|
+
if (x((t) => [...t, {
|
|
1770
1842
|
id: e.id,
|
|
1771
1843
|
kind: "tool",
|
|
1772
1844
|
label: n,
|
|
1773
1845
|
status: "running"
|
|
1774
|
-
}]), !t) return
|
|
1846
|
+
}]), !t) return T(e.id, "error"), {
|
|
1775
1847
|
toolCallId: e.id,
|
|
1776
1848
|
name: e.name,
|
|
1777
1849
|
output: `Tool sconosciuto: ${e.name}`,
|
|
@@ -1779,9 +1851,9 @@ function Wt(e, t = {}) {
|
|
|
1779
1851
|
};
|
|
1780
1852
|
try {
|
|
1781
1853
|
let n = await t.execute(e.input);
|
|
1782
|
-
|
|
1854
|
+
T(e.id, "done");
|
|
1783
1855
|
let r = t.card?.(e.input, n);
|
|
1784
|
-
return r &&
|
|
1856
|
+
return r && x((t) => [...t, {
|
|
1785
1857
|
id: `card-${e.id}`,
|
|
1786
1858
|
kind: "thinking",
|
|
1787
1859
|
label: "",
|
|
@@ -1796,10 +1868,10 @@ function Wt(e, t = {}) {
|
|
|
1796
1868
|
output: n
|
|
1797
1869
|
};
|
|
1798
1870
|
} catch (t) {
|
|
1799
|
-
return
|
|
1871
|
+
return T(e.id, "error"), {
|
|
1800
1872
|
toolCallId: e.id,
|
|
1801
1873
|
name: e.name,
|
|
1802
|
-
output:
|
|
1874
|
+
output: ve(t),
|
|
1803
1875
|
isError: !0
|
|
1804
1876
|
};
|
|
1805
1877
|
}
|
|
@@ -1822,17 +1894,17 @@ function Wt(e, t = {}) {
|
|
|
1822
1894
|
], r = "";
|
|
1823
1895
|
}
|
|
1824
1896
|
let i = crypto.randomUUID();
|
|
1825
|
-
|
|
1897
|
+
x((e) => [...e, {
|
|
1826
1898
|
id: i,
|
|
1827
1899
|
kind: "thinking",
|
|
1828
|
-
label:
|
|
1900
|
+
label: E.current.thinking,
|
|
1829
1901
|
status: "running"
|
|
1830
1902
|
}]);
|
|
1831
1903
|
let a;
|
|
1832
1904
|
try {
|
|
1833
|
-
a = await
|
|
1905
|
+
a = await p.complete({
|
|
1834
1906
|
...u,
|
|
1835
|
-
prompt:
|
|
1907
|
+
prompt: _e(X().stopCallingTools, e.microPromptIds),
|
|
1836
1908
|
model: f.model,
|
|
1837
1909
|
history: n,
|
|
1838
1910
|
signal: w.signal,
|
|
@@ -1842,122 +1914,124 @@ function Wt(e, t = {}) {
|
|
|
1842
1914
|
a = null;
|
|
1843
1915
|
}
|
|
1844
1916
|
if (a?.type === "text") {
|
|
1845
|
-
|
|
1917
|
+
T(i, "done", a.text), d.history = [...n, {
|
|
1846
1918
|
role: "assistant",
|
|
1847
1919
|
content: a.text
|
|
1848
1920
|
}];
|
|
1849
1921
|
let t = e.parseResponse(a.text, d.params, d.context);
|
|
1850
1922
|
if (t) return t;
|
|
1851
|
-
} else
|
|
1852
|
-
return w.signal.aborted ||
|
|
1923
|
+
} else T(i, w.signal.aborted ? "stopped" : "error"), d.history = n;
|
|
1924
|
+
return w.signal.aborted || m(E.current.tooManyToolTurns), e.fallback(d.params, d.context);
|
|
1853
1925
|
} finally {
|
|
1854
|
-
|
|
1926
|
+
j.current = null;
|
|
1855
1927
|
}
|
|
1856
|
-
},
|
|
1857
|
-
if (
|
|
1858
|
-
|
|
1928
|
+
}, xe = async (t, n) => {
|
|
1929
|
+
if (O.current) return m(E.current.requestInProgress), null;
|
|
1930
|
+
O.current = !0, m(null), x(n?.openingMessage ? [{
|
|
1859
1931
|
id: crypto.randomUUID(),
|
|
1860
1932
|
kind: "user",
|
|
1861
1933
|
label: "Tu",
|
|
1862
1934
|
status: "done",
|
|
1863
1935
|
detail: n.openingMessage,
|
|
1936
|
+
...r.current ? { author: r.current } : {},
|
|
1864
1937
|
...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1865
|
-
}] : []),
|
|
1938
|
+
}] : []), f(!0);
|
|
1866
1939
|
try {
|
|
1867
|
-
let
|
|
1868
|
-
if (
|
|
1940
|
+
let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
|
|
1941
|
+
if (D.current = {
|
|
1869
1942
|
params: t,
|
|
1870
|
-
context:
|
|
1943
|
+
context: r,
|
|
1871
1944
|
tools: o,
|
|
1872
1945
|
history: [],
|
|
1873
1946
|
logId: crypto.randomUUID(),
|
|
1874
1947
|
attachmentsRef: a
|
|
1875
|
-
},
|
|
1876
|
-
if (
|
|
1877
|
-
|
|
1878
|
-
let e = n?.model ||
|
|
1879
|
-
if (
|
|
1948
|
+
}, q) return g(!0), he(t), await Z(n?.openingMessage ?? "", !0, void 0, void 0, await J(n?.attachments));
|
|
1949
|
+
if (K) {
|
|
1950
|
+
he(t), Y.current = !1;
|
|
1951
|
+
let e = n?.model || pe.current;
|
|
1952
|
+
if (ce(e)) return g(!0), Y.current = !0, await Z(n?.openingMessage ?? "", !0, e, void 0, await J(n?.attachments));
|
|
1880
1953
|
}
|
|
1881
|
-
let s = n?.model || void 0, c = s ? !!N[
|
|
1882
|
-
if (!
|
|
1883
|
-
|
|
1884
|
-
let n = e.fallback(t,
|
|
1885
|
-
return
|
|
1954
|
+
let s = n?.model || void 0, c = s ? !!N[C(s)?.provider ?? ""] : !!re;
|
|
1955
|
+
if (!i || !c) {
|
|
1956
|
+
g(!1);
|
|
1957
|
+
let n = e.fallback(t, r);
|
|
1958
|
+
return x((t) => [...t, {
|
|
1886
1959
|
id: crypto.randomUUID(),
|
|
1887
1960
|
kind: "tool",
|
|
1888
1961
|
status: "done",
|
|
1889
|
-
label: e.describeFallback?.(n) ??
|
|
1962
|
+
label: e.describeFallback?.(n) ?? E.current.aiDisabledFallback
|
|
1890
1963
|
}]), n;
|
|
1891
1964
|
}
|
|
1892
|
-
|
|
1893
|
-
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
1894
|
-
return await
|
|
1965
|
+
g(!0);
|
|
1966
|
+
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, u = _e(e.buildPrompt(t, r), e.microPromptIds);
|
|
1967
|
+
return await be(u, l, s);
|
|
1895
1968
|
} catch (e) {
|
|
1896
|
-
return
|
|
1969
|
+
return m(ve(e)), null;
|
|
1897
1970
|
} finally {
|
|
1898
|
-
|
|
1971
|
+
O.current = !1, f(!1);
|
|
1899
1972
|
}
|
|
1900
|
-
},
|
|
1901
|
-
if (
|
|
1902
|
-
|
|
1973
|
+
}, Se = async (t, n) => {
|
|
1974
|
+
if (O.current) {
|
|
1975
|
+
m(E.current.requestInProgress);
|
|
1903
1976
|
return;
|
|
1904
1977
|
}
|
|
1905
|
-
|
|
1978
|
+
O.current = !0, m(null), x(Yt(n.activity)), f(!0);
|
|
1906
1979
|
try {
|
|
1907
|
-
let
|
|
1908
|
-
|
|
1980
|
+
let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
|
|
1981
|
+
D.current = {
|
|
1909
1982
|
params: t,
|
|
1910
|
-
context:
|
|
1983
|
+
context: r,
|
|
1911
1984
|
tools: o,
|
|
1912
1985
|
history: n.history,
|
|
1913
1986
|
logId: crypto.randomUUID(),
|
|
1914
1987
|
attachmentsRef: a
|
|
1915
|
-
}, (
|
|
1988
|
+
}, (q || K) && he(t), Y.current = !1, g(q || K || i && !!re);
|
|
1916
1989
|
} catch (e) {
|
|
1917
|
-
|
|
1990
|
+
m(ve(e));
|
|
1918
1991
|
} finally {
|
|
1919
|
-
|
|
1992
|
+
O.current = !1, f(!1);
|
|
1920
1993
|
}
|
|
1921
|
-
},
|
|
1922
|
-
if (
|
|
1923
|
-
if (
|
|
1924
|
-
let
|
|
1925
|
-
if (!
|
|
1926
|
-
|
|
1927
|
-
let
|
|
1928
|
-
|
|
1929
|
-
id:
|
|
1994
|
+
}, Ce = async (t, n) => {
|
|
1995
|
+
if (O.current) return m(E.current.requestInProgress), null;
|
|
1996
|
+
if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
|
|
1997
|
+
let i = D.current;
|
|
1998
|
+
if (!i) return m(E.current.noActiveSession), null;
|
|
1999
|
+
O.current = !0, f(!0);
|
|
2000
|
+
let a = crypto.randomUUID();
|
|
2001
|
+
A.current = a, x((e) => [...e, {
|
|
2002
|
+
id: a,
|
|
1930
2003
|
kind: "user",
|
|
1931
2004
|
label: "Tu",
|
|
1932
2005
|
status: "done",
|
|
1933
2006
|
detail: t,
|
|
2007
|
+
...r.current ? { author: r.current } : {},
|
|
1934
2008
|
...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {},
|
|
1935
2009
|
...n?.retry ? { retry: !0 } : {},
|
|
1936
|
-
historyAt:
|
|
2010
|
+
historyAt: i.history.length
|
|
1937
2011
|
}]);
|
|
1938
2012
|
try {
|
|
1939
|
-
if (
|
|
1940
|
-
let
|
|
1941
|
-
if (
|
|
1942
|
-
let e = !
|
|
1943
|
-
return
|
|
2013
|
+
if (q) return await Z(t, !1, n?.model || void 0, void 0, await J(n?.attachments));
|
|
2014
|
+
let r = n?.model || (K ? pe.current : "");
|
|
2015
|
+
if (K && ce(r)) {
|
|
2016
|
+
let e = !Y.current;
|
|
2017
|
+
return Y.current = !0, await Z(t, e, r, void 0, await J(n?.attachments));
|
|
1944
2018
|
}
|
|
1945
|
-
|
|
1946
|
-
...
|
|
2019
|
+
k.current &&= {
|
|
2020
|
+
...k.current,
|
|
1947
2021
|
fresh: !1
|
|
1948
2022
|
};
|
|
1949
|
-
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
1950
|
-
return await
|
|
2023
|
+
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => y.fileToAttachment(e))) : void 0, o = _e(e.buildFollowUpPrompt(t, i.params, i.context), e.microPromptIds);
|
|
2024
|
+
return await be(o, a, n?.model || void 0);
|
|
1951
2025
|
} catch (e) {
|
|
1952
|
-
return
|
|
2026
|
+
return m(ve(e)), null;
|
|
1953
2027
|
} finally {
|
|
1954
|
-
|
|
2028
|
+
O.current = !1, f(!1);
|
|
1955
2029
|
}
|
|
1956
|
-
},
|
|
1957
|
-
let t =
|
|
1958
|
-
if (!
|
|
2030
|
+
}, we = (e) => {
|
|
2031
|
+
let t = D.current, n = _.findIndex((t) => t.id === e), r = _[n], i = r?.detail?.trim();
|
|
2032
|
+
if (!ie || !t || !r || r.kind !== "user" || !i) return;
|
|
1959
2033
|
if (r.historyAt !== void 0) return r.historyAt;
|
|
1960
|
-
let a =
|
|
2034
|
+
let a = _.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
|
|
1961
2035
|
for (let e = 0; e < t.history.length; e += 1) {
|
|
1962
2036
|
let n = t.history[e];
|
|
1963
2037
|
if (n.role === "user" && n.content.includes(i)) {
|
|
@@ -1965,85 +2039,85 @@ function Wt(e, t = {}) {
|
|
|
1965
2039
|
o += 1;
|
|
1966
2040
|
}
|
|
1967
2041
|
}
|
|
1968
|
-
return n ===
|
|
1969
|
-
},
|
|
1970
|
-
if (
|
|
1971
|
-
let n =
|
|
2042
|
+
return n === _.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
|
|
2043
|
+
}, Te = (e) => we(e) !== void 0, Ee = async (e, t) => {
|
|
2044
|
+
if (O.current) return m(E.current.requestInProgress), null;
|
|
2045
|
+
let n = D.current, r = _.findIndex((t) => t.id === e), i = _[r], a = we(e);
|
|
1972
2046
|
if (!n || !i || a === void 0) return null;
|
|
1973
2047
|
let o = (t ?? i.detail ?? "").trim();
|
|
1974
2048
|
if (!o) return null;
|
|
1975
|
-
let s =
|
|
1976
|
-
return n.history = n.history.slice(0, a),
|
|
2049
|
+
let s = _.slice(0, r);
|
|
2050
|
+
return n.history = n.history.slice(0, a), k.current = {
|
|
1977
2051
|
activity: s,
|
|
1978
2052
|
fresh: !0
|
|
1979
|
-
},
|
|
1980
|
-
},
|
|
1981
|
-
let t =
|
|
2053
|
+
}, x(s), Ce(o);
|
|
2054
|
+
}, De = () => {
|
|
2055
|
+
let t = D.current;
|
|
1982
2056
|
if (!t) return null;
|
|
1983
|
-
|
|
2057
|
+
m(null);
|
|
1984
2058
|
let n = e.fallback(t.params, t.context);
|
|
1985
|
-
return
|
|
2059
|
+
return x((t) => [...t, {
|
|
1986
2060
|
id: crypto.randomUUID(),
|
|
1987
2061
|
kind: "tool",
|
|
1988
2062
|
status: "done",
|
|
1989
|
-
label: e.describeFallback?.(n) ??
|
|
2063
|
+
label: e.describeFallback?.(n) ?? E.current.continueWithoutAiFallback
|
|
1990
2064
|
}]), n;
|
|
1991
|
-
},
|
|
1992
|
-
history:
|
|
1993
|
-
activity:
|
|
2065
|
+
}, Oe = () => D.current ? {
|
|
2066
|
+
history: D.current.history,
|
|
2067
|
+
activity: _
|
|
1994
2068
|
} : null;
|
|
1995
2069
|
return {
|
|
1996
|
-
enabled:
|
|
1997
|
-
setEnabled:
|
|
1998
|
-
hasProviders:
|
|
1999
|
-
selectedModel:
|
|
2000
|
-
setSelectedModel:
|
|
2001
|
-
|
|
2002
|
-
} :
|
|
2003
|
-
modelsByProvider:
|
|
2004
|
-
modelsLoading:
|
|
2005
|
-
running:
|
|
2006
|
-
error:
|
|
2007
|
-
canContinue:
|
|
2008
|
-
remote:
|
|
2009
|
-
remoteModels:
|
|
2010
|
-
alongside:
|
|
2011
|
-
...
|
|
2012
|
-
activity:
|
|
2013
|
-
run:
|
|
2014
|
-
resume:
|
|
2015
|
-
sendMessage:
|
|
2016
|
-
stop:
|
|
2017
|
-
runFallback:
|
|
2018
|
-
snapshot:
|
|
2019
|
-
answerQuestions:
|
|
2020
|
-
cardAction:
|
|
2021
|
-
rewind:
|
|
2022
|
-
canRewind:
|
|
2023
|
-
rewindable:
|
|
2070
|
+
enabled: i,
|
|
2071
|
+
setEnabled: a,
|
|
2072
|
+
hasProviders: o,
|
|
2073
|
+
selectedModel: q || K && de ? de : U,
|
|
2074
|
+
setSelectedModel: q ? me : K ? (e) => {
|
|
2075
|
+
ce(e) ? me(e) : (me(""), u(e));
|
|
2076
|
+
} : u,
|
|
2077
|
+
modelsByProvider: ne,
|
|
2078
|
+
modelsLoading: c,
|
|
2079
|
+
running: d,
|
|
2080
|
+
error: p,
|
|
2081
|
+
canContinue: h,
|
|
2082
|
+
remote: q,
|
|
2083
|
+
remoteModels: le,
|
|
2084
|
+
alongside: K,
|
|
2085
|
+
...G?.catalogGroup ? { catalogGroup: G.catalogGroup } : {},
|
|
2086
|
+
activity: _,
|
|
2087
|
+
run: xe,
|
|
2088
|
+
resume: Se,
|
|
2089
|
+
sendMessage: Ce,
|
|
2090
|
+
stop: M,
|
|
2091
|
+
runFallback: De,
|
|
2092
|
+
snapshot: Oe,
|
|
2093
|
+
answerQuestions: ye,
|
|
2094
|
+
cardAction: ge,
|
|
2095
|
+
rewind: Ee,
|
|
2096
|
+
canRewind: ie,
|
|
2097
|
+
rewindable: Te,
|
|
2024
2098
|
executorAttachments: oe,
|
|
2025
2099
|
offersFallback: e.offersFallback !== !1
|
|
2026
2100
|
};
|
|
2027
2101
|
}
|
|
2028
2102
|
//#endregion
|
|
2029
2103
|
//#region src/domain/orchestrator/prompt.ts
|
|
2030
|
-
function
|
|
2104
|
+
function Zt() {
|
|
2031
2105
|
let e = X();
|
|
2032
2106
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
2033
2107
|
}
|
|
2034
|
-
function
|
|
2108
|
+
function Qt(e, t, n) {
|
|
2035
2109
|
let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
2036
2110
|
return `${r.orchestratorIntro}
|
|
2037
2111
|
|
|
2038
2112
|
${r.toolsHeading}
|
|
2039
2113
|
${t}
|
|
2040
2114
|
${i}
|
|
2041
|
-
${
|
|
2115
|
+
${Zt()}
|
|
2042
2116
|
|
|
2043
2117
|
${r.userRequestHeading}
|
|
2044
2118
|
${e}`;
|
|
2045
2119
|
}
|
|
2046
|
-
function
|
|
2120
|
+
function $t(e, t) {
|
|
2047
2121
|
return t ? {
|
|
2048
2122
|
kind: "handoff",
|
|
2049
2123
|
...t
|
|
@@ -2054,27 +2128,27 @@ function qt(e, t) {
|
|
|
2054
2128
|
}
|
|
2055
2129
|
//#endregion
|
|
2056
2130
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
2057
|
-
function
|
|
2058
|
-
return
|
|
2131
|
+
function en(e) {
|
|
2132
|
+
return re().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
2059
2133
|
}
|
|
2060
|
-
function
|
|
2134
|
+
function tn(e) {
|
|
2061
2135
|
return {
|
|
2062
2136
|
buildContext(e) {
|
|
2063
2137
|
return {
|
|
2064
|
-
cliCatalog:
|
|
2138
|
+
cliCatalog: he(en(e.scopedSubagentId)),
|
|
2065
2139
|
handoff: { current: null },
|
|
2066
2140
|
collected: {}
|
|
2067
2141
|
};
|
|
2068
2142
|
},
|
|
2069
2143
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
2070
|
-
return
|
|
2144
|
+
return Qt(e, n, t);
|
|
2071
2145
|
},
|
|
2072
2146
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
2073
|
-
return `${e}\n\n${
|
|
2147
|
+
return `${e}\n\n${Zt()}\n\n${X().toolsHeading}\n${n}`;
|
|
2074
2148
|
},
|
|
2075
2149
|
parseResponse(e, t, n) {
|
|
2076
2150
|
let r = n.handoff.current;
|
|
2077
|
-
return n.handoff.current = null,
|
|
2151
|
+
return n.handoff.current = null, $t(e, r);
|
|
2078
2152
|
},
|
|
2079
2153
|
fallback() {
|
|
2080
2154
|
return {
|
|
@@ -2086,16 +2160,16 @@ function Yt(e) {
|
|
|
2086
2160
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
2087
2161
|
},
|
|
2088
2162
|
getTools(t, n, r) {
|
|
2089
|
-
let i =
|
|
2163
|
+
let i = ie({
|
|
2090
2164
|
attachmentsRef: r,
|
|
2091
2165
|
collected: n.collected,
|
|
2092
|
-
proxyFetch:
|
|
2093
|
-
}), a = t.scopedSubagentId ?
|
|
2166
|
+
proxyFetch: w
|
|
2167
|
+
}), a = t.scopedSubagentId ? G(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = en(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
2094
2168
|
name: `${t.id}_${r.name}`,
|
|
2095
2169
|
description: `${t.label}: ${r.summary}`,
|
|
2096
2170
|
inputSchema: r.inputSchema,
|
|
2097
|
-
describeInvocation: () =>
|
|
2098
|
-
describeIntent:
|
|
2171
|
+
describeInvocation: () => S(e.preparing, { label: t.label }),
|
|
2172
|
+
describeIntent: S(e.collecting, { label: t.label }),
|
|
2099
2173
|
async execute(e) {
|
|
2100
2174
|
let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
|
|
2101
2175
|
return n.handoff.current = {
|
|
@@ -2104,7 +2178,7 @@ function Yt(e) {
|
|
|
2104
2178
|
params: i
|
|
2105
2179
|
}, {
|
|
2106
2180
|
status: "queued",
|
|
2107
|
-
note:
|
|
2181
|
+
note: S(X().handoffQueued, { label: t.label })
|
|
2108
2182
|
};
|
|
2109
2183
|
}
|
|
2110
2184
|
})));
|
|
@@ -2114,22 +2188,22 @@ function Yt(e) {
|
|
|
2114
2188
|
}
|
|
2115
2189
|
//#endregion
|
|
2116
2190
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
2117
|
-
function
|
|
2191
|
+
function nn(e, t) {
|
|
2118
2192
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
2119
2193
|
}
|
|
2120
2194
|
//#endregion
|
|
2121
2195
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
2122
|
-
function
|
|
2123
|
-
let s = $(), c =
|
|
2196
|
+
function rn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
2197
|
+
let s = $(), c = ot(), l = c.scope, u = O(), [d, f] = I(null), [p, m] = I(new Set(i ?? [])), [h, g] = I(null), _ = Te(), v = /* @__PURE__ */ new Map();
|
|
2124
2198
|
e.destinationIds.forEach((e) => {
|
|
2125
2199
|
let t = _[e];
|
|
2126
2200
|
t && v.set(e, t);
|
|
2127
|
-
}), (o ?? []).forEach((e) => v.set(e.id, e)), v.set(
|
|
2128
|
-
let y = Array.from(v.values()),
|
|
2201
|
+
}), (o ?? []).forEach((e) => v.set(e.id, e)), v.set(Se.id, Se);
|
|
2202
|
+
let y = Array.from(v.values()), b = async (i) => {
|
|
2129
2203
|
f(i), g(null);
|
|
2130
2204
|
try {
|
|
2131
2205
|
let o = v.get(i);
|
|
2132
|
-
if (!o) throw Error(
|
|
2206
|
+
if (!o) throw Error(S(s.unknownDestination, { id: i }));
|
|
2133
2207
|
if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
|
|
2134
2208
|
let d = await o.apply(t, {
|
|
2135
2209
|
scopeId: l?.id ?? "",
|
|
@@ -2137,31 +2211,31 @@ function Zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2137
2211
|
storageProvider: l?.storageProvider ?? null,
|
|
2138
2212
|
proxyFetch: u
|
|
2139
2213
|
}, n);
|
|
2140
|
-
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n,
|
|
2214
|
+
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, nn(e, n));
|
|
2141
2215
|
} catch (e) {
|
|
2142
2216
|
g(e instanceof Error ? e.message : String(e));
|
|
2143
2217
|
} finally {
|
|
2144
2218
|
f(null);
|
|
2145
2219
|
}
|
|
2146
2220
|
};
|
|
2147
|
-
return /* @__PURE__ */
|
|
2221
|
+
return /* @__PURE__ */ z("div", {
|
|
2148
2222
|
className: "space-y-2",
|
|
2149
2223
|
children: [
|
|
2150
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ R("p", {
|
|
2151
2225
|
className: "text-xs font-medium text-muted-foreground",
|
|
2152
2226
|
children: s.destinationPickerTitle
|
|
2153
2227
|
}),
|
|
2154
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ R("div", {
|
|
2155
2229
|
className: "flex flex-wrap gap-2",
|
|
2156
|
-
children: y.map((e) => /* @__PURE__ */
|
|
2230
|
+
children: y.map((e) => /* @__PURE__ */ R("button", {
|
|
2157
2231
|
type: "button",
|
|
2158
2232
|
disabled: d !== null,
|
|
2159
|
-
onClick: () => void
|
|
2233
|
+
onClick: () => void b(e.id),
|
|
2160
2234
|
className: "cursor-pointer rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-60",
|
|
2161
2235
|
children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
|
|
2162
2236
|
}, e.id))
|
|
2163
2237
|
}),
|
|
2164
|
-
h && /* @__PURE__ */
|
|
2238
|
+
h && /* @__PURE__ */ R("p", {
|
|
2165
2239
|
className: "text-xs text-destructive",
|
|
2166
2240
|
children: h
|
|
2167
2241
|
})
|
|
@@ -2170,33 +2244,33 @@ function Zt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2170
2244
|
}
|
|
2171
2245
|
//#endregion
|
|
2172
2246
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
2173
|
-
var
|
|
2174
|
-
function
|
|
2175
|
-
Object.assign(
|
|
2247
|
+
var an = {};
|
|
2248
|
+
function on(e) {
|
|
2249
|
+
Object.assign(an, e);
|
|
2176
2250
|
}
|
|
2177
|
-
function
|
|
2178
|
-
return
|
|
2251
|
+
function sn(e) {
|
|
2252
|
+
return an[e];
|
|
2179
2253
|
}
|
|
2180
2254
|
//#endregion
|
|
2181
2255
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
2182
|
-
function
|
|
2183
|
-
let [t, n] =
|
|
2184
|
-
return /* @__PURE__ */
|
|
2256
|
+
function cn({ result: e }) {
|
|
2257
|
+
let [t, n] = I(!1);
|
|
2258
|
+
return /* @__PURE__ */ z("div", {
|
|
2185
2259
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
2186
2260
|
onClick: () => n((e) => !e),
|
|
2187
2261
|
title: t ? "Clic per comprimere" : "Clic per espandere",
|
|
2188
|
-
children: [/* @__PURE__ */
|
|
2262
|
+
children: [/* @__PURE__ */ R(c, {
|
|
2189
2263
|
language: "json",
|
|
2190
2264
|
showCopy: t,
|
|
2191
2265
|
background: "transparent",
|
|
2192
2266
|
className: "!text-[11px]",
|
|
2193
2267
|
children: JSON.stringify(e, null, 2)
|
|
2194
|
-
}), !t && /* @__PURE__ */
|
|
2268
|
+
}), !t && /* @__PURE__ */ R("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
2195
2269
|
});
|
|
2196
2270
|
}
|
|
2197
2271
|
//#endregion
|
|
2198
2272
|
//#region src/presentation/liveAnchorDestination.ts
|
|
2199
|
-
function
|
|
2273
|
+
function ln(e, t, n) {
|
|
2200
2274
|
return e.length === 0 ? null : {
|
|
2201
2275
|
id: "live-component",
|
|
2202
2276
|
label: "Applica al componente aperto",
|
|
@@ -2207,38 +2281,38 @@ function nn(e, t, n) {
|
|
|
2207
2281
|
}
|
|
2208
2282
|
//#endregion
|
|
2209
2283
|
//#region src/presentation/subagentControls.ts
|
|
2210
|
-
var
|
|
2211
|
-
function
|
|
2212
|
-
Object.assign(
|
|
2284
|
+
var un = {};
|
|
2285
|
+
function dn(e) {
|
|
2286
|
+
Object.assign(un, e);
|
|
2213
2287
|
}
|
|
2214
|
-
function
|
|
2215
|
-
return
|
|
2288
|
+
function fn(e) {
|
|
2289
|
+
return un[e];
|
|
2216
2290
|
}
|
|
2217
2291
|
//#endregion
|
|
2218
2292
|
//#region src/presentation/chatTitles.ts
|
|
2219
|
-
function
|
|
2220
|
-
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !
|
|
2293
|
+
function pn(e, t = 6e3) {
|
|
2294
|
+
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Je(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
|
|
2221
2295
|
return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
|
|
2222
2296
|
}
|
|
2223
|
-
function
|
|
2297
|
+
function mn(e) {
|
|
2224
2298
|
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);
|
|
2225
2299
|
}
|
|
2226
|
-
function
|
|
2300
|
+
function hn(e, t) {
|
|
2227
2301
|
try {
|
|
2228
2302
|
return e.definition.executor?.catalogProviders?.(e.toParams(t));
|
|
2229
2303
|
} catch {
|
|
2230
2304
|
return;
|
|
2231
2305
|
}
|
|
2232
2306
|
}
|
|
2233
|
-
function
|
|
2234
|
-
let a =
|
|
2235
|
-
let t = e ?
|
|
2307
|
+
function gn(e, t, n, r, i) {
|
|
2308
|
+
let a = hn(e, t), o = (e) => {
|
|
2309
|
+
let t = e ? C(e) : null;
|
|
2236
2310
|
return !(!t || !i[t.provider] || a && !a.includes(t.provider));
|
|
2237
2311
|
};
|
|
2238
2312
|
return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
|
|
2239
2313
|
}
|
|
2240
|
-
function
|
|
2241
|
-
let t =
|
|
2314
|
+
function _n(e) {
|
|
2315
|
+
let t = T()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Ht(), i = F({
|
|
2242
2316
|
registry: t,
|
|
2243
2317
|
modelsByProvider: n,
|
|
2244
2318
|
selectedModel: r
|
|
@@ -2248,33 +2322,33 @@ function dn(e) {
|
|
|
2248
2322
|
modelsByProvider: n,
|
|
2249
2323
|
selectedModel: r
|
|
2250
2324
|
};
|
|
2251
|
-
let a =
|
|
2325
|
+
let a = F(/* @__PURE__ */ new Set()), o = A(async (t, n, r) => {
|
|
2252
2326
|
if (!e) return !1;
|
|
2253
|
-
let o =
|
|
2254
|
-
if (!o || !s?.autoTitle || o.name || !
|
|
2255
|
-
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f =
|
|
2327
|
+
let o = Ve(e, t, n), s = G(t), c = `${e}:${t}:${n}`;
|
|
2328
|
+
if (!o || !s?.autoTitle || o.name || !qe(o) || a.current.has(c)) return !1;
|
|
2329
|
+
let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = gn(s, o.params, r ?? d, u, l), p = f ? C(f) : null;
|
|
2256
2330
|
if (!p) return !1;
|
|
2257
2331
|
a.current.add(c);
|
|
2258
2332
|
try {
|
|
2259
2333
|
let r = await l[p.provider].complete({
|
|
2260
|
-
prompt: X().chatTitle.replace("{chat}",
|
|
2334
|
+
prompt: X().chatTitle.replace("{chat}", pn(o.activity)),
|
|
2261
2335
|
model: p.model,
|
|
2262
2336
|
history: []
|
|
2263
|
-
}), i = r && r.type === "text" ?
|
|
2264
|
-
return i ?
|
|
2337
|
+
}), i = r && r.type === "text" ? mn(r.text) : "";
|
|
2338
|
+
return i ? Ye(e, t, n, i, "model") : !1;
|
|
2265
2339
|
} catch {
|
|
2266
2340
|
return !1;
|
|
2267
2341
|
} finally {
|
|
2268
2342
|
a.current.delete(c);
|
|
2269
2343
|
}
|
|
2270
2344
|
}, [e]), s = Object.keys(n).length > 0;
|
|
2271
|
-
return
|
|
2272
|
-
e && s && !
|
|
2273
|
-
for (let t of
|
|
2274
|
-
let n =
|
|
2345
|
+
return M(() => {
|
|
2346
|
+
e && s && !vn.has(e) && (vn.add(e), (async () => {
|
|
2347
|
+
for (let t of Qe(e)) {
|
|
2348
|
+
let n = G(t.subagentId);
|
|
2275
2349
|
if (n?.autoTitle) {
|
|
2276
|
-
if (n.definition.conversational && !
|
|
2277
|
-
|
|
2350
|
+
if (n.definition.conversational && !qe(t)) {
|
|
2351
|
+
Ze(e, t.subagentId, t.entityId);
|
|
2278
2352
|
continue;
|
|
2279
2353
|
}
|
|
2280
2354
|
t.name || await o(t.subagentId, t.entityId);
|
|
@@ -2287,218 +2361,229 @@ function dn(e) {
|
|
|
2287
2361
|
o
|
|
2288
2362
|
]), o;
|
|
2289
2363
|
}
|
|
2290
|
-
var
|
|
2291
|
-
function
|
|
2292
|
-
let c =
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2364
|
+
var vn = /* @__PURE__ */ new Set(), yn = () => ({});
|
|
2365
|
+
function bn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
2366
|
+
let c = ot(), l = Xt(e.definition, {
|
|
2367
|
+
defaultEnabled: !0,
|
|
2368
|
+
...c.person ? { author: c.person } : {}
|
|
2369
|
+
}), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p = O(), m = F(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [h, g] = I(null), _ = (t) => {
|
|
2370
|
+
e.definition.conversational || g(t);
|
|
2371
|
+
}, [v, y] = I([]), [b, x] = I(null), S = sn(e.id), C = S?.kind === "selection" ? S : null, [w, T] = I(null), E = F(!1), D = F(0), k = F(null);
|
|
2372
|
+
h && h !== k.current && (k.current = h, D.current = (r?.length ?? 0) + l.activity.length);
|
|
2373
|
+
let A = F(!1), j = l.remote || !l.hasProviders || l.selectedModel !== "";
|
|
2374
|
+
M(() => {
|
|
2375
|
+
!E.current && j && (E.current = !0, a ? (re.current = !0, l.resume(e.toParams(t), a)) : (o && l.setSelectedModel(o), l.run(e.toParams(t), {
|
|
2299
2376
|
model: o,
|
|
2300
2377
|
openingMessage: s
|
|
2301
2378
|
}).then((e) => {
|
|
2302
|
-
e &&
|
|
2379
|
+
e && _(e);
|
|
2303
2380
|
})));
|
|
2304
|
-
}, [
|
|
2305
|
-
if (!
|
|
2306
|
-
let n = e.autoApplyDestinationIds ?? [], r =
|
|
2381
|
+
}, [j]), M(() => {
|
|
2382
|
+
if (!h || !f) return;
|
|
2383
|
+
let n = e.autoApplyDestinationIds ?? [], r = c.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = Te();
|
|
2307
2384
|
n.forEach((n) => {
|
|
2308
2385
|
let a = i[n];
|
|
2309
|
-
a && (
|
|
2310
|
-
scopeId:
|
|
2311
|
-
dataProvider:
|
|
2312
|
-
storageProvider:
|
|
2313
|
-
proxyFetch:
|
|
2386
|
+
a && (x(null), a.apply(h, {
|
|
2387
|
+
scopeId: f.id,
|
|
2388
|
+
dataProvider: f.dataProvider,
|
|
2389
|
+
storageProvider: f.storageProvider,
|
|
2390
|
+
proxyFetch: p
|
|
2314
2391
|
}, {
|
|
2315
2392
|
...t,
|
|
2316
2393
|
pinnedEntityId: r
|
|
2317
2394
|
}).then((n) => {
|
|
2318
|
-
n?.id &&
|
|
2319
|
-
}).catch((e) =>
|
|
2395
|
+
n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t, nn(e, t));
|
|
2396
|
+
}).catch((e) => x(e instanceof Error ? e.message : String(e))));
|
|
2320
2397
|
});
|
|
2321
2398
|
}, [
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
]),
|
|
2326
|
-
|
|
2327
|
-
}, [
|
|
2328
|
-
let
|
|
2329
|
-
|
|
2399
|
+
h,
|
|
2400
|
+
l.activity,
|
|
2401
|
+
f
|
|
2402
|
+
]), M(() => {
|
|
2403
|
+
h && C && T(C.defaultSelection(h));
|
|
2404
|
+
}, [h, C]);
|
|
2405
|
+
let N = (e, t) => {
|
|
2406
|
+
T((n) => n && {
|
|
2330
2407
|
...n,
|
|
2331
2408
|
[e]: t
|
|
2332
2409
|
});
|
|
2333
|
-
},
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
]),
|
|
2338
|
-
|
|
2410
|
+
}, B = (e) => _(e), V = P(() => h && C && w ? C.applySelection(h, w) : h, [
|
|
2411
|
+
h,
|
|
2412
|
+
C,
|
|
2413
|
+
w
|
|
2414
|
+
]), H = P(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), ee = P(() => ln(H, t, m), [
|
|
2415
|
+
H,
|
|
2339
2416
|
t,
|
|
2340
|
-
|
|
2341
|
-
]),
|
|
2342
|
-
|
|
2343
|
-
let n = !
|
|
2344
|
-
if (
|
|
2345
|
-
if (
|
|
2346
|
-
i && (
|
|
2417
|
+
m
|
|
2418
|
+
]), te = P(() => ee ? [ee, ...n ?? []] : n, [ee, n]), ne = e.chatEntityId?.(t), U = _n(f?.id), W = F(!1), re = F(!1);
|
|
2419
|
+
M(() => {
|
|
2420
|
+
let n = !W.current && l.running, i = W.current && !l.running;
|
|
2421
|
+
if (W.current = l.running, !n && !i || !ne || !f) return;
|
|
2422
|
+
if (re.current) {
|
|
2423
|
+
i && (re.current = !1);
|
|
2347
2424
|
return;
|
|
2348
2425
|
}
|
|
2349
|
-
let a =
|
|
2426
|
+
let a = l.snapshot();
|
|
2350
2427
|
if (!a) return;
|
|
2351
2428
|
let o = [...r ?? [], ...a.activity];
|
|
2352
|
-
e.autoTitle && e.definition.conversational && !
|
|
2353
|
-
scopeId:
|
|
2429
|
+
e.autoTitle && e.definition.conversational && !qe({ activity: o }) || (He({
|
|
2430
|
+
scopeId: f.id,
|
|
2354
2431
|
subagentId: e.id,
|
|
2355
|
-
entityId:
|
|
2432
|
+
entityId: ne,
|
|
2356
2433
|
params: t,
|
|
2357
|
-
title:
|
|
2434
|
+
title: nn(e, t),
|
|
2358
2435
|
history: a.history,
|
|
2359
2436
|
activity: o
|
|
2360
|
-
}), i && e.autoTitle &&
|
|
2361
|
-
}, [
|
|
2362
|
-
let
|
|
2363
|
-
|
|
2364
|
-
},
|
|
2437
|
+
}), i && e.autoTitle && U(e.id, ne, l.selectedModel));
|
|
2438
|
+
}, [l.running]);
|
|
2439
|
+
let G = () => {
|
|
2440
|
+
A.current = !0, l.running && l.stop(), c.closeTask(m);
|
|
2441
|
+
}, K = F(fn(e.id) ?? yn).current, q = K({
|
|
2365
2442
|
params: t,
|
|
2366
|
-
taskId:
|
|
2367
|
-
running:
|
|
2368
|
-
close:
|
|
2369
|
-
}),
|
|
2370
|
-
|
|
2443
|
+
taskId: m,
|
|
2444
|
+
running: l.running,
|
|
2445
|
+
close: G
|
|
2446
|
+
}), ie = (e) => {
|
|
2447
|
+
y((t) => t.includes(e) ? t : [...t, e]);
|
|
2371
2448
|
};
|
|
2372
|
-
return
|
|
2373
|
-
|
|
2374
|
-
id:
|
|
2375
|
-
title:
|
|
2449
|
+
return M(() => {
|
|
2450
|
+
A.current || c.openTask({
|
|
2451
|
+
id: m,
|
|
2452
|
+
title: nn(e, t),
|
|
2376
2453
|
icon: e.icon,
|
|
2377
|
-
agent:
|
|
2378
|
-
onApplied: (e) =>
|
|
2454
|
+
agent: l,
|
|
2455
|
+
onApplied: (e) => _(e),
|
|
2379
2456
|
precedingActivity: r,
|
|
2380
|
-
panelExtraAnchorIndex:
|
|
2381
|
-
onDismiss:
|
|
2382
|
-
...
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2457
|
+
panelExtraAnchorIndex: D.current,
|
|
2458
|
+
onDismiss: G,
|
|
2459
|
+
...u ? { thread: u } : {},
|
|
2460
|
+
...d ? { speaker: d } : {},
|
|
2461
|
+
...ne ? { savedToDisk: !0 } : {},
|
|
2462
|
+
panelActions: q.content,
|
|
2463
|
+
composerActions: q.actions,
|
|
2464
|
+
composerCommands: q.commands,
|
|
2465
|
+
panelExtra: h ? /* @__PURE__ */ z(L, { children: [
|
|
2466
|
+
C && w ? /* @__PURE__ */ R(C.Report, {
|
|
2467
|
+
result: h,
|
|
2468
|
+
selection: w,
|
|
2469
|
+
onChange: N
|
|
2470
|
+
}) : S?.kind === "editable" ? /* @__PURE__ */ R(S.Report, {
|
|
2471
|
+
result: h,
|
|
2472
|
+
onResultChange: B
|
|
2473
|
+
}) : /* @__PURE__ */ R(cn, { result: V }),
|
|
2474
|
+
b && /* @__PURE__ */ z("p", {
|
|
2396
2475
|
className: "text-xs text-destructive",
|
|
2397
|
-
children: ["Salvataggio automatico non riuscito: ",
|
|
2476
|
+
children: ["Salvataggio automatico non riuscito: ", b]
|
|
2398
2477
|
}),
|
|
2399
|
-
/* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ R(rn, {
|
|
2400
2479
|
manifest: e,
|
|
2401
|
-
result:
|
|
2480
|
+
result: V,
|
|
2402
2481
|
meta: t,
|
|
2403
|
-
taskId:
|
|
2404
|
-
initiallyApplied:
|
|
2405
|
-
onApplied:
|
|
2406
|
-
extraDestinations:
|
|
2482
|
+
taskId: m,
|
|
2483
|
+
initiallyApplied: v,
|
|
2484
|
+
onApplied: ie,
|
|
2485
|
+
extraDestinations: te
|
|
2407
2486
|
})
|
|
2408
2487
|
] }) : void 0
|
|
2409
2488
|
});
|
|
2410
2489
|
}, [
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2490
|
+
l.activity,
|
|
2491
|
+
l.running,
|
|
2492
|
+
l.error,
|
|
2493
|
+
l.canContinue,
|
|
2494
|
+
l.selectedModel,
|
|
2495
|
+
l.modelsByProvider,
|
|
2496
|
+
l.hasProviders,
|
|
2497
|
+
l.remoteModels,
|
|
2498
|
+
c.openTask,
|
|
2499
|
+
c.componentAnchors,
|
|
2500
|
+
m,
|
|
2422
2501
|
e,
|
|
2423
2502
|
t,
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2503
|
+
h,
|
|
2504
|
+
V,
|
|
2505
|
+
w,
|
|
2506
|
+
v,
|
|
2428
2507
|
n,
|
|
2429
2508
|
r,
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
]),
|
|
2435
|
-
|
|
2436
|
-
}, [
|
|
2509
|
+
b,
|
|
2510
|
+
q.content,
|
|
2511
|
+
q.actions,
|
|
2512
|
+
q.commands
|
|
2513
|
+
]), M(() => () => {
|
|
2514
|
+
c.closeTask(m);
|
|
2515
|
+
}, [c.closeTask, m]), null;
|
|
2437
2516
|
}
|
|
2438
2517
|
//#endregion
|
|
2439
2518
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2440
|
-
function
|
|
2441
|
-
let t = $(), n =
|
|
2519
|
+
function xn({ userGoal: e }) {
|
|
2520
|
+
let t = $(), n = P(() => tn({
|
|
2442
2521
|
unavailable: t.orchestratorUnavailable,
|
|
2443
2522
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2444
2523
|
preparing: t.orchestratorPreparing,
|
|
2445
2524
|
collecting: t.orchestratorCollecting
|
|
2446
|
-
}), []),
|
|
2447
|
-
|
|
2525
|
+
}), []), r = ot(), i = Xt(n, {
|
|
2526
|
+
defaultEnabled: !0,
|
|
2527
|
+
...r.person ? { author: r.person } : {}
|
|
2528
|
+
}), [a, o] = I(null), s = F(!1), c = !i.hasProviders || i.selectedModel !== "", l = F(r.pendingExtraDestinations), u = F(r.pendingAttachments), d = F(r.pendingModel), f = F(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), p = F(r.pendingCarryOver), m = F(!1), h = (e) => {
|
|
2529
|
+
e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(rt));
|
|
2448
2530
|
};
|
|
2449
|
-
|
|
2450
|
-
!
|
|
2531
|
+
M(() => {
|
|
2532
|
+
!s.current && c && (s.current = !0, d.current && i.setSelectedModel(d.current), i.run({
|
|
2451
2533
|
userGoal: e,
|
|
2452
2534
|
pageContext: r.pageContext,
|
|
2453
|
-
scopedSubagentId:
|
|
2535
|
+
scopedSubagentId: f.current ?? null
|
|
2454
2536
|
}, {
|
|
2455
|
-
attachments:
|
|
2456
|
-
model:
|
|
2537
|
+
attachments: u.current,
|
|
2538
|
+
model: d.current,
|
|
2457
2539
|
openingMessage: e
|
|
2458
2540
|
}).then((e) => {
|
|
2459
|
-
e &&
|
|
2541
|
+
e && h(e);
|
|
2460
2542
|
}));
|
|
2461
|
-
}, [
|
|
2462
|
-
|
|
2463
|
-
id:
|
|
2543
|
+
}, [c]), M(() => {
|
|
2544
|
+
m.current || r.openTask({
|
|
2545
|
+
id: rt,
|
|
2464
2546
|
title: "Agentico",
|
|
2465
2547
|
icon: "bot",
|
|
2466
|
-
agent:
|
|
2467
|
-
onApplied:
|
|
2468
|
-
scopedSubagentId:
|
|
2469
|
-
precedingActivity:
|
|
2548
|
+
agent: i,
|
|
2549
|
+
onApplied: h,
|
|
2550
|
+
scopedSubagentId: f.current,
|
|
2551
|
+
precedingActivity: p.current?.activity,
|
|
2470
2552
|
onDismiss: () => {
|
|
2471
|
-
|
|
2553
|
+
m.current = !0, i.running && i.stop(), r.closeTask(rt);
|
|
2472
2554
|
}
|
|
2473
2555
|
});
|
|
2474
2556
|
}, [
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2557
|
+
i.activity,
|
|
2558
|
+
i.running,
|
|
2559
|
+
i.error,
|
|
2560
|
+
i.canContinue,
|
|
2561
|
+
i.selectedModel,
|
|
2562
|
+
i.modelsByProvider,
|
|
2563
|
+
i.hasProviders,
|
|
2482
2564
|
r.openTask
|
|
2483
|
-
]),
|
|
2484
|
-
r.closeTask(
|
|
2565
|
+
]), M(() => () => {
|
|
2566
|
+
r.closeTask(rt);
|
|
2485
2567
|
}, [r.closeTask]);
|
|
2486
|
-
let
|
|
2487
|
-
if (!
|
|
2488
|
-
let
|
|
2489
|
-
return
|
|
2490
|
-
manifest:
|
|
2491
|
-
params:
|
|
2492
|
-
extraDestinations:
|
|
2493
|
-
model:
|
|
2494
|
-
taskId:
|
|
2495
|
-
precedingActivity:
|
|
2568
|
+
let g = P(() => [...p.current?.activity ?? [], ...i.activity], [i.activity]);
|
|
2569
|
+
if (!a) return null;
|
|
2570
|
+
let _ = G(a.subagentId);
|
|
2571
|
+
return _ ? /* @__PURE__ */ R(bn, {
|
|
2572
|
+
manifest: _,
|
|
2573
|
+
params: a.params,
|
|
2574
|
+
extraDestinations: l.current,
|
|
2575
|
+
model: d.current || void 0,
|
|
2576
|
+
taskId: p.current?.taskId,
|
|
2577
|
+
precedingActivity: g
|
|
2496
2578
|
}) : null;
|
|
2497
2579
|
}
|
|
2498
2580
|
//#endregion
|
|
2499
2581
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2500
|
-
function
|
|
2501
|
-
let r =
|
|
2582
|
+
function Sn({ manifest: e, extraDestinations: n }) {
|
|
2583
|
+
let r = ot(), i = Xt(e.definition, {
|
|
2584
|
+
defaultEnabled: !1,
|
|
2585
|
+
...r.person ? { author: r.person } : {}
|
|
2586
|
+
}), a = $(), o = F(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = I(null), [l, u] = I([]), d = sn(e.id), f = d?.kind === "selection" ? d : null, [p, m] = I(null), [h, g] = I(null), _ = F(!1), v = (t) => {
|
|
2502
2587
|
if (!e.manualEntry) return;
|
|
2503
2588
|
let n;
|
|
2504
2589
|
try {
|
|
@@ -2507,11 +2592,11 @@ function gn({ manifest: e, extraDestinations: n }) {
|
|
|
2507
2592
|
console.error("[ManualEntryRunner] manualEntry.fromRawText ha rifiutato il testo:", e);
|
|
2508
2593
|
return;
|
|
2509
2594
|
}
|
|
2510
|
-
g(n), u([]),
|
|
2595
|
+
g(n), u([]), i.run(n, { openingMessage: t }).then((e) => {
|
|
2511
2596
|
e && c(e);
|
|
2512
2597
|
});
|
|
2513
2598
|
};
|
|
2514
|
-
|
|
2599
|
+
M(() => {
|
|
2515
2600
|
s && f && m(f.defaultSelection(s));
|
|
2516
2601
|
}, [s, f]);
|
|
2517
2602
|
let y = (e, t) => {
|
|
@@ -2519,43 +2604,43 @@ function gn({ manifest: e, extraDestinations: n }) {
|
|
|
2519
2604
|
...n,
|
|
2520
2605
|
[e]: t
|
|
2521
2606
|
});
|
|
2522
|
-
}, b = (e) => c(e), x =
|
|
2607
|
+
}, b = (e) => c(e), x = P(() => s && f && p ? f.applySelection(s, p) : s, [
|
|
2523
2608
|
s,
|
|
2524
2609
|
f,
|
|
2525
2610
|
p
|
|
2526
2611
|
]), S = (e) => {
|
|
2527
2612
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
2528
|
-
}, C =
|
|
2613
|
+
}, C = P(() => r.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [r.componentAnchors, e.id]), w = P(() => h ? ln(C, h, o) : null, [
|
|
2529
2614
|
C,
|
|
2530
2615
|
h,
|
|
2531
2616
|
o
|
|
2532
|
-
]), T =
|
|
2533
|
-
return
|
|
2534
|
-
_.current ||
|
|
2617
|
+
]), T = P(() => w ? [w, ...n ?? []] : n, [w, n]);
|
|
2618
|
+
return M(() => {
|
|
2619
|
+
_.current || r.openTask({
|
|
2535
2620
|
id: o,
|
|
2536
2621
|
title: e.label,
|
|
2537
2622
|
icon: e.icon,
|
|
2538
|
-
agent:
|
|
2623
|
+
agent: i,
|
|
2539
2624
|
onApplied: (e) => c(e),
|
|
2540
2625
|
manualEntry: e.manualEntry ? {
|
|
2541
2626
|
prompt: e.manualEntry.prompt,
|
|
2542
2627
|
onSubmit: v
|
|
2543
2628
|
} : void 0,
|
|
2544
2629
|
onDismiss: () => {
|
|
2545
|
-
_.current = !0,
|
|
2630
|
+
_.current = !0, i.running && i.stop(), r.closeTask(o);
|
|
2546
2631
|
},
|
|
2547
|
-
panelExtra: s ? /* @__PURE__ */
|
|
2632
|
+
panelExtra: s ? /* @__PURE__ */ z("div", {
|
|
2548
2633
|
className: "space-y-2",
|
|
2549
2634
|
children: [
|
|
2550
|
-
f && p ? /* @__PURE__ */
|
|
2635
|
+
f && p ? /* @__PURE__ */ R(f.Report, {
|
|
2551
2636
|
result: s,
|
|
2552
2637
|
selection: p,
|
|
2553
2638
|
onChange: y
|
|
2554
|
-
}) : d?.kind === "editable" ? /* @__PURE__ */
|
|
2639
|
+
}) : d?.kind === "editable" ? /* @__PURE__ */ R(d.Report, {
|
|
2555
2640
|
result: s,
|
|
2556
2641
|
onResultChange: b
|
|
2557
|
-
}) : /* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2642
|
+
}) : /* @__PURE__ */ R(cn, { result: x }),
|
|
2643
|
+
/* @__PURE__ */ R(rn, {
|
|
2559
2644
|
manifest: e,
|
|
2560
2645
|
result: x,
|
|
2561
2646
|
meta: h ?? {},
|
|
@@ -2564,35 +2649,139 @@ function gn({ manifest: e, extraDestinations: n }) {
|
|
|
2564
2649
|
onApplied: S,
|
|
2565
2650
|
extraDestinations: T
|
|
2566
2651
|
}),
|
|
2567
|
-
|
|
2568
|
-
label:
|
|
2652
|
+
i.hasProviders && /* @__PURE__ */ R(t, {
|
|
2653
|
+
label: a.resumeWithAi,
|
|
2569
2654
|
variant: "outline-secondary",
|
|
2570
2655
|
className: "text-xs",
|
|
2571
2656
|
onClick: () => {
|
|
2572
|
-
h &&
|
|
2657
|
+
h && r.resumeWithAI(e.id, h, n);
|
|
2573
2658
|
}
|
|
2574
2659
|
})
|
|
2575
2660
|
]
|
|
2576
2661
|
}) : void 0
|
|
2577
2662
|
});
|
|
2578
2663
|
}, [
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2664
|
+
i.activity,
|
|
2665
|
+
i.running,
|
|
2666
|
+
i.error,
|
|
2667
|
+
i.hasProviders,
|
|
2668
|
+
r.componentAnchors,
|
|
2584
2669
|
s,
|
|
2585
2670
|
x,
|
|
2586
2671
|
p,
|
|
2587
2672
|
l,
|
|
2588
2673
|
h
|
|
2589
|
-
]),
|
|
2590
|
-
|
|
2674
|
+
]), M(() => () => {
|
|
2675
|
+
r.closeTask(o);
|
|
2591
2676
|
}, []), null;
|
|
2592
2677
|
}
|
|
2593
2678
|
//#endregion
|
|
2679
|
+
//#region src/presentation/EarlierSessions.tsx
|
|
2680
|
+
function Cn({ title: e, meta: t, action: n }) {
|
|
2681
|
+
return /* @__PURE__ */ z("div", {
|
|
2682
|
+
role: "separator",
|
|
2683
|
+
"aria-label": e,
|
|
2684
|
+
className: "my-3 flex items-center gap-2 text-[11px] text-muted-foreground",
|
|
2685
|
+
children: [
|
|
2686
|
+
/* @__PURE__ */ R("span", { className: "h-px flex-1 bg-border" }),
|
|
2687
|
+
/* @__PURE__ */ z("span", {
|
|
2688
|
+
className: "flex min-w-0 max-w-[75%] flex-col items-center text-center",
|
|
2689
|
+
children: [
|
|
2690
|
+
/* @__PURE__ */ R("span", {
|
|
2691
|
+
className: "max-w-full truncate font-medium text-foreground",
|
|
2692
|
+
children: e
|
|
2693
|
+
}),
|
|
2694
|
+
t && /* @__PURE__ */ R("span", { children: t }),
|
|
2695
|
+
n
|
|
2696
|
+
]
|
|
2697
|
+
}),
|
|
2698
|
+
/* @__PURE__ */ R("span", { className: "h-px flex-1 bg-border" })
|
|
2699
|
+
]
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
function wn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onContinue: o, busy: s = !1 }) {
|
|
2703
|
+
let c = $(), { locale: l } = D(), [u, d] = I(0);
|
|
2704
|
+
M(() => ze(() => d((e) => e + 1)), []);
|
|
2705
|
+
let f = P(() => tt(e, n, r), [
|
|
2706
|
+
e,
|
|
2707
|
+
n,
|
|
2708
|
+
r,
|
|
2709
|
+
u
|
|
2710
|
+
]), [p, m] = I(0);
|
|
2711
|
+
M(() => m(0), [r, n]);
|
|
2712
|
+
let h = p < f.length, g = F(null), _ = () => {
|
|
2713
|
+
let e = i.current;
|
|
2714
|
+
e && (g.current = {
|
|
2715
|
+
height: e.scrollHeight,
|
|
2716
|
+
top: e.scrollTop
|
|
2717
|
+
}), a?.(), m((e) => Math.min(e + 1, f.length));
|
|
2718
|
+
}, v = F(_);
|
|
2719
|
+
v.current = _, N(() => {
|
|
2720
|
+
let e = i.current, t = g.current;
|
|
2721
|
+
g.current = null, e && t && (e.scrollTop = t.top + (e.scrollHeight - t.height));
|
|
2722
|
+
}, [p, i]);
|
|
2723
|
+
let y = F(null);
|
|
2724
|
+
if (M(() => {
|
|
2725
|
+
let e = i.current, t = y.current;
|
|
2726
|
+
if (!e || !t || !h || typeof IntersectionObserver > "u") return;
|
|
2727
|
+
let n = e.scrollTop, r = !1, a = () => {
|
|
2728
|
+
e.scrollTop < n && (r = !0), n = e.scrollTop;
|
|
2729
|
+
};
|
|
2730
|
+
e.addEventListener("scroll", a, { passive: !0 });
|
|
2731
|
+
let o = new IntersectionObserver((e) => {
|
|
2732
|
+
r && e.some((e) => e.isIntersecting) && (r = !1, v.current());
|
|
2733
|
+
}, {
|
|
2734
|
+
root: e,
|
|
2735
|
+
rootMargin: "40px 0px 0px 0px"
|
|
2736
|
+
});
|
|
2737
|
+
return o.observe(t), () => {
|
|
2738
|
+
e.removeEventListener("scroll", a), o.disconnect();
|
|
2739
|
+
};
|
|
2740
|
+
}, [
|
|
2741
|
+
i,
|
|
2742
|
+
h,
|
|
2743
|
+
p
|
|
2744
|
+
]), !f.length) return null;
|
|
2745
|
+
let b = (e) => new Date(e).toLocaleString(l, {
|
|
2746
|
+
dateStyle: "medium",
|
|
2747
|
+
timeStyle: "short"
|
|
2748
|
+
}), x = f.slice(0, p).reverse();
|
|
2749
|
+
return /* @__PURE__ */ z("div", { children: [
|
|
2750
|
+
h && /* @__PURE__ */ R("div", {
|
|
2751
|
+
ref: y,
|
|
2752
|
+
className: "flex justify-center pb-1",
|
|
2753
|
+
children: /* @__PURE__ */ R(t, {
|
|
2754
|
+
icon: "history",
|
|
2755
|
+
label: c.earlierSession,
|
|
2756
|
+
variant: "link",
|
|
2757
|
+
className: "text-xs",
|
|
2758
|
+
onClick: _
|
|
2759
|
+
})
|
|
2760
|
+
}),
|
|
2761
|
+
x.map((e) => /* @__PURE__ */ z("section", {
|
|
2762
|
+
"aria-label": Ke(e),
|
|
2763
|
+
children: [/* @__PURE__ */ R(Cn, {
|
|
2764
|
+
title: Ke(e),
|
|
2765
|
+
meta: S(c.sessionOf, { at: b(Xe(e)) }),
|
|
2766
|
+
action: /* @__PURE__ */ R(t, {
|
|
2767
|
+
label: c.continueSession,
|
|
2768
|
+
variant: "link",
|
|
2769
|
+
className: "text-[11px]",
|
|
2770
|
+
disabled: s,
|
|
2771
|
+
onClick: () => o(e)
|
|
2772
|
+
})
|
|
2773
|
+
}), /* @__PURE__ */ R(Et, {
|
|
2774
|
+
activity: e.activity,
|
|
2775
|
+
pinUserMessages: !1,
|
|
2776
|
+
speaker: G(e.subagentId)?.speaker?.(e.params)
|
|
2777
|
+
})]
|
|
2778
|
+
}, `${e.subagentId}:${e.entityId}`)),
|
|
2779
|
+
p > 0 && /* @__PURE__ */ R(Cn, { title: c.thisSession })
|
|
2780
|
+
] });
|
|
2781
|
+
}
|
|
2782
|
+
//#endregion
|
|
2594
2783
|
//#region src/presentation/Agentico.tsx
|
|
2595
|
-
function
|
|
2784
|
+
function Tn(e, t) {
|
|
2596
2785
|
return Object.values(e).flat().map((e) => {
|
|
2597
2786
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
2598
2787
|
return {
|
|
@@ -2604,9 +2793,9 @@ function _n(e, t) {
|
|
|
2604
2793
|
};
|
|
2605
2794
|
});
|
|
2606
2795
|
}
|
|
2607
|
-
function
|
|
2608
|
-
let a = $(), [o, c] =
|
|
2609
|
-
|
|
2796
|
+
function En({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
2797
|
+
let a = $(), [o, c] = I(""), { agent: l, onApplied: u, manualEntry: d } = e, p = l.running;
|
|
2798
|
+
M(() => {
|
|
2610
2799
|
n && c(n.detail ?? "");
|
|
2611
2800
|
}, [n]);
|
|
2612
2801
|
let m = (e) => {
|
|
@@ -2624,20 +2813,20 @@ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
2624
2813
|
}).then((e) => {
|
|
2625
2814
|
e && u(e);
|
|
2626
2815
|
});
|
|
2627
|
-
}, h = !!d || l.remote && l.remoteModels.length === 0, g = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), _ = !h && !l.remote && !g && l.hasProviders && !l.selectedModel, v = h ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...
|
|
2628
|
-
return /* @__PURE__ */
|
|
2816
|
+
}, h = !!d || l.remote && l.remoteModels.length === 0, g = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), _ = !h && !l.remote && !g && l.hasProviders && !l.selectedModel, v = h ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...Tn(l.modelsByProvider, l.catalogGroup)] : Tn(l.modelsByProvider);
|
|
2817
|
+
return /* @__PURE__ */ z(L, { children: [n && /* @__PURE__ */ z("div", {
|
|
2629
2818
|
className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
|
|
2630
2819
|
children: [
|
|
2631
|
-
/* @__PURE__ */
|
|
2820
|
+
/* @__PURE__ */ R(f, {
|
|
2632
2821
|
name: "pencil",
|
|
2633
2822
|
size: 12,
|
|
2634
2823
|
className: "shrink-0"
|
|
2635
2824
|
}),
|
|
2636
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ R("span", {
|
|
2637
2826
|
className: "flex-1",
|
|
2638
2827
|
children: a.editingMessage
|
|
2639
2828
|
}),
|
|
2640
|
-
/* @__PURE__ */
|
|
2829
|
+
/* @__PURE__ */ R(t, {
|
|
2641
2830
|
label: a.cancelEdit,
|
|
2642
2831
|
variant: "link",
|
|
2643
2832
|
className: "p-0 text-xs",
|
|
@@ -2646,7 +2835,7 @@ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
2646
2835
|
}
|
|
2647
2836
|
})
|
|
2648
2837
|
]
|
|
2649
|
-
}), /* @__PURE__ */
|
|
2838
|
+
}), /* @__PURE__ */ R(s, {
|
|
2650
2839
|
value: o,
|
|
2651
2840
|
onChange: c,
|
|
2652
2841
|
placeholder: d?.prompt ?? a.messagePlaceholder,
|
|
@@ -2665,21 +2854,21 @@ function vn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
2665
2854
|
maxHeight: 220
|
|
2666
2855
|
})] });
|
|
2667
2856
|
}
|
|
2668
|
-
function
|
|
2669
|
-
let { startOrchestrator: e } =
|
|
2857
|
+
function Dn() {
|
|
2858
|
+
let { startOrchestrator: e } = ot(), t = $(), [n, r] = I(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Ht(), l = (t) => {
|
|
2670
2859
|
t.text.trim() && (e(t.text.trim(), {
|
|
2671
2860
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
2672
2861
|
model: t.model || void 0
|
|
2673
2862
|
}), r(""));
|
|
2674
2863
|
}, u = i && !o;
|
|
2675
|
-
return /* @__PURE__ */
|
|
2864
|
+
return /* @__PURE__ */ R(s, {
|
|
2676
2865
|
value: n,
|
|
2677
2866
|
onChange: r,
|
|
2678
2867
|
placeholder: t.orchestratorStarterPlaceholder,
|
|
2679
2868
|
disabled: !n.trim() || u,
|
|
2680
2869
|
onSubmit: l,
|
|
2681
2870
|
attachments: !0,
|
|
2682
|
-
models:
|
|
2871
|
+
models: Tn(a),
|
|
2683
2872
|
selectedModel: o,
|
|
2684
2873
|
onModelChange: c,
|
|
2685
2874
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -2687,30 +2876,30 @@ function yn() {
|
|
|
2687
2876
|
maxHeight: 220
|
|
2688
2877
|
});
|
|
2689
2878
|
}
|
|
2690
|
-
function
|
|
2691
|
-
let n = $(), r =
|
|
2692
|
-
return /* @__PURE__ */
|
|
2879
|
+
function On({ chat: e, onClose: t }) {
|
|
2880
|
+
let n = $(), r = E();
|
|
2881
|
+
return /* @__PURE__ */ R(_, {
|
|
2693
2882
|
title: n.renameChat,
|
|
2694
2883
|
size: "sm",
|
|
2695
2884
|
onClose: t,
|
|
2696
|
-
onSave: () => (
|
|
2697
|
-
children: /* @__PURE__ */
|
|
2885
|
+
onSave: () => (Ye(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Ke(e)), "person"), t(), Promise.resolve(!0)),
|
|
2886
|
+
children: /* @__PURE__ */ z(d, {
|
|
2698
2887
|
appearance: "empty",
|
|
2699
2888
|
controller: r,
|
|
2700
|
-
defaultValues: { title:
|
|
2889
|
+
defaultValues: { title: Ke(e) },
|
|
2701
2890
|
footer: !1,
|
|
2702
|
-
children: [/* @__PURE__ */
|
|
2891
|
+
children: [/* @__PURE__ */ R(h, {
|
|
2703
2892
|
name: "title",
|
|
2704
2893
|
label: n.chatTitleLabel,
|
|
2705
2894
|
placeholder: e.title
|
|
2706
|
-
}), /* @__PURE__ */
|
|
2895
|
+
}), /* @__PURE__ */ R("p", {
|
|
2707
2896
|
className: "text-xs text-muted-foreground",
|
|
2708
2897
|
children: n.chatTitleHint
|
|
2709
2898
|
})]
|
|
2710
2899
|
})
|
|
2711
2900
|
});
|
|
2712
2901
|
}
|
|
2713
|
-
function
|
|
2902
|
+
function kn(e, t, n = Date.now()) {
|
|
2714
2903
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
2715
2904
|
numeric: "auto",
|
|
2716
2905
|
style: "short"
|
|
@@ -2722,55 +2911,55 @@ function xn(e, t, n = Date.now()) {
|
|
|
2722
2911
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
2723
2912
|
return i.format(0, "minute");
|
|
2724
2913
|
}
|
|
2725
|
-
function
|
|
2914
|
+
function An({ card: e }) {
|
|
2726
2915
|
let t = $();
|
|
2727
|
-
return e.humanSummaryOnly ? /* @__PURE__ */
|
|
2916
|
+
return e.humanSummaryOnly ? /* @__PURE__ */ z("div", {
|
|
2728
2917
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2729
|
-
children: [/* @__PURE__ */
|
|
2918
|
+
children: [/* @__PURE__ */ z("p", {
|
|
2730
2919
|
className: "text-xs font-medium text-foreground",
|
|
2731
2920
|
children: [
|
|
2732
2921
|
"\"",
|
|
2733
2922
|
e.label,
|
|
2734
2923
|
"\""
|
|
2735
2924
|
]
|
|
2736
|
-
}), /* @__PURE__ */
|
|
2925
|
+
}), /* @__PURE__ */ R("p", {
|
|
2737
2926
|
className: "text-xs text-muted-foreground",
|
|
2738
2927
|
children: e.humanSummary
|
|
2739
2928
|
})]
|
|
2740
|
-
}) : /* @__PURE__ */
|
|
2929
|
+
}) : /* @__PURE__ */ z("div", {
|
|
2741
2930
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2742
2931
|
children: [
|
|
2743
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ R("p", {
|
|
2744
2933
|
className: "text-xs font-medium text-foreground",
|
|
2745
|
-
children:
|
|
2934
|
+
children: S(t.newInstance, { label: e.label })
|
|
2746
2935
|
}),
|
|
2747
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ R("p", {
|
|
2748
2937
|
className: "text-xs text-muted-foreground",
|
|
2749
2938
|
children: e.humanSummary
|
|
2750
2939
|
}),
|
|
2751
|
-
e.fields.length > 0 && /* @__PURE__ */
|
|
2940
|
+
e.fields.length > 0 && /* @__PURE__ */ R("ul", {
|
|
2752
2941
|
className: "space-y-1",
|
|
2753
|
-
children: e.fields.map((e) => /* @__PURE__ */
|
|
2942
|
+
children: e.fields.map((e) => /* @__PURE__ */ z("li", {
|
|
2754
2943
|
className: "flex items-start gap-1.5 text-xs",
|
|
2755
|
-
children: [/* @__PURE__ */
|
|
2944
|
+
children: [/* @__PURE__ */ R(n, {
|
|
2756
2945
|
variant: e.required ? "primary" : "secondary",
|
|
2757
2946
|
className: "mt-px shrink-0",
|
|
2758
2947
|
children: e.required ? "richiesto" : "opzionale"
|
|
2759
|
-
}), /* @__PURE__ */
|
|
2948
|
+
}), /* @__PURE__ */ z("span", {
|
|
2760
2949
|
className: "min-w-0",
|
|
2761
|
-
children: [/* @__PURE__ */
|
|
2950
|
+
children: [/* @__PURE__ */ R("span", {
|
|
2762
2951
|
className: "font-mono text-foreground",
|
|
2763
2952
|
children: e.key
|
|
2764
|
-
}), e.humanDescription ? /* @__PURE__ */
|
|
2953
|
+
}), e.humanDescription ? /* @__PURE__ */ z("span", {
|
|
2765
2954
|
className: "text-muted-foreground",
|
|
2766
2955
|
children: [" — ", e.humanDescription]
|
|
2767
2956
|
}) : null]
|
|
2768
2957
|
})]
|
|
2769
2958
|
}, e.key))
|
|
2770
2959
|
}),
|
|
2771
|
-
e.example && /* @__PURE__ */
|
|
2960
|
+
e.example && /* @__PURE__ */ z("p", {
|
|
2772
2961
|
className: "text-xs text-muted-foreground",
|
|
2773
|
-
children: ["Esempio: ", /* @__PURE__ */
|
|
2962
|
+
children: ["Esempio: ", /* @__PURE__ */ R("span", {
|
|
2774
2963
|
className: "font-mono",
|
|
2775
2964
|
children: e.example
|
|
2776
2965
|
})]
|
|
@@ -2778,40 +2967,40 @@ function Sn({ card: e }) {
|
|
|
2778
2967
|
]
|
|
2779
2968
|
});
|
|
2780
2969
|
}
|
|
2781
|
-
function
|
|
2782
|
-
return /* @__PURE__ */
|
|
2970
|
+
function jn({ messages: e }) {
|
|
2971
|
+
return /* @__PURE__ */ R("div", {
|
|
2783
2972
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
2784
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
2973
|
+
children: e.map((e, t) => /* @__PURE__ */ R("p", {
|
|
2785
2974
|
className: "text-xs text-muted-foreground",
|
|
2786
2975
|
children: e
|
|
2787
2976
|
}, t))
|
|
2788
2977
|
});
|
|
2789
2978
|
}
|
|
2790
|
-
function
|
|
2791
|
-
let c = $(), { locale: d } =
|
|
2792
|
-
|
|
2793
|
-
let _ =
|
|
2979
|
+
function Mn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
2980
|
+
let c = $(), { locale: d } = D(), [p, m] = I(""), [h, g] = I(0);
|
|
2981
|
+
M(() => ze(() => g((e) => e + 1)), []);
|
|
2982
|
+
let _ = P(() => r ? Qe(e) : [], [
|
|
2794
2983
|
e,
|
|
2795
2984
|
r,
|
|
2796
2985
|
h
|
|
2797
|
-
]), [v, y] =
|
|
2798
|
-
let r =
|
|
2986
|
+
]), [v, y] = I(null), b = async (t) => {
|
|
2987
|
+
let r = G(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
2799
2988
|
if (!i || window.confirm(i)) {
|
|
2800
2989
|
try {
|
|
2801
2990
|
await r?.onArchive?.(t.entityId, t.params);
|
|
2802
2991
|
} catch {
|
|
2803
2992
|
return;
|
|
2804
2993
|
}
|
|
2805
|
-
|
|
2994
|
+
Ze(e, t.subagentId, t.entityId), n === $e(t.subagentId, t.entityId) && s(), g((e) => e + 1);
|
|
2806
2995
|
}
|
|
2807
|
-
}, x =
|
|
2996
|
+
}, x = P(() => {
|
|
2808
2997
|
let e = p.trim().toLowerCase();
|
|
2809
2998
|
return e ? _.filter((t) => {
|
|
2810
|
-
let n =
|
|
2811
|
-
return
|
|
2999
|
+
let n = G(t.subagentId)?.label ?? t.subagentId;
|
|
3000
|
+
return Ke(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
2812
3001
|
}) : _;
|
|
2813
3002
|
}, [_, p]);
|
|
2814
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(l, {
|
|
2815
3004
|
trigger: {
|
|
2816
3005
|
icon: "history",
|
|
2817
3006
|
title: c.chatHistory
|
|
@@ -2822,22 +3011,22 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2822
3011
|
position: "end",
|
|
2823
3012
|
strategy: "absolute",
|
|
2824
3013
|
menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
|
|
2825
|
-
header: /* @__PURE__ */
|
|
3014
|
+
header: /* @__PURE__ */ z("div", {
|
|
2826
3015
|
className: "flex items-center gap-2 px-1 pb-1.5",
|
|
2827
3016
|
children: [
|
|
2828
|
-
/* @__PURE__ */
|
|
3017
|
+
/* @__PURE__ */ R(f, {
|
|
2829
3018
|
name: "search",
|
|
2830
3019
|
size: 14,
|
|
2831
3020
|
className: "shrink-0 text-muted-foreground"
|
|
2832
3021
|
}),
|
|
2833
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ R("input", {
|
|
2834
3023
|
autoFocus: !0,
|
|
2835
3024
|
value: p,
|
|
2836
3025
|
onChange: (e) => m(e.target.value),
|
|
2837
3026
|
placeholder: c.searchChats,
|
|
2838
3027
|
className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
2839
3028
|
}),
|
|
2840
|
-
/* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ R(t, {
|
|
2841
3030
|
icon: "square-pen",
|
|
2842
3031
|
ariaLabel: c.newChat,
|
|
2843
3032
|
title: c.newChat,
|
|
@@ -2847,12 +3036,12 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2847
3036
|
})
|
|
2848
3037
|
]
|
|
2849
3038
|
}),
|
|
2850
|
-
children: x.length === 0 ? /* @__PURE__ */
|
|
3039
|
+
children: x.length === 0 ? /* @__PURE__ */ R("p", {
|
|
2851
3040
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
2852
3041
|
children: _.length === 0 ? c.noSavedChats : c.noResults
|
|
2853
3042
|
}) : x.map((e) => {
|
|
2854
|
-
let t =
|
|
2855
|
-
return /* @__PURE__ */
|
|
3043
|
+
let t = G(e.subagentId), r = n === $e(e.subagentId, e.entityId);
|
|
3044
|
+
return /* @__PURE__ */ R(u, {
|
|
2856
3045
|
icon: r ? "check" : t?.icon ?? "bot",
|
|
2857
3046
|
className: r ? "bg-accent font-semibold text-primary" : void 0,
|
|
2858
3047
|
actions: [{
|
|
@@ -2867,194 +3056,207 @@ function wn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
2867
3056
|
onClick: () => void b(e)
|
|
2868
3057
|
}],
|
|
2869
3058
|
onClick: () => a(e.subagentId, e.entityId, e),
|
|
2870
|
-
children: /* @__PURE__ */
|
|
3059
|
+
children: /* @__PURE__ */ z("span", {
|
|
2871
3060
|
className: "flex min-w-0 flex-1 items-center justify-between gap-2",
|
|
2872
|
-
children: [/* @__PURE__ */
|
|
3061
|
+
children: [/* @__PURE__ */ R("span", {
|
|
2873
3062
|
className: "min-w-0 truncate",
|
|
2874
|
-
title: `${t?.label ?? e.subagentId} · ${
|
|
2875
|
-
children:
|
|
2876
|
-
}), /* @__PURE__ */
|
|
3063
|
+
title: `${t?.label ?? e.subagentId} · ${Ke(e)}`,
|
|
3064
|
+
children: Ke(e)
|
|
3065
|
+
}), /* @__PURE__ */ R("span", {
|
|
2877
3066
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2878
|
-
title: `${c.chatStarted.replace("{at}", new Date(
|
|
2879
|
-
children:
|
|
3067
|
+
title: `${c.chatStarted.replace("{at}", new Date(Xe(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
|
|
3068
|
+
children: kn(Xe(e), d)
|
|
2880
3069
|
})]
|
|
2881
3070
|
})
|
|
2882
3071
|
}, `${e.subagentId}:${e.entityId}`);
|
|
2883
3072
|
})
|
|
2884
|
-
}), v && /* @__PURE__ */
|
|
3073
|
+
}), v && /* @__PURE__ */ R(On, {
|
|
2885
3074
|
chat: v,
|
|
2886
3075
|
onClose: () => y(null)
|
|
2887
3076
|
})] });
|
|
2888
3077
|
}
|
|
2889
|
-
function
|
|
2890
|
-
let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry:
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
}, [a?.id]),
|
|
2894
|
-
let
|
|
3078
|
+
function Nn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
|
|
3079
|
+
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 } = ot(), E = $(), D = F(null), [O, k] = I(!1), [A, j] = I(null), [N, P] = I(null);
|
|
3080
|
+
M(() => {
|
|
3081
|
+
j(null), P(null);
|
|
3082
|
+
}, [a?.id]), _n(T?.id);
|
|
3083
|
+
let B = It({
|
|
2895
3084
|
defaultWidth: e,
|
|
2896
3085
|
minWidth: n,
|
|
2897
3086
|
maxWidth: r,
|
|
2898
3087
|
onWidthChange: i
|
|
2899
|
-
}),
|
|
2900
|
-
(!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(),
|
|
2901
|
-
},
|
|
2902
|
-
a && (
|
|
3088
|
+
}), V = () => {
|
|
3089
|
+
(!a || a.agent.running || a.savedToDisk || window.confirm(E.unsavedConversationConfirm)) && (m(), k(!1));
|
|
3090
|
+
}, H = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], ee = H.length, te = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? ee, ee)), ne = H.slice(0, te), U = H.slice(te), W = !!(a && !a.agent.running && a.agent.error), re = (e, t) => {
|
|
3091
|
+
a && (j(null), a.agent.rewind(e.id, t).then((e) => {
|
|
2903
3092
|
e && a.onApplied(e);
|
|
2904
3093
|
}));
|
|
2905
3094
|
}, K = (e) => {
|
|
2906
3095
|
let t = a?.agent.activity ?? [], n = t.slice(t.findIndex((t) => t.id === e.id) + 1).flatMap((e) => [...e.kind === "tool" && e.status === "done" ? [e.label] : [], ...(e.parts ?? []).flatMap((e) => e.type === "tool" && e.status === "done" ? [e.label] : [])]);
|
|
2907
3096
|
return [...new Set(n.filter(Boolean))];
|
|
2908
|
-
},
|
|
3097
|
+
}, q = (e, t) => {
|
|
2909
3098
|
let n = K(e);
|
|
2910
|
-
n.length ?
|
|
3099
|
+
n.length ? P({
|
|
2911
3100
|
entry: e,
|
|
2912
3101
|
steps: n,
|
|
2913
3102
|
...t === void 0 ? {} : { text: t }
|
|
2914
|
-
}) :
|
|
2915
|
-
},
|
|
3103
|
+
}) : re(e, t);
|
|
3104
|
+
}, ie = a ? {
|
|
2916
3105
|
available: (e) => a.agent.activity.some((t) => t.id === e.id) && a.agent.rewindable(e.id),
|
|
2917
3106
|
disabled: a.agent.running,
|
|
2918
|
-
onRetry: (e) =>
|
|
2919
|
-
onEdit: (e) =>
|
|
2920
|
-
} : void 0,
|
|
2921
|
-
canAnswer: (e) =>
|
|
3107
|
+
onRetry: (e) => q(e),
|
|
3108
|
+
onEdit: (e) => j(e)
|
|
3109
|
+
} : void 0, ae = new Set(a?.agent.activity.map((e) => e.id) ?? []), oe = a ? {
|
|
3110
|
+
canAnswer: (e) => ae.has(e),
|
|
2922
3111
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
2923
3112
|
e && a.onApplied(e);
|
|
2924
3113
|
}),
|
|
2925
3114
|
onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
|
|
2926
|
-
} : void 0, J =
|
|
2927
|
-
|
|
3115
|
+
} : void 0, J = oe ? St(H, oe.canAnswer) : null, se = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? G(a.scopedSubagentId) : void 0, ce = se?.manualEntry ? se : null, Y = F(!0);
|
|
3116
|
+
M(() => {
|
|
2928
3117
|
let e = D.current;
|
|
2929
3118
|
if (!e) return;
|
|
2930
3119
|
let t = () => {
|
|
2931
|
-
|
|
3120
|
+
Y.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
2932
3121
|
};
|
|
2933
3122
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
2934
|
-
}, [a?.id]),
|
|
3123
|
+
}, [a?.id]), M(() => {
|
|
2935
3124
|
let e = D.current;
|
|
2936
|
-
e && (
|
|
3125
|
+
e && (Y.current = !0, e.scrollTop = e.scrollHeight);
|
|
2937
3126
|
}, [a?.id]);
|
|
2938
|
-
let
|
|
2939
|
-
|
|
3127
|
+
let le = H.at(-1)?.detail?.length ?? 0;
|
|
3128
|
+
M(() => {
|
|
2940
3129
|
let e = D.current;
|
|
2941
|
-
e &&
|
|
3130
|
+
e && Y.current && (e.scrollTop = e.scrollHeight);
|
|
2942
3131
|
}, [
|
|
2943
|
-
|
|
3132
|
+
ee,
|
|
2944
3133
|
W,
|
|
2945
|
-
|
|
3134
|
+
le
|
|
2946
3135
|
]);
|
|
2947
|
-
let
|
|
2948
|
-
|
|
2949
|
-
let e = D.current, t =
|
|
3136
|
+
let X = F(null);
|
|
3137
|
+
M(() => {
|
|
3138
|
+
let e = D.current, t = X.current;
|
|
2950
3139
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
2951
3140
|
let n = new ResizeObserver(() => {
|
|
2952
|
-
|
|
3141
|
+
Y.current && (e.scrollTop = e.scrollHeight);
|
|
2953
3142
|
});
|
|
2954
3143
|
return n.observe(t), () => n.disconnect();
|
|
2955
3144
|
}, [a?.id, o]);
|
|
2956
|
-
let ue = s ? /* @__PURE__ */
|
|
3145
|
+
let ue = s ? /* @__PURE__ */ R(xn, { userGoal: s }, c) : null, de = f ? G(f.subagentId) : void 0, fe = f && de ? /* @__PURE__ */ R(bn, {
|
|
2957
3146
|
manifest: de,
|
|
2958
3147
|
params: f.snapshot.params,
|
|
2959
|
-
taskId:
|
|
3148
|
+
taskId: $e(f.subagentId, f.entityId),
|
|
2960
3149
|
resumeSeed: {
|
|
2961
3150
|
history: f.snapshot.history,
|
|
2962
3151
|
activity: f.snapshot.activity
|
|
2963
3152
|
}
|
|
2964
|
-
}, p) : null, pe =
|
|
3153
|
+
}, p) : null, pe = g ? G(g.subagentId) : void 0, me = g && pe ? /* @__PURE__ */ R(Sn, {
|
|
2965
3154
|
manifest: pe,
|
|
2966
|
-
extraDestinations:
|
|
2967
|
-
},
|
|
3155
|
+
extraDestinations: g.extraDestinations
|
|
3156
|
+
}, _) : null, he = x ? G(x.subagentId) : void 0, Z = x && he ? /* @__PURE__ */ R(bn, {
|
|
2968
3157
|
manifest: he,
|
|
2969
3158
|
params: x.params,
|
|
2970
3159
|
extraDestinations: x.extraDestinations
|
|
2971
|
-
}, S) : null,
|
|
2972
|
-
manifest:
|
|
3160
|
+
}, S) : null, ge = C ? G(C.subagentId) : void 0, _e = C && ge ? /* @__PURE__ */ R(bn, {
|
|
3161
|
+
manifest: ge,
|
|
2973
3162
|
params: C.params,
|
|
2974
3163
|
taskId: C.taskId,
|
|
2975
3164
|
openingMessage: C.openingMessage
|
|
2976
3165
|
}, w) : null;
|
|
2977
|
-
return o ? /* @__PURE__ */
|
|
3166
|
+
return o ? /* @__PURE__ */ z(L, { children: [
|
|
2978
3167
|
ue,
|
|
2979
3168
|
fe,
|
|
2980
3169
|
me,
|
|
2981
|
-
|
|
3170
|
+
Z,
|
|
2982
3171
|
_e,
|
|
2983
|
-
/* @__PURE__ */
|
|
2984
|
-
style: { width:
|
|
3172
|
+
/* @__PURE__ */ z("div", {
|
|
3173
|
+
style: { width: B.width },
|
|
2985
3174
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
2986
3175
|
children: [
|
|
2987
|
-
/* @__PURE__ */
|
|
2988
|
-
width:
|
|
2989
|
-
min:
|
|
2990
|
-
max:
|
|
2991
|
-
onResize:
|
|
2992
|
-
onCommit:
|
|
2993
|
-
onReset:
|
|
3176
|
+
/* @__PURE__ */ R(Lt, {
|
|
3177
|
+
width: B.width,
|
|
3178
|
+
min: B.min,
|
|
3179
|
+
max: B.max,
|
|
3180
|
+
onResize: B.set,
|
|
3181
|
+
onCommit: B.commit,
|
|
3182
|
+
onReset: B.reset
|
|
2994
3183
|
}),
|
|
2995
|
-
/* @__PURE__ */
|
|
3184
|
+
/* @__PURE__ */ z("div", {
|
|
2996
3185
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
2997
3186
|
children: [
|
|
2998
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ R("span", {
|
|
2999
3188
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
3000
3189
|
children: a ? a.title : "Agentico"
|
|
3001
3190
|
}),
|
|
3002
|
-
T && /* @__PURE__ */
|
|
3191
|
+
T && /* @__PURE__ */ R(Mn, {
|
|
3003
3192
|
scopeId: T.id,
|
|
3004
3193
|
currentTaskId: a?.id ?? null,
|
|
3005
3194
|
open: O,
|
|
3006
|
-
onOpenChange:
|
|
3007
|
-
onNewChat:
|
|
3195
|
+
onOpenChange: k,
|
|
3196
|
+
onNewChat: V,
|
|
3008
3197
|
onSelect: (e, t, n) => h(e, t, n),
|
|
3009
3198
|
onArchivedCurrent: m
|
|
3010
3199
|
}),
|
|
3011
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ R(Rt, {})
|
|
3012
3201
|
]
|
|
3013
3202
|
}),
|
|
3014
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ R("div", {
|
|
3015
3204
|
ref: D,
|
|
3016
3205
|
className: `flex-1 overflow-y-auto px-3 pb-2 ${J ? "min-h-24" : "min-h-0"}`,
|
|
3017
|
-
children: /* @__PURE__ */
|
|
3018
|
-
ref:
|
|
3206
|
+
children: /* @__PURE__ */ R("div", {
|
|
3207
|
+
ref: X,
|
|
3019
3208
|
className: "pt-2",
|
|
3020
|
-
children: a ? /* @__PURE__ */
|
|
3021
|
-
|
|
3209
|
+
children: a ? /* @__PURE__ */ z(L, { children: [
|
|
3210
|
+
T && a.thread && /* @__PURE__ */ R(wn, {
|
|
3211
|
+
scopeId: T.id,
|
|
3212
|
+
thread: a.thread,
|
|
3213
|
+
taskId: a.id,
|
|
3214
|
+
scrollRef: D,
|
|
3215
|
+
busy: a.agent.running,
|
|
3216
|
+
onLoad: () => {
|
|
3217
|
+
Y.current = !1;
|
|
3218
|
+
},
|
|
3219
|
+
onContinue: (e) => h(e.subagentId, e.entityId, e)
|
|
3220
|
+
}),
|
|
3221
|
+
a.manualEntry && H.length === 0 && /* @__PURE__ */ R("p", {
|
|
3022
3222
|
className: "text-xs text-muted-foreground",
|
|
3023
3223
|
children: a.manualEntry.prompt
|
|
3024
3224
|
}),
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
activity:
|
|
3027
|
-
questions:
|
|
3225
|
+
/* @__PURE__ */ R(Et, {
|
|
3226
|
+
activity: ne,
|
|
3227
|
+
questions: oe,
|
|
3028
3228
|
docked: J,
|
|
3029
3229
|
pinUserMessages: !J,
|
|
3030
|
-
messageActions:
|
|
3230
|
+
messageActions: ie,
|
|
3231
|
+
speaker: a.speaker
|
|
3031
3232
|
}),
|
|
3032
|
-
a.panelExtra && /* @__PURE__ */
|
|
3233
|
+
a.panelExtra && /* @__PURE__ */ R("div", {
|
|
3033
3234
|
className: "mt-3",
|
|
3034
3235
|
children: a.panelExtra
|
|
3035
3236
|
}),
|
|
3036
|
-
|
|
3037
|
-
activity:
|
|
3038
|
-
questions:
|
|
3237
|
+
U.length > 0 && /* @__PURE__ */ R(Et, {
|
|
3238
|
+
activity: U,
|
|
3239
|
+
questions: oe,
|
|
3039
3240
|
docked: J,
|
|
3040
3241
|
pinUserMessages: !J,
|
|
3041
|
-
messageActions:
|
|
3242
|
+
messageActions: ie,
|
|
3243
|
+
speaker: a.speaker
|
|
3042
3244
|
}),
|
|
3043
|
-
!a.agent.running && a.agent.error && /* @__PURE__ */
|
|
3245
|
+
!a.agent.running && a.agent.error && /* @__PURE__ */ z("div", {
|
|
3044
3246
|
className: "mt-2 flex items-center gap-2",
|
|
3045
3247
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ R("p", {
|
|
3047
3249
|
className: "flex-1 text-xs text-destructive",
|
|
3048
3250
|
children: a.agent.error
|
|
3049
3251
|
}),
|
|
3050
|
-
/* @__PURE__ */
|
|
3252
|
+
/* @__PURE__ */ R(t, {
|
|
3051
3253
|
label: E.retry,
|
|
3052
3254
|
variant: "secondary",
|
|
3053
3255
|
className: "shrink-0",
|
|
3054
3256
|
onClick: () => {
|
|
3055
3257
|
let e = [...a.agent.activity].reverse().find((e) => e.kind === "user");
|
|
3056
3258
|
if (e && a.agent.rewindable(e.id)) {
|
|
3057
|
-
|
|
3259
|
+
q(e);
|
|
3058
3260
|
return;
|
|
3059
3261
|
}
|
|
3060
3262
|
a.agent.sendMessage(E.retryMessage, { retry: !0 }).then((e) => {
|
|
@@ -3062,13 +3264,13 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3062
3264
|
});
|
|
3063
3265
|
}
|
|
3064
3266
|
}),
|
|
3065
|
-
!a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */
|
|
3267
|
+
!a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ R(t, {
|
|
3066
3268
|
label: E.continueWithoutAi,
|
|
3067
3269
|
variant: "secondary",
|
|
3068
3270
|
className: "shrink-0",
|
|
3069
3271
|
onClick: () => {
|
|
3070
|
-
if (
|
|
3071
|
-
y(
|
|
3272
|
+
if (ce) {
|
|
3273
|
+
y(ce.id, b);
|
|
3072
3274
|
return;
|
|
3073
3275
|
}
|
|
3074
3276
|
let e = a.agent.runFallback();
|
|
@@ -3077,32 +3279,32 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3077
3279
|
})
|
|
3078
3280
|
]
|
|
3079
3281
|
})
|
|
3080
|
-
] }) : d.length > 0 ? /* @__PURE__ */
|
|
3282
|
+
] }) : d.length > 0 ? /* @__PURE__ */ R(jn, { messages: d }) : u ? /* @__PURE__ */ R(An, { card: u }) : /* @__PURE__ */ R("p", {
|
|
3081
3283
|
className: "text-xs text-muted-foreground",
|
|
3082
3284
|
children: l ?? E.orchestratorStarterHint
|
|
3083
3285
|
})
|
|
3084
3286
|
})
|
|
3085
3287
|
}),
|
|
3086
|
-
a && J ? /* @__PURE__ */
|
|
3288
|
+
a && J ? /* @__PURE__ */ z("section", {
|
|
3087
3289
|
"aria-label": E.pendingQuestions,
|
|
3088
3290
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
3089
3291
|
children: [
|
|
3090
|
-
a.panelActions && /* @__PURE__ */
|
|
3292
|
+
a.panelActions && /* @__PURE__ */ R("div", {
|
|
3091
3293
|
className: "shrink-0 px-4 pt-3",
|
|
3092
3294
|
children: a.panelActions
|
|
3093
3295
|
}),
|
|
3094
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ R("div", {
|
|
3095
3297
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
3096
|
-
children: /* @__PURE__ */
|
|
3298
|
+
children: /* @__PURE__ */ R(Ct, {
|
|
3097
3299
|
entry: J.entry,
|
|
3098
3300
|
part: J.part,
|
|
3099
|
-
questions:
|
|
3301
|
+
questions: oe,
|
|
3100
3302
|
autoFocus: !0
|
|
3101
3303
|
}, `${J.entry.id}:${J.part.id}`)
|
|
3102
3304
|
}),
|
|
3103
|
-
a.agent.running && /* @__PURE__ */
|
|
3305
|
+
a.agent.running && /* @__PURE__ */ R("div", {
|
|
3104
3306
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
3105
|
-
children: /* @__PURE__ */
|
|
3307
|
+
children: /* @__PURE__ */ R(t, {
|
|
3106
3308
|
icon: "square",
|
|
3107
3309
|
label: E.stop,
|
|
3108
3310
|
variant: "secondary",
|
|
@@ -3110,51 +3312,51 @@ function Tn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3110
3312
|
})
|
|
3111
3313
|
})
|
|
3112
3314
|
]
|
|
3113
|
-
}) : /* @__PURE__ */
|
|
3315
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3114
3316
|
className: "border-t border-border/60 px-4 py-3",
|
|
3115
|
-
children: [a?.panelActions && /* @__PURE__ */
|
|
3317
|
+
children: [a?.panelActions && /* @__PURE__ */ R("div", {
|
|
3116
3318
|
className: "mb-2",
|
|
3117
3319
|
children: a.panelActions
|
|
3118
|
-
}), a ? /* @__PURE__ */
|
|
3320
|
+
}), a ? /* @__PURE__ */ R(En, {
|
|
3119
3321
|
task: a,
|
|
3120
|
-
editing:
|
|
3121
|
-
onCancelEdit: () =>
|
|
3122
|
-
onSendEdit: (e, t) =>
|
|
3123
|
-
}, a.id) : /* @__PURE__ */
|
|
3322
|
+
editing: A,
|
|
3323
|
+
onCancelEdit: () => j(null),
|
|
3324
|
+
onSendEdit: (e, t) => q(e, t)
|
|
3325
|
+
}, a.id) : /* @__PURE__ */ R(Dn, {})]
|
|
3124
3326
|
}),
|
|
3125
|
-
|
|
3327
|
+
N && /* @__PURE__ */ z(v, {
|
|
3126
3328
|
title: E.rewindTitle,
|
|
3127
|
-
onClose: () =>
|
|
3128
|
-
onYes: async () => (
|
|
3129
|
-
children: [/* @__PURE__ */
|
|
3329
|
+
onClose: () => P(null),
|
|
3330
|
+
onYes: async () => (re(N.entry, N.text), !0),
|
|
3331
|
+
children: [/* @__PURE__ */ R("p", {
|
|
3130
3332
|
className: "text-sm",
|
|
3131
3333
|
children: E.rewindText
|
|
3132
|
-
}), /* @__PURE__ */
|
|
3334
|
+
}), /* @__PURE__ */ R("ul", {
|
|
3133
3335
|
className: "mt-2 list-disc space-y-0.5 ps-5 text-sm text-muted-foreground",
|
|
3134
|
-
children:
|
|
3336
|
+
children: N.steps.slice(0, 8).map((e) => /* @__PURE__ */ R("li", { children: e }, e))
|
|
3135
3337
|
})]
|
|
3136
3338
|
})
|
|
3137
3339
|
]
|
|
3138
3340
|
})
|
|
3139
|
-
] }) : /* @__PURE__ */
|
|
3341
|
+
] }) : /* @__PURE__ */ z(L, { children: [
|
|
3140
3342
|
ue,
|
|
3141
3343
|
fe,
|
|
3142
3344
|
me,
|
|
3143
|
-
|
|
3345
|
+
Z,
|
|
3144
3346
|
_e
|
|
3145
3347
|
] });
|
|
3146
3348
|
}
|
|
3147
3349
|
//#endregion
|
|
3148
3350
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
3149
|
-
function
|
|
3150
|
-
let { setPageContext: n } =
|
|
3151
|
-
|
|
3351
|
+
function Pn(e, t) {
|
|
3352
|
+
let { setPageContext: n } = ot(), r = F(crypto.randomUUID()).current;
|
|
3353
|
+
M(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
3152
3354
|
}
|
|
3153
3355
|
//#endregion
|
|
3154
3356
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
3155
|
-
function
|
|
3156
|
-
let { registerComponentAnchor: o } =
|
|
3157
|
-
c.current = n,
|
|
3357
|
+
function Fn(e, t, n, r, i = !0, a) {
|
|
3358
|
+
let { registerComponentAnchor: o } = ot(), s = F(crypto.randomUUID()).current, c = F(n);
|
|
3359
|
+
c.current = n, M(() => {
|
|
3158
3360
|
if (i) return o(s, {
|
|
3159
3361
|
subagentId: e,
|
|
3160
3362
|
componentKey: t,
|
|
@@ -3171,6 +3373,6 @@ function Dn(e, t, n, r, i = !0, a) {
|
|
|
3171
3373
|
]);
|
|
3172
3374
|
}
|
|
3173
3375
|
//#endregion
|
|
3174
|
-
export {
|
|
3376
|
+
export { kt as AGENTICO_MAX_WIDTH, Ot as AGENTICO_MIN_WIDTH, Dt as AGENTICO_WIDTH, At as AGENTICO_WIDTH_STORAGE_KEY, Nn as Agentico, at as AgenticoProvider, Rt as AgenticoToggle, V as DEFAULT_REASONING_PART_ID, B as DEFAULT_TEXT_PART_ID, xe as JSON_EXPORT_DESTINATION_ID, ge as MICRO_PROMPT_REGISTRY, rt as ORCHESTRATOR_TASK_ID, Z as SUMMARY_MICRO_PROMPT, Oe as agenticoDe, Ee as agenticoEn, De as agenticoIt, se as agenticoPromptsEn, ce as agenticoPromptsIt, nt as agenticoTranslations, _e as applyMicroPrompts, qe as chatHasPersonMessage, Xe as chatStartedAt, et as chatThreadOf, Ke as chatTitle, le as configureAgenticoPrompts, je as configureEntityChatStore, ie as createCrossAgentTools, ne as defineSubagent, tt as earlierSessions, $e as entityChatTaskId, ve as extractErrorMessage, ye as extractJsonBlock, G as findSubagentManifest, te as formatQuestionAnswers, X as getAgenticoPrompts, Te as getDestinationRegistry, Ve as getEntityChat, fn as getSubagentControls, re as getSubagentRegistry, sn as getSubagentReport, Me as hasEntityChatBackend, Se as jsonExportDestination, Qe as listEntityChats, ee as messagePartsText, ze as onEntityChatsChange, q as registerCrossAgentTools, we as registerDestinations, dn as registerSubagentControls, on as registerSubagentReports, W as registerSubagents, Ze as removeEntityChat, Ye as renameEntityChat, he as renderRegistryCli, me as renderSubagentCli, ue as resetAgenticoPrompts, He as saveEntityChat, Fe as syncEntityChats, ae as toJsonSchema, oe as toMcpTool, H as upsertMessagePart, Xt as useAgent, ot as useAgentico, $ as useAgenticoI18n, Pn as useAgenticoPageContext, Fn as useSubagentComponentContext };
|
|
3175
3377
|
|
|
3176
3378
|
//# sourceMappingURL=index.mjs.map
|