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