@llmnative/agentico 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1441 -1154
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/settings.d.ts +27 -0
- package/dist/types/i18n/types.d.ts +17 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/presentation/AgenticoContext.d.ts +5 -1
- package/dist/types/presentation/AgenticoSettingsContext.d.ts +31 -0
- package/dist/types/presentation/AgenticoSettingsModal.d.ts +4 -0
- package/dist/types/presentation/ThreadEvents.d.ts +5 -2
- package/dist/types/presentation/useAIModelCatalog.d.ts +7 -1
- package/llms.txt +2 -0
- package/package.json +81 -79
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { zodToJsonSchema as e } from "zod-to-json-schema";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { AIConnections as t, ActionButton as n, Badge as r, Card as i, ChatMarkdown as a, ChatQuestions as o, ChatReasoning as s, Chatbot as c, Checkbox as l, Code as u, Dropdown as d, DropdownItem as f, Form as p, Icon as m, Identicon as h, ImageAvatar as g, Input as _, LoadingButton as v, Modal as y, ModalYesNo as b, PromptUtils as x, Select as S, Switch as C, Tree as w, getAIModelCatalog as T, interpolate as E, parseAIModelRef as D, proxyFetch as O, useAIProviderRegistry as ee, useFormController as k, useI18n as te, useProxy as A } from "@llmnative/react";
|
|
3
|
+
import ne, { createContext as j, useCallback as M, useContext as re, useEffect as N, useLayoutEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
4
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
5
5
|
//#region src/domain/messageParts.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
6
|
+
var V = "text", ie = "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 ie(e, t, n) {
|
|
|
14
14
|
...i.slice(a)
|
|
15
15
|
] : [...i, t];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function U(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 ae(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 W(e) {
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/domain/subagentRegistry.ts
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
30
|
+
var oe = [];
|
|
31
|
+
function G(e) {
|
|
32
|
+
oe = e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function K() {
|
|
35
|
+
return oe.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), oe;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function q(e) {
|
|
38
|
+
return oe.find((t) => t.id === e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/domain/crossAgentTools.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
|
|
42
|
+
var se = [];
|
|
43
|
+
function ce(...e) {
|
|
44
|
+
se = e;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function le(e) {
|
|
47
|
+
return se.flatMap((t) => t(e));
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/domain/mcpTool.ts
|
|
51
|
-
function
|
|
51
|
+
function ue(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 de(e, t, n, r) {
|
|
59
59
|
return {
|
|
60
60
|
name: e,
|
|
61
61
|
description: t,
|
|
62
|
-
inputSchema:
|
|
63
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: ue(n),
|
|
63
|
+
...r ? { outputSchema: ue(r) } : {}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/domain/subagentUsageCard.ts
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function fe(e) {
|
|
69
|
+
let t = ue(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 ce(e) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/domain/prompts.ts
|
|
83
|
-
var
|
|
83
|
+
var pe = {
|
|
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 le = {
|
|
|
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
|
+
}, me = {
|
|
114
114
|
orchestratorIntro: "Sei Agentico, l'orchestratore dei tool di questa applicazione. Il tuo compito è capire cosa vuole ottenere l'utente e, una volta raccolti tutti i parametri necessari, avviare il tool giusto tra quelli elencati sotto — non eseguirlo tu stesso \"a parole\", invocalo come strumento.",
|
|
115
115
|
responseRules: [
|
|
116
116
|
"PRIMA di chiedere qualunque parametro, controlla il \"Contesto pagina\" (se presente) qui sotto: se un parametro richiesto dal comando è già lì o si può dedurre da lì con ragionevole certezza (es. l'utente sta guardando lo storico di un tool specifico, o un'esecuzione passata con parametri simili), USALO direttamente — non chiederlo di nuovo all'utente. Chiedi solo i parametri che NON emergono in nessun modo dal contesto.",
|
|
@@ -140,26 +140,26 @@ var le = {
|
|
|
140
140
|
].join(" "),
|
|
141
141
|
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere.",
|
|
142
142
|
chatTitle: "Scrivi un titolo per questa chat, come lo mostra un elenco di chat: da 3 a 6 parole che dicono di cosa parla, nella lingua in cui scrive la persona. Rispondi solo con il titolo: niente virgolette, niente punto finale.\n\n{chat}"
|
|
143
|
-
},
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
...
|
|
143
|
+
}, he = pe;
|
|
144
|
+
function ge(e) {
|
|
145
|
+
he = {
|
|
146
|
+
...he,
|
|
147
147
|
...e
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
function J() {
|
|
151
|
-
return
|
|
151
|
+
return he;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
153
|
+
function _e() {
|
|
154
|
+
he = pe;
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/domain/cli/renderManifestCli.ts
|
|
158
|
-
function
|
|
158
|
+
function Y(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 X(e, t) {
|
|
162
|
+
let n = fe(t), r = Y(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 he(e, t) {
|
|
|
171
171
|
...i,
|
|
172
172
|
"",
|
|
173
173
|
" OUTPUT",
|
|
174
|
-
|
|
174
|
+
ve(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 ve(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 ye(e) {
|
|
185
185
|
return [
|
|
186
186
|
"NAME",
|
|
187
187
|
` ${e.id} — ${e.label}`,
|
|
188
188
|
"",
|
|
189
189
|
"DESCRIPTION",
|
|
190
|
-
|
|
190
|
+
ve(e.description, 2),
|
|
191
191
|
"",
|
|
192
|
-
...e.commands.map((t) =>
|
|
192
|
+
...e.commands.map((t) => X(e.id, t))
|
|
193
193
|
].join("\n");
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function be(e) {
|
|
196
196
|
return e.length === 0 ? J().noToolsAvailable : e.map((e) => `${e.id} [${e.commands.map((e) => e.name).join("|")}] — ${e.label}: ${e.commands.map((e) => e.summary).join(" / ")}`).join("\n");
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/domain/microPrompts.ts
|
|
200
|
-
var
|
|
200
|
+
var xe = {
|
|
201
201
|
id: "closing-summary",
|
|
202
202
|
get text() {
|
|
203
203
|
return J().closingSummary;
|
|
204
204
|
}
|
|
205
|
-
},
|
|
206
|
-
function
|
|
205
|
+
}, Se = { [xe.id]: xe };
|
|
206
|
+
function Ce(e, t) {
|
|
207
207
|
if (!t || t.length === 0) return e;
|
|
208
|
-
let n = t.map((e) =>
|
|
208
|
+
let n = t.map((e) => Se[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 we(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 be(e) {
|
|
|
229
229
|
}
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region src/domain/extractJsonBlock.ts
|
|
232
|
-
function
|
|
232
|
+
function Te(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 Ee(n) ?? n;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Ee(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 Se(e) {
|
|
|
256
256
|
}
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/domain/jsonExportDestination.ts
|
|
259
|
-
var
|
|
260
|
-
id:
|
|
259
|
+
var De = "json-export", Oe = {
|
|
260
|
+
id: De,
|
|
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 Ce = "json-export", we = {
|
|
|
268
268
|
URL.revokeObjectURL(n);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
},
|
|
272
|
-
function
|
|
273
|
-
|
|
271
|
+
}, ke = {};
|
|
272
|
+
function Ae(e) {
|
|
273
|
+
ke = e;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function je() {
|
|
276
276
|
return {
|
|
277
|
-
[
|
|
278
|
-
...
|
|
277
|
+
[Oe.id]: Oe,
|
|
278
|
+
...ke
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/i18n/en.ts
|
|
283
|
-
var
|
|
283
|
+
var Me = {
|
|
284
284
|
modelLabel: "Model",
|
|
285
285
|
modelsLoading: "Loading…",
|
|
286
286
|
noModelsAvailable: "No models available",
|
|
@@ -333,6 +333,22 @@ var Oe = {
|
|
|
333
333
|
eventRunning: "In progress",
|
|
334
334
|
showEvents: "Show what the agents did",
|
|
335
335
|
hideEvents: "Conversation only",
|
|
336
|
+
settingsTitle: "Settings",
|
|
337
|
+
settingsSave: "Save",
|
|
338
|
+
settingsClose: "Close",
|
|
339
|
+
settingsChats: "Chats",
|
|
340
|
+
settingsDefaultModel: "The model chats start with",
|
|
341
|
+
settingsDefaultModelNone: "The person picks it",
|
|
342
|
+
settingsReasoning: "How much the model reasons",
|
|
343
|
+
settingsReasoningDefault: "The default of the model",
|
|
344
|
+
settingsReasoningLow: "Low",
|
|
345
|
+
settingsReasoningMedium: "Medium",
|
|
346
|
+
settingsReasoningHigh: "High",
|
|
347
|
+
settingsReasoningMax: "Max",
|
|
348
|
+
settingsProviders: "Providers the chats may use",
|
|
349
|
+
settingsChatTitles: "The model writes the titles of the chats",
|
|
350
|
+
settingsThreadEvents: "Show what the other agents did",
|
|
351
|
+
settingsConnectors: "Connectors",
|
|
336
352
|
cardView: "View",
|
|
337
353
|
cardClose: "Close",
|
|
338
354
|
renameChat: "Rename",
|
|
@@ -362,7 +378,7 @@ var Oe = {
|
|
|
362
378
|
rewindTitle: "Go back to this message?",
|
|
363
379
|
rewindText: "What came after it leaves the chat and the memory of the agent. What its steps did stays done:",
|
|
364
380
|
stop: "Stop"
|
|
365
|
-
},
|
|
381
|
+
}, Ne = {
|
|
366
382
|
modelLabel: "Modello",
|
|
367
383
|
modelsLoading: "Caricamento…",
|
|
368
384
|
noModelsAvailable: "Nessun modello disponibile",
|
|
@@ -415,6 +431,22 @@ var Oe = {
|
|
|
415
431
|
eventRunning: "In corso",
|
|
416
432
|
showEvents: "Mostra cosa hanno fatto gli agenti",
|
|
417
433
|
hideEvents: "Solo la conversazione",
|
|
434
|
+
settingsTitle: "Impostazioni",
|
|
435
|
+
settingsSave: "Salva",
|
|
436
|
+
settingsClose: "Chiudi",
|
|
437
|
+
settingsChats: "Chat",
|
|
438
|
+
settingsDefaultModel: "Modello con cui partono le chat",
|
|
439
|
+
settingsDefaultModelNone: "Lo sceglie la persona",
|
|
440
|
+
settingsReasoning: "Quanto ragiona il modello",
|
|
441
|
+
settingsReasoningDefault: "Quello predefinito del modello",
|
|
442
|
+
settingsReasoningLow: "Poco",
|
|
443
|
+
settingsReasoningMedium: "Medio",
|
|
444
|
+
settingsReasoningHigh: "Molto",
|
|
445
|
+
settingsReasoningMax: "Al massimo",
|
|
446
|
+
settingsProviders: "Provider che le chat possono usare",
|
|
447
|
+
settingsChatTitles: "Il modello scrive i titoli delle chat",
|
|
448
|
+
settingsThreadEvents: "Mostra cosa hanno fatto gli altri agenti",
|
|
449
|
+
settingsConnectors: "Connettori",
|
|
418
450
|
cardView: "Vedi",
|
|
419
451
|
cardClose: "Chiudi",
|
|
420
452
|
renameChat: "Rinomina",
|
|
@@ -444,7 +476,7 @@ var Oe = {
|
|
|
444
476
|
rewindTitle: "Tornare a questo messaggio?",
|
|
445
477
|
rewindText: "Ciò che è venuto dopo lascia la chat e la memoria dell'agente. Ciò che hanno fatto i suoi passi resta fatto:",
|
|
446
478
|
stop: "Ferma"
|
|
447
|
-
},
|
|
479
|
+
}, Pe = {
|
|
448
480
|
modelLabel: "Modell",
|
|
449
481
|
modelsLoading: "Wird geladen…",
|
|
450
482
|
noModelsAvailable: "Keine Modelle verfügbar",
|
|
@@ -497,6 +529,22 @@ var Oe = {
|
|
|
497
529
|
eventRunning: "Läuft",
|
|
498
530
|
showEvents: "Zeigen, was die Agenten getan haben",
|
|
499
531
|
hideEvents: "Nur das Gespräch",
|
|
532
|
+
settingsTitle: "Einstellungen",
|
|
533
|
+
settingsSave: "Speichern",
|
|
534
|
+
settingsClose: "Schließen",
|
|
535
|
+
settingsChats: "Chats",
|
|
536
|
+
settingsDefaultModel: "Modell, mit dem Chats beginnen",
|
|
537
|
+
settingsDefaultModelNone: "Die Person wählt es",
|
|
538
|
+
settingsReasoning: "Wie viel das Modell nachdenkt",
|
|
539
|
+
settingsReasoningDefault: "Standard des Modells",
|
|
540
|
+
settingsReasoningLow: "Wenig",
|
|
541
|
+
settingsReasoningMedium: "Mittel",
|
|
542
|
+
settingsReasoningHigh: "Viel",
|
|
543
|
+
settingsReasoningMax: "Maximal",
|
|
544
|
+
settingsProviders: "Anbieter, die Chats nutzen dürfen",
|
|
545
|
+
settingsChatTitles: "Das Modell schreibt die Titel der Chats",
|
|
546
|
+
settingsThreadEvents: "Zeigen, was die anderen Agenten getan haben",
|
|
547
|
+
settingsConnectors: "Konnektoren",
|
|
500
548
|
cardView: "Ansehen",
|
|
501
549
|
cardClose: "Schließen",
|
|
502
550
|
renameChat: "Umbenennen",
|
|
@@ -526,39 +574,39 @@ var Oe = {
|
|
|
526
574
|
rewindTitle: "Zu dieser Nachricht zurückgehen?",
|
|
527
575
|
rewindText: "Was danach kam, verlässt den Chat und das Gedächtnis des Agenten. Was seine Schritte getan haben, bleibt getan:",
|
|
528
576
|
stop: "Stoppen"
|
|
529
|
-
},
|
|
530
|
-
function
|
|
531
|
-
|
|
577
|
+
}, Fe = "llmnative.agentico.entityChat", Ie;
|
|
578
|
+
function Le(e) {
|
|
579
|
+
Fe = e.storageKey, Ie = e.backend;
|
|
532
580
|
}
|
|
533
|
-
var
|
|
534
|
-
function
|
|
535
|
-
if (!
|
|
581
|
+
var Re = () => !!Ie, ze = ({ synced: e, ...t }) => t;
|
|
582
|
+
function Be(e) {
|
|
583
|
+
if (!Ie) return;
|
|
536
584
|
let t = Z(e.scopeId, e.subagentId, e.entityId);
|
|
537
|
-
Promise.resolve(
|
|
538
|
-
let e =
|
|
539
|
-
n && !n.synced &&
|
|
585
|
+
Promise.resolve(Ie.save(ze(e))).then(() => {
|
|
586
|
+
let e = Ue(), n = e.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === t);
|
|
587
|
+
n && !n.synced && Ke(e.map((e) => e === n ? {
|
|
540
588
|
...e,
|
|
541
589
|
synced: !0
|
|
542
590
|
} : e));
|
|
543
591
|
}, () => void 0);
|
|
544
592
|
}
|
|
545
|
-
async function
|
|
546
|
-
if (!
|
|
547
|
-
let t = (await
|
|
593
|
+
async function Ve(e) {
|
|
594
|
+
if (!Ie) return;
|
|
595
|
+
let t = (await Ie.load(e)).map(He).filter((t) => t !== null && t.scopeId === e), n = (e) => e.changedAt ?? e.savedAt, r = Ue(), i = r.filter((t) => t.scopeId !== e), a = r.filter((t) => t.scopeId === e), o = t.map((e) => {
|
|
548
596
|
let t = a.find((t) => Z(t.scopeId, t.subagentId, t.entityId) === Z(e.scopeId, e.subagentId, e.entityId));
|
|
549
|
-
return t && n(t) > n(e) ? (
|
|
597
|
+
return t && n(t) > n(e) ? (Be(t), t) : {
|
|
550
598
|
...e,
|
|
551
599
|
synced: !0
|
|
552
600
|
};
|
|
553
601
|
}), s = a.filter((e) => !e.synced && !t.some((t) => Z(t.scopeId, t.subagentId, t.entityId) === Z(e.scopeId, e.subagentId, e.entityId)));
|
|
554
|
-
|
|
602
|
+
Ke([
|
|
555
603
|
...i,
|
|
556
604
|
...o,
|
|
557
605
|
...s
|
|
558
606
|
]);
|
|
559
|
-
for (let e of s)
|
|
607
|
+
for (let e of s) Be(e);
|
|
560
608
|
}
|
|
561
|
-
function
|
|
609
|
+
function He(e) {
|
|
562
610
|
if (!e || typeof e != "object") return null;
|
|
563
611
|
let t = e;
|
|
564
612
|
if (typeof t.entityId != "string") return null;
|
|
@@ -570,35 +618,35 @@ function Re(e) {
|
|
|
570
618
|
scopeId: n
|
|
571
619
|
};
|
|
572
620
|
}
|
|
573
|
-
function
|
|
621
|
+
function Ue() {
|
|
574
622
|
try {
|
|
575
|
-
let e = localStorage.getItem(
|
|
623
|
+
let e = localStorage.getItem(Fe);
|
|
576
624
|
if (!e) return [];
|
|
577
625
|
let t = JSON.parse(e);
|
|
578
|
-
return Array.isArray(t) ? t.map(
|
|
626
|
+
return Array.isArray(t) ? t.map(He).filter((e) => e !== null) : [];
|
|
579
627
|
} catch {
|
|
580
628
|
return [];
|
|
581
629
|
}
|
|
582
630
|
}
|
|
583
|
-
var
|
|
584
|
-
function
|
|
585
|
-
return
|
|
586
|
-
|
|
631
|
+
var We = /* @__PURE__ */ new Set();
|
|
632
|
+
function Ge(e) {
|
|
633
|
+
return We.add(e), () => {
|
|
634
|
+
We.delete(e);
|
|
587
635
|
};
|
|
588
636
|
}
|
|
589
|
-
function
|
|
637
|
+
function Ke(e) {
|
|
590
638
|
try {
|
|
591
|
-
localStorage.setItem(
|
|
639
|
+
localStorage.setItem(Fe, JSON.stringify(e));
|
|
592
640
|
} catch {}
|
|
593
|
-
for (let e of [...
|
|
641
|
+
for (let e of [...We]) e();
|
|
594
642
|
}
|
|
595
643
|
var Z = (e, t, n) => `${e}:${t}:${n}`;
|
|
596
|
-
function
|
|
644
|
+
function qe(e, t, n) {
|
|
597
645
|
let r = Z(e, t, n);
|
|
598
|
-
return
|
|
646
|
+
return Ue().find((e) => Z(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
|
|
599
647
|
}
|
|
600
|
-
function
|
|
601
|
-
let t = Z(e.scopeId, e.subagentId, e.entityId), n =
|
|
648
|
+
function Je(e) {
|
|
649
|
+
let t = Z(e.scopeId, e.subagentId, e.entityId), n = Ue(), r = n.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === t), i = Date.now(), a = n.filter((e) => e !== r), o = {
|
|
602
650
|
...e,
|
|
603
651
|
savedAt: i,
|
|
604
652
|
changedAt: i,
|
|
@@ -609,18 +657,18 @@ function We(e) {
|
|
|
609
657
|
} : {},
|
|
610
658
|
...r?.synced ? { synced: !0 } : {}
|
|
611
659
|
};
|
|
612
|
-
a.push(o),
|
|
613
|
-
}
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
].map((e) => e.retryMessage.trim().toLowerCase())),
|
|
619
|
-
let t = (e.activity.find(
|
|
660
|
+
a.push(o), Ke(a), Be(o);
|
|
661
|
+
}
|
|
662
|
+
var Ye = new Set([
|
|
663
|
+
Me,
|
|
664
|
+
Ne,
|
|
665
|
+
Pe
|
|
666
|
+
].map((e) => e.retryMessage.trim().toLowerCase())), Xe = (e) => e.kind === "user" && !!e.detail?.trim() && !e.retry && !Ye.has(e.detail.trim().toLowerCase()), Ze = (e) => {
|
|
667
|
+
let t = (e.activity.find(Xe)?.detail ?? "").trim().split("\n")[0].trim();
|
|
620
668
|
return t.length > 80 ? `${t.slice(0, 80).trimEnd()}…` : t;
|
|
621
|
-
},
|
|
622
|
-
function
|
|
623
|
-
let a = Z(e, t, n), o =
|
|
669
|
+
}, Qe = (e) => e.name || Ze(e) || e.title || e.entityId, $e = (e) => e.activity.some(Xe), et = (e) => e.kind === "user" && !Xe(e) && !!e.detail?.trim();
|
|
670
|
+
function tt(e, t, n, r, i = "person") {
|
|
671
|
+
let a = Z(e, t, n), o = Ue(), s = o.find((e) => Z(e.scopeId, e.subagentId, e.entityId) === a);
|
|
624
672
|
if (!s || i === "model" && s.namedBy === "person") return !1;
|
|
625
673
|
let c = r.trim().replace(/\s+/g, " ").slice(0, 120), { name: l, namedBy: u, ...d } = s, f = c ? {
|
|
626
674
|
...d,
|
|
@@ -631,29 +679,29 @@ function Ze(e, t, n, r, i = "person") {
|
|
|
631
679
|
...d,
|
|
632
680
|
changedAt: Date.now()
|
|
633
681
|
};
|
|
634
|
-
return
|
|
682
|
+
return Ke(o.map((e) => e === s ? f : e)), Be(f), !0;
|
|
635
683
|
}
|
|
636
684
|
var Q = (e) => e.startedAt ?? e.savedAt;
|
|
637
|
-
function
|
|
685
|
+
function nt(e, t, n) {
|
|
638
686
|
let r = Z(e, t, n);
|
|
639
|
-
|
|
687
|
+
Ke(Ue().filter((e) => Z(e.scopeId, e.subagentId, e.entityId) !== r)), Ie && Promise.resolve(Ie.remove(e, t, n)).catch(() => void 0);
|
|
640
688
|
}
|
|
641
|
-
function
|
|
642
|
-
return
|
|
689
|
+
function rt(e) {
|
|
690
|
+
return Ue().filter((t) => t.scopeId === e).sort((e, t) => Q(t) - Q(e));
|
|
643
691
|
}
|
|
644
|
-
var
|
|
692
|
+
var it = (e, t) => `entitychat-${e}-${t}`;
|
|
645
693
|
//#endregion
|
|
646
694
|
//#region src/domain/chatThread.ts
|
|
647
|
-
function
|
|
648
|
-
return
|
|
695
|
+
function at(e) {
|
|
696
|
+
return q(e.subagentId)?.thread?.(e.params) || void 0;
|
|
649
697
|
}
|
|
650
|
-
function
|
|
651
|
-
let r =
|
|
652
|
-
return r.filter((e) => e !== i && Q(e) < a &&
|
|
698
|
+
function ot(e, t, n) {
|
|
699
|
+
let r = rt(e), i = n ? r.find((e) => it(e.subagentId, e.entityId) === n) : void 0, a = i ? Q(i) : Infinity;
|
|
700
|
+
return r.filter((e) => e !== i && Q(e) < a && at(e) === t).sort((e, t) => Q(t) - Q(e));
|
|
653
701
|
}
|
|
654
702
|
//#endregion
|
|
655
703
|
//#region src/domain/threadEvents.ts
|
|
656
|
-
function
|
|
704
|
+
function st(e, t) {
|
|
657
705
|
let n = Array.from({ length: e.length + 1 }, () => []), r = [], i = -Infinity;
|
|
658
706
|
for (let t of e) t !== void 0 && (i = t), r.push(i);
|
|
659
707
|
for (let i of [...t].sort((e, t) => e.at - t.at)) {
|
|
@@ -664,8 +712,8 @@ function rt(e, t) {
|
|
|
664
712
|
}
|
|
665
713
|
//#endregion
|
|
666
714
|
//#region src/presentation/imagePreview.ts
|
|
667
|
-
var
|
|
668
|
-
async function
|
|
715
|
+
var ct = 480, lt = 4;
|
|
716
|
+
async function ut(e, t) {
|
|
669
717
|
if (e.type.startsWith("image/") && typeof document < "u" && typeof createImageBitmap == "function") try {
|
|
670
718
|
let n = await createImageBitmap(e), r = Math.min(1, t / Math.max(n.width, n.height)), i = document.createElement("canvas");
|
|
671
719
|
i.width = Math.max(1, Math.round(n.width * r)), i.height = Math.max(1, Math.round(n.height * r));
|
|
@@ -675,55 +723,144 @@ async function ot(e, t) {
|
|
|
675
723
|
return;
|
|
676
724
|
}
|
|
677
725
|
}
|
|
678
|
-
async function
|
|
726
|
+
async function dt(e, t = 480, n = 4) {
|
|
679
727
|
let r = e.filter((e) => e.type.startsWith("image/")).slice(0, n);
|
|
680
728
|
return (await Promise.all(r.map(async (e) => ({
|
|
681
729
|
name: e.name,
|
|
682
|
-
src: await
|
|
730
|
+
src: await ut(e, t)
|
|
683
731
|
})))).filter((e) => !!e.src);
|
|
684
732
|
}
|
|
685
733
|
//#endregion
|
|
686
734
|
//#region src/i18n/index.ts
|
|
687
|
-
var
|
|
688
|
-
en: { agentico:
|
|
689
|
-
it: { agentico:
|
|
690
|
-
de: { agentico:
|
|
735
|
+
var ft = {
|
|
736
|
+
en: { agentico: Me },
|
|
737
|
+
it: { agentico: Ne },
|
|
738
|
+
de: { agentico: Pe }
|
|
691
739
|
};
|
|
692
740
|
function $() {
|
|
693
|
-
let { dict: e } =
|
|
741
|
+
let { dict: e } = te(), t = e.agentico;
|
|
694
742
|
return t ? {
|
|
695
|
-
...
|
|
743
|
+
...Me,
|
|
744
|
+
...t
|
|
745
|
+
} : Me;
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/domain/settings.ts
|
|
749
|
+
var pt = [
|
|
750
|
+
"defaultModel",
|
|
751
|
+
"reasoning",
|
|
752
|
+
"providers",
|
|
753
|
+
"chatTitles",
|
|
754
|
+
"threadEvents"
|
|
755
|
+
], mt = {
|
|
756
|
+
chatTitles: !0,
|
|
757
|
+
threadEvents: !0
|
|
758
|
+
};
|
|
759
|
+
function ht(e, t = {}) {
|
|
760
|
+
let n = Object.fromEntries(Object.entries(e).filter(([e, t]) => pt.includes(e) && t !== void 0));
|
|
761
|
+
return {
|
|
762
|
+
...mt,
|
|
763
|
+
...n,
|
|
696
764
|
...t
|
|
697
|
-
}
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
function gt(e = {}, t = []) {
|
|
768
|
+
return pt.filter((n) => !(n in e) && !t.includes(n));
|
|
769
|
+
}
|
|
770
|
+
var _t = "llmnative.agentico.settings", vt = {
|
|
771
|
+
async load() {
|
|
772
|
+
try {
|
|
773
|
+
let e = localStorage.getItem(_t);
|
|
774
|
+
return e ? JSON.parse(e) : {};
|
|
775
|
+
} catch {
|
|
776
|
+
return {};
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
async save(e) {
|
|
780
|
+
try {
|
|
781
|
+
localStorage.setItem(_t, JSON.stringify(e));
|
|
782
|
+
} catch {}
|
|
783
|
+
}
|
|
784
|
+
}, yt = j(null);
|
|
785
|
+
function bt({ config: e, children: t }) {
|
|
786
|
+
let n = e?.store ?? vt, [r, i] = L({}), [a, o] = L(!1);
|
|
787
|
+
N(() => {
|
|
788
|
+
let e = !0;
|
|
789
|
+
return n.load().then((t) => {
|
|
790
|
+
e && i(t ?? {});
|
|
791
|
+
}, () => void 0), () => {
|
|
792
|
+
e = !1;
|
|
793
|
+
};
|
|
794
|
+
}, [n]);
|
|
795
|
+
let s = JSON.stringify(e?.fixed ?? {}), c = (e?.hidden ?? []).join(","), l = F(() => ht(r, e?.fixed), [r, s]), u = F(() => gt(e?.fixed, e?.hidden), [s, c]), d = M(async (e) => {
|
|
796
|
+
let t = Object.fromEntries(Object.entries(e).filter(([e]) => u.includes(e))), a = {
|
|
797
|
+
...r,
|
|
798
|
+
...t
|
|
799
|
+
};
|
|
800
|
+
await n.save(a), i(a);
|
|
801
|
+
}, [
|
|
802
|
+
r,
|
|
803
|
+
u,
|
|
804
|
+
n
|
|
805
|
+
]), f = F(() => ({
|
|
806
|
+
settings: l,
|
|
807
|
+
shown: u,
|
|
808
|
+
connections: e?.connections,
|
|
809
|
+
save: d,
|
|
810
|
+
isOpen: a,
|
|
811
|
+
open: () => o(!0),
|
|
812
|
+
close: () => o(!1)
|
|
813
|
+
}), [
|
|
814
|
+
l,
|
|
815
|
+
u,
|
|
816
|
+
e?.connections,
|
|
817
|
+
d,
|
|
818
|
+
a
|
|
819
|
+
]);
|
|
820
|
+
return /* @__PURE__ */ z(yt.Provider, {
|
|
821
|
+
value: f,
|
|
822
|
+
children: t
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
var xt = {
|
|
826
|
+
settings: mt,
|
|
827
|
+
shown: [],
|
|
828
|
+
save: async () => void 0,
|
|
829
|
+
isOpen: !1,
|
|
830
|
+
open: () => void 0,
|
|
831
|
+
close: () => void 0
|
|
832
|
+
};
|
|
833
|
+
function St() {
|
|
834
|
+
return re(yt) ?? xt;
|
|
698
835
|
}
|
|
699
836
|
//#endregion
|
|
700
837
|
//#region src/presentation/AgenticoContext.tsx
|
|
701
|
-
var
|
|
702
|
-
function
|
|
703
|
-
let [
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}, [
|
|
707
|
-
let [
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}, [
|
|
711
|
-
let
|
|
712
|
-
let t =
|
|
838
|
+
var Ct = "agentico-orchestrator", wt = j(null);
|
|
839
|
+
function Tt({ children: e, scope: t = null, person: n = null, threadEvents: r = null, settings: i }) {
|
|
840
|
+
let [a, o] = L(null), s = I(null);
|
|
841
|
+
N(() => {
|
|
842
|
+
s.current = a;
|
|
843
|
+
}, [a]);
|
|
844
|
+
let [c, l] = L(!1), u = t?.id;
|
|
845
|
+
N(() => {
|
|
846
|
+
u && Ve(u).catch(() => void 0);
|
|
847
|
+
}, [u]);
|
|
848
|
+
let d = M((e) => {
|
|
849
|
+
let t = s.current;
|
|
713
850
|
t && t.id !== e.id && t.onDismiss();
|
|
714
851
|
let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
|
|
715
852
|
...e,
|
|
716
853
|
savedToDisk: !0
|
|
717
854
|
} : e;
|
|
718
|
-
|
|
719
|
-
}, []),
|
|
720
|
-
|
|
721
|
-
}, []),
|
|
722
|
-
|
|
855
|
+
o(n);
|
|
856
|
+
}, []), f = M((e) => {
|
|
857
|
+
o((t) => t && t.id === e ? null : t);
|
|
858
|
+
}, []), p = M(() => l((e) => !e), []), m = M(() => l(!0), []), [h, g] = L(null), _ = M((e) => {
|
|
859
|
+
l(!0), g((t) => ({
|
|
723
860
|
text: e,
|
|
724
861
|
nonce: (t?.nonce ?? 0) + 1
|
|
725
862
|
}));
|
|
726
|
-
}, []), [
|
|
863
|
+
}, []), [v, y] = L(null), [b, x] = L(void 0), [S, C] = L(void 0), [w, T] = L(void 0), [E, D] = L(null), [O, ee] = L(null), [k, te] = L(void 0), [A, ne] = L([]), j = M((e, t, n = null) => {
|
|
727
864
|
ne((r) => {
|
|
728
865
|
let i = r.filter((t) => t.id !== e);
|
|
729
866
|
return t ? [...i, {
|
|
@@ -732,7 +869,7 @@ function dt({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
732
869
|
card: n
|
|
733
870
|
}] : i;
|
|
734
871
|
});
|
|
735
|
-
}, []),
|
|
872
|
+
}, []), re = A.length > 0 ? A[A.length - 1] : null, [P, R] = L([]), B = M((e, t) => {
|
|
736
873
|
R((n) => {
|
|
737
874
|
let r = n.filter((t) => t.id !== e);
|
|
738
875
|
return t ? [...r, {
|
|
@@ -740,22 +877,22 @@ function dt({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
740
877
|
...t
|
|
741
878
|
}] : r;
|
|
742
879
|
});
|
|
743
|
-
}, []),
|
|
880
|
+
}, []), V = F(() => P.map((e) => ({
|
|
744
881
|
subagentId: e.subagentId,
|
|
745
882
|
componentKey: e.componentKey,
|
|
746
883
|
onResult: e.onResult,
|
|
747
884
|
pinnedEntityId: e.pinnedEntityId
|
|
748
|
-
})), [
|
|
885
|
+
})), [P]), ie = F(() => {
|
|
749
886
|
let e = /* @__PURE__ */ new Map();
|
|
750
|
-
for (let t of
|
|
887
|
+
for (let t of P) e.set(t.subagentId, {
|
|
751
888
|
subagentId: t.subagentId,
|
|
752
889
|
componentKey: t.componentKey,
|
|
753
890
|
onResult: t.onResult,
|
|
754
891
|
contextInfo: t.contextInfo
|
|
755
892
|
});
|
|
756
893
|
return [...e.values()];
|
|
757
|
-
}, [
|
|
758
|
-
let t =
|
|
894
|
+
}, [P]), H = F(() => ie.map((e) => {
|
|
895
|
+
let t = q(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
759
896
|
if (!t) return null;
|
|
760
897
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
761
898
|
return {
|
|
@@ -763,177 +900,188 @@ function dt({ children: e, scope: t = null, person: n = null, threadEvents: r =
|
|
|
763
900
|
agenticoHint: n,
|
|
764
901
|
userMessage: t.userMessage
|
|
765
902
|
};
|
|
766
|
-
}).filter((e) => e !== null), [
|
|
767
|
-
if (
|
|
768
|
-
if (
|
|
769
|
-
let e =
|
|
903
|
+
}).filter((e) => e !== null), [ie]), U = F(() => H.map((e) => e.userMessage), [H]), ae = F(() => {
|
|
904
|
+
if (H.length === 0) return null;
|
|
905
|
+
if (H.length === 1) return H[0].agenticoHint;
|
|
906
|
+
let e = H.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
770
907
|
return `${J().multipleCandidates}\n\n${e}`;
|
|
771
|
-
}, [
|
|
772
|
-
|
|
773
|
-
let n =
|
|
908
|
+
}, [H]) ?? re?.text ?? null, W = H.length > 0 ? null : re?.card ?? null, oe = F(() => [...new Set(V.map((e) => e.subagentId))], [V]), G = oe.length === 1 ? oe[0] : oe.length === 0 ? re?.card?.subagentId ?? null : null, K = M((e, t) => {
|
|
909
|
+
m();
|
|
910
|
+
let n = s.current;
|
|
774
911
|
if (n?.id === "agentico-orchestrator") return;
|
|
775
|
-
let r =
|
|
776
|
-
|
|
912
|
+
let r = G && n?.id.startsWith(`subagent-${G}-`) ? n : void 0;
|
|
913
|
+
ee(r ? {
|
|
777
914
|
taskId: r.id,
|
|
778
915
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
779
|
-
} : null),
|
|
780
|
-
}, [
|
|
916
|
+
} : null), y(e), x(t?.extraDestinations), C(t?.attachments), T(t?.model), te(t?.scopedSubagentId), D(crypto.randomUUID());
|
|
917
|
+
}, [m, G]), se = M((e, t, n, r, i, a) => {
|
|
781
918
|
if (!n || !r) return;
|
|
782
|
-
let c =
|
|
919
|
+
let c = s.current;
|
|
783
920
|
if (!c || c.id !== n) return;
|
|
784
921
|
let l = c.agent.snapshot();
|
|
785
|
-
l && (
|
|
922
|
+
l && (Je({
|
|
786
923
|
scopeId: r,
|
|
787
924
|
subagentId: e,
|
|
788
925
|
entityId: t,
|
|
789
926
|
params: i,
|
|
790
|
-
title:
|
|
927
|
+
title: a,
|
|
791
928
|
history: l.history,
|
|
792
929
|
activity: [...c.precedingActivity ?? [], ...l.activity]
|
|
793
|
-
}),
|
|
930
|
+
}), o((e) => e && e.id === n ? {
|
|
794
931
|
...e,
|
|
795
932
|
savedToDisk: !0
|
|
796
933
|
} : e));
|
|
797
|
-
}, []), [
|
|
798
|
-
|
|
934
|
+
}, []), [ce, le] = L(null), [ue, de] = L(null), fe = M((e, t, n) => {
|
|
935
|
+
m(), le({
|
|
799
936
|
subagentId: e,
|
|
800
937
|
entityId: t,
|
|
801
938
|
snapshot: n
|
|
802
|
-
}),
|
|
803
|
-
}, [
|
|
804
|
-
|
|
939
|
+
}), de(crypto.randomUUID());
|
|
940
|
+
}, [m]), [pe, me] = L(null), [he, ge] = L(null), _e = M((e, t) => {
|
|
941
|
+
m(), f(Ct), me({
|
|
805
942
|
subagentId: e,
|
|
806
943
|
extraDestinations: t
|
|
807
|
-
}),
|
|
808
|
-
}, [
|
|
809
|
-
|
|
944
|
+
}), ge(crypto.randomUUID());
|
|
945
|
+
}, [m, f]), [Y, X] = L(null), [ve, ye] = L(null), be = M((e, t, n) => {
|
|
946
|
+
me(null), X({
|
|
810
947
|
subagentId: e,
|
|
811
948
|
params: t,
|
|
812
949
|
extraDestinations: n
|
|
813
|
-
}),
|
|
814
|
-
}, []), [
|
|
815
|
-
|
|
950
|
+
}), ye(crypto.randomUUID());
|
|
951
|
+
}, []), [xe, Se] = L(null), [Ce, we] = L(null), Te = M((e, t, n) => {
|
|
952
|
+
m(), Se({
|
|
816
953
|
subagentId: e,
|
|
817
954
|
params: t,
|
|
818
955
|
...n
|
|
819
|
-
}),
|
|
820
|
-
}, [
|
|
821
|
-
let e =
|
|
956
|
+
}), we(crypto.randomUUID());
|
|
957
|
+
}, [m]), Ee = M(() => {
|
|
958
|
+
let e = s.current;
|
|
822
959
|
e && e.onDismiss();
|
|
823
|
-
}, []),
|
|
960
|
+
}, []), De = F(() => ({
|
|
824
961
|
scope: t,
|
|
825
962
|
person: n,
|
|
826
963
|
threadEvents: r,
|
|
827
|
-
compose:
|
|
828
|
-
draft:
|
|
829
|
-
task:
|
|
830
|
-
isOpen:
|
|
831
|
-
openTask:
|
|
832
|
-
closeTask:
|
|
833
|
-
toggleOpen:
|
|
834
|
-
pendingGoal:
|
|
835
|
-
startOrchestrator:
|
|
836
|
-
pageContext:
|
|
837
|
-
pageContextCard:
|
|
838
|
-
setPageContext:
|
|
839
|
-
scopedSubagentId:
|
|
840
|
-
pendingScopedSubagentId:
|
|
841
|
-
componentAnchors:
|
|
842
|
-
anchoredUserMessages:
|
|
843
|
-
registerComponentAnchor:
|
|
844
|
-
openPanel:
|
|
845
|
-
pendingExtraDestinations:
|
|
846
|
-
pendingAttachments:
|
|
847
|
-
pendingModel:
|
|
848
|
-
orchestratorRunId:
|
|
849
|
-
pendingCarryOver:
|
|
850
|
-
commitEntityChat:
|
|
851
|
-
resumeEntityChat:
|
|
852
|
-
pendingResume:
|
|
853
|
-
resumeRunId:
|
|
854
|
-
dismissForeignTask:
|
|
855
|
-
pendingManualEntry:
|
|
856
|
-
manualEntryRunId:
|
|
857
|
-
startManualEntry:
|
|
858
|
-
pendingResumeWithAI:
|
|
859
|
-
resumeWithAIRunId:
|
|
860
|
-
resumeWithAI:
|
|
861
|
-
startSubagent:
|
|
862
|
-
pendingStart:
|
|
863
|
-
startRunId:
|
|
964
|
+
compose: _,
|
|
965
|
+
draft: h,
|
|
966
|
+
task: a,
|
|
967
|
+
isOpen: c,
|
|
968
|
+
openTask: d,
|
|
969
|
+
closeTask: f,
|
|
970
|
+
toggleOpen: p,
|
|
971
|
+
pendingGoal: v,
|
|
972
|
+
startOrchestrator: K,
|
|
973
|
+
pageContext: ae,
|
|
974
|
+
pageContextCard: W,
|
|
975
|
+
setPageContext: j,
|
|
976
|
+
scopedSubagentId: G,
|
|
977
|
+
pendingScopedSubagentId: k,
|
|
978
|
+
componentAnchors: V,
|
|
979
|
+
anchoredUserMessages: U,
|
|
980
|
+
registerComponentAnchor: B,
|
|
981
|
+
openPanel: m,
|
|
982
|
+
pendingExtraDestinations: b,
|
|
983
|
+
pendingAttachments: S,
|
|
984
|
+
pendingModel: w,
|
|
985
|
+
orchestratorRunId: E,
|
|
986
|
+
pendingCarryOver: O,
|
|
987
|
+
commitEntityChat: se,
|
|
988
|
+
resumeEntityChat: fe,
|
|
989
|
+
pendingResume: ce,
|
|
990
|
+
resumeRunId: ue,
|
|
991
|
+
dismissForeignTask: Ee,
|
|
992
|
+
pendingManualEntry: pe,
|
|
993
|
+
manualEntryRunId: he,
|
|
994
|
+
startManualEntry: _e,
|
|
995
|
+
pendingResumeWithAI: Y,
|
|
996
|
+
resumeWithAIRunId: ve,
|
|
997
|
+
resumeWithAI: be,
|
|
998
|
+
startSubagent: Te,
|
|
999
|
+
pendingStart: xe,
|
|
1000
|
+
startRunId: Ce
|
|
864
1001
|
}), [
|
|
865
1002
|
t,
|
|
866
1003
|
n,
|
|
867
1004
|
r,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
u,
|
|
1005
|
+
_,
|
|
1006
|
+
h,
|
|
1007
|
+
a,
|
|
1008
|
+
c,
|
|
873
1009
|
d,
|
|
874
1010
|
f,
|
|
875
|
-
_,
|
|
876
|
-
q,
|
|
877
|
-
U,
|
|
878
|
-
ae,
|
|
879
|
-
F,
|
|
880
|
-
K,
|
|
881
|
-
O,
|
|
882
|
-
z,
|
|
883
|
-
H,
|
|
884
|
-
ie,
|
|
885
1011
|
p,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1012
|
+
v,
|
|
1013
|
+
K,
|
|
1014
|
+
ae,
|
|
1015
|
+
W,
|
|
1016
|
+
j,
|
|
1017
|
+
G,
|
|
1018
|
+
k,
|
|
1019
|
+
V,
|
|
1020
|
+
U,
|
|
1021
|
+
B,
|
|
1022
|
+
m,
|
|
1023
|
+
b,
|
|
1024
|
+
S,
|
|
1025
|
+
w,
|
|
890
1026
|
E,
|
|
891
|
-
|
|
892
|
-
de,
|
|
1027
|
+
O,
|
|
893
1028
|
se,
|
|
894
|
-
le,
|
|
895
|
-
Te,
|
|
896
1029
|
fe,
|
|
897
|
-
|
|
1030
|
+
ce,
|
|
1031
|
+
ue,
|
|
1032
|
+
Ee,
|
|
1033
|
+
pe,
|
|
1034
|
+
he,
|
|
1035
|
+
_e,
|
|
898
1036
|
Y,
|
|
899
|
-
|
|
900
|
-
X,
|
|
901
|
-
ye,
|
|
902
|
-
we,
|
|
1037
|
+
ve,
|
|
903
1038
|
be,
|
|
904
|
-
|
|
1039
|
+
Te,
|
|
1040
|
+
xe,
|
|
1041
|
+
Ce
|
|
905
1042
|
]);
|
|
906
|
-
return /* @__PURE__ */
|
|
907
|
-
value:
|
|
908
|
-
children:
|
|
1043
|
+
return /* @__PURE__ */ z(wt.Provider, {
|
|
1044
|
+
value: De,
|
|
1045
|
+
children: /* @__PURE__ */ z(bt, {
|
|
1046
|
+
config: i,
|
|
1047
|
+
children: e
|
|
1048
|
+
})
|
|
909
1049
|
});
|
|
910
1050
|
}
|
|
911
|
-
function
|
|
912
|
-
let e =
|
|
1051
|
+
function Et() {
|
|
1052
|
+
let e = re(wt);
|
|
913
1053
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
914
1054
|
return e;
|
|
915
1055
|
}
|
|
916
1056
|
//#endregion
|
|
917
1057
|
//#region src/presentation/ThreadEvents.tsx
|
|
918
|
-
var
|
|
919
|
-
function
|
|
920
|
-
let
|
|
1058
|
+
var Dt = "llmnative.agentico.threadEvents";
|
|
1059
|
+
function Ot() {
|
|
1060
|
+
let { settings: e } = St(), [t, n] = L(() => {
|
|
921
1061
|
try {
|
|
922
|
-
return localStorage.getItem(
|
|
1062
|
+
return localStorage.getItem(Dt) !== "off";
|
|
923
1063
|
} catch {
|
|
924
1064
|
return !0;
|
|
925
1065
|
}
|
|
926
1066
|
});
|
|
927
|
-
return
|
|
928
|
-
t
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1067
|
+
return e.threadEvents ? [
|
|
1068
|
+
t,
|
|
1069
|
+
(e) => {
|
|
1070
|
+
n(e);
|
|
1071
|
+
try {
|
|
1072
|
+
localStorage.setItem(Dt, e ? "on" : "off");
|
|
1073
|
+
} catch {}
|
|
1074
|
+
},
|
|
1075
|
+
!0
|
|
1076
|
+
] : [
|
|
1077
|
+
!1,
|
|
1078
|
+
() => void 0,
|
|
1079
|
+
!1
|
|
1080
|
+
];
|
|
933
1081
|
}
|
|
934
|
-
function
|
|
935
|
-
let { threadEvents: i } =
|
|
936
|
-
return
|
|
1082
|
+
function kt(e, t, n, r = !0) {
|
|
1083
|
+
let { threadEvents: i } = Et(), [a, o] = L([]);
|
|
1084
|
+
return N(() => {
|
|
937
1085
|
if (!i || !e || !r) {
|
|
938
1086
|
o([]);
|
|
939
1087
|
return;
|
|
@@ -956,8 +1104,8 @@ function ht(e, t, n, r = !0) {
|
|
|
956
1104
|
r
|
|
957
1105
|
]), a;
|
|
958
1106
|
}
|
|
959
|
-
function
|
|
960
|
-
let t = $(), { locale:
|
|
1107
|
+
function At({ event: e }) {
|
|
1108
|
+
let t = $(), { locale: n } = te(), [i, o] = L(!!e.open), { threadEvents: s, task: c, compose: l } = Et(), [u, d] = L(null), f = async (t) => {
|
|
961
1109
|
if (s?.onAction) {
|
|
962
1110
|
d(t);
|
|
963
1111
|
try {
|
|
@@ -976,71 +1124,71 @@ function gt({ event: e }) {
|
|
|
976
1124
|
d(null);
|
|
977
1125
|
}
|
|
978
1126
|
}
|
|
979
|
-
},
|
|
1127
|
+
}, p = new Date(e.at).toLocaleString(n, {
|
|
980
1128
|
dateStyle: "short",
|
|
981
1129
|
timeStyle: "short"
|
|
982
1130
|
});
|
|
983
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ B("li", {
|
|
984
1132
|
className: "flex items-start gap-2 py-1 text-xs",
|
|
985
1133
|
"aria-label": `${e.author.name}: ${e.title}`,
|
|
986
1134
|
"aria-busy": e.running || void 0,
|
|
987
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ z("span", {
|
|
988
1136
|
className: "flex w-6 shrink-0 justify-center pt-px",
|
|
989
|
-
children: /* @__PURE__ */
|
|
990
|
-
}), /* @__PURE__ */
|
|
1137
|
+
children: /* @__PURE__ */ z(Vt, { author: e.author })
|
|
1138
|
+
}), /* @__PURE__ */ B("div", {
|
|
991
1139
|
className: `min-w-0 flex-1 rounded-md border px-2 py-1 ${e.running ? "border-primary/40 bg-primary/5" : "border-border/60 bg-muted/30"}`,
|
|
992
1140
|
children: [
|
|
993
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ B("div", {
|
|
994
1142
|
className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5",
|
|
995
1143
|
children: [
|
|
996
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ z("span", {
|
|
997
1145
|
className: "font-medium text-foreground",
|
|
998
1146
|
children: e.author.name
|
|
999
1147
|
}),
|
|
1000
|
-
e.running ? /* @__PURE__ */
|
|
1148
|
+
e.running ? /* @__PURE__ */ z(m, {
|
|
1001
1149
|
name: "loader-circle",
|
|
1002
1150
|
size: 12,
|
|
1003
1151
|
className: "shrink-0 animate-spin text-primary",
|
|
1004
1152
|
"aria-label": t.eventRunning
|
|
1005
|
-
}) : e.icon && /* @__PURE__ */
|
|
1153
|
+
}) : e.icon && /* @__PURE__ */ z(m, {
|
|
1006
1154
|
name: e.icon,
|
|
1007
1155
|
size: 12,
|
|
1008
1156
|
className: "shrink-0 text-muted-foreground"
|
|
1009
1157
|
}),
|
|
1010
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ z("span", {
|
|
1011
1159
|
className: "min-w-0 break-words text-muted-foreground",
|
|
1012
1160
|
children: e.title
|
|
1013
1161
|
}),
|
|
1014
|
-
e.badge && /* @__PURE__ */
|
|
1162
|
+
e.badge && /* @__PURE__ */ z(r, {
|
|
1015
1163
|
variant: e.badge.variant ?? "light",
|
|
1016
1164
|
children: e.badge.label
|
|
1017
1165
|
}),
|
|
1018
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ B("span", {
|
|
1019
1167
|
className: "ms-auto flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground",
|
|
1020
1168
|
children: [
|
|
1021
|
-
/* @__PURE__ */
|
|
1169
|
+
/* @__PURE__ */ z("time", {
|
|
1022
1170
|
dateTime: new Date(e.at).toISOString(),
|
|
1023
|
-
children:
|
|
1171
|
+
children: p
|
|
1024
1172
|
}),
|
|
1025
|
-
e.body && /* @__PURE__ */
|
|
1173
|
+
e.body && /* @__PURE__ */ z("button", {
|
|
1026
1174
|
type: "button",
|
|
1027
1175
|
onClick: () => o((e) => !e),
|
|
1028
|
-
"aria-expanded":
|
|
1029
|
-
title:
|
|
1176
|
+
"aria-expanded": i,
|
|
1177
|
+
title: i ? t.eventLess : t.eventMore,
|
|
1030
1178
|
className: "rounded hover:text-foreground",
|
|
1031
|
-
children: /* @__PURE__ */
|
|
1032
|
-
name:
|
|
1179
|
+
children: /* @__PURE__ */ z(m, {
|
|
1180
|
+
name: i ? "chevron-up" : "chevron-down",
|
|
1033
1181
|
size: 12
|
|
1034
1182
|
})
|
|
1035
1183
|
}),
|
|
1036
|
-
e.href && /* @__PURE__ */
|
|
1184
|
+
e.href && /* @__PURE__ */ z("a", {
|
|
1037
1185
|
href: e.href,
|
|
1038
1186
|
target: "_blank",
|
|
1039
1187
|
rel: "noreferrer",
|
|
1040
1188
|
title: t.eventOpen,
|
|
1041
1189
|
"aria-label": t.eventOpen,
|
|
1042
1190
|
className: "rounded hover:text-foreground",
|
|
1043
|
-
children: /* @__PURE__ */
|
|
1191
|
+
children: /* @__PURE__ */ z(m, {
|
|
1044
1192
|
name: "external-link",
|
|
1045
1193
|
size: 12
|
|
1046
1194
|
})
|
|
@@ -1049,21 +1197,21 @@ function gt({ event: e }) {
|
|
|
1049
1197
|
})
|
|
1050
1198
|
]
|
|
1051
1199
|
}),
|
|
1052
|
-
|
|
1200
|
+
i && e.body && /* @__PURE__ */ z(a, {
|
|
1053
1201
|
content: e.body,
|
|
1054
1202
|
tone: "muted",
|
|
1055
1203
|
className: "mt-1 break-words text-xs leading-relaxed"
|
|
1056
1204
|
}),
|
|
1057
|
-
e.actions && e.actions.length > 0 && s?.onAction && /* @__PURE__ */
|
|
1205
|
+
e.actions && e.actions.length > 0 && s?.onAction && /* @__PURE__ */ z("div", {
|
|
1058
1206
|
className: "mt-1.5 flex flex-wrap gap-1.5",
|
|
1059
|
-
children: e.actions.map((e) => /* @__PURE__ */
|
|
1207
|
+
children: e.actions.map((e) => /* @__PURE__ */ z(v, {
|
|
1060
1208
|
label: e.label,
|
|
1061
1209
|
...e.icon ? { icon: e.icon } : {},
|
|
1062
1210
|
variant: e.primary ? "primary" : "outline-primary",
|
|
1063
1211
|
className: "px-2 py-0.5 text-xs",
|
|
1064
1212
|
loading: u === e.id,
|
|
1065
1213
|
disabled: u !== null || !!c?.agent.running,
|
|
1066
|
-
onClick: () =>
|
|
1214
|
+
onClick: () => f(e.id)
|
|
1067
1215
|
}, e.id))
|
|
1068
1216
|
})
|
|
1069
1217
|
]
|
|
@@ -1072,7 +1220,7 @@ function gt({ event: e }) {
|
|
|
1072
1220
|
}
|
|
1073
1221
|
//#endregion
|
|
1074
1222
|
//#region src/presentation/AgentActivityLog.tsx
|
|
1075
|
-
function
|
|
1223
|
+
function jt(e) {
|
|
1076
1224
|
let t = e.search(/[{[]/);
|
|
1077
1225
|
if (t === -1) return [{
|
|
1078
1226
|
type: "text",
|
|
@@ -1118,51 +1266,51 @@ function _t(e) {
|
|
|
1118
1266
|
language: "json"
|
|
1119
1267
|
});
|
|
1120
1268
|
let u = e.slice(s + 1);
|
|
1121
|
-
return u.trim() && l.push(...
|
|
1269
|
+
return u.trim() && l.push(...jt(u)), l;
|
|
1122
1270
|
}
|
|
1123
|
-
function
|
|
1271
|
+
function Mt(e) {
|
|
1124
1272
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
1125
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
1273
|
+
for (; i = n.exec(e);) i.index > r && t.push(...jt(e.slice(r, i.index))), t.push({
|
|
1126
1274
|
type: "code",
|
|
1127
1275
|
content: i[2].replace(/\n$/, ""),
|
|
1128
1276
|
language: i[1]
|
|
1129
1277
|
}), r = n.lastIndex;
|
|
1130
|
-
return r < e.length && t.push(...
|
|
1278
|
+
return r < e.length && t.push(...jt(e.slice(r))), t;
|
|
1131
1279
|
}
|
|
1132
|
-
function
|
|
1133
|
-
let [n, r] =
|
|
1134
|
-
return /* @__PURE__ */
|
|
1280
|
+
function Nt({ content: e, language: t }) {
|
|
1281
|
+
let [n, r] = L(!1);
|
|
1282
|
+
return /* @__PURE__ */ B("div", {
|
|
1135
1283
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
1136
1284
|
onClick: () => r((e) => !e),
|
|
1137
1285
|
title: n ? "Clic per comprimere" : "Clic per espandere",
|
|
1138
|
-
children: [/* @__PURE__ */
|
|
1286
|
+
children: [/* @__PURE__ */ z(u, {
|
|
1139
1287
|
language: t,
|
|
1140
1288
|
showCopy: n,
|
|
1141
1289
|
background: "transparent",
|
|
1142
1290
|
className: "!text-[11px]",
|
|
1143
1291
|
children: e
|
|
1144
|
-
}), !n && /* @__PURE__ */
|
|
1292
|
+
}), !n && /* @__PURE__ */ z("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
1145
1293
|
});
|
|
1146
1294
|
}
|
|
1147
|
-
function
|
|
1148
|
-
let n =
|
|
1149
|
-
return /* @__PURE__ */
|
|
1295
|
+
function Pt({ text: e, tone: t }) {
|
|
1296
|
+
let n = Mt(e);
|
|
1297
|
+
return /* @__PURE__ */ z(R, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ z(Nt, {
|
|
1150
1298
|
content: e.content,
|
|
1151
1299
|
language: e.language
|
|
1152
|
-
}, n) : e.content.trim() && /* @__PURE__ */
|
|
1300
|
+
}, n) : e.content.trim() && /* @__PURE__ */ z(a, {
|
|
1153
1301
|
content: e.content.trim(),
|
|
1154
1302
|
tone: t,
|
|
1155
1303
|
className: "break-words text-xs leading-relaxed"
|
|
1156
1304
|
}, n)) });
|
|
1157
1305
|
}
|
|
1158
|
-
function
|
|
1159
|
-
let [e] =
|
|
1160
|
-
|
|
1306
|
+
function Ft() {
|
|
1307
|
+
let [e] = L(() => Date.now()), [t, n] = L(e);
|
|
1308
|
+
N(() => {
|
|
1161
1309
|
let e = setInterval(() => n(Date.now()), 1e3);
|
|
1162
1310
|
return () => clearInterval(e);
|
|
1163
1311
|
}, []);
|
|
1164
1312
|
let r = Math.floor((t - e) / 1e3);
|
|
1165
|
-
return r < 10 ? null : /* @__PURE__ */
|
|
1313
|
+
return r < 10 ? null : /* @__PURE__ */ B("span", {
|
|
1166
1314
|
className: "tabular-nums",
|
|
1167
1315
|
children: [
|
|
1168
1316
|
" · ",
|
|
@@ -1172,66 +1320,66 @@ function xt() {
|
|
|
1172
1320
|
]
|
|
1173
1321
|
});
|
|
1174
1322
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return e === "running" ? /* @__PURE__ */
|
|
1323
|
+
function It({ status: e }) {
|
|
1324
|
+
return e === "running" ? /* @__PURE__ */ z("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ z(m, {
|
|
1177
1325
|
name: "check",
|
|
1178
1326
|
size: 12,
|
|
1179
1327
|
className: "shrink-0 text-green-600"
|
|
1180
|
-
}) : e === "stopped" ? /* @__PURE__ */
|
|
1328
|
+
}) : e === "stopped" ? /* @__PURE__ */ z(m, {
|
|
1181
1329
|
name: "circle-slash",
|
|
1182
1330
|
size: 12,
|
|
1183
1331
|
className: "shrink-0 text-muted-foreground"
|
|
1184
|
-
}) : /* @__PURE__ */
|
|
1332
|
+
}) : /* @__PURE__ */ z(m, {
|
|
1185
1333
|
name: "x",
|
|
1186
1334
|
size: 12,
|
|
1187
1335
|
className: "shrink-0 text-destructive"
|
|
1188
1336
|
});
|
|
1189
1337
|
}
|
|
1190
|
-
function
|
|
1338
|
+
function Lt(e, t) {
|
|
1191
1339
|
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;
|
|
1192
1340
|
}
|
|
1193
|
-
var
|
|
1194
|
-
function
|
|
1195
|
-
let [t, n] =
|
|
1196
|
-
return /* @__PURE__ */
|
|
1341
|
+
var Rt = 96, zt = (e) => e.some((e) => e.status === "stopped" || e.status === "error");
|
|
1342
|
+
function Bt({ previews: e }) {
|
|
1343
|
+
let [t, n] = L(null);
|
|
1344
|
+
return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
1197
1345
|
className: "flex flex-wrap gap-1.5",
|
|
1198
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1346
|
+
children: e.map((e) => /* @__PURE__ */ z("button", {
|
|
1199
1347
|
type: "button",
|
|
1200
1348
|
onClick: () => n(e),
|
|
1201
1349
|
title: e.name,
|
|
1202
1350
|
className: "overflow-hidden rounded-md border border-border/60 bg-background",
|
|
1203
|
-
children: /* @__PURE__ */
|
|
1351
|
+
children: /* @__PURE__ */ z("img", {
|
|
1204
1352
|
src: e.src,
|
|
1205
1353
|
alt: e.name,
|
|
1206
1354
|
className: "block max-h-40 max-w-full object-contain"
|
|
1207
1355
|
})
|
|
1208
1356
|
}, e.name))
|
|
1209
|
-
}), t && /* @__PURE__ */
|
|
1357
|
+
}), t && /* @__PURE__ */ z(y, {
|
|
1210
1358
|
title: t.name,
|
|
1211
1359
|
size: "lg",
|
|
1212
1360
|
onClose: () => n(null),
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1361
|
+
children: /* @__PURE__ */ z("img", {
|
|
1214
1362
|
src: t.src,
|
|
1215
1363
|
alt: t.name,
|
|
1216
1364
|
className: "mx-auto block max-h-[70vh] max-w-full object-contain"
|
|
1217
1365
|
})
|
|
1218
1366
|
})] });
|
|
1219
1367
|
}
|
|
1220
|
-
function
|
|
1221
|
-
return e.avatarUrl ? /* @__PURE__ */
|
|
1368
|
+
function Vt({ author: e, size: t = 20 }) {
|
|
1369
|
+
return e.avatarUrl ? /* @__PURE__ */ z(g, {
|
|
1222
1370
|
src: e.avatarUrl,
|
|
1223
1371
|
title: e.name,
|
|
1224
1372
|
alt: e.name,
|
|
1225
1373
|
width: t,
|
|
1226
1374
|
height: t
|
|
1227
|
-
}) : /* @__PURE__ */
|
|
1375
|
+
}) : /* @__PURE__ */ z(h, {
|
|
1228
1376
|
value: e.name,
|
|
1229
1377
|
size: t,
|
|
1230
1378
|
title: e.name
|
|
1231
1379
|
});
|
|
1232
1380
|
}
|
|
1233
|
-
var
|
|
1234
|
-
function
|
|
1381
|
+
var Ht = "w-6";
|
|
1382
|
+
function Ut(e) {
|
|
1235
1383
|
if (!e || e.kind !== "thinking" || !e.parts) return [];
|
|
1236
1384
|
let t = [];
|
|
1237
1385
|
for (let n of e.parts) {
|
|
@@ -1240,25 +1388,25 @@ function kt(e) {
|
|
|
1240
1388
|
}
|
|
1241
1389
|
return t;
|
|
1242
1390
|
}
|
|
1243
|
-
function
|
|
1244
|
-
let r = $(), i = e.filter((e) => e.type === "reasoning"), a = e.filter((e) => e.type === "tool"), o = i.some((e) => e.streaming), s = a.filter((e) => e.status === "running").at(-1), c = Math.round(i.reduce((e, t) => e + (t.duration ?? 0), 0)), l = [...i.length ? [o ? r.reasoningNow : c > 0 ?
|
|
1245
|
-
return /* @__PURE__ */
|
|
1391
|
+
function Wt({ parts: e, open: t, onToggle: n }) {
|
|
1392
|
+
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 ? E(r.reasonedFor, { seconds: c }) : r.reasoned] : [], ...a.length ? [s?.label ?? (a.length === 1 ? r.oneStep : E(r.steps, { count: a.length }))] : []], u = o || !!s, d = a.some((e) => e.status === "error");
|
|
1393
|
+
return /* @__PURE__ */ B("button", {
|
|
1246
1394
|
type: "button",
|
|
1247
1395
|
onClick: n,
|
|
1248
1396
|
"aria-expanded": t,
|
|
1249
1397
|
title: r.processDetails,
|
|
1250
1398
|
className: "inline-flex min-w-0 items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground",
|
|
1251
1399
|
children: [
|
|
1252
|
-
/* @__PURE__ */
|
|
1400
|
+
/* @__PURE__ */ z(m, {
|
|
1253
1401
|
name: u ? "loader-circle" : d ? "circle-alert" : i.length ? "brain" : "list-checks",
|
|
1254
1402
|
size: 12,
|
|
1255
1403
|
className: `shrink-0 ${u ? "animate-spin" : ""}`
|
|
1256
1404
|
}),
|
|
1257
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__PURE__ */ z("span", {
|
|
1258
1406
|
className: "truncate",
|
|
1259
1407
|
children: l.join(" · ")
|
|
1260
1408
|
}),
|
|
1261
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ z(m, {
|
|
1262
1410
|
name: t ? "chevron-up" : "chevron-down",
|
|
1263
1411
|
size: 12,
|
|
1264
1412
|
className: "shrink-0"
|
|
@@ -1266,13 +1414,13 @@ function At({ parts: e, open: t, onToggle: n }) {
|
|
|
1266
1414
|
]
|
|
1267
1415
|
});
|
|
1268
1416
|
}
|
|
1269
|
-
function
|
|
1270
|
-
let o = $(), s =
|
|
1271
|
-
|
|
1417
|
+
function Gt({ entry: e, pinned: t = !0, actions: r, cut: i = !1, showAuthor: a = !1 }) {
|
|
1418
|
+
let o = $(), s = I(null), [c, l] = L(!1), [u, d] = L(!1);
|
|
1419
|
+
P(() => {
|
|
1272
1420
|
let e = s.current;
|
|
1273
1421
|
e && d(e.scrollHeight > 97);
|
|
1274
1422
|
}, [e.detail, e.attachmentNames]);
|
|
1275
|
-
let
|
|
1423
|
+
let f = u && !c, p = r?.available(e) && i ? /* @__PURE__ */ z(n, {
|
|
1276
1424
|
icon: "rotate-ccw",
|
|
1277
1425
|
ariaLabel: o.retry,
|
|
1278
1426
|
title: o.retry,
|
|
@@ -1280,9 +1428,9 @@ function jt({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
|
|
|
1280
1428
|
className: "p-1 text-muted-foreground hover:text-foreground",
|
|
1281
1429
|
disabled: r.disabled,
|
|
1282
1430
|
onClick: () => r.onRetry(e)
|
|
1283
|
-
}) : null, h = r?.available(e) ? /* @__PURE__ */
|
|
1431
|
+
}) : null, h = r?.available(e) ? /* @__PURE__ */ z("span", {
|
|
1284
1432
|
className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1433
|
+
children: /* @__PURE__ */ z(n, {
|
|
1286
1434
|
icon: "pencil",
|
|
1287
1435
|
ariaLabel: o.editMessage,
|
|
1288
1436
|
title: o.editMessage,
|
|
@@ -1291,84 +1439,84 @@ function jt({ entry: e, pinned: n = !0, actions: r, cut: i = !1, showAuthor: a =
|
|
|
1291
1439
|
disabled: r.disabled,
|
|
1292
1440
|
onClick: () => r.onEdit(e)
|
|
1293
1441
|
})
|
|
1294
|
-
}) : null, g = (t) => /* @__PURE__ */
|
|
1442
|
+
}) : null, g = (t) => /* @__PURE__ */ B("div", {
|
|
1295
1443
|
className: `${t ? "w-full" : "max-w-[85%]"} rounded-lg bg-primary/10 text-xs text-foreground`,
|
|
1296
|
-
children: [/* @__PURE__ */
|
|
1444
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1297
1445
|
ref: s,
|
|
1298
|
-
className: `space-y-1 px-2.5 pt-1.5 ${
|
|
1299
|
-
style:
|
|
1446
|
+
className: `space-y-1 px-2.5 pt-1.5 ${f ? "overflow-hidden" : ""}`,
|
|
1447
|
+
style: f ? { maxHeight: Rt } : void 0,
|
|
1300
1448
|
children: [
|
|
1301
|
-
e.attachmentPreviews && e.attachmentPreviews.length > 0 && /* @__PURE__ */
|
|
1302
|
-
e.attachmentNames && e.attachmentNames.some((t) => !e.attachmentPreviews?.some((e) => e.name === t)) && /* @__PURE__ */
|
|
1449
|
+
e.attachmentPreviews && e.attachmentPreviews.length > 0 && /* @__PURE__ */ z(Bt, { previews: e.attachmentPreviews }),
|
|
1450
|
+
e.attachmentNames && e.attachmentNames.some((t) => !e.attachmentPreviews?.some((e) => e.name === t)) && /* @__PURE__ */ z("div", {
|
|
1303
1451
|
className: "flex flex-wrap gap-1",
|
|
1304
|
-
children: e.attachmentNames.filter((t) => !e.attachmentPreviews?.some((e) => e.name === t)).map((e, t) => /* @__PURE__ */
|
|
1452
|
+
children: e.attachmentNames.filter((t) => !e.attachmentPreviews?.some((e) => e.name === t)).map((e, t) => /* @__PURE__ */ B("span", {
|
|
1305
1453
|
className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
|
|
1306
|
-
children: [/* @__PURE__ */
|
|
1454
|
+
children: [/* @__PURE__ */ z(m, {
|
|
1307
1455
|
name: "paperclip",
|
|
1308
1456
|
size: 10,
|
|
1309
1457
|
className: "shrink-0"
|
|
1310
|
-
}), /* @__PURE__ */
|
|
1458
|
+
}), /* @__PURE__ */ z("span", {
|
|
1311
1459
|
className: "max-w-[160px] truncate",
|
|
1312
1460
|
children: e
|
|
1313
1461
|
})]
|
|
1314
1462
|
}, t))
|
|
1315
1463
|
}),
|
|
1316
|
-
/* @__PURE__ */
|
|
1464
|
+
/* @__PURE__ */ z(Pt, { text: e.detail ?? "" })
|
|
1317
1465
|
]
|
|
1318
|
-
}), u && /* @__PURE__ */
|
|
1466
|
+
}), u && /* @__PURE__ */ B("button", {
|
|
1319
1467
|
type: "button",
|
|
1320
1468
|
onClick: () => l((e) => !e),
|
|
1321
1469
|
className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
|
|
1322
1470
|
title: c ? "Comprimi" : "Espandi",
|
|
1323
|
-
children: [
|
|
1471
|
+
children: [f && /* @__PURE__ */ z("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ z(m, {
|
|
1324
1472
|
name: c ? "chevron-up" : "chevron-down",
|
|
1325
1473
|
size: 12
|
|
1326
1474
|
})]
|
|
1327
1475
|
})]
|
|
1328
1476
|
});
|
|
1329
|
-
return a ? /* @__PURE__ */
|
|
1330
|
-
className: `${
|
|
1331
|
-
children: [/* @__PURE__ */
|
|
1332
|
-
className: `flex shrink-0 flex-col items-center ${
|
|
1333
|
-
children: e.author ? /* @__PURE__ */
|
|
1477
|
+
return a ? /* @__PURE__ */ B("div", {
|
|
1478
|
+
className: `${t ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start gap-2 bg-background py-1.5`,
|
|
1479
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1480
|
+
className: `flex shrink-0 flex-col items-center ${Ht}`,
|
|
1481
|
+
children: e.author ? /* @__PURE__ */ z(Vt, { author: e.author }) : /* @__PURE__ */ z("span", {
|
|
1334
1482
|
className: "flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground",
|
|
1335
1483
|
"aria-hidden": !0,
|
|
1336
|
-
children: /* @__PURE__ */
|
|
1484
|
+
children: /* @__PURE__ */ z(m, {
|
|
1337
1485
|
name: "user",
|
|
1338
1486
|
size: 12
|
|
1339
1487
|
})
|
|
1340
1488
|
})
|
|
1341
|
-
}), /* @__PURE__ */
|
|
1489
|
+
}), /* @__PURE__ */ B("div", {
|
|
1342
1490
|
className: "min-w-0 flex-1",
|
|
1343
|
-
children: [(e.author ||
|
|
1491
|
+
children: [(e.author || p || h) && /* @__PURE__ */ B("div", {
|
|
1344
1492
|
className: "flex min-h-5 items-center gap-0.5 pb-0.5",
|
|
1345
1493
|
children: [
|
|
1346
|
-
e.author && /* @__PURE__ */
|
|
1494
|
+
e.author && /* @__PURE__ */ z("span", {
|
|
1347
1495
|
className: "me-1 truncate text-xs font-medium text-foreground",
|
|
1348
1496
|
children: e.author.name
|
|
1349
1497
|
}),
|
|
1350
|
-
|
|
1498
|
+
p,
|
|
1351
1499
|
h
|
|
1352
1500
|
]
|
|
1353
1501
|
}), g(!0)]
|
|
1354
1502
|
})]
|
|
1355
|
-
}) : /* @__PURE__ */
|
|
1356
|
-
className: `${
|
|
1357
|
-
children: [r?.available(e) && /* @__PURE__ */
|
|
1503
|
+
}) : /* @__PURE__ */ B("div", {
|
|
1504
|
+
className: `${t ? "sticky top-0 z-20 border-b border-border/40" : ""} group flex items-start justify-end gap-1 bg-background py-1.5`,
|
|
1505
|
+
children: [r?.available(e) && /* @__PURE__ */ B("span", {
|
|
1358
1506
|
className: "flex shrink-0 items-center",
|
|
1359
|
-
children: [
|
|
1507
|
+
children: [p, h]
|
|
1360
1508
|
}), g(!1)]
|
|
1361
1509
|
});
|
|
1362
1510
|
}
|
|
1363
|
-
var
|
|
1511
|
+
var Kt = {
|
|
1364
1512
|
running: "loader-circle",
|
|
1365
1513
|
done: "check",
|
|
1366
1514
|
error: "x",
|
|
1367
1515
|
stopped: "circle-slash"
|
|
1368
1516
|
};
|
|
1369
|
-
function
|
|
1370
|
-
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 :
|
|
1371
|
-
return /* @__PURE__ */
|
|
1517
|
+
function qt({ steps: e }) {
|
|
1518
|
+
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 : E(t.steps, { count: e.length }));
|
|
1519
|
+
return /* @__PURE__ */ z(w, {
|
|
1372
1520
|
ariaLabel: t.stepsLabel,
|
|
1373
1521
|
selectedId: null,
|
|
1374
1522
|
itemClassName: "py-0.5 text-xs text-muted-foreground",
|
|
@@ -1378,90 +1526,90 @@ function Nt({ steps: e }) {
|
|
|
1378
1526
|
icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
|
|
1379
1527
|
children: e.map((e) => ({
|
|
1380
1528
|
id: e.id,
|
|
1381
|
-
label: /* @__PURE__ */
|
|
1529
|
+
label: /* @__PURE__ */ z("span", {
|
|
1382
1530
|
className: e.status === "error" ? "text-destructive" : void 0,
|
|
1383
1531
|
children: e.label
|
|
1384
1532
|
}),
|
|
1385
|
-
icon:
|
|
1533
|
+
icon: Kt[e.status]
|
|
1386
1534
|
}))
|
|
1387
1535
|
}]
|
|
1388
1536
|
});
|
|
1389
1537
|
}
|
|
1390
|
-
function
|
|
1391
|
-
let s = $(), [c, l] =
|
|
1392
|
-
return /* @__PURE__ */
|
|
1538
|
+
function Jt({ entry: e, part: t, questions: o }) {
|
|
1539
|
+
let s = $(), [c, l] = L(!1), u = !!(o?.onCardAction && o.canAnswer(e.id) && !t.outcome), d = t.outcome?.status === "done" ? "text-success" : t.outcome?.status === "error" ? "text-destructive" : "text-muted-foreground";
|
|
1540
|
+
return /* @__PURE__ */ B(i, {
|
|
1393
1541
|
headerClassName: "flex items-center justify-between gap-2 px-3 py-2",
|
|
1394
1542
|
bodyClassName: "px-3 py-2",
|
|
1395
|
-
header: /* @__PURE__ */
|
|
1543
|
+
header: /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
|
|
1396
1544
|
className: "min-w-0 text-xs font-semibold text-foreground",
|
|
1397
|
-
children:
|
|
1398
|
-
}),
|
|
1399
|
-
variant:
|
|
1400
|
-
children:
|
|
1545
|
+
children: t.title
|
|
1546
|
+
}), t.badge && /* @__PURE__ */ z(r, {
|
|
1547
|
+
variant: t.badge.variant ?? "info",
|
|
1548
|
+
children: t.badge.label
|
|
1401
1549
|
})] }),
|
|
1402
|
-
footer: /* @__PURE__ */
|
|
1550
|
+
footer: /* @__PURE__ */ B("div", {
|
|
1403
1551
|
className: "space-y-1.5 px-3 py-2",
|
|
1404
|
-
children: [/* @__PURE__ */
|
|
1552
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1405
1553
|
className: "flex items-center gap-1",
|
|
1406
1554
|
children: [
|
|
1407
|
-
|
|
1555
|
+
t.details && /* @__PURE__ */ z(n, {
|
|
1408
1556
|
icon: "eye",
|
|
1409
1557
|
ariaLabel: s.cardView,
|
|
1410
1558
|
title: s.cardView,
|
|
1411
1559
|
variant: "outline-secondary",
|
|
1412
1560
|
onClick: () => l(!0)
|
|
1413
1561
|
}),
|
|
1414
|
-
(
|
|
1415
|
-
icon:
|
|
1416
|
-
ariaLabel:
|
|
1417
|
-
title:
|
|
1418
|
-
variant:
|
|
1562
|
+
(t.actions ?? []).filter((e) => e.variant !== "primary" && e.icon).map((n) => /* @__PURE__ */ z(v, {
|
|
1563
|
+
icon: n.icon,
|
|
1564
|
+
ariaLabel: n.label,
|
|
1565
|
+
title: n.label,
|
|
1566
|
+
variant: n.variant ?? "outline-secondary",
|
|
1419
1567
|
disabled: !u,
|
|
1420
|
-
onClick: () => o.onCardAction(e.id,
|
|
1421
|
-
},
|
|
1422
|
-
/* @__PURE__ */
|
|
1568
|
+
onClick: () => o.onCardAction(e.id, t.id, n.id)
|
|
1569
|
+
}, n.id)),
|
|
1570
|
+
/* @__PURE__ */ z("span", {
|
|
1423
1571
|
className: "ms-auto flex items-center gap-1",
|
|
1424
|
-
children: (
|
|
1425
|
-
...
|
|
1426
|
-
label:
|
|
1427
|
-
variant:
|
|
1572
|
+
children: (t.actions ?? []).filter((e) => e.variant === "primary" || !e.icon).map((n) => /* @__PURE__ */ z(v, {
|
|
1573
|
+
...n.icon ? { icon: n.icon } : {},
|
|
1574
|
+
label: n.label,
|
|
1575
|
+
variant: n.variant ?? "outline-primary",
|
|
1428
1576
|
disabled: !u,
|
|
1429
|
-
onClick: () => o.onCardAction(e.id,
|
|
1430
|
-
},
|
|
1577
|
+
onClick: () => o.onCardAction(e.id, t.id, n.id)
|
|
1578
|
+
}, n.id))
|
|
1431
1579
|
})
|
|
1432
1580
|
]
|
|
1433
|
-
}),
|
|
1581
|
+
}), t.outcome && /* @__PURE__ */ B("p", {
|
|
1434
1582
|
className: `text-xs ${d}`,
|
|
1435
|
-
children: [
|
|
1583
|
+
children: [t.outcome.text, t.outcome.link && /* @__PURE__ */ B(R, { children: [" ", /* @__PURE__ */ z("a", {
|
|
1436
1584
|
className: "underline",
|
|
1437
|
-
href:
|
|
1585
|
+
href: t.outcome.link.url,
|
|
1438
1586
|
target: "_blank",
|
|
1439
1587
|
rel: "noopener noreferrer",
|
|
1440
|
-
children:
|
|
1588
|
+
children: t.outcome.link.label
|
|
1441
1589
|
})] })]
|
|
1442
1590
|
})]
|
|
1443
1591
|
}),
|
|
1444
|
-
children: [
|
|
1445
|
-
content:
|
|
1592
|
+
children: [t.body ? /* @__PURE__ */ z(a, {
|
|
1593
|
+
content: t.body,
|
|
1446
1594
|
className: "break-words text-xs leading-relaxed text-foreground"
|
|
1447
|
-
}) : null, c &&
|
|
1448
|
-
title:
|
|
1595
|
+
}) : null, c && t.details && /* @__PURE__ */ z(y, {
|
|
1596
|
+
title: t.title,
|
|
1449
1597
|
position: "right",
|
|
1450
1598
|
size: "lg",
|
|
1451
1599
|
onClose: () => l(!1),
|
|
1452
|
-
footer: /* @__PURE__ */
|
|
1600
|
+
footer: /* @__PURE__ */ z(n, {
|
|
1453
1601
|
label: s.cardClose,
|
|
1454
1602
|
variant: "outline-secondary",
|
|
1455
1603
|
onClick: () => l(!1)
|
|
1456
1604
|
}),
|
|
1457
|
-
children: /* @__PURE__ */
|
|
1458
|
-
content:
|
|
1605
|
+
children: /* @__PURE__ */ z(a, {
|
|
1606
|
+
content: t.details,
|
|
1459
1607
|
className: "break-words text-sm leading-relaxed text-foreground"
|
|
1460
1608
|
})
|
|
1461
1609
|
})]
|
|
1462
1610
|
});
|
|
1463
1611
|
}
|
|
1464
|
-
function
|
|
1612
|
+
function Yt(e, t) {
|
|
1465
1613
|
let n = e.at(-1);
|
|
1466
1614
|
if (!n || n.kind !== "thinking" || !n.parts || n.status === "stopped" || n.status === "error") return null;
|
|
1467
1615
|
let r = [...n.parts].reverse().find((e) => e.type === "questions");
|
|
@@ -1470,48 +1618,48 @@ function Ft(e, t) {
|
|
|
1470
1618
|
part: r
|
|
1471
1619
|
};
|
|
1472
1620
|
}
|
|
1473
|
-
function
|
|
1474
|
-
let
|
|
1475
|
-
return /* @__PURE__ */
|
|
1621
|
+
function Xt({ entry: e, part: t, questions: n, autoFocus: r, className: i }) {
|
|
1622
|
+
let a = !!n?.canAnswer(e.id);
|
|
1623
|
+
return /* @__PURE__ */ z(o, {
|
|
1476
1624
|
questions: t.questions,
|
|
1477
1625
|
...t.answers ? { answers: t.answers } : {},
|
|
1478
|
-
disabled: !t.answers && !
|
|
1479
|
-
onSubmit: n &&
|
|
1626
|
+
disabled: !t.answers && !a,
|
|
1627
|
+
onSubmit: n && a ? (r) => n.onAnswer(e.id, t.id, r) : void 0,
|
|
1480
1628
|
autoFocus: r,
|
|
1481
1629
|
className: i ?? "text-xs"
|
|
1482
1630
|
});
|
|
1483
1631
|
}
|
|
1484
|
-
function
|
|
1485
|
-
let
|
|
1486
|
-
for (let e of
|
|
1487
|
-
let t =
|
|
1488
|
-
e.type === "tool" ? t && "steps" in t ? t.steps.push(e) :
|
|
1632
|
+
function Zt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
1633
|
+
let i = (e.parts ?? []).filter((e) => (e.type !== "questions" || e.id !== n) && !r?.has(e.id)), o = [];
|
|
1634
|
+
for (let e of i) {
|
|
1635
|
+
let t = o.at(-1);
|
|
1636
|
+
e.type === "tool" ? t && "steps" in t ? t.steps.push(e) : o.push({
|
|
1489
1637
|
key: `tool-${e.id}`,
|
|
1490
1638
|
steps: [e]
|
|
1491
|
-
}) :
|
|
1639
|
+
}) : o.push({
|
|
1492
1640
|
key: `${e.type}-${e.id}`,
|
|
1493
1641
|
part: e
|
|
1494
1642
|
});
|
|
1495
1643
|
}
|
|
1496
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ z("div", {
|
|
1497
1645
|
className: "space-y-2",
|
|
1498
|
-
children:
|
|
1499
|
-
if ("steps" in n) return /* @__PURE__ */
|
|
1646
|
+
children: o.map((n) => {
|
|
1647
|
+
if ("steps" in n) return /* @__PURE__ */ z(qt, { steps: n.steps }, n.key);
|
|
1500
1648
|
let { part: r } = n;
|
|
1501
|
-
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */
|
|
1649
|
+
return r.type === "text" ? r.text.trim() ? /* @__PURE__ */ z(a, {
|
|
1502
1650
|
content: r.text,
|
|
1503
1651
|
streaming: r.streaming,
|
|
1504
1652
|
className: "break-words text-xs leading-relaxed text-foreground"
|
|
1505
|
-
}, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */
|
|
1653
|
+
}, n.key) : null : r.type === "reasoning" ? /* @__PURE__ */ z(s, {
|
|
1506
1654
|
content: r.text,
|
|
1507
1655
|
streaming: r.streaming,
|
|
1508
1656
|
duration: r.duration,
|
|
1509
1657
|
className: "my-0"
|
|
1510
|
-
}, n.key) : r.type === "card" ? /* @__PURE__ */
|
|
1658
|
+
}, n.key) : r.type === "card" ? /* @__PURE__ */ z(Jt, {
|
|
1511
1659
|
entry: e,
|
|
1512
1660
|
part: r,
|
|
1513
1661
|
questions: t
|
|
1514
|
-
}, n.key) : /* @__PURE__ */
|
|
1662
|
+
}, n.key) : /* @__PURE__ */ z(Xt, {
|
|
1515
1663
|
entry: e,
|
|
1516
1664
|
part: r,
|
|
1517
1665
|
questions: t
|
|
@@ -1519,53 +1667,53 @@ function Lt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1519
1667
|
})
|
|
1520
1668
|
});
|
|
1521
1669
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let
|
|
1670
|
+
function Qt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
1671
|
+
let i = $();
|
|
1524
1672
|
if (e.kind === "thinking" && e.parts) {
|
|
1525
|
-
let
|
|
1526
|
-
return /* @__PURE__ */
|
|
1673
|
+
let a = e.status === "error" || e.status === "stopped" || e.status === "running", o = r ? e.parts.filter((e) => !r.has(e.id)).length : e.parts.length;
|
|
1674
|
+
return /* @__PURE__ */ B("li", {
|
|
1527
1675
|
className: "text-xs text-muted-foreground",
|
|
1528
|
-
children: [o > 0 && /* @__PURE__ */
|
|
1676
|
+
children: [o > 0 && /* @__PURE__ */ z(Zt, {
|
|
1529
1677
|
entry: e,
|
|
1530
1678
|
questions: t,
|
|
1531
1679
|
hiddenPartId: n,
|
|
1532
1680
|
skip: r
|
|
1533
|
-
}),
|
|
1681
|
+
}), a && /* @__PURE__ */ B("div", {
|
|
1534
1682
|
className: `flex items-start gap-1.5 ${o > 0 ? "mt-1" : ""}`,
|
|
1535
|
-
children: [/* @__PURE__ */
|
|
1683
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1536
1684
|
className: "pt-px",
|
|
1537
|
-
children: /* @__PURE__ */
|
|
1538
|
-
}), /* @__PURE__ */
|
|
1685
|
+
children: /* @__PURE__ */ z(It, { status: e.status })
|
|
1686
|
+
}), /* @__PURE__ */ B("span", {
|
|
1539
1687
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1540
|
-
children: [
|
|
1688
|
+
children: [Lt(e, i), e.status === "running" && /* @__PURE__ */ z(Ft, {})]
|
|
1541
1689
|
})]
|
|
1542
1690
|
})]
|
|
1543
1691
|
});
|
|
1544
1692
|
}
|
|
1545
|
-
let o = e.kind === "thinking" && e.detail ?
|
|
1546
|
-
return /* @__PURE__ */
|
|
1693
|
+
let o = e.kind === "thinking" && e.detail ? Mt(e.detail) : [], s = o.filter((e) => e.type === "code"), c = o.filter((e) => e.type === "text" && e.content.trim()), l = e.kind === "thinking" ? Lt(e, i) : e.label;
|
|
1694
|
+
return /* @__PURE__ */ B("li", {
|
|
1547
1695
|
className: "text-xs text-muted-foreground",
|
|
1548
1696
|
children: [
|
|
1549
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ B("div", {
|
|
1550
1698
|
className: "flex items-start gap-1.5",
|
|
1551
|
-
children: [/* @__PURE__ */
|
|
1699
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1552
1700
|
className: "pt-px",
|
|
1553
|
-
children: /* @__PURE__ */
|
|
1554
|
-
}), /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ z(It, { status: e.status })
|
|
1702
|
+
}), /* @__PURE__ */ z("span", {
|
|
1555
1703
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
1556
1704
|
children: l
|
|
1557
1705
|
})]
|
|
1558
1706
|
}),
|
|
1559
|
-
s.length > 0 && /* @__PURE__ */
|
|
1707
|
+
s.length > 0 && /* @__PURE__ */ z("div", {
|
|
1560
1708
|
className: "mt-1 ml-[18px] space-y-1",
|
|
1561
|
-
children: s.map((e, t) => /* @__PURE__ */
|
|
1709
|
+
children: s.map((e, t) => /* @__PURE__ */ z(Nt, {
|
|
1562
1710
|
content: e.content,
|
|
1563
1711
|
language: e.language
|
|
1564
1712
|
}, t))
|
|
1565
1713
|
}),
|
|
1566
|
-
c.length > 0 && /* @__PURE__ */
|
|
1714
|
+
c.length > 0 && /* @__PURE__ */ z("div", {
|
|
1567
1715
|
className: "mt-1 ml-[18px] space-y-2",
|
|
1568
|
-
children: c.map((e, t) => /* @__PURE__ */
|
|
1716
|
+
children: c.map((e, t) => /* @__PURE__ */ z(a, {
|
|
1569
1717
|
content: e.content.trim(),
|
|
1570
1718
|
tone: "muted",
|
|
1571
1719
|
className: "break-words text-xs leading-relaxed"
|
|
@@ -1574,52 +1722,52 @@ function Rt({ entry: e, questions: t, hiddenPartId: n, skip: r }) {
|
|
|
1574
1722
|
]
|
|
1575
1723
|
});
|
|
1576
1724
|
}
|
|
1577
|
-
function
|
|
1578
|
-
return /* @__PURE__ */
|
|
1725
|
+
function $t({ parts: e }) {
|
|
1726
|
+
return /* @__PURE__ */ z("div", {
|
|
1579
1727
|
className: "mb-1 space-y-1 border-l-2 border-border pl-2 text-xs text-muted-foreground",
|
|
1580
|
-
children: e.map((e) => e.type === "reasoning" ? /* @__PURE__ */
|
|
1728
|
+
children: e.map((e) => e.type === "reasoning" ? /* @__PURE__ */ z(a, {
|
|
1581
1729
|
content: e.text,
|
|
1582
1730
|
tone: "muted",
|
|
1583
1731
|
streaming: e.streaming,
|
|
1584
1732
|
className: "break-words text-xs leading-relaxed"
|
|
1585
|
-
}, e.id) : e.type === "tool" ? /* @__PURE__ */
|
|
1733
|
+
}, e.id) : e.type === "tool" ? /* @__PURE__ */ B("div", {
|
|
1586
1734
|
className: "flex items-start gap-1.5",
|
|
1587
|
-
children: [/* @__PURE__ */
|
|
1588
|
-
name:
|
|
1735
|
+
children: [/* @__PURE__ */ z(m, {
|
|
1736
|
+
name: Kt[e.status],
|
|
1589
1737
|
size: 12,
|
|
1590
1738
|
className: `mt-0.5 shrink-0 ${e.status === "running" ? "animate-spin" : ""}`
|
|
1591
|
-
}), /* @__PURE__ */
|
|
1739
|
+
}), /* @__PURE__ */ z("span", {
|
|
1592
1740
|
className: `min-w-0 break-words ${e.status === "error" ? "text-destructive" : ""}`,
|
|
1593
1741
|
children: e.label
|
|
1594
1742
|
})]
|
|
1595
1743
|
}, e.id) : null)
|
|
1596
1744
|
});
|
|
1597
1745
|
}
|
|
1598
|
-
function
|
|
1599
|
-
let i =
|
|
1600
|
-
return /* @__PURE__ */
|
|
1746
|
+
function en({ speaker: e, entries: t, questions: n, docked: r }) {
|
|
1747
|
+
let i = Ut(t[0]), a = i.length ? new Set(i.map((e) => e.id)) : void 0, [o, s] = L(!1);
|
|
1748
|
+
return /* @__PURE__ */ B("div", {
|
|
1601
1749
|
className: "flex items-start gap-2 pt-1.5",
|
|
1602
|
-
children: [/* @__PURE__ */
|
|
1603
|
-
className: `flex shrink-0 justify-center pt-px ${
|
|
1604
|
-
children: /* @__PURE__ */
|
|
1605
|
-
}), /* @__PURE__ */
|
|
1750
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1751
|
+
className: `flex shrink-0 justify-center pt-px ${Ht}`,
|
|
1752
|
+
children: /* @__PURE__ */ z(Vt, { author: e })
|
|
1753
|
+
}), /* @__PURE__ */ B("div", {
|
|
1606
1754
|
className: "min-w-0 flex-1",
|
|
1607
1755
|
children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1756
|
+
/* @__PURE__ */ B("div", {
|
|
1609
1757
|
className: "flex min-w-0 flex-wrap items-center gap-x-2 pb-0.5",
|
|
1610
|
-
children: [/* @__PURE__ */
|
|
1758
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1611
1759
|
className: "truncate text-xs font-medium text-foreground",
|
|
1612
1760
|
children: e.name
|
|
1613
|
-
}), i.length > 0 && /* @__PURE__ */
|
|
1761
|
+
}), i.length > 0 && /* @__PURE__ */ z(Wt, {
|
|
1614
1762
|
parts: i,
|
|
1615
1763
|
open: o,
|
|
1616
1764
|
onToggle: () => s((e) => !e)
|
|
1617
1765
|
})]
|
|
1618
1766
|
}),
|
|
1619
|
-
o && i.length > 0 && /* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1767
|
+
o && i.length > 0 && /* @__PURE__ */ z($t, { parts: i }),
|
|
1768
|
+
/* @__PURE__ */ z("ul", {
|
|
1621
1769
|
className: "space-y-0.5",
|
|
1622
|
-
children: t.map((e, t) => /* @__PURE__ */
|
|
1770
|
+
children: t.map((e, t) => /* @__PURE__ */ z(Qt, {
|
|
1623
1771
|
entry: e,
|
|
1624
1772
|
questions: n,
|
|
1625
1773
|
hiddenPartId: r?.entry.id === e.id ? r.part.id : void 0,
|
|
@@ -1630,89 +1778,89 @@ function Bt({ speaker: e, entries: t, questions: n, docked: r }) {
|
|
|
1630
1778
|
})]
|
|
1631
1779
|
});
|
|
1632
1780
|
}
|
|
1633
|
-
function
|
|
1781
|
+
function tn({ activity: e, questions: t, docked: n, pinUserMessages: r = !0, messageActions: i, speaker: a, showAuthors: o, events: s }) {
|
|
1634
1782
|
if (e.length === 0 && !s?.length) return null;
|
|
1635
1783
|
let c = o ?? (!!a || e.some((e) => e.kind === "user" && e.author)), l = [];
|
|
1636
1784
|
for (let t of e) t.kind === "user" || l.length === 0 ? l.push(t.kind === "user" ? {
|
|
1637
1785
|
user: t,
|
|
1638
1786
|
entries: []
|
|
1639
1787
|
} : { entries: [t] }) : l[l.length - 1].entries.push(t);
|
|
1640
|
-
let u =
|
|
1641
|
-
return /* @__PURE__ */
|
|
1788
|
+
let u = st(l.map((e) => (e.user ?? e.entries[0])?.at), s ?? []);
|
|
1789
|
+
return /* @__PURE__ */ B("ul", {
|
|
1642
1790
|
className: "space-y-0.5",
|
|
1643
|
-
children: [l.map((e, o) => /* @__PURE__ */
|
|
1791
|
+
children: [l.map((e, o) => /* @__PURE__ */ B(ne.Fragment, { children: [u[o].map((e) => /* @__PURE__ */ z(At, { event: e }, e.id)), /* @__PURE__ */ B("li", { children: [e.user && /* @__PURE__ */ z(Gt, {
|
|
1644
1792
|
entry: e.user,
|
|
1645
1793
|
pinned: r,
|
|
1646
1794
|
actions: i,
|
|
1647
|
-
cut:
|
|
1795
|
+
cut: zt(e.entries),
|
|
1648
1796
|
showAuthor: c
|
|
1649
|
-
}), a && e.entries.length > 0 ? /* @__PURE__ */
|
|
1797
|
+
}), a && e.entries.length > 0 ? /* @__PURE__ */ z(en, {
|
|
1650
1798
|
speaker: a,
|
|
1651
1799
|
entries: e.entries,
|
|
1652
1800
|
questions: t,
|
|
1653
1801
|
docked: n
|
|
1654
|
-
}) : e.entries.length > 0 && /* @__PURE__ */
|
|
1802
|
+
}) : e.entries.length > 0 && /* @__PURE__ */ z("ul", {
|
|
1655
1803
|
className: "space-y-0.5",
|
|
1656
|
-
children: e.entries.map((e) => /* @__PURE__ */
|
|
1804
|
+
children: e.entries.map((e) => /* @__PURE__ */ z(Qt, {
|
|
1657
1805
|
entry: e,
|
|
1658
1806
|
questions: t,
|
|
1659
1807
|
hiddenPartId: n?.entry.id === e.id ? n.part.id : void 0
|
|
1660
1808
|
}, e.id))
|
|
1661
|
-
})] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */
|
|
1809
|
+
})] })] }, e.user?.id ?? e.entries[0]?.id)), u[l.length].map((e) => /* @__PURE__ */ z(At, { event: e }, e.id))]
|
|
1662
1810
|
});
|
|
1663
1811
|
}
|
|
1664
1812
|
//#endregion
|
|
1665
1813
|
//#region src/presentation/panelWidth.ts
|
|
1666
|
-
var
|
|
1667
|
-
function
|
|
1814
|
+
var nn = 420, rn = 320, an = "60vw", on = "agentico:panel-width";
|
|
1815
|
+
function sn(e, t) {
|
|
1668
1816
|
if (typeof e == "number") return e;
|
|
1669
1817
|
let n = Number.parseFloat(e);
|
|
1670
1818
|
return Number.isFinite(n) ? Math.round(n / 100 * t) : Infinity;
|
|
1671
1819
|
}
|
|
1672
|
-
function
|
|
1820
|
+
function cn(e, t, n) {
|
|
1673
1821
|
return Math.round(Math.min(Math.max(e, t), Math.max(t, n)));
|
|
1674
1822
|
}
|
|
1675
|
-
function
|
|
1823
|
+
function ln() {
|
|
1676
1824
|
try {
|
|
1677
|
-
let e = window.localStorage.getItem(
|
|
1825
|
+
let e = window.localStorage.getItem(on), t = e === null ? NaN : Number(e);
|
|
1678
1826
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
1679
1827
|
} catch {
|
|
1680
1828
|
return null;
|
|
1681
1829
|
}
|
|
1682
1830
|
}
|
|
1683
|
-
function
|
|
1831
|
+
function un(e) {
|
|
1684
1832
|
try {
|
|
1685
|
-
e === null ? window.localStorage.removeItem(
|
|
1833
|
+
e === null ? window.localStorage.removeItem(on) : window.localStorage.setItem(on, String(e));
|
|
1686
1834
|
} catch {}
|
|
1687
1835
|
}
|
|
1688
|
-
function
|
|
1836
|
+
function dn() {
|
|
1689
1837
|
return typeof window > "u" ? Infinity : window.innerWidth;
|
|
1690
1838
|
}
|
|
1691
|
-
function
|
|
1692
|
-
let [i, a] =
|
|
1693
|
-
|
|
1839
|
+
function fn({ defaultWidth: e = 420, minWidth: t = 320, maxWidth: n = an, onWidthChange: r }) {
|
|
1840
|
+
let [i, a] = L(dn), [o, s] = L(() => ln() ?? e);
|
|
1841
|
+
N(() => {
|
|
1694
1842
|
if (typeof window > "u") return;
|
|
1695
1843
|
let e = () => a(window.innerWidth);
|
|
1696
1844
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1697
1845
|
}, []);
|
|
1698
|
-
let c = t, l = Math.max(c,
|
|
1699
|
-
return
|
|
1846
|
+
let c = t, l = Math.max(c, sn(n, i)), u = cn(o, c, l);
|
|
1847
|
+
return N(() => {
|
|
1700
1848
|
r?.(u);
|
|
1701
1849
|
}, [u]), {
|
|
1702
1850
|
width: u,
|
|
1703
1851
|
min: c,
|
|
1704
1852
|
max: l,
|
|
1705
|
-
set:
|
|
1706
|
-
commit:
|
|
1707
|
-
reset:
|
|
1708
|
-
s(e),
|
|
1853
|
+
set: M((e) => s(cn(e, c, l)), [c, l]),
|
|
1854
|
+
commit: M((e) => un(cn(e, c, l)), [c, l]),
|
|
1855
|
+
reset: M(() => {
|
|
1856
|
+
s(e), un(null);
|
|
1709
1857
|
}, [e])
|
|
1710
1858
|
};
|
|
1711
1859
|
}
|
|
1712
1860
|
//#endregion
|
|
1713
1861
|
//#region src/presentation/AgenticoResizeHandle.tsx
|
|
1714
|
-
function
|
|
1715
|
-
let o = $(), s =
|
|
1862
|
+
function pn({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a }) {
|
|
1863
|
+
let o = $(), s = I(null), [c, l] = L(!1), u = (e) => Math.round(Math.min(Math.max(e, t), Math.max(t, n))), d = (e) => {
|
|
1716
1864
|
let t = s.current;
|
|
1717
1865
|
if (t && t.pointerId === e.pointerId) {
|
|
1718
1866
|
s.current = null, l(!1), document.body.style.removeProperty("cursor"), document.body.style.removeProperty("user-select");
|
|
@@ -1722,7 +1870,7 @@ function Qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1722
1870
|
i(t.last);
|
|
1723
1871
|
}
|
|
1724
1872
|
};
|
|
1725
|
-
return /* @__PURE__ */
|
|
1873
|
+
return /* @__PURE__ */ z("div", {
|
|
1726
1874
|
role: "separator",
|
|
1727
1875
|
"aria-orientation": "vertical",
|
|
1728
1876
|
"aria-label": o.resizePanel,
|
|
@@ -1761,7 +1909,7 @@ function Qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1761
1909
|
let c = u(s);
|
|
1762
1910
|
r(c), i(c);
|
|
1763
1911
|
},
|
|
1764
|
-
children: /* @__PURE__ */
|
|
1912
|
+
children: /* @__PURE__ */ z("span", {
|
|
1765
1913
|
"aria-hidden": !0,
|
|
1766
1914
|
className: `h-full w-0.5 transition-colors ${c ? "bg-primary" : "bg-transparent group-hover:bg-primary/50 group-focus-visible:bg-primary"}`
|
|
1767
1915
|
})
|
|
@@ -1769,69 +1917,73 @@ function Qt({ width: e, min: t, max: n, onResize: r, onCommit: i, onReset: a })
|
|
|
1769
1917
|
}
|
|
1770
1918
|
//#endregion
|
|
1771
1919
|
//#region src/presentation/AgenticoToggle.tsx
|
|
1772
|
-
function
|
|
1773
|
-
let { isOpen:
|
|
1774
|
-
return /* @__PURE__ */
|
|
1920
|
+
function mn({ className: e = "" }) {
|
|
1921
|
+
let { isOpen: t, toggleOpen: r, task: i } = Et(), a = $(), o = i?.agent.running ?? !1;
|
|
1922
|
+
return /* @__PURE__ */ z(n, {
|
|
1775
1923
|
icon: "bot",
|
|
1776
|
-
ariaLabel:
|
|
1777
|
-
title:
|
|
1924
|
+
ariaLabel: t ? a.closePanel : a.openPanel,
|
|
1925
|
+
title: t ? a.closePanel : a.openPanel,
|
|
1778
1926
|
onClick: r,
|
|
1779
1927
|
iconClassName: o ? "animate-pulse" : void 0,
|
|
1780
|
-
className: `!h-9 !w-9 !p-0 rounded-md ${
|
|
1928
|
+
className: `!h-9 !w-9 !p-0 rounded-md ${t ? "bg-primary/10 text-primary hover:bg-primary/15" : "bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground"} ${e}`
|
|
1781
1929
|
});
|
|
1782
1930
|
}
|
|
1783
1931
|
//#endregion
|
|
1784
1932
|
//#region src/presentation/useAIModelCatalog.ts
|
|
1785
|
-
var
|
|
1786
|
-
function
|
|
1933
|
+
var hn = "llmnative-cms.selectedAIModel";
|
|
1934
|
+
function gn() {
|
|
1787
1935
|
try {
|
|
1788
|
-
return localStorage.getItem(
|
|
1936
|
+
return localStorage.getItem(hn) ?? "";
|
|
1789
1937
|
} catch {
|
|
1790
1938
|
return "";
|
|
1791
1939
|
}
|
|
1792
1940
|
}
|
|
1793
|
-
function
|
|
1941
|
+
function _n(e) {
|
|
1794
1942
|
try {
|
|
1795
|
-
e ? localStorage.setItem(
|
|
1943
|
+
e ? localStorage.setItem(hn, e) : localStorage.removeItem(hn);
|
|
1796
1944
|
} catch {}
|
|
1797
1945
|
}
|
|
1798
|
-
function
|
|
1799
|
-
let
|
|
1800
|
-
return
|
|
1801
|
-
if (!
|
|
1802
|
-
|
|
1946
|
+
function vn({ unfiltered: e = !1 } = {}) {
|
|
1947
|
+
let t = ee()?.registry ?? {}, { settings: n } = St(), r = e ? void 0 : n.providers, i = r ? Object.fromEntries(Object.entries(t).filter(([e]) => r.includes(e))) : t, a = Object.keys(i).length > 0, [o, s] = L({}), [c, l] = L(!1), [u, d] = L(gn);
|
|
1948
|
+
return N(() => {
|
|
1949
|
+
if (!a) {
|
|
1950
|
+
s({});
|
|
1803
1951
|
return;
|
|
1804
1952
|
}
|
|
1805
|
-
let
|
|
1806
|
-
return
|
|
1807
|
-
if (
|
|
1808
|
-
|
|
1809
|
-
let
|
|
1810
|
-
|
|
1811
|
-
}).catch((
|
|
1812
|
-
console.error("useAIModelCatalog: getAIModelCatalog failed",
|
|
1953
|
+
let e = !1;
|
|
1954
|
+
return l(!0), T(i).then((t) => {
|
|
1955
|
+
if (e) return;
|
|
1956
|
+
s(t.modelsByProvider);
|
|
1957
|
+
let r = Object.values(t.modelsByProvider).flat();
|
|
1958
|
+
d((e) => r.some((t) => t.id === e) ? e : (e && _n(""), n.defaultModel && r.some((e) => e.id === n.defaultModel) ? n.defaultModel : ""));
|
|
1959
|
+
}).catch((t) => {
|
|
1960
|
+
console.error("useAIModelCatalog: getAIModelCatalog failed", t), e || s({});
|
|
1813
1961
|
}).finally(() => {
|
|
1814
|
-
|
|
1962
|
+
e || l(!1);
|
|
1815
1963
|
}), () => {
|
|
1816
|
-
|
|
1964
|
+
e = !0;
|
|
1817
1965
|
};
|
|
1818
|
-
}, [
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1966
|
+
}, [
|
|
1967
|
+
a,
|
|
1968
|
+
JSON.stringify(Object.keys(i).sort()),
|
|
1969
|
+
n.defaultModel
|
|
1970
|
+
]), {
|
|
1971
|
+
hasProviders: a,
|
|
1972
|
+
modelsByProvider: o,
|
|
1973
|
+
modelsLoading: c,
|
|
1974
|
+
selectedModel: u,
|
|
1823
1975
|
setSelectedModel: (e) => {
|
|
1824
|
-
|
|
1976
|
+
_n(e), d(e);
|
|
1825
1977
|
}
|
|
1826
1978
|
};
|
|
1827
1979
|
}
|
|
1828
1980
|
//#endregion
|
|
1829
1981
|
//#region src/domain/approval.ts
|
|
1830
|
-
var
|
|
1831
|
-
function
|
|
1982
|
+
var yn = "approval";
|
|
1983
|
+
function bn(e, t) {
|
|
1832
1984
|
return typeof e.needsApproval == "function" ? e.needsApproval(t) : e.needsApproval === !0;
|
|
1833
1985
|
}
|
|
1834
|
-
function
|
|
1986
|
+
function xn(e, t, n) {
|
|
1835
1987
|
let r = e[0]?.values ?? [], i = r.filter((e) => e !== t && e !== n).join(" ").trim();
|
|
1836
1988
|
return {
|
|
1837
1989
|
approved: r.includes(t) && !r.includes(n),
|
|
@@ -1840,11 +1992,11 @@ function sn(e, t, n) {
|
|
|
1840
1992
|
}
|
|
1841
1993
|
//#endregion
|
|
1842
1994
|
//#region src/presentation/useAgent.ts
|
|
1843
|
-
var
|
|
1844
|
-
function
|
|
1845
|
-
return e.filter((e) => !
|
|
1995
|
+
var Sn = 20, Cn = 26e4;
|
|
1996
|
+
function wn(e) {
|
|
1997
|
+
return e.filter((e) => !x.isTextAttachment(e.mimeType) || e.base64.length <= Cn);
|
|
1846
1998
|
}
|
|
1847
|
-
function
|
|
1999
|
+
function Tn(e) {
|
|
1848
2000
|
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 : {
|
|
1849
2001
|
...e,
|
|
1850
2002
|
status: e.status === "running" ? "stopped" : e.status,
|
|
@@ -1857,10 +2009,10 @@ function dn(e) {
|
|
|
1857
2009
|
} : e) } : {}
|
|
1858
2010
|
});
|
|
1859
2011
|
}
|
|
1860
|
-
function
|
|
1861
|
-
let { defaultEnabled: n = !1 } = t, r =
|
|
2012
|
+
function En(e, t = {}) {
|
|
2013
|
+
let { defaultEnabled: n = !1 } = t, r = I(t.author);
|
|
1862
2014
|
r.current = t.author;
|
|
1863
|
-
let [i, a] =
|
|
2015
|
+
let [i, a] = L(n), { hasProviders: o, modelsByProvider: s, modelsLoading: c, selectedModel: l, setSelectedModel: u } = vn(), [d, f] = L(!1), [p, m] = L(null), [h, g] = L(!1), [_, v] = L([]), y = I([]), b = (e, t) => {
|
|
1864
2016
|
v((n) => {
|
|
1865
2017
|
let r = typeof e == "function" ? e(n) : e;
|
|
1866
2018
|
if (t?.stamp !== !1) {
|
|
@@ -1873,43 +2025,45 @@ function fn(e, t = {}) {
|
|
|
1873
2025
|
} : n);
|
|
1874
2026
|
}
|
|
1875
2027
|
}
|
|
1876
|
-
return
|
|
2028
|
+
return y.current = r, r;
|
|
1877
2029
|
});
|
|
1878
2030
|
}, S = (e, t) => {
|
|
1879
|
-
t?.some((e) => e.type.startsWith("image/")) &&
|
|
1880
|
-
t.length &&
|
|
2031
|
+
t?.some((e) => e.type.startsWith("image/")) && dt(t).then((t) => {
|
|
2032
|
+
t.length && b((n) => n.map((n) => n.id === e ? {
|
|
1881
2033
|
...n,
|
|
1882
2034
|
attachmentPreviews: t
|
|
1883
2035
|
} : n));
|
|
1884
2036
|
});
|
|
1885
|
-
},
|
|
1886
|
-
|
|
1887
|
-
let
|
|
2037
|
+
}, C = I(/* @__PURE__ */ new Map()), w = $(), T = I(w);
|
|
2038
|
+
T.current = w;
|
|
2039
|
+
let E = I(null), O = I(!1), k = I(null), te = I(null), A = I(null), ne = () => {
|
|
1888
2040
|
A.current?.abort();
|
|
1889
|
-
},
|
|
2041
|
+
}, j = ee()?.registry ?? {}, [M, re] = L(void 0), N = I(void 0), { settings: P } = St(), R = I(P);
|
|
2042
|
+
R.current = P;
|
|
2043
|
+
let z = (e, t) => {
|
|
1890
2044
|
if (!t) return !1;
|
|
1891
2045
|
if (!e) return !0;
|
|
1892
|
-
let n =
|
|
2046
|
+
let n = D(t);
|
|
1893
2047
|
return !!n && e.includes(n.provider);
|
|
1894
|
-
},
|
|
1895
|
-
Y.current = e,
|
|
1896
|
-
},
|
|
1897
|
-
let t =
|
|
1898
|
-
|
|
1899
|
-
let n =
|
|
1900
|
-
|
|
1901
|
-
let r =
|
|
1902
|
-
|
|
1903
|
-
},
|
|
1904
|
-
let a =
|
|
1905
|
-
if (!a || !
|
|
2048
|
+
}, B = F(() => M ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, t.filter((e) => M.includes(e.provider))]).filter(([, e]) => e.length)) : s, [M, s]), ie = z(M, l) ? l : Object.values(B).flat()[0]?.id ?? "", W = i && ie ? D(ie) : null, oe = W ? j[W.provider] : null, G = e.executor, K = !!G?.alongside, q = !!G && !K, se = !G || !!G.canRewind, ce = !!G?.attachments, le = async (e) => ce && e?.length ? Promise.all(e.map((e) => x.fileToAttachment(e))) : void 0, de = I([]), fe = (e) => !!e && de.current.some((t) => t.value === e), pe = I(!1), [me, he] = L([]), [ge, _e] = L(""), Y = I(""), X = (e) => {
|
|
2049
|
+
Y.current = e, _e(e);
|
|
2050
|
+
}, ve = (e) => {
|
|
2051
|
+
let t = G?.models?.(e) ?? [];
|
|
2052
|
+
de.current = t, he(t);
|
|
2053
|
+
let n = G?.catalogProviders?.(e);
|
|
2054
|
+
N.current = n, re(n);
|
|
2055
|
+
let r = K && !z(n, l) ? t[0]?.value : void 0;
|
|
2056
|
+
X(G?.defaultModel?.(e) ?? r ?? "");
|
|
2057
|
+
}, ye = async (e, t, n, r, i) => {
|
|
2058
|
+
let a = E.current;
|
|
2059
|
+
if (!a || !G) return m(T.current.noActiveSession), null;
|
|
1906
2060
|
let o = new AbortController();
|
|
1907
2061
|
A.current = o;
|
|
1908
2062
|
let s = crypto.randomUUID();
|
|
1909
|
-
|
|
2063
|
+
b((e) => [...e, {
|
|
1910
2064
|
id: s,
|
|
1911
2065
|
kind: "thinking",
|
|
1912
|
-
label:
|
|
2066
|
+
label: T.current.thinking,
|
|
1913
2067
|
status: "running",
|
|
1914
2068
|
parts: []
|
|
1915
2069
|
}]);
|
|
@@ -1917,16 +2071,16 @@ function fn(e, t = {}) {
|
|
|
1917
2071
|
...e,
|
|
1918
2072
|
streaming: !1,
|
|
1919
2073
|
duration: e.duration ?? l(e.id)
|
|
1920
|
-
}), d = (e, t) =>
|
|
2074
|
+
}), d = (e, t) => b((n) => n.map((n) => {
|
|
1921
2075
|
if (n.id !== s) return n;
|
|
1922
|
-
let r = e(n.parts ?? []), i =
|
|
2076
|
+
let r = e(n.parts ?? []), i = U(r);
|
|
1923
2077
|
return {
|
|
1924
2078
|
...n,
|
|
1925
2079
|
parts: r,
|
|
1926
2080
|
...t ? { status: t } : {},
|
|
1927
2081
|
...i ? { detail: i } : {}
|
|
1928
2082
|
};
|
|
1929
|
-
})), f = (e) => d((t) =>
|
|
2083
|
+
})), f = (e) => d((t) => H(t, e, u)), p = !1, h = (e, t) => {
|
|
1930
2084
|
t?.id && t.id !== "text" && (p = !0), f({
|
|
1931
2085
|
type: "text",
|
|
1932
2086
|
id: t?.id ?? "text",
|
|
@@ -1950,15 +2104,15 @@ function fn(e, t = {}) {
|
|
|
1950
2104
|
}), v = (e) => f({
|
|
1951
2105
|
...e,
|
|
1952
2106
|
type: "card"
|
|
1953
|
-
}),
|
|
1954
|
-
for (let e of
|
|
1955
|
-
let t =
|
|
1956
|
-
|
|
2107
|
+
}), x = /* @__PURE__ */ new Set(), S = 0, w = () => {
|
|
2108
|
+
for (let e of x) {
|
|
2109
|
+
let t = C.current.get(e);
|
|
2110
|
+
C.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
|
|
1957
2111
|
}
|
|
1958
|
-
|
|
2112
|
+
x.clear();
|
|
1959
2113
|
};
|
|
1960
|
-
o.signal.addEventListener("abort",
|
|
1961
|
-
let
|
|
2114
|
+
o.signal.addEventListener("abort", w);
|
|
2115
|
+
let D = (e, t) => {
|
|
1962
2116
|
S += 1;
|
|
1963
2117
|
let n = t?.id ?? `questions-${S}`;
|
|
1964
2118
|
f({
|
|
@@ -1967,16 +2121,16 @@ function fn(e, t = {}) {
|
|
|
1967
2121
|
questions: e
|
|
1968
2122
|
});
|
|
1969
2123
|
let r = `${s}:${n}`;
|
|
1970
|
-
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (
|
|
1971
|
-
|
|
2124
|
+
return o.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (x.add(r), new Promise((e, t) => {
|
|
2125
|
+
C.current.set(r, {
|
|
1972
2126
|
resolve: e,
|
|
1973
2127
|
reject: t
|
|
1974
2128
|
});
|
|
1975
2129
|
}));
|
|
1976
|
-
},
|
|
1977
|
-
d((n) => (t && !p ?
|
|
2130
|
+
}, O = (e, t) => {
|
|
2131
|
+
d((n) => (t && !p ? H(n, {
|
|
1978
2132
|
type: "text",
|
|
1979
|
-
id:
|
|
2133
|
+
id: V,
|
|
1980
2134
|
text: t,
|
|
1981
2135
|
streaming: !1
|
|
1982
2136
|
}, u) : n).map((t) => t.type === "reasoning" && t.streaming ? u(t) : t.type === "text" && t.streaming ? {
|
|
@@ -1985,14 +2139,14 @@ function fn(e, t = {}) {
|
|
|
1985
2139
|
} : t.type === "tool" && t.status === "running" && e !== "done" ? {
|
|
1986
2140
|
...t,
|
|
1987
2141
|
status: "stopped"
|
|
1988
|
-
} : t), e), o.signal.removeEventListener("abort",
|
|
1989
|
-
for (let e of
|
|
1990
|
-
|
|
1991
|
-
},
|
|
2142
|
+
} : t), e), o.signal.removeEventListener("abort", w);
|
|
2143
|
+
for (let e of x) C.current.delete(e);
|
|
2144
|
+
x.clear();
|
|
2145
|
+
}, ee = e || r?.historyText || "";
|
|
1992
2146
|
try {
|
|
1993
|
-
let c =
|
|
1994
|
-
|
|
1995
|
-
let l =
|
|
2147
|
+
let c = k.current;
|
|
2148
|
+
k.current = null;
|
|
2149
|
+
let l = y.current, u = l.findIndex((e) => e.id === te.current), d = c ? { activity: c.fresh ? c.activity : (u >= 0 ? l.slice(0, u) : l).filter((e) => e.id !== s) } : void 0, f = await G.turn({
|
|
1996
2150
|
params: a.params,
|
|
1997
2151
|
context: a.context,
|
|
1998
2152
|
text: e,
|
|
@@ -2008,14 +2162,14 @@ function fn(e, t = {}) {
|
|
|
2008
2162
|
onText: h,
|
|
2009
2163
|
onReasoning: g,
|
|
2010
2164
|
onStep: _,
|
|
2011
|
-
onQuestions:
|
|
2165
|
+
onQuestions: D,
|
|
2012
2166
|
onCard: v
|
|
2013
2167
|
});
|
|
2014
|
-
return
|
|
2168
|
+
return O("done", f.text), a.history = [
|
|
2015
2169
|
...a.history,
|
|
2016
|
-
...
|
|
2170
|
+
...ee ? [{
|
|
2017
2171
|
role: "user",
|
|
2018
|
-
content:
|
|
2172
|
+
content: ee
|
|
2019
2173
|
}] : [],
|
|
2020
2174
|
{
|
|
2021
2175
|
role: "assistant",
|
|
@@ -2023,15 +2177,15 @@ function fn(e, t = {}) {
|
|
|
2023
2177
|
}
|
|
2024
2178
|
], f.result ?? null;
|
|
2025
2179
|
} catch (e) {
|
|
2026
|
-
return a.history = [...a.history, ...
|
|
2180
|
+
return a.history = [...a.history, ...ee ? [{
|
|
2027
2181
|
role: "user",
|
|
2028
|
-
content:
|
|
2029
|
-
}] : []], o.signal.aborted ? (
|
|
2182
|
+
content: ee
|
|
2183
|
+
}] : []], o.signal.aborted ? (O("stopped"), null) : (O("error"), m(we(e)), null);
|
|
2030
2184
|
} finally {
|
|
2031
2185
|
A.current = null;
|
|
2032
2186
|
}
|
|
2033
|
-
},
|
|
2034
|
-
let i =
|
|
2187
|
+
}, be = async (t, n, r) => {
|
|
2188
|
+
let i = y.current.find((e) => e.id === t)?.parts?.find((e) => e.type === "card" && e.id === n), a = E.current;
|
|
2035
2189
|
if (!i || !a || !e.onCardAction) return;
|
|
2036
2190
|
let o;
|
|
2037
2191
|
try {
|
|
@@ -2039,10 +2193,10 @@ function fn(e, t = {}) {
|
|
|
2039
2193
|
} catch (e) {
|
|
2040
2194
|
o = {
|
|
2041
2195
|
status: "error",
|
|
2042
|
-
text:
|
|
2196
|
+
text: we(e)
|
|
2043
2197
|
};
|
|
2044
2198
|
}
|
|
2045
|
-
o &&
|
|
2199
|
+
o && b((e) => e.map((e) => e.id === t ? {
|
|
2046
2200
|
...e,
|
|
2047
2201
|
parts: e.parts?.map((e) => e.type === "card" && e.id === n ? {
|
|
2048
2202
|
...e,
|
|
@@ -2050,48 +2204,49 @@ function fn(e, t = {}) {
|
|
|
2050
2204
|
} : e)
|
|
2051
2205
|
} : e));
|
|
2052
2206
|
}, xe = async (e, t, n) => {
|
|
2053
|
-
let r =
|
|
2054
|
-
if (!r || r.type !== "questions") throw m(
|
|
2055
|
-
let i = () =>
|
|
2207
|
+
let r = y.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
2208
|
+
if (!r || r.type !== "questions") throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
2209
|
+
let i = () => b((r) => r.map((r) => r.id === e ? {
|
|
2056
2210
|
...r,
|
|
2057
2211
|
parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
|
|
2058
2212
|
...e,
|
|
2059
2213
|
answers: n
|
|
2060
2214
|
} : e)
|
|
2061
|
-
} : r)), a = `${e}:${t}`, o =
|
|
2062
|
-
if (o) return
|
|
2063
|
-
if (O.current) throw m(
|
|
2064
|
-
if (!
|
|
2215
|
+
} : r)), a = `${e}:${t}`, o = C.current.get(a);
|
|
2216
|
+
if (o) return C.current.delete(a), i(), o.resolve(n), null;
|
|
2217
|
+
if (O.current) throw m(T.current.requestInProgress), Error(T.current.requestInProgress);
|
|
2218
|
+
if (!E.current) throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
2219
|
+
if (!q) return i(), De(ae(r.questions, n));
|
|
2065
2220
|
O.current = !0, f(!0), m(null), i();
|
|
2066
2221
|
try {
|
|
2067
|
-
return await
|
|
2222
|
+
return await ye("", !1, void 0, {
|
|
2068
2223
|
id: t,
|
|
2069
2224
|
answers: n,
|
|
2070
|
-
historyText:
|
|
2225
|
+
historyText: ae(r.questions, n)
|
|
2071
2226
|
});
|
|
2072
2227
|
} finally {
|
|
2073
2228
|
O.current = !1, f(!1);
|
|
2074
2229
|
}
|
|
2075
2230
|
}, Se = async (t, n, r) => {
|
|
2076
|
-
let i =
|
|
2077
|
-
if (!d) return m(
|
|
2078
|
-
let f = o ?
|
|
2079
|
-
if (!p || !f) return m(
|
|
2231
|
+
let i = N.current, a = Object.values(s).flat().find((e) => !i || i.includes(e.provider))?.id, o = r && z(i, r) ? r : z(i, ie) ? void 0 : a, c = o ? D(o) : W, l = (c && E.current ? G?.catalogReasoning?.(E.current.params, c.provider) : void 0) ?? R.current.reasoning, u = l ? { reasoning: l } : {}, d = E.current;
|
|
2232
|
+
if (!d) return m(T.current.noActiveSession), null;
|
|
2233
|
+
let f = o ? D(o) : W, p = f ? j[f.provider] : null;
|
|
2234
|
+
if (!p || !f) return m(T.current.noProviderAvailable), null;
|
|
2080
2235
|
n?.length && (d.attachmentsRef.current = [...d.attachmentsRef.current ?? [], ...n]);
|
|
2081
|
-
let h = (n ?? []).filter((e) =>
|
|
2236
|
+
let h = (n ?? []).filter((e) => x.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= Cn ? `\n\n[File allegato: ${e.name}]\n${x.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 = wn(n ?? []), _ = d.tools.map((e) => ({
|
|
2082
2237
|
name: e.name,
|
|
2083
2238
|
description: e.description,
|
|
2084
|
-
inputSchema:
|
|
2239
|
+
inputSchema: ue(e.inputSchema)
|
|
2085
2240
|
})), v = (e, t, n, r) => {
|
|
2086
|
-
let i =
|
|
2087
|
-
|
|
2241
|
+
let i = T.current, a = `approval-${e}`, o = t.describeApproval?.(n) ?? t.describeInvocation?.(n) ?? t.name;
|
|
2242
|
+
b((e) => [...e, {
|
|
2088
2243
|
id: a,
|
|
2089
2244
|
kind: "thinking",
|
|
2090
2245
|
label: i.approvalHeader,
|
|
2091
2246
|
status: "running",
|
|
2092
2247
|
parts: [{
|
|
2093
2248
|
type: "questions",
|
|
2094
|
-
id:
|
|
2249
|
+
id: yn,
|
|
2095
2250
|
questions: [{
|
|
2096
2251
|
header: i.approvalHeader,
|
|
2097
2252
|
question: i.approveQuestion.replace("{action}", o),
|
|
@@ -2100,25 +2255,25 @@ function fn(e, t = {}) {
|
|
|
2100
2255
|
}]
|
|
2101
2256
|
}]
|
|
2102
2257
|
}]);
|
|
2103
|
-
let s = `${a}:${
|
|
2258
|
+
let s = `${a}:${yn}`;
|
|
2104
2259
|
return new Promise((e, t) => {
|
|
2105
2260
|
let n = () => {
|
|
2106
|
-
|
|
2261
|
+
C.current.delete(s), w(a, "stopped"), t(new DOMException("The turn was stopped.", "AbortError"));
|
|
2107
2262
|
};
|
|
2108
2263
|
if (r.aborted) {
|
|
2109
2264
|
n();
|
|
2110
2265
|
return;
|
|
2111
2266
|
}
|
|
2112
|
-
r.addEventListener("abort", n, { once: !0 }),
|
|
2267
|
+
r.addEventListener("abort", n, { once: !0 }), C.current.set(s, {
|
|
2113
2268
|
resolve: (t) => {
|
|
2114
|
-
r.removeEventListener("abort", n),
|
|
2269
|
+
r.removeEventListener("abort", n), w(a, "done"), e(xn(t, i.approve, i.reject));
|
|
2115
2270
|
},
|
|
2116
2271
|
reject: t
|
|
2117
2272
|
});
|
|
2118
2273
|
});
|
|
2119
|
-
},
|
|
2274
|
+
}, y = new Map(d.tools.map((e) => [e.name, e])), S = new AbortController();
|
|
2120
2275
|
A.current = S;
|
|
2121
|
-
let
|
|
2276
|
+
let w = (e, t, n, r) => b((i) => i.map((i) => i.id === e ? {
|
|
2122
2277
|
...i,
|
|
2123
2278
|
status: t,
|
|
2124
2279
|
...n === void 0 ? {} : { detail: n },
|
|
@@ -2126,12 +2281,12 @@ function fn(e, t = {}) {
|
|
|
2126
2281
|
} : i));
|
|
2127
2282
|
try {
|
|
2128
2283
|
let n = d.history, r = t;
|
|
2129
|
-
for (let t = 0; t <
|
|
2284
|
+
for (let t = 0; t < Sn; t++) {
|
|
2130
2285
|
let i = crypto.randomUUID();
|
|
2131
|
-
|
|
2286
|
+
b((e) => [...e, {
|
|
2132
2287
|
id: i,
|
|
2133
2288
|
kind: "thinking",
|
|
2134
|
-
label:
|
|
2289
|
+
label: T.current.thinking,
|
|
2135
2290
|
status: "running"
|
|
2136
2291
|
}]);
|
|
2137
2292
|
let a;
|
|
@@ -2150,13 +2305,13 @@ function fn(e, t = {}) {
|
|
|
2150
2305
|
return d.history = [...n, ...r ? [{
|
|
2151
2306
|
role: "user",
|
|
2152
2307
|
content: r + h
|
|
2153
|
-
}] : []], S.signal.aborted ? (
|
|
2308
|
+
}] : []], S.signal.aborted ? (w(i, "stopped"), e.fallback(d.params, d.context)) : (w(i, "error"), m(we(t)), null);
|
|
2154
2309
|
}
|
|
2155
2310
|
if (d.history = [...n, ...r ? [{
|
|
2156
2311
|
role: "user",
|
|
2157
2312
|
content: r + h
|
|
2158
|
-
}] : []], !a) return S.signal.aborted ? (
|
|
2159
|
-
if (a.type === "text") return
|
|
2313
|
+
}] : []], !a) return S.signal.aborted ? (w(i, "stopped"), e.fallback(d.params, d.context)) : (w(i, "error"), m(T.current.noProviderResponse), null);
|
|
2314
|
+
if (a.type === "text") return w(i, "done", a.text), e.conversational && a.text.trim() && b((e) => e.map((e) => e.id === i ? {
|
|
2160
2315
|
...e,
|
|
2161
2316
|
parts: [{
|
|
2162
2317
|
type: "text",
|
|
@@ -2177,25 +2332,25 @@ function fn(e, t = {}) {
|
|
|
2177
2332
|
responseLength: a.text.length,
|
|
2178
2333
|
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,
|
|
2179
2334
|
params: d.params
|
|
2180
|
-
}), m(
|
|
2335
|
+
}), m(T.current.invalidResponse), e.fallback(d.params, d.context));
|
|
2181
2336
|
let o = a.toolCalls.map((e) => {
|
|
2182
|
-
let t =
|
|
2337
|
+
let t = y.get(e.name);
|
|
2183
2338
|
return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
2184
2339
|
});
|
|
2185
|
-
|
|
2340
|
+
w(i, "done", a.text || void 0, a.text ? void 0 : o);
|
|
2186
2341
|
let s = /* @__PURE__ */ new Map();
|
|
2187
2342
|
for (let t of a.toolCalls) {
|
|
2188
|
-
let n =
|
|
2189
|
-
if (n &&
|
|
2343
|
+
let n = y.get(t.name);
|
|
2344
|
+
if (n && bn(n, t.input)) try {
|
|
2190
2345
|
s.set(t.id, await v(t.id, n, t.input, S.signal));
|
|
2191
2346
|
} catch {
|
|
2192
2347
|
return e.fallback(d.params, d.context);
|
|
2193
2348
|
}
|
|
2194
2349
|
}
|
|
2195
2350
|
let c = await Promise.all(a.toolCalls.map(async (e) => {
|
|
2196
|
-
let t =
|
|
2351
|
+
let t = y.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`, r = s.get(e.id);
|
|
2197
2352
|
if (r && !r.approved) {
|
|
2198
|
-
|
|
2353
|
+
b((t) => [...t, {
|
|
2199
2354
|
id: e.id,
|
|
2200
2355
|
kind: "tool",
|
|
2201
2356
|
label: n,
|
|
@@ -2209,12 +2364,12 @@ function fn(e, t = {}) {
|
|
|
2209
2364
|
isError: !0
|
|
2210
2365
|
};
|
|
2211
2366
|
}
|
|
2212
|
-
if (
|
|
2367
|
+
if (b((t) => [...t, {
|
|
2213
2368
|
id: e.id,
|
|
2214
2369
|
kind: "tool",
|
|
2215
2370
|
label: n,
|
|
2216
2371
|
status: "running"
|
|
2217
|
-
}]), !t) return
|
|
2372
|
+
}]), !t) return w(e.id, "error"), {
|
|
2218
2373
|
toolCallId: e.id,
|
|
2219
2374
|
name: e.name,
|
|
2220
2375
|
output: `Tool sconosciuto: ${e.name}`,
|
|
@@ -2222,9 +2377,9 @@ function fn(e, t = {}) {
|
|
|
2222
2377
|
};
|
|
2223
2378
|
try {
|
|
2224
2379
|
let n = await t.execute(e.input);
|
|
2225
|
-
|
|
2380
|
+
w(e.id, "done");
|
|
2226
2381
|
let r = t.card?.(e.input, n);
|
|
2227
|
-
return r &&
|
|
2382
|
+
return r && b((t) => [...t, {
|
|
2228
2383
|
id: `card-${e.id}`,
|
|
2229
2384
|
kind: "thinking",
|
|
2230
2385
|
label: "",
|
|
@@ -2239,10 +2394,10 @@ function fn(e, t = {}) {
|
|
|
2239
2394
|
output: n
|
|
2240
2395
|
};
|
|
2241
2396
|
} catch (t) {
|
|
2242
|
-
return
|
|
2397
|
+
return w(e.id, "error"), {
|
|
2243
2398
|
toolCallId: e.id,
|
|
2244
2399
|
name: e.name,
|
|
2245
|
-
output:
|
|
2400
|
+
output: we(t),
|
|
2246
2401
|
isError: !0
|
|
2247
2402
|
};
|
|
2248
2403
|
}
|
|
@@ -2265,17 +2420,17 @@ function fn(e, t = {}) {
|
|
|
2265
2420
|
], r = "";
|
|
2266
2421
|
}
|
|
2267
2422
|
let i = crypto.randomUUID();
|
|
2268
|
-
|
|
2423
|
+
b((e) => [...e, {
|
|
2269
2424
|
id: i,
|
|
2270
2425
|
kind: "thinking",
|
|
2271
|
-
label:
|
|
2426
|
+
label: T.current.thinking,
|
|
2272
2427
|
status: "running"
|
|
2273
2428
|
}]);
|
|
2274
2429
|
let a;
|
|
2275
2430
|
try {
|
|
2276
2431
|
a = await p.complete({
|
|
2277
2432
|
...u,
|
|
2278
|
-
prompt:
|
|
2433
|
+
prompt: Ce(J().stopCallingTools, e.microPromptIds),
|
|
2279
2434
|
model: f.model,
|
|
2280
2435
|
history: n,
|
|
2281
2436
|
signal: S.signal,
|
|
@@ -2285,22 +2440,22 @@ function fn(e, t = {}) {
|
|
|
2285
2440
|
a = null;
|
|
2286
2441
|
}
|
|
2287
2442
|
if (a?.type === "text") {
|
|
2288
|
-
|
|
2443
|
+
w(i, "done", a.text), d.history = [...n, {
|
|
2289
2444
|
role: "assistant",
|
|
2290
2445
|
content: a.text
|
|
2291
2446
|
}];
|
|
2292
2447
|
let t = e.parseResponse(a.text, d.params, d.context);
|
|
2293
2448
|
if (t) return t;
|
|
2294
|
-
} else
|
|
2295
|
-
return S.signal.aborted || m(
|
|
2449
|
+
} else w(i, S.signal.aborted ? "stopped" : "error"), d.history = n;
|
|
2450
|
+
return S.signal.aborted || m(T.current.tooManyToolTurns), e.fallback(d.params, d.context);
|
|
2296
2451
|
} finally {
|
|
2297
2452
|
A.current = null;
|
|
2298
2453
|
}
|
|
2299
|
-
},
|
|
2300
|
-
if (O.current) return m(
|
|
2454
|
+
}, Te = async (t, n) => {
|
|
2455
|
+
if (O.current) return m(T.current.requestInProgress), null;
|
|
2301
2456
|
O.current = !0, m(null);
|
|
2302
2457
|
let a = crypto.randomUUID();
|
|
2303
|
-
n?.openingMessage && S(a, n.attachments),
|
|
2458
|
+
n?.openingMessage && S(a, n.attachments), b(n?.openingMessage ? [{
|
|
2304
2459
|
id: a,
|
|
2305
2460
|
kind: "user",
|
|
2306
2461
|
label: "Tu",
|
|
@@ -2311,67 +2466,67 @@ function fn(e, t = {}) {
|
|
|
2311
2466
|
}] : []), f(!0);
|
|
2312
2467
|
try {
|
|
2313
2468
|
let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
|
|
2314
|
-
if (
|
|
2469
|
+
if (E.current = {
|
|
2315
2470
|
params: t,
|
|
2316
2471
|
context: r,
|
|
2317
2472
|
tools: o,
|
|
2318
2473
|
history: [],
|
|
2319
2474
|
logId: crypto.randomUUID(),
|
|
2320
2475
|
attachmentsRef: a
|
|
2321
|
-
},
|
|
2322
|
-
if (
|
|
2323
|
-
|
|
2476
|
+
}, q) return g(!0), ve(t), await ye(n?.openingMessage ?? "", !0, void 0, void 0, await le(n?.attachments));
|
|
2477
|
+
if (K) {
|
|
2478
|
+
ve(t), pe.current = !1;
|
|
2324
2479
|
let e = n?.model || Y.current;
|
|
2325
|
-
if (
|
|
2480
|
+
if (fe(e)) return g(!0), pe.current = !0, await ye(n?.openingMessage ?? "", !0, e, void 0, await le(n?.attachments));
|
|
2326
2481
|
}
|
|
2327
|
-
let s = n?.model || void 0, c = s ? !!
|
|
2482
|
+
let s = n?.model || void 0, c = s ? !!j[D(s)?.provider ?? ""] : !!oe;
|
|
2328
2483
|
if (!i || !c) {
|
|
2329
2484
|
g(!1);
|
|
2330
2485
|
let n = e.fallback(t, r);
|
|
2331
|
-
return
|
|
2486
|
+
return b((t) => [...t, {
|
|
2332
2487
|
id: crypto.randomUUID(),
|
|
2333
2488
|
kind: "tool",
|
|
2334
2489
|
status: "done",
|
|
2335
|
-
label: e.describeFallback?.(n) ??
|
|
2490
|
+
label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
|
|
2336
2491
|
}]), n;
|
|
2337
2492
|
}
|
|
2338
2493
|
g(!0);
|
|
2339
|
-
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
2494
|
+
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => x.fileToAttachment(e))) : void 0, u = Ce(e.buildPrompt(t, r), e.microPromptIds);
|
|
2340
2495
|
return await Se(u, l, s);
|
|
2341
2496
|
} catch (e) {
|
|
2342
|
-
return m(
|
|
2497
|
+
return m(we(e)), null;
|
|
2343
2498
|
} finally {
|
|
2344
2499
|
O.current = !1, f(!1);
|
|
2345
2500
|
}
|
|
2346
|
-
},
|
|
2501
|
+
}, Ee = async (t, n) => {
|
|
2347
2502
|
if (O.current) {
|
|
2348
|
-
m(
|
|
2503
|
+
m(T.current.requestInProgress);
|
|
2349
2504
|
return;
|
|
2350
2505
|
}
|
|
2351
|
-
O.current = !0, m(null),
|
|
2506
|
+
O.current = !0, m(null), b(Tn(n.activity), { stamp: !1 }), f(!0);
|
|
2352
2507
|
try {
|
|
2353
2508
|
let r = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, r, a) ?? [];
|
|
2354
|
-
|
|
2509
|
+
E.current = {
|
|
2355
2510
|
params: t,
|
|
2356
2511
|
context: r,
|
|
2357
2512
|
tools: o,
|
|
2358
2513
|
history: n.history,
|
|
2359
2514
|
logId: crypto.randomUUID(),
|
|
2360
2515
|
attachmentsRef: a
|
|
2361
|
-
}, (
|
|
2516
|
+
}, (q || K) && ve(t), pe.current = !1, g(q || K || i && !!oe);
|
|
2362
2517
|
} catch (e) {
|
|
2363
|
-
m(
|
|
2518
|
+
m(we(e));
|
|
2364
2519
|
} finally {
|
|
2365
2520
|
O.current = !1, f(!1);
|
|
2366
2521
|
}
|
|
2367
|
-
},
|
|
2368
|
-
if (O.current) return m(
|
|
2522
|
+
}, De = async (t, n) => {
|
|
2523
|
+
if (O.current) return m(T.current.requestInProgress), null;
|
|
2369
2524
|
if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
|
|
2370
|
-
let i =
|
|
2371
|
-
if (!i) return m(
|
|
2525
|
+
let i = E.current;
|
|
2526
|
+
if (!i) return m(T.current.noActiveSession), null;
|
|
2372
2527
|
O.current = !0, f(!0);
|
|
2373
2528
|
let a = crypto.randomUUID();
|
|
2374
|
-
|
|
2529
|
+
te.current = a, S(a, n?.attachments), b((e) => [...e, {
|
|
2375
2530
|
id: a,
|
|
2376
2531
|
kind: "user",
|
|
2377
2532
|
label: "Tu",
|
|
@@ -2383,26 +2538,26 @@ function fn(e, t = {}) {
|
|
|
2383
2538
|
historyAt: i.history.length
|
|
2384
2539
|
}]);
|
|
2385
2540
|
try {
|
|
2386
|
-
if (
|
|
2387
|
-
let r = n?.model || (
|
|
2388
|
-
if (
|
|
2389
|
-
let e = !
|
|
2390
|
-
return
|
|
2541
|
+
if (q) return await ye(t, !1, n?.model || void 0, void 0, await le(n?.attachments));
|
|
2542
|
+
let r = n?.model || (K ? Y.current : "");
|
|
2543
|
+
if (K && fe(r)) {
|
|
2544
|
+
let e = !pe.current;
|
|
2545
|
+
return pe.current = !0, await ye(t, e, r, void 0, await le(n?.attachments));
|
|
2391
2546
|
}
|
|
2392
|
-
|
|
2393
|
-
...
|
|
2547
|
+
k.current &&= {
|
|
2548
|
+
...k.current,
|
|
2394
2549
|
fresh: !1
|
|
2395
2550
|
};
|
|
2396
|
-
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) =>
|
|
2551
|
+
let a = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => x.fileToAttachment(e))) : void 0, o = Ce(e.buildFollowUpPrompt(t, i.params, i.context), e.microPromptIds);
|
|
2397
2552
|
return await Se(o, a, n?.model || void 0);
|
|
2398
2553
|
} catch (e) {
|
|
2399
|
-
return m(
|
|
2554
|
+
return m(we(e)), null;
|
|
2400
2555
|
} finally {
|
|
2401
2556
|
O.current = !1, f(!1);
|
|
2402
2557
|
}
|
|
2403
|
-
},
|
|
2404
|
-
let t =
|
|
2405
|
-
if (!
|
|
2558
|
+
}, Oe = (e) => {
|
|
2559
|
+
let t = E.current, n = _.findIndex((t) => t.id === e), r = _[n], i = r?.detail?.trim();
|
|
2560
|
+
if (!se || !t || !r || r.kind !== "user" || !i) return;
|
|
2406
2561
|
if (r.historyAt !== void 0) return r.historyAt;
|
|
2407
2562
|
let a = _.slice(0, n).filter((e) => e.kind === "user" && e.detail?.trim() === i).length, o = 0;
|
|
2408
2563
|
for (let e = 0; e < t.history.length; e += 1) {
|
|
@@ -2413,84 +2568,84 @@ function fn(e, t = {}) {
|
|
|
2413
2568
|
}
|
|
2414
2569
|
}
|
|
2415
2570
|
return n === _.map((e) => e.kind === "user").lastIndexOf(!0) ? t.history.length : void 0;
|
|
2416
|
-
},
|
|
2417
|
-
if (O.current) return m(
|
|
2418
|
-
let n =
|
|
2571
|
+
}, ke = (e) => Oe(e) !== void 0, Ae = async (e, t) => {
|
|
2572
|
+
if (O.current) return m(T.current.requestInProgress), null;
|
|
2573
|
+
let n = E.current, r = _.findIndex((t) => t.id === e), i = _[r], a = Oe(e);
|
|
2419
2574
|
if (!n || !i || a === void 0) return null;
|
|
2420
2575
|
let o = (t ?? i.detail ?? "").trim();
|
|
2421
2576
|
if (!o) return null;
|
|
2422
2577
|
let s = _.slice(0, r);
|
|
2423
|
-
return n.history = n.history.slice(0, a),
|
|
2578
|
+
return n.history = n.history.slice(0, a), k.current = {
|
|
2424
2579
|
activity: s,
|
|
2425
2580
|
fresh: !0
|
|
2426
|
-
},
|
|
2427
|
-
},
|
|
2428
|
-
let t =
|
|
2581
|
+
}, b(s), De(o);
|
|
2582
|
+
}, je = () => {
|
|
2583
|
+
let t = E.current;
|
|
2429
2584
|
if (!t) return null;
|
|
2430
2585
|
m(null);
|
|
2431
2586
|
let n = e.fallback(t.params, t.context);
|
|
2432
|
-
return
|
|
2587
|
+
return b((t) => [...t, {
|
|
2433
2588
|
id: crypto.randomUUID(),
|
|
2434
2589
|
kind: "tool",
|
|
2435
2590
|
status: "done",
|
|
2436
|
-
label: e.describeFallback?.(n) ??
|
|
2591
|
+
label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
|
|
2437
2592
|
}]), n;
|
|
2438
|
-
},
|
|
2439
|
-
history:
|
|
2593
|
+
}, Me = () => E.current ? {
|
|
2594
|
+
history: E.current.history,
|
|
2440
2595
|
activity: _
|
|
2441
2596
|
} : null;
|
|
2442
2597
|
return {
|
|
2443
2598
|
enabled: i,
|
|
2444
2599
|
setEnabled: a,
|
|
2445
2600
|
hasProviders: o,
|
|
2446
|
-
selectedModel:
|
|
2447
|
-
setSelectedModel:
|
|
2448
|
-
|
|
2601
|
+
selectedModel: q || K && ge ? ge : ie,
|
|
2602
|
+
setSelectedModel: q ? X : K ? (e) => {
|
|
2603
|
+
fe(e) ? X(e) : (X(""), u(e));
|
|
2449
2604
|
} : u,
|
|
2450
|
-
modelsByProvider:
|
|
2605
|
+
modelsByProvider: B,
|
|
2451
2606
|
modelsLoading: c,
|
|
2452
2607
|
running: d,
|
|
2453
2608
|
error: p,
|
|
2454
2609
|
canContinue: h,
|
|
2455
|
-
remote:
|
|
2456
|
-
remoteModels:
|
|
2457
|
-
alongside:
|
|
2458
|
-
...
|
|
2610
|
+
remote: q,
|
|
2611
|
+
remoteModels: me,
|
|
2612
|
+
alongside: K,
|
|
2613
|
+
...G?.catalogGroup ? { catalogGroup: G.catalogGroup } : {},
|
|
2459
2614
|
activity: _,
|
|
2460
|
-
run:
|
|
2461
|
-
resume:
|
|
2462
|
-
sendMessage:
|
|
2463
|
-
stop:
|
|
2464
|
-
runFallback:
|
|
2465
|
-
snapshot:
|
|
2615
|
+
run: Te,
|
|
2616
|
+
resume: Ee,
|
|
2617
|
+
sendMessage: De,
|
|
2618
|
+
stop: ne,
|
|
2619
|
+
runFallback: je,
|
|
2620
|
+
snapshot: Me,
|
|
2466
2621
|
answerQuestions: xe,
|
|
2467
|
-
cardAction:
|
|
2468
|
-
rewind:
|
|
2469
|
-
canRewind:
|
|
2470
|
-
rewindable:
|
|
2471
|
-
executorAttachments:
|
|
2622
|
+
cardAction: be,
|
|
2623
|
+
rewind: Ae,
|
|
2624
|
+
canRewind: se,
|
|
2625
|
+
rewindable: ke,
|
|
2626
|
+
executorAttachments: ce,
|
|
2472
2627
|
offersFallback: e.offersFallback !== !1
|
|
2473
2628
|
};
|
|
2474
2629
|
}
|
|
2475
2630
|
//#endregion
|
|
2476
2631
|
//#region src/domain/orchestrator/prompt.ts
|
|
2477
|
-
function
|
|
2632
|
+
function Dn() {
|
|
2478
2633
|
let e = J();
|
|
2479
2634
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
2480
2635
|
}
|
|
2481
|
-
function
|
|
2636
|
+
function On(e, t, n) {
|
|
2482
2637
|
let r = J(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
2483
2638
|
return `${r.orchestratorIntro}
|
|
2484
2639
|
|
|
2485
2640
|
${r.toolsHeading}
|
|
2486
2641
|
${t}
|
|
2487
2642
|
${i}
|
|
2488
|
-
${
|
|
2643
|
+
${Dn()}
|
|
2489
2644
|
|
|
2490
2645
|
${r.userRequestHeading}
|
|
2491
2646
|
${e}`;
|
|
2492
2647
|
}
|
|
2493
|
-
function
|
|
2648
|
+
function kn(e, t) {
|
|
2494
2649
|
return t ? {
|
|
2495
2650
|
kind: "handoff",
|
|
2496
2651
|
...t
|
|
@@ -2501,27 +2656,27 @@ function hn(e, t) {
|
|
|
2501
2656
|
}
|
|
2502
2657
|
//#endregion
|
|
2503
2658
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
2504
|
-
function
|
|
2505
|
-
return
|
|
2659
|
+
function An(e) {
|
|
2660
|
+
return K().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
2506
2661
|
}
|
|
2507
|
-
function
|
|
2662
|
+
function jn(e) {
|
|
2508
2663
|
return {
|
|
2509
2664
|
buildContext(e) {
|
|
2510
2665
|
return {
|
|
2511
|
-
cliCatalog:
|
|
2666
|
+
cliCatalog: be(An(e.scopedSubagentId)),
|
|
2512
2667
|
handoff: { current: null },
|
|
2513
2668
|
collected: {}
|
|
2514
2669
|
};
|
|
2515
2670
|
},
|
|
2516
2671
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
2517
|
-
return
|
|
2672
|
+
return On(e, n, t);
|
|
2518
2673
|
},
|
|
2519
2674
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
2520
|
-
return `${e}\n\n${
|
|
2675
|
+
return `${e}\n\n${Dn()}\n\n${J().toolsHeading}\n${n}`;
|
|
2521
2676
|
},
|
|
2522
2677
|
parseResponse(e, t, n) {
|
|
2523
2678
|
let r = n.handoff.current;
|
|
2524
|
-
return n.handoff.current = null,
|
|
2679
|
+
return n.handoff.current = null, kn(e, r);
|
|
2525
2680
|
},
|
|
2526
2681
|
fallback() {
|
|
2527
2682
|
return {
|
|
@@ -2533,16 +2688,16 @@ function _n(e) {
|
|
|
2533
2688
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
2534
2689
|
},
|
|
2535
2690
|
getTools(t, n, r) {
|
|
2536
|
-
let i =
|
|
2691
|
+
let i = le({
|
|
2537
2692
|
attachmentsRef: r,
|
|
2538
2693
|
collected: n.collected,
|
|
2539
|
-
proxyFetch:
|
|
2540
|
-
}), a = t.scopedSubagentId ?
|
|
2694
|
+
proxyFetch: O
|
|
2695
|
+
}), a = t.scopedSubagentId ? q(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = An(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
2541
2696
|
name: `${t.id}_${r.name}`,
|
|
2542
2697
|
description: `${t.label}: ${r.summary}`,
|
|
2543
2698
|
inputSchema: r.inputSchema,
|
|
2544
|
-
describeInvocation: () =>
|
|
2545
|
-
describeIntent:
|
|
2699
|
+
describeInvocation: () => E(e.preparing, { label: t.label }),
|
|
2700
|
+
describeIntent: E(e.collecting, { label: t.label }),
|
|
2546
2701
|
async execute(e) {
|
|
2547
2702
|
let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
|
|
2548
2703
|
return n.handoff.current = {
|
|
@@ -2551,7 +2706,7 @@ function _n(e) {
|
|
|
2551
2706
|
params: i
|
|
2552
2707
|
}, {
|
|
2553
2708
|
status: "queued",
|
|
2554
|
-
note:
|
|
2709
|
+
note: E(J().handoffQueued, { label: t.label })
|
|
2555
2710
|
};
|
|
2556
2711
|
}
|
|
2557
2712
|
})));
|
|
@@ -2561,22 +2716,22 @@ function _n(e) {
|
|
|
2561
2716
|
}
|
|
2562
2717
|
//#endregion
|
|
2563
2718
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
2564
|
-
function
|
|
2719
|
+
function Mn(e, t) {
|
|
2565
2720
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
2566
2721
|
}
|
|
2567
2722
|
//#endregion
|
|
2568
2723
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
2569
|
-
function
|
|
2570
|
-
let s = $(), c =
|
|
2724
|
+
function Nn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
2725
|
+
let s = $(), c = Et(), l = c.scope, u = A(), [d, f] = L(null), [p, m] = L(new Set(i ?? [])), [h, g] = L(null), _ = je(), v = /* @__PURE__ */ new Map();
|
|
2571
2726
|
e.destinationIds.forEach((e) => {
|
|
2572
2727
|
let t = _[e];
|
|
2573
2728
|
t && v.set(e, t);
|
|
2574
|
-
}), (o ?? []).forEach((e) => v.set(e.id, e)), v.set(
|
|
2729
|
+
}), (o ?? []).forEach((e) => v.set(e.id, e)), v.set(Oe.id, Oe);
|
|
2575
2730
|
let y = Array.from(v.values()), b = async (i) => {
|
|
2576
2731
|
f(i), g(null);
|
|
2577
2732
|
try {
|
|
2578
2733
|
let o = v.get(i);
|
|
2579
|
-
if (!o) throw Error(
|
|
2734
|
+
if (!o) throw Error(E(s.unknownDestination, { id: i }));
|
|
2580
2735
|
if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
|
|
2581
2736
|
let d = await o.apply(t, {
|
|
2582
2737
|
scopeId: l?.id ?? "",
|
|
@@ -2584,23 +2739,23 @@ function yn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2584
2739
|
storageProvider: l?.storageProvider ?? null,
|
|
2585
2740
|
proxyFetch: u
|
|
2586
2741
|
}, n);
|
|
2587
|
-
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n,
|
|
2742
|
+
m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Mn(e, n));
|
|
2588
2743
|
} catch (e) {
|
|
2589
2744
|
g(e instanceof Error ? e.message : String(e));
|
|
2590
2745
|
} finally {
|
|
2591
2746
|
f(null);
|
|
2592
2747
|
}
|
|
2593
2748
|
};
|
|
2594
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ B("div", {
|
|
2595
2750
|
className: "space-y-2",
|
|
2596
2751
|
children: [
|
|
2597
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ z("p", {
|
|
2598
2753
|
className: "text-xs font-medium text-muted-foreground",
|
|
2599
2754
|
children: s.destinationPickerTitle
|
|
2600
2755
|
}),
|
|
2601
|
-
/* @__PURE__ */
|
|
2756
|
+
/* @__PURE__ */ z("div", {
|
|
2602
2757
|
className: "flex flex-wrap gap-2",
|
|
2603
|
-
children: y.map((e) => /* @__PURE__ */
|
|
2758
|
+
children: y.map((e) => /* @__PURE__ */ z("button", {
|
|
2604
2759
|
type: "button",
|
|
2605
2760
|
disabled: d !== null,
|
|
2606
2761
|
onClick: () => void b(e.id),
|
|
@@ -2608,7 +2763,7 @@ function yn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2608
2763
|
children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
|
|
2609
2764
|
}, e.id))
|
|
2610
2765
|
}),
|
|
2611
|
-
h && /* @__PURE__ */
|
|
2766
|
+
h && /* @__PURE__ */ z("p", {
|
|
2612
2767
|
className: "text-xs text-destructive",
|
|
2613
2768
|
children: h
|
|
2614
2769
|
})
|
|
@@ -2617,33 +2772,33 @@ function yn({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
|
|
|
2617
2772
|
}
|
|
2618
2773
|
//#endregion
|
|
2619
2774
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
2620
|
-
var
|
|
2621
|
-
function
|
|
2622
|
-
Object.assign(
|
|
2775
|
+
var Pn = {};
|
|
2776
|
+
function Fn(e) {
|
|
2777
|
+
Object.assign(Pn, e);
|
|
2623
2778
|
}
|
|
2624
|
-
function
|
|
2625
|
-
return
|
|
2779
|
+
function In(e) {
|
|
2780
|
+
return Pn[e];
|
|
2626
2781
|
}
|
|
2627
2782
|
//#endregion
|
|
2628
2783
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
2629
|
-
function
|
|
2630
|
-
let [t, n] =
|
|
2631
|
-
return /* @__PURE__ */
|
|
2784
|
+
function Ln({ result: e }) {
|
|
2785
|
+
let [t, n] = L(!1);
|
|
2786
|
+
return /* @__PURE__ */ B("div", {
|
|
2632
2787
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
2633
2788
|
onClick: () => n((e) => !e),
|
|
2634
2789
|
title: t ? "Clic per comprimere" : "Clic per espandere",
|
|
2635
|
-
children: [/* @__PURE__ */
|
|
2790
|
+
children: [/* @__PURE__ */ z(u, {
|
|
2636
2791
|
language: "json",
|
|
2637
2792
|
showCopy: t,
|
|
2638
2793
|
background: "transparent",
|
|
2639
2794
|
className: "!text-[11px]",
|
|
2640
2795
|
children: JSON.stringify(e, null, 2)
|
|
2641
|
-
}), !t && /* @__PURE__ */
|
|
2796
|
+
}), !t && /* @__PURE__ */ z("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
2642
2797
|
});
|
|
2643
2798
|
}
|
|
2644
2799
|
//#endregion
|
|
2645
2800
|
//#region src/presentation/liveAnchorDestination.ts
|
|
2646
|
-
function
|
|
2801
|
+
function Rn(e, t, n) {
|
|
2647
2802
|
return e.length === 0 ? null : {
|
|
2648
2803
|
id: "live-component",
|
|
2649
2804
|
label: "Applica al componente aperto",
|
|
@@ -2654,106 +2809,108 @@ function wn(e, t, n) {
|
|
|
2654
2809
|
}
|
|
2655
2810
|
//#endregion
|
|
2656
2811
|
//#region src/presentation/subagentControls.ts
|
|
2657
|
-
var
|
|
2658
|
-
function
|
|
2659
|
-
Object.assign(
|
|
2812
|
+
var zn = {};
|
|
2813
|
+
function Bn(e) {
|
|
2814
|
+
Object.assign(zn, e);
|
|
2660
2815
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return
|
|
2816
|
+
function Vn(e) {
|
|
2817
|
+
return zn[e];
|
|
2663
2818
|
}
|
|
2664
2819
|
//#endregion
|
|
2665
2820
|
//#region src/presentation/chatTitles.ts
|
|
2666
|
-
function
|
|
2667
|
-
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !
|
|
2821
|
+
function Hn(e, t = 6e3) {
|
|
2822
|
+
let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !et(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
|
|
2668
2823
|
return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
|
|
2669
2824
|
}
|
|
2670
|
-
function
|
|
2825
|
+
function Un(e) {
|
|
2671
2826
|
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);
|
|
2672
2827
|
}
|
|
2673
|
-
function
|
|
2828
|
+
function Wn(e, t) {
|
|
2674
2829
|
try {
|
|
2675
2830
|
return e.definition.executor?.catalogProviders?.(e.toParams(t));
|
|
2676
2831
|
} catch {
|
|
2677
2832
|
return;
|
|
2678
2833
|
}
|
|
2679
2834
|
}
|
|
2680
|
-
function
|
|
2681
|
-
let a =
|
|
2682
|
-
let t = e ?
|
|
2835
|
+
function Gn(e, t, n, r, i) {
|
|
2836
|
+
let a = Wn(e, t), o = (e) => {
|
|
2837
|
+
let t = e ? D(e) : null;
|
|
2683
2838
|
return !(!t || !i[t.provider] || a && !a.includes(t.provider));
|
|
2684
2839
|
};
|
|
2685
2840
|
return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
|
|
2686
2841
|
}
|
|
2687
|
-
function
|
|
2688
|
-
let t =
|
|
2842
|
+
function Kn(e) {
|
|
2843
|
+
let t = ee()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = vn(), { settings: i } = St(), a = I({
|
|
2689
2844
|
registry: t,
|
|
2690
2845
|
modelsByProvider: n,
|
|
2691
|
-
selectedModel: r
|
|
2846
|
+
selectedModel: r,
|
|
2847
|
+
enabled: i.chatTitles
|
|
2692
2848
|
});
|
|
2693
|
-
|
|
2849
|
+
a.current = {
|
|
2694
2850
|
registry: t,
|
|
2695
2851
|
modelsByProvider: n,
|
|
2696
|
-
selectedModel: r
|
|
2852
|
+
selectedModel: r,
|
|
2853
|
+
enabled: i.chatTitles
|
|
2697
2854
|
};
|
|
2698
|
-
let
|
|
2699
|
-
if (!e) return !1;
|
|
2700
|
-
let
|
|
2701
|
-
if (!
|
|
2702
|
-
let { registry: l, modelsByProvider: u, selectedModel: d } =
|
|
2855
|
+
let o = I(/* @__PURE__ */ new Set()), s = M(async (t, n, r) => {
|
|
2856
|
+
if (!e || !a.current.enabled) return !1;
|
|
2857
|
+
let i = qe(e, t, n), s = q(t), c = `${e}:${t}:${n}`;
|
|
2858
|
+
if (!i || !s?.autoTitle || i.name || !$e(i) || o.current.has(c)) return !1;
|
|
2859
|
+
let { registry: l, modelsByProvider: u, selectedModel: d } = a.current, f = Gn(s, i.params, r ?? d, u, l), p = f ? D(f) : null;
|
|
2703
2860
|
if (!p) return !1;
|
|
2704
|
-
|
|
2861
|
+
o.current.add(c);
|
|
2705
2862
|
try {
|
|
2706
2863
|
let r = await l[p.provider].complete({
|
|
2707
|
-
prompt: J().chatTitle.replace("{chat}",
|
|
2864
|
+
prompt: J().chatTitle.replace("{chat}", Hn(i.activity)),
|
|
2708
2865
|
model: p.model,
|
|
2709
2866
|
history: []
|
|
2710
|
-
}),
|
|
2711
|
-
return
|
|
2867
|
+
}), a = r && r.type === "text" ? Un(r.text) : "";
|
|
2868
|
+
return a ? tt(e, t, n, a, "model") : !1;
|
|
2712
2869
|
} catch {
|
|
2713
2870
|
return !1;
|
|
2714
2871
|
} finally {
|
|
2715
|
-
|
|
2872
|
+
o.current.delete(c);
|
|
2716
2873
|
}
|
|
2717
|
-
}, [e]),
|
|
2718
|
-
return
|
|
2719
|
-
e &&
|
|
2720
|
-
for (let t of
|
|
2721
|
-
let n =
|
|
2874
|
+
}, [e]), c = Object.keys(n).length > 0;
|
|
2875
|
+
return N(() => {
|
|
2876
|
+
e && c && !qn.has(e) && (qn.add(e), (async () => {
|
|
2877
|
+
for (let t of rt(e)) {
|
|
2878
|
+
let n = q(t.subagentId);
|
|
2722
2879
|
if (n?.autoTitle) {
|
|
2723
|
-
if (n.definition.conversational &&
|
|
2724
|
-
|
|
2880
|
+
if (n.definition.conversational && !$e(t)) {
|
|
2881
|
+
nt(e, t.subagentId, t.entityId);
|
|
2725
2882
|
continue;
|
|
2726
2883
|
}
|
|
2727
|
-
t.name || await
|
|
2884
|
+
t.name || await s(t.subagentId, t.entityId);
|
|
2728
2885
|
}
|
|
2729
2886
|
}
|
|
2730
2887
|
})());
|
|
2731
2888
|
}, [
|
|
2732
2889
|
e,
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
]),
|
|
2890
|
+
c,
|
|
2891
|
+
s
|
|
2892
|
+
]), s;
|
|
2736
2893
|
}
|
|
2737
|
-
var
|
|
2738
|
-
function
|
|
2739
|
-
let c =
|
|
2894
|
+
var qn = /* @__PURE__ */ new Set(), Jn = () => ({});
|
|
2895
|
+
function Yn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
2896
|
+
let c = Et(), l = En(e.definition, {
|
|
2740
2897
|
defaultEnabled: !0,
|
|
2741
2898
|
...c.person ? { author: c.person } : {}
|
|
2742
|
-
}), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p =
|
|
2899
|
+
}), u = e.thread?.(t) || void 0, d = e.speaker?.(t), f = c.scope, p = A(), m = I(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [h, g] = L(null), _ = (t) => {
|
|
2743
2900
|
e.definition.conversational || g(t);
|
|
2744
|
-
}, [v, y] =
|
|
2745
|
-
h && h !== O.current && (O.current = h,
|
|
2746
|
-
let
|
|
2747
|
-
|
|
2748
|
-
!
|
|
2901
|
+
}, [v, y] = L([]), [b, x] = L(null), S = In(e.id), C = S?.kind === "selection" ? S : null, [w, T] = L(null), E = I(!1), D = I(0), O = I(null);
|
|
2902
|
+
h && h !== O.current && (O.current = h, D.current = (r?.length ?? 0) + l.activity.length);
|
|
2903
|
+
let ee = I(!1), k = l.remote || !l.hasProviders || l.selectedModel !== "";
|
|
2904
|
+
N(() => {
|
|
2905
|
+
!E.current && k && (E.current = !0, a ? (U.current = !0, l.resume(e.toParams(t), a)) : (o && l.setSelectedModel(o), l.run(e.toParams(t), {
|
|
2749
2906
|
model: o,
|
|
2750
2907
|
openingMessage: s
|
|
2751
2908
|
}).then((e) => {
|
|
2752
2909
|
e && _(e);
|
|
2753
2910
|
})));
|
|
2754
|
-
}, [k]),
|
|
2911
|
+
}, [k]), N(() => {
|
|
2755
2912
|
if (!h || !f) return;
|
|
2756
|
-
let n = e.autoApplyDestinationIds ?? [], r = c.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i =
|
|
2913
|
+
let n = e.autoApplyDestinationIds ?? [], r = c.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = je();
|
|
2757
2914
|
n.forEach((n) => {
|
|
2758
2915
|
let a = i[n];
|
|
2759
2916
|
a && (x(null), a.apply(h, {
|
|
@@ -2765,33 +2922,33 @@ function Fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2765
2922
|
...t,
|
|
2766
2923
|
pinnedEntityId: r
|
|
2767
2924
|
}).then((n) => {
|
|
2768
|
-
n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t,
|
|
2925
|
+
n?.id && c.commitEntityChat(e.id, n.id, m, f.id, t, Mn(e, t));
|
|
2769
2926
|
}).catch((e) => x(e instanceof Error ? e.message : String(e))));
|
|
2770
2927
|
});
|
|
2771
2928
|
}, [
|
|
2772
2929
|
h,
|
|
2773
2930
|
l.activity,
|
|
2774
2931
|
f
|
|
2775
|
-
]),
|
|
2932
|
+
]), N(() => {
|
|
2776
2933
|
h && C && T(C.defaultSelection(h));
|
|
2777
2934
|
}, [h, C]);
|
|
2778
|
-
let
|
|
2935
|
+
let te = (e, t) => {
|
|
2779
2936
|
T((n) => n && {
|
|
2780
2937
|
...n,
|
|
2781
2938
|
[e]: t
|
|
2782
2939
|
});
|
|
2783
|
-
}, ne = (e) => _(e),
|
|
2940
|
+
}, ne = (e) => _(e), j = F(() => h && C && w ? C.applySelection(h, w) : h, [
|
|
2784
2941
|
h,
|
|
2785
2942
|
C,
|
|
2786
2943
|
w
|
|
2787
|
-
]),
|
|
2788
|
-
|
|
2944
|
+
]), M = F(() => c.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [c.componentAnchors, e.id]), re = F(() => Rn(M, t, m), [
|
|
2945
|
+
M,
|
|
2789
2946
|
t,
|
|
2790
2947
|
m
|
|
2791
|
-
]),
|
|
2792
|
-
|
|
2948
|
+
]), P = F(() => re ? [re, ...n ?? []] : n, [re, n]), V = e.chatEntityId?.(t), ie = Kn(f?.id), H = I(!1), U = I(!1);
|
|
2949
|
+
N(() => {
|
|
2793
2950
|
let n = !H.current && l.running, i = H.current && !l.running;
|
|
2794
|
-
if (H.current = l.running, !n && !i || !
|
|
2951
|
+
if (H.current = l.running, !n && !i || !V || !f) return;
|
|
2795
2952
|
if (U.current) {
|
|
2796
2953
|
i && (U.current = !1);
|
|
2797
2954
|
return;
|
|
@@ -2799,79 +2956,79 @@ function Fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2799
2956
|
let a = l.snapshot();
|
|
2800
2957
|
if (!a) return;
|
|
2801
2958
|
let o = [...r ?? [], ...a.activity];
|
|
2802
|
-
e.autoTitle && e.definition.conversational &&
|
|
2959
|
+
e.autoTitle && e.definition.conversational && !$e({ activity: o }) || (Je({
|
|
2803
2960
|
scopeId: f.id,
|
|
2804
2961
|
subagentId: e.id,
|
|
2805
|
-
entityId:
|
|
2962
|
+
entityId: V,
|
|
2806
2963
|
params: t,
|
|
2807
|
-
title:
|
|
2964
|
+
title: Mn(e, t),
|
|
2808
2965
|
history: a.history,
|
|
2809
2966
|
activity: o
|
|
2810
|
-
}), i && e.autoTitle &&
|
|
2967
|
+
}), i && e.autoTitle && ie(e.id, V, l.selectedModel));
|
|
2811
2968
|
}, [l.running]);
|
|
2812
|
-
let ae = l.activity.flatMap((e) => (e.parts ?? []).flatMap((e) => e.type === "card" && e.outcome ? [`${e.id}:${e.outcome.status}`] : [])).join(","), W =
|
|
2813
|
-
|
|
2814
|
-
if (ae === W.current || (W.current = ae, !ae || !
|
|
2969
|
+
let ae = l.activity.flatMap((e) => (e.parts ?? []).flatMap((e) => e.type === "card" && e.outcome ? [`${e.id}:${e.outcome.status}`] : [])).join(","), W = I(ae);
|
|
2970
|
+
N(() => {
|
|
2971
|
+
if (ae === W.current || (W.current = ae, !ae || !V || !f || l.running || U.current)) return;
|
|
2815
2972
|
let n = l.snapshot();
|
|
2816
2973
|
if (!n) return;
|
|
2817
2974
|
let i = [...r ?? [], ...n.activity];
|
|
2818
|
-
e.autoTitle && e.definition.conversational &&
|
|
2975
|
+
e.autoTitle && e.definition.conversational && !$e({ activity: i }) || Je({
|
|
2819
2976
|
scopeId: f.id,
|
|
2820
2977
|
subagentId: e.id,
|
|
2821
|
-
entityId:
|
|
2978
|
+
entityId: V,
|
|
2822
2979
|
params: t,
|
|
2823
|
-
title:
|
|
2980
|
+
title: Mn(e, t),
|
|
2824
2981
|
history: n.history,
|
|
2825
2982
|
activity: i
|
|
2826
2983
|
});
|
|
2827
2984
|
}, [ae]);
|
|
2828
|
-
let
|
|
2829
|
-
|
|
2830
|
-
},
|
|
2985
|
+
let oe = () => {
|
|
2986
|
+
ee.current = !0, l.running && l.stop(), c.closeTask(m);
|
|
2987
|
+
}, G = I(Vn(e.id) ?? Jn).current, K = G({
|
|
2831
2988
|
params: t,
|
|
2832
2989
|
taskId: m,
|
|
2833
2990
|
running: l.running,
|
|
2834
|
-
close:
|
|
2835
|
-
}),
|
|
2991
|
+
close: oe
|
|
2992
|
+
}), q = (e) => {
|
|
2836
2993
|
y((t) => t.includes(e) ? t : [...t, e]);
|
|
2837
2994
|
};
|
|
2838
|
-
return
|
|
2839
|
-
|
|
2995
|
+
return N(() => {
|
|
2996
|
+
ee.current || c.openTask({
|
|
2840
2997
|
id: m,
|
|
2841
|
-
title:
|
|
2998
|
+
title: Mn(e, t),
|
|
2842
2999
|
icon: e.icon,
|
|
2843
3000
|
agent: l,
|
|
2844
3001
|
onApplied: (e) => _(e),
|
|
2845
3002
|
precedingActivity: r,
|
|
2846
|
-
panelExtraAnchorIndex:
|
|
2847
|
-
onDismiss:
|
|
3003
|
+
panelExtraAnchorIndex: D.current,
|
|
3004
|
+
onDismiss: oe,
|
|
2848
3005
|
...u ? { thread: u } : {},
|
|
2849
3006
|
...d ? { speaker: d } : {},
|
|
2850
|
-
...
|
|
2851
|
-
panelActions:
|
|
2852
|
-
composerActions:
|
|
2853
|
-
composerCommands:
|
|
2854
|
-
panelExtra: h ? /* @__PURE__ */
|
|
2855
|
-
C && w ? /* @__PURE__ */
|
|
3007
|
+
...V ? { savedToDisk: !0 } : {},
|
|
3008
|
+
panelActions: K.content,
|
|
3009
|
+
composerActions: K.actions,
|
|
3010
|
+
composerCommands: K.commands,
|
|
3011
|
+
panelExtra: h ? /* @__PURE__ */ B(R, { children: [
|
|
3012
|
+
C && w ? /* @__PURE__ */ z(C.Report, {
|
|
2856
3013
|
result: h,
|
|
2857
3014
|
selection: w,
|
|
2858
|
-
onChange:
|
|
2859
|
-
}) : S?.kind === "editable" ? /* @__PURE__ */
|
|
3015
|
+
onChange: te
|
|
3016
|
+
}) : S?.kind === "editable" ? /* @__PURE__ */ z(S.Report, {
|
|
2860
3017
|
result: h,
|
|
2861
3018
|
onResultChange: ne
|
|
2862
|
-
}) : /* @__PURE__ */
|
|
2863
|
-
b && /* @__PURE__ */
|
|
3019
|
+
}) : /* @__PURE__ */ z(Ln, { result: j }),
|
|
3020
|
+
b && /* @__PURE__ */ B("p", {
|
|
2864
3021
|
className: "text-xs text-destructive",
|
|
2865
3022
|
children: ["Salvataggio automatico non riuscito: ", b]
|
|
2866
3023
|
}),
|
|
2867
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ z(Nn, {
|
|
2868
3025
|
manifest: e,
|
|
2869
|
-
result:
|
|
3026
|
+
result: j,
|
|
2870
3027
|
meta: t,
|
|
2871
3028
|
taskId: m,
|
|
2872
3029
|
initiallyApplied: v,
|
|
2873
|
-
onApplied:
|
|
2874
|
-
extraDestinations:
|
|
3030
|
+
onApplied: q,
|
|
3031
|
+
extraDestinations: P
|
|
2875
3032
|
})
|
|
2876
3033
|
] }) : void 0
|
|
2877
3034
|
});
|
|
@@ -2890,34 +3047,34 @@ function Fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
|
|
|
2890
3047
|
e,
|
|
2891
3048
|
t,
|
|
2892
3049
|
h,
|
|
2893
|
-
|
|
3050
|
+
j,
|
|
2894
3051
|
w,
|
|
2895
3052
|
v,
|
|
2896
3053
|
n,
|
|
2897
3054
|
r,
|
|
2898
3055
|
b,
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
]),
|
|
3056
|
+
K.content,
|
|
3057
|
+
K.actions,
|
|
3058
|
+
K.commands
|
|
3059
|
+
]), N(() => () => {
|
|
2903
3060
|
c.closeTask(m);
|
|
2904
3061
|
}, [c.closeTask, m]), null;
|
|
2905
3062
|
}
|
|
2906
3063
|
//#endregion
|
|
2907
3064
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
2908
|
-
function
|
|
2909
|
-
let t = $(), n =
|
|
3065
|
+
function Xn({ userGoal: e }) {
|
|
3066
|
+
let t = $(), n = F(() => jn({
|
|
2910
3067
|
unavailable: t.orchestratorUnavailable,
|
|
2911
3068
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
2912
3069
|
preparing: t.orchestratorPreparing,
|
|
2913
3070
|
collecting: t.orchestratorCollecting
|
|
2914
|
-
}), []), r =
|
|
3071
|
+
}), []), r = Et(), i = En(n, {
|
|
2915
3072
|
defaultEnabled: !0,
|
|
2916
3073
|
...r.person ? { author: r.person } : {}
|
|
2917
|
-
}), [a, o] =
|
|
2918
|
-
e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(
|
|
3074
|
+
}), [a, o] = L(null), s = I(!1), c = !i.hasProviders || i.selectedModel !== "", l = I(r.pendingExtraDestinations), u = I(r.pendingAttachments), d = I(r.pendingModel), f = I(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), p = I(r.pendingCarryOver), m = I(!1), h = (e) => {
|
|
3075
|
+
e && typeof e == "object" && e.kind === "handoff" && (o(e), r.closeTask(Ct));
|
|
2919
3076
|
};
|
|
2920
|
-
|
|
3077
|
+
N(() => {
|
|
2921
3078
|
!s.current && c && (s.current = !0, d.current && i.setSelectedModel(d.current), i.run({
|
|
2922
3079
|
userGoal: e,
|
|
2923
3080
|
pageContext: r.pageContext,
|
|
@@ -2929,9 +3086,9 @@ function In({ userGoal: e }) {
|
|
|
2929
3086
|
}).then((e) => {
|
|
2930
3087
|
e && h(e);
|
|
2931
3088
|
}));
|
|
2932
|
-
}, [c]),
|
|
3089
|
+
}, [c]), N(() => {
|
|
2933
3090
|
m.current || r.openTask({
|
|
2934
|
-
id:
|
|
3091
|
+
id: Ct,
|
|
2935
3092
|
title: "Agentico",
|
|
2936
3093
|
icon: "bot",
|
|
2937
3094
|
agent: i,
|
|
@@ -2939,7 +3096,7 @@ function In({ userGoal: e }) {
|
|
|
2939
3096
|
scopedSubagentId: f.current,
|
|
2940
3097
|
precedingActivity: p.current?.activity,
|
|
2941
3098
|
onDismiss: () => {
|
|
2942
|
-
m.current = !0, i.running && i.stop(), r.closeTask(
|
|
3099
|
+
m.current = !0, i.running && i.stop(), r.closeTask(Ct);
|
|
2943
3100
|
}
|
|
2944
3101
|
});
|
|
2945
3102
|
}, [
|
|
@@ -2951,13 +3108,13 @@ function In({ userGoal: e }) {
|
|
|
2951
3108
|
i.modelsByProvider,
|
|
2952
3109
|
i.hasProviders,
|
|
2953
3110
|
r.openTask
|
|
2954
|
-
]),
|
|
2955
|
-
r.closeTask(
|
|
3111
|
+
]), N(() => () => {
|
|
3112
|
+
r.closeTask(Ct);
|
|
2956
3113
|
}, [r.closeTask]);
|
|
2957
|
-
let g =
|
|
3114
|
+
let g = F(() => [...p.current?.activity ?? [], ...i.activity], [i.activity]);
|
|
2958
3115
|
if (!a) return null;
|
|
2959
|
-
let _ =
|
|
2960
|
-
return _ ? /* @__PURE__ */
|
|
3116
|
+
let _ = q(a.subagentId);
|
|
3117
|
+
return _ ? /* @__PURE__ */ z(Yn, {
|
|
2961
3118
|
manifest: _,
|
|
2962
3119
|
params: a.params,
|
|
2963
3120
|
extraDestinations: l.current,
|
|
@@ -2968,11 +3125,11 @@ function In({ userGoal: e }) {
|
|
|
2968
3125
|
}
|
|
2969
3126
|
//#endregion
|
|
2970
3127
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
2971
|
-
function
|
|
2972
|
-
let r =
|
|
3128
|
+
function Zn({ manifest: e, extraDestinations: t }) {
|
|
3129
|
+
let r = Et(), i = En(e.definition, {
|
|
2973
3130
|
defaultEnabled: !1,
|
|
2974
3131
|
...r.person ? { author: r.person } : {}
|
|
2975
|
-
}), a = $(), o =
|
|
3132
|
+
}), a = $(), o = I(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = L(null), [l, u] = L([]), d = In(e.id), f = d?.kind === "selection" ? d : null, [p, m] = L(null), [h, g] = L(null), _ = I(!1), v = (t) => {
|
|
2976
3133
|
if (!e.manualEntry) return;
|
|
2977
3134
|
let n;
|
|
2978
3135
|
try {
|
|
@@ -2985,7 +3142,7 @@ function Ln({ manifest: e, extraDestinations: n }) {
|
|
|
2985
3142
|
e && c(e);
|
|
2986
3143
|
});
|
|
2987
3144
|
};
|
|
2988
|
-
|
|
3145
|
+
N(() => {
|
|
2989
3146
|
s && f && m(f.defaultSelection(s));
|
|
2990
3147
|
}, [s, f]);
|
|
2991
3148
|
let y = (e, t) => {
|
|
@@ -2993,18 +3150,18 @@ function Ln({ manifest: e, extraDestinations: n }) {
|
|
|
2993
3150
|
...n,
|
|
2994
3151
|
[e]: t
|
|
2995
3152
|
});
|
|
2996
|
-
}, b = (e) => c(e), x =
|
|
3153
|
+
}, b = (e) => c(e), x = F(() => s && f && p ? f.applySelection(s, p) : s, [
|
|
2997
3154
|
s,
|
|
2998
3155
|
f,
|
|
2999
3156
|
p
|
|
3000
3157
|
]), S = (e) => {
|
|
3001
3158
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
3002
|
-
}, C =
|
|
3159
|
+
}, C = F(() => r.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [r.componentAnchors, e.id]), w = F(() => h ? Rn(C, h, o) : null, [
|
|
3003
3160
|
C,
|
|
3004
3161
|
h,
|
|
3005
3162
|
o
|
|
3006
|
-
]), T =
|
|
3007
|
-
return
|
|
3163
|
+
]), T = F(() => w ? [w, ...t ?? []] : t, [w, t]);
|
|
3164
|
+
return N(() => {
|
|
3008
3165
|
_.current || r.openTask({
|
|
3009
3166
|
id: o,
|
|
3010
3167
|
title: e.label,
|
|
@@ -3018,18 +3175,18 @@ function Ln({ manifest: e, extraDestinations: n }) {
|
|
|
3018
3175
|
onDismiss: () => {
|
|
3019
3176
|
_.current = !0, i.running && i.stop(), r.closeTask(o);
|
|
3020
3177
|
},
|
|
3021
|
-
panelExtra: s ? /* @__PURE__ */
|
|
3178
|
+
panelExtra: s ? /* @__PURE__ */ B("div", {
|
|
3022
3179
|
className: "space-y-2",
|
|
3023
3180
|
children: [
|
|
3024
|
-
f && p ? /* @__PURE__ */
|
|
3181
|
+
f && p ? /* @__PURE__ */ z(f.Report, {
|
|
3025
3182
|
result: s,
|
|
3026
3183
|
selection: p,
|
|
3027
3184
|
onChange: y
|
|
3028
|
-
}) : d?.kind === "editable" ? /* @__PURE__ */
|
|
3185
|
+
}) : d?.kind === "editable" ? /* @__PURE__ */ z(d.Report, {
|
|
3029
3186
|
result: s,
|
|
3030
3187
|
onResultChange: b
|
|
3031
|
-
}) : /* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3188
|
+
}) : /* @__PURE__ */ z(Ln, { result: x }),
|
|
3189
|
+
/* @__PURE__ */ z(Nn, {
|
|
3033
3190
|
manifest: e,
|
|
3034
3191
|
result: x,
|
|
3035
3192
|
meta: h ?? {},
|
|
@@ -3038,12 +3195,12 @@ function Ln({ manifest: e, extraDestinations: n }) {
|
|
|
3038
3195
|
onApplied: S,
|
|
3039
3196
|
extraDestinations: T
|
|
3040
3197
|
}),
|
|
3041
|
-
i.hasProviders && /* @__PURE__ */
|
|
3198
|
+
i.hasProviders && /* @__PURE__ */ z(n, {
|
|
3042
3199
|
label: a.resumeWithAi,
|
|
3043
3200
|
variant: "outline-secondary",
|
|
3044
3201
|
className: "text-xs",
|
|
3045
3202
|
onClick: () => {
|
|
3046
|
-
h && r.resumeWithAI(e.id, h,
|
|
3203
|
+
h && r.resumeWithAI(e.id, h, t);
|
|
3047
3204
|
}
|
|
3048
3205
|
})
|
|
3049
3206
|
]
|
|
@@ -3060,66 +3217,66 @@ function Ln({ manifest: e, extraDestinations: n }) {
|
|
|
3060
3217
|
p,
|
|
3061
3218
|
l,
|
|
3062
3219
|
h
|
|
3063
|
-
]),
|
|
3220
|
+
]), N(() => () => {
|
|
3064
3221
|
r.closeTask(o);
|
|
3065
3222
|
}, []), null;
|
|
3066
3223
|
}
|
|
3067
3224
|
//#endregion
|
|
3068
3225
|
//#region src/presentation/EarlierSessions.tsx
|
|
3069
|
-
function
|
|
3070
|
-
return /* @__PURE__ */
|
|
3226
|
+
function Qn({ title: e, meta: t, action: n }) {
|
|
3227
|
+
return /* @__PURE__ */ B("div", {
|
|
3071
3228
|
role: "separator",
|
|
3072
3229
|
"aria-label": e,
|
|
3073
3230
|
className: "my-3 flex items-center gap-2 text-[11px] text-muted-foreground",
|
|
3074
3231
|
children: [
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ z("span", { className: "h-px flex-1 bg-border" }),
|
|
3233
|
+
/* @__PURE__ */ B("span", {
|
|
3077
3234
|
className: "flex min-w-0 max-w-[75%] flex-col items-center text-center",
|
|
3078
3235
|
children: [
|
|
3079
|
-
/* @__PURE__ */
|
|
3236
|
+
/* @__PURE__ */ z("span", {
|
|
3080
3237
|
className: "max-w-full truncate font-medium text-foreground",
|
|
3081
3238
|
children: e
|
|
3082
3239
|
}),
|
|
3083
|
-
t && /* @__PURE__ */
|
|
3240
|
+
t && /* @__PURE__ */ z("span", { children: t }),
|
|
3084
3241
|
n
|
|
3085
3242
|
]
|
|
3086
3243
|
}),
|
|
3087
|
-
/* @__PURE__ */
|
|
3244
|
+
/* @__PURE__ */ z("span", { className: "h-px flex-1 bg-border" })
|
|
3088
3245
|
]
|
|
3089
3246
|
});
|
|
3090
3247
|
}
|
|
3091
|
-
function
|
|
3092
|
-
let i =
|
|
3093
|
-
return /* @__PURE__ */
|
|
3248
|
+
function $n({ chat: e, thread: t, from: n, showEvents: r }) {
|
|
3249
|
+
let i = kt(t, n, e.savedAt, r);
|
|
3250
|
+
return /* @__PURE__ */ z(tn, {
|
|
3094
3251
|
activity: e.activity,
|
|
3095
3252
|
pinUserMessages: !1,
|
|
3096
|
-
speaker:
|
|
3253
|
+
speaker: q(e.subagentId)?.speaker?.(e.params),
|
|
3097
3254
|
events: i
|
|
3098
3255
|
});
|
|
3099
3256
|
}
|
|
3100
|
-
function
|
|
3101
|
-
let l = $(), { locale: u } =
|
|
3102
|
-
|
|
3103
|
-
let p =
|
|
3257
|
+
function er({ scopeId: e, thread: t, taskId: r, scrollRef: i, onLoad: a, onContinue: o, busy: s = !1, showEvents: c = !0 }) {
|
|
3258
|
+
let l = $(), { locale: u } = te(), [d, f] = L(0);
|
|
3259
|
+
N(() => Ge(() => f((e) => e + 1)), []);
|
|
3260
|
+
let p = F(() => ot(e, t, r), [
|
|
3104
3261
|
e,
|
|
3105
|
-
|
|
3262
|
+
t,
|
|
3106
3263
|
r,
|
|
3107
3264
|
d
|
|
3108
|
-
]), [m, h] =
|
|
3109
|
-
|
|
3110
|
-
let g = m < p.length, _ =
|
|
3265
|
+
]), [m, h] = L(0);
|
|
3266
|
+
N(() => h(0), [r, t]);
|
|
3267
|
+
let g = m < p.length, _ = I(null), v = () => {
|
|
3111
3268
|
let e = i.current;
|
|
3112
3269
|
e && (_.current = {
|
|
3113
3270
|
height: e.scrollHeight,
|
|
3114
3271
|
top: e.scrollTop
|
|
3115
3272
|
}), a?.(), h((e) => Math.min(e + 1, p.length));
|
|
3116
|
-
}, y =
|
|
3117
|
-
y.current = v,
|
|
3273
|
+
}, y = I(v);
|
|
3274
|
+
y.current = v, P(() => {
|
|
3118
3275
|
let e = i.current, t = _.current;
|
|
3119
3276
|
_.current = null, e && t && (e.scrollTop = t.top + (e.scrollHeight - t.height));
|
|
3120
3277
|
}, [m, i]);
|
|
3121
|
-
let b =
|
|
3122
|
-
if (
|
|
3278
|
+
let b = I(null);
|
|
3279
|
+
if (N(() => {
|
|
3123
3280
|
let e = i.current, t = b.current;
|
|
3124
3281
|
if (!e || !t || !g || typeof IntersectionObserver > "u") return;
|
|
3125
3282
|
let n = e.scrollTop, r = !1, a = () => {
|
|
@@ -3143,15 +3300,15 @@ function Bn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
|
|
|
3143
3300
|
let x = (e) => new Date(e).toLocaleString(u, {
|
|
3144
3301
|
dateStyle: "medium",
|
|
3145
3302
|
timeStyle: "short"
|
|
3146
|
-
}),
|
|
3303
|
+
}), S = p.slice(0, m).reverse(), C = (e) => {
|
|
3147
3304
|
let t = p[p.indexOf(e) + 1];
|
|
3148
3305
|
return t ? t.savedAt : Q(e);
|
|
3149
3306
|
};
|
|
3150
|
-
return /* @__PURE__ */
|
|
3151
|
-
g && /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ B("div", { children: [
|
|
3308
|
+
g && /* @__PURE__ */ z("div", {
|
|
3152
3309
|
ref: b,
|
|
3153
3310
|
className: "flex justify-center pb-1",
|
|
3154
|
-
children: /* @__PURE__ */
|
|
3311
|
+
children: /* @__PURE__ */ z(n, {
|
|
3155
3312
|
icon: "history",
|
|
3156
3313
|
label: l.earlierSession,
|
|
3157
3314
|
variant: "link",
|
|
@@ -3159,31 +3316,152 @@ function Bn({ scopeId: e, thread: n, taskId: r, scrollRef: i, onLoad: a, onConti
|
|
|
3159
3316
|
onClick: v
|
|
3160
3317
|
})
|
|
3161
3318
|
}),
|
|
3162
|
-
|
|
3163
|
-
"aria-label":
|
|
3164
|
-
children: [/* @__PURE__ */
|
|
3165
|
-
title:
|
|
3166
|
-
meta:
|
|
3167
|
-
action: /* @__PURE__ */
|
|
3319
|
+
S.map((e) => /* @__PURE__ */ B("section", {
|
|
3320
|
+
"aria-label": Qe(e),
|
|
3321
|
+
children: [/* @__PURE__ */ z(Qn, {
|
|
3322
|
+
title: Qe(e),
|
|
3323
|
+
meta: E(l.sessionOf, { at: x(Q(e)) }),
|
|
3324
|
+
action: /* @__PURE__ */ z(n, {
|
|
3168
3325
|
label: l.continueSession,
|
|
3169
3326
|
variant: "link",
|
|
3170
3327
|
className: "text-[11px]",
|
|
3171
3328
|
disabled: s,
|
|
3172
3329
|
onClick: () => o(e)
|
|
3173
3330
|
})
|
|
3174
|
-
}), /* @__PURE__ */
|
|
3331
|
+
}), /* @__PURE__ */ z($n, {
|
|
3175
3332
|
chat: e,
|
|
3176
|
-
thread:
|
|
3177
|
-
from:
|
|
3333
|
+
thread: t,
|
|
3334
|
+
from: C(e),
|
|
3178
3335
|
showEvents: c
|
|
3179
3336
|
})]
|
|
3180
3337
|
}, `${e.subagentId}:${e.entityId}`)),
|
|
3181
|
-
m > 0 && /* @__PURE__ */
|
|
3338
|
+
m > 0 && /* @__PURE__ */ z(Qn, { title: l.thisSession })
|
|
3182
3339
|
] });
|
|
3183
3340
|
}
|
|
3184
3341
|
//#endregion
|
|
3342
|
+
//#region src/presentation/AgenticoSettingsModal.tsx
|
|
3343
|
+
var tr = [
|
|
3344
|
+
"low",
|
|
3345
|
+
"medium",
|
|
3346
|
+
"high",
|
|
3347
|
+
"max"
|
|
3348
|
+
];
|
|
3349
|
+
function nr() {
|
|
3350
|
+
let { shown: e, connections: t } = St();
|
|
3351
|
+
return e.length > 0 || !!t;
|
|
3352
|
+
}
|
|
3353
|
+
function rr() {
|
|
3354
|
+
let e = $(), { settings: r, shown: i, connections: a, save: o, isOpen: s, close: c } = St(), u = k(), d = ee()?.registry ?? {}, { modelsByProvider: f } = vn({ unfiltered: !0 });
|
|
3355
|
+
if (!s) return null;
|
|
3356
|
+
let m = Object.keys(d), h = (e) => d[e]?.label ?? e, g = Object.values(f).flat(), _ = {
|
|
3357
|
+
low: e.settingsReasoningLow,
|
|
3358
|
+
medium: e.settingsReasoningMedium,
|
|
3359
|
+
high: e.settingsReasoningHigh,
|
|
3360
|
+
max: e.settingsReasoningMax
|
|
3361
|
+
}, b = (e) => i.includes(e), x = {
|
|
3362
|
+
defaultModel: r.defaultModel ?? "",
|
|
3363
|
+
reasoning: r.reasoning ?? "",
|
|
3364
|
+
chatTitles: r.chatTitles ? "on" : "",
|
|
3365
|
+
threadEvents: r.threadEvents ? "on" : "",
|
|
3366
|
+
...Object.fromEntries(m.map((e) => [`provider_${e}`, !r.providers || r.providers.includes(e) ? "on" : ""]))
|
|
3367
|
+
};
|
|
3368
|
+
return /* @__PURE__ */ z(y, {
|
|
3369
|
+
title: e.settingsTitle,
|
|
3370
|
+
position: "right",
|
|
3371
|
+
size: "lg",
|
|
3372
|
+
onClose: c,
|
|
3373
|
+
footer: /* @__PURE__ */ B(R, { children: [i.length > 0 && /* @__PURE__ */ z(v, {
|
|
3374
|
+
variant: "primary",
|
|
3375
|
+
label: e.settingsSave,
|
|
3376
|
+
onClick: (e) => u.save(e)
|
|
3377
|
+
}), /* @__PURE__ */ z(n, {
|
|
3378
|
+
variant: "link",
|
|
3379
|
+
label: e.settingsClose,
|
|
3380
|
+
onClick: c
|
|
3381
|
+
})] }),
|
|
3382
|
+
children: /* @__PURE__ */ B("div", {
|
|
3383
|
+
className: "space-y-6",
|
|
3384
|
+
children: [i.length > 0 && /* @__PURE__ */ B("section", {
|
|
3385
|
+
className: "space-y-3",
|
|
3386
|
+
children: [/* @__PURE__ */ z("h4", {
|
|
3387
|
+
className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
3388
|
+
children: e.settingsChats
|
|
3389
|
+
}), /* @__PURE__ */ z(p, {
|
|
3390
|
+
appearance: "empty",
|
|
3391
|
+
controller: u,
|
|
3392
|
+
showNotice: !1,
|
|
3393
|
+
defaultValues: x,
|
|
3394
|
+
onSave: async ({ record: e }) => {
|
|
3395
|
+
let t = (t) => String(e?.[t] ?? ""), n = m.filter((e) => t(`provider_${e}`) === "on");
|
|
3396
|
+
await o({
|
|
3397
|
+
...b("defaultModel") ? { defaultModel: t("defaultModel") || void 0 } : {},
|
|
3398
|
+
...b("reasoning") ? { reasoning: t("reasoning") || void 0 } : {},
|
|
3399
|
+
...b("providers") ? { providers: n.length === m.length ? void 0 : n } : {},
|
|
3400
|
+
...b("chatTitles") ? { chatTitles: t("chatTitles") === "on" } : {},
|
|
3401
|
+
...b("threadEvents") ? { threadEvents: t("threadEvents") === "on" } : {}
|
|
3402
|
+
}), c();
|
|
3403
|
+
},
|
|
3404
|
+
children: /* @__PURE__ */ B("div", {
|
|
3405
|
+
className: "space-y-3",
|
|
3406
|
+
children: [
|
|
3407
|
+
b("defaultModel") && /* @__PURE__ */ z(S, {
|
|
3408
|
+
name: "defaultModel",
|
|
3409
|
+
label: e.settingsDefaultModel,
|
|
3410
|
+
placeholderOption: {
|
|
3411
|
+
label: e.settingsDefaultModelNone,
|
|
3412
|
+
value: ""
|
|
3413
|
+
},
|
|
3414
|
+
options: g.map((e) => ({
|
|
3415
|
+
label: `${e.providerLabel ?? e.provider} / ${e.model}`,
|
|
3416
|
+
value: e.id
|
|
3417
|
+
}))
|
|
3418
|
+
}),
|
|
3419
|
+
b("reasoning") && /* @__PURE__ */ z(S, {
|
|
3420
|
+
name: "reasoning",
|
|
3421
|
+
label: e.settingsReasoning,
|
|
3422
|
+
placeholderOption: {
|
|
3423
|
+
label: e.settingsReasoningDefault,
|
|
3424
|
+
value: ""
|
|
3425
|
+
},
|
|
3426
|
+
options: tr.map((e) => ({
|
|
3427
|
+
label: _[e],
|
|
3428
|
+
value: e
|
|
3429
|
+
}))
|
|
3430
|
+
}),
|
|
3431
|
+
b("providers") && m.length > 0 && /* @__PURE__ */ B("fieldset", {
|
|
3432
|
+
className: "space-y-1",
|
|
3433
|
+
children: [/* @__PURE__ */ z("legend", {
|
|
3434
|
+
className: "text-sm font-medium",
|
|
3435
|
+
children: e.settingsProviders
|
|
3436
|
+
}), m.map((e) => /* @__PURE__ */ z(l, {
|
|
3437
|
+
name: `provider_${e}`,
|
|
3438
|
+
label: h(e)
|
|
3439
|
+
}, e))]
|
|
3440
|
+
}),
|
|
3441
|
+
b("chatTitles") && /* @__PURE__ */ z(C, {
|
|
3442
|
+
name: "chatTitles",
|
|
3443
|
+
label: e.settingsChatTitles
|
|
3444
|
+
}),
|
|
3445
|
+
b("threadEvents") && /* @__PURE__ */ z(C, {
|
|
3446
|
+
name: "threadEvents",
|
|
3447
|
+
label: e.settingsThreadEvents
|
|
3448
|
+
})
|
|
3449
|
+
]
|
|
3450
|
+
})
|
|
3451
|
+
})]
|
|
3452
|
+
}), a && /* @__PURE__ */ B("section", {
|
|
3453
|
+
className: "space-y-3",
|
|
3454
|
+
children: [/* @__PURE__ */ z("h4", {
|
|
3455
|
+
className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
3456
|
+
children: e.settingsConnectors
|
|
3457
|
+
}), /* @__PURE__ */ z(t, { ...a })]
|
|
3458
|
+
})]
|
|
3459
|
+
})
|
|
3460
|
+
});
|
|
3461
|
+
}
|
|
3462
|
+
//#endregion
|
|
3185
3463
|
//#region src/presentation/Agentico.tsx
|
|
3186
|
-
function
|
|
3464
|
+
function ir(e, t) {
|
|
3187
3465
|
return Object.values(e).flat().map((e) => {
|
|
3188
3466
|
let n = t?.(e.provider, e.providerLabel ?? e.provider);
|
|
3189
3467
|
return {
|
|
@@ -3195,18 +3473,18 @@ function Vn(e, t) {
|
|
|
3195
3473
|
};
|
|
3196
3474
|
});
|
|
3197
3475
|
}
|
|
3198
|
-
function
|
|
3199
|
-
let a = $(), [o,
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
}, [
|
|
3203
|
-
let { draft:
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
}, [
|
|
3476
|
+
function ar({ task: e, editing: t, onCancelEdit: r, onSendEdit: i }) {
|
|
3477
|
+
let a = $(), [o, s] = L(""), { agent: l, onApplied: u, manualEntry: d } = e, f = l.running;
|
|
3478
|
+
N(() => {
|
|
3479
|
+
t && s(t.detail ?? "");
|
|
3480
|
+
}, [t]);
|
|
3481
|
+
let { draft: p } = Et(), h = I(p?.nonce ?? 0);
|
|
3482
|
+
N(() => {
|
|
3483
|
+
p && p.nonce !== h.current && (h.current = p.nonce, s(p.text));
|
|
3484
|
+
}, [p]);
|
|
3207
3485
|
let g = (e) => {
|
|
3208
|
-
if (
|
|
3209
|
-
i(
|
|
3486
|
+
if (s(""), t && i) {
|
|
3487
|
+
i(t, e.text);
|
|
3210
3488
|
return;
|
|
3211
3489
|
}
|
|
3212
3490
|
if (d) {
|
|
@@ -3219,33 +3497,33 @@ function Hn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
3219
3497
|
}).then((e) => {
|
|
3220
3498
|
e && u(e);
|
|
3221
3499
|
});
|
|
3222
|
-
}, _ = !!d || l.remote && l.remoteModels.length === 0, v = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), y = !_ && !l.remote && !v && l.hasProviders && !l.selectedModel, b = _ ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...
|
|
3223
|
-
return /* @__PURE__ */
|
|
3500
|
+
}, _ = !!d || l.remote && l.remoteModels.length === 0, v = l.alongside && l.remoteModels.some((e) => e.value === l.selectedModel), y = !_ && !l.remote && !v && l.hasProviders && !l.selectedModel, b = _ ? [] : l.remote ? l.remoteModels : l.alongside ? [...l.remoteModels, ...ir(l.modelsByProvider, l.catalogGroup)] : ir(l.modelsByProvider);
|
|
3501
|
+
return /* @__PURE__ */ B(R, { children: [t && /* @__PURE__ */ B("div", {
|
|
3224
3502
|
className: "mb-2 flex items-center gap-2 text-xs text-muted-foreground",
|
|
3225
3503
|
children: [
|
|
3226
|
-
/* @__PURE__ */
|
|
3504
|
+
/* @__PURE__ */ z(m, {
|
|
3227
3505
|
name: "pencil",
|
|
3228
3506
|
size: 12,
|
|
3229
3507
|
className: "shrink-0"
|
|
3230
3508
|
}),
|
|
3231
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ z("span", {
|
|
3232
3510
|
className: "flex-1",
|
|
3233
3511
|
children: a.editingMessage
|
|
3234
3512
|
}),
|
|
3235
|
-
/* @__PURE__ */
|
|
3513
|
+
/* @__PURE__ */ z(n, {
|
|
3236
3514
|
label: a.cancelEdit,
|
|
3237
3515
|
variant: "link",
|
|
3238
3516
|
className: "p-0 text-xs",
|
|
3239
3517
|
onClick: () => {
|
|
3240
|
-
|
|
3518
|
+
s(""), r?.();
|
|
3241
3519
|
}
|
|
3242
3520
|
})
|
|
3243
3521
|
]
|
|
3244
|
-
}), /* @__PURE__ */
|
|
3522
|
+
}), /* @__PURE__ */ z(c, {
|
|
3245
3523
|
value: o,
|
|
3246
|
-
onChange:
|
|
3524
|
+
onChange: s,
|
|
3247
3525
|
placeholder: d?.prompt ?? a.messagePlaceholder,
|
|
3248
|
-
running:
|
|
3526
|
+
running: f,
|
|
3249
3527
|
onStop: l.stop,
|
|
3250
3528
|
disabled: !o.trim() || y,
|
|
3251
3529
|
onSubmit: g,
|
|
@@ -3260,52 +3538,52 @@ function Hn({ task: e, editing: n, onCancelEdit: r, onSendEdit: i }) {
|
|
|
3260
3538
|
maxHeight: 220
|
|
3261
3539
|
})] });
|
|
3262
3540
|
}
|
|
3263
|
-
function
|
|
3264
|
-
let { startOrchestrator: e } =
|
|
3541
|
+
function or() {
|
|
3542
|
+
let { startOrchestrator: e } = Et(), t = $(), [n, r] = L(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: s } = vn(), l = (t) => {
|
|
3265
3543
|
t.text.trim() && (e(t.text.trim(), {
|
|
3266
3544
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
3267
3545
|
model: t.model || void 0
|
|
3268
3546
|
}), r(""));
|
|
3269
3547
|
}, u = i && !o;
|
|
3270
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ z(c, {
|
|
3271
3549
|
value: n,
|
|
3272
3550
|
onChange: r,
|
|
3273
3551
|
placeholder: t.orchestratorStarterPlaceholder,
|
|
3274
3552
|
disabled: !n.trim() || u,
|
|
3275
3553
|
onSubmit: l,
|
|
3276
3554
|
attachments: !0,
|
|
3277
|
-
models:
|
|
3555
|
+
models: ir(a),
|
|
3278
3556
|
selectedModel: o,
|
|
3279
|
-
onModelChange:
|
|
3557
|
+
onModelChange: s,
|
|
3280
3558
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
3281
3559
|
minHeight: 44,
|
|
3282
3560
|
maxHeight: 220
|
|
3283
3561
|
});
|
|
3284
3562
|
}
|
|
3285
|
-
function
|
|
3286
|
-
let n = $(), r =
|
|
3287
|
-
return /* @__PURE__ */
|
|
3563
|
+
function sr({ chat: e, onClose: t }) {
|
|
3564
|
+
let n = $(), r = k();
|
|
3565
|
+
return /* @__PURE__ */ z(y, {
|
|
3288
3566
|
title: n.renameChat,
|
|
3289
3567
|
size: "sm",
|
|
3290
3568
|
onClose: t,
|
|
3291
|
-
onSave: () => (
|
|
3292
|
-
children: /* @__PURE__ */
|
|
3569
|
+
onSave: () => (tt(e.scopeId, e.subagentId, e.entityId, String(r.record?.title ?? Qe(e)), "person"), t(), Promise.resolve(!0)),
|
|
3570
|
+
children: /* @__PURE__ */ B(p, {
|
|
3293
3571
|
appearance: "empty",
|
|
3294
3572
|
controller: r,
|
|
3295
|
-
defaultValues: { title:
|
|
3573
|
+
defaultValues: { title: Qe(e) },
|
|
3296
3574
|
footer: !1,
|
|
3297
|
-
children: [/* @__PURE__ */
|
|
3575
|
+
children: [/* @__PURE__ */ z(_, {
|
|
3298
3576
|
name: "title",
|
|
3299
3577
|
label: n.chatTitleLabel,
|
|
3300
3578
|
placeholder: e.title
|
|
3301
|
-
}), /* @__PURE__ */
|
|
3579
|
+
}), /* @__PURE__ */ z("p", {
|
|
3302
3580
|
className: "text-xs text-muted-foreground",
|
|
3303
3581
|
children: n.chatTitleHint
|
|
3304
3582
|
})]
|
|
3305
3583
|
})
|
|
3306
3584
|
});
|
|
3307
3585
|
}
|
|
3308
|
-
function
|
|
3586
|
+
function cr(e, t, n = Date.now()) {
|
|
3309
3587
|
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
3310
3588
|
numeric: "auto",
|
|
3311
3589
|
style: "short"
|
|
@@ -3317,55 +3595,55 @@ function Gn(e, t, n = Date.now()) {
|
|
|
3317
3595
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
3318
3596
|
return i.format(0, "minute");
|
|
3319
3597
|
}
|
|
3320
|
-
function
|
|
3598
|
+
function lr({ card: e }) {
|
|
3321
3599
|
let t = $();
|
|
3322
|
-
return e.humanSummaryOnly ? /* @__PURE__ */
|
|
3600
|
+
return e.humanSummaryOnly ? /* @__PURE__ */ B("div", {
|
|
3323
3601
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
3324
|
-
children: [/* @__PURE__ */
|
|
3602
|
+
children: [/* @__PURE__ */ B("p", {
|
|
3325
3603
|
className: "text-xs font-medium text-foreground",
|
|
3326
3604
|
children: [
|
|
3327
3605
|
"\"",
|
|
3328
3606
|
e.label,
|
|
3329
3607
|
"\""
|
|
3330
3608
|
]
|
|
3331
|
-
}), /* @__PURE__ */
|
|
3609
|
+
}), /* @__PURE__ */ z("p", {
|
|
3332
3610
|
className: "text-xs text-muted-foreground",
|
|
3333
3611
|
children: e.humanSummary
|
|
3334
3612
|
})]
|
|
3335
|
-
}) : /* @__PURE__ */
|
|
3613
|
+
}) : /* @__PURE__ */ B("div", {
|
|
3336
3614
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
3337
3615
|
children: [
|
|
3338
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ z("p", {
|
|
3339
3617
|
className: "text-xs font-medium text-foreground",
|
|
3340
|
-
children:
|
|
3618
|
+
children: E(t.newInstance, { label: e.label })
|
|
3341
3619
|
}),
|
|
3342
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ z("p", {
|
|
3343
3621
|
className: "text-xs text-muted-foreground",
|
|
3344
3622
|
children: e.humanSummary
|
|
3345
3623
|
}),
|
|
3346
|
-
e.fields.length > 0 && /* @__PURE__ */
|
|
3624
|
+
e.fields.length > 0 && /* @__PURE__ */ z("ul", {
|
|
3347
3625
|
className: "space-y-1",
|
|
3348
|
-
children: e.fields.map((e) => /* @__PURE__ */
|
|
3626
|
+
children: e.fields.map((e) => /* @__PURE__ */ B("li", {
|
|
3349
3627
|
className: "flex items-start gap-1.5 text-xs",
|
|
3350
|
-
children: [/* @__PURE__ */
|
|
3628
|
+
children: [/* @__PURE__ */ z(r, {
|
|
3351
3629
|
variant: e.required ? "primary" : "secondary",
|
|
3352
3630
|
className: "mt-px shrink-0",
|
|
3353
3631
|
children: e.required ? "richiesto" : "opzionale"
|
|
3354
|
-
}), /* @__PURE__ */
|
|
3632
|
+
}), /* @__PURE__ */ B("span", {
|
|
3355
3633
|
className: "min-w-0",
|
|
3356
|
-
children: [/* @__PURE__ */
|
|
3634
|
+
children: [/* @__PURE__ */ z("span", {
|
|
3357
3635
|
className: "font-mono text-foreground",
|
|
3358
3636
|
children: e.key
|
|
3359
|
-
}), e.humanDescription ? /* @__PURE__ */
|
|
3637
|
+
}), e.humanDescription ? /* @__PURE__ */ B("span", {
|
|
3360
3638
|
className: "text-muted-foreground",
|
|
3361
3639
|
children: [" — ", e.humanDescription]
|
|
3362
3640
|
}) : null]
|
|
3363
3641
|
})]
|
|
3364
3642
|
}, e.key))
|
|
3365
3643
|
}),
|
|
3366
|
-
e.example && /* @__PURE__ */
|
|
3644
|
+
e.example && /* @__PURE__ */ B("p", {
|
|
3367
3645
|
className: "text-xs text-muted-foreground",
|
|
3368
|
-
children: ["Esempio: ", /* @__PURE__ */
|
|
3646
|
+
children: ["Esempio: ", /* @__PURE__ */ z("span", {
|
|
3369
3647
|
className: "font-mono",
|
|
3370
3648
|
children: e.example
|
|
3371
3649
|
})]
|
|
@@ -3373,40 +3651,40 @@ function Kn({ card: e }) {
|
|
|
3373
3651
|
]
|
|
3374
3652
|
});
|
|
3375
3653
|
}
|
|
3376
|
-
function
|
|
3377
|
-
return /* @__PURE__ */
|
|
3654
|
+
function ur({ messages: e }) {
|
|
3655
|
+
return /* @__PURE__ */ z("div", {
|
|
3378
3656
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
3379
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
3657
|
+
children: e.map((e, t) => /* @__PURE__ */ z("p", {
|
|
3380
3658
|
className: "text-xs text-muted-foreground",
|
|
3381
3659
|
children: e
|
|
3382
3660
|
}, t))
|
|
3383
3661
|
});
|
|
3384
3662
|
}
|
|
3385
|
-
function
|
|
3386
|
-
let c = $(), { locale:
|
|
3387
|
-
|
|
3388
|
-
let _ =
|
|
3663
|
+
function dr({ scopeId: e, currentTaskId: t, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
3664
|
+
let c = $(), { locale: l } = te(), [u, p] = L(""), [h, g] = L(0);
|
|
3665
|
+
N(() => Ge(() => g((e) => e + 1)), []);
|
|
3666
|
+
let _ = F(() => r ? rt(e) : [], [
|
|
3389
3667
|
e,
|
|
3390
3668
|
r,
|
|
3391
3669
|
h
|
|
3392
|
-
]), [v, y] =
|
|
3393
|
-
let r =
|
|
3670
|
+
]), [v, y] = L(null), b = async (n) => {
|
|
3671
|
+
let r = q(n.subagentId), i = await r?.confirmArchive?.(n.entityId, n.params);
|
|
3394
3672
|
if (!i || window.confirm(i)) {
|
|
3395
3673
|
try {
|
|
3396
|
-
await r?.onArchive?.(
|
|
3674
|
+
await r?.onArchive?.(n.entityId, n.params);
|
|
3397
3675
|
} catch {
|
|
3398
3676
|
return;
|
|
3399
3677
|
}
|
|
3400
|
-
|
|
3678
|
+
nt(e, n.subagentId, n.entityId), t === it(n.subagentId, n.entityId) && s(), g((e) => e + 1);
|
|
3401
3679
|
}
|
|
3402
|
-
}, x =
|
|
3403
|
-
let e =
|
|
3680
|
+
}, x = F(() => {
|
|
3681
|
+
let e = u.trim().toLowerCase();
|
|
3404
3682
|
return e ? _.filter((t) => {
|
|
3405
|
-
let n =
|
|
3406
|
-
return
|
|
3683
|
+
let n = q(t.subagentId)?.label ?? t.subagentId;
|
|
3684
|
+
return Qe(t).toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
3407
3685
|
}) : _;
|
|
3408
|
-
}, [_,
|
|
3409
|
-
return /* @__PURE__ */
|
|
3686
|
+
}, [_, u]);
|
|
3687
|
+
return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(d, {
|
|
3410
3688
|
trigger: {
|
|
3411
3689
|
icon: "history",
|
|
3412
3690
|
title: c.chatHistory
|
|
@@ -3417,22 +3695,22 @@ function Jn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3417
3695
|
position: "end",
|
|
3418
3696
|
strategy: "absolute",
|
|
3419
3697
|
menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
|
|
3420
|
-
header: /* @__PURE__ */
|
|
3698
|
+
header: /* @__PURE__ */ B("div", {
|
|
3421
3699
|
className: "flex items-center gap-2 px-1 pb-1.5",
|
|
3422
3700
|
children: [
|
|
3423
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ z(m, {
|
|
3424
3702
|
name: "search",
|
|
3425
3703
|
size: 14,
|
|
3426
3704
|
className: "shrink-0 text-muted-foreground"
|
|
3427
3705
|
}),
|
|
3428
|
-
/* @__PURE__ */
|
|
3706
|
+
/* @__PURE__ */ z("input", {
|
|
3429
3707
|
autoFocus: !0,
|
|
3430
|
-
value:
|
|
3431
|
-
onChange: (e) =>
|
|
3708
|
+
value: u,
|
|
3709
|
+
onChange: (e) => p(e.target.value),
|
|
3432
3710
|
placeholder: c.searchChats,
|
|
3433
3711
|
className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3434
3712
|
}),
|
|
3435
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ z(n, {
|
|
3436
3714
|
icon: "square-pen",
|
|
3437
3715
|
ariaLabel: c.newChat,
|
|
3438
3716
|
title: c.newChat,
|
|
@@ -3442,13 +3720,13 @@ function Jn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3442
3720
|
})
|
|
3443
3721
|
]
|
|
3444
3722
|
}),
|
|
3445
|
-
children: x.length === 0 ? /* @__PURE__ */
|
|
3723
|
+
children: x.length === 0 ? /* @__PURE__ */ z("p", {
|
|
3446
3724
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
3447
3725
|
children: _.length === 0 ? c.noSavedChats : c.noResults
|
|
3448
3726
|
}) : x.map((e) => {
|
|
3449
|
-
let
|
|
3450
|
-
return /* @__PURE__ */
|
|
3451
|
-
icon: r ? "check" :
|
|
3727
|
+
let n = q(e.subagentId), r = t === it(e.subagentId, e.entityId);
|
|
3728
|
+
return /* @__PURE__ */ z(f, {
|
|
3729
|
+
icon: r ? "check" : n?.icon ?? "bot",
|
|
3452
3730
|
className: r ? "bg-accent font-semibold text-primary" : void 0,
|
|
3453
3731
|
actions: [{
|
|
3454
3732
|
icon: "pencil",
|
|
@@ -3462,248 +3740,257 @@ function Jn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
|
|
|
3462
3740
|
onClick: () => void b(e)
|
|
3463
3741
|
}],
|
|
3464
3742
|
onClick: () => a(e.subagentId, e.entityId, e),
|
|
3465
|
-
children: /* @__PURE__ */
|
|
3743
|
+
children: /* @__PURE__ */ B("span", {
|
|
3466
3744
|
className: "flex min-w-0 flex-1 items-center justify-between gap-2",
|
|
3467
|
-
children: [/* @__PURE__ */
|
|
3745
|
+
children: [/* @__PURE__ */ z("span", {
|
|
3468
3746
|
className: "min-w-0 truncate",
|
|
3469
|
-
title: `${
|
|
3470
|
-
children:
|
|
3471
|
-
}), /* @__PURE__ */
|
|
3747
|
+
title: `${n?.label ?? e.subagentId} · ${Qe(e)}`,
|
|
3748
|
+
children: Qe(e)
|
|
3749
|
+
}), /* @__PURE__ */ z("span", {
|
|
3472
3750
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
3473
|
-
title: `${c.chatStarted.replace("{at}", new Date(Q(e)).toLocaleString(
|
|
3474
|
-
children:
|
|
3751
|
+
title: `${c.chatStarted.replace("{at}", new Date(Q(e)).toLocaleString(l))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(l))}`,
|
|
3752
|
+
children: cr(Q(e), l)
|
|
3475
3753
|
})]
|
|
3476
3754
|
})
|
|
3477
3755
|
}, `${e.subagentId}:${e.entityId}`);
|
|
3478
3756
|
})
|
|
3479
|
-
}), v && /* @__PURE__ */
|
|
3757
|
+
}), v && /* @__PURE__ */ z(sr, {
|
|
3480
3758
|
chat: v,
|
|
3481
3759
|
onClose: () => y(null)
|
|
3482
3760
|
})] });
|
|
3483
3761
|
}
|
|
3484
|
-
function
|
|
3485
|
-
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:
|
|
3486
|
-
|
|
3487
|
-
A(null),
|
|
3488
|
-
}, [a?.id]),
|
|
3489
|
-
let
|
|
3762
|
+
function fr({ defaultWidth: e, minWidth: t, maxWidth: r, onWidthChange: i } = {}) {
|
|
3763
|
+
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: v, pendingExtraDestinations: y, pendingResumeWithAI: x, resumeWithAIRunId: S, pendingStart: C, startRunId: w, scope: T, threadEvents: E } = Et(), D = $(), O = I(null), [ee, k] = L(!1), [te, A] = L(null), [ne, j] = L(null);
|
|
3764
|
+
N(() => {
|
|
3765
|
+
A(null), j(null);
|
|
3766
|
+
}, [a?.id]), Kn(T?.id);
|
|
3767
|
+
let M = fn({
|
|
3490
3768
|
defaultWidth: e,
|
|
3491
|
-
minWidth:
|
|
3769
|
+
minWidth: t,
|
|
3492
3770
|
maxWidth: r,
|
|
3493
3771
|
onWidthChange: i
|
|
3494
|
-
}),
|
|
3495
|
-
(!a || a.agent.running || a.savedToDisk || window.confirm(
|
|
3496
|
-
},
|
|
3497
|
-
|
|
3772
|
+
}), re = () => {
|
|
3773
|
+
(!a || a.agent.running || a.savedToDisk || window.confirm(D.unsavedConversationConfirm)) && (m(), k(!1));
|
|
3774
|
+
}, P = a ? [...a.precedingActivity ?? [], ...a.agent.activity] : [], V = P.length, ie = Math.max(0, Math.min(a?.panelExtraAnchorIndex ?? V, V)), H = P.slice(0, ie), U = P.slice(ie), ae = !!(a && !a.agent.running && a.agent.error), [W, oe, G] = Ot(), K = St(), se = nr(), ce = I({ at: Date.now() });
|
|
3775
|
+
ce.current.id !== a?.id && (ce.current = {
|
|
3498
3776
|
id: a?.id,
|
|
3499
3777
|
at: Date.now()
|
|
3500
3778
|
});
|
|
3501
|
-
let
|
|
3502
|
-
if (!T || !a?.thread) return
|
|
3503
|
-
let e =
|
|
3779
|
+
let le = F(() => {
|
|
3780
|
+
if (!T || !a?.thread) return ce.current.at;
|
|
3781
|
+
let e = ot(T.id, a.thread, a.id)[0];
|
|
3504
3782
|
if (e) return e.savedAt;
|
|
3505
|
-
let t =
|
|
3506
|
-
return t ? Q(t) :
|
|
3783
|
+
let t = rt(T.id).find((e) => it(e.subagentId, e.entityId) === a.id);
|
|
3784
|
+
return t ? Q(t) : P.find((e) => e.at !== void 0)?.at ?? ce.current.at;
|
|
3507
3785
|
}, [
|
|
3508
3786
|
T?.id,
|
|
3509
3787
|
a?.thread,
|
|
3510
3788
|
a?.id,
|
|
3511
|
-
|
|
3512
|
-
]),
|
|
3789
|
+
V === 0
|
|
3790
|
+
]), ue = kt(a?.thread, le, Infinity, W), de = U.find((e) => e.at !== void 0)?.at, fe = U.length === 0 || de === void 0 ? ue : ue.filter((e) => e.at < de), pe = U.length === 0 || de === void 0 ? [] : ue.filter((e) => e.at >= de), me = (e, t) => {
|
|
3513
3791
|
a && (A(null), a.agent.rewind(e.id, t).then((e) => {
|
|
3514
3792
|
e && a.onApplied(e);
|
|
3515
3793
|
}));
|
|
3516
|
-
},
|
|
3794
|
+
}, he = (e) => {
|
|
3517
3795
|
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] : [])]);
|
|
3518
3796
|
return [...new Set(n.filter(Boolean))];
|
|
3519
|
-
},
|
|
3520
|
-
let n =
|
|
3521
|
-
n.length ?
|
|
3797
|
+
}, ge = (e, t) => {
|
|
3798
|
+
let n = he(e);
|
|
3799
|
+
n.length ? j({
|
|
3522
3800
|
entry: e,
|
|
3523
3801
|
steps: n,
|
|
3524
3802
|
...t === void 0 ? {} : { text: t }
|
|
3525
|
-
}) :
|
|
3526
|
-
},
|
|
3803
|
+
}) : me(e, t);
|
|
3804
|
+
}, J = a ? {
|
|
3527
3805
|
available: (e) => a.agent.activity.some((t) => t.id === e.id) && a.agent.rewindable(e.id),
|
|
3528
3806
|
disabled: a.agent.running,
|
|
3529
|
-
onRetry: (e) =>
|
|
3807
|
+
onRetry: (e) => ge(e),
|
|
3530
3808
|
onEdit: (e) => A(e)
|
|
3531
|
-
} : void 0,
|
|
3532
|
-
canAnswer: (e) =>
|
|
3809
|
+
} : void 0, _e = new Set(a?.agent.activity.map((e) => e.id) ?? []), Y = a ? {
|
|
3810
|
+
canAnswer: (e) => _e.has(e),
|
|
3533
3811
|
onAnswer: (e, t, n) => a.agent.answerQuestions(e, t, n).then((e) => {
|
|
3534
3812
|
e && a.onApplied(e);
|
|
3535
3813
|
}),
|
|
3536
3814
|
onCardAction: (e, t, n) => a.agent.cardAction(e, t, n)
|
|
3537
|
-
} : void 0,
|
|
3538
|
-
|
|
3539
|
-
let e =
|
|
3815
|
+
} : void 0, X = Y ? Yt(P, Y.canAnswer) : null, ve = a?.id === "agentico-orchestrator" && a.scopedSubagentId ? q(a.scopedSubagentId) : void 0, ye = ve?.manualEntry ? ve : null, be = I(!0);
|
|
3816
|
+
N(() => {
|
|
3817
|
+
let e = O.current;
|
|
3540
3818
|
if (!e) return;
|
|
3541
3819
|
let t = () => {
|
|
3542
|
-
|
|
3820
|
+
be.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
3543
3821
|
};
|
|
3544
3822
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
3545
|
-
}, [a?.id]),
|
|
3546
|
-
let e =
|
|
3547
|
-
e && (
|
|
3823
|
+
}, [a?.id]), N(() => {
|
|
3824
|
+
let e = O.current;
|
|
3825
|
+
e && (be.current = !0, e.scrollTop = e.scrollHeight);
|
|
3548
3826
|
}, [a?.id]);
|
|
3549
|
-
let
|
|
3550
|
-
|
|
3551
|
-
let e =
|
|
3552
|
-
e &&
|
|
3827
|
+
let xe = P.at(-1)?.detail?.length ?? 0;
|
|
3828
|
+
N(() => {
|
|
3829
|
+
let e = O.current;
|
|
3830
|
+
e && be.current && (e.scrollTop = e.scrollHeight);
|
|
3553
3831
|
}, [
|
|
3554
|
-
|
|
3832
|
+
V,
|
|
3555
3833
|
ae,
|
|
3556
|
-
|
|
3834
|
+
xe
|
|
3557
3835
|
]);
|
|
3558
|
-
let
|
|
3559
|
-
|
|
3560
|
-
let e =
|
|
3836
|
+
let Se = I(null);
|
|
3837
|
+
N(() => {
|
|
3838
|
+
let e = O.current, t = Se.current;
|
|
3561
3839
|
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
3562
3840
|
let n = new ResizeObserver(() => {
|
|
3563
|
-
|
|
3841
|
+
be.current && (e.scrollTop = e.scrollHeight);
|
|
3564
3842
|
});
|
|
3565
3843
|
return n.observe(t), () => n.disconnect();
|
|
3566
3844
|
}, [a?.id, o]);
|
|
3567
|
-
let
|
|
3568
|
-
manifest:
|
|
3845
|
+
let Ce = s ? /* @__PURE__ */ z(Xn, { userGoal: s }, c) : null, we = f ? q(f.subagentId) : void 0, Te = f && we ? /* @__PURE__ */ z(Yn, {
|
|
3846
|
+
manifest: we,
|
|
3569
3847
|
params: f.snapshot.params,
|
|
3570
|
-
taskId:
|
|
3848
|
+
taskId: it(f.subagentId, f.entityId),
|
|
3571
3849
|
resumeSeed: {
|
|
3572
3850
|
history: f.snapshot.history,
|
|
3573
3851
|
activity: f.snapshot.activity
|
|
3574
3852
|
}
|
|
3575
|
-
}, p) : null,
|
|
3576
|
-
manifest:
|
|
3853
|
+
}, p) : null, Ee = g ? q(g.subagentId) : void 0, De = g && Ee ? /* @__PURE__ */ z(Zn, {
|
|
3854
|
+
manifest: Ee,
|
|
3577
3855
|
extraDestinations: g.extraDestinations
|
|
3578
|
-
}, _) : null,
|
|
3579
|
-
manifest:
|
|
3856
|
+
}, _) : null, Oe = x ? q(x.subagentId) : void 0, ke = x && Oe ? /* @__PURE__ */ z(Yn, {
|
|
3857
|
+
manifest: Oe,
|
|
3580
3858
|
params: x.params,
|
|
3581
3859
|
extraDestinations: x.extraDestinations
|
|
3582
|
-
}, S) : null,
|
|
3583
|
-
manifest:
|
|
3860
|
+
}, S) : null, Ae = C ? q(C.subagentId) : void 0, je = C && Ae ? /* @__PURE__ */ z(Yn, {
|
|
3861
|
+
manifest: Ae,
|
|
3584
3862
|
params: C.params,
|
|
3585
3863
|
taskId: C.taskId,
|
|
3586
3864
|
openingMessage: C.openingMessage
|
|
3587
3865
|
}, w) : null;
|
|
3588
|
-
return o ? /* @__PURE__ */
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
/* @__PURE__ */
|
|
3595
|
-
style: { width:
|
|
3866
|
+
return o ? /* @__PURE__ */ B(R, { children: [
|
|
3867
|
+
Ce,
|
|
3868
|
+
Te,
|
|
3869
|
+
De,
|
|
3870
|
+
ke,
|
|
3871
|
+
je,
|
|
3872
|
+
/* @__PURE__ */ B("div", {
|
|
3873
|
+
style: { width: M.width },
|
|
3596
3874
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
3597
3875
|
children: [
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
width:
|
|
3600
|
-
min:
|
|
3601
|
-
max:
|
|
3602
|
-
onResize:
|
|
3603
|
-
onCommit:
|
|
3604
|
-
onReset:
|
|
3876
|
+
/* @__PURE__ */ z(pn, {
|
|
3877
|
+
width: M.width,
|
|
3878
|
+
min: M.min,
|
|
3879
|
+
max: M.max,
|
|
3880
|
+
onResize: M.set,
|
|
3881
|
+
onCommit: M.commit,
|
|
3882
|
+
onReset: M.reset
|
|
3605
3883
|
}),
|
|
3606
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ B("div", {
|
|
3607
3885
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
3608
3886
|
children: [
|
|
3609
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ z("span", {
|
|
3610
3888
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
3611
3889
|
children: a ? a.title : "Agentico"
|
|
3612
3890
|
}),
|
|
3613
|
-
a?.thread &&
|
|
3614
|
-
icon:
|
|
3615
|
-
ariaLabel:
|
|
3616
|
-
title:
|
|
3891
|
+
a?.thread && E && G && /* @__PURE__ */ z(n, {
|
|
3892
|
+
icon: W ? "activity" : "message-square",
|
|
3893
|
+
ariaLabel: W ? D.hideEvents : D.showEvents,
|
|
3894
|
+
title: W ? D.hideEvents : D.showEvents,
|
|
3617
3895
|
variant: "link",
|
|
3618
|
-
className: `p-1 ${
|
|
3619
|
-
onClick: () =>
|
|
3896
|
+
className: `p-1 ${W ? "text-primary" : "text-muted-foreground"}`,
|
|
3897
|
+
onClick: () => oe(!W)
|
|
3620
3898
|
}),
|
|
3621
|
-
T && /* @__PURE__ */
|
|
3899
|
+
T && /* @__PURE__ */ z(dr, {
|
|
3622
3900
|
scopeId: T.id,
|
|
3623
3901
|
currentTaskId: a?.id ?? null,
|
|
3624
|
-
open:
|
|
3625
|
-
onOpenChange:
|
|
3626
|
-
onNewChat:
|
|
3902
|
+
open: ee,
|
|
3903
|
+
onOpenChange: k,
|
|
3904
|
+
onNewChat: re,
|
|
3627
3905
|
onSelect: (e, t, n) => h(e, t, n),
|
|
3628
3906
|
onArchivedCurrent: m
|
|
3629
3907
|
}),
|
|
3630
|
-
/* @__PURE__ */
|
|
3908
|
+
se && /* @__PURE__ */ z(n, {
|
|
3909
|
+
icon: "settings",
|
|
3910
|
+
ariaLabel: D.settingsTitle,
|
|
3911
|
+
title: D.settingsTitle,
|
|
3912
|
+
variant: "link",
|
|
3913
|
+
className: "p-1 text-muted-foreground",
|
|
3914
|
+
onClick: K.open
|
|
3915
|
+
}),
|
|
3916
|
+
/* @__PURE__ */ z(mn, {})
|
|
3631
3917
|
]
|
|
3632
3918
|
}),
|
|
3633
|
-
/* @__PURE__ */
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3919
|
+
/* @__PURE__ */ z(rr, {}),
|
|
3920
|
+
/* @__PURE__ */ z("div", {
|
|
3921
|
+
ref: O,
|
|
3922
|
+
className: `flex-1 overflow-y-auto px-3 pb-2 ${X ? "min-h-24" : "min-h-0"}`,
|
|
3923
|
+
children: /* @__PURE__ */ z("div", {
|
|
3924
|
+
ref: Se,
|
|
3638
3925
|
className: "pt-2",
|
|
3639
|
-
children: a ? /* @__PURE__ */
|
|
3640
|
-
T && a.thread && /* @__PURE__ */
|
|
3926
|
+
children: a ? /* @__PURE__ */ B(R, { children: [
|
|
3927
|
+
T && a.thread && /* @__PURE__ */ z(er, {
|
|
3641
3928
|
scopeId: T.id,
|
|
3642
3929
|
thread: a.thread,
|
|
3643
3930
|
taskId: a.id,
|
|
3644
|
-
scrollRef:
|
|
3931
|
+
scrollRef: O,
|
|
3645
3932
|
busy: a.agent.running,
|
|
3646
|
-
showEvents:
|
|
3933
|
+
showEvents: W,
|
|
3647
3934
|
onLoad: () => {
|
|
3648
|
-
|
|
3935
|
+
be.current = !1;
|
|
3649
3936
|
},
|
|
3650
3937
|
onContinue: (e) => h(e.subagentId, e.entityId, e)
|
|
3651
3938
|
}),
|
|
3652
|
-
a.manualEntry &&
|
|
3939
|
+
a.manualEntry && P.length === 0 && /* @__PURE__ */ z("p", {
|
|
3653
3940
|
className: "text-xs text-muted-foreground",
|
|
3654
3941
|
children: a.manualEntry.prompt
|
|
3655
3942
|
}),
|
|
3656
|
-
/* @__PURE__ */
|
|
3943
|
+
/* @__PURE__ */ z(tn, {
|
|
3657
3944
|
activity: H,
|
|
3658
|
-
questions:
|
|
3659
|
-
docked:
|
|
3660
|
-
pinUserMessages: !
|
|
3661
|
-
messageActions:
|
|
3945
|
+
questions: Y,
|
|
3946
|
+
docked: X,
|
|
3947
|
+
pinUserMessages: !X,
|
|
3948
|
+
messageActions: J,
|
|
3662
3949
|
speaker: a.speaker,
|
|
3663
|
-
events:
|
|
3950
|
+
events: fe
|
|
3664
3951
|
}),
|
|
3665
|
-
a.panelExtra && /* @__PURE__ */
|
|
3952
|
+
a.panelExtra && /* @__PURE__ */ z("div", {
|
|
3666
3953
|
className: "mt-3",
|
|
3667
3954
|
children: a.panelExtra
|
|
3668
3955
|
}),
|
|
3669
|
-
U.length > 0 && /* @__PURE__ */
|
|
3956
|
+
U.length > 0 && /* @__PURE__ */ z(tn, {
|
|
3670
3957
|
activity: U,
|
|
3671
|
-
questions:
|
|
3672
|
-
docked:
|
|
3673
|
-
pinUserMessages: !
|
|
3674
|
-
messageActions:
|
|
3958
|
+
questions: Y,
|
|
3959
|
+
docked: X,
|
|
3960
|
+
pinUserMessages: !X,
|
|
3961
|
+
messageActions: J,
|
|
3675
3962
|
speaker: a.speaker,
|
|
3676
|
-
events:
|
|
3963
|
+
events: pe
|
|
3677
3964
|
}),
|
|
3678
|
-
!a.agent.running && a.agent.error && /* @__PURE__ */
|
|
3965
|
+
!a.agent.running && a.agent.error && /* @__PURE__ */ B("div", {
|
|
3679
3966
|
className: "mt-2 flex items-center gap-2",
|
|
3680
3967
|
children: [
|
|
3681
|
-
/* @__PURE__ */
|
|
3968
|
+
/* @__PURE__ */ z("p", {
|
|
3682
3969
|
className: "flex-1 text-xs text-destructive",
|
|
3683
3970
|
children: a.agent.error
|
|
3684
3971
|
}),
|
|
3685
|
-
/* @__PURE__ */
|
|
3686
|
-
label:
|
|
3972
|
+
/* @__PURE__ */ z(n, {
|
|
3973
|
+
label: D.retry,
|
|
3687
3974
|
variant: "secondary",
|
|
3688
3975
|
className: "shrink-0",
|
|
3689
3976
|
onClick: () => {
|
|
3690
3977
|
let e = [...a.agent.activity].reverse().find((e) => e.kind === "user");
|
|
3691
3978
|
if (e && a.agent.rewindable(e.id)) {
|
|
3692
|
-
|
|
3979
|
+
ge(e);
|
|
3693
3980
|
return;
|
|
3694
3981
|
}
|
|
3695
|
-
a.agent.sendMessage(
|
|
3982
|
+
a.agent.sendMessage(D.retryMessage, { retry: !0 }).then((e) => {
|
|
3696
3983
|
e && a.onApplied(e);
|
|
3697
3984
|
});
|
|
3698
3985
|
}
|
|
3699
3986
|
}),
|
|
3700
|
-
!a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */
|
|
3701
|
-
label:
|
|
3987
|
+
!a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ z(n, {
|
|
3988
|
+
label: D.continueWithoutAi,
|
|
3702
3989
|
variant: "secondary",
|
|
3703
3990
|
className: "shrink-0",
|
|
3704
3991
|
onClick: () => {
|
|
3705
|
-
if (
|
|
3706
|
-
|
|
3992
|
+
if (ye) {
|
|
3993
|
+
v(ye.id, y);
|
|
3707
3994
|
return;
|
|
3708
3995
|
}
|
|
3709
3996
|
let e = a.agent.runFallback();
|
|
@@ -3712,84 +3999,84 @@ function Yn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
|
|
|
3712
3999
|
})
|
|
3713
4000
|
]
|
|
3714
4001
|
})
|
|
3715
|
-
] }) : d.length > 0 ? /* @__PURE__ */
|
|
4002
|
+
] }) : d.length > 0 ? /* @__PURE__ */ z(ur, { messages: d }) : u ? /* @__PURE__ */ z(lr, { card: u }) : /* @__PURE__ */ z("p", {
|
|
3716
4003
|
className: "text-xs text-muted-foreground",
|
|
3717
|
-
children: l ??
|
|
4004
|
+
children: l ?? D.orchestratorStarterHint
|
|
3718
4005
|
})
|
|
3719
4006
|
})
|
|
3720
4007
|
}),
|
|
3721
|
-
a &&
|
|
3722
|
-
"aria-label":
|
|
4008
|
+
a && X ? /* @__PURE__ */ B("section", {
|
|
4009
|
+
"aria-label": D.pendingQuestions,
|
|
3723
4010
|
className: "flex min-h-0 shrink flex-col border-t border-border/60",
|
|
3724
4011
|
children: [
|
|
3725
|
-
a.panelActions && /* @__PURE__ */
|
|
4012
|
+
a.panelActions && /* @__PURE__ */ z("div", {
|
|
3726
4013
|
className: "shrink-0 px-4 pt-3",
|
|
3727
4014
|
children: a.panelActions
|
|
3728
4015
|
}),
|
|
3729
|
-
/* @__PURE__ */
|
|
4016
|
+
/* @__PURE__ */ z("div", {
|
|
3730
4017
|
className: "min-h-0 overflow-y-auto px-4 py-3",
|
|
3731
|
-
children: /* @__PURE__ */
|
|
3732
|
-
entry:
|
|
3733
|
-
part:
|
|
3734
|
-
questions:
|
|
4018
|
+
children: /* @__PURE__ */ z(Xt, {
|
|
4019
|
+
entry: X.entry,
|
|
4020
|
+
part: X.part,
|
|
4021
|
+
questions: Y,
|
|
3735
4022
|
autoFocus: !0
|
|
3736
|
-
}, `${
|
|
4023
|
+
}, `${X.entry.id}:${X.part.id}`)
|
|
3737
4024
|
}),
|
|
3738
|
-
a.agent.running && /* @__PURE__ */
|
|
4025
|
+
a.agent.running && /* @__PURE__ */ z("div", {
|
|
3739
4026
|
className: "flex shrink-0 justify-end px-4 pb-3",
|
|
3740
|
-
children: /* @__PURE__ */
|
|
4027
|
+
children: /* @__PURE__ */ z(n, {
|
|
3741
4028
|
icon: "square",
|
|
3742
|
-
label:
|
|
4029
|
+
label: D.stop,
|
|
3743
4030
|
variant: "secondary",
|
|
3744
4031
|
onClick: a.agent.stop
|
|
3745
4032
|
})
|
|
3746
4033
|
})
|
|
3747
4034
|
]
|
|
3748
|
-
}) : /* @__PURE__ */
|
|
4035
|
+
}) : /* @__PURE__ */ B("div", {
|
|
3749
4036
|
className: "border-t border-border/60 px-4 py-3",
|
|
3750
|
-
children: [a?.panelActions && /* @__PURE__ */
|
|
4037
|
+
children: [a?.panelActions && /* @__PURE__ */ z("div", {
|
|
3751
4038
|
className: "mb-2",
|
|
3752
4039
|
children: a.panelActions
|
|
3753
|
-
}), a ? /* @__PURE__ */
|
|
4040
|
+
}), a ? /* @__PURE__ */ z(ar, {
|
|
3754
4041
|
task: a,
|
|
3755
|
-
editing:
|
|
4042
|
+
editing: te,
|
|
3756
4043
|
onCancelEdit: () => A(null),
|
|
3757
|
-
onSendEdit: (e, t) =>
|
|
3758
|
-
}, a.id) : /* @__PURE__ */
|
|
4044
|
+
onSendEdit: (e, t) => ge(e, t)
|
|
4045
|
+
}, a.id) : /* @__PURE__ */ z(or, {})]
|
|
3759
4046
|
}),
|
|
3760
|
-
ne && /* @__PURE__ */
|
|
3761
|
-
title:
|
|
3762
|
-
onClose: () =>
|
|
3763
|
-
onYes: async () => (
|
|
3764
|
-
children: [/* @__PURE__ */
|
|
4047
|
+
ne && /* @__PURE__ */ B(b, {
|
|
4048
|
+
title: D.rewindTitle,
|
|
4049
|
+
onClose: () => j(null),
|
|
4050
|
+
onYes: async () => (me(ne.entry, ne.text), !0),
|
|
4051
|
+
children: [/* @__PURE__ */ z("p", {
|
|
3765
4052
|
className: "text-sm",
|
|
3766
|
-
children:
|
|
3767
|
-
}), /* @__PURE__ */
|
|
4053
|
+
children: D.rewindText
|
|
4054
|
+
}), /* @__PURE__ */ z("ul", {
|
|
3768
4055
|
className: "mt-2 list-disc space-y-0.5 ps-5 text-sm text-muted-foreground",
|
|
3769
|
-
children: ne.steps.slice(0, 8).map((e) => /* @__PURE__ */
|
|
4056
|
+
children: ne.steps.slice(0, 8).map((e) => /* @__PURE__ */ z("li", { children: e }, e))
|
|
3770
4057
|
})]
|
|
3771
4058
|
})
|
|
3772
4059
|
]
|
|
3773
4060
|
})
|
|
3774
|
-
] }) : /* @__PURE__ */
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
4061
|
+
] }) : /* @__PURE__ */ B(R, { children: [
|
|
4062
|
+
Ce,
|
|
4063
|
+
Te,
|
|
4064
|
+
De,
|
|
4065
|
+
ke,
|
|
4066
|
+
je
|
|
3780
4067
|
] });
|
|
3781
4068
|
}
|
|
3782
4069
|
//#endregion
|
|
3783
4070
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
3784
|
-
function
|
|
3785
|
-
let { setPageContext: n } =
|
|
3786
|
-
|
|
4071
|
+
function pr(e, t) {
|
|
4072
|
+
let { setPageContext: n } = Et(), r = I(crypto.randomUUID()).current;
|
|
4073
|
+
N(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
3787
4074
|
}
|
|
3788
4075
|
//#endregion
|
|
3789
4076
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
3790
|
-
function
|
|
3791
|
-
let { registerComponentAnchor: o } =
|
|
3792
|
-
c.current = n,
|
|
4077
|
+
function mr(e, t, n, r, i = !0, a) {
|
|
4078
|
+
let { registerComponentAnchor: o } = Et(), s = I(crypto.randomUUID()).current, c = I(n);
|
|
4079
|
+
c.current = n, N(() => {
|
|
3793
4080
|
if (i) return o(s, {
|
|
3794
4081
|
subagentId: e,
|
|
3795
4082
|
componentKey: t,
|
|
@@ -3806,6 +4093,6 @@ function Zn(e, t, n, r, i = !0, a) {
|
|
|
3806
4093
|
]);
|
|
3807
4094
|
}
|
|
3808
4095
|
//#endregion
|
|
3809
|
-
export {
|
|
4096
|
+
export { an as AGENTICO_MAX_WIDTH, rn as AGENTICO_MIN_WIDTH, pt as AGENTICO_SETTING_KEYS, nn as AGENTICO_WIDTH, on as AGENTICO_WIDTH_STORAGE_KEY, fr as Agentico, Tt as AgenticoProvider, rr as AgenticoSettingsModal, mn as AgenticoToggle, mt as DEFAULT_AGENTICO_SETTINGS, ie as DEFAULT_REASONING_PART_ID, V as DEFAULT_TEXT_PART_ID, De as JSON_EXPORT_DESTINATION_ID, Se as MICRO_PROMPT_REGISTRY, Ct as ORCHESTRATOR_TASK_ID, lt as PREVIEW_LIMIT, ct as PREVIEW_MAX, xe as SUMMARY_MICRO_PROMPT, Pe as agenticoDe, Me as agenticoEn, Ne as agenticoIt, pe as agenticoPromptsEn, me as agenticoPromptsIt, ft as agenticoTranslations, Ce as applyMicroPrompts, vt as browserSettingsStore, $e as chatHasPersonMessage, Q as chatStartedAt, at as chatThreadOf, Qe as chatTitle, ge as configureAgenticoPrompts, Le as configureEntityChatStore, le as createCrossAgentTools, W as defineSubagent, ot as earlierSessions, ht as effectiveSettings, it as entityChatTaskId, we as extractErrorMessage, Te as extractJsonBlock, q as findSubagentManifest, ae as formatQuestionAnswers, J as getAgenticoPrompts, je as getDestinationRegistry, qe as getEntityChat, Vn as getSubagentControls, K as getSubagentRegistry, In as getSubagentReport, Re as hasEntityChatBackend, dt as imagePreviews, Oe as jsonExportDestination, rt as listEntityChats, U as messagePartsText, Ge as onEntityChatsChange, st as placeEvents, ce as registerCrossAgentTools, Ae as registerDestinations, Bn as registerSubagentControls, Fn as registerSubagentReports, G as registerSubagents, nt as removeEntityChat, tt as renameEntityChat, be as renderRegistryCli, ye as renderSubagentCli, _e as resetAgenticoPrompts, Je as saveEntityChat, gt as shownSettings, Ve as syncEntityChats, ue as toJsonSchema, de as toMcpTool, H as upsertMessagePart, En as useAgent, Et as useAgentico, $ as useAgenticoI18n, pr as useAgenticoPageContext, St as useAgenticoSettings, mr as useSubagentComponentContext };
|
|
3810
4097
|
|
|
3811
4098
|
//# sourceMappingURL=index.mjs.map
|