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