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