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