@llmnative/agentico 0.1.0 → 0.3.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 +6 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1054 -680
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/agentDefinition.d.ts +79 -0
- package/dist/types/domain/entityChatStore.d.ts +9 -0
- package/dist/types/domain/messageParts.d.ts +79 -0
- package/dist/types/domain/subagentManifest.d.ts +14 -0
- package/dist/types/i18n/types.d.ts +8 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/presentation/AgentActivityLog.d.ts +16 -4
- package/dist/types/presentation/AgenticoContext.d.ts +22 -1
- package/dist/types/presentation/SubagentRunner.d.ts +4 -14
- package/dist/types/presentation/subagentControls.d.ts +28 -0
- package/dist/types/presentation/useAgent.d.ts +21 -1
- package/llms.txt +9 -3
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,53 +1,72 @@
|
|
|
1
1
|
import { zodToJsonSchema as e } from "zod-to-json-schema";
|
|
2
|
-
import { ActionButton as t, Badge as n,
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { ActionButton as t, Badge as n, ChatMarkdown as r, ChatQuestions as i, ChatReasoning as a, Chatbot as o, Code as s, Dropdown as c, DropdownItem as l, Icon as u, PromptUtils as d, Tree as f, getAIModelCatalog as p, interpolate as m, parseAIModelRef as h, proxyFetch as g, useAIProviderRegistry as _, useI18n as v, useProxy as y } from "@llmnative/react";
|
|
3
|
+
import { createContext as b, useCallback as x, useContext as S, useEffect as C, useLayoutEffect as w, useMemo as T, useRef as E, useState as D } from "react";
|
|
4
|
+
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
5
|
+
//#region src/domain/messageParts.ts
|
|
6
|
+
var j = "text", M = "reasoning";
|
|
7
|
+
function N(e, t, n) {
|
|
8
|
+
let r = e.findIndex((e) => e.type === t.type && e.id === t.id);
|
|
9
|
+
if (r >= 0) return e.map((e, n) => n === r ? t : e);
|
|
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");
|
|
11
|
+
return (t.type === "tool" || t.type === "reasoning") && a >= 0 ? [
|
|
12
|
+
...i.slice(0, a),
|
|
13
|
+
t,
|
|
14
|
+
...i.slice(a)
|
|
15
|
+
] : [...i, t];
|
|
16
|
+
}
|
|
17
|
+
function P(e) {
|
|
18
|
+
return e.filter((e) => e.type === "text").map((e) => e.text).filter(Boolean).join("\n\n");
|
|
19
|
+
}
|
|
20
|
+
function F(e, t) {
|
|
21
|
+
return t.map((t, n) => `${t.header ?? e[n]?.header ?? e[n]?.question ?? t.id ?? `${n + 1}`}: ${t.values.join(", ")}`).join("\n");
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
5
24
|
//#region src/domain/defineSubagent.ts
|
|
6
|
-
function
|
|
25
|
+
function I(e) {
|
|
7
26
|
return e;
|
|
8
27
|
}
|
|
9
28
|
//#endregion
|
|
10
29
|
//#region src/domain/subagentRegistry.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
|
|
30
|
+
var L = [];
|
|
31
|
+
function R(e) {
|
|
32
|
+
L = e;
|
|
14
33
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
34
|
+
function z() {
|
|
35
|
+
return L.length === 0 && typeof console < "u" && console.warn("[agentico] getSubagentRegistry() letto a registro vuoto — registerSubagents() non è ancora stato chiamato?"), L;
|
|
17
36
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
37
|
+
function B(e) {
|
|
38
|
+
return L.find((t) => t.id === e);
|
|
20
39
|
}
|
|
21
40
|
//#endregion
|
|
22
41
|
//#region src/domain/crossAgentTools.ts
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
|
|
42
|
+
var V = [];
|
|
43
|
+
function H(...e) {
|
|
44
|
+
V = e;
|
|
26
45
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
46
|
+
function U(e) {
|
|
47
|
+
return V.flatMap((t) => t(e));
|
|
29
48
|
}
|
|
30
49
|
//#endregion
|
|
31
50
|
//#region src/domain/mcpTool.ts
|
|
32
|
-
function
|
|
51
|
+
function W(t) {
|
|
33
52
|
let { $schema: n, ...r } = e(t, {
|
|
34
53
|
target: "jsonSchema7",
|
|
35
54
|
$refStrategy: "none"
|
|
36
55
|
});
|
|
37
56
|
return r;
|
|
38
57
|
}
|
|
39
|
-
function
|
|
58
|
+
function G(e, t, n, r) {
|
|
40
59
|
return {
|
|
41
60
|
name: e,
|
|
42
61
|
description: t,
|
|
43
|
-
inputSchema:
|
|
44
|
-
...r ? { outputSchema:
|
|
62
|
+
inputSchema: W(n),
|
|
63
|
+
...r ? { outputSchema: W(r) } : {}
|
|
45
64
|
};
|
|
46
65
|
}
|
|
47
66
|
//#endregion
|
|
48
67
|
//#region src/domain/subagentUsageCard.ts
|
|
49
|
-
function
|
|
50
|
-
let t =
|
|
68
|
+
function K(e) {
|
|
69
|
+
let t = W(e.inputSchema), n = t.properties ?? {}, r = new Set(t.required ?? []);
|
|
51
70
|
return Object.entries(n).map(([t, n]) => {
|
|
52
71
|
let i = typeof n.description == "string" ? n.description : "";
|
|
53
72
|
return {
|
|
@@ -61,7 +80,7 @@ function R(e) {
|
|
|
61
80
|
}
|
|
62
81
|
//#endregion
|
|
63
82
|
//#region src/domain/prompts.ts
|
|
64
|
-
var
|
|
83
|
+
var q = {
|
|
65
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.",
|
|
66
85
|
responseRules: [
|
|
67
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.",
|
|
@@ -89,7 +108,7 @@ var z = {
|
|
|
89
108
|
"block requested above, never before it and never instead of it."
|
|
90
109
|
].join(" "),
|
|
91
110
|
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."
|
|
92
|
-
},
|
|
111
|
+
}, J = {
|
|
93
112
|
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.",
|
|
94
113
|
responseRules: [
|
|
95
114
|
"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.",
|
|
@@ -117,26 +136,26 @@ var z = {
|
|
|
117
136
|
"richiesto sopra, mai prima e mai al posto suo."
|
|
118
137
|
].join(" "),
|
|
119
138
|
multipleCandidates: "Più subagent sono candidati su questa pagina — chiedi all'utente quale intende se non è chiaro dal suo messaggio, prima di procedere."
|
|
120
|
-
},
|
|
139
|
+
}, Y = q;
|
|
121
140
|
function ee(e) {
|
|
122
|
-
|
|
123
|
-
...
|
|
141
|
+
Y = {
|
|
142
|
+
...Y,
|
|
124
143
|
...e
|
|
125
144
|
};
|
|
126
145
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
146
|
+
function X() {
|
|
147
|
+
return Y;
|
|
129
148
|
}
|
|
130
149
|
function te() {
|
|
131
|
-
|
|
150
|
+
Y = q;
|
|
132
151
|
}
|
|
133
152
|
//#endregion
|
|
134
153
|
//#region src/domain/cli/renderManifestCli.ts
|
|
135
154
|
function ne(e, t) {
|
|
136
155
|
return `${e} ${t.map((e) => e.required ? `--${e.key} <${e.type}>` : `[--${e.key} <${e.type}>]`).join(" ")}`.trim();
|
|
137
156
|
}
|
|
138
|
-
function
|
|
139
|
-
let n =
|
|
157
|
+
function re(e, t) {
|
|
158
|
+
let n = K(t), r = ne(t.name, n), i = n.map((e) => ` --${e.key} <${e.type}> (${e.required ? "required" : "optional"})${e.description ? ` — ${e.description}` : ""}`);
|
|
140
159
|
return [
|
|
141
160
|
`COMMAND: ${e} ${t.name}`,
|
|
142
161
|
` ${t.summary}`,
|
|
@@ -148,46 +167,46 @@ function U(e, t) {
|
|
|
148
167
|
...i,
|
|
149
168
|
"",
|
|
150
169
|
" OUTPUT",
|
|
151
|
-
|
|
170
|
+
ie(t.describeOutput(), 4),
|
|
152
171
|
(t.example, ""),
|
|
153
172
|
t.example ? " EXAMPLE" : "",
|
|
154
173
|
t.example ? ` ${t.example}` : ""
|
|
155
174
|
].filter((e) => e !== "").join("\n");
|
|
156
175
|
}
|
|
157
|
-
function
|
|
176
|
+
function ie(e, t) {
|
|
158
177
|
let n = " ".repeat(t);
|
|
159
178
|
return e.split("\n").map((e) => e && n + e).join("\n");
|
|
160
179
|
}
|
|
161
|
-
function
|
|
180
|
+
function ae(e) {
|
|
162
181
|
return [
|
|
163
182
|
"NAME",
|
|
164
183
|
` ${e.id} — ${e.label}`,
|
|
165
184
|
"",
|
|
166
185
|
"DESCRIPTION",
|
|
167
|
-
|
|
186
|
+
ie(e.description, 2),
|
|
168
187
|
"",
|
|
169
|
-
...e.commands.map((t) =>
|
|
188
|
+
...e.commands.map((t) => re(e.id, t))
|
|
170
189
|
].join("\n");
|
|
171
190
|
}
|
|
172
|
-
function
|
|
173
|
-
return e.length === 0 ?
|
|
191
|
+
function oe(e) {
|
|
192
|
+
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");
|
|
174
193
|
}
|
|
175
194
|
//#endregion
|
|
176
195
|
//#region src/domain/microPrompts.ts
|
|
177
|
-
var
|
|
196
|
+
var se = {
|
|
178
197
|
id: "closing-summary",
|
|
179
198
|
get text() {
|
|
180
|
-
return
|
|
199
|
+
return X().closingSummary;
|
|
181
200
|
}
|
|
182
|
-
},
|
|
183
|
-
function
|
|
201
|
+
}, ce = { [se.id]: se };
|
|
202
|
+
function le(e, t) {
|
|
184
203
|
if (!t || t.length === 0) return e;
|
|
185
|
-
let n = t.map((e) =>
|
|
204
|
+
let n = t.map((e) => ce[e]?.text).filter((e) => !!e);
|
|
186
205
|
return n.length === 0 ? e : `${e}\n\n${n.join("\n")}`;
|
|
187
206
|
}
|
|
188
207
|
//#endregion
|
|
189
208
|
//#region src/domain/extractErrorMessage.ts
|
|
190
|
-
function
|
|
209
|
+
function Z(e) {
|
|
191
210
|
if (e instanceof Error) return e.message;
|
|
192
211
|
if (typeof e == "object" && e) {
|
|
193
212
|
let t = e;
|
|
@@ -206,13 +225,13 @@ function K(e) {
|
|
|
206
225
|
}
|
|
207
226
|
//#endregion
|
|
208
227
|
//#region src/domain/extractJsonBlock.ts
|
|
209
|
-
function
|
|
228
|
+
function ue(e) {
|
|
210
229
|
let t = e.match(/```(?:json)?\s*\n?([\s\S]*?)```/i);
|
|
211
230
|
if (t) return t[1].trim();
|
|
212
231
|
let n = e.replace(/^```json\s*/i, "").replace(/^```\s*/i, "").replace(/```\s*$/, "").trim();
|
|
213
|
-
return
|
|
232
|
+
return de(n) ?? n;
|
|
214
233
|
}
|
|
215
|
-
function
|
|
234
|
+
function de(e) {
|
|
216
235
|
let t = e.search(/[{[]/);
|
|
217
236
|
if (t === -1) return null;
|
|
218
237
|
let n = e[t], r = n === "{" ? "}" : "]", i = 0, a = !1, o = !1;
|
|
@@ -233,8 +252,8 @@ function ce(e) {
|
|
|
233
252
|
}
|
|
234
253
|
//#endregion
|
|
235
254
|
//#region src/domain/jsonExportDestination.ts
|
|
236
|
-
var
|
|
237
|
-
id:
|
|
255
|
+
var fe = "json-export", pe = {
|
|
256
|
+
id: fe,
|
|
238
257
|
label: "Export as JSON",
|
|
239
258
|
async apply(e) {
|
|
240
259
|
let t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t);
|
|
@@ -245,23 +264,23 @@ var le = "json-export", q = {
|
|
|
245
264
|
URL.revokeObjectURL(n);
|
|
246
265
|
}
|
|
247
266
|
}
|
|
248
|
-
},
|
|
249
|
-
function
|
|
250
|
-
|
|
267
|
+
}, me = {};
|
|
268
|
+
function he(e) {
|
|
269
|
+
me = e;
|
|
251
270
|
}
|
|
252
|
-
function
|
|
271
|
+
function ge() {
|
|
253
272
|
return {
|
|
254
|
-
[
|
|
255
|
-
...
|
|
273
|
+
[pe.id]: pe,
|
|
274
|
+
...me
|
|
256
275
|
};
|
|
257
276
|
}
|
|
258
277
|
//#endregion
|
|
259
278
|
//#region src/domain/entityChatStore.ts
|
|
260
|
-
var
|
|
261
|
-
function
|
|
262
|
-
|
|
279
|
+
var _e = "llmnative.agentico.entityChat";
|
|
280
|
+
function ve(e) {
|
|
281
|
+
_e = e.storageKey;
|
|
263
282
|
}
|
|
264
|
-
function
|
|
283
|
+
function ye(e) {
|
|
265
284
|
if (!e || typeof e != "object") return null;
|
|
266
285
|
let t = e;
|
|
267
286
|
if (typeof t.entityId != "string") return null;
|
|
@@ -273,43 +292,41 @@ function me(e) {
|
|
|
273
292
|
scopeId: n
|
|
274
293
|
};
|
|
275
294
|
}
|
|
276
|
-
function
|
|
295
|
+
function be() {
|
|
277
296
|
try {
|
|
278
|
-
let e = localStorage.getItem(
|
|
297
|
+
let e = localStorage.getItem(_e);
|
|
279
298
|
if (!e) return [];
|
|
280
299
|
let t = JSON.parse(e);
|
|
281
|
-
return Array.isArray(t) ? t.map(
|
|
300
|
+
return Array.isArray(t) ? t.map(ye).filter((e) => e !== null) : [];
|
|
282
301
|
} catch {
|
|
283
302
|
return [];
|
|
284
303
|
}
|
|
285
304
|
}
|
|
286
|
-
function
|
|
305
|
+
function xe(e) {
|
|
287
306
|
try {
|
|
288
|
-
localStorage.setItem(
|
|
307
|
+
localStorage.setItem(_e, JSON.stringify(e));
|
|
289
308
|
} catch {}
|
|
290
309
|
}
|
|
291
|
-
var
|
|
292
|
-
function
|
|
293
|
-
let r =
|
|
294
|
-
return
|
|
310
|
+
var Se = (e, t, n) => `${e}:${t}:${n}`;
|
|
311
|
+
function Ce(e, t, n) {
|
|
312
|
+
let r = Se(e, t, n);
|
|
313
|
+
return be().find((e) => Se(e.scopeId, e.subagentId, e.entityId) === r) ?? null;
|
|
295
314
|
}
|
|
296
|
-
function
|
|
297
|
-
let t =
|
|
315
|
+
function we(e) {
|
|
316
|
+
let t = Se(e.scopeId, e.subagentId, e.entityId), n = be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== t);
|
|
298
317
|
n.push({
|
|
299
318
|
...e,
|
|
300
319
|
savedAt: Date.now()
|
|
301
|
-
}),
|
|
320
|
+
}), xe(n);
|
|
302
321
|
}
|
|
303
|
-
function
|
|
304
|
-
let r =
|
|
305
|
-
|
|
322
|
+
function Te(e, t, n) {
|
|
323
|
+
let r = Se(e, t, n);
|
|
324
|
+
xe(be().filter((e) => Se(e.scopeId, e.subagentId, e.entityId) !== r));
|
|
306
325
|
}
|
|
307
|
-
function
|
|
308
|
-
return
|
|
326
|
+
function Ee(e) {
|
|
327
|
+
return be().filter((t) => t.scopeId === e).sort((e, t) => t.savedAt - e.savedAt);
|
|
309
328
|
}
|
|
310
|
-
|
|
311
|
-
//#region src/i18n/de.ts
|
|
312
|
-
var be = {
|
|
329
|
+
var De = (e, t) => `entitychat-${e}-${t}`, Oe = {
|
|
313
330
|
modelLabel: "Modell",
|
|
314
331
|
modelsLoading: "Wird geladen…",
|
|
315
332
|
noModelsAvailable: "Keine Modelle verfügbar",
|
|
@@ -339,6 +356,9 @@ var be = {
|
|
|
339
356
|
tooManyToolTurns: "Zu viele aufeinanderfolgende Werkzeugaufrufe — das bisher gesammelte deterministische Ergebnis wird verwendet.",
|
|
340
357
|
aiDisabledFallback: "AI deaktiviert — das deterministische Ergebnis wird verwendet.",
|
|
341
358
|
continueWithoutAiFallback: "Weiter ohne AI — das deterministische Ergebnis wird verwendet.",
|
|
359
|
+
oneStep: "1 Schritt",
|
|
360
|
+
steps: "{count} Schritte",
|
|
361
|
+
stepsLabel: "Schritte des Agenten",
|
|
342
362
|
newInstance: "Neue Instanz von \"{label}\"",
|
|
343
363
|
chatHistory: "Chatverlauf",
|
|
344
364
|
newChat: "Neuer Chat",
|
|
@@ -346,6 +366,7 @@ var be = {
|
|
|
346
366
|
messagePlaceholder: "Nachricht schreiben…",
|
|
347
367
|
unsavedConversationConfirm: "Diese Unterhaltung wurde nicht gespeichert und geht verloren. Fortfahren?",
|
|
348
368
|
noSavedChats: "Noch keine gespeicherten Chats.",
|
|
369
|
+
archiveChat: "Archivieren",
|
|
349
370
|
noResults: "Keine Ergebnisse.",
|
|
350
371
|
retry: "Erneut versuchen",
|
|
351
372
|
retryMessage: "Erneut versuchen.",
|
|
@@ -353,7 +374,7 @@ var be = {
|
|
|
353
374
|
resumeWithAi: "Mit AI fortsetzen",
|
|
354
375
|
openPanel: "Agentenbereich öffnen",
|
|
355
376
|
closePanel: "Agentenbereich schließen"
|
|
356
|
-
},
|
|
377
|
+
}, ke = {
|
|
357
378
|
modelLabel: "Model",
|
|
358
379
|
modelsLoading: "Loading…",
|
|
359
380
|
noModelsAvailable: "No models available",
|
|
@@ -383,6 +404,9 @@ var be = {
|
|
|
383
404
|
tooManyToolTurns: "Too many consecutive tool-calling turns — using the deterministic result collected so far.",
|
|
384
405
|
aiDisabledFallback: "AI disabled — using the deterministic result.",
|
|
385
406
|
continueWithoutAiFallback: "Continuing without AI — using the deterministic result.",
|
|
407
|
+
oneStep: "1 step",
|
|
408
|
+
steps: "{count} steps",
|
|
409
|
+
stepsLabel: "Steps of the agent",
|
|
386
410
|
newInstance: "New \"{label}\" instance",
|
|
387
411
|
chatHistory: "Chat history",
|
|
388
412
|
newChat: "New chat",
|
|
@@ -390,6 +414,7 @@ var be = {
|
|
|
390
414
|
messagePlaceholder: "Write a message…",
|
|
391
415
|
unsavedConversationConfirm: "This conversation has not been saved and will be lost. Continue?",
|
|
392
416
|
noSavedChats: "No saved chats yet.",
|
|
417
|
+
archiveChat: "Archive",
|
|
393
418
|
noResults: "No results.",
|
|
394
419
|
retry: "Retry",
|
|
395
420
|
retryMessage: "Retry.",
|
|
@@ -397,7 +422,7 @@ var be = {
|
|
|
397
422
|
resumeWithAi: "Resume with AI",
|
|
398
423
|
openPanel: "Open agent panel",
|
|
399
424
|
closePanel: "Close agent panel"
|
|
400
|
-
},
|
|
425
|
+
}, Ae = {
|
|
401
426
|
modelLabel: "Modello",
|
|
402
427
|
modelsLoading: "Caricamento…",
|
|
403
428
|
noModelsAvailable: "Nessun modello disponibile",
|
|
@@ -427,6 +452,9 @@ var be = {
|
|
|
427
452
|
tooManyToolTurns: "Troppi turni di tool-calling consecutivi — uso il risultato deterministico raccolto finora.",
|
|
428
453
|
aiDisabledFallback: "AI disabilitata — uso il risultato deterministico.",
|
|
429
454
|
continueWithoutAiFallback: "Continuo senza AI — uso il risultato deterministico.",
|
|
455
|
+
oneStep: "1 passo",
|
|
456
|
+
steps: "{count} passi",
|
|
457
|
+
stepsLabel: "Passi dell'agente",
|
|
430
458
|
newInstance: "Nuova istanza di \"{label}\"",
|
|
431
459
|
chatHistory: "Storico chat",
|
|
432
460
|
newChat: "Nuova chat",
|
|
@@ -434,6 +462,7 @@ var be = {
|
|
|
434
462
|
messagePlaceholder: "Scrivi un messaggio…",
|
|
435
463
|
unsavedConversationConfirm: "Questa conversazione non è stata salvata e andrà persa. Continuare?",
|
|
436
464
|
noSavedChats: "Nessuna chat salvata ancora.",
|
|
465
|
+
archiveChat: "Archivia",
|
|
437
466
|
noResults: "Nessun risultato.",
|
|
438
467
|
retry: "Riprova",
|
|
439
468
|
retryMessage: "Riprova.",
|
|
@@ -441,27 +470,27 @@ var be = {
|
|
|
441
470
|
resumeWithAi: "Riprendi con AI",
|
|
442
471
|
openPanel: "Apri pannello agente",
|
|
443
472
|
closePanel: "Chiudi pannello agente"
|
|
444
|
-
},
|
|
445
|
-
en: { agentico:
|
|
446
|
-
it: { agentico:
|
|
447
|
-
de: { agentico:
|
|
473
|
+
}, je = {
|
|
474
|
+
en: { agentico: ke },
|
|
475
|
+
it: { agentico: Ae },
|
|
476
|
+
de: { agentico: Oe }
|
|
448
477
|
};
|
|
449
|
-
function
|
|
450
|
-
let { dict: e } =
|
|
478
|
+
function Q() {
|
|
479
|
+
let { dict: e } = v(), t = e.agentico;
|
|
451
480
|
return t ? {
|
|
452
|
-
...
|
|
481
|
+
...ke,
|
|
453
482
|
...t
|
|
454
|
-
} :
|
|
483
|
+
} : ke;
|
|
455
484
|
}
|
|
456
485
|
//#endregion
|
|
457
486
|
//#region src/presentation/AgenticoContext.tsx
|
|
458
|
-
var
|
|
459
|
-
function
|
|
460
|
-
let [n, r] =
|
|
461
|
-
|
|
487
|
+
var Me = "agentico-orchestrator", Ne = b(null);
|
|
488
|
+
function Pe({ children: e, scope: t = null }) {
|
|
489
|
+
let [n, r] = D(null), i = E(null);
|
|
490
|
+
C(() => {
|
|
462
491
|
i.current = n;
|
|
463
492
|
}, [n]);
|
|
464
|
-
let [a, o] =
|
|
493
|
+
let [a, o] = D(!1), s = x((e) => {
|
|
465
494
|
let t = i.current;
|
|
466
495
|
t && t.id !== e.id && t.onDismiss();
|
|
467
496
|
let n = t && t.id === e.id && t.savedToDisk && e.savedToDisk === void 0 ? {
|
|
@@ -469,10 +498,10 @@ function Te({ children: e, scope: t = null }) {
|
|
|
469
498
|
savedToDisk: !0
|
|
470
499
|
} : e;
|
|
471
500
|
r(n);
|
|
472
|
-
}, []), c =
|
|
501
|
+
}, []), c = x((e) => {
|
|
473
502
|
r((t) => t && t.id === e ? null : t);
|
|
474
|
-
}, []), l =
|
|
475
|
-
|
|
503
|
+
}, []), l = x(() => o((e) => !e), []), u = x(() => o(!0), []), [d, f] = D(null), [p, m] = D(void 0), [h, g] = D(void 0), [_, v] = D(void 0), [y, b] = D(null), [S, w] = D(null), [O, A] = D(void 0), [j, M] = D([]), N = x((e, t, n = null) => {
|
|
504
|
+
M((r) => {
|
|
476
505
|
let i = r.filter((t) => t.id !== e);
|
|
477
506
|
return t ? [...i, {
|
|
478
507
|
id: e,
|
|
@@ -480,30 +509,30 @@ function Te({ children: e, scope: t = null }) {
|
|
|
480
509
|
card: n
|
|
481
510
|
}] : i;
|
|
482
511
|
});
|
|
483
|
-
}, []),
|
|
484
|
-
|
|
512
|
+
}, []), P = j.length > 0 ? j[j.length - 1] : null, [F, I] = D([]), L = x((e, t) => {
|
|
513
|
+
I((n) => {
|
|
485
514
|
let r = n.filter((t) => t.id !== e);
|
|
486
515
|
return t ? [...r, {
|
|
487
516
|
id: e,
|
|
488
517
|
...t
|
|
489
518
|
}] : r;
|
|
490
519
|
});
|
|
491
|
-
}, []),
|
|
520
|
+
}, []), R = T(() => F.map((e) => ({
|
|
492
521
|
subagentId: e.subagentId,
|
|
493
522
|
componentKey: e.componentKey,
|
|
494
523
|
onResult: e.onResult,
|
|
495
524
|
pinnedEntityId: e.pinnedEntityId
|
|
496
|
-
})), [
|
|
525
|
+
})), [F]), z = T(() => {
|
|
497
526
|
let e = /* @__PURE__ */ new Map();
|
|
498
|
-
for (let t of
|
|
527
|
+
for (let t of F) e.set(t.subagentId, {
|
|
499
528
|
subagentId: t.subagentId,
|
|
500
529
|
componentKey: t.componentKey,
|
|
501
530
|
onResult: t.onResult,
|
|
502
531
|
contextInfo: t.contextInfo
|
|
503
532
|
});
|
|
504
533
|
return [...e.values()];
|
|
505
|
-
}, [
|
|
506
|
-
let t =
|
|
534
|
+
}, [F]), V = T(() => z.map((e) => {
|
|
535
|
+
let t = B(e.subagentId)?.componentContexts?.[e.componentKey];
|
|
507
536
|
if (!t) return null;
|
|
508
537
|
let n = e.contextInfo ? `${t.agenticoHint}\n${e.contextInfo}` : t.agenticoHint;
|
|
509
538
|
return {
|
|
@@ -511,26 +540,26 @@ function Te({ children: e, scope: t = null }) {
|
|
|
511
540
|
agenticoHint: n,
|
|
512
541
|
userMessage: t.userMessage
|
|
513
542
|
};
|
|
514
|
-
}).filter((e) => e !== null), [
|
|
543
|
+
}).filter((e) => e !== null), [z]), H = T(() => V.map((e) => e.userMessage), [V]), U = T(() => {
|
|
515
544
|
if (V.length === 0) return null;
|
|
516
545
|
if (V.length === 1) return V[0].agenticoHint;
|
|
517
546
|
let e = V.map((e, t) => `${t + 1}. ${e.agenticoHint}`).join("\n");
|
|
518
|
-
return `${
|
|
519
|
-
}, [V]) ??
|
|
547
|
+
return `${X().multipleCandidates}\n\n${e}`;
|
|
548
|
+
}, [V]) ?? P?.text ?? null, W = V.length > 0 ? null : P?.card ?? null, G = T(() => [...new Set(R.map((e) => e.subagentId))], [R]), K = G.length === 1 ? G[0] : G.length === 0 ? P?.card?.subagentId ?? null : null, q = x((e, t) => {
|
|
520
549
|
u();
|
|
521
550
|
let n = i.current;
|
|
522
551
|
if (n?.id === "agentico-orchestrator") return;
|
|
523
|
-
let r =
|
|
524
|
-
|
|
552
|
+
let r = K && n?.id.startsWith(`subagent-${K}-`) ? n : void 0;
|
|
553
|
+
w(r ? {
|
|
525
554
|
taskId: r.id,
|
|
526
555
|
activity: [...r.precedingActivity ?? [], ...r.agent.activity]
|
|
527
|
-
} : null), f(e), m(t?.extraDestinations), g(t?.attachments),
|
|
528
|
-
}, [u,
|
|
556
|
+
} : null), f(e), m(t?.extraDestinations), g(t?.attachments), v(t?.model), A(t?.scopedSubagentId), b(crypto.randomUUID());
|
|
557
|
+
}, [u, K]), J = x((e, t, n, a, o, s) => {
|
|
529
558
|
if (!n || !a) return;
|
|
530
559
|
let c = i.current;
|
|
531
560
|
if (!c || c.id !== n) return;
|
|
532
561
|
let l = c.agent.snapshot();
|
|
533
|
-
l && (
|
|
562
|
+
l && (we({
|
|
534
563
|
scopeId: a,
|
|
535
564
|
subagentId: e,
|
|
536
565
|
entityId: t,
|
|
@@ -542,27 +571,33 @@ function Te({ children: e, scope: t = null }) {
|
|
|
542
571
|
...e,
|
|
543
572
|
savedToDisk: !0
|
|
544
573
|
} : e));
|
|
545
|
-
}, []), [
|
|
546
|
-
u(),
|
|
574
|
+
}, []), [Y, ee] = D(null), [te, ne] = D(null), re = x((e, t, n) => {
|
|
575
|
+
u(), ee({
|
|
547
576
|
subagentId: e,
|
|
548
577
|
entityId: t,
|
|
549
578
|
snapshot: n
|
|
550
|
-
}),
|
|
551
|
-
}, [u]), [
|
|
552
|
-
u(), c(
|
|
579
|
+
}), ne(crypto.randomUUID());
|
|
580
|
+
}, [u]), [ie, ae] = D(null), [oe, se] = D(null), ce = x((e, t) => {
|
|
581
|
+
u(), c(Me), ae({
|
|
553
582
|
subagentId: e,
|
|
554
583
|
extraDestinations: t
|
|
555
|
-
}),
|
|
556
|
-
}, [u, c]), [
|
|
557
|
-
|
|
584
|
+
}), se(crypto.randomUUID());
|
|
585
|
+
}, [u, c]), [le, Z] = D(null), [ue, de] = D(null), fe = x((e, t, n) => {
|
|
586
|
+
ae(null), Z({
|
|
558
587
|
subagentId: e,
|
|
559
588
|
params: t,
|
|
560
589
|
extraDestinations: n
|
|
561
|
-
}),
|
|
562
|
-
}, []), he =
|
|
590
|
+
}), de(crypto.randomUUID());
|
|
591
|
+
}, []), [pe, me] = D(null), [he, ge] = D(null), _e = x((e, t, n) => {
|
|
592
|
+
u(), me({
|
|
593
|
+
subagentId: e,
|
|
594
|
+
params: t,
|
|
595
|
+
...n
|
|
596
|
+
}), ge(crypto.randomUUID());
|
|
597
|
+
}, [u]), ve = x(() => {
|
|
563
598
|
let e = i.current;
|
|
564
599
|
e && e.onDismiss();
|
|
565
|
-
}, []),
|
|
600
|
+
}, []), ye = T(() => ({
|
|
566
601
|
scope: t,
|
|
567
602
|
task: n,
|
|
568
603
|
isOpen: a,
|
|
@@ -570,32 +605,35 @@ function Te({ children: e, scope: t = null }) {
|
|
|
570
605
|
closeTask: c,
|
|
571
606
|
toggleOpen: l,
|
|
572
607
|
pendingGoal: d,
|
|
573
|
-
startOrchestrator:
|
|
574
|
-
pageContext:
|
|
575
|
-
pageContextCard:
|
|
576
|
-
setPageContext:
|
|
577
|
-
scopedSubagentId:
|
|
578
|
-
pendingScopedSubagentId:
|
|
579
|
-
componentAnchors:
|
|
580
|
-
anchoredUserMessages:
|
|
581
|
-
registerComponentAnchor:
|
|
608
|
+
startOrchestrator: q,
|
|
609
|
+
pageContext: U,
|
|
610
|
+
pageContextCard: W,
|
|
611
|
+
setPageContext: N,
|
|
612
|
+
scopedSubagentId: K,
|
|
613
|
+
pendingScopedSubagentId: O,
|
|
614
|
+
componentAnchors: R,
|
|
615
|
+
anchoredUserMessages: H,
|
|
616
|
+
registerComponentAnchor: L,
|
|
582
617
|
openPanel: u,
|
|
583
618
|
pendingExtraDestinations: p,
|
|
584
619
|
pendingAttachments: h,
|
|
585
620
|
pendingModel: _,
|
|
586
|
-
orchestratorRunId:
|
|
587
|
-
pendingCarryOver:
|
|
588
|
-
commitEntityChat:
|
|
589
|
-
resumeEntityChat:
|
|
590
|
-
pendingResume:
|
|
591
|
-
resumeRunId:
|
|
592
|
-
dismissForeignTask:
|
|
593
|
-
pendingManualEntry:
|
|
594
|
-
manualEntryRunId:
|
|
595
|
-
startManualEntry:
|
|
596
|
-
pendingResumeWithAI:
|
|
597
|
-
resumeWithAIRunId:
|
|
598
|
-
resumeWithAI:
|
|
621
|
+
orchestratorRunId: y,
|
|
622
|
+
pendingCarryOver: S,
|
|
623
|
+
commitEntityChat: J,
|
|
624
|
+
resumeEntityChat: re,
|
|
625
|
+
pendingResume: Y,
|
|
626
|
+
resumeRunId: te,
|
|
627
|
+
dismissForeignTask: ve,
|
|
628
|
+
pendingManualEntry: ie,
|
|
629
|
+
manualEntryRunId: oe,
|
|
630
|
+
startManualEntry: ce,
|
|
631
|
+
pendingResumeWithAI: le,
|
|
632
|
+
resumeWithAIRunId: ue,
|
|
633
|
+
resumeWithAI: fe,
|
|
634
|
+
startSubagent: _e,
|
|
635
|
+
pendingStart: pe,
|
|
636
|
+
startRunId: he
|
|
599
637
|
}), [
|
|
600
638
|
t,
|
|
601
639
|
n,
|
|
@@ -604,46 +642,49 @@ function Te({ children: e, scope: t = null }) {
|
|
|
604
642
|
c,
|
|
605
643
|
l,
|
|
606
644
|
d,
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
ne,
|
|
610
|
-
P,
|
|
645
|
+
q,
|
|
646
|
+
U,
|
|
611
647
|
W,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
648
|
+
N,
|
|
649
|
+
K,
|
|
650
|
+
O,
|
|
615
651
|
R,
|
|
652
|
+
H,
|
|
653
|
+
L,
|
|
616
654
|
u,
|
|
617
655
|
p,
|
|
618
656
|
h,
|
|
619
657
|
_,
|
|
620
|
-
|
|
621
|
-
|
|
658
|
+
y,
|
|
659
|
+
S,
|
|
660
|
+
J,
|
|
661
|
+
re,
|
|
662
|
+
Y,
|
|
663
|
+
te,
|
|
664
|
+
ve,
|
|
622
665
|
ie,
|
|
623
|
-
|
|
624
|
-
ae,
|
|
625
|
-
G,
|
|
626
|
-
he,
|
|
666
|
+
oe,
|
|
627
667
|
ce,
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
668
|
+
le,
|
|
669
|
+
ue,
|
|
670
|
+
fe,
|
|
671
|
+
_e,
|
|
631
672
|
pe,
|
|
632
|
-
|
|
673
|
+
he
|
|
633
674
|
]);
|
|
634
|
-
return /* @__PURE__ */
|
|
635
|
-
value:
|
|
675
|
+
return /* @__PURE__ */ k(Ne.Provider, {
|
|
676
|
+
value: ye,
|
|
636
677
|
children: e
|
|
637
678
|
});
|
|
638
679
|
}
|
|
639
680
|
function $() {
|
|
640
|
-
let e =
|
|
681
|
+
let e = S(Ne);
|
|
641
682
|
if (!e) throw Error("useAgentico must be used inside AgenticoProvider");
|
|
642
683
|
return e;
|
|
643
684
|
}
|
|
644
685
|
//#endregion
|
|
645
686
|
//#region src/presentation/AgentActivityLog.tsx
|
|
646
|
-
function
|
|
687
|
+
function Fe(e) {
|
|
647
688
|
let t = e.search(/[{[]/);
|
|
648
689
|
if (t === -1) return [{
|
|
649
690
|
type: "text",
|
|
@@ -689,132 +730,97 @@ function Ee(e) {
|
|
|
689
730
|
language: "json"
|
|
690
731
|
});
|
|
691
732
|
let u = e.slice(s + 1);
|
|
692
|
-
return u.trim() && l.push(...
|
|
733
|
+
return u.trim() && l.push(...Fe(u)), l;
|
|
693
734
|
}
|
|
694
|
-
function
|
|
735
|
+
function Ie(e) {
|
|
695
736
|
let t = [], n = /```(\w+)?\n?([\s\S]*?)```/g, r = 0, i;
|
|
696
|
-
for (; i = n.exec(e);) i.index > r && t.push(...
|
|
737
|
+
for (; i = n.exec(e);) i.index > r && t.push(...Fe(e.slice(r, i.index))), t.push({
|
|
697
738
|
type: "code",
|
|
698
739
|
content: i[2].replace(/\n$/, ""),
|
|
699
740
|
language: i[1]
|
|
700
741
|
}), r = n.lastIndex;
|
|
701
|
-
return r < e.length && t.push(...
|
|
742
|
+
return r < e.length && t.push(...Fe(e.slice(r))), t;
|
|
702
743
|
}
|
|
703
|
-
function
|
|
704
|
-
let [n, r] =
|
|
705
|
-
return /* @__PURE__ */
|
|
744
|
+
function Le({ content: e, language: t }) {
|
|
745
|
+
let [n, r] = D(!1);
|
|
746
|
+
return /* @__PURE__ */ A("div", {
|
|
706
747
|
className: `relative cursor-pointer rounded-md ${n ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
707
748
|
onClick: () => r((e) => !e),
|
|
708
749
|
title: n ? "Clic per comprimere" : "Clic per espandere",
|
|
709
|
-
children: [/* @__PURE__ */
|
|
750
|
+
children: [/* @__PURE__ */ k(s, {
|
|
710
751
|
language: t,
|
|
711
752
|
showCopy: n,
|
|
712
753
|
background: "transparent",
|
|
713
754
|
className: "!text-[11px]",
|
|
714
755
|
children: e
|
|
715
|
-
}), !n && /* @__PURE__ */
|
|
756
|
+
}), !n && /* @__PURE__ */ k("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
716
757
|
});
|
|
717
758
|
}
|
|
718
|
-
function
|
|
719
|
-
let
|
|
720
|
-
|
|
721
|
-
type: "text",
|
|
722
|
-
content: e.slice(r, i.index)
|
|
723
|
-
}), i[1] === void 0 ? i[2] === void 0 ? i[3] !== void 0 && t.push({
|
|
724
|
-
type: "link",
|
|
725
|
-
content: i[3],
|
|
726
|
-
href: i[4]
|
|
727
|
-
}) : t.push({
|
|
728
|
-
type: "code",
|
|
729
|
-
content: i[2]
|
|
730
|
-
}) : t.push({
|
|
731
|
-
type: "bold",
|
|
732
|
-
content: i[1]
|
|
733
|
-
}), r = n.lastIndex;
|
|
734
|
-
return r < e.length && t.push({
|
|
735
|
-
type: "text",
|
|
736
|
-
content: e.slice(r)
|
|
737
|
-
}), t;
|
|
738
|
-
}
|
|
739
|
-
function Ae({ text: e }) {
|
|
740
|
-
return /* @__PURE__ */ E(T, { children: ke(e).map((e, t) => e.type === "bold" ? /* @__PURE__ */ E("strong", {
|
|
741
|
-
className: "font-semibold text-foreground",
|
|
742
|
-
children: e.content
|
|
743
|
-
}, t) : e.type === "code" ? /* @__PURE__ */ E("code", {
|
|
744
|
-
className: "rounded bg-muted px-1 py-0.5 font-mono text-[11px] break-words",
|
|
745
|
-
children: e.content
|
|
746
|
-
}, t) : e.type === "link" ? /* @__PURE__ */ E("a", {
|
|
747
|
-
href: e.href,
|
|
748
|
-
target: "_blank",
|
|
749
|
-
rel: "noreferrer",
|
|
750
|
-
className: "text-primary underline underline-offset-2",
|
|
751
|
-
children: e.content
|
|
752
|
-
}, t) : /* @__PURE__ */ E(g.Fragment, { children: e.content }, t)) });
|
|
753
|
-
}
|
|
754
|
-
function je({ text: e }) {
|
|
755
|
-
let t = De(e);
|
|
756
|
-
return /* @__PURE__ */ E(T, { children: t.map((e, t) => e.type === "code" ? /* @__PURE__ */ E(Oe, {
|
|
759
|
+
function Re({ text: e, tone: t }) {
|
|
760
|
+
let n = Ie(e);
|
|
761
|
+
return /* @__PURE__ */ k(O, { children: n.map((e, n) => e.type === "code" ? /* @__PURE__ */ k(Le, {
|
|
757
762
|
content: e.content,
|
|
758
763
|
language: e.language
|
|
759
|
-
},
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
|
|
764
|
+
}, n) : e.content.trim() && /* @__PURE__ */ k(r, {
|
|
765
|
+
content: e.content.trim(),
|
|
766
|
+
tone: t,
|
|
767
|
+
className: "break-words text-xs leading-relaxed"
|
|
768
|
+
}, n)) });
|
|
769
|
+
}
|
|
770
|
+
function ze({ status: e }) {
|
|
771
|
+
return e === "running" ? /* @__PURE__ */ k("span", { className: "inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }) : e === "done" ? /* @__PURE__ */ k(u, {
|
|
766
772
|
name: "check",
|
|
767
773
|
size: 12,
|
|
768
774
|
className: "shrink-0 text-green-600"
|
|
769
|
-
}) : e === "stopped" ? /* @__PURE__ */
|
|
775
|
+
}) : e === "stopped" ? /* @__PURE__ */ k(u, {
|
|
770
776
|
name: "circle-slash",
|
|
771
777
|
size: 12,
|
|
772
778
|
className: "shrink-0 text-muted-foreground"
|
|
773
|
-
}) : /* @__PURE__ */
|
|
779
|
+
}) : /* @__PURE__ */ k(u, {
|
|
774
780
|
name: "x",
|
|
775
781
|
size: 12,
|
|
776
782
|
className: "shrink-0 text-destructive"
|
|
777
783
|
});
|
|
778
784
|
}
|
|
779
|
-
function
|
|
785
|
+
function Be(e, t) {
|
|
780
786
|
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;
|
|
781
787
|
}
|
|
782
|
-
var
|
|
783
|
-
function
|
|
784
|
-
let t =
|
|
785
|
-
|
|
788
|
+
var Ve = 96;
|
|
789
|
+
function He({ entry: e }) {
|
|
790
|
+
let t = E(null), [n, r] = D(!1), [i, a] = D(!1);
|
|
791
|
+
w(() => {
|
|
786
792
|
let e = t.current;
|
|
787
793
|
e && a(e.scrollHeight > 97);
|
|
788
794
|
}, [e.detail, e.attachmentNames]);
|
|
789
795
|
let o = i && !n;
|
|
790
|
-
return /* @__PURE__ */
|
|
791
|
-
className: "sticky top-0 z-
|
|
792
|
-
children: /* @__PURE__ */
|
|
796
|
+
return /* @__PURE__ */ k("div", {
|
|
797
|
+
className: "sticky top-0 z-20 flex justify-end border-b border-border/40 bg-background py-1.5",
|
|
798
|
+
children: /* @__PURE__ */ A("div", {
|
|
793
799
|
className: "max-w-[85%] rounded-lg bg-primary/10 text-xs text-foreground",
|
|
794
|
-
children: [/* @__PURE__ */
|
|
800
|
+
children: [/* @__PURE__ */ A("div", {
|
|
795
801
|
ref: t,
|
|
796
802
|
className: `space-y-1 px-2.5 pt-1.5 ${o ? "overflow-hidden" : ""}`,
|
|
797
|
-
style: o ? { maxHeight:
|
|
798
|
-
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */
|
|
803
|
+
style: o ? { maxHeight: Ve } : void 0,
|
|
804
|
+
children: [e.attachmentNames && e.attachmentNames.length > 0 && /* @__PURE__ */ k("div", {
|
|
799
805
|
className: "flex flex-wrap gap-1",
|
|
800
|
-
children: e.attachmentNames.map((e, t) => /* @__PURE__ */
|
|
806
|
+
children: e.attachmentNames.map((e, t) => /* @__PURE__ */ A("span", {
|
|
801
807
|
className: "inline-flex items-center gap-1 rounded-md bg-primary/15 px-1.5 py-0.5 text-[11px] text-foreground",
|
|
802
|
-
children: [/* @__PURE__ */
|
|
808
|
+
children: [/* @__PURE__ */ k(u, {
|
|
803
809
|
name: "paperclip",
|
|
804
810
|
size: 10,
|
|
805
811
|
className: "shrink-0"
|
|
806
|
-
}), /* @__PURE__ */
|
|
812
|
+
}), /* @__PURE__ */ k("span", {
|
|
807
813
|
className: "max-w-[160px] truncate",
|
|
808
814
|
children: e
|
|
809
815
|
})]
|
|
810
816
|
}, t))
|
|
811
|
-
}), /* @__PURE__ */
|
|
812
|
-
}), i && /* @__PURE__ */
|
|
817
|
+
}), /* @__PURE__ */ k(Re, { text: e.detail ?? "" })]
|
|
818
|
+
}), i && /* @__PURE__ */ A("button", {
|
|
813
819
|
type: "button",
|
|
814
820
|
onClick: () => r((e) => !e),
|
|
815
821
|
className: "relative flex w-full items-center justify-center rounded-b-lg py-1 text-muted-foreground hover:bg-primary/15",
|
|
816
822
|
title: n ? "Comprimi" : "Espandi",
|
|
817
|
-
children: [o && /* @__PURE__ */
|
|
823
|
+
children: [o && /* @__PURE__ */ k("div", { className: "pointer-events-none absolute inset-x-0 -top-4 h-4 bg-gradient-to-t from-primary/10 to-transparent" }), /* @__PURE__ */ k(u, {
|
|
818
824
|
name: n ? "chevron-up" : "chevron-down",
|
|
819
825
|
size: 12
|
|
820
826
|
})]
|
|
@@ -822,51 +828,146 @@ function Fe({ entry: e }) {
|
|
|
822
828
|
})
|
|
823
829
|
});
|
|
824
830
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
831
|
+
var Ue = {
|
|
832
|
+
running: "loader-circle",
|
|
833
|
+
done: "check",
|
|
834
|
+
error: "x",
|
|
835
|
+
stopped: "circle-slash"
|
|
836
|
+
};
|
|
837
|
+
function We({ steps: e }) {
|
|
838
|
+
let t = Q(), n = e.filter((e) => e.status === "running").at(-1), r = e.some((e) => e.status === "error"), i = n?.label ?? (e.length === 1 ? t.oneStep : m(t.steps, { count: e.length }));
|
|
839
|
+
return /* @__PURE__ */ k(f, {
|
|
840
|
+
ariaLabel: t.stepsLabel,
|
|
841
|
+
selectedId: null,
|
|
842
|
+
itemClassName: "py-0.5 text-xs text-muted-foreground",
|
|
843
|
+
nodes: [{
|
|
844
|
+
id: `steps-${e[0]?.id ?? ""}`,
|
|
845
|
+
label: i,
|
|
846
|
+
icon: n ? "loader-circle" : r ? "circle-alert" : "list-checks",
|
|
847
|
+
children: e.map((e) => ({
|
|
848
|
+
id: e.id,
|
|
849
|
+
label: /* @__PURE__ */ k("span", {
|
|
850
|
+
className: e.status === "error" ? "text-destructive" : void 0,
|
|
851
|
+
children: e.label
|
|
852
|
+
}),
|
|
853
|
+
icon: Ue[e.status]
|
|
854
|
+
}))
|
|
855
|
+
}]
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function Ge({ entry: e, questions: t }) {
|
|
859
|
+
let n = e.parts ?? [], o = [];
|
|
860
|
+
for (let e of n) {
|
|
861
|
+
let t = o.at(-1);
|
|
862
|
+
e.type === "tool" ? t && "steps" in t ? t.steps.push(e) : o.push({
|
|
863
|
+
key: `tool-${e.id}`,
|
|
864
|
+
steps: [e]
|
|
865
|
+
}) : o.push({
|
|
866
|
+
key: `${e.type}-${e.id}`,
|
|
867
|
+
part: e
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
let s = !!t?.canAnswer(e.id);
|
|
871
|
+
return /* @__PURE__ */ k("div", {
|
|
872
|
+
className: "space-y-2",
|
|
873
|
+
children: o.map((n) => {
|
|
874
|
+
if ("steps" in n) return /* @__PURE__ */ k(We, { steps: n.steps }, n.key);
|
|
875
|
+
let { part: o } = n;
|
|
876
|
+
return o.type === "text" ? o.text.trim() ? /* @__PURE__ */ k(r, {
|
|
877
|
+
content: o.text,
|
|
878
|
+
streaming: o.streaming,
|
|
879
|
+
className: "break-words text-xs leading-relaxed text-foreground"
|
|
880
|
+
}, n.key) : null : o.type === "reasoning" ? /* @__PURE__ */ k(a, {
|
|
881
|
+
content: o.text,
|
|
882
|
+
streaming: o.streaming,
|
|
883
|
+
duration: o.duration,
|
|
884
|
+
className: "my-0"
|
|
885
|
+
}, n.key) : /* @__PURE__ */ k(i, {
|
|
886
|
+
questions: o.questions,
|
|
887
|
+
...o.answers ? { answers: o.answers } : {},
|
|
888
|
+
disabled: !o.answers && !s,
|
|
889
|
+
onSubmit: t && s ? (n) => t.onAnswer(e.id, o.id, n) : void 0,
|
|
890
|
+
className: "text-xs"
|
|
891
|
+
}, n.key);
|
|
892
|
+
})
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
function Ke({ entry: e, questions: t }) {
|
|
896
|
+
let n = Q();
|
|
897
|
+
if (e.kind === "thinking" && e.parts) {
|
|
898
|
+
let r = e.status === "error" || e.status === "stopped" || e.status === "running" && e.parts.length === 0;
|
|
899
|
+
return /* @__PURE__ */ A("li", {
|
|
900
|
+
className: "text-xs text-muted-foreground",
|
|
901
|
+
children: [e.parts.length > 0 && /* @__PURE__ */ k(Ge, {
|
|
902
|
+
entry: e,
|
|
903
|
+
questions: t
|
|
904
|
+
}), r && /* @__PURE__ */ A("div", {
|
|
905
|
+
className: `flex items-start gap-1.5 ${e.parts.length > 0 ? "mt-1" : ""}`,
|
|
906
|
+
children: [/* @__PURE__ */ k("span", {
|
|
907
|
+
className: "pt-px",
|
|
908
|
+
children: /* @__PURE__ */ k(ze, { status: e.status })
|
|
909
|
+
}), /* @__PURE__ */ k("span", {
|
|
910
|
+
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
911
|
+
children: Be(e, n)
|
|
912
|
+
})]
|
|
913
|
+
})]
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
let i = e.kind === "thinking" && e.detail ? Ie(e.detail) : [], a = i.filter((e) => e.type === "code"), o = i.filter((e) => e.type === "text" && e.content.trim()), s = e.kind === "thinking" ? Be(e, n) : e.label;
|
|
917
|
+
return /* @__PURE__ */ A("li", {
|
|
830
918
|
className: "text-xs text-muted-foreground",
|
|
831
919
|
children: [
|
|
832
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ A("div", {
|
|
833
921
|
className: "flex items-start gap-1.5",
|
|
834
|
-
children: [/* @__PURE__ */
|
|
922
|
+
children: [/* @__PURE__ */ k("span", {
|
|
835
923
|
className: "pt-px",
|
|
836
|
-
children: /* @__PURE__ */
|
|
837
|
-
}), /* @__PURE__ */
|
|
924
|
+
children: /* @__PURE__ */ k(ze, { status: e.status })
|
|
925
|
+
}), /* @__PURE__ */ k("span", {
|
|
838
926
|
className: "min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
839
|
-
children:
|
|
927
|
+
children: s
|
|
840
928
|
})]
|
|
841
929
|
}),
|
|
842
|
-
|
|
930
|
+
a.length > 0 && /* @__PURE__ */ k("div", {
|
|
843
931
|
className: "mt-1 ml-[18px] space-y-1",
|
|
844
|
-
children:
|
|
932
|
+
children: a.map((e, t) => /* @__PURE__ */ k(Le, {
|
|
845
933
|
content: e.content,
|
|
846
934
|
language: e.language
|
|
847
935
|
}, t))
|
|
848
936
|
}),
|
|
849
|
-
|
|
937
|
+
o.length > 0 && /* @__PURE__ */ k("div", {
|
|
850
938
|
className: "mt-1 ml-[18px] space-y-2",
|
|
851
|
-
children:
|
|
852
|
-
|
|
853
|
-
|
|
939
|
+
children: o.map((e, t) => /* @__PURE__ */ k(r, {
|
|
940
|
+
content: e.content.trim(),
|
|
941
|
+
tone: "muted",
|
|
942
|
+
className: "break-words text-xs leading-relaxed"
|
|
854
943
|
}, t))
|
|
855
944
|
})
|
|
856
945
|
]
|
|
857
946
|
});
|
|
858
947
|
}
|
|
859
|
-
function
|
|
860
|
-
|
|
948
|
+
function qe({ activity: e, questions: t }) {
|
|
949
|
+
if (e.length === 0) return null;
|
|
950
|
+
let n = [];
|
|
951
|
+
for (let t of e) t.kind === "user" || n.length === 0 ? n.push(t.kind === "user" ? {
|
|
952
|
+
user: t,
|
|
953
|
+
entries: []
|
|
954
|
+
} : { entries: [t] }) : n[n.length - 1].entries.push(t);
|
|
955
|
+
return /* @__PURE__ */ k("ul", {
|
|
861
956
|
className: "space-y-0.5",
|
|
862
|
-
children:
|
|
957
|
+
children: n.map((e) => /* @__PURE__ */ A("li", { children: [e.user && /* @__PURE__ */ k(He, { entry: e.user }), e.entries.length > 0 && /* @__PURE__ */ k("ul", {
|
|
958
|
+
className: "space-y-0.5",
|
|
959
|
+
children: e.entries.map((e) => /* @__PURE__ */ k(Ke, {
|
|
960
|
+
entry: e,
|
|
961
|
+
questions: t
|
|
962
|
+
}, e.id))
|
|
963
|
+
})] }, e.user?.id ?? e.entries[0]?.id))
|
|
863
964
|
});
|
|
864
965
|
}
|
|
865
966
|
//#endregion
|
|
866
967
|
//#region src/presentation/AgenticoToggle.tsx
|
|
867
|
-
function
|
|
868
|
-
let { isOpen: n, toggleOpen: r, task: i } = $(), a =
|
|
869
|
-
return /* @__PURE__ */
|
|
968
|
+
function Je({ className: e = "" }) {
|
|
969
|
+
let { isOpen: n, toggleOpen: r, task: i } = $(), a = Q(), o = i?.agent.running ?? !1;
|
|
970
|
+
return /* @__PURE__ */ k(t, {
|
|
870
971
|
icon: "bot",
|
|
871
972
|
ariaLabel: n ? a.closePanel : a.openPanel,
|
|
872
973
|
title: n ? a.closePanel : a.openPanel,
|
|
@@ -877,32 +978,32 @@ function Re({ className: e = "" }) {
|
|
|
877
978
|
}
|
|
878
979
|
//#endregion
|
|
879
980
|
//#region src/presentation/useAIModelCatalog.ts
|
|
880
|
-
var
|
|
881
|
-
function
|
|
981
|
+
var Ye = "llmnative-cms.selectedAIModel";
|
|
982
|
+
function Xe() {
|
|
882
983
|
try {
|
|
883
|
-
return localStorage.getItem(
|
|
984
|
+
return localStorage.getItem(Ye) ?? "";
|
|
884
985
|
} catch {
|
|
885
986
|
return "";
|
|
886
987
|
}
|
|
887
988
|
}
|
|
888
|
-
function
|
|
989
|
+
function Ze(e) {
|
|
889
990
|
try {
|
|
890
|
-
e ? localStorage.setItem(
|
|
991
|
+
e ? localStorage.setItem(Ye, e) : localStorage.removeItem(Ye);
|
|
891
992
|
} catch {}
|
|
892
993
|
}
|
|
893
|
-
function
|
|
894
|
-
let e =
|
|
895
|
-
return
|
|
994
|
+
function Qe() {
|
|
995
|
+
let e = _()?.registry ?? {}, t = Object.keys(e).length > 0, [n, r] = D({}), [i, a] = D(!1), [o, s] = D(Xe);
|
|
996
|
+
return C(() => {
|
|
896
997
|
if (!t) {
|
|
897
998
|
r({});
|
|
898
999
|
return;
|
|
899
1000
|
}
|
|
900
1001
|
let n = !1;
|
|
901
|
-
return a(!0),
|
|
1002
|
+
return a(!0), p(e).then((e) => {
|
|
902
1003
|
if (n) return;
|
|
903
1004
|
r(e.modelsByProvider);
|
|
904
1005
|
let t = Object.values(e.modelsByProvider).flat();
|
|
905
|
-
s((e) => t.some((t) => t.id === e) ? e : (
|
|
1006
|
+
s((e) => t.some((t) => t.id === e) ? e : (Ze(""), ""));
|
|
906
1007
|
}).catch((e) => {
|
|
907
1008
|
console.error("useAIModelCatalog: getAIModelCatalog failed", e), n || r({});
|
|
908
1009
|
}).finally(() => {
|
|
@@ -916,34 +1017,188 @@ function He() {
|
|
|
916
1017
|
modelsLoading: i,
|
|
917
1018
|
selectedModel: o,
|
|
918
1019
|
setSelectedModel: (e) => {
|
|
919
|
-
|
|
1020
|
+
Ze(e), s(e);
|
|
920
1021
|
}
|
|
921
1022
|
};
|
|
922
1023
|
}
|
|
923
1024
|
//#endregion
|
|
924
1025
|
//#region src/presentation/useAgent.ts
|
|
925
|
-
var
|
|
926
|
-
function
|
|
927
|
-
return e.filter((e) => !
|
|
928
|
-
}
|
|
929
|
-
function
|
|
930
|
-
let { defaultEnabled: n = !1 } = t, [r, i] =
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1026
|
+
var $e = 20, et = 26e4;
|
|
1027
|
+
function tt(e) {
|
|
1028
|
+
return e.filter((e) => !d.isTextAttachment(e.mimeType) || e.base64.length <= et);
|
|
1029
|
+
}
|
|
1030
|
+
function nt(e, t = {}) {
|
|
1031
|
+
let { defaultEnabled: n = !1 } = t, [r, i] = D(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Qe(), [u, f] = D(!1), [p, m] = D(null), [g, v] = D(!1), [y, b] = D([]), x = E([]), S = (e) => {
|
|
1032
|
+
b((t) => {
|
|
1033
|
+
let n = typeof e == "function" ? e(t) : e;
|
|
1034
|
+
return x.current = n, n;
|
|
1035
|
+
});
|
|
1036
|
+
}, C = E(/* @__PURE__ */ new Map()), w = Q(), T = E(w);
|
|
1037
|
+
T.current = w;
|
|
1038
|
+
let O = E(null), k = E(!1), A = E(null), M = () => {
|
|
1039
|
+
A.current?.abort();
|
|
1040
|
+
}, I = _()?.registry ?? {}, L = r && c ? h(c) : null, R = L ? I[L.provider] : null, z = e.executor, B = !!z, [V, H] = D([]), [U, G] = D(""), K = E(""), q = (e) => {
|
|
1041
|
+
K.current = e, G(e);
|
|
1042
|
+
}, J = (e) => {
|
|
1043
|
+
H(z?.models?.(e) ?? []), q(z?.defaultModel?.(e) ?? "");
|
|
1044
|
+
}, Y = async (e, t, n, r) => {
|
|
1045
|
+
let i = O.current;
|
|
1046
|
+
if (!i || !z) return m(T.current.noActiveSession), null;
|
|
1047
|
+
let a = new AbortController();
|
|
1048
|
+
A.current = a;
|
|
1049
|
+
let o = crypto.randomUUID();
|
|
1050
|
+
S((e) => [...e, {
|
|
1051
|
+
id: o,
|
|
1052
|
+
kind: "thinking",
|
|
1053
|
+
label: T.current.thinking,
|
|
1054
|
+
status: "running",
|
|
1055
|
+
parts: []
|
|
1056
|
+
}]);
|
|
1057
|
+
let s = /* @__PURE__ */ new Map(), c = (e) => Math.max(1, Math.round((Date.now() - (s.get(e) ?? Date.now())) / 1e3)), l = (e) => ({
|
|
1058
|
+
...e,
|
|
1059
|
+
streaming: !1,
|
|
1060
|
+
duration: e.duration ?? c(e.id)
|
|
1061
|
+
}), u = (e, t) => S((n) => n.map((n) => {
|
|
1062
|
+
if (n.id !== o) return n;
|
|
1063
|
+
let r = e(n.parts ?? []), i = P(r);
|
|
1064
|
+
return {
|
|
1065
|
+
...n,
|
|
1066
|
+
parts: r,
|
|
1067
|
+
...t ? { status: t } : {},
|
|
1068
|
+
...i ? { detail: i } : {}
|
|
1069
|
+
};
|
|
1070
|
+
})), d = (e) => u((t) => N(t, e, l)), f = !1, p = (e, t) => {
|
|
1071
|
+
t?.id && t.id !== "text" && (f = !0), d({
|
|
1072
|
+
type: "text",
|
|
1073
|
+
id: t?.id ?? "text",
|
|
1074
|
+
text: e,
|
|
1075
|
+
streaming: !t?.done
|
|
1076
|
+
});
|
|
1077
|
+
}, h = (e, t) => {
|
|
1078
|
+
let n = t?.id ?? "reasoning";
|
|
1079
|
+
s.has(n) || s.set(n, Date.now()), d({
|
|
1080
|
+
type: "reasoning",
|
|
1081
|
+
id: n,
|
|
1082
|
+
text: e,
|
|
1083
|
+
streaming: !t?.done,
|
|
1084
|
+
...t?.duration === void 0 ? t?.done ? { duration: c(n) } : {} : { duration: t.duration }
|
|
1085
|
+
});
|
|
1086
|
+
}, g = (e) => d({
|
|
1087
|
+
type: "tool",
|
|
1088
|
+
id: e.id,
|
|
1089
|
+
label: e.label,
|
|
1090
|
+
status: e.status
|
|
1091
|
+
}), _ = /* @__PURE__ */ new Set(), v = 0, y = () => {
|
|
1092
|
+
for (let e of _) {
|
|
1093
|
+
let t = C.current.get(e);
|
|
1094
|
+
C.current.delete(e), t?.reject(new DOMException("The turn was stopped.", "AbortError"));
|
|
1095
|
+
}
|
|
1096
|
+
_.clear();
|
|
1097
|
+
};
|
|
1098
|
+
a.signal.addEventListener("abort", y);
|
|
1099
|
+
let b = (e, t) => {
|
|
1100
|
+
v += 1;
|
|
1101
|
+
let n = t?.id ?? `questions-${v}`;
|
|
1102
|
+
d({
|
|
1103
|
+
type: "questions",
|
|
1104
|
+
id: n,
|
|
1105
|
+
questions: e
|
|
1106
|
+
});
|
|
1107
|
+
let r = `${o}:${n}`;
|
|
1108
|
+
return a.signal.aborted ? Promise.reject(new DOMException("The turn was stopped.", "AbortError")) : (_.add(r), new Promise((e, t) => {
|
|
1109
|
+
C.current.set(r, {
|
|
1110
|
+
resolve: e,
|
|
1111
|
+
reject: t
|
|
1112
|
+
});
|
|
1113
|
+
}));
|
|
1114
|
+
}, x = (e, t) => {
|
|
1115
|
+
u((n) => (t && !f ? N(n, {
|
|
1116
|
+
type: "text",
|
|
1117
|
+
id: j,
|
|
1118
|
+
text: t,
|
|
1119
|
+
streaming: !1
|
|
1120
|
+
}, l) : n).map((t) => t.type === "reasoning" && t.streaming ? l(t) : t.type === "text" && t.streaming ? {
|
|
1121
|
+
...t,
|
|
1122
|
+
streaming: !1
|
|
1123
|
+
} : t.type === "tool" && t.status === "running" && e !== "done" ? {
|
|
1124
|
+
...t,
|
|
1125
|
+
status: "stopped"
|
|
1126
|
+
} : t), e), a.signal.removeEventListener("abort", y);
|
|
1127
|
+
for (let e of _) C.current.delete(e);
|
|
1128
|
+
_.clear();
|
|
1129
|
+
}, w = e || r?.historyText || "";
|
|
1130
|
+
try {
|
|
1131
|
+
let o = await z.turn({
|
|
1132
|
+
params: i.params,
|
|
1133
|
+
context: i.context,
|
|
1134
|
+
text: e,
|
|
1135
|
+
first: t,
|
|
1136
|
+
signal: a.signal,
|
|
1137
|
+
...n || K.current ? { model: n || K.current } : {},
|
|
1138
|
+
...r ? { answers: {
|
|
1139
|
+
id: r.id,
|
|
1140
|
+
answers: r.answers
|
|
1141
|
+
} } : {},
|
|
1142
|
+
onText: p,
|
|
1143
|
+
onReasoning: h,
|
|
1144
|
+
onStep: g,
|
|
1145
|
+
onQuestions: b
|
|
1146
|
+
});
|
|
1147
|
+
return x("done", o.text), i.history = [
|
|
1148
|
+
...i.history,
|
|
1149
|
+
...w ? [{
|
|
1150
|
+
role: "user",
|
|
1151
|
+
content: w
|
|
1152
|
+
}] : [],
|
|
1153
|
+
{
|
|
1154
|
+
role: "assistant",
|
|
1155
|
+
content: o.text
|
|
1156
|
+
}
|
|
1157
|
+
], o.result ?? null;
|
|
1158
|
+
} catch (e) {
|
|
1159
|
+
return i.history = [...i.history, ...w ? [{
|
|
1160
|
+
role: "user",
|
|
1161
|
+
content: w
|
|
1162
|
+
}] : []], a.signal.aborted ? (x("stopped"), null) : (x("error"), m(Z(e)), null);
|
|
1163
|
+
} finally {
|
|
1164
|
+
A.current = null;
|
|
1165
|
+
}
|
|
1166
|
+
}, ee = async (e, t, n) => {
|
|
1167
|
+
let r = x.current.find((t) => t.id === e)?.parts?.find((e) => e.type === "questions" && e.id === t);
|
|
1168
|
+
if (!r || r.type !== "questions") throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1169
|
+
let i = () => S((r) => r.map((r) => r.id === e ? {
|
|
1170
|
+
...r,
|
|
1171
|
+
parts: r.parts?.map((e) => e.type === "questions" && e.id === t ? {
|
|
1172
|
+
...e,
|
|
1173
|
+
answers: n
|
|
1174
|
+
} : e)
|
|
1175
|
+
} : r)), a = `${e}:${t}`, o = C.current.get(a);
|
|
1176
|
+
if (o) return C.current.delete(a), i(), o.resolve(n), null;
|
|
1177
|
+
if (k.current) throw m(T.current.requestInProgress), Error(T.current.requestInProgress);
|
|
1178
|
+
if (!B || !O.current) throw m(T.current.noActiveSession), Error(T.current.noActiveSession);
|
|
1179
|
+
k.current = !0, f(!0), m(null), i();
|
|
1180
|
+
try {
|
|
1181
|
+
return await Y("", !1, void 0, {
|
|
1182
|
+
id: t,
|
|
1183
|
+
answers: n,
|
|
1184
|
+
historyText: F(r.questions, n)
|
|
1185
|
+
});
|
|
1186
|
+
} finally {
|
|
1187
|
+
k.current = !1, f(!1);
|
|
1188
|
+
}
|
|
1189
|
+
}, te = async (t, n, r) => {
|
|
1190
|
+
let i = O.current;
|
|
1191
|
+
if (!i) return m(T.current.noActiveSession), null;
|
|
1192
|
+
let a = r ? h(r) : L, o = a ? I[a.provider] : null;
|
|
1193
|
+
if (!o || !a) return m(T.current.noProviderAvailable), null;
|
|
939
1194
|
n?.length && (i.attachmentsRef.current = [...i.attachmentsRef.current ?? [], ...n]);
|
|
940
|
-
let s = (n ?? []).filter((e) =>
|
|
1195
|
+
let s = (n ?? []).filter((e) => d.isTextAttachment(e.mimeType)).map((e) => e.base64.length <= et ? `\n\n[File allegato: ${e.name}]\n${d.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(""), c = tt(n ?? []), l = i.tools.map((e) => ({
|
|
941
1196
|
name: e.name,
|
|
942
1197
|
description: e.description,
|
|
943
|
-
inputSchema:
|
|
944
|
-
})),
|
|
945
|
-
|
|
946
|
-
let
|
|
1198
|
+
inputSchema: W(e.inputSchema)
|
|
1199
|
+
})), u = new Map(i.tools.map((e) => [e.name, e])), f = new AbortController();
|
|
1200
|
+
A.current = f;
|
|
1201
|
+
let p = (e, t, n, r) => S((i) => i.map((i) => i.id === e ? {
|
|
947
1202
|
...i,
|
|
948
1203
|
status: t,
|
|
949
1204
|
...n === void 0 ? {} : { detail: n },
|
|
@@ -951,36 +1206,36 @@ function Ke(e, t = {}) {
|
|
|
951
1206
|
} : i));
|
|
952
1207
|
try {
|
|
953
1208
|
let n = i.history, r = t;
|
|
954
|
-
for (let t = 0; t <
|
|
955
|
-
let
|
|
956
|
-
|
|
957
|
-
id:
|
|
1209
|
+
for (let t = 0; t < $e; t++) {
|
|
1210
|
+
let d = crypto.randomUUID();
|
|
1211
|
+
S((e) => [...e, {
|
|
1212
|
+
id: d,
|
|
958
1213
|
kind: "thinking",
|
|
959
|
-
label:
|
|
1214
|
+
label: T.current.thinking,
|
|
960
1215
|
status: "running"
|
|
961
1216
|
}]);
|
|
962
|
-
let
|
|
1217
|
+
let h;
|
|
963
1218
|
try {
|
|
964
|
-
|
|
1219
|
+
h = await o.complete({
|
|
965
1220
|
prompt: r,
|
|
966
1221
|
model: a.model,
|
|
967
1222
|
history: n,
|
|
968
|
-
tools:
|
|
969
|
-
signal:
|
|
970
|
-
attachments: t === 0 ?
|
|
1223
|
+
tools: l.length ? l : void 0,
|
|
1224
|
+
signal: f.signal,
|
|
1225
|
+
attachments: t === 0 ? c : void 0,
|
|
971
1226
|
logId: i.logId
|
|
972
1227
|
});
|
|
973
1228
|
} catch (t) {
|
|
974
1229
|
return i.history = [...n, ...r ? [{
|
|
975
1230
|
role: "user",
|
|
976
1231
|
content: r + s
|
|
977
|
-
}] : []],
|
|
1232
|
+
}] : []], f.signal.aborted ? (p(d, "stopped"), e.fallback(i.params, i.context)) : (p(d, "error"), m(Z(t)), null);
|
|
978
1233
|
}
|
|
979
1234
|
if (i.history = [...n, ...r ? [{
|
|
980
1235
|
role: "user",
|
|
981
1236
|
content: r + s
|
|
982
|
-
}] : []], !
|
|
983
|
-
if (
|
|
1237
|
+
}] : []], !h) return f.signal.aborted ? (p(d, "stopped"), e.fallback(i.params, i.context)) : (p(d, "error"), m(T.current.noProviderResponse), null);
|
|
1238
|
+
if (h.type === "text") return p(d, "done", h.text), i.history = [
|
|
984
1239
|
...n,
|
|
985
1240
|
...r ? [{
|
|
986
1241
|
role: "user",
|
|
@@ -988,26 +1243,26 @@ function Ke(e, t = {}) {
|
|
|
988
1243
|
}] : [],
|
|
989
1244
|
{
|
|
990
1245
|
role: "assistant",
|
|
991
|
-
content:
|
|
1246
|
+
content: h.text
|
|
992
1247
|
}
|
|
993
|
-
], e.parseResponse(
|
|
994
|
-
responseLength:
|
|
995
|
-
responsePreview:
|
|
1248
|
+
], e.parseResponse(h.text, i.params, i.context) || (console.error("[useAgent] parseResponse ha restituito null — la risposta del modello non è nel formato atteso da questo subagent. Uso il fallback deterministico.", {
|
|
1249
|
+
responseLength: h.text.length,
|
|
1250
|
+
responsePreview: h.text.length > 2e3 ? `${h.text.slice(0, 1e3)}\n…[troncato qui nel log, ${h.text.length} caratteri totali]…\n${h.text.slice(-1e3)}` : h.text,
|
|
996
1251
|
params: i.params
|
|
997
|
-
}),
|
|
998
|
-
let
|
|
999
|
-
let t =
|
|
1252
|
+
}), m(T.current.invalidResponse), e.fallback(i.params, i.context));
|
|
1253
|
+
let g = h.toolCalls.map((e) => {
|
|
1254
|
+
let t = u.get(e.name);
|
|
1000
1255
|
return t?.describeIntent ?? t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
1001
1256
|
});
|
|
1002
|
-
|
|
1003
|
-
let _ = await Promise.all(
|
|
1004
|
-
let t =
|
|
1005
|
-
if (
|
|
1257
|
+
p(d, "done", h.text || void 0, h.text ? void 0 : g);
|
|
1258
|
+
let _ = await Promise.all(h.toolCalls.map(async (e) => {
|
|
1259
|
+
let t = u.get(e.name), n = t?.describeInvocation?.(e.input) ?? `Chiamata: ${e.name}`;
|
|
1260
|
+
if (S((t) => [...t, {
|
|
1006
1261
|
id: e.id,
|
|
1007
1262
|
kind: "tool",
|
|
1008
1263
|
label: n,
|
|
1009
1264
|
status: "running"
|
|
1010
|
-
}]), !t) return
|
|
1265
|
+
}]), !t) return p(e.id, "error"), {
|
|
1011
1266
|
toolCallId: e.id,
|
|
1012
1267
|
name: e.name,
|
|
1013
1268
|
output: `Tool sconosciuto: ${e.name}`,
|
|
@@ -1015,16 +1270,16 @@ function Ke(e, t = {}) {
|
|
|
1015
1270
|
};
|
|
1016
1271
|
try {
|
|
1017
1272
|
let n = await t.execute(e.input);
|
|
1018
|
-
return
|
|
1273
|
+
return p(e.id, "done"), {
|
|
1019
1274
|
toolCallId: e.id,
|
|
1020
1275
|
name: e.name,
|
|
1021
1276
|
output: n
|
|
1022
1277
|
};
|
|
1023
1278
|
} catch (t) {
|
|
1024
|
-
return
|
|
1279
|
+
return p(e.id, "error"), {
|
|
1025
1280
|
toolCallId: e.id,
|
|
1026
1281
|
name: e.name,
|
|
1027
|
-
output:
|
|
1282
|
+
output: Z(t),
|
|
1028
1283
|
isError: !0
|
|
1029
1284
|
};
|
|
1030
1285
|
}
|
|
@@ -1037,8 +1292,8 @@ function Ke(e, t = {}) {
|
|
|
1037
1292
|
}] : [],
|
|
1038
1293
|
{
|
|
1039
1294
|
role: "assistant",
|
|
1040
|
-
content:
|
|
1041
|
-
toolCalls:
|
|
1295
|
+
content: h.text,
|
|
1296
|
+
toolCalls: h.toolCalls
|
|
1042
1297
|
},
|
|
1043
1298
|
{
|
|
1044
1299
|
role: "tool_result",
|
|
@@ -1046,118 +1301,120 @@ function Ke(e, t = {}) {
|
|
|
1046
1301
|
}
|
|
1047
1302
|
], r = "";
|
|
1048
1303
|
}
|
|
1049
|
-
let
|
|
1050
|
-
|
|
1051
|
-
id:
|
|
1304
|
+
let d = crypto.randomUUID();
|
|
1305
|
+
S((e) => [...e, {
|
|
1306
|
+
id: d,
|
|
1052
1307
|
kind: "thinking",
|
|
1053
|
-
label:
|
|
1308
|
+
label: T.current.thinking,
|
|
1054
1309
|
status: "running"
|
|
1055
1310
|
}]);
|
|
1056
|
-
let
|
|
1311
|
+
let h;
|
|
1057
1312
|
try {
|
|
1058
|
-
|
|
1059
|
-
prompt:
|
|
1313
|
+
h = await o.complete({
|
|
1314
|
+
prompt: le(X().stopCallingTools, e.microPromptIds),
|
|
1060
1315
|
model: a.model,
|
|
1061
1316
|
history: n,
|
|
1062
|
-
signal:
|
|
1317
|
+
signal: f.signal,
|
|
1063
1318
|
logId: i.logId
|
|
1064
1319
|
});
|
|
1065
1320
|
} catch {
|
|
1066
|
-
|
|
1321
|
+
h = null;
|
|
1067
1322
|
}
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1323
|
+
if (h?.type === "text") {
|
|
1324
|
+
p(d, "done", h.text), i.history = [...n, {
|
|
1070
1325
|
role: "assistant",
|
|
1071
|
-
content:
|
|
1326
|
+
content: h.text
|
|
1072
1327
|
}];
|
|
1073
|
-
let t = e.parseResponse(
|
|
1328
|
+
let t = e.parseResponse(h.text, i.params, i.context);
|
|
1074
1329
|
if (t) return t;
|
|
1075
|
-
} else
|
|
1076
|
-
return
|
|
1330
|
+
} else p(d, f.signal.aborted ? "stopped" : "error"), i.history = n;
|
|
1331
|
+
return f.signal.aborted || m(T.current.tooManyToolTurns), e.fallback(i.params, i.context);
|
|
1077
1332
|
} finally {
|
|
1078
|
-
|
|
1333
|
+
A.current = null;
|
|
1079
1334
|
}
|
|
1080
1335
|
};
|
|
1081
1336
|
return {
|
|
1082
1337
|
enabled: r,
|
|
1083
1338
|
setEnabled: i,
|
|
1084
1339
|
hasProviders: a,
|
|
1085
|
-
selectedModel:
|
|
1086
|
-
setSelectedModel:
|
|
1340
|
+
selectedModel: B ? U : c,
|
|
1341
|
+
setSelectedModel: B ? q : l,
|
|
1087
1342
|
modelsByProvider: o,
|
|
1088
1343
|
modelsLoading: s,
|
|
1089
|
-
running:
|
|
1090
|
-
error:
|
|
1091
|
-
canContinue:
|
|
1344
|
+
running: u,
|
|
1345
|
+
error: p,
|
|
1346
|
+
canContinue: g,
|
|
1347
|
+
remote: B,
|
|
1348
|
+
remoteModels: V,
|
|
1092
1349
|
activity: y,
|
|
1093
1350
|
run: async (t, n) => {
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1351
|
+
if (k.current) return m(T.current.requestInProgress), null;
|
|
1352
|
+
k.current = !0, m(null), S(n?.openingMessage ? [{
|
|
1096
1353
|
id: crypto.randomUUID(),
|
|
1097
1354
|
kind: "user",
|
|
1098
1355
|
label: "Tu",
|
|
1099
1356
|
status: "done",
|
|
1100
1357
|
detail: n.openingMessage,
|
|
1101
1358
|
...n.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1102
|
-
}] : []),
|
|
1359
|
+
}] : []), f(!0);
|
|
1103
1360
|
try {
|
|
1104
1361
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1105
|
-
|
|
1362
|
+
if (O.current = {
|
|
1106
1363
|
params: t,
|
|
1107
1364
|
context: i,
|
|
1108
1365
|
tools: o,
|
|
1109
1366
|
history: [],
|
|
1110
1367
|
logId: crypto.randomUUID(),
|
|
1111
1368
|
attachmentsRef: a
|
|
1112
|
-
};
|
|
1113
|
-
let s = n?.model || void 0,
|
|
1114
|
-
if (!r || !
|
|
1369
|
+
}, B) return v(!0), J(t), await Y(n?.openingMessage ?? "", !0);
|
|
1370
|
+
let s = n?.model || void 0, c = s ? !!I[h(s)?.provider ?? ""] : !!R;
|
|
1371
|
+
if (!r || !c) {
|
|
1115
1372
|
v(!1);
|
|
1116
1373
|
let n = e.fallback(t, i);
|
|
1117
|
-
return
|
|
1374
|
+
return S((t) => [...t, {
|
|
1118
1375
|
id: crypto.randomUUID(),
|
|
1119
1376
|
kind: "tool",
|
|
1120
1377
|
status: "done",
|
|
1121
|
-
label: e.describeFallback?.(n) ??
|
|
1378
|
+
label: e.describeFallback?.(n) ?? T.current.aiDisabledFallback
|
|
1122
1379
|
}]), n;
|
|
1123
1380
|
}
|
|
1124
1381
|
v(!0);
|
|
1125
|
-
let
|
|
1126
|
-
return await
|
|
1382
|
+
let l = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, u = le(e.buildPrompt(t, i), e.microPromptIds);
|
|
1383
|
+
return await te(u, l, s);
|
|
1127
1384
|
} catch (e) {
|
|
1128
|
-
return
|
|
1385
|
+
return m(Z(e)), null;
|
|
1129
1386
|
} finally {
|
|
1130
|
-
|
|
1387
|
+
k.current = !1, f(!1);
|
|
1131
1388
|
}
|
|
1132
1389
|
},
|
|
1133
1390
|
resume: async (t, n) => {
|
|
1134
|
-
if (
|
|
1135
|
-
|
|
1391
|
+
if (k.current) {
|
|
1392
|
+
m(T.current.requestInProgress);
|
|
1136
1393
|
return;
|
|
1137
1394
|
}
|
|
1138
|
-
|
|
1395
|
+
k.current = !0, m(null), S(n.activity), f(!0);
|
|
1139
1396
|
try {
|
|
1140
1397
|
let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
|
|
1141
|
-
|
|
1398
|
+
O.current = {
|
|
1142
1399
|
params: t,
|
|
1143
1400
|
context: i,
|
|
1144
1401
|
tools: o,
|
|
1145
1402
|
history: n.history,
|
|
1146
1403
|
logId: crypto.randomUUID(),
|
|
1147
1404
|
attachmentsRef: a
|
|
1148
|
-
}, v(r && !!
|
|
1405
|
+
}, B && J(t), v(B || r && !!R);
|
|
1149
1406
|
} catch (e) {
|
|
1150
|
-
|
|
1407
|
+
m(Z(e));
|
|
1151
1408
|
} finally {
|
|
1152
|
-
|
|
1409
|
+
k.current = !1, f(!1);
|
|
1153
1410
|
}
|
|
1154
1411
|
},
|
|
1155
1412
|
sendMessage: async (t, n) => {
|
|
1156
|
-
if (
|
|
1157
|
-
if (
|
|
1158
|
-
let r =
|
|
1159
|
-
if (!r) return
|
|
1160
|
-
|
|
1413
|
+
if (k.current) return m(T.current.requestInProgress), null;
|
|
1414
|
+
if (m(null), !t.trim()) return m("Messaggio vuoto."), null;
|
|
1415
|
+
let r = O.current;
|
|
1416
|
+
if (!r) return m(T.current.noActiveSession), null;
|
|
1417
|
+
k.current = !0, f(!0), S((e) => [...e, {
|
|
1161
1418
|
id: crypto.randomUUID(),
|
|
1162
1419
|
kind: "user",
|
|
1163
1420
|
label: "Tu",
|
|
@@ -1166,52 +1423,54 @@ function Ke(e, t = {}) {
|
|
|
1166
1423
|
...n?.attachments?.length ? { attachmentNames: n.attachments.map((e) => e.name) } : {}
|
|
1167
1424
|
}]);
|
|
1168
1425
|
try {
|
|
1169
|
-
|
|
1170
|
-
|
|
1426
|
+
if (B) return await Y(t, !1, n?.model || void 0);
|
|
1427
|
+
let i = n?.attachments?.length ? await Promise.all(n.attachments.map((e) => d.fileToAttachment(e))) : void 0, a = le(e.buildFollowUpPrompt(t, r.params, r.context), e.microPromptIds);
|
|
1428
|
+
return await te(a, i, n?.model || void 0);
|
|
1171
1429
|
} catch (e) {
|
|
1172
|
-
return
|
|
1430
|
+
return m(Z(e)), null;
|
|
1173
1431
|
} finally {
|
|
1174
|
-
|
|
1432
|
+
k.current = !1, f(!1);
|
|
1175
1433
|
}
|
|
1176
1434
|
},
|
|
1177
|
-
stop:
|
|
1435
|
+
stop: M,
|
|
1178
1436
|
runFallback: () => {
|
|
1179
|
-
let t =
|
|
1437
|
+
let t = O.current;
|
|
1180
1438
|
if (!t) return null;
|
|
1181
|
-
|
|
1439
|
+
m(null);
|
|
1182
1440
|
let n = e.fallback(t.params, t.context);
|
|
1183
|
-
return
|
|
1441
|
+
return S((t) => [...t, {
|
|
1184
1442
|
id: crypto.randomUUID(),
|
|
1185
1443
|
kind: "tool",
|
|
1186
1444
|
status: "done",
|
|
1187
|
-
label: e.describeFallback?.(n) ??
|
|
1445
|
+
label: e.describeFallback?.(n) ?? T.current.continueWithoutAiFallback
|
|
1188
1446
|
}]), n;
|
|
1189
1447
|
},
|
|
1190
|
-
snapshot: () =>
|
|
1191
|
-
history:
|
|
1448
|
+
snapshot: () => O.current ? {
|
|
1449
|
+
history: O.current.history,
|
|
1192
1450
|
activity: y
|
|
1193
|
-
} : null
|
|
1451
|
+
} : null,
|
|
1452
|
+
answerQuestions: ee
|
|
1194
1453
|
};
|
|
1195
1454
|
}
|
|
1196
1455
|
//#endregion
|
|
1197
1456
|
//#region src/domain/orchestrator/prompt.ts
|
|
1198
|
-
function
|
|
1199
|
-
let e =
|
|
1457
|
+
function rt() {
|
|
1458
|
+
let e = X();
|
|
1200
1459
|
return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
|
|
1201
1460
|
}
|
|
1202
|
-
function
|
|
1203
|
-
let r =
|
|
1461
|
+
function it(e, t, n) {
|
|
1462
|
+
let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
|
|
1204
1463
|
return `${r.orchestratorIntro}
|
|
1205
1464
|
|
|
1206
1465
|
${r.toolsHeading}
|
|
1207
1466
|
${t}
|
|
1208
1467
|
${i}
|
|
1209
|
-
${
|
|
1468
|
+
${rt()}
|
|
1210
1469
|
|
|
1211
1470
|
${r.userRequestHeading}
|
|
1212
1471
|
${e}`;
|
|
1213
1472
|
}
|
|
1214
|
-
function
|
|
1473
|
+
function at(e, t) {
|
|
1215
1474
|
return t ? {
|
|
1216
1475
|
kind: "handoff",
|
|
1217
1476
|
...t
|
|
@@ -1222,24 +1481,27 @@ function Ye(e, t) {
|
|
|
1222
1481
|
}
|
|
1223
1482
|
//#endregion
|
|
1224
1483
|
//#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
|
|
1225
|
-
function
|
|
1484
|
+
function ot(e) {
|
|
1485
|
+
return z().filter((t) => !t.onlyWhenAnchored || e === t.id);
|
|
1486
|
+
}
|
|
1487
|
+
function st(e) {
|
|
1226
1488
|
return {
|
|
1227
|
-
buildContext() {
|
|
1489
|
+
buildContext(e) {
|
|
1228
1490
|
return {
|
|
1229
|
-
cliCatalog:
|
|
1491
|
+
cliCatalog: oe(ot(e.scopedSubagentId)),
|
|
1230
1492
|
handoff: { current: null },
|
|
1231
1493
|
collected: {}
|
|
1232
1494
|
};
|
|
1233
1495
|
},
|
|
1234
1496
|
buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
|
|
1235
|
-
return
|
|
1497
|
+
return it(e, n, t);
|
|
1236
1498
|
},
|
|
1237
1499
|
buildFollowUpPrompt(e, t, { cliCatalog: n }) {
|
|
1238
|
-
return `${e}\n\n${
|
|
1500
|
+
return `${e}\n\n${rt()}\n\n${X().toolsHeading}\n${n}`;
|
|
1239
1501
|
},
|
|
1240
1502
|
parseResponse(e, t, n) {
|
|
1241
1503
|
let r = n.handoff.current;
|
|
1242
|
-
return n.handoff.current = null,
|
|
1504
|
+
return n.handoff.current = null, at(e, r);
|
|
1243
1505
|
},
|
|
1244
1506
|
fallback() {
|
|
1245
1507
|
return {
|
|
@@ -1251,16 +1513,16 @@ function Xe(e) {
|
|
|
1251
1513
|
return t.kind === "chat" ? t.message : e.continueWithoutAi;
|
|
1252
1514
|
},
|
|
1253
1515
|
getTools(t, n, r) {
|
|
1254
|
-
let i =
|
|
1516
|
+
let i = U({
|
|
1255
1517
|
attachmentsRef: r,
|
|
1256
1518
|
collected: n.collected,
|
|
1257
|
-
proxyFetch:
|
|
1258
|
-
}), a = t.scopedSubagentId ?
|
|
1519
|
+
proxyFetch: g
|
|
1520
|
+
}), a = t.scopedSubagentId ? B(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = ot(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
|
|
1259
1521
|
name: `${t.id}_${r.name}`,
|
|
1260
1522
|
description: `${t.label}: ${r.summary}`,
|
|
1261
1523
|
inputSchema: r.inputSchema,
|
|
1262
|
-
describeInvocation: () =>
|
|
1263
|
-
describeIntent:
|
|
1524
|
+
describeInvocation: () => m(e.preparing, { label: t.label }),
|
|
1525
|
+
describeIntent: m(e.collecting, { label: t.label }),
|
|
1264
1526
|
async execute(e) {
|
|
1265
1527
|
let i = t.withCollected ? t.withCollected({ ...e }, n.collected) : e;
|
|
1266
1528
|
return n.handoff.current = {
|
|
@@ -1269,7 +1531,7 @@ function Xe(e) {
|
|
|
1269
1531
|
params: i
|
|
1270
1532
|
}, {
|
|
1271
1533
|
status: "queued",
|
|
1272
|
-
note:
|
|
1534
|
+
note: m(X().handoffQueued, { label: t.label })
|
|
1273
1535
|
};
|
|
1274
1536
|
}
|
|
1275
1537
|
})));
|
|
@@ -1279,89 +1541,89 @@ function Xe(e) {
|
|
|
1279
1541
|
}
|
|
1280
1542
|
//#endregion
|
|
1281
1543
|
//#region src/presentation/deriveHistoryTitle.ts
|
|
1282
|
-
function
|
|
1544
|
+
function ct(e, t) {
|
|
1283
1545
|
return e.deriveHistoryTitle?.(t) ?? e.label;
|
|
1284
1546
|
}
|
|
1285
1547
|
//#endregion
|
|
1286
1548
|
//#region src/presentation/ResultDestinationPicker.tsx
|
|
1287
|
-
function
|
|
1288
|
-
let s =
|
|
1549
|
+
function lt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
|
|
1550
|
+
let s = Q(), c = $(), l = c.scope, u = y(), [d, f] = D(null), [p, h] = D(new Set(i ?? [])), [g, _] = D(null), v = ge(), b = /* @__PURE__ */ new Map();
|
|
1289
1551
|
e.destinationIds.forEach((e) => {
|
|
1290
|
-
let t =
|
|
1552
|
+
let t = v[e];
|
|
1291
1553
|
t && b.set(e, t);
|
|
1292
|
-
}), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(
|
|
1554
|
+
}), (o ?? []).forEach((e) => b.set(e.id, e)), b.set(pe.id, pe);
|
|
1293
1555
|
let x = Array.from(b.values()), S = async (i) => {
|
|
1294
|
-
|
|
1556
|
+
f(i), _(null);
|
|
1295
1557
|
try {
|
|
1296
1558
|
let o = b.get(i);
|
|
1297
|
-
if (!o) throw Error(
|
|
1559
|
+
if (!o) throw Error(m(s.unknownDestination, { id: i }));
|
|
1298
1560
|
if (i !== "json-export" && !l) throw Error(s.destinationNoScope);
|
|
1299
|
-
let
|
|
1561
|
+
let d = await o.apply(t, {
|
|
1300
1562
|
scopeId: l?.id ?? "",
|
|
1301
1563
|
dataProvider: l?.dataProvider,
|
|
1302
1564
|
storageProvider: l?.storageProvider ?? null,
|
|
1303
|
-
proxyFetch:
|
|
1565
|
+
proxyFetch: u
|
|
1304
1566
|
}, n);
|
|
1305
|
-
|
|
1567
|
+
h((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, ct(e, n));
|
|
1306
1568
|
} catch (e) {
|
|
1307
|
-
|
|
1569
|
+
_(e instanceof Error ? e.message : String(e));
|
|
1308
1570
|
} finally {
|
|
1309
|
-
|
|
1571
|
+
f(null);
|
|
1310
1572
|
}
|
|
1311
1573
|
};
|
|
1312
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ A("div", {
|
|
1313
1575
|
className: "space-y-2",
|
|
1314
1576
|
children: [
|
|
1315
|
-
/* @__PURE__ */
|
|
1577
|
+
/* @__PURE__ */ k("p", {
|
|
1316
1578
|
className: "text-xs font-medium text-muted-foreground",
|
|
1317
1579
|
children: s.destinationPickerTitle
|
|
1318
1580
|
}),
|
|
1319
|
-
/* @__PURE__ */
|
|
1581
|
+
/* @__PURE__ */ k("div", {
|
|
1320
1582
|
className: "flex flex-wrap gap-2",
|
|
1321
|
-
children: x.map((e) => /* @__PURE__ */
|
|
1583
|
+
children: x.map((e) => /* @__PURE__ */ k("button", {
|
|
1322
1584
|
type: "button",
|
|
1323
|
-
disabled:
|
|
1585
|
+
disabled: d !== null,
|
|
1324
1586
|
onClick: () => void S(e.id),
|
|
1325
1587
|
className: "cursor-pointer rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-60",
|
|
1326
|
-
children:
|
|
1588
|
+
children: d === e.id ? s.destinationApplying : `${p.has(e.id) ? "✓ " : ""}${e.id === "json-export" ? s.exportJson : e.label}`
|
|
1327
1589
|
}, e.id))
|
|
1328
1590
|
}),
|
|
1329
|
-
|
|
1591
|
+
g && /* @__PURE__ */ k("p", {
|
|
1330
1592
|
className: "text-xs text-destructive",
|
|
1331
|
-
children:
|
|
1593
|
+
children: g
|
|
1332
1594
|
})
|
|
1333
1595
|
]
|
|
1334
1596
|
});
|
|
1335
1597
|
}
|
|
1336
1598
|
//#endregion
|
|
1337
1599
|
//#region src/presentation/reports/subagentReportRegistry.tsx
|
|
1338
|
-
var
|
|
1339
|
-
function
|
|
1340
|
-
Object.assign(
|
|
1600
|
+
var ut = {};
|
|
1601
|
+
function dt(e) {
|
|
1602
|
+
Object.assign(ut, e);
|
|
1341
1603
|
}
|
|
1342
|
-
function
|
|
1343
|
-
return
|
|
1604
|
+
function ft(e) {
|
|
1605
|
+
return ut[e];
|
|
1344
1606
|
}
|
|
1345
1607
|
//#endregion
|
|
1346
1608
|
//#region src/presentation/reports/GenericResultPreview.tsx
|
|
1347
|
-
function
|
|
1348
|
-
let [t, n] =
|
|
1349
|
-
return /* @__PURE__ */
|
|
1609
|
+
function pt({ result: e }) {
|
|
1610
|
+
let [t, n] = D(!1);
|
|
1611
|
+
return /* @__PURE__ */ A("div", {
|
|
1350
1612
|
className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
|
|
1351
1613
|
onClick: () => n((e) => !e),
|
|
1352
1614
|
title: t ? "Clic per comprimere" : "Clic per espandere",
|
|
1353
|
-
children: [/* @__PURE__ */
|
|
1615
|
+
children: [/* @__PURE__ */ k(s, {
|
|
1354
1616
|
language: "json",
|
|
1355
1617
|
showCopy: t,
|
|
1356
1618
|
background: "transparent",
|
|
1357
1619
|
className: "!text-[11px]",
|
|
1358
1620
|
children: JSON.stringify(e, null, 2)
|
|
1359
|
-
}), !t && /* @__PURE__ */
|
|
1621
|
+
}), !t && /* @__PURE__ */ k("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-muted/30 to-transparent" })]
|
|
1360
1622
|
});
|
|
1361
1623
|
}
|
|
1362
1624
|
//#endregion
|
|
1363
1625
|
//#region src/presentation/liveAnchorDestination.ts
|
|
1364
|
-
function
|
|
1626
|
+
function mt(e, t, n) {
|
|
1365
1627
|
return e.length === 0 ? null : {
|
|
1366
1628
|
id: "live-component",
|
|
1367
1629
|
label: "Applica al componente aperto",
|
|
@@ -1371,127 +1633,166 @@ function rt(e, t, n) {
|
|
|
1371
1633
|
};
|
|
1372
1634
|
}
|
|
1373
1635
|
//#endregion
|
|
1636
|
+
//#region src/presentation/subagentControls.ts
|
|
1637
|
+
var ht = {};
|
|
1638
|
+
function gt(e) {
|
|
1639
|
+
Object.assign(ht, e);
|
|
1640
|
+
}
|
|
1641
|
+
function _t(e) {
|
|
1642
|
+
return ht[e];
|
|
1643
|
+
}
|
|
1644
|
+
//#endregion
|
|
1374
1645
|
//#region src/presentation/SubagentRunner.tsx
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1646
|
+
var vt = () => ({});
|
|
1647
|
+
function yt({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
|
|
1648
|
+
let c = nt(e.definition, { defaultEnabled: !0 }), l = $(), u = l.scope, d = y(), f = E(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = D(null), [h, g] = D([]), [_, v] = D(null), b = ft(e.id), x = b?.kind === "selection" ? b : null, [S, w] = D(null), j = E(!1), M = E(0), N = E(null);
|
|
1649
|
+
p && p !== N.current && (N.current = p, M.current = (r?.length ?? 0) + c.activity.length);
|
|
1650
|
+
let P = E(!1), F = c.remote || !c.hasProviders || c.selectedModel !== "";
|
|
1651
|
+
C(() => {
|
|
1652
|
+
!j.current && F && (j.current = !0, a ? c.resume(e.toParams(t), a) : (o && c.setSelectedModel(o), c.run(e.toParams(t), {
|
|
1653
|
+
model: o,
|
|
1654
|
+
openingMessage: s
|
|
1655
|
+
}).then((e) => {
|
|
1656
|
+
e && m(e);
|
|
1382
1657
|
})));
|
|
1383
|
-
}, [
|
|
1384
|
-
if (!
|
|
1385
|
-
let n = e.autoApplyDestinationIds ?? [], r =
|
|
1658
|
+
}, [F]), C(() => {
|
|
1659
|
+
if (!p || !u) return;
|
|
1660
|
+
let n = e.autoApplyDestinationIds ?? [], r = l.componentAnchors.find((t) => t.subagentId === e.id && t.pinnedEntityId)?.pinnedEntityId, i = ge();
|
|
1386
1661
|
n.forEach((n) => {
|
|
1387
1662
|
let a = i[n];
|
|
1388
|
-
a && (v(null), a.apply(
|
|
1389
|
-
scopeId:
|
|
1390
|
-
dataProvider:
|
|
1391
|
-
storageProvider:
|
|
1392
|
-
proxyFetch:
|
|
1663
|
+
a && (v(null), a.apply(p, {
|
|
1664
|
+
scopeId: u.id,
|
|
1665
|
+
dataProvider: u.dataProvider,
|
|
1666
|
+
storageProvider: u.storageProvider,
|
|
1667
|
+
proxyFetch: d
|
|
1393
1668
|
}, {
|
|
1394
1669
|
...t,
|
|
1395
1670
|
pinnedEntityId: r
|
|
1396
1671
|
}).then((n) => {
|
|
1397
|
-
n?.id &&
|
|
1672
|
+
n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, ct(e, t));
|
|
1398
1673
|
}).catch((e) => v(e instanceof Error ? e.message : String(e))));
|
|
1399
1674
|
});
|
|
1400
1675
|
}, [
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
]),
|
|
1405
|
-
|
|
1406
|
-
}, [
|
|
1407
|
-
let
|
|
1408
|
-
|
|
1676
|
+
p,
|
|
1677
|
+
c.activity,
|
|
1678
|
+
u
|
|
1679
|
+
]), C(() => {
|
|
1680
|
+
p && x && w(x.defaultSelection(p));
|
|
1681
|
+
}, [p, x]);
|
|
1682
|
+
let I = (e, t) => {
|
|
1683
|
+
w((n) => n && {
|
|
1409
1684
|
...n,
|
|
1410
1685
|
[e]: t
|
|
1411
1686
|
});
|
|
1412
|
-
},
|
|
1413
|
-
|
|
1687
|
+
}, L = (e) => m(e), R = T(() => p && x && S ? x.applySelection(p, S) : p, [
|
|
1688
|
+
p,
|
|
1414
1689
|
x,
|
|
1415
|
-
|
|
1416
|
-
]),
|
|
1417
|
-
|
|
1690
|
+
S
|
|
1691
|
+
]), z = T(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = T(() => mt(z, t, f), [
|
|
1692
|
+
z,
|
|
1418
1693
|
t,
|
|
1419
|
-
|
|
1420
|
-
]),
|
|
1694
|
+
f
|
|
1695
|
+
]), V = T(() => B ? [B, ...n ?? []] : n, [B, n]), H = e.chatEntityId?.(t), U = E(!1);
|
|
1696
|
+
C(() => {
|
|
1697
|
+
let n = U.current && !c.running;
|
|
1698
|
+
if (U.current = c.running, !n || !H || !u) return;
|
|
1699
|
+
let i = c.snapshot();
|
|
1700
|
+
i && we({
|
|
1701
|
+
scopeId: u.id,
|
|
1702
|
+
subagentId: e.id,
|
|
1703
|
+
entityId: H,
|
|
1704
|
+
params: t,
|
|
1705
|
+
title: ct(e, t),
|
|
1706
|
+
history: i.history,
|
|
1707
|
+
activity: [...r ?? [], ...i.activity]
|
|
1708
|
+
});
|
|
1709
|
+
}, [c.running]);
|
|
1710
|
+
let W = () => {
|
|
1711
|
+
P.current = !0, c.running && c.stop(), l.closeTask(f);
|
|
1712
|
+
}, G = E(_t(e.id) ?? vt).current, K = G({
|
|
1713
|
+
params: t,
|
|
1714
|
+
taskId: f,
|
|
1715
|
+
running: c.running,
|
|
1716
|
+
close: W
|
|
1717
|
+
}), q = (e) => {
|
|
1421
1718
|
g((t) => t.includes(e) ? t : [...t, e]);
|
|
1422
1719
|
};
|
|
1423
|
-
return
|
|
1424
|
-
|
|
1425
|
-
id:
|
|
1426
|
-
title:
|
|
1720
|
+
return C(() => {
|
|
1721
|
+
P.current || l.openTask({
|
|
1722
|
+
id: f,
|
|
1723
|
+
title: ct(e, t),
|
|
1427
1724
|
icon: e.icon,
|
|
1428
|
-
agent:
|
|
1429
|
-
onApplied: (e) =>
|
|
1725
|
+
agent: c,
|
|
1726
|
+
onApplied: (e) => m(e),
|
|
1430
1727
|
precedingActivity: r,
|
|
1431
|
-
panelExtraAnchorIndex:
|
|
1432
|
-
onDismiss:
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1728
|
+
panelExtraAnchorIndex: M.current,
|
|
1729
|
+
onDismiss: W,
|
|
1730
|
+
...H ? { savedToDisk: !0 } : {},
|
|
1731
|
+
panelActions: K.content,
|
|
1732
|
+
composerActions: K.actions,
|
|
1733
|
+
panelExtra: p ? /* @__PURE__ */ A(O, { children: [
|
|
1734
|
+
x && S ? /* @__PURE__ */ k(x.Report, {
|
|
1735
|
+
result: p,
|
|
1736
|
+
selection: S,
|
|
1737
|
+
onChange: I
|
|
1738
|
+
}) : b?.kind === "editable" ? /* @__PURE__ */ k(b.Report, {
|
|
1739
|
+
result: p,
|
|
1740
|
+
onResultChange: L
|
|
1741
|
+
}) : /* @__PURE__ */ k(pt, { result: R }),
|
|
1742
|
+
_ && /* @__PURE__ */ A("p", {
|
|
1445
1743
|
className: "text-xs text-destructive",
|
|
1446
1744
|
children: ["Salvataggio automatico non riuscito: ", _]
|
|
1447
1745
|
}),
|
|
1448
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ k(lt, {
|
|
1449
1747
|
manifest: e,
|
|
1450
|
-
result:
|
|
1748
|
+
result: R,
|
|
1451
1749
|
meta: t,
|
|
1452
|
-
taskId:
|
|
1453
|
-
initiallyApplied:
|
|
1454
|
-
onApplied:
|
|
1455
|
-
extraDestinations:
|
|
1750
|
+
taskId: f,
|
|
1751
|
+
initiallyApplied: h,
|
|
1752
|
+
onApplied: q,
|
|
1753
|
+
extraDestinations: V
|
|
1456
1754
|
})
|
|
1457
1755
|
] }) : void 0
|
|
1458
1756
|
});
|
|
1459
1757
|
}, [
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
c.
|
|
1468
|
-
|
|
1469
|
-
|
|
1758
|
+
c.activity,
|
|
1759
|
+
c.running,
|
|
1760
|
+
c.error,
|
|
1761
|
+
c.canContinue,
|
|
1762
|
+
c.selectedModel,
|
|
1763
|
+
c.modelsByProvider,
|
|
1764
|
+
c.hasProviders,
|
|
1765
|
+
c.remoteModels,
|
|
1766
|
+
l.openTask,
|
|
1767
|
+
l.componentAnchors,
|
|
1768
|
+
f,
|
|
1470
1769
|
e,
|
|
1471
1770
|
t,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1771
|
+
p,
|
|
1772
|
+
R,
|
|
1773
|
+
S,
|
|
1774
|
+
h,
|
|
1476
1775
|
n,
|
|
1477
1776
|
r,
|
|
1478
|
-
_
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1777
|
+
_,
|
|
1778
|
+
K.content,
|
|
1779
|
+
K.actions
|
|
1780
|
+
]), C(() => () => {
|
|
1781
|
+
l.closeTask(f);
|
|
1782
|
+
}, [l.closeTask, f]), null;
|
|
1482
1783
|
}
|
|
1483
1784
|
//#endregion
|
|
1484
1785
|
//#region src/presentation/OrchestratorRunner.tsx
|
|
1485
|
-
function
|
|
1486
|
-
let t =
|
|
1786
|
+
function bt({ userGoal: e }) {
|
|
1787
|
+
let t = Q(), n = nt(T(() => st({
|
|
1487
1788
|
unavailable: t.orchestratorUnavailable,
|
|
1488
1789
|
continueWithoutAi: t.orchestratorContinueWithoutAi,
|
|
1489
1790
|
preparing: t.orchestratorPreparing,
|
|
1490
1791
|
collecting: t.orchestratorCollecting
|
|
1491
|
-
}), []), { defaultEnabled: !0 }), r = $(), [i, a] =
|
|
1492
|
-
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(
|
|
1792
|
+
}), []), { defaultEnabled: !0 }), r = $(), [i, a] = D(null), o = E(!1), s = !n.hasProviders || n.selectedModel !== "", c = E(r.pendingExtraDestinations), l = E(r.pendingAttachments), u = E(r.pendingModel), d = E(r.pendingScopedSubagentId ?? r.scopedSubagentId ?? void 0), f = E(r.pendingCarryOver), p = E(!1), m = (e) => {
|
|
1793
|
+
e && typeof e == "object" && e.kind === "handoff" && (a(e), r.closeTask(Me));
|
|
1493
1794
|
};
|
|
1494
|
-
|
|
1795
|
+
C(() => {
|
|
1495
1796
|
!o.current && s && (o.current = !0, u.current && n.setSelectedModel(u.current), n.run({
|
|
1496
1797
|
userGoal: e,
|
|
1497
1798
|
pageContext: r.pageContext,
|
|
@@ -1503,9 +1804,9 @@ function at({ userGoal: e }) {
|
|
|
1503
1804
|
}).then((e) => {
|
|
1504
1805
|
e && m(e);
|
|
1505
1806
|
}));
|
|
1506
|
-
}, [s]),
|
|
1807
|
+
}, [s]), C(() => {
|
|
1507
1808
|
p.current || r.openTask({
|
|
1508
|
-
id:
|
|
1809
|
+
id: Me,
|
|
1509
1810
|
title: "Agentico",
|
|
1510
1811
|
icon: "bot",
|
|
1511
1812
|
agent: n,
|
|
@@ -1513,7 +1814,7 @@ function at({ userGoal: e }) {
|
|
|
1513
1814
|
scopedSubagentId: d.current,
|
|
1514
1815
|
precedingActivity: f.current?.activity,
|
|
1515
1816
|
onDismiss: () => {
|
|
1516
|
-
p.current = !0, n.running && n.stop(), r.closeTask(
|
|
1817
|
+
p.current = !0, n.running && n.stop(), r.closeTask(Me);
|
|
1517
1818
|
}
|
|
1518
1819
|
});
|
|
1519
1820
|
}, [
|
|
@@ -1525,13 +1826,13 @@ function at({ userGoal: e }) {
|
|
|
1525
1826
|
n.modelsByProvider,
|
|
1526
1827
|
n.hasProviders,
|
|
1527
1828
|
r.openTask
|
|
1528
|
-
]),
|
|
1529
|
-
r.closeTask(
|
|
1829
|
+
]), C(() => () => {
|
|
1830
|
+
r.closeTask(Me);
|
|
1530
1831
|
}, [r.closeTask]);
|
|
1531
|
-
let h =
|
|
1832
|
+
let h = T(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
|
|
1532
1833
|
if (!i) return null;
|
|
1533
|
-
let g =
|
|
1534
|
-
return g ? /* @__PURE__ */
|
|
1834
|
+
let g = B(i.subagentId);
|
|
1835
|
+
return g ? /* @__PURE__ */ k(yt, {
|
|
1535
1836
|
manifest: g,
|
|
1536
1837
|
params: i.params,
|
|
1537
1838
|
extraDestinations: c.current,
|
|
@@ -1542,8 +1843,8 @@ function at({ userGoal: e }) {
|
|
|
1542
1843
|
}
|
|
1543
1844
|
//#endregion
|
|
1544
1845
|
//#region src/presentation/ManualEntryRunner.tsx
|
|
1545
|
-
function
|
|
1546
|
-
let r =
|
|
1846
|
+
function xt({ manifest: e, extraDestinations: n }) {
|
|
1847
|
+
let r = nt(e.definition, { defaultEnabled: !1 }), i = Q(), a = $(), o = E(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = D(null), [l, u] = D([]), d = ft(e.id), f = d?.kind === "selection" ? d : null, [p, m] = D(null), [h, g] = D(null), _ = E(!1), v = (t) => {
|
|
1547
1848
|
if (!e.manualEntry) return;
|
|
1548
1849
|
let n;
|
|
1549
1850
|
try {
|
|
@@ -1556,7 +1857,7 @@ function ot({ manifest: e, extraDestinations: n }) {
|
|
|
1556
1857
|
e && c(e);
|
|
1557
1858
|
});
|
|
1558
1859
|
};
|
|
1559
|
-
|
|
1860
|
+
C(() => {
|
|
1560
1861
|
s && f && m(f.defaultSelection(s));
|
|
1561
1862
|
}, [s, f]);
|
|
1562
1863
|
let y = (e, t) => {
|
|
@@ -1564,18 +1865,18 @@ function ot({ manifest: e, extraDestinations: n }) {
|
|
|
1564
1865
|
...n,
|
|
1565
1866
|
[e]: t
|
|
1566
1867
|
});
|
|
1567
|
-
},
|
|
1868
|
+
}, b = (e) => c(e), x = T(() => s && f && p ? f.applySelection(s, p) : s, [
|
|
1568
1869
|
s,
|
|
1569
1870
|
f,
|
|
1570
1871
|
p
|
|
1571
|
-
]),
|
|
1872
|
+
]), S = (e) => {
|
|
1572
1873
|
u((t) => t.includes(e) ? t : [...t, e]);
|
|
1573
|
-
},
|
|
1574
|
-
|
|
1874
|
+
}, w = T(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), O = T(() => h ? mt(w, h, o) : null, [
|
|
1875
|
+
w,
|
|
1575
1876
|
h,
|
|
1576
1877
|
o
|
|
1577
|
-
]), j =
|
|
1578
|
-
return
|
|
1878
|
+
]), j = T(() => O ? [O, ...n ?? []] : n, [O, n]);
|
|
1879
|
+
return C(() => {
|
|
1579
1880
|
_.current || a.openTask({
|
|
1580
1881
|
id: o,
|
|
1581
1882
|
title: e.label,
|
|
@@ -1589,27 +1890,27 @@ function ot({ manifest: e, extraDestinations: n }) {
|
|
|
1589
1890
|
onDismiss: () => {
|
|
1590
1891
|
_.current = !0, r.running && r.stop(), a.closeTask(o);
|
|
1591
1892
|
},
|
|
1592
|
-
panelExtra: s ? /* @__PURE__ */
|
|
1893
|
+
panelExtra: s ? /* @__PURE__ */ A("div", {
|
|
1593
1894
|
className: "space-y-2",
|
|
1594
1895
|
children: [
|
|
1595
|
-
f && p ? /* @__PURE__ */
|
|
1896
|
+
f && p ? /* @__PURE__ */ k(f.Report, {
|
|
1596
1897
|
result: s,
|
|
1597
1898
|
selection: p,
|
|
1598
1899
|
onChange: y
|
|
1599
|
-
}) : d?.kind === "editable" ? /* @__PURE__ */
|
|
1900
|
+
}) : d?.kind === "editable" ? /* @__PURE__ */ k(d.Report, {
|
|
1600
1901
|
result: s,
|
|
1601
|
-
onResultChange:
|
|
1602
|
-
}) : /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1902
|
+
onResultChange: b
|
|
1903
|
+
}) : /* @__PURE__ */ k(pt, { result: x }),
|
|
1904
|
+
/* @__PURE__ */ k(lt, {
|
|
1604
1905
|
manifest: e,
|
|
1605
|
-
result:
|
|
1906
|
+
result: x,
|
|
1606
1907
|
meta: h ?? {},
|
|
1607
1908
|
taskId: o,
|
|
1608
1909
|
initiallyApplied: l,
|
|
1609
|
-
onApplied:
|
|
1910
|
+
onApplied: S,
|
|
1610
1911
|
extraDestinations: j
|
|
1611
1912
|
}),
|
|
1612
|
-
r.hasProviders && /* @__PURE__ */
|
|
1913
|
+
r.hasProviders && /* @__PURE__ */ k(t, {
|
|
1613
1914
|
label: i.resumeWithAi,
|
|
1614
1915
|
variant: "outline-secondary",
|
|
1615
1916
|
className: "text-xs",
|
|
@@ -1627,18 +1928,18 @@ function ot({ manifest: e, extraDestinations: n }) {
|
|
|
1627
1928
|
r.hasProviders,
|
|
1628
1929
|
a.componentAnchors,
|
|
1629
1930
|
s,
|
|
1630
|
-
|
|
1931
|
+
x,
|
|
1631
1932
|
p,
|
|
1632
1933
|
l,
|
|
1633
1934
|
h
|
|
1634
|
-
]),
|
|
1935
|
+
]), C(() => () => {
|
|
1635
1936
|
a.closeTask(o);
|
|
1636
1937
|
}, []), null;
|
|
1637
1938
|
}
|
|
1638
1939
|
//#endregion
|
|
1639
1940
|
//#region src/presentation/Agentico.tsx
|
|
1640
|
-
var
|
|
1641
|
-
function
|
|
1941
|
+
var St = 420;
|
|
1942
|
+
function Ct(e) {
|
|
1642
1943
|
return Object.values(e).flat().map((e) => ({
|
|
1643
1944
|
label: e.model,
|
|
1644
1945
|
value: e.id,
|
|
@@ -1646,51 +1947,52 @@ function ct(e) {
|
|
|
1646
1947
|
group: e.providerLabel ?? e.provider
|
|
1647
1948
|
}));
|
|
1648
1949
|
}
|
|
1649
|
-
function
|
|
1650
|
-
let t =
|
|
1651
|
-
if (
|
|
1950
|
+
function wt({ task: e }) {
|
|
1951
|
+
let t = Q(), [n, r] = D(""), { agent: i, onApplied: a, manualEntry: s } = e, c = i.running, l = (e) => {
|
|
1952
|
+
if (r(""), s) {
|
|
1652
1953
|
s.onSubmit(e.text);
|
|
1653
1954
|
return;
|
|
1654
1955
|
}
|
|
1655
|
-
|
|
1956
|
+
i.sendMessage(e.text, {
|
|
1656
1957
|
attachments: e.files,
|
|
1657
1958
|
model: e.model
|
|
1658
1959
|
}).then((e) => {
|
|
1659
|
-
e &&
|
|
1960
|
+
e && a(e);
|
|
1660
1961
|
});
|
|
1661
|
-
}, u =
|
|
1662
|
-
return /* @__PURE__ */
|
|
1962
|
+
}, u = !!s || i.remote && i.remoteModels.length === 0, d = !u && !i.remote && i.hasProviders && !i.selectedModel, f = u ? [] : i.remote ? i.remoteModels : Ct(i.modelsByProvider);
|
|
1963
|
+
return /* @__PURE__ */ k(o, {
|
|
1663
1964
|
value: n,
|
|
1664
|
-
onChange:
|
|
1965
|
+
onChange: r,
|
|
1665
1966
|
placeholder: s?.prompt ?? t.messagePlaceholder,
|
|
1666
1967
|
running: c,
|
|
1667
|
-
onStop:
|
|
1668
|
-
disabled: !n.trim() ||
|
|
1968
|
+
onStop: i.stop,
|
|
1969
|
+
disabled: !n.trim() || d,
|
|
1669
1970
|
onSubmit: l,
|
|
1670
|
-
attachments: !s,
|
|
1671
|
-
models:
|
|
1672
|
-
selectedModel:
|
|
1673
|
-
|
|
1971
|
+
attachments: !s && !i.remote,
|
|
1972
|
+
models: f,
|
|
1973
|
+
selectedModel: u ? "" : i.selectedModel,
|
|
1974
|
+
actions: e.composerActions,
|
|
1975
|
+
onModelChange: i.setSelectedModel,
|
|
1674
1976
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
1675
1977
|
minHeight: 44,
|
|
1676
1978
|
maxHeight: 220
|
|
1677
1979
|
});
|
|
1678
1980
|
}
|
|
1679
|
-
function
|
|
1680
|
-
let { startOrchestrator: e } = $(), t =
|
|
1981
|
+
function Tt() {
|
|
1982
|
+
let { startOrchestrator: e } = $(), t = Q(), [n, r] = D(""), { hasProviders: i, modelsByProvider: a, selectedModel: s, setSelectedModel: c } = Qe(), l = (t) => {
|
|
1681
1983
|
t.text.trim() && (e(t.text.trim(), {
|
|
1682
1984
|
attachments: t.files.length > 0 ? t.files : void 0,
|
|
1683
1985
|
model: t.model || void 0
|
|
1684
|
-
}),
|
|
1685
|
-
}, u =
|
|
1686
|
-
return /* @__PURE__ */
|
|
1986
|
+
}), r(""));
|
|
1987
|
+
}, u = i && !s;
|
|
1988
|
+
return /* @__PURE__ */ k(o, {
|
|
1687
1989
|
value: n,
|
|
1688
|
-
onChange:
|
|
1990
|
+
onChange: r,
|
|
1689
1991
|
placeholder: t.orchestratorStarterPlaceholder,
|
|
1690
1992
|
disabled: !n.trim() || u,
|
|
1691
1993
|
onSubmit: l,
|
|
1692
1994
|
attachments: !0,
|
|
1693
|
-
models:
|
|
1995
|
+
models: Ct(a),
|
|
1694
1996
|
selectedModel: s,
|
|
1695
1997
|
onModelChange: c,
|
|
1696
1998
|
modelPlaceholder: t.selectModelPlaceholder,
|
|
@@ -1698,55 +2000,67 @@ function ut() {
|
|
|
1698
2000
|
maxHeight: 220
|
|
1699
2001
|
});
|
|
1700
2002
|
}
|
|
1701
|
-
function
|
|
1702
|
-
let
|
|
1703
|
-
|
|
2003
|
+
function Et(e, t, n = Date.now()) {
|
|
2004
|
+
let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
|
|
2005
|
+
numeric: "auto",
|
|
2006
|
+
style: "short"
|
|
2007
|
+
});
|
|
2008
|
+
for (let [e, t] of [
|
|
2009
|
+
["day", 86400],
|
|
2010
|
+
["hour", 3600],
|
|
2011
|
+
["minute", 60]
|
|
2012
|
+
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
2013
|
+
return i.format(0, "minute");
|
|
2014
|
+
}
|
|
2015
|
+
function Dt({ card: e }) {
|
|
2016
|
+
let t = Q();
|
|
2017
|
+
return e.humanSummaryOnly ? /* @__PURE__ */ A("div", {
|
|
1704
2018
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
1705
|
-
children: [/* @__PURE__ */
|
|
2019
|
+
children: [/* @__PURE__ */ A("p", {
|
|
1706
2020
|
className: "text-xs font-medium text-foreground",
|
|
1707
2021
|
children: [
|
|
1708
2022
|
"\"",
|
|
1709
2023
|
e.label,
|
|
1710
2024
|
"\""
|
|
1711
2025
|
]
|
|
1712
|
-
}), /* @__PURE__ */
|
|
2026
|
+
}), /* @__PURE__ */ k("p", {
|
|
1713
2027
|
className: "text-xs text-muted-foreground",
|
|
1714
2028
|
children: e.humanSummary
|
|
1715
2029
|
})]
|
|
1716
|
-
}) : /* @__PURE__ */
|
|
2030
|
+
}) : /* @__PURE__ */ A("div", {
|
|
1717
2031
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
1718
2032
|
children: [
|
|
1719
|
-
/* @__PURE__ */
|
|
2033
|
+
/* @__PURE__ */ k("p", {
|
|
1720
2034
|
className: "text-xs font-medium text-foreground",
|
|
1721
|
-
children:
|
|
2035
|
+
children: m(t.newInstance, { label: e.label })
|
|
1722
2036
|
}),
|
|
1723
|
-
/* @__PURE__ */
|
|
2037
|
+
/* @__PURE__ */ k("p", {
|
|
1724
2038
|
className: "text-xs text-muted-foreground",
|
|
1725
2039
|
children: e.humanSummary
|
|
1726
2040
|
}),
|
|
1727
|
-
e.fields.length > 0 && /* @__PURE__ */
|
|
2041
|
+
e.fields.length > 0 && /* @__PURE__ */ k("ul", {
|
|
1728
2042
|
className: "space-y-1",
|
|
1729
|
-
children: e.fields.map((e) => /* @__PURE__ */
|
|
2043
|
+
children: e.fields.map((e) => /* @__PURE__ */ A("li", {
|
|
1730
2044
|
className: "flex items-start gap-1.5 text-xs",
|
|
1731
|
-
children: [/* @__PURE__ */
|
|
2045
|
+
children: [/* @__PURE__ */ k(n, {
|
|
1732
2046
|
variant: e.required ? "primary" : "secondary",
|
|
1733
2047
|
className: "mt-px shrink-0",
|
|
1734
2048
|
children: e.required ? "richiesto" : "opzionale"
|
|
1735
|
-
}), /* @__PURE__ */
|
|
2049
|
+
}), /* @__PURE__ */ A("span", {
|
|
1736
2050
|
className: "min-w-0",
|
|
1737
|
-
children: [/* @__PURE__ */
|
|
2051
|
+
children: [/* @__PURE__ */ k("span", {
|
|
1738
2052
|
className: "font-mono text-foreground",
|
|
1739
2053
|
children: e.key
|
|
1740
|
-
}), e.humanDescription ? /* @__PURE__ */
|
|
2054
|
+
}), e.humanDescription ? /* @__PURE__ */ A("span", {
|
|
1741
2055
|
className: "text-muted-foreground",
|
|
1742
2056
|
children: [" — ", e.humanDescription]
|
|
1743
2057
|
}) : null]
|
|
1744
2058
|
})]
|
|
1745
2059
|
}, e.key))
|
|
1746
2060
|
}),
|
|
1747
|
-
e.example && /* @__PURE__ */
|
|
2061
|
+
e.example && /* @__PURE__ */ A("p", {
|
|
1748
2062
|
className: "text-xs text-muted-foreground",
|
|
1749
|
-
children: ["Esempio: ", /* @__PURE__ */
|
|
2063
|
+
children: ["Esempio: ", /* @__PURE__ */ k("span", {
|
|
1750
2064
|
className: "font-mono",
|
|
1751
2065
|
children: e.example
|
|
1752
2066
|
})]
|
|
@@ -1754,188 +2068,244 @@ function dt({ card: e }) {
|
|
|
1754
2068
|
]
|
|
1755
2069
|
});
|
|
1756
2070
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return /* @__PURE__ */
|
|
2071
|
+
function Ot({ messages: e }) {
|
|
2072
|
+
return /* @__PURE__ */ k("div", {
|
|
1759
2073
|
className: "space-y-2 rounded-lg border border-border/60 p-3",
|
|
1760
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
2074
|
+
children: e.map((e, t) => /* @__PURE__ */ k("p", {
|
|
1761
2075
|
className: "text-xs text-muted-foreground",
|
|
1762
2076
|
children: e
|
|
1763
2077
|
}, t))
|
|
1764
2078
|
});
|
|
1765
2079
|
}
|
|
1766
|
-
function
|
|
1767
|
-
let
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
2080
|
+
function kt({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
|
|
2081
|
+
let d = Q(), { locale: f } = v(), [p, m] = D(""), [h, g] = D(0), _ = T(() => r ? Ee(e) : [], [
|
|
2082
|
+
e,
|
|
2083
|
+
r,
|
|
2084
|
+
h
|
|
2085
|
+
]), y = async (t) => {
|
|
2086
|
+
let r = B(t.subagentId), i = await r?.confirmArchive?.(t.entityId, t.params);
|
|
2087
|
+
if (!i || window.confirm(i)) {
|
|
2088
|
+
try {
|
|
2089
|
+
await r?.onArchive?.(t.entityId, t.params);
|
|
2090
|
+
} catch {
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
Te(e, t.subagentId, t.entityId), n === De(t.subagentId, t.entityId) && s(), g((e) => e + 1);
|
|
2094
|
+
}
|
|
2095
|
+
}, b = T(() => {
|
|
2096
|
+
let e = p.trim().toLowerCase();
|
|
2097
|
+
return e ? _.filter((t) => {
|
|
2098
|
+
let n = B(t.subagentId)?.label ?? t.subagentId;
|
|
1771
2099
|
return t.title.toLowerCase().includes(e) || n.toLowerCase().includes(e);
|
|
1772
|
-
}) :
|
|
1773
|
-
}, [
|
|
1774
|
-
return /* @__PURE__ */
|
|
2100
|
+
}) : _;
|
|
2101
|
+
}, [_, p]);
|
|
2102
|
+
return /* @__PURE__ */ k(c, {
|
|
1775
2103
|
trigger: {
|
|
1776
2104
|
icon: "history",
|
|
1777
|
-
title:
|
|
2105
|
+
title: d.chatHistory
|
|
1778
2106
|
},
|
|
1779
2107
|
triggerClassName: "!h-9 !w-9 !p-0 rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
1780
|
-
open:
|
|
1781
|
-
onOpenChange:
|
|
2108
|
+
open: r,
|
|
2109
|
+
onOpenChange: i,
|
|
1782
2110
|
position: "end",
|
|
1783
2111
|
strategy: "absolute",
|
|
1784
2112
|
menuClassName: "w-[380px] max-h-[70vh] overflow-y-auto",
|
|
1785
|
-
header: /* @__PURE__ */
|
|
2113
|
+
header: /* @__PURE__ */ A("div", {
|
|
1786
2114
|
className: "flex items-center gap-2 px-1 pb-1.5",
|
|
1787
2115
|
children: [
|
|
1788
|
-
/* @__PURE__ */
|
|
2116
|
+
/* @__PURE__ */ k(u, {
|
|
1789
2117
|
name: "search",
|
|
1790
2118
|
size: 14,
|
|
1791
2119
|
className: "shrink-0 text-muted-foreground"
|
|
1792
2120
|
}),
|
|
1793
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ k("input", {
|
|
1794
2122
|
autoFocus: !0,
|
|
1795
|
-
value:
|
|
1796
|
-
onChange: (e) =>
|
|
1797
|
-
placeholder:
|
|
2123
|
+
value: p,
|
|
2124
|
+
onChange: (e) => m(e.target.value),
|
|
2125
|
+
placeholder: d.searchChats,
|
|
1798
2126
|
className: "min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
1799
2127
|
}),
|
|
1800
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ k(t, {
|
|
1801
2129
|
icon: "square-pen",
|
|
1802
|
-
ariaLabel:
|
|
1803
|
-
title:
|
|
2130
|
+
ariaLabel: d.newChat,
|
|
2131
|
+
title: d.newChat,
|
|
1804
2132
|
variant: "link",
|
|
1805
2133
|
className: "shrink-0",
|
|
1806
|
-
onClick:
|
|
2134
|
+
onClick: o
|
|
1807
2135
|
})
|
|
1808
2136
|
]
|
|
1809
2137
|
}),
|
|
1810
|
-
children:
|
|
2138
|
+
children: b.length === 0 ? /* @__PURE__ */ k("p", {
|
|
1811
2139
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
1812
|
-
children:
|
|
1813
|
-
}) :
|
|
1814
|
-
let t =
|
|
1815
|
-
return /* @__PURE__ */
|
|
1816
|
-
icon: t?.icon ?? "bot",
|
|
1817
|
-
|
|
1818
|
-
|
|
2140
|
+
children: _.length === 0 ? d.noSavedChats : d.noResults
|
|
2141
|
+
}) : b.map((e) => {
|
|
2142
|
+
let t = B(e.subagentId), r = n === De(e.subagentId, e.entityId);
|
|
2143
|
+
return /* @__PURE__ */ k(l, {
|
|
2144
|
+
icon: r ? "check" : t?.icon ?? "bot",
|
|
2145
|
+
className: r ? "bg-accent font-medium" : void 0,
|
|
2146
|
+
actions: [{
|
|
2147
|
+
icon: "archive",
|
|
2148
|
+
label: d.archiveChat,
|
|
2149
|
+
onClick: () => void y(e)
|
|
2150
|
+
}],
|
|
2151
|
+
onClick: () => a(e.subagentId, e.entityId, e),
|
|
2152
|
+
children: /* @__PURE__ */ A("span", {
|
|
1819
2153
|
className: "flex min-w-0 flex-1 items-center justify-between gap-2",
|
|
1820
|
-
children: [/* @__PURE__ */
|
|
2154
|
+
children: [/* @__PURE__ */ A("span", {
|
|
1821
2155
|
className: "min-w-0 truncate",
|
|
1822
2156
|
children: [
|
|
1823
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ k("span", {
|
|
1824
2158
|
className: "text-muted-foreground",
|
|
1825
2159
|
children: t?.label ?? e.subagentId
|
|
1826
2160
|
}),
|
|
1827
2161
|
" · ",
|
|
1828
2162
|
e.title || e.entityId
|
|
1829
2163
|
]
|
|
1830
|
-
}), /* @__PURE__ */
|
|
2164
|
+
}), /* @__PURE__ */ k("span", {
|
|
1831
2165
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
1832
|
-
|
|
2166
|
+
title: new Date(e.savedAt).toLocaleString(f),
|
|
2167
|
+
children: Et(e.savedAt, f)
|
|
1833
2168
|
})]
|
|
1834
2169
|
})
|
|
1835
2170
|
}, `${e.subagentId}:${e.entityId}`);
|
|
1836
2171
|
})
|
|
1837
2172
|
});
|
|
1838
2173
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let { task: e, isOpen: n, pendingGoal: r, orchestratorRunId: i, pageContext: a, pageContextCard: o, anchoredUserMessages: s, pendingResume: c, resumeRunId: l, dismissForeignTask: u, resumeEntityChat: d, pendingManualEntry: f, manualEntryRunId: p, startManualEntry: m, pendingExtraDestinations: h, pendingResumeWithAI: g, resumeWithAIRunId: _,
|
|
1841
|
-
(!e || e.agent.running || e.savedToDisk || window.confirm(
|
|
1842
|
-
},
|
|
1843
|
-
|
|
1844
|
-
|
|
2174
|
+
function At() {
|
|
2175
|
+
let { task: e, isOpen: n, pendingGoal: r, orchestratorRunId: i, pageContext: a, pageContextCard: o, anchoredUserMessages: s, pendingResume: c, resumeRunId: l, dismissForeignTask: u, resumeEntityChat: d, pendingManualEntry: f, manualEntryRunId: p, startManualEntry: m, pendingExtraDestinations: h, pendingResumeWithAI: g, resumeWithAIRunId: _, pendingStart: v, startRunId: y, scope: b } = $(), x = Q(), S = E(null), [w, T] = D(!1), j = () => {
|
|
2176
|
+
(!e || e.agent.running || e.savedToDisk || window.confirm(x.unsavedConversationConfirm)) && (u(), T(!1));
|
|
2177
|
+
}, M = e ? [...e.precedingActivity ?? [], ...e.agent.activity] : [], N = M.length, P = Math.max(0, Math.min(e?.panelExtraAnchorIndex ?? N, N)), F = M.slice(0, P), I = M.slice(P), L = !!(e && !e.agent.running && e.agent.error), R = new Set(e?.agent.activity.map((e) => e.id) ?? []), z = e ? {
|
|
2178
|
+
canAnswer: (e) => R.has(e),
|
|
2179
|
+
onAnswer: (t, n, r) => e.agent.answerQuestions(t, n, r).then((t) => {
|
|
2180
|
+
t && e.onApplied(t);
|
|
2181
|
+
})
|
|
2182
|
+
} : void 0, V = e?.id === "agentico-orchestrator" && e.scopedSubagentId ? B(e.scopedSubagentId) : void 0, H = V?.manualEntry ? V : null, U = E(!0);
|
|
2183
|
+
C(() => {
|
|
2184
|
+
let e = S.current;
|
|
1845
2185
|
if (!e) return;
|
|
1846
2186
|
let t = () => {
|
|
1847
|
-
|
|
2187
|
+
U.current = e.scrollHeight - e.scrollTop - e.clientHeight < 80;
|
|
1848
2188
|
};
|
|
1849
2189
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
1850
|
-
}, [e?.id]),
|
|
1851
|
-
let e =
|
|
1852
|
-
e && (
|
|
1853
|
-
}, [e?.id])
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
2190
|
+
}, [e?.id]), C(() => {
|
|
2191
|
+
let e = S.current;
|
|
2192
|
+
e && (U.current = !0, e.scrollTop = e.scrollHeight);
|
|
2193
|
+
}, [e?.id]);
|
|
2194
|
+
let W = M.at(-1)?.detail?.length ?? 0;
|
|
2195
|
+
C(() => {
|
|
2196
|
+
let e = S.current;
|
|
2197
|
+
e && U.current && (e.scrollTop = e.scrollHeight);
|
|
2198
|
+
}, [
|
|
2199
|
+
N,
|
|
2200
|
+
L,
|
|
2201
|
+
W
|
|
2202
|
+
]);
|
|
2203
|
+
let G = E(null);
|
|
2204
|
+
C(() => {
|
|
2205
|
+
let e = S.current, t = G.current;
|
|
2206
|
+
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
2207
|
+
let n = new ResizeObserver(() => {
|
|
2208
|
+
U.current && (e.scrollTop = e.scrollHeight);
|
|
2209
|
+
});
|
|
2210
|
+
return n.observe(t), () => n.disconnect();
|
|
2211
|
+
}, [e?.id, n]);
|
|
2212
|
+
let K = r ? /* @__PURE__ */ k(bt, { userGoal: r }, i) : null, q = c ? B(c.subagentId) : void 0, J = c && q ? /* @__PURE__ */ k(yt, {
|
|
2213
|
+
manifest: q,
|
|
1859
2214
|
params: c.snapshot.params,
|
|
1860
|
-
taskId:
|
|
2215
|
+
taskId: De(c.subagentId, c.entityId),
|
|
1861
2216
|
resumeSeed: {
|
|
1862
2217
|
history: c.snapshot.history,
|
|
1863
2218
|
activity: c.snapshot.activity
|
|
1864
2219
|
}
|
|
1865
|
-
}, l) : null,
|
|
1866
|
-
manifest:
|
|
2220
|
+
}, l) : null, Y = f ? B(f.subagentId) : void 0, ee = f && Y ? /* @__PURE__ */ k(xt, {
|
|
2221
|
+
manifest: Y,
|
|
1867
2222
|
extraDestinations: f.extraDestinations
|
|
1868
|
-
}, p) : null,
|
|
1869
|
-
manifest:
|
|
2223
|
+
}, p) : null, X = g ? B(g.subagentId) : void 0, te = g && X ? /* @__PURE__ */ k(yt, {
|
|
2224
|
+
manifest: X,
|
|
1870
2225
|
params: g.params,
|
|
1871
2226
|
extraDestinations: g.extraDestinations
|
|
1872
|
-
}, _) : null
|
|
1873
|
-
|
|
1874
|
-
|
|
2227
|
+
}, _) : null, ne = v ? B(v.subagentId) : void 0, re = v && ne ? /* @__PURE__ */ k(yt, {
|
|
2228
|
+
manifest: ne,
|
|
2229
|
+
params: v.params,
|
|
2230
|
+
taskId: v.taskId,
|
|
2231
|
+
openingMessage: v.openingMessage
|
|
2232
|
+
}, y) : null;
|
|
2233
|
+
return n ? /* @__PURE__ */ A(O, { children: [
|
|
2234
|
+
K,
|
|
2235
|
+
J,
|
|
1875
2236
|
ee,
|
|
1876
2237
|
te,
|
|
1877
|
-
|
|
1878
|
-
/* @__PURE__ */
|
|
2238
|
+
re,
|
|
2239
|
+
/* @__PURE__ */ A("div", {
|
|
1879
2240
|
style: { width: 420 },
|
|
1880
2241
|
className: "relative flex h-full shrink-0 flex-col border-l border-border bg-background",
|
|
1881
2242
|
children: [
|
|
1882
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ A("div", {
|
|
1883
2244
|
className: "flex min-h-[60px] items-center gap-1 border-b border-border/60 px-4 py-3",
|
|
1884
2245
|
children: [
|
|
1885
|
-
/* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ k("span", {
|
|
1886
2247
|
className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
|
|
1887
2248
|
children: e ? e.title : "Agentico"
|
|
1888
2249
|
}),
|
|
1889
|
-
|
|
1890
|
-
scopeId:
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
2250
|
+
b && /* @__PURE__ */ k(kt, {
|
|
2251
|
+
scopeId: b.id,
|
|
2252
|
+
currentTaskId: e?.id ?? null,
|
|
2253
|
+
open: w,
|
|
2254
|
+
onOpenChange: T,
|
|
2255
|
+
onNewChat: j,
|
|
2256
|
+
onSelect: (e, t, n) => d(e, t, n),
|
|
2257
|
+
onArchivedCurrent: u
|
|
1895
2258
|
}),
|
|
1896
|
-
/* @__PURE__ */
|
|
2259
|
+
/* @__PURE__ */ k(Je, {})
|
|
1897
2260
|
]
|
|
1898
2261
|
}),
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
ref:
|
|
2262
|
+
/* @__PURE__ */ k("div", {
|
|
2263
|
+
ref: S,
|
|
1901
2264
|
className: "flex-1 overflow-y-auto px-3 pb-2",
|
|
1902
|
-
children: /* @__PURE__ */
|
|
2265
|
+
children: /* @__PURE__ */ k("div", {
|
|
2266
|
+
ref: G,
|
|
1903
2267
|
className: "pt-2",
|
|
1904
|
-
children: e ? /* @__PURE__ */
|
|
1905
|
-
e.manualEntry &&
|
|
2268
|
+
children: e ? /* @__PURE__ */ A(O, { children: [
|
|
2269
|
+
e.manualEntry && M.length === 0 && /* @__PURE__ */ k("p", {
|
|
1906
2270
|
className: "text-xs text-muted-foreground",
|
|
1907
2271
|
children: e.manualEntry.prompt
|
|
1908
2272
|
}),
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
|
|
2273
|
+
/* @__PURE__ */ k(qe, {
|
|
2274
|
+
activity: F,
|
|
2275
|
+
questions: z
|
|
2276
|
+
}),
|
|
2277
|
+
e.panelExtra && /* @__PURE__ */ k("div", {
|
|
1911
2278
|
className: "mt-3",
|
|
1912
2279
|
children: e.panelExtra
|
|
1913
2280
|
}),
|
|
1914
|
-
|
|
1915
|
-
|
|
2281
|
+
I.length > 0 && /* @__PURE__ */ k(qe, {
|
|
2282
|
+
activity: I,
|
|
2283
|
+
questions: z
|
|
2284
|
+
}),
|
|
2285
|
+
!e.agent.running && e.agent.error && /* @__PURE__ */ A("div", {
|
|
1916
2286
|
className: "mt-2 flex items-center gap-2",
|
|
1917
2287
|
children: [
|
|
1918
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ k("p", {
|
|
1919
2289
|
className: "flex-1 text-xs text-destructive",
|
|
1920
2290
|
children: e.agent.error
|
|
1921
2291
|
}),
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
label:
|
|
2292
|
+
/* @__PURE__ */ k(t, {
|
|
2293
|
+
label: x.retry,
|
|
1924
2294
|
variant: "secondary",
|
|
1925
2295
|
className: "shrink-0",
|
|
1926
2296
|
onClick: () => {
|
|
1927
|
-
e.agent.sendMessage(
|
|
2297
|
+
e.agent.sendMessage(x.retryMessage).then((t) => {
|
|
1928
2298
|
t && e.onApplied(t);
|
|
1929
2299
|
});
|
|
1930
2300
|
}
|
|
1931
2301
|
}),
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
label:
|
|
2302
|
+
!e.agent.remote && /* @__PURE__ */ k(t, {
|
|
2303
|
+
label: x.continueWithoutAi,
|
|
1934
2304
|
variant: "secondary",
|
|
1935
2305
|
className: "shrink-0",
|
|
1936
2306
|
onClick: () => {
|
|
1937
|
-
if (
|
|
1938
|
-
m(
|
|
2307
|
+
if (H) {
|
|
2308
|
+
m(H.id, h);
|
|
1939
2309
|
return;
|
|
1940
2310
|
}
|
|
1941
2311
|
let t = e.agent.runFallback();
|
|
@@ -1944,36 +2314,40 @@ function mt() {
|
|
|
1944
2314
|
})
|
|
1945
2315
|
]
|
|
1946
2316
|
})
|
|
1947
|
-
] }) : s.length > 0 ? /* @__PURE__ */
|
|
2317
|
+
] }) : s.length > 0 ? /* @__PURE__ */ k(Ot, { messages: s }) : o ? /* @__PURE__ */ k(Dt, { card: o }) : /* @__PURE__ */ k("p", {
|
|
1948
2318
|
className: "text-xs text-muted-foreground",
|
|
1949
|
-
children: a ??
|
|
2319
|
+
children: a ?? x.orchestratorStarterHint
|
|
1950
2320
|
})
|
|
1951
2321
|
})
|
|
1952
2322
|
}),
|
|
1953
|
-
/* @__PURE__ */
|
|
2323
|
+
/* @__PURE__ */ A("div", {
|
|
1954
2324
|
className: "border-t border-border/60 px-4 py-3",
|
|
1955
|
-
children: e
|
|
2325
|
+
children: [e?.panelActions && /* @__PURE__ */ k("div", {
|
|
2326
|
+
className: "mb-2",
|
|
2327
|
+
children: e.panelActions
|
|
2328
|
+
}), e ? /* @__PURE__ */ k(wt, { task: e }, e.id) : /* @__PURE__ */ k(Tt, {})]
|
|
1956
2329
|
})
|
|
1957
2330
|
]
|
|
1958
2331
|
})
|
|
1959
|
-
] }) : /* @__PURE__ */
|
|
1960
|
-
|
|
2332
|
+
] }) : /* @__PURE__ */ A(O, { children: [
|
|
2333
|
+
K,
|
|
2334
|
+
J,
|
|
1961
2335
|
ee,
|
|
1962
2336
|
te,
|
|
1963
|
-
|
|
2337
|
+
re
|
|
1964
2338
|
] });
|
|
1965
2339
|
}
|
|
1966
2340
|
//#endregion
|
|
1967
2341
|
//#region src/presentation/useAgenticoPageContext.ts
|
|
1968
|
-
function
|
|
1969
|
-
let { setPageContext: n } = $(), r =
|
|
1970
|
-
|
|
2342
|
+
function jt(e, t) {
|
|
2343
|
+
let { setPageContext: n } = $(), r = E(crypto.randomUUID()).current;
|
|
2344
|
+
C(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
|
|
1971
2345
|
}
|
|
1972
2346
|
//#endregion
|
|
1973
2347
|
//#region src/presentation/useSubagentComponentContext.ts
|
|
1974
|
-
function
|
|
1975
|
-
let { registerComponentAnchor: o } = $(), s =
|
|
1976
|
-
c.current = n,
|
|
2348
|
+
function Mt(e, t, n, r, i = !0, a) {
|
|
2349
|
+
let { registerComponentAnchor: o } = $(), s = E(crypto.randomUUID()).current, c = E(n);
|
|
2350
|
+
c.current = n, C(() => {
|
|
1977
2351
|
if (i) return o(s, {
|
|
1978
2352
|
subagentId: e,
|
|
1979
2353
|
componentKey: t,
|
|
@@ -1990,6 +2364,6 @@ function gt(e, t, n, r, i = !0, a) {
|
|
|
1990
2364
|
]);
|
|
1991
2365
|
}
|
|
1992
2366
|
//#endregion
|
|
1993
|
-
export {
|
|
2367
|
+
export { St as AGENTICO_WIDTH, At as Agentico, Pe as AgenticoProvider, Je as AgenticoToggle, M as DEFAULT_REASONING_PART_ID, j as DEFAULT_TEXT_PART_ID, fe as JSON_EXPORT_DESTINATION_ID, ce as MICRO_PROMPT_REGISTRY, Me as ORCHESTRATOR_TASK_ID, se as SUMMARY_MICRO_PROMPT, Oe as agenticoDe, ke as agenticoEn, Ae as agenticoIt, q as agenticoPromptsEn, J as agenticoPromptsIt, je as agenticoTranslations, le as applyMicroPrompts, ee as configureAgenticoPrompts, ve as configureEntityChatStore, U as createCrossAgentTools, I as defineSubagent, De as entityChatTaskId, Z as extractErrorMessage, ue as extractJsonBlock, B as findSubagentManifest, F as formatQuestionAnswers, X as getAgenticoPrompts, ge as getDestinationRegistry, Ce as getEntityChat, _t as getSubagentControls, z as getSubagentRegistry, ft as getSubagentReport, pe as jsonExportDestination, Ee as listEntityChats, P as messagePartsText, H as registerCrossAgentTools, he as registerDestinations, gt as registerSubagentControls, dt as registerSubagentReports, R as registerSubagents, Te as removeEntityChat, oe as renderRegistryCli, ae as renderSubagentCli, te as resetAgenticoPrompts, we as saveEntityChat, W as toJsonSchema, G as toMcpTool, N as upsertMessagePart, nt as useAgent, $ as useAgentico, Q as useAgenticoI18n, jt as useAgenticoPageContext, Mt as useSubagentComponentContext };
|
|
1994
2368
|
|
|
1995
2369
|
//# sourceMappingURL=index.mjs.map
|