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